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).
43 BL_PROFILE(
"make_buoyancy()");
45 const Array<Real,AMREX_SPACEDIM> grav{0.0, 0.0, -solverChoice.
gravity};
46 const GpuArray<Real,AMREX_SPACEDIM> grav_gpu{grav[0], grav[1], grav[2]};
48 const int klo = geom.Domain().smallEnd()[2];
49 const int khi = geom.Domain().bigEnd()[2] + 1;
51 Real rd_over_cp = solverChoice.
rdOcp;
60 #pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
62 for ( MFIter mfi(buoyancy,TilingIfNotGPU()); mfi.isValid(); ++mfi)
64 Box tbz = mfi.tilebox();
67 if (tbz.smallEnd(2) == klo) tbz.growLo(2,-1);
68 if (tbz.bigEnd(2) == khi) tbz.growHi(2,-1);
70 const Array4<const Real> & cell_data = S_data[
IntVars::cons].array(mfi);
71 const Array4<const Real> & cell_prim = S_prim.array(mfi);
72 const Array4<const Real> & qt_arr =
qt.array(mfi);
73 const Array4< Real> & buoyancy_fab = buoyancy.array(mfi);
76 const Array4<const Real>& r0_arr = r0.const_array(mfi);
77 const Array4<const Real>& p0_arr =
p0.const_array(mfi);
78 const Array4<const Real>& th0_arr = th0.const_array(mfi);
79 const Array4<const Real>& qv0_arr = qv0.const_array(mfi);
83 if ( anelastic && (solverChoice.
moisture_type == MoistureType::None) )
88 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
94 r0_arr,th0_arr,cell_data);
97 else if ( anelastic && (solverChoice.
moisture_type != MoistureType::None) )
102 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
113 r0_arr,th0_arr,qv0_arr,cell_prim,qt_arr);
116 else if ( !anelastic && (solverChoice.
moisture_type == MoistureType::None) )
123 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
129 r0_arr,cell_data,qt_arr);
134 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
140 r0_arr,p0_arr,th0_arr,cell_data);
145 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
151 r0_arr,th0_arr,cell_data);
161 if ( (solverChoice.
moisture_type == MoistureType::Kessler_NoRain) ||
163 (solverChoice.
moisture_type == MoistureType::SAM_NoPrecip_NoIce) )
170 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
173 r0_arr,cell_data,qt_arr);
179 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
182 r0_arr,th0_arr,qv0_arr,p0_arr,
183 cell_prim,cell_data,qt_arr);
188 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
191 r0_arr,th0_arr,qv0_arr,cell_prim,qt_arr);
201 Array4<const EBCellFlag> cellflg = (ebfact.
get_const_factory())->getMultiEBCellFlagFab()[mfi].const_array();
203 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
205 buoyancy_fab(i, j, k) =
buoyancy_rhopert_eb(i,j,k,grav_gpu[2],r0_arr,cell_data,qt_arr,cellflg);
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:165
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:202
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:147
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_rhopert_eb(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, amrex::Array4< amrex::EBCellFlag const > const &flag)
Definition: ERF_BuoyancyUtils.H:86
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:121
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
const std::unique_ptr< amrex::EBFArrayBoxFactory > & get_const_factory() const noexcept
Definition: ERF_EB.H:46
@ 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:808
amrex::Real gravity
Definition: ERF_DataStruct.H:806
MoistureType moisture_type
Definition: ERF_DataStruct.H:850
static TerrainType terrain_type
Definition: ERF_DataStruct.H:751
int buoyancy_type
Definition: ERF_DataStruct.H:782