24 ParallelForRNG(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k,
const RandomEngine& engine) noexcept
29 const Real*
dx = geomdata.CellSize();
51 Real rand_double = amrex::Random(engine);
55 Real rand_double = amrex::Random(engine);
58 if (rand_T || rand_qv) {
65 state_pert(i, j, k,
Rho_comp) = drho;
#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 bool use_z_phys
Definition: ERF_InitCustomPert_Bomex.H:4
amrex::Real A_0
Definition: ERF_InitCustomPert_Bomex.H:12
Real T_0_Pert_Mag
Definition: ERF_InitCustomPert_Bomex.H:15
Real pert_ref_height
Definition: ERF_InitCustomPert_Bomex.H:17
const bool use_moisture
Definition: ERF_InitCustomPert_Bomex.H:20
const Real rdOcp
Definition: ERF_InitCustomPert_Bomex.H:22
const Real phys_z_hi
Definition: ERF_InitCustomPert_Bomex.H:6
amrex::Real rho_0
Definition: ERF_InitCustomPert_Bomex.H:10
amrex::Real KE_0
Definition: ERF_InitCustomPert_Bomex.H:13
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_z_phys ? 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));const bool rand_T=(z_agl<=pert_ref_height) &&(T_0_Pert_Mag !=zero);const bool rand_qv=use_moisture &&(z_agl<=pert_ref_height) &&(qv_0_Pert_Mag !=zero);Real dT=zero;Real dqv=zero;if(rand_T) { Real rand_double=amrex::Random(engine);dT=(rand_double *two - one) *T_0_Pert_Mag;} if(rand_qv) { Real rand_double=amrex::Random(engine);dqv=(rand_double *two - one) *qv_0_Pert_Mag;} if(rand_T||rand_qv) { Real drho, drhoqv;erf_moist_perturbation::perturb_temperature_and_vapour(state(i, j, k, Rho_comp), state(i, j, k, RhoTheta_comp), use_moisture ? state(i, j, k, RhoQ1_comp) :zero, dT, dqv, rand_T, use_moisture, rdOcp, drho, drhoqv);if(rand_T) { state_pert(i, j, k, Rho_comp)=drho;state_pert(i, j, k, RhoTheta_comp)=zero;} if(use_moisture) { state_pert(i, j, k, RhoQ1_comp)=drhoqv;} } state_pert(i, j, k, RhoScalar_comp)=A_0 *std::exp(-amrex::Real(10.) *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, RhoQ2_comp)=state_pert(i, j, k, Rho_comp) *state(i, j, k, RhoQ2_comp)/state(i, j, k, Rho_comp);} })
Real qv_0_Pert_Mag
Definition: ERF_InitCustomPert_Bomex.H:16
amrex::Real T_0
Definition: ERF_InitCustomPert_Bomex.H:11
bool custom_TKE
Definition: ERF_InitCustomPert_Bomex.H:18
const Real phys_z_lo
Definition: ERF_InitCustomPert_Bomex.H:5
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
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
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void perturb_temperature_and_vapour(const amrex::Real rho, const amrex::Real rhotheta, const amrex::Real rhoqv, const amrex::Real dT, const amrex::Real dqv, const bool perturb_T, const bool moist, const amrex::Real rdOcp, amrex::Real &drho, amrex::Real &drhoqv) noexcept
Definition: ERF_MoistPerturbation.H:39
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