ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_DataStruct.H
Go to the documentation of this file.
1 #ifndef ERF_DATA_STRUCT_H_
2 #define ERF_DATA_STRUCT_H_
3 
4 #include <string>
5 #include <iostream>
6 
7 #include <AMReX_ParmParse.H>
8 #include <AMReX_Print.H>
9 #include <AMReX_Gpu.H>
10 #include <AMReX_Geometry.H>
11 
12 #include <ERF_Constants.H>
13 #include <ERF_IndexDefines.H>
14 #include <ERF_AdvStruct.H>
15 #include <ERF_DampingStruct.H>
16 #include <ERF_DiffStruct.H>
17 #include <ERF_EBStruct.H>
18 #include <ERF_SpongeStruct.H>
19 #include <ERF_TurbStruct.H>
20 #include <ERF_TurbPertStruct.H>
21 
22 enum MapFacType {
23 // This version assumes isotropic
24  m_x, u_x, v_x, num,
25  m_y = 0, u_y = 1, v_y = 2
26 // This version allows for non-isotropic
27 // m_x, u_x, v_x,
28 // m_y, u_y, v_y, num
29 };
30 
31 enum TauType {
33 };
34 
35 AMREX_ENUM(InitType,
36  None, Input_Sounding, NCFile, WRFInput, Metgrid, Uniform, HindCast
37 );
38 
39 AMREX_ENUM(SoundingType,
40  ConstantDensity, Ideal, Isentropic, DryIsentropic
41 );
42 
43 AMREX_ENUM(ABLDriverType,
44  None, PressureGradient, GeostrophicWind
45 );
46 
47 AMREX_ENUM(CouplingType,
48  OneWay, TwoWay
49 );
50 
51 AMREX_ENUM(SubsteppingType,
52  None, Implicit
53 );
54 
55 AMREX_ENUM(MeshType,
56  ConstantDz, StretchedDz, VariableDz
57 );
58 
59 AMREX_ENUM(TerrainType,
60  None, StaticFittedMesh, MovingFittedMesh, EB, ImmersedForcing
61 );
62 
63 AMREX_ENUM(BuildingsType,
64  None, ImmersedForcing
65 );
66 
67 AMREX_ENUM(MoistureModelType,
68  Eulerian, Lagrangian, Undefined
69 );
70 
71 AMREX_ENUM(MoistureType,
72  SAM, SAM_NoIce, SAM_NoPrecip_NoIce, Kessler, Kessler_NoRain, SatAdj, Morrison, Morrison_NoIce, None
73 );
74 
75 AMREX_ENUM(WindFarmType,
76  Fitch, EWP, SimpleAD, GeneralAD, None
77 );
78 
79 AMREX_ENUM(WindFarmLocType,
80  lat_lon, x_y, None
81 );
82 
83 AMREX_ENUM(LandSurfaceType,
84  SLM, MM5, None, NOAHMP
85 );
86 
87 AMREX_ENUM(RadiationType,
88  None, RRTMGP
89 );
90 
91 enum struct Coord {
92  x, y, z
93 };
94 
95 // These are used as integers so must be enum not enum struct
96 enum Rayleigh {
98 };
99 
100 // These are used as integers so must be enum not enum struct
101 enum Sponge {
103 };
104 
106  int qv = -1; // Water vapor
107  int qc = -1; // Cloud liquid water
108  int qi = -1; // Cloud ice
109  int qr = -1; // Rain
110  int qs = -1; // Snow
111  int qg = -1; // Graupel
112 
113  // Constructor for easy initialization
114  MoistureComponentIndices (int qv_comp, int qc_comp,
115  int qi_comp=-1,
116  int qr_comp=-1,
117  int qs_comp=-1,
118  int qg_comp=-1)
119  : qv(qv_comp), qc(qc_comp), qi(qi_comp), qr(qr_comp), qs(qs_comp), qg(qg_comp) {}
120 
121  // Default constructor
123 };
124 
125 /**
126  * Container holding many of the algorithmic options and parameters
127  */
128 
129 struct SolverChoice {
130  public:
131  void init_params (int max_level, std::string pp_prefix)
132  {
133  amrex::ParmParse pp(pp_prefix);
134 
135  bool bogus;
136  if (pp.query("use_terrain",bogus) > 0) {
137  amrex::Abort("The input use_terrain is deprecated. Set terrain_type instead.");
138  }
139 
140  // Do we set map scale factors to 0.5 instead of 1 for testing?
141  pp.query("test_mapfactor", test_mapfactor);
142 
143  // Which horizontal pressure gradient formulation to use with terrain fitted coords?
144  // 0: dp/dx with dp/dz correction (default)
145  // 1: gradient of vertically interpolated p, see Klemp 2011
146  pp.query("gradp_type", gradp_type);
147  AMREX_ALWAYS_ASSERT(gradp_type == 0 || gradp_type == 1);
148 
149  // What type of moisture model to use?
150  moisture_type = MoistureType::None; // Default
151  if (pp.query("moisture_type",moisture_type) > 0) {
152  amrex::Abort("The input moisture_type is deprecated. Set moisture_model instead.");
153  }
154  pp.query_enum_case_insensitive("moisture_model",moisture_type);
155  if ( (moisture_type == MoistureType::Morrison) ||
156  (moisture_type == MoistureType::SAM) ) {
158  RhoQ1_comp, // water vapor
159  RhoQ2_comp, // cloud water
160  RhoQ3_comp, // cloud ice
161  RhoQ4_comp, // rain
162  RhoQ5_comp, // snow
163  RhoQ6_comp // graupel
164  );
165  } else if ( (moisture_type == MoistureType::Morrison_NoIce) ||
166  (moisture_type == MoistureType::SAM_NoIce) ) {
168  RhoQ1_comp, // water vapor
169  RhoQ2_comp, // cloud water
170  -1, // cloud ice
171  RhoQ4_comp // rain
172  );
173  } else if ( (moisture_type == MoistureType::SAM_NoPrecip_NoIce) ||
174  (moisture_type == MoistureType::Kessler_NoRain) ||
175  (moisture_type == MoistureType::SatAdj) ) {
177  RhoQ1_comp, // water vapor
178  RhoQ2_comp // cloud water
179  );
180  } else if (moisture_type == MoistureType::Kessler) {
182  RhoQ1_comp, // water vapor
183  RhoQ2_comp, // cloud water
184  -1, // cloud ice
185  RhoQ3_comp // rain
186  );
187  }
188 
189  // Set a default for dry
190  buoyancy_type.resize(max_level+1);
191  for (int i = 0; i <= max_level; ++i) {
192  buoyancy_type[i] = 1; // uses Rhoprime
193  }
194 
195  // Set a default for moist
196  if (moisture_type != MoistureType::None) {
197  if ( !(moisture_type == MoistureType::Kessler_NoRain ||
198  moisture_type == MoistureType::SAM ||
199  moisture_type == MoistureType::SAM_NoIce ||
200  moisture_type == MoistureType::SAM_NoPrecip_NoIce ||
201  moisture_type == MoistureType::Morrison ||
202  moisture_type == MoistureType::Morrison_NoIce ||
203  moisture_type == MoistureType::SatAdj) )
204  {
205  for (int i = 0; i <= max_level; ++i) {
206  buoyancy_type[i] = 2; // uses Tprime
207  }
208  }
209 
210  pp.query("moisture_tight_coupling",moisture_tight_coupling);
211  }
212 
213  // Which expression (1,2/3 or 4) to use for buoyancy
214  int default_buoyancy_type = buoyancy_type[0];
215  read_int_string(max_level, "buoyancy_type", buoyancy_type, default_buoyancy_type);
216 
217  // What type of land surface model to use
218  lsm_type = LandSurfaceType::None; // Default
219  pp.query_enum_case_insensitive("land_surface_model",lsm_type);
220 
221  // What type of radiation model to use
222  rad_type = RadiationType::None; // Default
223  pp.query_enum_case_insensitive("radiation_model", rad_type);
224 
225  // Verify that radiation model cannot be RRTMGP if ERF was not compiled with RRTMGP
226 #ifndef ERF_USE_RRTMGP
227  if (rad_type == RadiationType::RRTMGP)
228  {
229  amrex::Abort("ERF was not compiled with RRTMGP enabled!");
230  }
231 #endif
232 
233  // Is the terrain none, static or moving?
234  std::string terrain_type_temp = "";
235  pp.query("terrain_type", terrain_type_temp);
236  if (terrain_type_temp == "Moving") {
237  amrex::Warning("erf.terrain_type = Moving is deprecated; please replace Moving by MovingFittedMesh");
238  terrain_type = TerrainType::MovingFittedMesh;
239  } else if (terrain_type_temp == "Static") {
240  amrex::Warning("erf.terrain_type = Static is deprecated; please replace Static by StaticFittedMesh");
241  terrain_type = TerrainType::StaticFittedMesh;
242  } else {
243  pp.query_enum_case_insensitive("terrain_type",terrain_type);
244  }
245 
246  // Get buildings type
247  std::string buildings_type_temp = "";
248  pp.query("buildings_type", buildings_type_temp);
249  if (buildings_type_temp == "ImmersedForcing") {
250  buildings_type = BuildingsType::ImmersedForcing;
251  }
252 
253  //
254  // Read the init_type here to make sure we correctly set the mesh and terrain types
255  //
256  std::string init_type_temp_string;
257  pp.query("init_type",init_type_temp_string);
258  if ( (init_type_temp_string == "Real") || (init_type_temp_string == "real") ) {
259  amrex::Abort("erf.init_type = Real is deprecated; please replace Real by WRFInput");
260  } else if ( (init_type_temp_string == "Ideal") || (init_type_temp_string == "ideal") ) {
261  amrex::Abort("erf.init_type = Ideal is deprecated; please replace Ideal by WRFInput");
262  } else if (init_type_temp_string == "hindcast") {
263  init_type = InitType::HindCast;
264  }
265  else {
266  pp.query_enum_case_insensitive("init_type",init_type);
267  use_real_bcs = ( (init_type == InitType::WRFInput) || (init_type == InitType::Metgrid) );
268  }
269 
270  if ( (init_type == InitType::WRFInput) || (init_type == InitType::Metgrid) ) {
271  if (terrain_type != TerrainType::StaticFittedMesh) {
272  amrex::Abort("Only terrain_type = StaticFittedMesh are allowed with init_type = WRFInput or Metgrid");
273  }
274  }
275 
276  if (init_type == InitType::WRFInput) {
277  if (moisture_type == MoistureType::None) {
278  amrex::Abort("Can't have moisture_type = None with init_type = WRFInput");
279  }
280 
281  // NetCDF wrfbdy lateral boundary file
282  std::string nc_bdy_file_temp_string;
283  bool has_bdy = pp.query("nc_bdy_file", nc_bdy_file_temp_string);
284  if (!has_bdy) use_real_bcs = false;
285 
286  bool use_real_bcs_temp = use_real_bcs;
287  pp.query("use_real_bcs", use_real_bcs_temp);
288  if (use_real_bcs && !use_real_bcs_temp) {
289  use_real_bcs = false;
290  }
291  }
292 
293  if (use_real_bcs) {
294  pp.query("upwind_real_bcs",upwind_real_bcs);
295  }
296 
297  // Check for rebalancing with wrfinput
298  if (init_type == InitType::WRFInput) {
299  pp.query("rebalance_wrfinput",rebalance_wrfinput);
300  }
301 
302  // How to interpret input_sounding
303  if (init_type == InitType::Input_Sounding) {
304  pp.query_enum_case_insensitive("sounding_type",sounding_type);
305  }
306 
307  if (terrain_type == TerrainType::StaticFittedMesh ||
308  terrain_type == TerrainType::MovingFittedMesh) {
309  mesh_type = MeshType::VariableDz;
310  }
311 
312  pp.query("grid_stretching_ratio", grid_stretching_ratio);
313  if (grid_stretching_ratio != 0) {
314  AMREX_ASSERT_WITH_MESSAGE((grid_stretching_ratio >= 1.),
315  "The grid stretching ratio must be greater than 1");
316  }
317  if (grid_stretching_ratio >= 1) {
318  if (terrain_type == TerrainType::None) {
319  terrain_type = TerrainType::StaticFittedMesh;
320  }
321  if (mesh_type == MeshType::ConstantDz) {
322  mesh_type = MeshType::StretchedDz;
323  }
324  pp.query("zsurface", zsurf);
325  if (zsurf != 0.0) {
326  amrex::Print() << "Nominal zsurface height != 0, may result in unexpected behavior"
327  << std::endl;
328  }
329  pp.get("initial_dz", dz0);
330  }
331 
332  int n_zlevels = pp.countval("terrain_z_levels");
333  if (n_zlevels > 0)
334  {
335  if (terrain_type == TerrainType::None) {
336  terrain_type = TerrainType::StaticFittedMesh;
337  }
338  if (mesh_type == MeshType::ConstantDz) {
339  mesh_type = MeshType::StretchedDz;
340  }
341  }
342 
343  // Use lagged_delta_rt in the fast integrator?
344  pp.query("use_lagged_delta_rt", use_lagged_delta_rt);
345 
346  // These default to true but are used for unit testing
347  pp.query("use_gravity", use_gravity);
349 
350  pp.query("c_p", c_p);
351  rdOcp = R_d / c_p;
352 
353  // *******************************************************************************
354  // Read anelastic etc and over-ride if necessary
355  // *******************************************************************************
356 
357  read_int_string(max_level, "anelastic", anelastic, 0);
358  read_int_string(max_level, "fixed_density", fixed_density, 0);
359  read_int_string(max_level, "project_initial_velocity", project_initial_velocity, 0);
360 
361  for (int i = 0; i <= max_level; ++i) {
362  if (anelastic[i] == 1) {
364  fixed_density[i] = 1; // We default to true but are allowed to override below
365  buoyancy_type[i] = 3; // (This isn't actually used when anelastic is set)
366  }
367  }
368 
369  // *******************************************************************************
370 
371  if (!upwind_real_bcs && anelastic[0]) {
372  amrex::Print() << "Setting upwind_real_bcs to true because we are doing anelastic at level 0" << std::endl;
373  upwind_real_bcs = true;
374  }
375 
376  // *******************************************************************************
377  // Read substepping_type and allow for different values at each level
378  // *******************************************************************************
379  substepping_type.resize(max_level+1);
380 
381  for (int i = 0; i <= max_level; i++) {
382  substepping_type[i] = SubsteppingType::Implicit;
383  }
384 
385  int nvals = pp.countval("substepping_type");
386  AMREX_ALWAYS_ASSERT(nvals == 0 || nvals == 1 || nvals >= max_level+1);
387 
388  if (nvals == 1) {
389  pp.query_enum_case_insensitive("substepping_type",substepping_type[0]);
390  for (int i = 1; i <= max_level; i++) {
392  }
393  } else if (nvals > 1) { // in this case we have asserted nvals >= max_level+1
394  for (int i = 0; i <= max_level; i++) {
395  pp.query_enum_case_insensitive("substepping_type",substepping_type[i],i);
396  }
397  }
398 
399  pp.query("substepping_diag", substepping_diag);
400 
401  pp.query("beta_s", beta_s);
402 
403 
404 
405  // *******************************************************************************
406  // Error check on deprecated input
407  // *******************************************************************************
408  int nvals_old = pp.countval("no_substepping");
409  if (nvals_old > 0) {
410  amrex::Abort("The no_substepping flag is deprecated -- set substepping_type instead");
411  }
412 
413  // *******************************************************************************
414 
415  pp.query("ncorr", ncorr);
416  pp.query("poisson_abstol", poisson_abstol);
417  pp.query("poisson_reltol", poisson_reltol);
418 
419  for (int lev = 0; lev <= max_level; lev++) {
420  if (anelastic[lev] != 0)
421  {
422  substepping_type[lev] = SubsteppingType::None;
423  }
424  }
425 
426  pp.query("force_stage1_single_substep", force_stage1_single_substep);
427 
428  // Include Coriolis forcing?
429  pp.query("use_coriolis", use_coriolis);
430  pp.query("has_lat_lon", has_lat_lon);
431  pp.query("variable_coriolis", variable_coriolis);
432 
433  // Include four stream radiation approximation
434  pp.query("four_stream_radiation", four_stream_radiation);
435 
436  // flags for whether to apply other source terms in substep only
437  pp.query("immersed_forcing_substep", immersed_forcing_substep); // apply immersed forcing source terms in substep only
438  pp.query("forest_substep", forest_substep); // apply canopy-related source terms in substep only
439 
440  // immersed forcing parameters
441  pp.query("if_Cd_scalar", if_Cd_scalar);
442  pp.query("if_Cd_momentum", if_Cd_momentum);
443  pp.query("if_z0", if_z0);
444  pp.query("if_surf_temp_flux", if_surf_temp_flux);
445  pp.query("if_init_surf_temp", if_init_surf_temp);
446  pp.query("if_surf_heating_rate", if_surf_heating_rate);
447  pp.query("if_Olen", if_Olen_in);
448  pp.query("if_use_most",if_use_most);
449 
450  if ((if_init_surf_temp > 0.0 && if_surf_temp_flux != 1e-8) ||
451  (if_init_surf_temp > 0.0 && if_Olen_in != 1e-8) ||
452  (if_Olen_in != 1e-8 && if_surf_temp_flux != 1e-8))
453  {
454  amrex::Abort("Can only specify one of init_surf_temp, surf_temp_flux, or Olen");
455  }
456 
457  if (if_use_most && buildings_type == BuildingsType::ImmersedForcing)
458  {
459  amrex::Abort("MOST wall-model with immersed forcing for buildings is not currently supported");
460  }
461 
462  if (if_surf_temp_flux != 1e-8 && buildings_type == BuildingsType::ImmersedForcing)
463  {
464  amrex::Abort("Specifying surf_temp_flux with immersed forcing for buildings is not currently supported");
465  }
466 
467  if (if_Olen_in != 1e-8 && buildings_type == BuildingsType::ImmersedForcing)
468  {
469  amrex::Abort("Specifying Olen with immersed forcing for buildings is not currently supported");
470  }
471 
472  // Flag to do MOST rotations with terrain
473  pp.query("use_rotate_surface_flux",use_rotate_surface_flux);
475  AMREX_ASSERT_WITH_MESSAGE(terrain_type != TerrainType::None,"MOST stress rotations are only valid with terrain!");
476  }
477 
478  // Which external forcings?
479  abl_driver_type = ABLDriverType::None; // Default: no ABL driver for simulating classical fluid dynamics problems
480  pp.query_enum_case_insensitive("abl_driver_type",abl_driver_type);
481  pp.query("const_massflux_u", const_massflux_u);
482  pp.query("const_massflux_v", const_massflux_v);
483  pp.query("const_massflux_tau", const_massflux_tau);
484  pp.query("const_massflux_layer_lo", const_massflux_layer_lo);
485  pp.query("const_massflux_layer_hi", const_massflux_layer_hi);
486 
487  // Which type of inflow turbulent generation
488  pert_type = PerturbationType::None; // Default
489  pp.query_enum_case_insensitive("perturbation_type",pert_type);
490 
491  amrex::Vector<amrex::Real> abl_pressure_grad_in = {0.0, 0.0, 0.0};
492  pp.queryarr("abl_pressure_grad",abl_pressure_grad_in);
493  for(int i = 0; i < AMREX_SPACEDIM; ++i) abl_pressure_grad[i] = abl_pressure_grad_in[i];
494 
495  amrex::Vector<amrex::Real> abl_geo_forcing_in = {0.0, 0.0, 0.0};
496  if(pp.queryarr("abl_geo_forcing",abl_geo_forcing_in)) {
497  amrex::Print() << "Specified abl_geo_forcing: (";
498  for (int i = 0; i < AMREX_SPACEDIM; ++i) {
499  abl_geo_forcing[i] = abl_geo_forcing_in[i];
500  amrex::Print() << abl_geo_forcing[i] << " ";
501  }
502  amrex::Print() << ")" << std::endl;
503  }
504 
505  if (use_coriolis)
506  {
508  }
509 
510  pp.query("add_custom_rhotheta_forcing", custom_rhotheta_forcing);
511  pp.query("add_custom_moisture_forcing", custom_moisture_forcing);
512  pp.query("add_custom_w_subsidence", custom_w_subsidence);
513  pp.query("add_custom_geostrophic_profile", custom_geostrophic_profile);
514  pp.query("custom_forcing_uses_primitive_vars", custom_forcing_prim_vars);
515 
516  pp.query("nudging_from_input_sounding", nudging_from_input_sounding);
517 
519  AMREX_ALWAYS_ASSERT_WITH_MESSAGE(!(!abl_geo_wind_table.empty() && custom_geostrophic_profile),
520  "Should not have both abl_geo_wind_table and custom_geostrophic_profile set.");
521 
522  pp.query("Ave_Plane", ave_plane);
523 
524  pp.query("use_moist_background", use_moist_background);
525 
526  // Use numerical diffusion?
527  pp.query("num_diff_coeff",num_diff_coeff);
528  AMREX_ASSERT_WITH_MESSAGE(( (num_diff_coeff >= 0.) && (num_diff_coeff <= 1.) ),
529  "Numerical diffusion coefficient must be between 0 & 1.");
531  if (use_num_diff) {
532  amrex::Print() << "6th-order numerical diffusion turned on with coefficient = "
533  << num_diff_coeff << std::endl;
534  num_diff_coeff *= std::pow(2.0,-6);
535  }
536 
537  advChoice.init_params(pp_prefix);
538  diffChoice.init_params(pp_prefix);
539  dampingChoice.init_params(pp_prefix);
540  spongeChoice.init_params(pp_prefix);
541  ebChoice.init_params(pp_prefix);
542 
543  turbChoice.resize(max_level+1);
544  for (int lev = 0; lev <= max_level; lev++) {
545  turbChoice[lev].init_params(lev,max_level,pp_prefix);
546  }
547 
548  // YSU PBL: use consistent coriolis frequency
549  for (int lev = 0; lev <= max_level; lev++) {
550  if (turbChoice[lev].pbl_ysu_use_consistent_coriolis) {
551  if (use_coriolis) {
552  turbChoice[lev].pbl_ysu_coriolis_freq = coriolis_factor * sinphi;
553  if (lev == 0) {
554  amrex::Print() << "YSU PBL using ERF coriolis frequency: " << turbChoice[lev].pbl_ysu_coriolis_freq << std::endl;
555  }
556  } else {
557  amrex::Abort("YSU cannot use ERF coriolis frequency if not using coriolis");
558  }
559  }
560  }
561  // MRF
562  for (int lev = 0; lev <= max_level; lev++) {
563  if (turbChoice[lev].pbl_ysu_use_consistent_coriolis) {
564  if (use_coriolis) {
565  turbChoice[lev].pbl_ysu_coriolis_freq = coriolis_factor * sinphi;
566  if (lev == 0) {
567  amrex::Print() << "MRF PBL using ERF coriolis frequency: " << turbChoice[lev].pbl_ysu_coriolis_freq << std::endl;
568  }
569  } else {
570  amrex::Abort("MRF cannot use ERF coriolis frequency if not using coriolis");
571  }
572  }
573  }
574 
575  // Are we using SHOC? (test on compilation done in turb struct)
576  if (turbChoice[0].pbl_type == PBLType::SHOC) { use_shoc = true; }
577 
578  // Implicit vertical diffusion (not available with Shoc)
579  if (!use_shoc) {
580  // This controls the time-centering of the vertical differences in the diffusive term
581  bool do_vert_implicit = false;
582  if (pp.query("vert_implicit", do_vert_implicit) && do_vert_implicit) {
583  // set to default here
584  vert_implicit_fac[0] = 1.0;
585  vert_implicit_fac[1] = 1.0;
586  vert_implicit_fac[2] = 0.0;
587  }
588 
589  // This may be one value for all RK stages or a different value in each stage
590  int n_impfac = pp.countval("vert_implicit_fac");
591  AMREX_ALWAYS_ASSERT(n_impfac == 0 || n_impfac == 1 || n_impfac==3);
592  if (n_impfac > 0 && do_vert_implicit) {
593  amrex::Print() << "Overriding defaults with specified implicit factor(s)" << std::endl;
594  }
595 
596  if (n_impfac == 1) {
597  amrex::Real fac_in;
598  pp.get("vert_implicit_fac", fac_in);
599  for (int i=0; i<3; ++i) { vert_implicit_fac[i] = fac_in; }
600  } else if (n_impfac == 3) {
601  pp.getarr("vert_implicit_fac", vert_implicit_fac);
602  }
603 
604  // If true (default), include implicit contributions to vertical
605  // thermal diffusion
606  pp.query("implicit_thermal_diffusion", implicit_thermal_diffusion);
607 
608  // If true (default), include implicit contributions in tau13, tau23,
609  // (and if ERF_IMPLICIT_W is set, tau33) to correct u, v, (and w).
610  pp.query("implicit_momentum_diffusion", implicit_momentum_diffusion);
611 
613  amrex::Print() << "Thermal and momentum diffusion are both turned off -- turning off vertical implicit solve" << std::endl;
614  vert_implicit_fac[0] = 0.0;
615  vert_implicit_fac[1] = 0.0;
616  vert_implicit_fac[2] = 0.0;
617  }
618 
619  // This controls when the vertical implicit solve for the diffusive terms will happen relative to
620  // the acoustic substepping (if it happens, i.e. if any of the implicit_fac > 0.)
621  // The default is true (i.e. that it happens before the acoustic substepping).
622  pp.query("implicit_before_substep", implicit_before_substep);
623  }
624 
625  // Which type of multilevel coupling
626  coupling_type = CouplingType::TwoWay; // Default
627  pp.query_enum_case_insensitive("coupling_type",coupling_type);
628 
629  // Test for hybrid (compressible + anelastic) -- in this case we must use one-way coupling
630  bool any_anelastic = false;
631  bool any_compress = false;
632  for (int lev = 0; lev <= max_level; lev++) {
633  if (anelastic[lev] == 0) {
634  any_compress = true;
635  } else {
636  any_anelastic = true;
637  }
638  }
639  if (any_anelastic && any_compress) {
640  coupling_type = CouplingType::OneWay;
641  }
642 
643  // Which type of windfarm model
644  windfarm_type = WindFarmType::None; // Default
645  pp.query_enum_case_insensitive("windfarm_type",windfarm_type);
646 
647  static std::string windfarm_loc_type_string = "None";
648  windfarm_loc_type = WindFarmLocType::None;
649  pp.query_enum_case_insensitive("windfarm_loc_type",windfarm_loc_type);
650 
651  pp.query("windfarm_loc_table", windfarm_loc_table);
652  pp.query("windfarm_spec_table", windfarm_spec_table);
653  pp.query("windfarm_blade_table", windfarm_blade_table);
654  pp.query("windfarm_airfoil_tables", windfarm_airfoil_tables);
655  pp.query("windfarm_spec_table_extra", windfarm_spec_table_extra);
656 
657  // Sampling distance upstream of the turbine to find the
658  // incoming free stream velocity as a factor of the diameter of the
659  // turbine. ie. the sampling distance will be this number multiplied
660  // by the diameter of the turbine
661  pp.query("sampling_distance_by_D", sampling_distance_by_D);
662  pp.query("turb_disk_angle_from_x", turb_disk_angle);
663 
664  pp.query("windfarm_x_shift",windfarm_x_shift);
665  pp.query("windfarm_y_shift",windfarm_y_shift);
666  // Test if time averaged data is to be output
667  pp.query("time_avg_vel",time_avg_vel);
668 
669  pp.query("hindcast_lateral_forcing", hindcast_lateral_forcing);
670 
672  pp.query("hindcast_boundary_data_dir", hindcast_boundary_data_dir);
673 
674  if(hindcast_boundary_data_dir.empty()) {
675  amrex::Abort("ERROR: Missing input parameter 'erf.hindcast_boundary_data_dir' for boundary data for lateral forcing");
676  }
677  pp.query("hindcast_data_interval_in_hrs", hindcast_data_interval_in_hrs);
679  amrex::Abort("ERROR: Input parameter 'erf.hindcast_data_interval_in_hrs' which is the time interval between the "
680  "data files is either missing or set to less than zero");
681  }
682  pp.query("hindcast_lateral_sponge_strength", hindcast_lateral_sponge_strength);
683  pp.query("hindcast_lateral_sponge_length", hindcast_lateral_sponge_length);
684 
685  pp.query("hindcast_zhi_sponge_length", hindcast_zhi_sponge_length);
686  pp.query("hindcast_zhi_sponge_strength", hindcast_zhi_sponge_strength);
687 
688  pp.query("hindcast_zhi_sponge_damping", hindcast_zhi_sponge_damping);
689 
691  amrex::Abort("ERROR: Missing input parameter 'erf.hindcast_lateral_sponge_strength' or it is specified to be less than zero");
692  }
693 
695  amrex::Abort("ERROR: Missing input parameter 'erf.hindcast_lateral_sponge_length' or it is specified to be less than zero");
696  }
697 
699  amrex::Abort("ERROR: Missing input parameter 'erf.hindcast_zhi_sponge_strength' or it is specified to be less than zero");
700  }
701 
703  amrex::Abort("ERROR: Missing input parameter 'erf.hindcast_zhi_sponge_strength' or it is specified to be less than zero");
704  }
705  }
706 
707  pp.query("io_hurricane_eye_tracker", io_hurricane_eye_tracker);
709  pp.query("hurricane_eye_latitude", hurricane_eye_latitude);
710  pp.query("hurricane_eye_longitude", hurricane_eye_longitude);
711  if(hurricane_eye_latitude == -1e10 or hurricane_eye_longitude == -1e10) {
712  amrex::Abort("ERROR: You are using 'erf.io_hurricane_eye_tracker' to write out the files that track the eye of the hurricane"
713  " but have not provided the initial location of the eye of the hurricane to be tracked. There has to be two"
714  " options in the inputs - erf.hurricane_eye_latitude and erf.hurricane_eye_longitude that gives an approximate"
715  " location of the eye in the initial condition");
716  }
717  }
718  }
719 
720  void check_params (int max_level, const amrex::Vector<amrex::Geometry>& geom_vect, amrex::GpuArray<ERF_BC, AMREX_SPACEDIM*2> phys_bc_type)
721  {
722 #if 0
723  // Warn for PBL models and moisture - these may not yet be compatible
724  for (int lev = 0; lev <= max_level; lev++) {
725  if ((moisture_type != MoistureType::None) && (turbChoice[lev].pbl_type != PBLType::None)) {
726  amrex::Warning("\n*** WARNING: Moisture may not yet be compatible with PBL models, \n proceed with caution ***");
727  }
728  }
729 #endif
730  //
731  // Buoyancy type check
732  //
733  for (int lev = 0; lev <= max_level; lev++) {
734  if (buoyancy_type[lev] != 1 && buoyancy_type[lev] != 2 && buoyancy_type[lev] != 3 && buoyancy_type[lev] != 4) {
735  amrex::Abort("buoyancy_type must be 1, 2, 3 or 4");
736  }
737  }
738 
739  if (!use_lagged_delta_rt && !(terrain_type == TerrainType::MovingFittedMesh)) {
740  amrex::Error("Can't turn off lagged_delta_rt when terrain not moving");
741  }
742 
743  //
744  // Wind farm checks
745  //
746  if (windfarm_type==WindFarmType::SimpleAD and sampling_distance_by_D < 0.0) {
747  amrex::Abort("To use simplified actuator disks, you need to provide a variable"
748  " erf.sampling_distance_by_D in the inputs which specifies the upstream"
749  " distance as a factor of the turbine diameter at which the incoming free stream"
750  " velocity will be computed at.");
751  }
752  if ( (windfarm_type==WindFarmType::SimpleAD ||
753  windfarm_type==WindFarmType::GeneralAD ) && turb_disk_angle < 0.0) {
754  amrex::Abort("To use simplified actuator disks, you need to provide a variable"
755  " erf.turb_disk_angle_from_x in the inputs which is the angle of the face of the"
756  " turbine disk from the x-axis. A turbine facing an oncoming flow in the x-direction"
757  " will have turb_disk_angle value of 90 deg.");
758  }
759  if (windfarm_loc_type == WindFarmLocType::lat_lon and (windfarm_x_shift < 0.0 or windfarm_y_shift < 0.0)) {
760  amrex::Abort("You are using windfarms with latitude-logitude option to position the turbines."
761  " For this you should provide the inputs erf.windfarm_x_shift and"
762  " erf.windfarm_y_shift which are the values by which the bounding box of the"
763  " windfarm is shifted from the x and the y axes.");
764  }
765 
766 
767  if ( (const_massflux_u != 0) && !(geom_vect[0].isPeriodic(0)) ) {
768  amrex::Abort("Constant mass flux (in x) should be used with periodic boundaries");
769  }
770 
771  if ( (const_massflux_v != 0) && !(geom_vect[0].isPeriodic(1)) ) {
772  amrex::Abort("Constant mass flux (in y) should be used with periodic boundaries");
773  }
774 
775  // Mesoscale diffusion -- test if LES appropriate with this dx,dy
776  for (int lev = 0; lev <= max_level; lev++) {
777  if ((geom_vect[lev].CellSize(0) > 2000.) || (geom_vect[lev].CellSize(1) > 2000.))
778  {
779  if ( (turbChoice[lev].les_type == LESType::Smagorinsky) && !turbChoice[lev].smag2d ) {
780  amrex::Warning("Should use 2-D Smagorinsky for mesoscale resolution");
781  } else if (turbChoice[lev].les_type == LESType::Deardorff) {
782  amrex::Warning("Should not use Deardorff LES for mesoscale resolution");
783  }
784  }
785  }
786 
787  // Turn off implicit solve if we have no diffusion
788  bool l_use_kturb = turbChoice[0].use_kturb;
789  for (int lev = 1; lev <= max_level; lev++) {
790  l_use_kturb = (l_use_kturb || turbChoice[lev].use_kturb);
791  }
792  bool l_use_diff = ( (diffChoice.molec_diff_type != MolecDiffType::None) || l_use_kturb );
793  bool l_implicit_diff = (vert_implicit_fac[0] > 0 ||
794  vert_implicit_fac[1] > 0 ||
795  vert_implicit_fac[2] > 0);
796  if (l_implicit_diff && !l_use_diff) {
797  amrex:: Print() << "No molecular or turbulent diffusion, turning off implicit solve" << std::endl;
798  vert_implicit_fac[0] = 0;
799  vert_implicit_fac[1] = 0;
800  vert_implicit_fac[2] = 0;
801  }
802 
803  for (int lev = 0; lev <= max_level; lev++) {
804  turbChoice[lev].check_params(phys_bc_type);
805  }
806  }
807 
808  void display (int max_level, std::string pp_prefix)
809  {
810  amrex::Print() << "SOLVER CHOICE: " << std::endl;
811  for (int lev = 0; lev <= max_level; lev++) {
812  amrex::Print() << "At level " << lev << " : " << std::endl;
813  if (anelastic[lev]) {
814  amrex::Print() << " anelastic with no substepping" << std::endl;
815  } else {
816  if (substepping_type[lev] == SubsteppingType::None) {
817  amrex::Print() << " compressible with no substepping" << std::endl;
818  } else if (substepping_type[lev] == SubsteppingType::Implicit) {
819  amrex::Print() << " compressible with implicit substepping" << std::endl;
820  }
821  }
822  if (fixed_density[lev]) {
823  amrex::Print() << " and fixed density" << std::endl;
824  }
825  }
826 
827  amrex::Print() << "vert_implicit_fac : " << vert_implicit_fac[0] << " "
828  << vert_implicit_fac[1] << " "
829  << vert_implicit_fac[2];
830  if (vert_implicit_fac[0] > 0 ||
831  vert_implicit_fac[0] > 1 ||
832  vert_implicit_fac[0] > 2)
833  {
834  amrex::Print() << " (theta=" << implicit_thermal_diffusion
835  << ", momenta=" << implicit_momentum_diffusion;
836 #ifdef ERF_IMPLICIT_W
837  amrex::Print() << ", including w";
838 #endif
839  amrex::Print() << ")";
840  }
841  amrex::Print() << std::endl;
842  amrex::Print() << "use_coriolis : " << use_coriolis << std::endl;
843  amrex::Print() << "use_gravity : " << use_gravity << std::endl;
844 
845  if (moisture_type == MoistureType::SAM) {
846  amrex::Print() << "Moisture Model: SAM" << std::endl;
847  } else if (moisture_type == MoistureType::SAM_NoIce) {
848  amrex::Print() << "Moisture Model: SAM No Ice" << std::endl;
849  } else if (moisture_type == MoistureType::SAM_NoPrecip_NoIce) {
850  amrex::Print() << "Moisture Model: SAM No Precip No Ice" << std::endl;
851  } else if (moisture_type == MoistureType::Morrison) {
852  amrex::Print() << "Moisture Model: Morrison" << std::endl;
853  } else if (moisture_type == MoistureType::Morrison_NoIce) {
854  amrex::Print() << "Moisture Model: Morrison_NoIce" << std::endl;
855  } else if (moisture_type == MoistureType::Kessler) {
856  amrex::Print() << "Moisture Model: Kessler" << std::endl;
857  } else if (moisture_type == MoistureType::Kessler_NoRain) {
858  amrex::Print() << "Moisture Model: Kessler No Rain" << std::endl;
859  } else if (moisture_type == MoistureType::SatAdj) {
860  amrex::Print() << "Moisture Model: Saturation Adjustment" << std::endl;
861  } else {
862  amrex::Print() << "Moisture Model: None" << std::endl;
863  }
864 
865  if (terrain_type == TerrainType::StaticFittedMesh) {
866  amrex::Print() << "Terrain Type: StaticFittedMesh" << std::endl;
867  } else if (terrain_type == TerrainType::MovingFittedMesh) {
868  amrex::Print() << "Terrain Type: MovingFittedMesh" << std::endl;
869  } else if (terrain_type == TerrainType::EB) {
870  amrex::Print() << "Terrain Type: EB" << std::endl;
871  ebChoice.display();
872  } else if (terrain_type == TerrainType::ImmersedForcing) {
873  amrex::Print() << "Terrain Type: ImmersedForcing" << std::endl;
874  } else {
875  amrex::Print() << "Terrain Type: None" << std::endl;
876  }
877 
878  if (buildings_type == BuildingsType::ImmersedForcing) {
879  amrex::Print() << "Buildings Type: ImmersedForcing" << std::endl;
880  } else {
881  amrex::Print() << "Buildings Type: None" << std::endl;
882  }
883 
884  if (mesh_type == MeshType::ConstantDz) {
885  amrex::Print() << " Mesh Type: ConstantDz" << std::endl;
886  } else if (mesh_type == MeshType::StretchedDz) {
887  amrex::Print() << " Mesh Type: StretchedDz" << std::endl;
888  } else if (mesh_type == MeshType::VariableDz) {
889  amrex::Print() << " Mesh Type: VariableDz" << std::endl;
890  } else {
891  amrex::Abort("No mesh_type set!");
892  }
893 
894  amrex::Print() << "ABL Driver Type: " << std::endl;
895  if (abl_driver_type == ABLDriverType::None) {
896  amrex::Print() << " None" << std::endl;
897  } else if (abl_driver_type == ABLDriverType::PressureGradient) {
898  amrex::Print() << " Pressure Gradient "
899  << amrex::RealVect(abl_pressure_grad[0],abl_pressure_grad[1],abl_pressure_grad[2])
900  << std::endl;
901  } else if (abl_driver_type == ABLDriverType::GeostrophicWind) {
902  amrex::Print() << " Geostrophic Wind "
903  << amrex::RealVect(abl_geo_forcing[0],abl_geo_forcing[1],abl_geo_forcing[2])
904  << std::endl;
905  }
906 
907  if (max_level > 0) {
908  amrex::Print() << "Coupling Type: " << std::endl;
909  if (coupling_type == CouplingType::TwoWay) {
910  amrex::Print() << " Two-way" << std::endl;
911  } else if (coupling_type == CouplingType::OneWay) {
912  amrex::Print() << " One-way" << std::endl;
913  }
914  }
915 
916  if (rad_type == RadiationType::RRTMGP) {
917  amrex::Print() << "Radiation Model: RRTMGP" << std::endl;
918  } else {
919  amrex::Print() << "Radiation Model: None" << std::endl;
920  }
921 
922  amrex::Print() << "Gradp_type : " << gradp_type << std::endl;
923 
924  for (int lev = 0; lev <= max_level; lev++) {
925  amrex::Print() << "Buoyancy_type at level " << lev << " : " << buoyancy_type[lev] << std::endl;
926  }
927 
928  advChoice.display(pp_prefix);
932 
933  for (int lev = 0; lev <= max_level; lev++) {
934  turbChoice[lev].display(lev);
935  }
936  }
937 
938  void build_coriolis_forcings_const_lat (std::string pp_prefix)
939  {
940  amrex::ParmParse pp(pp_prefix);
941 
942  // Read the rotational time period (in seconds)
943  amrex::Real rot_time_period = 86400.0;
944  pp.query("rotational_time_period", rot_time_period);
945 
946  coriolis_factor = 2.0 * 2.0 * PI / rot_time_period;
947 
948  amrex::Real latitude = 90.0;
949  pp.query("latitude", latitude);
950 
951  pp.query("coriolis_3d", coriolis_3d);
952 
953  // Convert to radians
954  latitude *= (PI/180.);
955  sinphi = std::sin(latitude);
956  if (coriolis_3d) {
957  cosphi = std::cos(latitude);
958  }
959 
960  amrex::Print() << "Coriolis frequency, f = " << coriolis_factor * sinphi << " 1/s" << std::endl;
961 
962  if (abl_driver_type == ABLDriverType::GeostrophicWind) {
963  // Read in the geostrophic wind -- we only use this to construct
964  // the forcing term so no need to keep it
965  amrex::Vector<amrex::Real> abl_geo_wind(3);
966  pp.queryarr("abl_geo_wind",abl_geo_wind);
967 
968  if(!pp.query("abl_geo_wind_table",abl_geo_wind_table)) {
969  abl_geo_forcing = {
970  -coriolis_factor * (abl_geo_wind[1]*sinphi - abl_geo_wind[2]*cosphi),
971  coriolis_factor * abl_geo_wind[0]*sinphi,
972  -coriolis_factor * abl_geo_wind[0]*cosphi
973  };
974  } else {
975  amrex::Print() << "NOTE: abl_geo_wind_table provided, ignoring input abl_geo_wind" << std::endl;
976  }
977  }
978  }
979 
980  void read_int_string (int max_level, const char* string_to_read,
981  amrex::Vector<int>& vec_to_fill, int default_int)
982  {
983  amrex::ParmParse pp("erf");
984  int nvals = pp.countval(string_to_read);
985  AMREX_ALWAYS_ASSERT(nvals == 0 || nvals == 1 || nvals >= max_level+1);
986  amrex::Vector<int> temp; temp.resize(nvals);
987  pp.queryarr(string_to_read,temp);
988 
989  if (vec_to_fill.size() < max_level+1) {
990  vec_to_fill.resize(max_level+1);
991  }
992 
993  if (nvals == 0) {
994  for (int i = 0; i <= max_level; ++i) vec_to_fill[i] = default_int;
995  } else if (nvals == 1) {
996  for (int i = 0; i <= max_level; ++i) vec_to_fill[i] = temp[0];
997  } else {
998  for (int i = 0; i <= max_level; ++i) vec_to_fill[i] = temp[i];
999  }
1000  }
1001 
1002  inline static
1003  InitType init_type = InitType::None;
1004 
1005  inline static
1006  SoundingType sounding_type = SoundingType::Ideal;
1007 
1008  inline static
1009  TerrainType terrain_type = TerrainType::None;
1010 
1011  inline static
1012  BuildingsType buildings_type = BuildingsType::None;
1013 
1014  inline static
1015  bool use_real_bcs = false;
1016 
1017  inline static
1018  bool upwind_real_bcs = false;
1019 
1020  inline static
1021  MeshType mesh_type = MeshType::ConstantDz;
1022 
1023  static
1024  void set_mesh_type (MeshType new_mesh_type)
1025  {
1026  mesh_type = new_mesh_type;
1027  }
1028 
1033  amrex::Vector<TurbChoice> turbChoice;
1035 
1037 
1038  amrex::Vector<SubsteppingType> substepping_type;
1039  amrex::Vector<int> anelastic;
1040  amrex::Vector<int> fixed_density;
1041  amrex::Vector<int> project_initial_velocity;
1042  amrex::Vector<int> buoyancy_type;
1043 
1044  // do some extra CFL diagnostics for compressible with substepping
1045  bool substepping_diag = false;
1046 
1047  // time off-centering coefficient, > 0 for forward weighting (i.e., bias
1048  // towards the future time step)
1050 
1051  // This controls the time-centering of the *vertical* differences in the diffusive term for
1052  // theta, u, v (and w if ERF_IMPLICIT_W is set)
1053  // 0: fully explicit
1054  // 1: fully implicit
1055  amrex::Vector<amrex::Real> vert_implicit_fac = {0.0, 0.0, 0.0}; // one value per RK stage
1056  // if any vert_implicit_fac > 0, then the following apply:
1060 
1061  int ncorr = 1;
1064 
1065  bool test_mapfactor = false;
1066 
1067  int gradp_type = 0;
1068 
1069  // Specify what additional physics/forcing modules we use
1070  bool use_gravity = false;
1071  bool use_coriolis = false;
1072  bool coriolis_3d = true;
1073 
1075 
1076  // Specify whether to apply other various source terms on substep only
1078  bool forest_substep = false;
1079 
1080  // immersed forcing parameters
1083  // immersed forcing MOST parameters.
1084  amrex::Real if_z0 = 0.1; // [m]
1085  amrex::Real if_surf_temp_flux = 1e-8; // [K m/s]
1088  amrex::Real if_Olen_in = 1e-8; // [m]
1089  bool if_use_most = false;
1090 
1091  // This defaults to true but can be set to false for moving terrain cases only
1092  bool use_lagged_delta_rt = true;
1093 
1094  // Constants
1096  amrex::Real c_p = Cp_d; // specific heat at constant pressure for dry air [J/(kg-K)]
1098 
1099  // Staggered z levels for vertical grid stretching
1103 
1104  // Coriolis forcing
1108 
1109  // User-specified forcings in problem definition
1112  bool custom_w_subsidence = false;
1115 
1116  // Do we use source terms to nudge the solution towards
1117  // the time-varying data provided in input sounding files?
1119 
1120  // MOST stress rotations
1122 
1123  // Should we use SHOC?
1124  bool use_shoc = false;
1125 
1126  // User wishes to output time averaged velocity fields
1127  bool time_avg_vel = false;
1128 
1129  // Type of perturbation
1130  PerturbationType pert_type;
1131 
1132  // Numerical diffusion
1133  bool use_num_diff{false};
1135 
1136  // Rebalance wrfinput
1137  bool rebalance_wrfinput{false};
1138 
1139  CouplingType coupling_type;
1140  MoistureType moisture_type;
1141  WindFarmType windfarm_type;
1142  WindFarmLocType windfarm_loc_type;
1143  LandSurfaceType lsm_type;
1144  RadiationType rad_type;
1145 
1146  ABLDriverType abl_driver_type;
1147  amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> abl_pressure_grad;
1148  amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> abl_geo_forcing;
1149  std::string abl_geo_wind_table;
1151 
1152  bool has_lat_lon{false};
1153  bool variable_coriolis{false};
1154 
1155  int ave_plane {2};
1156 
1157  // Microphysics params
1158  bool use_moist_background {false};
1160 
1162 
1169 
1170  // Use forest canopy model?
1171  bool do_forest_drag {false};
1172 
1173  // Enforce constant mass flux?
1179  int massflux_klo {0}; // these are updated in ERF.cpp
1180  int massflux_khi {0};
1181 
1188 
1191 };
1192 #endif
constexpr amrex::Real Cp_d
Definition: ERF_Constants.H:12
constexpr amrex::Real PI
Definition: ERF_Constants.H:6
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:21
constexpr amrex::Real R_d
Definition: ERF_Constants.H:10
TauType
Definition: ERF_DataStruct.H:31
@ tau12
Definition: ERF_DataStruct.H:32
@ tau23
Definition: ERF_DataStruct.H:32
@ tau33
Definition: ERF_DataStruct.H:32
@ tau22
Definition: ERF_DataStruct.H:32
@ tau11
Definition: ERF_DataStruct.H:32
@ tau32
Definition: ERF_DataStruct.H:32
@ tau31
Definition: ERF_DataStruct.H:32
@ tau21
Definition: ERF_DataStruct.H:32
@ tau13
Definition: ERF_DataStruct.H:32
Rayleigh
Definition: ERF_DataStruct.H:96
@ ubar
Definition: ERF_DataStruct.H:97
@ wbar
Definition: ERF_DataStruct.H:97
@ nvars
Definition: ERF_DataStruct.H:97
@ vbar
Definition: ERF_DataStruct.H:97
@ thetabar
Definition: ERF_DataStruct.H:97
Sponge
Definition: ERF_DataStruct.H:101
@ nvars_sponge
Definition: ERF_DataStruct.H:102
@ vbar_sponge
Definition: ERF_DataStruct.H:102
@ ubar_sponge
Definition: ERF_DataStruct.H:102
MapFacType
Definition: ERF_DataStruct.H:22
@ v_x
Definition: ERF_DataStruct.H:24
@ num
Definition: ERF_DataStruct.H:24
@ u_y
Definition: ERF_DataStruct.H:25
@ v_y
Definition: ERF_DataStruct.H:25
@ m_y
Definition: ERF_DataStruct.H:25
@ u_x
Definition: ERF_DataStruct.H:24
@ m_x
Definition: ERF_DataStruct.H:24
Coord
Definition: ERF_DataStruct.H:91
AMREX_ENUM(InitType, None, Input_Sounding, NCFile, WRFInput, Metgrid, Uniform, HindCast)
#define RhoQ4_comp
Definition: ERF_IndexDefines.H:45
#define RhoQ2_comp
Definition: ERF_IndexDefines.H:43
#define RhoQ3_comp
Definition: ERF_IndexDefines.H:44
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:42
#define RhoQ6_comp
Definition: ERF_IndexDefines.H:47
#define RhoQ5_comp
Definition: ERF_IndexDefines.H:46
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real pp(amrex::Real y)
Definition: ERF_MicrophysicsUtils.H:233
amrex::Real Real
Definition: ERF_ShocInterface.H:19
Definition: ERF_EWP.H:9
Definition: ERF_Fitch.H:9
Definition: ERF_GeneralAD.H:8
Definition: ERF_Kessler.H:38
Definition: ERF_MM5.H:26
Definition: ERF_Morrison.H:58
Definition: ERF_NOAHMP.H:49
Definition: ERF_SAM.H:53
Definition: ERF_SLM.H:26
Definition: ERF_SatAdj.H:41
Definition: ERF_SimpleAD.H:8
@ bogus
Definition: ERF_IndexDefines.H:204
Definition: ERF_AdvStruct.H:19
void display(std::string &pp_prefix)
Definition: ERF_AdvStruct.H:235
void init_params(std::string pp_prefix)
Definition: ERF_AdvStruct.H:21
Definition: ERF_DampingStruct.H:19
void init_params(std::string pp_prefix)
Definition: ERF_DampingStruct.H:21
void display()
Definition: ERF_DampingStruct.H:61
Definition: ERF_DiffStruct.H:19
void init_params(std::string pp_prefix)
Definition: ERF_DiffStruct.H:21
void display()
Definition: ERF_DiffStruct.H:67
MolecDiffType molec_diff_type
Definition: ERF_DiffStruct.H:84
Definition: ERF_EBStruct.H:19
void init_params(std::string pp_prefix)
Definition: ERF_EBStruct.H:21
void display()
Definition: ERF_EBStruct.H:37
Definition: ERF_DataStruct.H:105
int qs
Definition: ERF_DataStruct.H:110
int qr
Definition: ERF_DataStruct.H:109
MoistureComponentIndices()=default
int qi
Definition: ERF_DataStruct.H:108
int qv
Definition: ERF_DataStruct.H:106
int qc
Definition: ERF_DataStruct.H:107
int qg
Definition: ERF_DataStruct.H:111
MoistureComponentIndices(int qv_comp, int qc_comp, int qi_comp=-1, int qr_comp=-1, int qs_comp=-1, int qg_comp=-1)
Definition: ERF_DataStruct.H:114
Definition: ERF_DataStruct.H:129
amrex::Real hurricane_eye_latitude
Definition: ERF_DataStruct.H:1190
amrex::Real if_init_surf_temp
Definition: ERF_DataStruct.H:1086
amrex::Real dz0
Definition: ERF_DataStruct.H:1102
amrex::Real const_massflux_layer_lo
Definition: ERF_DataStruct.H:1177
bool use_lagged_delta_rt
Definition: ERF_DataStruct.H:1092
amrex::Real coriolis_factor
Definition: ERF_DataStruct.H:1105
static MeshType mesh_type
Definition: ERF_DataStruct.H:1021
amrex::Real if_surf_temp_flux
Definition: ERF_DataStruct.H:1085
amrex::Real windfarm_x_shift
Definition: ERF_DataStruct.H:1167
void check_params(int max_level, const amrex::Vector< amrex::Geometry > &geom_vect, amrex::GpuArray< ERF_BC, AMREX_SPACEDIM *2 > phys_bc_type)
Definition: ERF_DataStruct.H:720
void display(int max_level, std::string pp_prefix)
Definition: ERF_DataStruct.H:808
bool rebalance_wrfinput
Definition: ERF_DataStruct.H:1137
amrex::Real hindcast_lateral_sponge_strength
Definition: ERF_DataStruct.H:1185
amrex::Real poisson_reltol
Definition: ERF_DataStruct.H:1063
void build_coriolis_forcings_const_lat(std::string pp_prefix)
Definition: ERF_DataStruct.H:938
bool if_use_most
Definition: ERF_DataStruct.H:1089
DampingChoice dampingChoice
Definition: ERF_DataStruct.H:1031
amrex::Real rdOcp
Definition: ERF_DataStruct.H:1097
RadiationType rad_type
Definition: ERF_DataStruct.H:1144
void read_int_string(int max_level, const char *string_to_read, amrex::Vector< int > &vec_to_fill, int default_int)
Definition: ERF_DataStruct.H:980
amrex::Vector< int > project_initial_velocity
Definition: ERF_DataStruct.H:1041
std::string windfarm_spec_table
Definition: ERF_DataStruct.H:1163
amrex::Real hindcast_zhi_sponge_length
Definition: ERF_DataStruct.H:1186
DiffChoice diffChoice
Definition: ERF_DataStruct.H:1030
amrex::Real const_massflux_v
Definition: ERF_DataStruct.H:1175
amrex::Real if_z0
Definition: ERF_DataStruct.H:1084
bool use_gravity
Definition: ERF_DataStruct.H:1070
int ncorr
Definition: ERF_DataStruct.H:1061
int force_stage1_single_substep
Definition: ERF_DataStruct.H:1036
bool hindcast_zhi_sponge_damping
Definition: ERF_DataStruct.H:1187
std::string windfarm_spec_table_extra
Definition: ERF_DataStruct.H:1163
amrex::Real cosphi
Definition: ERF_DataStruct.H:1106
LandSurfaceType lsm_type
Definition: ERF_DataStruct.H:1143
amrex::Real c_p
Definition: ERF_DataStruct.H:1096
amrex::Vector< int > buoyancy_type
Definition: ERF_DataStruct.H:1042
std::string windfarm_loc_table
Definition: ERF_DataStruct.H:1163
amrex::Real gravity
Definition: ERF_DataStruct.H:1095
amrex::Real beta_s
Definition: ERF_DataStruct.H:1049
bool custom_rhotheta_forcing
Definition: ERF_DataStruct.H:1110
amrex::Real hindcast_lateral_sponge_length
Definition: ERF_DataStruct.H:1185
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > abl_geo_forcing
Definition: ERF_DataStruct.H:1148
bool use_shoc
Definition: ERF_DataStruct.H:1124
WindFarmLocType windfarm_loc_type
Definition: ERF_DataStruct.H:1142
bool hindcast_lateral_forcing
Definition: ERF_DataStruct.H:1184
int massflux_klo
Definition: ERF_DataStruct.H:1179
bool moisture_tight_coupling
Definition: ERF_DataStruct.H:1161
bool custom_w_subsidence
Definition: ERF_DataStruct.H:1112
bool nudging_from_input_sounding
Definition: ERF_DataStruct.H:1118
bool custom_geostrophic_profile
Definition: ERF_DataStruct.H:1113
amrex::Real if_Cd_scalar
Definition: ERF_DataStruct.H:1081
bool immersed_forcing_substep
Definition: ERF_DataStruct.H:1077
amrex::Real grid_stretching_ratio
Definition: ERF_DataStruct.H:1100
amrex::Real sinphi
Definition: ERF_DataStruct.H:1107
bool have_geo_wind_profile
Definition: ERF_DataStruct.H:1150
amrex::Vector< amrex::Real > vert_implicit_fac
Definition: ERF_DataStruct.H:1055
amrex::Real hurricane_eye_longitude
Definition: ERF_DataStruct.H:1190
amrex::Real const_massflux_u
Definition: ERF_DataStruct.H:1174
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > abl_pressure_grad
Definition: ERF_DataStruct.H:1147
void init_params(int max_level, std::string pp_prefix)
Definition: ERF_DataStruct.H:131
bool io_hurricane_eye_tracker
Definition: ERF_DataStruct.H:1189
amrex::Vector< SubsteppingType > substepping_type
Definition: ERF_DataStruct.H:1038
bool coriolis_3d
Definition: ERF_DataStruct.H:1072
amrex::Real if_Olen_in
Definition: ERF_DataStruct.H:1088
bool use_num_diff
Definition: ERF_DataStruct.H:1133
amrex::Real sampling_distance_by_D
Definition: ERF_DataStruct.H:1165
bool implicit_thermal_diffusion
Definition: ERF_DataStruct.H:1057
amrex::Real hindcast_zhi_sponge_strength
Definition: ERF_DataStruct.H:1186
bool test_mapfactor
Definition: ERF_DataStruct.H:1065
bool use_coriolis
Definition: ERF_DataStruct.H:1071
static SoundingType sounding_type
Definition: ERF_DataStruct.H:1006
bool four_stream_radiation
Definition: ERF_DataStruct.H:1074
bool custom_moisture_forcing
Definition: ERF_DataStruct.H:1111
amrex::Real num_diff_coeff
Definition: ERF_DataStruct.H:1134
std::string windfarm_blade_table
Definition: ERF_DataStruct.H:1164
amrex::Real zsurf
Definition: ERF_DataStruct.H:1101
amrex::Real if_surf_heating_rate
Definition: ERF_DataStruct.H:1087
amrex::Vector< TurbChoice > turbChoice
Definition: ERF_DataStruct.H:1033
bool variable_coriolis
Definition: ERF_DataStruct.H:1153
amrex::Vector< int > anelastic
Definition: ERF_DataStruct.H:1039
amrex::Real if_Cd_momentum
Definition: ERF_DataStruct.H:1082
static bool upwind_real_bcs
Definition: ERF_DataStruct.H:1018
AdvChoice advChoice
Definition: ERF_DataStruct.H:1029
bool use_moist_background
Definition: ERF_DataStruct.H:1158
MoistureType moisture_type
Definition: ERF_DataStruct.H:1140
bool custom_forcing_prim_vars
Definition: ERF_DataStruct.H:1114
std::string abl_geo_wind_table
Definition: ERF_DataStruct.H:1149
static BuildingsType buildings_type
Definition: ERF_DataStruct.H:1012
static TerrainType terrain_type
Definition: ERF_DataStruct.H:1009
amrex::Real hindcast_data_interval_in_hrs
Definition: ERF_DataStruct.H:1183
ABLDriverType abl_driver_type
Definition: ERF_DataStruct.H:1146
amrex::Vector< int > fixed_density
Definition: ERF_DataStruct.H:1040
PerturbationType pert_type
Definition: ERF_DataStruct.H:1130
SpongeChoice spongeChoice
Definition: ERF_DataStruct.H:1032
WindFarmType windfarm_type
Definition: ERF_DataStruct.H:1141
static InitType init_type
Definition: ERF_DataStruct.H:1003
bool substepping_diag
Definition: ERF_DataStruct.H:1045
bool implicit_momentum_diffusion
Definition: ERF_DataStruct.H:1058
amrex::Real const_massflux_layer_hi
Definition: ERF_DataStruct.H:1178
bool implicit_before_substep
Definition: ERF_DataStruct.H:1059
static bool use_real_bcs
Definition: ERF_DataStruct.H:1015
amrex::Real poisson_abstol
Definition: ERF_DataStruct.H:1062
MoistureComponentIndices moisture_indices
Definition: ERF_DataStruct.H:1159
amrex::Real turb_disk_angle
Definition: ERF_DataStruct.H:1166
amrex::Real windfarm_y_shift
Definition: ERF_DataStruct.H:1168
bool has_lat_lon
Definition: ERF_DataStruct.H:1152
bool use_rotate_surface_flux
Definition: ERF_DataStruct.H:1121
bool do_forest_drag
Definition: ERF_DataStruct.H:1171
amrex::Real const_massflux_tau
Definition: ERF_DataStruct.H:1176
int massflux_khi
Definition: ERF_DataStruct.H:1180
bool time_avg_vel
Definition: ERF_DataStruct.H:1127
bool forest_substep
Definition: ERF_DataStruct.H:1078
EBChoice ebChoice
Definition: ERF_DataStruct.H:1034
CouplingType coupling_type
Definition: ERF_DataStruct.H:1139
std::string windfarm_airfoil_tables
Definition: ERF_DataStruct.H:1164
int gradp_type
Definition: ERF_DataStruct.H:1067
static void set_mesh_type(MeshType new_mesh_type)
Definition: ERF_DataStruct.H:1024
int ave_plane
Definition: ERF_DataStruct.H:1155
std::string hindcast_boundary_data_dir
Definition: ERF_DataStruct.H:1182
Definition: ERF_SpongeStruct.H:15
void display()
Definition: ERF_SpongeStruct.H:45
void init_params(std::string pp_prefix)
Definition: ERF_SpongeStruct.H:17