ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
TurbChoice Struct Reference

#include <ERF_TurbStruct.H>

Collaboration diagram for TurbChoice:

Public Member Functions

void init_params (int lev, int max_level, std::string pp_prefix)
 
void check_params (amrex::GpuArray< ERF_BC, AMREX_SPACEDIM *2 > &phys_bc_type)
 
void display (int lev)
 
bool uses_eamxx_shoc () const noexcept
 
bool uses_native_shoc () const noexcept
 
bool uses_shoc_family () const noexcept
 
bool pbl_requires_surface_layer () const noexcept
 
bool pbl_suppresses_microphysics_condensation () const noexcept
 

Public Attributes

LESType les_type = LESType::None
 
amrex::Real Pr_t = one / three
 
amrex::Real Pr_t_inv = three
 
amrex::Real Sc_t = one
 
amrex::Real Sc_t_inv = one
 
amrex::Real Cs = zero
 
bool smag2d = false
 
amrex::Real Ce = amrex::Real(0.93)
 
amrex::Real Ce_wall = zero
 
amrex::Real Ck = amrex::Real(0.1)
 
amrex::Real Cmu0 = amrex::Real(0.5562)
 
amrex::Real Cb = amrex::Real(0.35)
 
amrex::Real Rt_crit = -one
 
amrex::Real Rt_min = -three
 
amrex::Real l_g_max = amrex::Real(30.0)
 
amrex::Real sigma_k = amrex::Real(0.5)
 
amrex::Real theta_ref = zero
 
StratType strat_type = StratType::theta
 
bool mix_isotropic = true
 
bool use_Ri_correction = true
 
amrex::Real Ri_crit = fourth
 
RANSType rans_type = RANSType::None
 
bool dirichlet_k = false
 
PBLType pbl_type = PBLType::None
 
MYNNLevel25 pbl_mynn
 
MYNNLevel2 pbl_mynn_level2
 
bool use_kturb = false
 
bool use_keqn
 
bool use_pbl_tke
 
bool use_tke = false
 
bool init_tke_from_ustar = false
 
amrex::Real tke_min = amrex::Real(1.e-6)
 
amrex::Real pbl_ysu_coriolis_freq
 
bool pbl_ysu_use_consistent_coriolis
 
bool pbl_ysu_force_over_water
 
amrex::Real pbl_ysu_land_Ribcr
 
amrex::Real pbl_ysu_unst_Ribcr
 
bool enable_ysu_liquid_theta
 
bool enable_ysu_countergradient
 
bool enable_ysu_terrain_pblh_floor
 
bool enable_ysu_sat_limiter
 
bool enable_ysu_topdown
 
bool enable_ysu_entrainment
 
bool enable_ysu_cloud_pblh
 
amrex::Real ysu_qcloud_threshold
 
bool ysu_moistvars = false
 
bool pbl_ysunew_highres_bounds = false
 
amrex::Real pbl_mrf_coriolis_freq = amrex::Real(1.0e-4)
 
amrex::Real pbl_mrf_Ribcr = amrex::Real(0.5)
 
amrex::Real pbl_mrf_const_b = amrex::Real(7.8)
 
amrex::Real pbl_mrf_sf = amrex::Real(0.1)
 
bool mrf_moistvars = false
 
bool enable_mrf_countergradient = false
 
bool enable_mrf_cloud_adjustment = false
 
bool pbl_mrf_highres_bounds = false
 
bool enable_mrf_unbounded_vpert = false
 
bool pbl_mrf_use_zero_ri_extent = false
 
bool advect_tke = true
 
bool diffuse_tke_3D = true
 

Detailed Description

Container holding quantities related to turbulence parametrizations

Member Function Documentation

◆ check_params()

void TurbChoice::check_params ( amrex::GpuArray< ERF_BC, AMREX_SPACEDIM *2 > &  phys_bc_type)
inline
323  {
324  // BC compatibility
326  phys_bc_type[amrex::Orientation(amrex::Direction::z,amrex::Orientation::low)] != ERF_BC::surface_layer ) {
327  amrex::Abort("The selected PBL model requires MOST at lower boundary");
328  }
329  if ( (les_type == LESType::Deardorff) && (Ce_wall > 0) &&
330  (phys_bc_type[amrex::Orientation(amrex::Direction::z,amrex::Orientation::low)] != ERF_BC::surface_layer) &&
331  (phys_bc_type[amrex::Orientation(amrex::Direction::z,amrex::Orientation::low)] != ERF_BC::slip_wall) &&
332  (phys_bc_type[amrex::Orientation(amrex::Direction::z,amrex::Orientation::low)] != ERF_BC::no_slip_wall) )
333  {
334  amrex::Warning("Deardorff LES assumes wall at zlo when applying Ce_wall");
335  }
336  }
@ no_slip_wall
@ surface_layer
amrex::Real Ce_wall
Definition: ERF_TurbStruct.H:510
LESType les_type
Definition: ERF_TurbStruct.H:494
bool pbl_requires_surface_layer() const noexcept
Definition: ERF_TurbStruct.H:558
Here is the call graph for this function:

◆ display()

