1 #ifndef ERF_DATA_STRUCT_H_
2 #define ERF_DATA_STRUCT_H_
7 #include <AMReX_ParmParse.H>
8 #include <AMReX_Print.H>
10 #include <AMReX_Geometry.H>
21 None, PressureGradient, GeostrophicWind
29 None, Explicit, Implicit
33 ConstantDz, StretchedDz, VariableDz
41 Eulerian, Lagrangian, Undefined
91 "The grid stretching ratio must be greater than 1");
98 amrex::Print() <<
"Turning terrain on to enable grid stretching" << std::endl;
103 amrex::Print() <<
"Nominal zsurface height != 0, may result in unexpected behavior"
106 pp.get(
"initial_dz",
dz0);
123 }
else if (
moisture_type == MoistureType::SAM_NoPrecip_NoIce) {
158 pp.query_enum_case_insensitive(
"land_surface_model",
lsm_type);
167 int n_zlevels =
pp.countval(
"terrain_z_levels");
185 pp.query(
"c_p",
c_p);
195 for (
int i = 0; i <= max_level; i++) {
199 int nvals =
pp.countval(
"substepping_type");
200 AMREX_ALWAYS_ASSERT(nvals == 0 || nvals == 1 || nvals >= max_level+1);
204 for (
int i = 1; i <= max_level; i++) {
207 }
else if (nvals > 1) {
208 for (
int i = 0; i <= max_level; i++) {
216 int nvals_old =
pp.countval(
"no_substepping");
218 amrex::Abort(
"The no_substepping flag is deprecated -- set substepping_type instead");
222 bool any_anelastic =
false;
223 for (
int i = 0; i <= max_level; ++i) {
224 if (
anelastic[i] == 1) any_anelastic =
true;
228 if (any_anelastic == 1) {
245 for (
int lev = 0; lev <= max_level; lev++) {
271 AMREX_ASSERT_WITH_MESSAGE(
terrain_type != TerrainType::None,
"MOST stress rotations are only valid with terrain!");
272 AMREX_ASSERT_WITH_MESSAGE(
use_explicit_most,
"MOST Stress rotations are only valid with explicit MOST!");
281 pp.query_enum_case_insensitive(
"perturbation_type",
pert_type);
283 amrex::Vector<amrex::Real> abl_pressure_grad_in = {0.0, 0.0, 0.0};
284 pp.queryarr(
"abl_pressure_grad",abl_pressure_grad_in);
285 for(
int i = 0; i < AMREX_SPACEDIM; ++i)
abl_pressure_grad[i] = abl_pressure_grad_in[i];
287 amrex::Vector<amrex::Real> abl_geo_forcing_in = {0.0, 0.0, 0.0};
288 if(
pp.queryarr(
"abl_geo_forcing",abl_geo_forcing_in)) {
289 amrex::Print() <<
"Specified abl_geo_forcing: (";
290 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
294 amrex::Print() <<
")" << std::endl;
312 "Should not have both abl_geo_wind_table and custom_geostrophic_profile set.");
323 "Numerical diffusion coefficient must be between 0 & 1.");
326 amrex::Print() <<
"6th-order numerical diffusion turned on with coefficient = "
339 for (
int lev = 0; lev <= max_level; lev++) {
344 for (
int lev = 0; lev <= max_level; lev++) {
345 if (
turbChoice[lev].pbl_ysu_use_consistent_coriolis) {
349 amrex::Print() <<
"YSU PBL using ERF coriolis frequency: " <<
turbChoice[lev].pbl_ysu_coriolis_freq << std::endl;
352 amrex::Abort(
"YSU cannot use ERF coriolis frequency if not using coriolis");
366 static std::string windfarm_loc_type_string =
"None";
394 for (
int lev = 0; lev <= max_level; lev++) {
396 amrex::Warning(
"\n*** WARNING: Moisture may not yet be compatible with PBL models, \n proceed with caution ***");
403 amrex::Abort(
"buoyancy_type must be 1, 2, 3 or 4");
407 amrex::Error(
"Can't turn off lagged_delta_rt when terrain not moving");
414 amrex::Abort(
"To use simplified actuator disks, you need to provide a variable"
415 " erf.sampling_distance_by_D in the inputs which specifies the upstream"
416 " distance as a factor of the turbine diameter at which the incoming free stream"
417 " velocity will be computed at.");
421 amrex::Abort(
"To use simplified actuator disks, you need to provide a variable"
422 " erf.turb_disk_angle_from_x in the inputs which is the angle of the face of the"
423 " turbine disk from the x-axis. A turbine facing an oncoming flow in the x-direction"
424 " will have turb_disk_angle value of 90 deg.");
427 amrex::Abort(
"You are using windfarms with latitude-logitude option to position the turbines."
428 " For this you should provide the inputs erf.windfarm_x_shift and"
429 " erf.windfarm_y_shift which are the values by which the bounding box of the"
430 " windfarm is shifted from the x and the y axes.");
436 amrex::Print() <<
"SOLVER CHOICE: " << std::endl;
438 for (
int lev = 0; lev <= max_level; lev++) {
439 amrex::Print() <<
"anelastic at level : " << lev <<
" is " <<
anelastic[lev] << std::endl;
441 amrex::Print() <<
"No substepping at level " << lev << std::endl;
443 amrex::Print() <<
"Explicit substepping at level " << lev << std::endl;
445 amrex::Print() <<
"Implicit substepping at level " << lev << std::endl;
448 amrex::Print() <<
"use_coriolis : " <<
use_coriolis << std::endl;
449 amrex::Print() <<
"use_gravity : " <<
use_gravity << std::endl;
451 amrex::Print() <<
"Terrain Type: " << std::endl;
453 amrex::Print() <<
" Static" << std::endl;
455 amrex::Print() <<
" Moving" << std::endl;
457 amrex::Print() <<
" None" << std::endl;
460 amrex::Print() <<
" Mesh Type: " << std::endl;
462 amrex::Print() <<
" ConstantDz" << std::endl;
463 }
else if (
mesh_type == MeshType::StretchedDz) {
464 amrex::Print() <<
" StretchedDz" << std::endl;
465 }
else if (
mesh_type == MeshType::VariableDz) {
466 amrex::Print() <<
" VariableDz" << std::endl;
468 amrex::Abort(
"No mesh_type set!");
471 amrex::Print() <<
"ABL Driver Type: " << std::endl;
473 amrex::Print() <<
" None" << std::endl;
475 amrex::Print() <<
" Pressure Gradient "
479 amrex::Print() <<
" Geostrophic Wind "
485 amrex::Print() <<
"Coupling Type: " << std::endl;
487 amrex::Print() <<
" Two-way" << std::endl;
489 amrex::Print() <<
" One-way" << std::endl;
493 amrex::Print() <<
"Buoyancy_type : " <<
buoyancy_type << std::endl;
499 for (
int lev = 0; lev <= max_level; lev++) {
509 amrex::Real rot_time_period = 86400.0;
510 pp.query(
"rotational_time_period", rot_time_period);
514 amrex::Real latitude = 90.0;
515 pp.query(
"latitude", latitude);
520 latitude *= (
PI/180.);
521 sinphi = std::sin(latitude);
523 cosphi = std::cos(latitude);
531 amrex::Vector<amrex::Real> abl_geo_wind(3);
532 pp.queryarr(
"abl_geo_wind",abl_geo_wind);
541 amrex::Print() <<
"NOTE: abl_geo_wind_table provided, ignoring input abl_geo_wind" << std::endl;
547 amrex::Vector<int>& vec_to_fill,
int default_int)
549 amrex::ParmParse
pp(
"erf");
550 int nvals =
pp.countval(string_to_read);
551 AMREX_ALWAYS_ASSERT(nvals == 0 || nvals == 1 || nvals >= max_level+1);
552 amrex::Vector<int> temp; temp.resize(nvals);
553 pp.queryarr(string_to_read,temp);
555 for (
int i = 0; i <= max_level; ++i) vec_to_fill.push_back(default_int);
556 }
else if (nvals == 1) {
557 for (
int i = 0; i <= max_level; ++i) vec_to_fill.push_back(temp[0]);
559 for (
int i = 0; i <= max_level; ++i) vec_to_fill.push_back(temp[i]);
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
AMREX_ENUM(ABLDriverType, None, PressureGradient, GeostrophicWind)
Rayleigh
Definition: ERF_DataStruct.H:69
@ ubar
Definition: ERF_DataStruct.H:70
@ wbar
Definition: ERF_DataStruct.H:70
@ nvars
Definition: ERF_DataStruct.H:70
@ vbar
Definition: ERF_DataStruct.H:70
@ thetabar
Definition: ERF_DataStruct.H:70
Sponge
Definition: ERF_DataStruct.H:74
@ nvars_sponge
Definition: ERF_DataStruct.H:75
@ vbar_sponge
Definition: ERF_DataStruct.H:75
@ ubar_sponge
Definition: ERF_DataStruct.H:75
Coord
Definition: ERF_DataStruct.H:64
#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
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real pp(amrex::Real y)
Definition: ERF_MicrophysicsUtils.H:219
Definition: ERF_Fitch.H:9
Definition: ERF_GeneralAD.H:8
Definition: ERF_Kessler.H:46
Definition: ERF_NOAH.H:20
Definition: ERF_SatAdj.H:41
Definition: ERF_SimpleAD.H:8
Definition: ERF_AdvStruct.H:19
void display()
Definition: ERF_AdvStruct.H:190
void init_params()
Definition: ERF_AdvStruct.H:21
Definition: ERF_DiffStruct.H:19
void init_params()
Definition: ERF_DiffStruct.H:21
void display()
Definition: ERF_DiffStruct.H:64
Definition: ERF_DataStruct.H:82
bool rayleigh_damp_T
Definition: ERF_DataStruct.H:608
amrex::Real dz0
Definition: ERF_DataStruct.H:624
bool use_lagged_delta_rt
Definition: ERF_DataStruct.H:614
amrex::Real coriolis_factor
Definition: ERF_DataStruct.H:629
bool use_explicit_most
Definition: ERF_DataStruct.H:645
static MeshType mesh_type
Definition: ERF_DataStruct.H:570
amrex::Real windfarm_x_shift
Definition: ERF_DataStruct.H:693
bool rayleigh_damp_V
Definition: ERF_DataStruct.H:606
int RhoQr_comp
Definition: ERF_DataStruct.H:687
amrex::Real poisson_reltol
Definition: ERF_DataStruct.H:594
amrex::Real rayleigh_zdamp
Definition: ERF_DataStruct.H:610
amrex::Real rdOcp
Definition: ERF_DataStruct.H:619
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:546
std::string windfarm_spec_table
Definition: ERF_DataStruct.H:689
bool use_mono_adv
Definition: ERF_DataStruct.H:661
DiffChoice diffChoice
Definition: ERF_DataStruct.H:579
static void set_flat_terrain_flag()
Definition: ERF_DataStruct.H:573
bool use_gravity
Definition: ERF_DataStruct.H:601
void build_coriolis_forcings()
Definition: ERF_DataStruct.H:504
int ncorr
Definition: ERF_DataStruct.H:592
int force_stage1_single_substep
Definition: ERF_DataStruct.H:586
std::string windfarm_spec_table_extra
Definition: ERF_DataStruct.H:689
amrex::Real cosphi
Definition: ERF_DataStruct.H:630
LandSurfaceType lsm_type
Definition: ERF_DataStruct.H:667
amrex::Real c_p
Definition: ERF_DataStruct.H:618
std::string windfarm_loc_table
Definition: ERF_DataStruct.H:689
amrex::Real gravity
Definition: ERF_DataStruct.H:617
std::string pp_prefix
Definition: ERF_DataStruct.H:584
void check_params(int max_level)
Definition: ERF_DataStruct.H:391
bool custom_rhotheta_forcing
Definition: ERF_DataStruct.H:634
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > abl_geo_forcing
Definition: ERF_DataStruct.H:671
WindFarmLocType windfarm_loc_type
Definition: ERF_DataStruct.H:666
bool custom_w_subsidence
Definition: ERF_DataStruct.H:636
bool nudging_from_input_sounding
Definition: ERF_DataStruct.H:642
bool rayleigh_damp_U
Definition: ERF_DataStruct.H:605
int RhoQc_comp
Definition: ERF_DataStruct.H:681
bool custom_geostrophic_profile
Definition: ERF_DataStruct.H:637
amrex::Real rayleigh_ztop
Definition: ERF_DataStruct.H:611
amrex::Real grid_stretching_ratio
Definition: ERF_DataStruct.H:622
amrex::Real sinphi
Definition: ERF_DataStruct.H:631
bool have_geo_wind_profile
Definition: ERF_DataStruct.H:673
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > abl_pressure_grad
Definition: ERF_DataStruct.H:670
bool do_precip
Definition: ERF_DataStruct.H:678
amrex::Vector< SubsteppingType > substepping_type
Definition: ERF_DataStruct.H:588
bool coriolis_3d
Definition: ERF_DataStruct.H:603
void init_params(int max_level)
Definition: ERF_DataStruct.H:84
bool use_num_diff
Definition: ERF_DataStruct.H:657
amrex::Real sampling_distance_by_D
Definition: ERF_DataStruct.H:691
int RhoQv_comp
Definition: ERF_DataStruct.H:680
bool test_mapfactor
Definition: ERF_DataStruct.H:596
void display(int max_level)
Definition: ERF_DataStruct.H:434
bool use_coriolis
Definition: ERF_DataStruct.H:602
bool custom_moisture_forcing
Definition: ERF_DataStruct.H:635
amrex::Real num_diff_coeff
Definition: ERF_DataStruct.H:658
std::string windfarm_blade_table
Definition: ERF_DataStruct.H:690
amrex::Real zsurf
Definition: ERF_DataStruct.H:623
bool do_terrain_drag
Definition: ERF_DataStruct.H:700
amrex::Vector< TurbChoice > turbChoice
Definition: ERF_DataStruct.H:581
bool project_initial_velocity
Definition: ERF_DataStruct.H:626
amrex::Vector< int > anelastic
Definition: ERF_DataStruct.H:589
int constant_density
Definition: ERF_DataStruct.H:591
AdvChoice advChoice
Definition: ERF_DataStruct.H:578
bool use_moist_background
Definition: ERF_DataStruct.H:679
MoistureType moisture_type
Definition: ERF_DataStruct.H:664
bool custom_forcing_prim_vars
Definition: ERF_DataStruct.H:638
std::string abl_geo_wind_table
Definition: ERF_DataStruct.H:672
static TerrainType terrain_type
Definition: ERF_DataStruct.H:567
ABLDriverType abl_driver_type
Definition: ERF_DataStruct.H:669
bool rayleigh_damp_W
Definition: ERF_DataStruct.H:607
PerturbationType pert_type
Definition: ERF_DataStruct.H:654
SpongeChoice spongeChoice
Definition: ERF_DataStruct.H:580
WindFarmType windfarm_type
Definition: ERF_DataStruct.H:665
int buoyancy_type
Definition: ERF_DataStruct.H:598
amrex::Real poisson_abstol
Definition: ERF_DataStruct.H:593
amrex::Real turb_disk_angle
Definition: ERF_DataStruct.H:692
amrex::Real windfarm_y_shift
Definition: ERF_DataStruct.H:694
static bool terrain_is_flat
Definition: ERF_DataStruct.H:564
bool do_forest_drag
Definition: ERF_DataStruct.H:697
bool time_avg_vel
Definition: ERF_DataStruct.H:651
bool do_cloud
Definition: ERF_DataStruct.H:677
bool use_rotate_most
Definition: ERF_DataStruct.H:648
amrex::Real rayleigh_dampcoef
Definition: ERF_DataStruct.H:609
CouplingType coupling_type
Definition: ERF_DataStruct.H:663
std::string windfarm_airfoil_tables
Definition: ERF_DataStruct.H:690
int ave_plane
Definition: ERF_DataStruct.H:675
Definition: ERF_SpongeStruct.H:15
void display()
Definition: ERF_SpongeStruct.H:45
void init_params()
Definition: ERF_SpongeStruct.H:17