1 #ifndef ERF_SHOC_TYPES_H_
2 #define ERF_SHOC_TYPES_H_
6 #include <AMReX_FArrayBox.H>
7 #include <AMReX_Geometry.H>
8 #include <AMReX_GpuQualifiers.H>
9 #include <AMReX_ParmParse.H>
10 #include <AMReX_Vector.H>
127 [] (
unsigned char c) { return static_cast<char>(std::tolower(c)); });
134 std::string& error_message)
137 if (
value ==
"state_update") {
141 if (
value ==
"host_diffusion") {
145 if (
value ==
"tendencies") {
147 "erf.shoc.transport_mode = tendencies has been removed for native SHOC. Use erf.shoc.transport_mode = state_update. Native SHOC now applies its coupled column increment before the dycore to avoid splitting theta and momentum from moisture.";
151 error_message =
"erf.shoc.transport_mode must be 'state_update' or 'host_diffusion'";
158 std::string& error_message)
161 if (
value ==
"none") {
165 if (
value ==
"state_update") {
169 if (
value ==
"host_diffusion") {
174 error_message =
"erf.shoc.momentum_transport must be 'none', 'state_update', or 'host_diffusion'";
180 std::string& error_message)
185 "erf.shoc.transport_mode = host_diffusion requires erf.shoc.momentum_transport = host_diffusion";
285 amrex::ParmParse
pp(
"erf.shoc");
323 if (
pp.query(
"transport_mode", transport_mode)) {
324 std::string error_message;
326 amrex::Abort(error_message.c_str());
331 if (
pp.query(
"momentum_transport", momentum_transport)) {
332 std::string error_message;
336 amrex::Abort(error_message.c_str());
344 AMREX_ALWAYS_ASSERT_WITH_MESSAGE(opts.
lambda_low > 0.0,
"erf.shoc.lambda_low must be positive");
346 "erf.shoc.lambda_high must be >= lambda_low");
347 AMREX_ALWAYS_ASSERT_WITH_MESSAGE(opts.
length_fac > 0.0,
"erf.shoc.length_fac must be positive");
348 AMREX_ALWAYS_ASSERT_WITH_MESSAGE(opts.
coeff_kh >= 0.0,
"erf.shoc.coeff_kh must be non-negative");
349 AMREX_ALWAYS_ASSERT_WITH_MESSAGE(opts.
coeff_km >= 0.0,
"erf.shoc.coeff_km must be non-negative");
351 "erf.shoc.top_taper_depth must be non-negative");
354 "erf.shoc.top_taper_min_factor must be in [0, 1]");
356 "erf.shoc.debug_bad_column_max_reports must be positive");
358 "erf.shoc.debug_bad_column_theta_tend_threshold must be positive");
360 "erf.shoc.debug_bad_column_q_tend_threshold must be positive");
362 "erf.shoc.debug_bad_column_brunt_threshold must be positive");
364 "erf.shoc.debug_bad_column_min_dz must be positive");
366 "erf.shoc.debug_bad_column_scalar_moment_threshold must be positive");
367 std::string error_message;
369 error_message.c_str());
372 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
376 return comp >= 0 && comp < ncomp;
379 template <
typename T>
380 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
384 return amrex::max(lo, amrex::min(
value, hi));
amrex::Real value
Definition: ERF_HurricaneDiagnostics.H:20
Real T
Definition: ERF_InitCustomPert_Bubble.H:105
amrex::Real Real
Definition: ERF_ShocInterface.H:19
bool parse_shoc_momentum_transport_string(std::string value, ShocMomentumTransport &mode, std::string &error_message)
Definition: ERF_ShocTypes.H:156
void validate_shoc_runtime_options(const ShocRuntimeOptions &opts)
Definition: ERF_ShocTypes.H:342
bool parse_shoc_transport_mode_string(std::string value, ShocTransportMode &mode, std::string &error_message)
Definition: ERF_ShocTypes.H:132
const char * shoc_transport_mode_name(ShocTransportMode mode)
Definition: ERF_ShocTypes.H:30
ShocMomentumTransport
Definition: ERF_ShocTypes.H:23
bool shoc_disables_momentum_transport(ShocMomentumTransport mode)
Definition: ERF_ShocTypes.H:75
bool validate_shoc_runtime_options_message(const ShocRuntimeOptions &opts, std::string &error_message)
Definition: ERF_ShocTypes.H:179
bool shoc_uses_momentum_state_update(ShocMomentumTransport mode)
Definition: ERF_ShocTypes.H:63
bool shoc_uses_host_diffusion(ShocTransportMode mode)
Definition: ERF_ShocTypes.H:57
std::string shoc_lower_copy(std::string value)
Definition: ERF_ShocTypes.H:124
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool shoc_valid_comp(int comp, int ncomp)
Definition: ERF_ShocTypes.H:374
const char * shoc_momentum_transport_name(ShocMomentumTransport mode)
Definition: ERF_ShocTypes.H:40
void read_shoc_runtime_options(ShocRuntimeOptions &opts)
Definition: ERF_ShocTypes.H:283
bool shoc_uses_state_update(ShocTransportMode mode)
Definition: ERF_ShocTypes.H:51
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T shoc_clamp(T value, T lo, T hi)
Definition: ERF_ShocTypes.H:382
bool shoc_uses_momentum_host_diffusion(ShocMomentumTransport mode)
Definition: ERF_ShocTypes.H:69
ShocTransportMode
Definition: ERF_ShocTypes.H:17
Definition: ERF_ShocTypes.H:204
amrex::FArrayBox theta_v
Definition: ERF_ShocTypes.H:216
amrex::FArrayBox theta
Definition: ERF_ShocTypes.H:214
amrex::FArrayBox qc_tend
Definition: ERF_ShocTypes.H:271
amrex::FArrayBox theta_base
Definition: ERF_ShocTypes.H:261
amrex::FArrayBox v_tend
Definition: ERF_ShocTypes.H:274
amrex::FArrayBox shoc_cond
Definition: ERF_ShocTypes.H:246
amrex::FArrayBox qi
Definition: ERF_ShocTypes.H:220
amrex::FArrayBox buoy_prod
Definition: ERF_ShocTypes.H:239
amrex::FArrayBox dz
Definition: ERF_ShocTypes.H:210
amrex::FArrayBox diss_tke
Definition: ERF_ShocTypes.H:240
amrex::FArrayBox w_sec
Definition: ERF_ShocTypes.H:258
amrex::FArrayBox tk
Definition: ERF_ShocTypes.H:236
amrex::FArrayBox w3
Definition: ERF_ShocTypes.H:257
amrex::FArrayBox vw_sec
Definition: ERF_ShocTypes.H:255
amrex::FArrayBox surf_lat_flux
Definition: ERF_ShocTypes.H:277
amrex::FArrayBox ustar
Definition: ERF_ShocTypes.H:232
amrex::FArrayBox shoc_evap
Definition: ERF_ShocTypes.H:247
amrex::FArrayBox shoc_mix
Definition: ERF_ShocTypes.H:233
amrex::FArrayBox v_base
Definition: ERF_ShocTypes.H:266
amrex::FArrayBox wthv_sec
Definition: ERF_ShocTypes.H:241
amrex::FArrayBox shear_prod
Definition: ERF_ShocTypes.H:238
amrex::FArrayBox rho
Definition: ERF_ShocTypes.H:213
amrex::FArrayBox tke_base_state
Definition: ERF_ShocTypes.H:267
amrex::FArrayBox wqw_sec
Definition: ERF_ShocTypes.H:253
amrex::FArrayBox qv_base
Definition: ERF_ShocTypes.H:262
amrex::FArrayBox shoc_ql
Definition: ERF_ShocTypes.H:243
amrex::FArrayBox uw_sec
Definition: ERF_ShocTypes.H:254
amrex::FArrayBox w
Definition: ERF_ShocTypes.H:226
amrex::FArrayBox host_dse
Definition: ERF_ShocTypes.H:227
amrex::FArrayBox pblh
Definition: ERF_ShocTypes.H:230
amrex::FArrayBox qc
Definition: ERF_ShocTypes.H:219
amrex::FArrayBox surf_tau_v
Definition: ERF_ShocTypes.H:279
amrex::FArrayBox isotropy
Definition: ERF_ShocTypes.H:235
amrex::FArrayBox tke
Definition: ERF_ShocTypes.H:223
amrex::FArrayBox p_int
Definition: ERF_ShocTypes.H:212
amrex::FArrayBox qw_sec
Definition: ERF_ShocTypes.H:250
amrex::FArrayBox qi_base
Definition: ERF_ShocTypes.H:264
amrex::FArrayBox tkh
Definition: ERF_ShocTypes.H:237
amrex::FArrayBox exner
Definition: ERF_ShocTypes.H:215
amrex::FArrayBox u_base
Definition: ERF_ShocTypes.H:265
amrex::FArrayBox tke_tend
Definition: ERF_ShocTypes.H:275
amrex::FArrayBox qi_tend
Definition: ERF_ShocTypes.H:272
amrex::FArrayBox qc_base
Definition: ERF_ShocTypes.H:263
amrex::FArrayBox u_tend
Definition: ERF_ShocTypes.H:273
ShocColumnLayout layout
Definition: ERF_ShocTypes.H:205
amrex::FArrayBox zi
Definition: ERF_ShocTypes.H:209
amrex::FArrayBox tabs
Definition: ERF_ShocTypes.H:222
amrex::FArrayBox surf_sens_flux
Definition: ERF_ShocTypes.H:276
amrex::FArrayBox qw
Definition: ERF_ShocTypes.H:221
amrex::FArrayBox v
Definition: ERF_ShocTypes.H:225
amrex::FArrayBox zt
Definition: ERF_ShocTypes.H:208
amrex::FArrayBox qv
Definition: ERF_ShocTypes.H:218
amrex::FArrayBox p_mid
Definition: ERF_ShocTypes.H:211
amrex::FArrayBox wtke_sec
Definition: ERF_ShocTypes.H:256
amrex::FArrayBox u
Definition: ERF_ShocTypes.H:224
amrex::FArrayBox theta_tend
Definition: ERF_ShocTypes.H:269
amrex::FArrayBox obklen
Definition: ERF_ShocTypes.H:231
amrex::FArrayBox wqls_sec
Definition: ERF_ShocTypes.H:245
amrex::FArrayBox surf_tau_u
Definition: ERF_ShocTypes.H:278
amrex::FArrayBox qv_tend
Definition: ERF_ShocTypes.H:270
amrex::FArrayBox wthl_sec
Definition: ERF_ShocTypes.H:252
amrex::FArrayBox thl_sec
Definition: ERF_ShocTypes.H:249
amrex::FArrayBox shoc_ql2
Definition: ERF_ShocTypes.H:244
amrex::FArrayBox thetal_base
Definition: ERF_ShocTypes.H:260
amrex::FArrayBox qwthl_sec
Definition: ERF_ShocTypes.H:251
amrex::FArrayBox brunt
Definition: ERF_ShocTypes.H:234
amrex::FArrayBox shoc_cldfrac
Definition: ERF_ShocTypes.H:242
amrex::FArrayBox thetal
Definition: ERF_ShocTypes.H:217
Definition: ERF_ShocTypes.H:192
int imin
Definition: ERF_ShocTypes.H:197
int nlev
Definition: ERF_ShocTypes.H:196
int kmax
Definition: ERF_ShocTypes.H:200
int ncell
Definition: ERF_ShocTypes.H:195
int jmin
Definition: ERF_ShocTypes.H:198
int ny
Definition: ERF_ShocTypes.H:194
int nx
Definition: ERF_ShocTypes.H:193
int kmin
Definition: ERF_ShocTypes.H:199
Definition: ERF_ShocTypes.H:81
int debug_bad_column_max_reports
Definition: ERF_ShocTypes.H:111
ShocTransportMode transport_mode
Definition: ERF_ShocTypes.H:107
bool debug_disable_moisture_state_update
Definition: ERF_ShocTypes.H:119
bool shoc_1p5tke
Definition: ERF_ShocTypes.H:99
amrex::Real debug_bad_column_q_tend_threshold
Definition: ERF_ShocTypes.H:113
amrex::Real coeff_kh
Definition: ERF_ShocTypes.H:94
amrex::Real top_taper_depth
Definition: ERF_ShocTypes.H:96
amrex::Real debug_bad_column_scalar_moment_threshold
Definition: ERF_ShocTypes.H:116
amrex::Real lambda_high
Definition: ERF_ShocTypes.H:83
amrex::Real w2tune
Definition: ERF_ShocTypes.H:90
amrex::Real debug_bad_column_min_dz
Definition: ERF_ShocTypes.H:115
amrex::Real qwthl2tune
Definition: ERF_ShocTypes.H:89
bool debug_disable_pdf_cloud_increment
Definition: ERF_ShocTypes.H:117
amrex::Real c_diag_3rd_mom
Definition: ERF_ShocTypes.H:93
ShocMomentumTransport momentum_transport
Definition: ERF_ShocTypes.H:108
bool column_conservation_check
Definition: ERF_ShocTypes.H:103
amrex::Real lambda_thresh
Definition: ERF_ShocTypes.H:85
bool extra_shoc_diags
Definition: ERF_ShocTypes.H:100
amrex::Real coeff_km
Definition: ERF_ShocTypes.H:95
bool debug_disable_theta_state_update
Definition: ERF_ShocTypes.H:118
amrex::Real debug_bad_column_theta_tend_threshold
Definition: ERF_ShocTypes.H:112
amrex::Real lambda_slope
Definition: ERF_ShocTypes.H:84
amrex::Real lambda_low
Definition: ERF_ShocTypes.H:82
bool debug_bad_column
Definition: ERF_ShocTypes.H:109
bool signed_tke_production
Definition: ERF_ShocTypes.H:106
amrex::Real debug_bad_column_brunt_threshold
Definition: ERF_ShocTypes.H:114
bool debug_disable_tke_state_update
Definition: ERF_ShocTypes.H:120
bool apply_tms
Definition: ERF_ShocTypes.H:101
bool debug_bad_column_abort
Definition: ERF_ShocTypes.H:110
bool allow_tendency_microphysics_overlap
Definition: ERF_ShocTypes.H:105
bool check_flux_state
Definition: ERF_ShocTypes.H:102
amrex::Real length_fac
Definition: ERF_ShocTypes.H:92
amrex::Real top_taper_min_factor
Definition: ERF_ShocTypes.H:97
amrex::Real thl2tune
Definition: ERF_ShocTypes.H:87
amrex::Real qw2tune
Definition: ERF_ShocTypes.H:88
bool debug_summary
Definition: ERF_ShocTypes.H:104