void TurbChoice::display ( int  lev)
inline
339  {
340  amrex::Print() << "Turbulence Settings at level " << lev << std::endl;
341 
342  if (
343  les_type == LESType::None && rans_type == RANSType::None &&
344  pbl_type == PBLType::None) {
345  amrex::Print() << " Using DNS model at level " << lev << std::endl;
346  } else if (les_type == LESType::Smagorinsky) {
347  if (smag2d) {
348  amrex::Print() << " Using 2D Smagorinsky LES model at level " << lev << std::endl;
349  } else {
350  amrex::Print() << " Using Smagorinsky LES model at level " << lev << std::endl;
351  }
352  if (use_Ri_correction) {
353  amrex::Print() << " Smagorinsky uses Richardson number correction with Ri_crit = "
354  << Ri_crit << std::endl;
355  }
356  } else if (les_type == LESType::Deardorff) {
357  amrex::Print() << " Using Deardorff LES model at level " << lev << std::endl;
358  } else if (rans_type == RANSType::kEqn) {
359  amrex::Print()
360  << " Using Axell & Liungman one-equation RANS k model at level " << lev
361  << std::endl;
362  } else if (pbl_type == PBLType::MYJ) {
363  amrex::Print() << " Using MYJ PBL model at level " << lev << std::endl;
364  } else if (pbl_type == PBLType::MYNN25) {
365  amrex::Print() << " Using MYNN2.5 PBL model at level " << lev << std::endl;
366  } else if (pbl_type == PBLType::MYNNEDMF) {
367  amrex::Print() << " Using MYNNEDMF PBL model at level " << lev << std::endl;
368  } else if (pbl_type == PBLType::YSU) {
369  amrex::Print() << " Using YSU PBL model at level " << lev << std::endl;
370  } else if (pbl_type == PBLType::YSUNew) {
371  amrex::Print() << " Using YSU PBL model at level " << lev << std::endl;
372  } else if (pbl_type == PBLType::MRF) {
373  amrex::Print() << " Using MRF PBL model at level " << lev << std::endl;
374  } else if (pbl_type == PBLType::EAMXX_SHOC) {
375  amrex::Print() << " Using EAMxx SHOC PBL model at level " << lev << std::endl;
376  } else if (pbl_type == PBLType::NATIVE_SHOC) {
377  amrex::Print() << " Using native SHOC PBL model at level " << lev << std::endl;
378  } else {
379  amrex::Error("Unknown turbulence model");
380  }
381 
382  if (les_type != LESType::None) {
383  if (les_type == LESType::Smagorinsky) {
384  amrex::Print() << " Cs : " << Cs << std::endl;
385  }
386  if (les_type == LESType::Deardorff) {
387  amrex::Print() << " Ce : " << Ce << std::endl;
388  amrex::Print() << " Ce at wall : " << Ce_wall << std::endl;
389  amrex::Print() << " Ck : " << Ck << std::endl;
390  amrex::Print() << " sigma_k : " << sigma_k << std::endl;
391 
392  // Sullivan et al 1994, Eqn 14
393  amrex::Real Cs_equiv = std::sqrt(Ck * std::sqrt(Ck / Ce));
394  amrex::Print() << " equivalent Cs : " << Cs_equiv
395  << std::endl;
396  }
397  amrex::Print() << " isotropic mixing : " << mix_isotropic
398  << std::endl;
399  }
400 
401  if (rans_type != RANSType::None) {
402  if (rans_type == RANSType::kEqn) {
403  amrex::Print() << "Cmu0 : " << Cmu0 << std::endl;
404  amrex::Print() << "sigma_k : " << sigma_k << std::endl;
405  amrex::Print() << "Cb : " << Cb << std::endl;
406  amrex::Print() << "Rt_crit : " << Rt_crit << std::endl;
407  amrex::Print() << "Rt_min : " << Rt_min << std::endl;
408  amrex::Print() << "max_geom_lscale : " << l_g_max << std::endl;
409  }
410  }
411 
412  if ((les_type == LESType::Deardorff) ||
413  (rans_type == RANSType::kEqn)) {
414  if (theta_ref > 0) {
415  amrex::Print() << " reference theta : " << theta_ref << std::endl;
416  } else {
417  amrex::Print() << " reference theta : n/a" << std::endl;
418  }
419  }
420 
421  if ((les_type != LESType::None) || (rans_type != RANSType::None)) {
422  amrex::Print() << " Pr_t : " << Pr_t << std::endl;
423  amrex::Print() << " Sc_t : " << Sc_t << std::endl;
424  }
425 
426  if (pbl_type == PBLType::MYNN25 || pbl_type == PBLType::MYNNEDMF) {
427  amrex::Print() << " pbl_mynn_A1 : " << pbl_mynn.A1 << std::endl;
428  amrex::Print() << " pbl_mynn_A2 : " << pbl_mynn.A2 << std::endl;
429  amrex::Print() << " pbl_mynn_B1 : " << pbl_mynn.B1 << std::endl;
430  amrex::Print() << " pbl_mynn_B2 : " << pbl_mynn.B2 << std::endl;
431  amrex::Print() << " pbl_mynn_C1 : " << pbl_mynn.C1 << std::endl;
432  amrex::Print() << " pbl_mynn_C2 : " << pbl_mynn.C2 << std::endl;
433  amrex::Print() << " pbl_mynn_C3 : " << pbl_mynn.C3 << std::endl;
434  amrex::Print() << " pbl_mynn_C4 : " << pbl_mynn.C4 << std::endl;
435  amrex::Print() << " pbl_mynn_C5 : " << pbl_mynn.C5 << std::endl;
436  } else if (pbl_type == PBLType::YSU || pbl_type == PBLType::YSUNew) {
437  amrex::Print() << " pbl_ysu_coriolis_freq : "
438  << pbl_ysu_coriolis_freq << std::endl;
439  amrex::Print() << " pbl_ysu_use_consistent_coriolis : "
440  << pbl_ysu_use_consistent_coriolis << std::endl;
441  amrex::Print() << " pbl_ysu_force_over_water : "
442  << pbl_ysu_force_over_water << std::endl;
443  amrex::Print() << " pbl_ysu_land_Ribcr : "
444  << pbl_ysu_land_Ribcr << std::endl;
445  amrex::Print() << " pbl_ysu_unst_Ribcr : "
446  << pbl_ysu_unst_Ribcr << std::endl;
447  amrex::Print() << " enable_ysu_liquid_theta : "
448  << enable_ysu_liquid_theta << std::endl;
449  amrex::Print() << " enable_ysu_countergradient : "
450  << enable_ysu_countergradient << std::endl;
451  amrex::Print() << " enable_ysu_terrain_pblh_floor : "
452  << enable_ysu_terrain_pblh_floor << std::endl;
453  amrex::Print() << " enable_ysu_sat_limiter : "
454  << enable_ysu_sat_limiter << std::endl;
455  amrex::Print() << " enable_ysu_topdown : "
456  << enable_ysu_topdown << std::endl;
457  amrex::Print() << " enable_ysu_entrainment : "
458  << enable_ysu_entrainment << std::endl;
459  amrex::Print() << " enable_ysu_cloud_pblh : "
460  << enable_ysu_cloud_pblh << std::endl;
461  amrex::Print() << " ysu_qcloud_threshold : "
462  << ysu_qcloud_threshold << std::endl;
463  amrex::Print() << " ysu_moistvars : "
464  << ysu_moistvars << std::endl;
465  amrex::Print() << " pbl_ysunew_highres_bounds : "
466  << pbl_ysunew_highres_bounds << std::endl;
467  amrex::Print() << " enable_mrf_unbounded_vpert : "
468  << enable_mrf_unbounded_vpert << std::endl;
469  } else if (pbl_type == PBLType::MRF) {
470  amrex::Print() << " pbl_mrf_coriolis_freq : " << pbl_mrf_coriolis_freq
471  << std::endl;
472  amrex::Print() << " pbl_mrf_Ribcr : " << pbl_mrf_Ribcr
473  << std::endl;
474  amrex::Print() << " pbl_mrf_const_b : " << pbl_mrf_const_b
475  << std::endl;
476  amrex::Print() << " pbl_mrf_sf : " << pbl_mrf_sf
477  << std::endl;
478  amrex::Print() << " mrf_moistvars : " << mrf_moistvars
479  << std::endl;
480  amrex::Print() << " enable_mrf_countergradient : " << enable_mrf_countergradient
481  << std::endl;
482  amrex::Print() << " enable_mrf_cloud_adjustment : " << enable_mrf_cloud_adjustment
483  << std::endl;
484  amrex::Print() << " pbl_mrf_highres_bounds : " << pbl_mrf_highres_bounds
485  << std::endl;
486  amrex::Print() << " enable_mrf_unbounded_vpert : " << enable_mrf_unbounded_vpert
487  << std::endl;
488  amrex::Print() << " pbl_mrf_use_zero_ri_extent : " << pbl_mrf_use_zero_ri_extent
489  << std::endl;
490  }
491  }
amrex::Real Real
Definition: ERF_ShocInterface.H:19
amrex::Real C4
Definition: ERF_MYNNStruct.H:50
amrex::Real C1
Definition: ERF_MYNNStruct.H:47
amrex::Real C3
Definition: ERF_MYNNStruct.H:49
amrex::Real C2
Definition: ERF_MYNNStruct.H:48
amrex::Real A2
Definition: ERF_MYNNStruct.H:44
amrex::Real B1
Definition: ERF_MYNNStruct.H:45
amrex::Real B2
Definition: ERF_MYNNStruct.H:46
amrex::Real C5
Definition: ERF_MYNNStruct.H:51
amrex::Real A1
Definition: ERF_MYNNStruct.H:43
bool enable_ysu_countergradient
Definition: ERF_TurbStruct.H:610
bool smag2d
Definition: ERF_TurbStruct.H:506
amrex::Real sigma_k
Definition: ERF_TurbStruct.H:522
bool pbl_mrf_use_zero_ri_extent
Definition: ERF_TurbStruct.H:636
MYNNLevel25 pbl_mynn
Definition: ERF_TurbStruct.H:573
PBLType pbl_type
Definition: ERF_TurbStruct.H:541
amrex::Real pbl_mrf_const_b
Definition: ERF_TurbStruct.H:629
amrex::Real ysu_qcloud_threshold
Definition: ERF_TurbStruct.H:622
amrex::Real Rt_min
Definition: ERF_TurbStruct.H:517
amrex::Real pbl_mrf_coriolis_freq
Definition: ERF_TurbStruct.H:627
bool pbl_ysunew_highres_bounds
Definition: ERF_TurbStruct.H:625
bool enable_ysu_topdown
Definition: ERF_TurbStruct.H:616
amrex::Real Ri_crit
Definition: ERF_TurbStruct.H:533
RANSType rans_type
Definition: ERF_TurbStruct.H:536
bool enable_mrf_unbounded_vpert
Definition: ERF_TurbStruct.H:635
amrex::Real pbl_mrf_Ribcr
Definition: ERF_TurbStruct.H:628
amrex::Real Ck
Definition: ERF_TurbStruct.H:511
amrex::Real Cmu0
Definition: ERF_TurbStruct.H:514
bool pbl_ysu_use_consistent_coriolis
Definition: ERF_TurbStruct.H:598
amrex::Real Cb
Definition: ERF_TurbStruct.H:515
amrex::Real pbl_mrf_sf
Definition: ERF_TurbStruct.H:630
bool enable_mrf_countergradient
Definition: ERF_TurbStruct.H:632
bool use_Ri_correction
Definition: ERF_TurbStruct.H:532
bool enable_ysu_sat_limiter
Definition: ERF_TurbStruct.H:614
amrex::Real pbl_ysu_land_Ribcr
Definition: ERF_TurbStruct.H:604
bool mrf_moistvars
Definition: ERF_TurbStruct.H:631
bool enable_ysu_entrainment
Definition: ERF_TurbStruct.H:618
amrex::Real Cs
Definition: ERF_TurbStruct.H:505
amrex::Real Ce
Definition: ERF_TurbStruct.H:509
bool enable_mrf_cloud_adjustment
Definition: ERF_TurbStruct.H:633
bool enable_ysu_cloud_pblh
Definition: ERF_TurbStruct.H:620
bool enable_ysu_terrain_pblh_floor
Definition: ERF_TurbStruct.H:612
amrex::Real pbl_ysu_coriolis_freq
Definition: ERF_TurbStruct.H:595
bool pbl_ysu_force_over_water
Definition: ERF_TurbStruct.H:601
bool enable_ysu_liquid_theta
Definition: ERF_TurbStruct.H:608
bool pbl_mrf_highres_bounds
Definition: ERF_TurbStruct.H:634
amrex::Real Pr_t
Definition: ERF_TurbStruct.H:497
amrex::Real theta_ref
Definition: ERF_TurbStruct.H:525
amrex::Real Sc_t
Definition: ERF_TurbStruct.H:501
amrex::Real Rt_crit
Definition: ERF_TurbStruct.H:516
bool ysu_moistvars
Definition: ERF_TurbStruct.H:624
amrex::Real pbl_ysu_unst_Ribcr
Definition: ERF_TurbStruct.H:606
bool mix_isotropic
Definition: ERF_TurbStruct.H:530
amrex::Real l_g_max
Definition: ERF_TurbStruct.H:518

