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

Go to the source code of this file.

Functions

ParmParse pp_prob ("prob")
 
pp_prob query ("A_0", A_0)
 
pp_prob query ("KE_0", KE_0)
 
pp_prob query ("pert_deltaT", pert_deltaT)
 
pp_prob query ("pert_deltaQV", pert_deltaQV)
 
pp_prob query ("pert_periods_T", pert_periods_T)
 
pp_prob query ("pert_periods_QV", pert_periods_QV)
 
pp_prob query ("T_0_Pert_Mag", T_0_Pert_Mag)
 
pp_prob query ("qv_0_Pert_Mag", qv_0_Pert_Mag)
 
pp_prob query ("wbar_sub_max", wbar_sub_max)
 
pp_prob query ("pert_ref_height", pert_ref_height)
 
pp_prob 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+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);const bool sin_T=(pert_deltaT !=zero);const bool sin_qv=use_moisture &&(pert_deltaQV !=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(sin_T||sin_qv) { const Real zl=z_agl/pert_ref_height;const Real damp=std::exp(-myhalf *zl *zl);if(sin_T) { dT+=tfac *damp *z_agl *std::cos(cval *(x - xc));} if(sin_qv) { dqv+=qvfac *damp *z_agl *std::cos(dval *(x - xc));} } if(rand_T||sin_T||rand_qv||sin_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||sin_T, use_moisture, rdOcp, drho, drhoqv);if(rand_T||sin_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);} })
 

Variables

const bool use_z_phys = use_physical_z()
 
const Real phys_z_lo = phys_zlo(geomdata, lev)
 
const Real phys_z_hi = phys_zhi(geomdata, lev)
 
Real A_0 = one
 
Real KE_0 = amrex::Real(0.1)
 
Real pert_deltaT = zero
 
Real pert_deltaQV = zero
 
Real pert_periods_T = amrex::Real(5.0)
 
Real pert_periods_QV = amrex::Real(5.0)
 
Real T_0_Pert_Mag = zero
 
Real qv_0_Pert_Mag = zero
 
Real wbar_sub_max = -amrex::Real(0.65)
 
Real pert_ref_height = amrex::Real(100.0)
 
bool custom_TKE = false
 
const Real prob_lo_x = geomdata.ProbLo()[0]
 
const Real prob_hi_x = geomdata.ProbHi()[0]
 
Real cval = pert_periods_T * two * PI / (prob_hi_x - prob_lo_x)
 
Real dval = pert_periods_QV * two * PI / (prob_hi_x - prob_lo_x)
 
Real tfac = pert_deltaT * std::exp(myhalf) / pert_ref_height
 
Real qvfac = pert_deltaQV * std::exp(myhalf) / pert_ref_height
 
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+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);const bool sin_T=(pert_deltaT !=zero);const bool sin_qv=use_moisture &&(pert_deltaQV !=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(sin_T||sin_qv) { const Real zl=z_agl/pert_ref_height;const Real damp=std::exp(-myhalf *zl *zl);if(sin_T) { dT+=tfac *damp *z_agl *std::cos(cval *(x - xc));} if(sin_qv) { dqv+=qvfac *damp *z_agl *std::cos(dval *(x - xc));} } if(rand_T||sin_T||rand_qv||sin_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||sin_T, use_moisture, rdOcp, drho, drhoqv);if(rand_T||sin_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);} }   
)
Here is the call graph for this function:

◆ pp_prob()

ParmParse pp_prob ( "prob"  )

◆ query() [1/11]

pp_prob query ( "A_0"  ,
A_0   
)

◆ query() [2/11]

pp_prob query ( "custom_TKE"  ,
custom_TKE   
)

◆ query() [3/11]

pp_prob query ( "KE_0"  ,
KE_0   
)

◆ query() [4/11]

pp_prob query ( "pert_deltaQV"  ,
pert_deltaQV   
)

◆ query() [5/11]

pp_prob query ( "pert_deltaT"  ,
pert_deltaT   
)

◆ query() [6/11]

pp_prob query ( "pert_periods_QV"  ,
pert_periods_QV   
)

◆ query() [7/11]

pp_prob query ( "pert_periods_T"  ,
pert_periods_T   
)

◆ query() [8/11]

pp_prob query ( "pert_ref_height"  ,
pert_ref_height   
)

◆ query() [9/11]

pp_prob query ( "qv_0_Pert_Mag"  ,
qv_0_Pert_Mag   
)

◆ query() [10/11]

pp_prob query ( "T_0_Pert_Mag"  ,
T_0_Pert_Mag   
)

◆ query() [11/11]

pp_prob query ( "wbar_sub_max"  ,
wbar_sub_max   
)

Variable Documentation

◆ A_0

Real A_0 = one

Referenced by ParallelForRNG().

◆ custom_TKE

bool custom_TKE = false

Referenced by ParallelForRNG().

◆ cval

Referenced by ParallelForRNG().

◆ dval

Referenced by ParallelForRNG().

◆ KE_0

Real KE_0 = amrex::Real(0.1)

Referenced by ParallelForRNG().

◆ pert_deltaQV

Real pert_deltaQV = zero

Referenced by ParallelForRNG().

◆ pert_deltaT

Real pert_deltaT = zero

Referenced by ParallelForRNG().

◆ pert_periods_QV

Real pert_periods_QV = amrex::Real(5.0)

◆ pert_periods_T

Real pert_periods_T = amrex::Real(5.0)

◆ pert_ref_height

Real pert_ref_height = amrex::Real(100.0)

Referenced by ParallelForRNG().

◆ phys_z_hi

const Real phys_z_hi = phys_zhi(geomdata, lev)

Referenced by ParallelForRNG().

◆ phys_z_lo

const Real phys_z_lo = phys_zlo(geomdata, lev)

Referenced by ParallelForRNG().

◆ prob_hi_x

const Real prob_hi_x = geomdata.ProbHi()[0]

◆ prob_lo_x

const Real prob_lo_x = geomdata.ProbLo()[0]

◆ qv_0_Pert_Mag

Real qv_0_Pert_Mag = zero

Referenced by ParallelForRNG().

◆ qvfac

Real qvfac = pert_deltaQV * std::exp(myhalf) / pert_ref_height

Referenced by ParallelForRNG().

◆ rdOcp

const Real rdOcp = sc.rdOcp

Referenced by ParallelForRNG().

◆ T_0_Pert_Mag

Real T_0_Pert_Mag = zero

Referenced by ParallelForRNG().

◆ tfac

Real tfac = pert_deltaT * std::exp(myhalf) / pert_ref_height

Referenced by ParallelForRNG().

◆ use_moisture

const bool use_moisture = (sc.moisture_type != MoistureType::None)

Referenced by ParallelForRNG().

◆ use_z_phys

const bool use_z_phys = use_physical_z()

Referenced by ParallelForRNG().

◆ wbar_sub_max

Real wbar_sub_max = -amrex::Real(0.65)