ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_InitCustomPert_Bomex.H File Reference

Go to the source code of this file.

Functions

ParmParse pp ("prob")
 
pp query ("rho_0", rho_0)
 
pp query ("T_0", T_0)
 
pp query ("A_0", A_0)
 
pp query ("KE_0", KE_0)
 
pp query ("T_0_Pert_Mag", T_0_Pert_Mag)
 
pp query ("qv_0_Pert_Mag", qv_0_Pert_Mag)
 
pp query ("pert_ref_height", pert_ref_height)
 
pp query ("custom_TKE", custom_TKE)
 
 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+0.5) *dx[0];const Real y=prob_lo[1]+(j+0.5) *dx[1];const Real z=prob_lo[2]+(k+0.5) *dx[2];const Real xc=0.5 *(prob_lo[0]+prob_hi[0]);const Real yc=0.5 *(prob_lo[1]+prob_hi[1]);const Real zc=0.5 *(prob_lo[2]+prob_hi[2]);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 !=0.0)) { Real rhotheta=state(i, j, k, RhoTheta_comp);Real rho=state(i, j, k, Rho_comp);Real qv=state(i, j, k, RhoQ1_comp)/rho;Real Told=getTgivenRandRTh(rho, rhotheta, qv);Real P=getPgivenRTh(rhotheta, qv);Real rand_double=amrex::Random(engine);Real Tpert=(rand_double *2.0 - 1.0) *T_0_Pert_Mag;Real Tnew=Told+Tpert;Real theta_new=getThgivenTandP(Tnew, P, rdOcp);Real rhonew=getRhogivenThetaPress(theta_new, P, rdOcp, qv);state_pert(i, j, k, Rho_comp)=rhonew - rho;state_pert(i, j, k, RhoTheta_comp)=0.0;} state_pert(i, j, k, RhoScalar_comp)=A_0 *exp(-10.*r *r);if(custom_TKE) { state_pert(i, j, k, RhoKE_comp)=(1.0 - z/prob_hi[2]) *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)=0.0;state_pert(i, j, k, RhoQ2_comp)=0.0;if((z<=pert_ref_height) &&(qv_0_Pert_Mag !=0.0)) { Real rhoold=state(i, j, k, Rho_comp);Real rhonew=rhoold+state_pert(i, j, k, Rho_comp);Real qvold=state(i, j, k, RhoQ1_comp)/rhoold;Real rand_double=amrex::Random(engine);Real qvnew=qvold+(rand_double *2.0 - 1.0) *qv_0_Pert_Mag;state_pert(i, j, k, RhoQ1_comp)=rhonew *qvnew - rhoold *qvold;} } })
 

Variables

amrex::Real rho_0 = 0.0
 
amrex::Real T_0 = 0.0
 
amrex::Real A_0 = 1.0
 
amrex::Real KE_0 = 0.1
 
Real T_0_Pert_Mag = 0.0
 
Real qv_0_Pert_Mag = 0.0
 
Real pert_ref_height = 100.0
 
bool custom_TKE = false
 
const bool use_moisture = (sc.moisture_type != MoistureType::None)
 
const Real rdOcp = sc.rdOcp
 

Function Documentation

◆ ParallelForRNG()

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+0.5) *dx[0];const Real y=prob_lo[1]+(j+0.5) *dx[1];const Real z=prob_lo[2]+(k+0.5) *dx[2];const Real xc=0.5 *(prob_lo[0]+prob_hi[0]);const Real yc=0.5 *(prob_lo[1]+prob_hi[1]);const Real zc=0.5 *(prob_lo[2]+prob_hi[2]);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 !=0.0)) { Real rhotheta=state(i, j, k, RhoTheta_comp);Real rho=state(i, j, k, Rho_comp);Real qv=state(i, j, k, RhoQ1_comp)/rho;Real Told=getTgivenRandRTh(rho, rhotheta, qv);Real P=getPgivenRTh(rhotheta, qv);Real rand_double=amrex::Random(engine);Real Tpert=(rand_double *2.0 - 1.0) *T_0_Pert_Mag;Real Tnew=Told+Tpert;Real theta_new=getThgivenTandP(Tnew, P, rdOcp);Real rhonew=getRhogivenThetaPress(theta_new, P, rdOcp, qv);state_pert(i, j, k, Rho_comp)=rhonew - rho;state_pert(i, j, k, RhoTheta_comp)=0.0;} state_pert(i, j, k, RhoScalar_comp)=A_0 *exp(-10.*r *r);if(custom_TKE) { state_pert(i, j, k, RhoKE_comp)=(1.0 - z/prob_hi[2]) *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)=0.0;state_pert(i, j, k, RhoQ2_comp)=0.0;if((z<=pert_ref_height) &&(qv_0_Pert_Mag !=0.0)) { Real rhoold=state(i, j, k, Rho_comp);Real rhonew=rhoold+state_pert(i, j, k, Rho_comp);Real qvold=state(i, j, k, RhoQ1_comp)/rhoold;Real rand_double=amrex::Random(engine);Real qvnew=qvold+(rand_double *2.0 - 1.0) *qv_0_Pert_Mag;state_pert(i, j, k, RhoQ1_comp)=rhonew *qvnew - rhoold *qvold;} } }   
)
Here is the call graph for this function:

◆ pp()

ParmParse pp ( "prob"  )

◆ query() [1/8]

pp query ( "A_0"  ,
A_0   
)

◆ query() [2/8]

pp query ( "custom_TKE"  ,
custom_TKE   
)

◆ query() [3/8]

pp query ( "KE_0"  ,
KE_0   
)

◆ query() [4/8]

pp query ( "pert_ref_height"  ,
pert_ref_height   
)

◆ query() [5/8]

pp query ( "qv_0_Pert_Mag"  ,
qv_0_Pert_Mag   
)

◆ query() [6/8]

pp query ( "rho_0"  ,
rho_0   
)

◆ query() [7/8]

pp query ( "T_0"  ,
T_0   
)

◆ query() [8/8]

pp query ( "T_0_Pert_Mag"  ,
T_0_Pert_Mag   
)

Variable Documentation

◆ A_0

amrex::Real A_0 = 1.0

Referenced by ParallelForRNG().

◆ custom_TKE

bool custom_TKE = false

Referenced by ParallelForRNG().

◆ KE_0

amrex::Real KE_0 = 0.1

Referenced by ParallelForRNG().

◆ pert_ref_height

Real pert_ref_height = 100.0

Referenced by ParallelForRNG().

◆ qv_0_Pert_Mag

Real qv_0_Pert_Mag = 0.0

Referenced by ParallelForRNG().

◆ rdOcp

◆ rho_0

amrex::Real rho_0 = 0.0

◆ T_0

amrex::Real T_0 = 0.0

◆ T_0_Pert_Mag

Real T_0_Pert_Mag = 0.0

Referenced by ParallelForRNG().

◆ use_moisture