◆ init_params()

void TurbChoice::init_params ( int  lev,
int  max_level,
std::string  pp_prefix 
)
inline
85  {
86  amrex::ParmParse pp(pp_prefix);
87 
88  // Which LES closure?
89  query_one_or_per_level(pp, "les_type", les_type, lev, max_level);
90 
91  // Handle 2-D Smag
92  if (les_type == LESType::Smagorinsky2D) {
93  les_type = LESType::Smagorinsky;
94  smag2d = true;
95  }
96 
97  // Which RANS closure?
98  query_one_or_per_level(pp, "rans_type", rans_type, lev, max_level);
99 
100  if ((rans_type != RANSType::None) && (les_type != LESType::None)) {
101  amrex::Error("Hybrid RANS-LES not implemented");
102  }
103 
104  // Which PBL Closure
105  query_one_or_per_level_enum_case_insensitive(pp, "pbl_type", pbl_type, lev, max_level);
106  if (pbl_type == PBLType::SHOC) {
107  static bool warned_legacy_shoc = false;
108  if (!warned_legacy_shoc) {
109  amrex::Warning("erf.pbl_type = SHOC is deprecated; use erf.pbl_type = EAMXX_SHOC");
110  warned_legacy_shoc = true;
111  }
112  pbl_type = PBLType::EAMXX_SHOC;
113  }
114 
115  // Do some more stuff for PBL Modeling
116  if (pbl_type != PBLType::None) {
117  // Check for compatibility between PBL, LES, Molec Transport
118  if (les_type != LESType::None) {
119  amrex::Print() << "Selected a PBL model and an LES model: "
120  << "Using PBL for vertical transport, LES for horizontal"
121  << std::endl;
122  }
123  if (les_type == LESType::Smagorinsky) {
124  if (!smag2d)
125  amrex::Error("If using Smagorinsky with a PBL model, the 2-D "
126  "formulation should be used");
127  } else if (les_type == LESType::Deardorff) {
128  amrex::Error(
129  "It is not recommended to use Deardorff LES and a PBL model");
130  }
131 
132  if (pbl_type == PBLType::MYNN25 || pbl_type == PBLType::MYNNEDMF) {
133  query_one_or_per_level(pp, "pbl_mynn_A1", pbl_mynn.A1, lev, max_level);
134  query_one_or_per_level(pp, "pbl_mynn_A2", pbl_mynn.A2, lev, max_level);
135  query_one_or_per_level(pp, "pbl_mynn_B1", pbl_mynn.B1, lev, max_level);
136  query_one_or_per_level(pp, "pbl_mynn_B2", pbl_mynn.B2, lev, max_level);
137  query_one_or_per_level(pp, "pbl_mynn_C1", pbl_mynn.C1, lev, max_level);
138  query_one_or_per_level(pp, "pbl_mynn_C2", pbl_mynn.C2, lev, max_level);
139  query_one_or_per_level(pp, "pbl_mynn_C3", pbl_mynn.C3, lev, max_level);
140  query_one_or_per_level(pp, "pbl_mynn_C4", pbl_mynn.C4, lev, max_level);
141  query_one_or_per_level(pp, "pbl_mynn_C5", pbl_mynn.C5, lev, max_level);
146  pp, "pbl_mynn_diffuse_moistvars", pbl_mynn.diffuse_moistvars, lev,
147  max_level);
149  pp, "pbl_mynn_SMmin", pbl_mynn.SMmin, lev, max_level);
151  pp, "pbl_mynn_SMmax", pbl_mynn.SMmax, lev, max_level);
153  pp, "pbl_mynn_SHmin", pbl_mynn.SHmin, lev, max_level);
155  pp, "pbl_mynn_SHmax", pbl_mynn.SHmax, lev, max_level);
157  pp, "pbl_mynn_SQfactor", pbl_mynn.SQfac, lev, max_level);
158  } else if (pbl_type == PBLType::YSU || pbl_type == PBLType::YSUNew) {
160  pp, "pbl_ysu_coriolis_freq", pbl_ysu_coriolis_freq, lev, max_level);
162  pp, "pbl_ysu_use_consistent_coriolis",
163  pbl_ysu_use_consistent_coriolis, lev, max_level);
165  pp, "pbl_ysu_force_over_water", pbl_ysu_force_over_water, lev,
166  max_level);
168  pp, "pbl_ysu_land_Ribcr", pbl_ysu_land_Ribcr, lev, max_level);
170  pp, "pbl_ysu_unst_Ribcr", pbl_ysu_unst_Ribcr, lev, max_level);
172  pp, "enable_ysu_liquid_theta", enable_ysu_liquid_theta, lev, max_level);
174  pp, "enable_ysu_countergradient", enable_ysu_countergradient, lev, max_level);
176  pp, "enable_ysu_terrain_pblh_floor", enable_ysu_terrain_pblh_floor, lev, max_level);
178  pp, "enable_ysu_sat_limiter", enable_ysu_sat_limiter, lev, max_level);
180  pp, "enable_ysu_topdown", enable_ysu_topdown, lev, max_level);
182  pp, "enable_ysu_entrainment", enable_ysu_entrainment, lev, max_level);
184  pp, "enable_ysu_cloud_pblh", enable_ysu_cloud_pblh, lev, max_level);
186  pp, "enable_mrf_unbounded_vpert", enable_mrf_unbounded_vpert, lev, max_level);
188  pp, "ysu_qcloud_threshold", ysu_qcloud_threshold, lev, max_level);
190  pp, "ysu_moistvars", ysu_moistvars, lev, max_level);
192  pp, "pbl_ysunew_highres_bounds", pbl_ysunew_highres_bounds, lev, max_level);
193  } else if (pbl_type == PBLType::MRF) {
195  pp, "pbl_mrf_coriolis_freq", pbl_mrf_coriolis_freq, lev, max_level);
197  pp, "pbl_mrf_Ribcr", pbl_mrf_Ribcr, lev, max_level);
199  pp, "pbl_mrf_const_b", pbl_mrf_const_b, lev, max_level);
200  query_one_or_per_level(pp, "pbl_mrf_sf", pbl_mrf_sf, lev, max_level);
202  pp, "mrf_moistvars", mrf_moistvars, lev, max_level);
204  pp, "enable_mrf_countergradient", enable_mrf_countergradient, lev, max_level);
206  pp, "enable_mrf_cloud_adjustment", enable_mrf_cloud_adjustment, lev, max_level);
208  pp, "pbl_mrf_highres_bounds", pbl_mrf_highres_bounds, lev, max_level);
210  pp, "enable_mrf_unbounded_vpert", enable_mrf_unbounded_vpert, lev, max_level);
212  pp, "pbl_mrf_use_zero_ri_extent", pbl_mrf_use_zero_ri_extent, lev, max_level);
213  } else if (pbl_type == PBLType::SHOC) {
214 #ifndef ERF_USE_SHOC
215  amrex::Abort("You set use_shoc to true but didn't build with SHOC; you must rebuild the executable");
216  }
217 #endif
218  if (uses_eamxx_shoc()) {
219 #ifndef ERF_USE_EAMXX_SHOC
220  amrex::Abort("PBLType::EAMXX_SHOC requested, but ERF was not built with ERF_ENABLE_EAMXX_SHOC=ON");
221 #endif
222  }
223 
225  std::string zlo_bc = "none";
226  amrex::ParmParse pp_bc("zlo");
227  pp_bc.get("type",zlo_bc);
228  if (amrex::toLower(zlo_bc) != "surface_layer") {
229  amrex::Abort("You must use the surface_layer BC at zlo with the selected PBL.");
230  }
231  }
232  }
233 
234  // Flags for QKE/TKE equation
235  if (pbl_type == PBLType::MYJ || pbl_type == PBLType::MYNN25 || pbl_type == PBLType::MYNNEDMF) {
236  // Add sources/sinks to QKE/TKE? (MYJ does this inline)
237  if (pbl_type == PBLType::MYNN25 || pbl_type == PBLType::MYNNEDMF) {
238  use_pbl_tke = true;
239  }
240  // Advect QKE/TKE?
241  query_one_or_per_level(pp, "advect_tke" , advect_tke , lev, max_level);
242  // Apply numerical diffusion to QKE/TKE?
243  query_one_or_per_level(pp, "diffuse_tke_3D", diffuse_tke_3D, lev, max_level);
244  }
245 
246  // There is a default value of 1e-6 but the user can override the value here,
247  // and in addition can add perturbational values. and in addition can add perturbational values.
248  pp.query("tke_min",tke_min);
249 
250  // LES constants...
251  query_one_or_per_level(pp, "Cs", Cs, lev, max_level);
252 
253  query_one_or_per_level(pp, "Pr_t", Pr_t, lev, max_level);
254  query_one_or_per_level(pp, "Sc_t", Sc_t, lev, max_level);
255 
256  // Compute relevant forms of diffusion parameters
257  Pr_t_inv = one / Pr_t;
258  Sc_t_inv = one / Sc_t;
259 
260  if (les_type == LESType::Deardorff) {
261  query_one_or_per_level(pp, "Ck", Ck, lev, max_level);
262  query_one_or_per_level(pp, "Ce", Ce, lev, max_level);
263  query_one_or_per_level(pp, "Ce_wall", Ce_wall, lev, max_level);
264  }
265 
266  // To quantify atmospheric stability for subgrid modeling
267  query_one_or_per_level(pp, "thermal_stratification", strat_type, lev, max_level);
268  if (strat_type == StratType::theta) {
269  amrex::Print() << "Thermal stratification based on gradient of potential temperature" << std::endl;
270  } else if (strat_type == StratType::thetav) {
271  amrex::Print() << "Thermal stratification based on gradient of virtual potential temperature" << std::endl;
272  } else if (strat_type == StratType::thetal) {
273  amrex::Print() << "Thermal stratification based on gradient of linearized liquid-water potential temperature" << std::endl;
274  }
275 
276  // k-eqn constants
277  query_one_or_per_level(pp, "Cmu0", Cmu0, lev, max_level);
278  query_one_or_per_level(pp, "Cb", Cb, lev, max_level);
279  query_one_or_per_level(pp, "Rt_crit", Rt_crit, lev, max_level);
280  query_one_or_per_level(pp, "Rt_min", Rt_min, lev, max_level);
281  query_one_or_per_level(pp, "max_geom_lscale", l_g_max, lev, max_level);
282  query_one_or_per_level(pp, "dirichlet_k", dirichlet_k, lev, max_level);
283 
284  // Common inputs (LES or RANS)
285  if (!query_one_or_per_level(pp, "sigma_k", sigma_k, lev, max_level) && rans_type == RANSType::kEqn) {
286  amrex::Print() << "Overriding default sigma_k for k-eqn RANS" << std::endl;
287  sigma_k = one;
288  };
289  query_one_or_per_level(pp, "theta_ref", theta_ref, lev, max_level);
290 
291  query_one_or_per_level(pp, "mix_isotropic", mix_isotropic, lev, max_level);
292  query_one_or_per_level(pp, "use_Ri_correction", use_Ri_correction, lev, max_level);
293  query_one_or_per_level(pp, "Ri_crit", Ri_crit, lev, max_level);
294 
295  // Set common flags
296  use_kturb =
297  ((les_type != LESType::None) || (rans_type != RANSType::None) ||
298  (pbl_type != PBLType::None));
299  use_keqn =
300  ((les_type == LESType::Deardorff) || (rans_type == RANSType::kEqn));
301  use_tke =
302  ((les_type == LESType::Deardorff) || (rans_type == RANSType::kEqn) ||
303  (pbl_type == PBLType::MYJ) || (pbl_type == PBLType::MYNN25) ||
304  (pbl_type == PBLType::MYNNEDMF) || uses_shoc_family());
305 
306  if (use_tke) {
307  query_one_or_per_level(pp, "init_tke_from_ustar", init_tke_from_ustar, lev, max_level);
308  }
309 
310  // Validate inputs
311  if (les_type == LESType::Smagorinsky) {
312  if (Cs == 0) {
313  amrex::Error("Need to specify Cs for Smagorsinky LES");
314  }
315  if (smag2d && mix_isotropic) {
316  amrex::Print() << "Turning off mix_isotropic for 2-D Smagorinsky" << std::endl;
317  mix_isotropic = false;
318  }
319  }
320  }
constexpr amrex::Real one
Definition: ERF_Constants.H:9
ParmParse pp("prob")
int query_one_or_per_level_enum_case_insensitive(const amrex::ParmParse &pp, const char *query_string, T &query_var, const int lev, const int maxlev)
Definition: ERF_TurbStruct.H:48
int query_one_or_per_level(const amrex::ParmParse &pp, const char *query_string, T &query_var, const int lev, const int maxlev)
Definition: ERF_TurbStruct.H:16
@ theta
Definition: ERF_MM5.H:20
amrex::Real SMmax
Definition: ERF_MYNNStruct.H:58
amrex::Real SHmax
Definition: ERF_MYNNStruct.H:60
amrex::Real SQfac
Definition: ERF_MYNNStruct.H:54
amrex::Real SHmin
Definition: ERF_MYNNStruct.H:59
amrex::Real SMmin
Definition: ERF_MYNNStruct.H:57
bool diffuse_moistvars
Definition: ERF_MYNNStruct.H:65
void init_coeffs(amrex::Real A1_lvl25, amrex::Real A2_lvl25, amrex::Real B1, amrex::Real B2, amrex::Real C1, amrex::Real C2, amrex::Real C3, amrex::Real, amrex::Real C5)
Definition: ERF_MYNNStruct.H:69
amrex::Real tke_min
Definition: ERF_TurbStruct.H:591
bool use_pbl_tke
Definition: ERF_TurbStruct.H:581
amrex::Real Sc_t_inv
Definition: ERF_TurbStruct.H:502
bool use_keqn
Definition: ERF_TurbStruct.H:578
MYNNLevel2 pbl_mynn_level2
Definition: ERF_TurbStruct.H:574
StratType strat_type
Definition: ERF_TurbStruct.H:527
bool uses_eamxx_shoc() const noexcept
Definition: ERF_TurbStruct.H:543
bool dirichlet_k
Definition: ERF_TurbStruct.H:538
bool advect_tke
Definition: ERF_TurbStruct.H:639
bool uses_shoc_family() const noexcept
Definition: ERF_TurbStruct.H:553
bool init_tke_from_ustar
Definition: ERF_TurbStruct.H:588
bool use_tke
Definition: ERF_TurbStruct.H:583
bool diffuse_tke_3D
Definition: ERF_TurbStruct.H:641
amrex::Real Pr_t_inv
Definition: ERF_TurbStruct.H:498
bool use_kturb
Definition: ERF_TurbStruct.H:577
Here is the call graph for this function:

