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

Go to the source code of this file.

Functions

 AMREX_ALWAYS_ASSERT (bx.length()[2]==khi+1)
 
ParmParse pp_prob ("prob")
 
pp_prob query ("qt_init", q_t)
 
pp_prob query ("eq_pot_temp", eq_pot_temp)
 
pp_prob query ("use_empirical_psat", use_empirical)
 
Vector< Real > h_r (khi+2)
 
Vector< Real > h_p (khi+2)
 
Vector< Real > h_t (khi+2)
 
Vector< Real > h_q_v (khi+2)
 
amrex::Gpu::DeviceVector< Real > d_r (khi+2)
 
amrex::Gpu::DeviceVector< Real > d_p (khi+2)
 
amrex::Gpu::DeviceVector< Real > d_t (khi+2)
 
amrex::Gpu::DeviceVector< Real > d_q_v (khi+2)
 
pp_prob query ("height", height)
 
pp_prob query ("z_tr", z_tr)
 
pp_prob query ("x_c", x_c)
 
pp_prob query ("y_c", y_c)
 
pp_prob query ("z_c", z_c)
 
pp_prob query ("x_r", x_r)
 
pp_prob query ("y_r", y_r)
 
pp_prob query ("z_r", z_r)
 
pp_prob query ("T_tr", T_tr)
 
pp_prob query ("theta_tr", theta_tr)
 
pp_prob query ("theta_c", theta_c)
 
pp_prob query ("theta_0", theta_0)
 
 if (use_z_phys)
 
 ParallelFor (bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { const auto prob_lo=geomdata.ProbLo();const auto 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);Real rad, delta_theta, theta_total, temperature, rho, RH, scalar;rad=std::sqrt(amrex::Math::powi< 2 >((x - x_c)/x_r)+amrex::Math::powi< 2 >((y - y_c)/y_r)+amrex::Math::powi< 2 >((z - z_c)/z_r));if(rad<=r_c) { delta_theta=theta_c *amrex::Math::powi< 2 >(std::cos(PI *rad/two));scalar=amrex::Math::powi< 2 >(std::cos(PI *rad/two));} else { delta_theta=zero;scalar=zero;} Real scaled_height=z_agl/z_tr;int which_zone=-1;if(z_agl<=height) { which_zone=1;} else if(z_agl<=z_tr) { which_zone=2;} else { which_zone=3;} theta_total=t[k]+delta_theta;temperature=getTgivenPandTh(p[k], theta_total, RdoCp);Real T_b=getTgivenPandTh(p[k], t[k], RdoCp);RH=HSEutils::compute_relative_humidity(p[k], T_b, use_empirical, which_zone, scaled_height);Real q_v_hot;if(z_agl< height) { q_v_hot=amrex::Real(0.014);} else { q_v_hot=HSEutils::vapor_mixing_ratio(p[k], T_b, RH, use_empirical, which_zone);} rho=p[k]/(R_d *temperature *(one+RvoRd *q_v_hot));Real temperature_back=getTgivenPandTh(p[k], t[k], RdoCp);Real T_back=getTgivenPandTh(p[k], t[k], RdoCp);Real RH_back=HSEutils::compute_relative_humidity(p[k], T_back, use_empirical, which_zone, scaled_height);Real q_v_back;if(z_agl< height) { q_v_back=amrex::Real(0.014);} else { q_v_back=HSEutils::vapor_mixing_ratio(p[k], T_back, RH_back, use_empirical, which_zone);} Real rho_back=getRhogivenTandPress(temperature_back, p[k], q_v_back);state_pert(i, j, k, RhoTheta_comp)=rho *theta_total - rho_back *t[k] *(one+RvoRd *q_v_back);state_pert(i, j, k, Rho_comp)=rho - rho_back *(one+q_v_back);state_pert(i, j, k, RhoScalar_comp)=rho *scalar;if(use_moisture) { state_pert(i, j, k, RhoQ1_comp)=rho *q_v_hot;state_pert(i, j, k, RhoQ2_comp)=zero;} })
 

Variables

const bool use_z_phys = use_physical_z()
 
const bool use_moisture = (sc.moisture_type != MoistureType::None)
 
const int khi = geomdata.Domain().bigEnd()[2]
 
Real q_t = amrex::Real(0.02)
 
Real eq_pot_temp = amrex::Real(320.0)
 
bool use_empirical = false
 
const amrex::Real & dz = geomdata.CellSize()[2]
 
Real height = amrex::Real(1200.)
 
Real z_tr = amrex::Real(12000.)
 
Real x_c = zero
 
Real y_c = zero
 
Real z_c = amrex::Real(1.5e3)
 
Real r_c = one
 
Real x_r = amrex::Real(10.0e3)
 
