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)
 
void display (int lev)
 

Public Attributes

std::string pp_prefix {"erf"}
 
LESType les_type
 
amrex::Real Pr_t = amrex::Real(1.0) / amrex::Real(3.0)
 
amrex::Real Pr_t_inv = amrex::Real(3.0)
 
amrex::Real Sc_t = 1.0
 
amrex::Real Sc_t_inv = 1.0
 
amrex::Real Cs = 0.0
 
amrex::Real Ce = 0.93
 
amrex::Real Ce_wall = 0.0
 
amrex::Real Ck = 0.1
 
amrex::Real Cmu0 = 0.5562
 
amrex::Real Cb = 0.35
 
amrex::Real Rt_crit = -1.0
 
amrex::Real Rt_min = -3.0
 
amrex::Real l_g_max = 1e99
 
amrex::Real sigma_k = 0.5
 
amrex::Real theta_ref = 300.0
 
RANSType rans_type
 
PBLType pbl_type
 
MYNNLevel25 pbl_mynn
 
MYNNLevel2 pbl_mynn_level2
 
amrex::Real pbl_ysu_coriolis_freq = 1.0e-4
 
bool pbl_ysu_use_consistent_coriolis = false
 
bool pbl_ysu_force_over_water = false
 
amrex::Real pbl_ysu_land_Ribcr = 0.25
 
amrex::Real pbl_ysu_unst_Ribcr = 0.0
 
bool use_KE = true
 
bool diffuse_KE_3D = true
 
bool advect_KE = true
 

Detailed Description

Container holding quantities related to turbulence parametrizations

Member Function Documentation

◆ display()