◆ pbl_requires_surface_layer()

bool TurbChoice::pbl_requires_surface_layer ( ) const
inlinenoexcept
559  {
560  return (pbl_type == PBLType::MYNN25) ||
561  (pbl_type == PBLType::MYNNEDMF) ||
562  (pbl_type == PBLType::YSU) ||
563  (pbl_type == PBLType::YSUNew) ||
564  (pbl_type == PBLType::MRF) ||
566  }

Referenced by check_params(), and init_params().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pbl_suppresses_microphysics_condensation()

bool TurbChoice::pbl_suppresses_microphysics_condensation ( ) const
inlinenoexcept
569  {
570  return uses_shoc_family();
571  }
Here is the call graph for this function:

◆ uses_eamxx_shoc()

bool TurbChoice::uses_eamxx_shoc ( ) const
inlinenoexcept
544  {
545  return pbl_type == PBLType::EAMXX_SHOC;
546  }

Referenced by erf_slow_rhs_post(), erf_slow_rhs_pre(), init_params(), and uses_shoc_family().

Here is the caller graph for this function:

◆ uses_native_shoc()

bool TurbChoice::uses_native_shoc ( ) const
inlinenoexcept
549  {
550  return pbl_type == PBLType::NATIVE_SHOC;
551  }

Referenced by erf_slow_rhs_post(), erf_slow_rhs_pre(), and uses_shoc_family().

