20 const bool const_rho = (sc.fixed_density[lev] == 1);
24 const RandomEngine& engine) noexcept
28 const Real*
dx = geomdata.CellSize();
49 const Real rand_double = amrex::Random(engine);
58 r_hse(i, j, k) * (theta_new - (rhotheta /
rho));
81 const Real rand_double = amrex::Random(engine);
82 const Real qvnew = qvold +
85 rhonew * qvnew - rhoold * qvold;
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getRhogivenThetaPress(const amrex::Real th, const amrex::Real p, const amrex::Real rdOcp, const amrex::Real qv=amrex::Real(0))
Definition: ERF_EOS.H:96
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getTgivenRandRTh(const amrex::Real rho, const amrex::Real rhotheta, const amrex::Real qv=amrex::Real(0))
Definition: ERF_EOS.H:46
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getThgivenTandP(const amrex::Real T, const amrex::Real P, const amrex::Real rdOcp)
Definition: ERF_EOS.H:18
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
#define RhoScalar_comp
Definition: ERF_IndexDefines.H:57
#define Rho_comp
Definition: ERF_IndexDefines.H:53
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:54
#define RhoQ2_comp
Definition: ERF_IndexDefines.H:67
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:66
#define RhoKE_comp
Definition: ERF_IndexDefines.H:55
const Real zc
Definition: ERF_InitCustomPert_ABL.H:56
const Real yc
Definition: ERF_InitCustomPert_ABL.H:55
const Real xc
Definition: ERF_InitCustomPert_ABL.H:54
const Real dx
Definition: ERF_InitCustomPert_ABL.H:44
const GpuArray< Real, AMREX_SPACEDIM > prob_lo
Definition: ERF_InitCustomPert_CloudChamber.H:33
const amrex::Real * prob_hi
Definition: ERF_InitCustomPert_DataAssimilation_ISV.H:17
const bool use_terrain
Definition: ERF_InitCustomPert_SLM.H:19
const bool const_rho
Definition: ERF_InitCustomPert_SLM.H:20
ParallelForRNG(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k, const RandomEngine &engine) noexcept { const Real *prob_lo=geomdata.ProbLo();const Real *prob_hi=geomdata.ProbHi();const Real *dx=geomdata.CellSize();const Real x=prob_lo[0]+(i+myhalf) *dx[0];const Real y=prob_lo[1]+(j+myhalf) *dx[1];const Real z=use_terrain ? z_cc(i, j, k) :prob_lo[2]+(k+myhalf) *dx[2];const Real z_agl=z - erf_prob_heights::z_ground_cc(i, j, z_sfc_nd);const Real xc=myhalf *(prob_lo[0]+prob_hi[0]);const Real yc=myhalf *(prob_lo[1]+prob_hi[1]);const Real zc=myhalf *(phys_z_lo+phys_z_hi);const Real r=std::sqrt((x-xc) *(x-xc)+(y-yc) *(y-yc)+(z-zc) *(z-zc));if(pert_ref_height > zero &&z_agl<=pert_ref_height &&T_0_Pert_Mag !=zero) { const Real rhotheta=state(i, j, k, RhoTheta_comp);const Real rho=state(i, j, k, Rho_comp);const Real qv=(use_moisture) ? state(i, j, k, RhoQ1_comp)/rho :zero;const Real Told=getTgivenRandRTh(rho, rhotheta, qv);const Real P=getPgivenRTh(rhotheta, qv);const Real rand_double=amrex::Random(engine);const Real Tnew=Told+T_0_Pert_Mag *(one - two *rand_double) *(one - z_agl/pert_ref_height);const Real theta_new=getThgivenTandP(Tnew, P, rdOcp);const Real rhonew=getRhogivenThetaPress(theta_new, P, rdOcp, qv);if(const_rho) { state_pert(i, j, k, Rho_comp)=zero;state_pert(i, j, k, RhoTheta_comp)=r_hse(i, j, k) *(theta_new -(rhotheta/rho));} else { state_pert(i, j, k, Rho_comp)=rhonew - rho;state_pert(i, j, k, RhoTheta_comp)=zero;} } state_pert(i, j, k, RhoScalar_comp)=A_0 *exp(-amrex::Real(10.0) *r *r);if(custom_TKE) { state_pert(i, j, k, RhoKE_comp)=(one - z/phys_z_hi) *r_hse(i, j, k);} else { state_pert(i, j, k, RhoKE_comp)=KE_0;} if(use_moisture) { state_pert(i, j, k, RhoQ1_comp)=zero;state_pert(i, j, k, RhoQ2_comp)=zero;if(z_agl<=pert_ref_height &&qv_0_Pert_Mag !=zero) { const Real rhoold=state(i, j, k, Rho_comp);const Real rhonew=rhoold+state_pert(i, j, k, Rho_comp);const Real qvold=state(i, j, k, RhoQ1_comp)/rhoold;const Real rand_double=amrex::Random(engine);const Real qvnew=qvold+(two *rand_double - one) *qv_0_Pert_Mag;state_pert(i, j, k, RhoQ1_comp)=rhonew *qvnew - rhoold *qvold;} } })
Real T_0_Pert_Mag
Definition: ERF_InitCustomPert_SLM.H:13
Real pert_ref_height
Definition: ERF_InitCustomPert_SLM.H:15
const bool use_moisture
Definition: ERF_InitCustomPert_SLM.H:18
Real KE_0
Definition: ERF_InitCustomPert_SLM.H:10
const Real rdOcp
Definition: ERF_InitCustomPert_SLM.H:21
const Real phys_z_hi
Definition: ERF_InitCustomPert_SLM.H:5
Real A_0
Definition: ERF_InitCustomPert_SLM.H:9
Real qv_0_Pert_Mag
Definition: ERF_InitCustomPert_SLM.H:14
bool custom_TKE
Definition: ERF_InitCustomPert_SLM.H:16
const Real phys_z_lo
Definition: ERF_InitCustomPert_SLM.H:4
constexpr amrex::Real two
Definition: ERF_NumericalConstants.H:38
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:37
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:41
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ None
Definition: ERF_LSM_Types.H:6
@ P
Definition: ERF_IndexDefines.H:244
@ rho
Definition: ERF_Kessler.H:25
@ qv
Definition: ERF_Kessler.H:31
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real z_ground_cc(int i, int j, amrex::Array4< amrex::Real const > const &z_sfc_nd) noexcept
Definition: ERF_ProbHeights.H:49