void TurbChoice::display ( int  lev)
inline
132  {
133  amrex::Print() << "Turbulence Settings at level " << lev << std::endl;
134 
135  if (les_type == LESType::None && rans_type == RANSType::None && pbl_type == PBLType::None) {
136  amrex::Print() << " Using DNS model at level " << lev << std::endl;
137  } else if (les_type == LESType::Smagorinsky) {
138  amrex::Print() << " Using Smagorinsky LES model at level " << lev << std::endl;
139  } else if (les_type == LESType::Deardorff) {
140  amrex::Print() << " Using Deardorff LES model at level " << lev << std::endl;
141  } else if (rans_type == RANSType::kEqn) {
142  amrex::Print() << " Using Axell & Liungman one-equation RANS k model at level " << lev << std::endl;
143  } else if (pbl_type == PBLType::MYNN25) {
144  amrex::Print() << " Using MYNN2.5 PBL model at level " << lev << std::endl;
145  } else if (pbl_type == PBLType::YSU) {
146  amrex::Print() << " Using YSU PBL model at level " << lev << std::endl;
147  }
148 
149  if (les_type != LESType::None) {
150  if (les_type == LESType::Smagorinsky) {
151  amrex::Print() << "Cs : " << Cs << std::endl;
152  }
153  if (les_type == LESType::Deardorff) {
154  amrex::Print() << "Ce : " << Ce << std::endl;
155  amrex::Print() << "Ce at wall : " << Ce_wall << std::endl;
156  amrex::Print() << "Ck : " << Ck << std::endl;
157  amrex::Print() << "sigma_k : " << sigma_k << std::endl;
158  amrex::Print() << "reference theta : " << theta_ref << std::endl;
159  // Sullivan et al 1994, Eqn 14
160  amrex::Real Cs_equiv = std::sqrt(Ck * std::sqrt(Ck/Ce));
161  amrex::Print() << "equivalent Cs : " << Cs_equiv << std::endl;
162  }
163  }
164 
165  if (rans_type != RANSType::None) {
166  if (rans_type == RANSType::kEqn) {
167  amrex::Print() << "Cmu0 : " << Cmu0 << std::endl;
168  amrex::Print() << "sigma_k : " << sigma_k << std::endl;
169  amrex::Print() << "Cb : " << Cb << std::endl;
170  amrex::Print() << "Rt_crit : " << Rt_crit << std::endl;
171  amrex::Print() << "Rt_min : " << Rt_min << std::endl;
172  amrex::Print() << "max_geom_lscale : " << l_g_max << std::endl;
173  amrex::Print() << "reference theta : " << theta_ref << std::endl;
174  }
175  }
176 
177  if ((les_type != LESType::None) || (rans_type != RANSType::None)) {
178  amrex::Print() << "Pr_t : " << Pr_t << std::endl;
179  amrex::Print() << "Sc_t : " << Sc_t << std::endl;
180  }
181 
182  if (pbl_type == PBLType::MYNN25) {
183  amrex::Print() << " pbl_mynn_A1 : " << pbl_mynn.A1 << std::endl;
184  amrex::Print() << " pbl_mynn_A2 : " << pbl_mynn.A2 << std::endl;
185  amrex::Print() << " pbl_mynn_B1 : " << pbl_mynn.B1 << std::endl;
186  amrex::Print() << " pbl_mynn_B2 : " << pbl_mynn.B2 << std::endl;
187  amrex::Print() << " pbl_mynn_C1 : " << pbl_mynn.C1 << std::endl;
188  amrex::Print() << " pbl_mynn_C2 : " << pbl_mynn.C2 << std::endl;
189  amrex::Print() << " pbl_mynn_C3 : " << pbl_mynn.C3 << std::endl;
190  amrex::Print() << " pbl_mynn_C4 : " << pbl_mynn.C4 << std::endl;
191  amrex::Print() << " pbl_mynn_C5 : " << pbl_mynn.C5 << std::endl;
192  } else if (pbl_type == PBLType::YSU) {
193  amrex::Print() << " pbl_ysu_coriolis_freq : " << pbl_ysu_coriolis_freq << std::endl;
194  amrex::Print() << " pbl_ysu_use_consistent_coriolis : " << pbl_ysu_use_consistent_coriolis << std::endl;
195  amrex::Print() << " pbl_ysu_force_over_water : " << pbl_ysu_force_over_water << std::endl;
196  amrex::Print() << " pbl_ysu_land_Ribcr : " << pbl_ysu_land_Ribcr << std::endl;
197  amrex::Print() << " pbl_ysu_unst_Ribcr : " << pbl_ysu_unst_Ribcr << std::endl;
198  }
199  }
amrex::Real C4
Definition: ERF_MYNNStruct.H:48
amrex::Real C1
Definition: ERF_MYNNStruct.H:45
amrex::Real C3
Definition: ERF_MYNNStruct.H:47
amrex::Real C2
Definition: ERF_MYNNStruct.H:46
amrex::Real A2
Definition: ERF_MYNNStruct.H:42
amrex::Real B1
Definition: ERF_MYNNStruct.H:43
amrex::Real B2
Definition: ERF_MYNNStruct.H:44
amrex::Real C5
Definition: ERF_MYNNStruct.H:49
amrex::Real A1
Definition: ERF_MYNNStruct.H:41
amrex::Real sigma_k
Definition: ERF_TurbStruct.H:232
MYNNLevel25 pbl_mynn
Definition: ERF_TurbStruct.H:243
PBLType pbl_type
Definition: ERF_TurbStruct.H:241
amrex::Real Rt_min
Definition: ERF_TurbStruct.H:227
RANSType rans_type
Definition: ERF_TurbStruct.H:238
amrex::Real Ck
Definition: ERF_TurbStruct.H:221
amrex::Real Cmu0
Definition: ERF_TurbStruct.H:224
bool pbl_ysu_use_consistent_coriolis
Definition: ERF_TurbStruct.H:249
amrex::Real Cb
Definition: ERF_TurbStruct.H:225
amrex::Real pbl_ysu_land_Ribcr
Definition: ERF_TurbStruct.H:251
amrex::Real Cs
Definition: ERF_TurbStruct.H:216
amrex::Real Ce_wall
Definition: ERF_TurbStruct.H:220
amrex::Real Ce
Definition: ERF_TurbStruct.H:219
LESType les_type
Definition: ERF_TurbStruct.H:205
amrex::Real pbl_ysu_coriolis_freq
Definition: ERF_TurbStruct.H:248
bool pbl_ysu_force_over_water
Definition: ERF_TurbStruct.H:250
amrex::Real Pr_t
Definition: ERF_TurbStruct.H:208
amrex::Real theta_ref
Definition: ERF_TurbStruct.H:235
amrex::Real Sc_t
Definition: ERF_TurbStruct.H:212
amrex::Real Rt_crit
Definition: ERF_TurbStruct.H:226
amrex::Real pbl_ysu_unst_Ribcr
Definition: ERF_TurbStruct.H:252
amrex::Real l_g_max
Definition: ERF_TurbStruct.H:228

◆ init_params()