Here is the caller graph for this function:

◆ uses_shoc_family()

bool TurbChoice::uses_shoc_family ( ) const
inlinenoexcept
554  {
555  return uses_eamxx_shoc() || uses_native_shoc();
556  }
bool uses_native_shoc() const noexcept
Definition: ERF_TurbStruct.H:548

Referenced by ComputeTurbulentViscosity(), init_params(), pbl_requires_surface_layer(), and pbl_suppresses_microphysics_condensation().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ advect_tke

bool TurbChoice::advect_tke = true

Referenced by erf_slow_rhs_post(), and init_params().

◆ Cb

amrex::Real TurbChoice::Cb = amrex::Real(0.35)

◆ Ce

amrex::Real TurbChoice::Ce = amrex::Real(0.93)

◆ Ce_wall

◆ Ck

◆ Cmu0

amrex::Real TurbChoice::Cmu0 = amrex::Real(0.5562)

◆ Cs

◆ diffuse_tke_3D

bool TurbChoice::diffuse_tke_3D = true

Referenced by init_params(), and make_sources().

◆ dirichlet_k

bool TurbChoice::dirichlet_k = false

Referenced by init_params().

◆ enable_mrf_cloud_adjustment

bool TurbChoice::enable_mrf_cloud_adjustment = false

