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;
57 #pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
59 for ( MFIter mfi(buoyancy,TilingIfNotGPU()); mfi.isValid(); ++mfi)
61 Box tbz = mfi.tilebox();
64 if (tbz.smallEnd(2) == klo) tbz.growLo(2,-1);
65 if (tbz.bigEnd(2) == khi) tbz.growHi(2,-1);
67 const Array4<const Real> & cell_data = S_data[
IntVars::cons].array(mfi);
68 const Array4<const Real> & cell_prim = S_prim.array(mfi);
69 const Array4< Real> & buoyancy_fab = buoyancy.array(mfi);
72 const Array4<const Real>& r0_arr = r0.const_array(mfi);
73 const Array4<const Real>& p0_arr = p0.const_array(mfi);
74 const Array4<const Real>& th0_arr = th0.const_array(mfi);
76 if ( anelastic && (solverChoice.
moisture_type == MoistureType::None) )
81 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
87 r0_arr,th0_arr,cell_data);
90 else if ( anelastic && (solverChoice.
moisture_type != MoistureType::None) )
95 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
101 r0_arr,th0_arr,cell_data);
104 else if ( !anelastic && (solverChoice.
moisture_type == MoistureType::None) )
112 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
123 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
129 r0_arr,p0_arr,th0_arr,cell_data);
134 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
140 r0_arr,th0_arr,cell_data);
150 if ( (solverChoice.
moisture_type == MoistureType::Kessler_NoRain) ||
152 (solverChoice.
moisture_type == MoistureType::SAM_NoPrecip_NoIce) )
159 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
168 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
171 r0_arr,th0_arr,p0_arr,
172 cell_prim,cell_data);
177 ParallelFor(tbz, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
180 r0_arr,th0_arr,cell_prim);
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_rhopert(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 > &cell_data)
Definition: ERF_BuoyancyUtils.H:59
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:103
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:77
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real buoyancy_moist_anelastic(int &i, int &j, int &k, amrex::Real const &grav_gpu, amrex::Real const &rv_over_rd, 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:30
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 > &cell_prim)
Definition: ERF_BuoyancyUtils.H:166
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 > &p0_arr, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< const amrex::Real > &cell_data)
Definition: ERF_BuoyancyUtils.H:125
constexpr amrex::Real R_v
Definition: ERF_Constants.H:11
constexpr amrex::Real R_d
Definition: ERF_Constants.H:10
@ 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:139
amrex::Real rdOcp
Definition: ERF_DataStruct.H:619
amrex::Real gravity
Definition: ERF_DataStruct.H:617
MoistureType moisture_type
Definition: ERF_DataStruct.H:664
int buoyancy_type
Definition: ERF_DataStruct.H:598