void TurbChoice::init_params ( int  lev,
int  max_level 
)
inline
34  {
35  amrex::ParmParse pp(pp_prefix);
36 
37  // Which LES closure?
38  std::string les_type_string = "None";
39  query_one_or_per_level(pp, "les_type", les_type, lev, max_level);
40 
41  // Which RANS closure?
42  std::string rans_type_string = "None";
43  query_one_or_per_level(pp, "rans_type", rans_type, lev, max_level);
44 
45  if ((rans_type != RANSType::None) && (les_type != LESType::None)) {
46  amrex::Error("Hybrid RANS-LES not implemented");
47  }
48 
49  // Which PBL Closure
50  static std::string pbl_type_string = "None";
51  query_one_or_per_level(pp, "pbl_type", pbl_type, lev, max_level);
52 
53  // Do some more stuff for PBL Modeling
54  if (pbl_type != PBLType::None) {
55  // Check for compatibility between PBL, LES, Molec Transport
56  if (les_type != LESType::None) {
57  amrex::Print() << "Selected a PBL model and an LES model: " <<
58  "Using PBL for vertical transport, LES for horizontal" << std::endl;
59  } else if (les_type == LESType::Deardorff) {
60  amrex::Error("It is not recommended to use Deardorff LES and a PBL model");
61  }
62 
63  if (pbl_type == PBLType::MYNN25) {
64  query_one_or_per_level(pp, "pbl_mynn_A1", pbl_mynn.A1, lev, max_level);
65  query_one_or_per_level(pp, "pbl_mynn_A2", pbl_mynn.A2, lev, max_level);
66  query_one_or_per_level(pp, "pbl_mynn_B1", pbl_mynn.B1, lev, max_level);
67  query_one_or_per_level(pp, "pbl_mynn_B2", pbl_mynn.B2, lev, max_level);
68  query_one_or_per_level(pp, "pbl_mynn_C1", pbl_mynn.C1, lev, max_level);
69  query_one_or_per_level(pp, "pbl_mynn_C2", pbl_mynn.C2, lev, max_level);
70  query_one_or_per_level(pp, "pbl_mynn_C3", pbl_mynn.C3, lev, max_level);
71  query_one_or_per_level(pp, "pbl_mynn_C4", pbl_mynn.C4, lev, max_level);
72  query_one_or_per_level(pp, "pbl_mynn_C5", pbl_mynn.C5, lev, max_level);
75  query_one_or_per_level(pp, "pbl_mynn_diffuse_moistvars", pbl_mynn.diffuse_moistvars, lev, max_level);
76  query_one_or_per_level(pp, "pbl_mynn_SMmin", pbl_mynn.SMmin, lev, max_level);
77  query_one_or_per_level(pp, "pbl_mynn_SMmax", pbl_mynn.SMmax, lev, max_level);
78  query_one_or_per_level(pp, "pbl_mynn_SHmin", pbl_mynn.SHmin, lev, max_level);
79  query_one_or_per_level(pp, "pbl_mynn_SHmax", pbl_mynn.SHmax, lev, max_level);
80  } else if (pbl_type == PBLType::YSU) {
81  query_one_or_per_level(pp, "pbl_ysu_coriolis_freq", pbl_ysu_coriolis_freq, lev, max_level);
82  query_one_or_per_level(pp, "pbl_ysu_use_consistent_coriolis", pbl_ysu_use_consistent_coriolis, lev, max_level);
83  query_one_or_per_level(pp, "pbl_ysu_force_over_water", pbl_ysu_force_over_water, lev, max_level);
84  query_one_or_per_level(pp, "pbl_ysu_land_Ribcr", pbl_ysu_land_Ribcr, lev, max_level);
85  query_one_or_per_level(pp, "pbl_ysu_unst_Ribcr", pbl_ysu_unst_Ribcr, lev, max_level);
86  }
87  }
88 
89  // Right now, solving the QKE equation is only supported when MYNN PBL is turned on
90  if (pbl_type == PBLType::MYNN25) {
91  use_KE = true;
92  query_one_or_per_level(pp, "advect_KE" , advect_KE, lev, max_level);
93  query_one_or_per_level(pp, "diffuse_KE_3D", diffuse_KE_3D, lev, max_level);
94  }
95 
96  // LES constants...
97  query_one_or_per_level(pp, "Cs" ,Cs, lev, max_level);
98  query_one_or_per_level(pp, "Pr_t",Pr_t, lev, max_level);
99  query_one_or_per_level(pp, "Sc_t",Sc_t, lev, max_level);
100 
101  // Compute relevant forms of diffusion parameters
102  Pr_t_inv = amrex::Real(1.0) / Pr_t;
103  Sc_t_inv = amrex::Real(1.0) / Sc_t;
104 
105  query_one_or_per_level(pp, "Ce" , Ce, lev, max_level);
106  query_one_or_per_level(pp, "Ce_wall" , Ce_wall, lev, max_level);
107 
108  if (les_type == LESType::Deardorff) {
109  query_one_or_per_level(pp, "Ck" , Ck, lev, max_level);
110  }
111 
112  // k-eqn constants
113  query_one_or_per_level(pp, "Cmu0" , Cmu0 , lev, max_level);
114  query_one_or_per_level(pp, "Cb" , Cb , lev, max_level);
115  query_one_or_per_level(pp, "Rt_crit" , Rt_crit, lev, max_level);
116  query_one_or_per_level(pp, "Rt_min" , Rt_min , lev, max_level);
117  query_one_or_per_level(pp, "max_geom_lscale", l_g_max, lev, max_level);
118 
119  // Common inputs (LES or RANS)
120  query_one_or_per_level(pp, "sigma_k" , sigma_k, lev, max_level);
121  query_one_or_per_level(pp, "theta_ref", theta_ref, lev, max_level);
122 
123  // Validate inputs
124  if (les_type == LESType::Smagorinsky) {
125  if (Cs == 0) {
126  amrex::Error("Need to specify Cs for Smagorsinky LES");
127  }
128  }
129  }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real pp(amrex::Real y)
Definition: ERF_MicrophysicsUtils.H:219
void 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:13
amrex::Real SMmax
Definition: ERF_MYNNStruct.H:53
amrex::Real SHmax
Definition: ERF_MYNNStruct.H:55
amrex::Real SHmin
Definition: ERF_MYNNStruct.H:54
amrex::Real SMmin
Definition: ERF_MYNNStruct.H:52
bool diffuse_moistvars
Definition: ERF_MYNNStruct.H:60
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:64
bool use_KE
Definition: ERF_TurbStruct.H:255
amrex::Real Sc_t_inv
Definition: ERF_TurbStruct.H:213
MYNNLevel2 pbl_mynn_level2
Definition: ERF_TurbStruct.H:244
bool diffuse_KE_3D
Definition: ERF_TurbStruct.H:256
std::string pp_prefix
Definition: ERF_TurbStruct.H:202
amrex::Real Pr_t_inv
Definition: ERF_TurbStruct.H:209
bool advect_KE
Definition: ERF_TurbStruct.H:257
Here is the call graph for this function:

