Function for computing the buoyancy term to be used in the evolution equation for the z-component of momentum in the slow integrator. There are three options for how buoyancy is computed (two are the same in the absence of moisture).
41 BL_PROFILE(
"make_buoyancy()");
43 const Array<Real,AMREX_SPACEDIM> grav{0.0, 0.0, -solverChoice.
gravity};
44 const GpuArray<Real,AMREX_SPACEDIM> grav_gpu{grav[0], grav[1], grav[2]};
46 const int klo = geom.Domain().smallEnd()[2];
47 const int khi = geom.Domain().bigEnd()[2] + 1;
49 Real rd_over_cp = solverChoice.
rdOcp;
58 #pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
60 for ( MFIter mfi(buoyancy,TilingIfNotGPU()); mfi.isValid(); ++mfi)
62 Box tbz = mfi.tilebox();
65 if (tbz.smallEnd(2) == klo) tbz.growLo(2,-1);
66 if (tbz.bigEnd(2) == khi) tbz.growHi(2,-1);
68 const Array4<const Real> & cell_data = S_data[
IntVars::cons].array(mfi);
69 const Array4<const Real> & cell_prim = S_prim.array(mfi);
70 const Array4<const Real> & qt_arr =
qt.array(mfi);
71 const Array4< Real> & buoyancy_fab = buoyancy.array(mfi);
74 const Array4<const Real>& r0_arr = r0.const_array(mfi);
75 const Array4<const Real>& p0_arr =
p0.const_array(mfi);
76 const Array4<const Real>& th0_arr = th0.const_array(mfi);
77 const Array4<const Real>& qv0_arr = qv0.const_array(mfi);
79 if ( anelastic && (solverChoice.
moisture_type == MoistureType::None) )
84 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
90 r0_arr,th0_arr,cell_data);
93 else if ( anelastic && (solverChoice.
moisture_type != MoistureType::None) )
98 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
109 r0_arr,th0_arr,qv0_arr,cell_prim,qt_arr);
112 else if ( !anelastic && (solverChoice.
moisture_type == MoistureType::None) )
119 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
125 r0_arr,cell_data,qt_arr);
130 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
136 r0_arr,p0_arr,th0_arr,cell_data);
141 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
147 r0_arr,th0_arr,cell_data);
157 if ( (solverChoice.
moisture_type == MoistureType::Kessler_NoRain) ||
159 (solverChoice.
moisture_type == MoistureType::SAM_NoPrecip_NoIce) )
166 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
169 r0_arr,cell_data,qt_arr);
175 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
178 r0_arr,th0_arr,qv0_arr,p0_arr,
179 cell_prim,cell_data,qt_arr);
184 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
187 r0_arr,th0_arr,qv0_arr,cell_prim,qt_arr);
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_moist_Tpert(int &i, int &j, int &k, const int &n_qstate, amrex::Real const &grav_gpu, amrex::Real const &rd_over_cp, const amrex::Array4< const amrex::Real > &r0_arr, const amrex::Array4< const amrex::Real > &th0_arr, const amrex::Array4< const amrex::Real > &qv0_arr, const amrex::Array4< const amrex::Real > &p0_arr, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< const amrex::Real > &cell_data, const amrex::Array4< const amrex::Real > &qt_arr)
Definition: ERF_BuoyancyUtils.H:130
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_moist_Thpert(int &i, int &j, int &k, const int &n_qstate, amrex::Real const &grav_gpu, const amrex::Array4< const amrex::Real > &r0_arr, const amrex::Array4< const amrex::Real > &th0_arr, const amrex::Array4< const amrex::Real > &qv0_arr, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< const amrex::Real > &qt_arr)
Definition: ERF_BuoyancyUtils.H:167
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_dry_anelastic(int &i, int &j, int &k, amrex::Real const &grav_gpu, const amrex::Array4< const amrex::Real > &r0_arr, const amrex::Array4< const amrex::Real > &th0_arr, const amrex::Array4< const amrex::Real > &cell_data)
Definition: ERF_BuoyancyUtils.H:10
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_dry_Thpert(int &i, int &j, int &k, amrex::Real const &grav_gpu, const amrex::Array4< const amrex::Real > &r0_arr, const amrex::Array4< const amrex::Real > &th0_arr, const amrex::Array4< const amrex::Real > &cell_prim)
Definition: ERF_BuoyancyUtils.H:112
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_dry_Tpert(int &i, int &j, int &k, amrex::Real const &grav_gpu, amrex::Real const &rd_over_cp, const amrex::Array4< const amrex::Real > &r0_arr, const amrex::Array4< const amrex::Real > &p0_arr, const amrex::Array4< const amrex::Real > &th0_arr, const amrex::Array4< const amrex::Real > &cell_data)
Definition: ERF_BuoyancyUtils.H:86
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_rhopert(int &i, int &j, int &k, amrex::Real const &grav_gpu, const amrex::Array4< const amrex::Real > &r0_arr, const amrex::Array4< const amrex::Real > &cell_data, const amrex::Array4< const amrex::Real > &qt_arr)
Definition: ERF_BuoyancyUtils.H:72
@ qv0_comp
Definition: ERF_IndexDefines.H:67
@ p0_comp
Definition: ERF_IndexDefines.H:64
@ th0_comp
Definition: ERF_IndexDefines.H:66
@ r0_comp
Definition: ERF_IndexDefines.H:63
@ cons
Definition: ERF_IndexDefines.H:158
@ qt
Definition: ERF_Kessler.H:27
real(c_double), parameter p0
Definition: ERF_module_model_constants.F90:40
amrex::Real rdOcp
Definition: ERF_DataStruct.H:756
amrex::Real gravity
Definition: ERF_DataStruct.H:754
MoistureType moisture_type
Definition: ERF_DataStruct.H:798
int buoyancy_type
Definition: ERF_DataStruct.H:730