◆ enable_mrf_countergradient

bool TurbChoice::enable_mrf_countergradient = false

◆ enable_mrf_unbounded_vpert

bool TurbChoice::enable_mrf_unbounded_vpert = false

◆ enable_ysu_cloud_pblh

bool TurbChoice::enable_ysu_cloud_pblh
Initial value:
=
true

Referenced by ComputeDiffusivityYSUNew(), display(), and init_params().

◆ enable_ysu_countergradient

bool TurbChoice::enable_ysu_countergradient
Initial value:
=
true

Referenced by ComputeDiffusivityYSUNew(), display(), and init_params().

◆ enable_ysu_entrainment

bool TurbChoice::enable_ysu_entrainment
Initial value:
=
true

Referenced by ComputeDiffusivityYSUNew(), display(), and init_params().

◆ enable_ysu_liquid_theta

bool TurbChoice::enable_ysu_liquid_theta
Initial value:
=
true

Referenced by ComputeDiffusivityYSUNew(), display(), and init_params().

◆ enable_ysu_sat_limiter

bool TurbChoice::enable_ysu_sat_limiter
Initial value:
=
false

Referenced by ComputeDiffusivityYSUNew(), display(), and init_params().

◆ enable_ysu_terrain_pblh_floor

bool TurbChoice::enable_ysu_terrain_pblh_floor
Initial value:
=
true

