26 std::unique_ptr<amrex::MultiFab>& ,
27 std::unique_ptr<amrex::MultiFab>& z_phys_cc,
28 amrex::Geometry
const& geom,
29 const amrex::Vector<amrex::Real>& stretched_dz_h,
30 bool is_constant_dz,
bool is_stretched_dz)
override
36 if (!is_constant_dz && !is_stretched_dz) {
38 const int domlo_z = geom.Domain().smallEnd(2);
39 const int domhi_z = geom.Domain().bigEnd(2);
40 if (domhi_z > 255) amrex::Abort(
"1D Arrays are hard-wired to only 256 high");
42 for ( amrex::MFIter mfi(rho_hse,
TileNoZ()); mfi.isValid(); ++mfi )
44 amrex::Array4<amrex::Real >
rho_arr = rho_hse.array(mfi);
45 amrex::Array4<amrex::Real const> z_cc_arr = z_phys_cc->const_array(mfi);
48 const amrex::Box& tbz = mfi.nodaltilebox(2);
50 b2d.grow(0,1); b2d.grow(1,1);
53 const int klo = tbz.smallEnd(2);
54 const int khi = tbz.bigEnd(2)-1;
72 amrex::Array1D<amrex::Real,0,255> r;
73 amrex::Array1D<amrex::Real,0,255>
p;
76 for (
int k = klo; k <=
khi; k++) {
96 const int klo = geom.Domain().smallEnd(2);
97 const int khi = geom.Domain().bigEnd(2);
100 amrex::Vector<amrex::Real>
h_r(
khi+2);
101 amrex::Vector<amrex::Real>
h_p(
khi+2);
103 amrex::Gpu::DeviceVector<amrex::Real>
d_r(
khi+2);
104 amrex::Gpu::DeviceVector<amrex::Real>
d_p(
khi+2);
106 if (is_constant_dz) {
113 amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice,
h_r.begin(),
h_r.end(),
d_r.begin());
114 amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice,
h_p.begin(),
h_p.end(),
d_p.begin());
119 #pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
121 for ( amrex::MFIter mfi(rho_hse, amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi )
123 const amrex::Box& bx = mfi.growntilebox(1);
124 const amrex::Array4<amrex::Real> rho_hse_arr = rho_hse[mfi].array();
127 int kk = std::max(k,0);
128 rho_hse_arr(i,j,k) = r[kk];
143 std::unique_ptr<amrex::MultiFab>& ,
144 amrex::Geometry
const& geom)
override
147 const int khi = geom.Domain().bigEnd()[2];
150 amrex::Vector<amrex::Real>
h_r(
khi+2);
151 amrex::Vector<amrex::Real>
h_p(
khi+2);
152 amrex::Vector<amrex::Real>
h_t(
khi+2);
153 amrex::Vector<amrex::Real>
h_q_v(
khi+2);
155 amrex::ParmParse
pp(
"prob");
157 pp.query(
"qt_init",
q_t);
167 pp.query(
"height", z_tr_1);
168 pp.query(
"z_tr", z_tr_2);
173 bool T_from_theta =
false;
174 pp.query(
"T_from_theta_in_moist_init", T_from_theta);
183 T_from_theta, z_tr_1, z_tr_2,
186 amrex::Gpu::DeviceVector<amrex::Real>
d_r(
khi+2);
187 amrex::Gpu::copy(amrex::Gpu::hostToDevice,
h_r.begin(),
h_r.end(),
d_r.begin());
191 #pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
193 for ( amrex::MFIter mfi(rho_hse,amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi)
195 const amrex::Box& bx = mfi.growntilebox(1);
196 const amrex::Array4<amrex::Real> rho_hse_arr = rho_hse[mfi].array();
199 int kk = std::max(k,0);
200 rho_hse_arr(i,j,k) = r[kk];
214 for ( amrex::MFIter mfi(rho_hse, amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi )
216 amrex::Array4<amrex::Real> rho_hse_arr = rho_hse.array(mfi);
217 const amrex::Box& gbx = mfi.growntilebox(1);
218 ParallelFor(gbx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
220 rho_hse_arr(i,j,k) =
rho_0;
236 amrex::MultiFab& pi_hse, amrex::MultiFab& th_hse,
237 amrex::MultiFab& qv_hse,
amrex::Real l_rdOcp)
override
242 amrex::ParmParse
pp_prob(
"prob");
245 rho_hse.setVal(
rho_0);
274 amrex::MultiFab& pi_hse, amrex::MultiFab& th_hse,
276 std::unique_ptr<amrex::MultiFab>& z_phys_cc)
override
281 amrex::ParmParse
pp_prob(
"prob");
284 rho_hse.setVal(
rho_0);
286 for ( amrex::MFIter mfi(th_hse, amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi )
288 amrex::Array4<amrex::Real> th_hse_arr = th_hse.array(mfi);
289 amrex::Array4<amrex::Real> p_hse_arr = p_hse.array(mfi);
290 amrex::Array4<amrex::Real> pi_hse_arr = pi_hse.array(mfi);
291 amrex::Array4<amrex::Real const> z_arr = z_phys_cc->array(mfi);
292 const amrex::Box& gbx = mfi.growntilebox(1);
293 ParallelFor(gbx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
295 th_hse_arr(i,j,k) =
T_0 + dtheta_dz * (z_arr(i,j,k)- z_arr(i,j,0));
constexpr amrex::Real one
Definition: ERF_Constants.H:9
constexpr amrex::Real zero
Definition: ERF_Constants.H:8
constexpr amrex::Real p_0
Definition: ERF_Constants.H:61
constexpr amrex::Real R_d
Definition: ERF_Constants.H:47
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getExnergivenRTh(const amrex::Real rhotheta, const amrex::Real rdOcp, const amrex::Real qv=amrex::Real(0))
Definition: ERF_EOS.H:156
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getPgivenRTh(const amrex::Real rhotheta, const amrex::Real qv=amrex::Real(0))
Definition: ERF_EOS.H:81
Real rho_0
Definition: ERF_InitCustomPert_ABL.H:18
Real T_0
Definition: ERF_InitCustomPert_ABL.H:19
ParmParse pp_prob("prob")
const int khi
Definition: ERF_InitCustomPert_Bubble.H:21
Real eq_pot_temp
Definition: ERF_InitCustomPert_MultiSpeciesBubble.H:23
bool use_empirical
Definition: ERF_InitCustomPert_MultiSpeciesBubble.H:25
Vector< Real > h_t(khi+2)
Real T_tr
Definition: ERF_InitCustomPert_SquallLine.H:43
Real q_t
Definition: ERF_InitCustomPert_SquallLine.H:24
Vector< Real > h_q_v(khi+2)
Gpu::DeviceVector< Real > d_p(khi+2)
Vector< Real > h_r(khi+2)
Real theta_tr
Definition: ERF_InitCustomPert_SquallLine.H:47
Vector< Real > h_p(khi+2)
Gpu::DeviceVector< Real > d_r(khi+2)
Real theta_0
Definition: ERF_InitCustomPert_SquallLine.H:46
void erf_init_const_dens_hse(amrex::MultiFab &rho_hse) override
Initialize HSE density as a constant value.
Definition: ERF_InitDensityHSE.H:211
void erf_init_const_dens_and_linear_th_hse(amrex::MultiFab &rho_hse, amrex::MultiFab &p_hse, amrex::MultiFab &pi_hse, amrex::MultiFab &th_hse, amrex::MultiFab &qv_hse, amrex::Real l_rdOcp, std::unique_ptr< amrex::MultiFab > &z_phys_cc) override
Initialize constant density and linearly varying potential temperature in HSE.
Definition: ERF_InitDensityHSE.H:273
void erf_init_dens_hse_moist(amrex::MultiFab &rho_hse, std::unique_ptr< amrex::MultiFab > &, amrex::Geometry const &geom) override
Initialize density in hydrostatic equilibrium for moist cases.
Definition: ERF_InitDensityHSE.H:142
void erf_init_const_dens_and_th_hse(amrex::MultiFab &rho_hse, amrex::MultiFab &p_hse, amrex::MultiFab &pi_hse, amrex::MultiFab &th_hse, amrex::MultiFab &qv_hse, amrex::Real l_rdOcp) override
Initialize constant density and potential temperature in HSE.
Definition: ERF_InitDensityHSE.H:235
void erf_init_dens_hse_dry(amrex::MultiFab &rho_hse, std::unique_ptr< amrex::MultiFab > &, std::unique_ptr< amrex::MultiFab > &z_phys_cc, amrex::Geometry const &geom, const amrex::Vector< amrex::Real > &stretched_dz_h, bool is_constant_dz, bool is_stretched_dz) override
Initialize density in hydrostatic equilibrium for dry cases.
Definition: ERF_InitDensityHSE.H:25
ParallelFor(fab_box, [=] AMREX_GPU_DEVICE(int i, int j, int k) { qrcuten_arr(i, j, k)=Real(0);qscuten_arr(i, j, k)=Real(0);qicuten_arr(i, j, k)=Real(0);})
amrex::Real Real
Definition: ERF_ShocInterface.H:19
AMREX_FORCE_INLINE amrex::IntVect TileNoZ()
Definition: ERF_TileNoZ.H:11
auto rho_arr
Definition: ERF_UpdateWSubsidence_SineMassFlux.H:3
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void init_isentropic_hse_stretched_dz(const amrex::Real &r_sfc, const amrex::Real &theta, amrex::Real *r, amrex::Real *p, const amrex::Real *stretched_dz, const int klo, const int khi)
Definition: ERF_HSEUtils.H:219
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void init_isentropic_hse_constant_dz(const amrex::Real &r_sfc, const amrex::Real &theta, amrex::Real *r, amrex::Real *p, const amrex::Real &dz, const int klo, const int khi)
Definition: ERF_HSEUtils.H:109
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE void init_isentropic_hse_no_terrain(Real *theta, Real *r, Real *p, Real *q_v, const Real &dz, const int &khi, const Real q_t, const Real eq_pot_temp, const bool use_empirical, const bool T_from_theta=false, const Real z_tr_1=-one, const Real z_tr_2=-one, const Real theta_0=amrex::Real(0), const Real theta_tr=amrex::Real(0), const Real T_tr=amrex::Real(0))
Definition: ERF_HSEUtils.H:675
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void init_isentropic_hse_terrain(int i, int j, const amrex::Real &r_sfc, const amrex::Real &theta, amrex::Real *r, amrex::Real *p, const amrex::Array4< amrex::Real const > z_cc, const int &klo, const int &khi)
Definition: ERF_HSEUtils.H:331
@ dz
Definition: ERF_AdvanceWDM6.cpp:270
@ p
Definition: ERF_WSM6.H:191
real(c_double), parameter p0
Definition: ERF_module_model_constants.F90:40