Real y_r = amrex::Real(10.0e3)
 
Real z_r = amrex::Real(1.5e3)
 
Real T_tr = amrex::Real(213.0)
 
Real theta_tr = amrex::Real(343.0)
 
Real theta_c = three
 
Real theta_0 = amrex::Real(300.0)
 
 else
 
Real * t = d_t.data()
 
Real * p = d_p.data()
 

Function Documentation

◆ AMREX_ALWAYS_ASSERT()

AMREX_ALWAYS_ASSERT ( bx.  length()[2] = =khi+1)

◆ d_p()

amrex::Gpu::DeviceVector<Real> d_p ( khi+  2)

◆ d_q_v()

amrex::Gpu::DeviceVector<Real> d_q_v ( khi+  2)

◆ d_r()

amrex::Gpu::DeviceVector<Real> d_r ( khi+  2)

◆ d_t()

amrex::Gpu::DeviceVector<Real> d_t ( khi+  2)

◆ h_p()

Vector<Real> h_p ( khi+  2)

Referenced by if().

Here is the caller graph for this function:

◆ h_q_v()

Vector<Real> h_q_v ( khi+  2)

Referenced by if().

Here is the caller graph for this function:

◆ h_r()

Vector<Real> h_r ( khi+  2)

Referenced by if().

Here is the caller graph for this function:

◆ h_t()

Vector<Real> h_t ( khi+  2)

Referenced by if().

Here is the caller graph for this function:

◆ if()