Referenced by ComputeDiffusivityYSUNew(), display(), and init_params().

◆ enable_ysu_topdown

bool TurbChoice::enable_ysu_topdown
Initial value:
=
true

Referenced by ComputeDiffusivityYSUNew(), display(), and init_params().

◆ init_tke_from_ustar

bool TurbChoice::init_tke_from_ustar = false

Referenced by init_params().

◆ l_g_max

amrex::Real TurbChoice::l_g_max = amrex::Real(30.0)

◆ les_type

◆ mix_isotropic

bool TurbChoice::mix_isotropic = true

◆ mrf_moistvars

bool TurbChoice::mrf_moistvars = false

◆ pbl_mrf_const_b

amrex::Real TurbChoice::pbl_mrf_const_b = amrex::Real(7.8)

◆ pbl_mrf_coriolis_freq

amrex::Real TurbChoice::pbl_mrf_coriolis_freq = amrex::Real(1.0e-4)

Referenced by display(), and init_params().

◆ pbl_mrf_highres_bounds

bool TurbChoice::pbl_mrf_highres_bounds = false

◆ pbl_mrf_Ribcr

amrex::Real TurbChoice::pbl_mrf_Ribcr = amrex::Real(0.5)

◆ pbl_mrf_sf

◆ pbl_mrf_use_zero_ri_extent

