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

Go to the source code of this file.

Functions

ParmParse pp_prob ("prob")
 
pp_prob query ("U_0", U_0)
 
pp_prob query ("V_0", V_0)
 
pp_prob query ("W_0", W_0)
 
pp_prob query ("U_0_Pert_Mag", U_0_Pert_Mag)
 
pp_prob query ("V_0_Pert_Mag", V_0_Pert_Mag)
 
pp_prob query ("W_0_Pert_Mag", W_0_Pert_Mag)
 
pp_prob query ("pert_deltaU", pert_deltaU)
 
pp_prob query ("pert_deltaV", pert_deltaV)
 
pp_prob query ("pert_periods_U", pert_periods_U)
 
pp_prob query ("pert_periods_V", pert_periods_V)
 
pp_prob query ("pert_ref_height", pert_ref_height)
 
 if (pert_ref_height > 0)
 
 ParallelForRNG (xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine &engine) noexcept { const Real *prob_lo=geomdata.ProbLo();const Real *dx=geomdata.CellSize();const Real y=prob_lo[1]+(j+myhalf) *dx[1];const Real z=(z_nd) ? fourth *(z_nd(i, j, k)+z_nd(i, j, k+1)+z_nd(i, j+1, k)+z_nd(i, j+1, k+1)) :prob_lo[2]+(k+myhalf) *dx[2];x_vel_pert(i, j, k)=U_0;if((z<=pert_ref_height) &&(U_0_Pert_Mag !=zero)) { Real rand_double=amrex::Random(engine);Real x_vel_prime=(rand_double *two - one) *U_0_Pert_Mag;x_vel_pert(i, j, k)+=x_vel_prime;} if(pert_deltaU !=zero) { const amrex::Real yl=y - prob_lo[1];const amrex::Real zl=z/pert_ref_height;const amrex::Real damp=std::exp(-myhalf *zl *zl);x_vel_pert(i, j, k)+=ufac *damp *z *std::cos(aval *yl);} })
 
 ParallelForRNG (ybx, [=] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine &engine) noexcept { const Real *prob_lo=geomdata.ProbLo();const Real *dx=geomdata.CellSize();const Real x=prob_lo[0]+(i+myhalf) *dx[0];const Real z=(z_nd) ? fourth *(z_nd(i, j, k)+z_nd(i, j, k+1)+z_nd(i+1, j, k)+z_nd(i+1, j, k+1)) :prob_lo[2]+(k+myhalf) *dx[2];y_vel_pert(i, j, k)=V_0;if((z<=pert_ref_height) &&(V_0_Pert_Mag !=zero)) { Real rand_double=amrex::Random(engine);Real y_vel_prime=(rand_double *two - one) *V_0_Pert_Mag;y_vel_pert(i, j, k)+=y_vel_prime;} if(pert_deltaV !=zero) { const amrex::Real xl=x - prob_lo[0];const amrex::Real zl=z/pert_ref_height;const amrex::Real damp=std::exp(-myhalf *zl *zl);y_vel_pert(i, j, k)+=vfac *damp *z *std::cos(bval *xl);} })
 
 ParallelForRNG (zbx, [=] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine &engine) noexcept { const int dom_lo_z=geomdata.Domain().smallEnd()[2];const int dom_hi_z=geomdata.Domain().bigEnd()[2];if(k==dom_lo_z||k==dom_hi_z+1) { z_vel_pert(i, j, k)=zero;} else if(W_0_Pert_Mag !=zero) { Real rand_double=amrex::Random(engine);Real z_vel_prime=(rand_double *two - one) *W_0_Pert_Mag;z_vel_pert(i, j, k)=W_0+z_vel_prime;} })
 

Variables

Real U_0 = zero
 
Real V_0 = zero
 
Real W_0 = zero
 
Real U_0_Pert_Mag = zero
 
Real V_0_Pert_Mag = zero
 
Real W_0_Pert_Mag = zero
 
Real pert_deltaU = zero
 
Real pert_deltaV = zero
 
Real pert_periods_U = amrex::Real(5.0)
 
Real pert_periods_V = amrex::Real(5.0)
 
Real pert_ref_height = amrex::Real(100.0)
 
auto problo = geomdata.ProbLo()
 
auto probhi = geomdata.ProbHi()
 
Real aval = pert_periods_U * two * PI / (probhi[1] - problo[1])
 
Real bval = pert_periods_V * two * PI / (probhi[0] - problo[0])
 
Real ufac = pert_deltaU * std::exp(myhalf) / pert_ref_height
 
Real vfac = pert_deltaV * std::exp(myhalf) / pert_ref_height
 

Function Documentation

◆ if()

if ( pert_ref_height  ,
 
)
28  {
29  if ((pert_deltaU != zero) || (pert_deltaV != zero)) {
30  amrex::Print() << "Adding divergence-free perturbations "
31  << pert_deltaU << " " << pert_deltaV
32  << std::endl;
33  }
34  if (U_0_Pert_Mag != zero) {
35  amrex::Print() << "Adding random x-velocity perturbations" << std::endl;
36  }
37  if (V_0_Pert_Mag != zero) {
38  amrex::Print() << "Adding random y-velocity perturbations" << std::endl;
39  }
40  }
constexpr amrex::Real zero
Definition: ERF_Constants.H:6
Real U_0_Pert_Mag
Definition: ERF_InitCustomPertVels_ABL.H:9
Real pert_deltaV
Definition: ERF_InitCustomPertVels_ABL.H:15
Real pert_deltaU
Definition: ERF_InitCustomPertVels_ABL.H:14
Real V_0_Pert_Mag
Definition: ERF_InitCustomPertVels_ABL.H:10

◆ ParallelForRNG() [1/3]

ParallelForRNG ( xbx  ,
[=] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine &engine) noexcept { const Real *prob_lo=geomdata.ProbLo();const Real *dx=geomdata.CellSize();const Real y=prob_lo[1]+(j+myhalf) *dx[1];const Real z=(z_nd) ? fourth *(z_nd(i, j, k)+z_nd(i, j, k+1)+z_nd(i, j+1, k)+z_nd(i, j+1, k+1)) :prob_lo[2]+(k+myhalf) *dx[2];x_vel_pert(i, j, k)=U_0;if((z<=pert_ref_height) &&(U_0_Pert_Mag !=zero)) { Real rand_double=amrex::Random(engine);Real x_vel_prime=(rand_double *two - one) *U_0_Pert_Mag;x_vel_pert(i, j, k)+=x_vel_prime;} if(pert_deltaU !=zero) { const amrex::Real yl=y - prob_lo[1];const amrex::Real zl=z/pert_ref_height;const amrex::Real damp=std::exp(-myhalf *zl *zl);x_vel_pert(i, j, k)+=ufac *damp *z *std::cos(aval *yl);} }   
)

◆ ParallelForRNG() [2/3]

ParallelForRNG ( ybx  ,
[=] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine &engine) noexcept { const Real *prob_lo=geomdata.ProbLo();const Real *dx=geomdata.CellSize();const Real x=prob_lo[0]+(i+myhalf) *dx[0];const Real z=(z_nd) ? fourth *(z_nd(i, j, k)+z_nd(i, j, k+1)+z_nd(i+1, j, k)+z_nd(i+1, j, k+1)) :prob_lo[2]+(k+myhalf) *dx[2];y_vel_pert(i, j, k)=V_0;if((z<=pert_ref_height) &&(V_0_Pert_Mag !=zero)) { Real rand_double=amrex::Random(engine);Real y_vel_prime=(rand_double *two - one) *V_0_Pert_Mag;y_vel_pert(i, j, k)+=y_vel_prime;} if(pert_deltaV !=zero) { const amrex::Real xl=x - prob_lo[0];const amrex::Real zl=z/pert_ref_height;const amrex::Real damp=std::exp(-myhalf *zl *zl);y_vel_pert(i, j, k)+=vfac *damp *z *std::cos(bval *xl);} }   
)

◆ ParallelForRNG() [3/3]

ParallelForRNG ( zbx  ,
[=] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine &engine) noexcept { const int dom_lo_z=geomdata.Domain().smallEnd()[2];const int dom_hi_z=geomdata.Domain().bigEnd()[2];if(k==dom_lo_z||k==dom_hi_z+1) { z_vel_pert(i, j, k)=zero;} else if(W_0_Pert_Mag !=zero) { Real rand_double=amrex::Random(engine);Real z_vel_prime=(rand_double *two - one) *W_0_Pert_Mag;z_vel_pert(i, j, k)=W_0+z_vel_prime;} }   
)

◆ pp_prob()

ParmParse pp_prob ( "prob"  )

◆ query() [1/11]

pp_prob query ( "pert_deltaU"  ,
pert_deltaU   
)

◆ query() [2/11]

pp_prob query ( "pert_deltaV"  ,
pert_deltaV   
)

◆ query() [3/11]

pp_prob query ( "pert_periods_U"  ,
pert_periods_U   
)

◆ query() [4/11]

pp_prob query ( "pert_periods_V"  ,
pert_periods_V   
)

◆ query() [5/11]

pp_prob query ( "pert_ref_height"  ,
pert_ref_height   
)

◆ query() [6/11]

pp_prob query ( "U_0"  ,
U_0   
)

◆ query() [7/11]

pp_prob query ( "U_0_Pert_Mag"  ,
U_0_Pert_Mag   
)

◆ query() [8/11]

pp_prob query ( "V_0"  ,
V_0   
)

◆ query() [9/11]

pp_prob query ( "V_0_Pert_Mag"  ,
V_0_Pert_Mag   
)

◆ query() [10/11]

pp_prob query ( "W_0"  ,
W_0   
)

◆ query() [11/11]

pp_prob query ( "W_0_Pert_Mag"  ,
W_0_Pert_Mag   
)

Variable Documentation

◆ aval

◆ bval

Real bval = pert_periods_V * two * PI / (probhi[0] - problo[0])

Referenced by ParallelForRNG().

◆ pert_deltaU

Real pert_deltaU = zero

Referenced by if(), and ParallelForRNG().

◆ pert_deltaV

Real pert_deltaV = zero

Referenced by if(), and ParallelForRNG().

◆ pert_periods_U

Real pert_periods_U = amrex::Real(5.0)

◆ pert_periods_V

Real pert_periods_V = amrex::Real(5.0)

◆ pert_ref_height

Real pert_ref_height = amrex::Real(100.0)

Referenced by ParallelForRNG().

◆ probhi

auto probhi = geomdata.ProbHi()

◆ problo

auto problo = geomdata.ProbLo()

◆ U_0

Real U_0 = zero

Referenced by ParallelForRNG().

◆ U_0_Pert_Mag

Real U_0_Pert_Mag = zero

Referenced by if(), and ParallelForRNG().

◆ ufac

Real ufac = pert_deltaU * std::exp(myhalf) / pert_ref_height

Referenced by ParallelForRNG().

◆ V_0

Real V_0 = zero

Referenced by ParallelForRNG().

◆ V_0_Pert_Mag

Real V_0_Pert_Mag = zero

Referenced by if(), and ParallelForRNG().

◆ vfac

◆ W_0

Real W_0 = zero

Referenced by ParallelForRNG().

◆ W_0_Pert_Mag

Real W_0_Pert_Mag = zero

Referenced by ParallelForRNG().