if ( use_z_phys  )
58  {
59  HSEutils::init_isentropic_hse_no_terrain(h_t.data(), h_r.data(),h_p.data(),h_q_v.data(),m_zlevels_stag[lev].data(),khi,
62  } else {
Vector< Real > h_t(khi+2)
const int khi
Definition: ERF_InitCustomPert_SuperCell.H:8
Real T_tr
Definition: ERF_InitCustomPert_SuperCell.H:53
Real q_t
Definition: ERF_InitCustomPert_SuperCell.H:13
Vector< Real > h_q_v(khi+2)
Real height
Definition: ERF_InitCustomPert_SuperCell.H:37
Real eq_pot_temp
Definition: ERF_InitCustomPert_SuperCell.H:16
bool use_empirical
Definition: ERF_InitCustomPert_SuperCell.H:19
Vector< Real > h_r(khi+2)
Real theta_tr
Definition: ERF_InitCustomPert_SuperCell.H:54
Vector< Real > h_p(khi+2)
Real theta_0
Definition: ERF_InitCustomPert_SuperCell.H:56
Real z_tr
Definition: ERF_InitCustomPert_SuperCell.H:40
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE void init_isentropic_hse_no_terrain(Real *theta, Real *r, Real *p, Real *q_v, const Real &dz, const Real &z_bot, const int &khi, const Real q_t, const Real eq_pot_temp, const bool use_empirical, const bool T_from_theta=false, const Real z_tr_1=-one, const Real z_tr_2=-one, const Real theta_0=amrex::Real(300), const Real theta_tr=amrex::Real(300), const Real T_tr=amrex::Real(300))
Definition: ERF_HSEUtils.H:769
Here is the call graph for this function:

◆ ParallelFor()

ParallelFor ( bx  ,
[=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { const auto prob_lo=geomdata.ProbLo();const auto 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);Real rad, delta_theta, theta_total, temperature, rho, RH, scalar;rad=std::sqrt(amrex::Math::powi< 2 >((x - x_c)/x_r)+amrex::Math::powi< 2 >((y - y_c)/y_r)+amrex::Math::powi< 2 >((z - z_c)/z_r));if(rad<=r_c) { delta_theta=theta_c *amrex::Math::powi< 2 >(std::cos(PI *rad/two));scalar=amrex::Math::powi< 2 >(std::cos(PI *rad/two));} else { delta_theta=zero;scalar=zero;} Real scaled_height=z_agl/z_tr;int which_zone=-1;if(z_agl<=height) { which_zone=1;} else if(z_agl<=z_tr) { which_zone=2;} else { which_zone=3;} theta_total=t[k]+delta_theta;temperature=getTgivenPandTh(p[k], theta_total, RdoCp);Real T_b=getTgivenPandTh(p[k], t[k], RdoCp);RH=HSEutils::compute_relative_humidity(p[k], T_b, use_empirical, which_zone, scaled_height);Real q_v_hot;if(z_agl< height) { q_v_hot=amrex::Real(0.014);} else { q_v_hot=HSEutils::vapor_mixing_ratio(p[k], T_b, RH, use_empirical, which_zone);} rho=p[k]/(R_d *temperature *(one+RvoRd *q_v_hot));Real temperature_back=getTgivenPandTh(p[k], t[k], RdoCp);Real T_back=getTgivenPandTh(p[k], t[k], RdoCp);Real RH_back=HSEutils::compute_relative_humidity(p[k], T_back, use_empirical, which_zone, scaled_height);Real q_v_back;if(z_agl< height) { q_v_back=amrex::Real(0.014);} else { q_v_back=HSEutils::vapor_mixing_ratio(p[k], T_back, RH_back, use_empirical, which_zone);} Real rho_back=getRhogivenTandPress(temperature_back, p[k], q_v_back);state_pert(i, j, k, RhoTheta_comp)=rho *theta_total - rho_back *t[k] *(one+RvoRd *q_v_back);state_pert(i, j, k, Rho_comp)=rho - rho_back *(one+q_v_back);state_pert(i, j, k, RhoScalar_comp)=rho *scalar;if(use_moisture) { state_pert(i, j, k, RhoQ1_comp)=rho *q_v_hot;state_pert(i, j, k, RhoQ2_comp)=zero;} }   
)
Here is the call graph for this function:

◆ pp_prob()

ParmParse pp_prob ( "prob"  )

◆ query() [1/15]

pp_prob query ( "eq_pot_temp"  ,
eq_pot_temp   
)

◆ query() [2/15]

pp_prob query ( "height"  ,
height   
)

◆ query() [3/15]

pp_prob query ( "qt_init"  ,
q_t   
)

◆ query() [4/15]

pp_prob query ( "T_tr"  ,
T_tr   
)

◆ query() [5/15]

pp_prob query ( "theta_0"  ,
theta_0   
)

◆ query() [6/15]

pp_prob query ( "theta_c"  ,
theta_c   
)

◆ query() [7/15]

pp_prob query ( "theta_tr"  ,
theta_tr   
)

◆ query() [8/15]

pp_prob query ( "use_empirical_psat"  ,
use_empirical   
)

◆ query() [9/15]

pp_prob query ( "x_c"  ,
x_c   
)

◆ query() [10/15]

pp_prob query ( "x_r"  ,
x_r   
)

◆ query() [11/15]

pp_prob query ( "y_c"  ,
y_c   
)

◆ query() [12/15]

pp_prob query ( "y_r"  ,
y_r   
)

◆ query() [13/15]

pp_prob query ( "z_c"  ,
z_c   
)

◆ query() [14/15]

pp_prob query ( "z_r"  ,
z_r   
)

◆ query() [15/15]

pp_prob query ( "z_tr"  ,
z_tr   
)

Variable Documentation

◆ dz

const amrex::Real& dz = geomdata.CellSize()[2]

◆ else

else
Initial value:
{
HSEutils::init_isentropic_hse_no_terrain(h_t.data(), h_r.data(),h_p.data(),h_q_v.data(),dz,geomdata.ProbLo(2),khi,
const amrex::Real & dz
Definition: ERF_InitCustomPert_SuperCell.H:23

◆ eq_pot_temp

Real eq_pot_temp = amrex::Real(320.0)

Referenced by if().

◆ height

Real height = amrex::Real(1200.)

Referenced by if(), and ParallelFor().

◆ khi

const int khi = geomdata.Domain().bigEnd()[2]

Referenced by if().

◆ p

Real* p = d_p.data()

Referenced by ParallelFor().

◆ q_t

Real q_t = amrex::Real(0.02)

Referenced by if().

◆ r_c

Real r_c = one

Referenced by ParallelFor().

◆ t

Real* t = d_t.data()

Referenced by ParallelFor().

◆ T_tr

Real T_tr = amrex::Real(213.0)

Referenced by if().

◆ theta_0

Real theta_0 = amrex::Real(300.0)

Referenced by if().

◆ theta_c

Real theta_c = three

Referenced by ParallelFor().

◆ theta_tr

Real theta_tr = amrex::Real(343.0)

Referenced by if().

◆ use_empirical

bool use_empirical = false

Referenced by if(), and ParallelFor().

◆ use_moisture

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

Referenced by ParallelFor().

◆ use_z_phys

const bool use_z_phys = use_physical_z()

Referenced by ParallelFor().

◆ x_c

Real x_c = zero

Referenced by ParallelFor().

◆ x_r

Real x_r = amrex::Real(10.0e3)

Referenced by ParallelFor().

◆ y_c

Real y_c = zero

Referenced by ParallelFor().

◆ y_r

Real y_r = amrex::Real(10.0e3)

Referenced by ParallelFor().

◆ z_c

Real z_c = amrex::Real(1.5e3)

Referenced by ParallelFor().

◆ z_r

Real z_r = amrex::Real(1.5e3)

Referenced by ParallelFor().

◆ z_tr

Real z_tr = amrex::Real(12000.)

Referenced by if(), and ParallelFor().