bool TurbChoice::pbl_mrf_use_zero_ri_extent = false

◆ pbl_mynn

◆ pbl_mynn_level2

MYNNLevel2 TurbChoice::pbl_mynn_level2

◆ pbl_type

◆ pbl_ysu_coriolis_freq

amrex::Real TurbChoice::pbl_ysu_coriolis_freq

◆ pbl_ysu_force_over_water

bool TurbChoice::pbl_ysu_force_over_water
Initial value:
=
false

Referenced by ComputeDiffusivityYSU(), display(), and init_params().

◆ pbl_ysu_land_Ribcr

amrex::Real TurbChoice::pbl_ysu_land_Ribcr
Initial value:
=
constexpr amrex::Real fourth
Definition: ERF_Constants.H:14

Referenced by ComputeDiffusivityYSU(), ComputeDiffusivityYSUNew(), display(), and init_params().

◆ pbl_ysu_unst_Ribcr

amrex::Real TurbChoice::pbl_ysu_unst_Ribcr
Initial value:
=
constexpr amrex::Real zero
Definition: ERF_Constants.H:8

Referenced by ComputeDiffusivityYSU(), display(), and init_params().

◆ pbl_ysu_use_consistent_coriolis

bool TurbChoice::pbl_ysu_use_consistent_coriolis
Initial value:
=
false

Referenced by display(), and init_params().

◆ pbl_ysunew_highres_bounds

bool TurbChoice::pbl_ysunew_highres_bounds = false

◆ Pr_t

amrex::Real TurbChoice::Pr_t = one / three

Referenced by display(), and init_params().

◆ Pr_t_inv

◆ rans_type

◆ Ri_crit

◆ Rt_crit

amrex::Real TurbChoice::Rt_crit = -one

◆ Rt_min

amrex::Real TurbChoice::Rt_min = -three

◆ Sc_t

amrex::Real TurbChoice::Sc_t = one

Referenced by display(), and init_params().

◆ Sc_t_inv

◆ sigma_k

◆ smag2d

bool TurbChoice::smag2d = false

◆ strat_type

StratType TurbChoice::strat_type = StratType::theta

◆ theta_ref

◆ tke_min

amrex::Real TurbChoice::tke_min = amrex::Real(1.e-6)

Referenced by init_params().

◆ use_keqn

bool TurbChoice::use_keqn
Initial value:
=
false

Referenced by erf_slow_rhs_pre(), and init_params().

◆ use_kturb

◆ use_pbl_tke

bool TurbChoice::use_pbl_tke
Initial value:
=
false

Referenced by init_params().

◆ use_Ri_correction

bool TurbChoice::use_Ri_correction = true

◆ use_tke

bool TurbChoice::use_tke = false

◆ ysu_moistvars

bool TurbChoice::ysu_moistvars = false

◆ ysu_qcloud_threshold

amrex::Real TurbChoice::ysu_qcloud_threshold
Initial value:
=
amrex::Real(1.0e-4)

Referenced by ComputeDiffusivityYSUNew(), display(), and init_params().


The documentation for this struct was generated from the following file: