8 amrex::ParmParse pp_erf(
"erf");
44 const Real dx = geomdata.CellSize(0);
45 const Real dy = geomdata.CellSize(1);
71 const bool use_moisture = (sc.moisture_type != MoistureType::None);
84 amrex::Print() <<
"Adding random rho*theta perturbations" << std::endl;
86 amrex::Print() <<
"Adding random theta perturbations" << std::endl;
90 amrex::Print() <<
"Adding sinusoidal temperature perturbations "
92 <<
" periods" << std::endl;
100 amrex::Print() <<
"WARNING: prob.pert_deltaT has no effect at level " << lev
101 <<
" because fixed_density is set there" << std::endl;
105 ParallelForRNG(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k,
const amrex::RandomEngine& engine) noexcept
109 const Real z = z_cc(i,j,k);
120 rand_double = amrex::Random(engine);
150 const Real damp = std::exp(-
myhalf * zl * zl);
183 state_pert(i, j, k,
RhoKE_comp) *= amrex::max(
constexpr amrex::Real two
Definition: ERF_Constants.H:10
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:13
constexpr amrex::Real PI
Definition: ERF_Constants.H:42
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:43
#define Rho_comp
Definition: ERF_IndexDefines.H:39
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:40
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:45
#define RhoKE_comp
Definition: ERF_IndexDefines.H:41
const Real prob_lo_z
Definition: ERF_InitCustomPert_ABL.H:48
const Real prob_lo_y
Definition: ERF_InitCustomPert_ABL.H:47
int deterministic_ic_pert
Definition: ERF_InitCustomPert_ABL.H:4
Real T_0_Pert_Mag
Definition: ERF_InitCustomPert_ABL.H:28
const bool add_sinusoidal_T
Definition: ERF_InitCustomPert_ABL.H:64
Real pert_ref_height
Definition: ERF_InitCustomPert_ABL.H:34
const bool use_moisture
Definition: ERF_InitCustomPert_ABL.H:71
Real KE_0
Definition: ERF_InitCustomPert_ABL.H:21
const Real dy
Definition: ERF_InitCustomPert_ABL.H:45
Real rho_0
Definition: ERF_InitCustomPert_ABL.H:18
const Real zc
Definition: ERF_InitCustomPert_ABL.H:56
const Real rdOcp
Definition: ERF_InitCustomPert_ABL.H:72
Real rhoKE_0
Definition: ERF_InitCustomPert_ABL.H:22
const Real yc
Definition: ERF_InitCustomPert_ABL.H:55
const Real prob_lo_x
Definition: ERF_InitCustomPert_ABL.H:46
constexpr int temperature_hash_comp
Definition: ERF_InitCustomPert_ABL.H:16
long random_seed
Definition: ERF_InitCustomPert_ABL.H:6
Real T_0
Definition: ERF_InitCustomPert_ABL.H:19
Real pert_deltaV
Definition: ERF_InitCustomPert_ABL.H:33
const Real prob_hi_y
Definition: ERF_InitCustomPert_ABL.H:50
const std::uint64_t ic_pert_seed
Definition: ERF_InitCustomPert_ABL.H:13
const Real tfac
Definition: ERF_InitCustomPert_ABL.H:67
const Real prob_hi_x
Definition: ERF_InitCustomPert_ABL.H:49
const Real cval
Definition: ERF_InitCustomPert_ABL.H:66
Real KE_decay_order
Definition: ERF_InitCustomPert_ABL.H:25
Real pert_deltaU
Definition: ERF_InitCustomPert_ABL.H:32
const Real prob_hi_z
Definition: ERF_InitCustomPert_ABL.H:51
Real KE_decay_height
Definition: ERF_InitCustomPert_ABL.H:24
bool pert_rhotheta
Definition: ERF_InitCustomPert_ABL.H:29
ParallelForRNG(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine &engine) noexcept { const Real x=prob_lo_x+(i+myhalf) *dx;const Real y=prob_lo_y+(j+myhalf) *dy;const Real z=z_cc(i, j, k);const Real r=std::sqrt((x-xc) *(x-xc)+(y-yc) *(y-yc)+(z-zc) *(z-zc));if((z<=pert_ref_height) &&(T_0_Pert_Mag !=amrex::Real(0))) { Real rand_double;if(deterministic_ic_pert) { rand_double=erf_hash_rng::hash_uniform(i, j, k, temperature_hash_comp, lev, ic_pert_seed);} else { rand_double=amrex::Random(engine);} state_pert(i, j, k, RhoTheta_comp)=(rand_double *amrex::Real(2) - amrex::Real(1)) *T_0_Pert_Mag;if(!pert_rhotheta) { state_pert(i, j, k, RhoTheta_comp) *=r_hse(i, j, k);} } if(add_sinusoidal_T) { const Real zl=z/pert_ref_height;const Real damp=std::exp(-myhalf *zl *zl);const Real rho=state(i, j, k, Rho_comp);const Real rhotheta=state(i, j, k, RhoTheta_comp);const Real qv=(use_moisture) ? state(i, j, k, RhoQ1_comp)/rho :amrex::Real(0);const Real Told=getTgivenRandRTh(rho, rhotheta, qv);const Real P=getPgivenRTh(rhotheta, qv);const Real Tnew=Told+tfac *damp *z *std::cos(cval *(x - xc));const Real theta_new=getThgivenTandP(Tnew, P, rdOcp);const Real rho_new=getRhogivenThetaPress(theta_new, P, rdOcp, qv);state_pert(i, j, k, Rho_comp)+=rho_new - rho;if(use_moisture) { state_pert(i, j, k, RhoQ1_comp)+=(rho_new - rho) *qv;} } state_pert(i, j, k, RhoScalar_comp)=A_0 *std::exp(-amrex::Real(10.) *r *r);if(state_pert.nComp() > RhoKE_comp) { if(rhoKE_0 > 0) { state_pert(i, j, k, RhoKE_comp)=rhoKE_0;} else { state_pert(i, j, k, RhoKE_comp)=r_hse(i, j, k) *KE_0;} if(KE_decay_height > 0) { state_pert(i, j, k, RhoKE_comp) *=amrex::max(std::pow(1 - amrex::min(z/KE_decay_height, amrex::Real(1)), KE_decay_order), Real(1e-12));} } })
Real pert_periods_T
Definition: ERF_InitCustomPert_ABL.H:41
int fix_random_seed
Definition: ERF_InitCustomPert_ABL.H:5
Real A_0
Definition: ERF_InitCustomPert_ABL.H:20
const Real xc
Definition: ERF_InitCustomPert_ABL.H:54
Real pert_deltaT
Definition: ERF_InitCustomPert_ABL.H:40
const Real dx
Definition: ERF_InitCustomPert_ABL.H:44
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ P
Definition: ERF_IndexDefines.H:204
@ rho
Definition: ERF_Kessler.H:24
@ qv
Definition: ERF_Kessler.H:30
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real hash_uniform(int i, int j, int k, int comp, int lev, std::uint64_t seed) noexcept
Definition: ERF_HashRNG.H:68