Member Data Documentation

◆ advect_KE

bool TurbChoice::advect_KE = true

Referenced by erf_slow_rhs_post(), and init_params().

◆ Cb

amrex::Real TurbChoice::Cb = 0.35

◆ Ce

amrex::Real TurbChoice::Ce = 0.93

◆ Ce_wall

amrex::Real TurbChoice::Ce_wall = 0.0

◆ Ck

amrex::Real TurbChoice::Ck = 0.1

◆ Cmu0

amrex::Real TurbChoice::Cmu0 = 0.5562

◆ Cs

amrex::Real TurbChoice::Cs = 0.0

◆ diffuse_KE_3D

bool TurbChoice::diffuse_KE_3D = true

Referenced by init_params(), and make_sources().

◆ l_g_max

amrex::Real TurbChoice::l_g_max = 1e99

◆ les_type

◆ pbl_mynn

◆ pbl_mynn_level2

MYNNLevel2 TurbChoice::pbl_mynn_level2

◆ pbl_type

◆ pbl_ysu_coriolis_freq

amrex::Real TurbChoice::pbl_ysu_coriolis_freq = 1.0e-4

◆ pbl_ysu_force_over_water

bool TurbChoice::pbl_ysu_force_over_water = false

◆ pbl_ysu_land_Ribcr

amrex::Real TurbChoice::pbl_ysu_land_Ribcr = 0.25

◆ pbl_ysu_unst_Ribcr

amrex::Real TurbChoice::pbl_ysu_unst_Ribcr = 0.0

◆ pbl_ysu_use_consistent_coriolis

bool TurbChoice::pbl_ysu_use_consistent_coriolis = false

Referenced by display(), and init_params().

◆ pp_prefix

std::string TurbChoice::pp_prefix {"erf"}

Referenced by init_params().

◆ Pr_t

amrex::Real TurbChoice::Pr_t = amrex::Real(1.0) / amrex::Real(3.0)

Referenced by display(), and init_params().

◆ Pr_t_inv

amrex::Real TurbChoice::Pr_t_inv = amrex::Real(3.0)

◆ rans_type

◆ Rt_crit

amrex::Real TurbChoice::Rt_crit = -1.0

◆ Rt_min

amrex::Real TurbChoice::Rt_min = -3.0

◆ Sc_t

amrex::Real TurbChoice::Sc_t = 1.0

Referenced by display(), and init_params().

◆ Sc_t_inv

amrex::Real TurbChoice::Sc_t_inv = 1.0

◆ sigma_k

amrex::Real TurbChoice::sigma_k = 0.5

◆ theta_ref

◆ use_KE

bool TurbChoice::use_KE = true

Referenced by erf_slow_rhs_post(), and init_params().


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