4 #ifndef ERF_PLOTFILE_SELECTION_H_
5 #define ERF_PLOTFILE_SELECTION_H_
10 #include <AMReX_Vector.H>
24 return rad_model != RadiationType::None;
86 const int qstate_moist_size,
87 const int qstate_size)
96 bool interval_diagnostic_consumed,
97 bool compute_mean_vars,
98 const std::string& reset_mode)
100 return plotfiles_written > 0 && interval_diagnostic_consumed &&
101 compute_mean_vars && reset_mode ==
"plotfile";
111 if (q < 1 || q > 11)
return -1;
127 if (
name.size() > 4 &&
name.compare(0, 4,
"rhoQ") == 0) {
128 const std::string suffix =
name.substr(4);
129 if (!suffix.empty() && std::all_of(suffix.cbegin(), suffix.cend(),
130 [] (
const char c) { return c >=
'0' && c <=
'9'; })) {
131 const int q = std::stoi(suffix);
145 static constexpr
const char* names[] = {
146 "temp",
"theta",
"KE",
"scalar",
"soundspeed",
"reflectivity",
147 "max_reflectivity",
"mucape",
"vorticity_x",
"vorticity_y",
"vorticity_z",
148 "helicity",
"local_helicity",
"vort_stretching",
149 "magvel",
"divU",
"pres_hse",
"dens_hse",
150 "theta_hse",
"pi_hse",
"qv_hse",
"pressure",
"pert_pres",
"pert_dens",
"buoyancy",
151 "eq_pot_temp",
"VPD",
"dpdx",
"dpdy",
"dpdz",
"pres_hse_x",
"pres_hse_y",
152 "pres_hse_z",
"z_phys",
"detJ",
"h_xi",
"h_eta",
"h_zeta",
153 "mapfac",
"lat_m",
"lon_m",
"pblh",
154 "shoc_cldfrac",
"shoc_ql",
"shoc_ql2",
"shoc_cond",
"wqls_sec",
"wthv_sec",
155 "w_sec",
"thl_sec",
"qw_sec",
"qwthl_sec",
"wthl_sec",
"wqw_sec",
"w3",
156 "brunt",
"isotropy",
"shear_prod",
"buoy_prod",
"diss_tke",
157 "terrain_IB_mask",
"volfrac",
158 "ibseb_nfaces",
"ibseb_tskin",
"ibseb_sw_abs",
"ibseb_shadow",
159 "ibseb_lw_net",
"ibseb_f_sky",
"ibseb_H",
"ibseb_G",
160 "Tau11",
"Tau12",
"Tau13",
"Tau21",
"Tau22",
"Tau23",
161 "Tau31",
"Tau32",
"Tau33",
"hfx1",
"hfx2",
"hfx3",
162 "q1fx1",
"q1fx2",
"q1fx3",
"q2fx3"
165 for (
const char* candidate : names) {
166 if (
name == candidate)
return true;
169 #ifdef ERF_COMPUTE_ERROR
170 if (
name ==
"xvel_err" ||
name ==
"yvel_err" ||
name ==
"zvel_err" ||
171 name ==
"pp_err")
return true;
188 static constexpr
const char* names[] = {
189 "u_mean",
"v_mean",
"w_mean",
"theta_mean",
190 "uu_mean",
"vv_mean",
"ww_mean",
"uw_mean",
"vw_mean",
"wtheta_mean",
191 "uu_fluct",
"vv_fluct",
"ww_fluct",
"uw_fluct",
"vw_fluct",
"wtheta_fluct",
"tke_resolved"
194 for (
const char* candidate : names) {
195 if (
name == candidate)
return true;
202 const amrex::Vector<std::string>& names)
204 return std::any_of(names.begin(), names.end(),
205 [] (
const std::string&
name) {
206 return plot3d_interval_mean_diagnostic(name);
223 if (cons_comp >= 0) {
234 if (moist_status.governed)
return moist_status.
available;
236 if (
name ==
"u_t_avg" ||
name ==
"v_t_avg" ||
name ==
"w_t_avg" ||
237 name ==
"umag_t_avg") {
243 if (
name ==
"qsrc_sw" ||
name ==
"qsrc_lw") {
250 if (
name ==
"Rt" ||
name ==
"cmu" ||
name ==
"cmu_prime") {
265 for (
const auto&
name : names) {
266 if (
name ==
"pressure" ||
name ==
"pert_pres" ||
268 name ==
"eq_pot_temp" ||
name ==
"VPD" ||
name ==
"qsat" ||
269 name ==
"rel_humidity") {
272 #ifdef ERF_COMPUTE_ERROR
273 if (
name ==
"pp_err")
return true;
279 inline amrex::Vector<std::string>
281 const amrex::Vector<std::string>& configured)
283 amrex::Vector<std::string> selected;
284 for (
const auto& count_name : requested) {
285 constexpr std::size_t suffix_size = 6;
286 if (count_name.size() > suffix_size &&
287 count_name.compare(count_name.size() - suffix_size, suffix_size,
"_count") == 0) {
288 const std::string container = count_name.substr(0, count_name.size() - suffix_size);
289 if (std::find(configured.cbegin(), configured.cend(), container) == configured.cend() ||
290 std::find(selected.cbegin(), selected.cend(), container) != selected.cend()) {
293 selected.push_back(container);
#define RhoScalar_comp
Definition: ERF_IndexDefines.H:43
#define Rho_comp
Definition: ERF_IndexDefines.H:39
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:40
#define NDRY
Definition: ERF_IndexDefines.H:13
#define NSCALARS
Definition: ERF_IndexDefines.H:16
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:45
#define NMOIST_max
Definition: ERF_IndexDefines.H:19
#define RhoKE_comp
Definition: ERF_IndexDefines.H:41
std::string name
Definition: ERF_Plotfile2DCatalog.cpp:101
@ q
Definition: ERF_WSM6.H:273
Definition: ERF_PlotfileSelection.H:15
int plot3d_q_conserved_component_index(const int q)
Conserved-state component holding the q-th moist variable, or -1 if q is outside the fixed RhoQ1....
Definition: ERF_PlotfileSelection.H:109
int plot3d_conserved_component_index(const std::string &name)
Conserved-state component behind a raw state variable name ("density", "rhotheta",...
Definition: ERF_PlotfileSelection.H:120
void plot3d_set_state_capabilities(Plot3DSelectionCapabilities &caps, const MoistureComponentIndices &mi, const int qstate_moist_size, const int qstate_size)
Record the conserved-state layout of a run on its capabilities.
Definition: ERF_PlotfileSelection.H:84
bool plot3d_batch_resets_interval_means(int plotfiles_written, bool interval_diagnostic_consumed, bool compute_mean_vars, const std::string &reset_mode)
Definition: ERF_PlotfileSelection.H:95
bool plot3d_interval_mean_diagnostic(const std::string &name)
Whether a named 3D plot variable can be written by this run.
Definition: ERF_PlotfileSelection.H:186
bool plot3d_selection_has_interval_mean_diagnostic(const amrex::Vector< std::string > &names)
Definition: ERF_PlotfileSelection.H:201
bool plot3d_needs_pressure(const amrex::Vector< std::string > &names)
Whether any requested variable needs the pressure field computed.
Definition: ERF_PlotfileSelection.H:263
bool plot3d_fixed_variable_available(const std::string &name, const Plot3DSelectionCapabilities &caps)
Definition: ERF_PlotfileSelection.H:211
amrex::Vector< std::string > plot3d_selected_particle_count_names(const amrex::Vector< std::string > &requested, const amrex::Vector< std::string > &configured)
Definition: ERF_PlotfileSelection.H:280
bool plot3d_fixed_unconditional_diagnostic(const std::string &name)
Diagnostics that every run can write, moist or dry.
Definition: ERF_PlotfileSelection.H:143
bool radiation_heating_storage_available(RadiationType rad_model)
Whether the SW/LW heating-rate storage (qsrc_sw, qsrc_lw) exists: every erf.radiation_model other tha...
Definition: ERF_PlotfileSelection.H:22
bool available
the active scheme carries the data behind it
Definition: ERF_DataStruct.H:593
The moisture data carried by the active microphysics scheme.
Definition: ERF_DataStruct.H:223
bool has_comp(int comp) const
Test whether a conserved-state component holds one of the moisture variables this scheme carries.
Definition: ERF_DataStruct.H:515
VarAvailability query_var(const std::string &name) const
Classify an output variable name against this index map.
Definition: ERF_DataStruct.H:607
What the active run can supply to a 3D plotfile.
Definition: ERF_PlotfileSelection.H:39
bool eddy_diffusivity_storage
Definition: ERF_PlotfileSelection.H:64
MoistureComponentIndices moisture_indices
The active moisture scheme's component/diagnostic map.
Definition: ERF_PlotfileSelection.H:59
int moist_state_size
Definition: ERF_PlotfileSelection.H:56
bool dissipation_storage
Definition: ERF_PlotfileSelection.H:65
bool radiation_heating_storage
Definition: ERF_PlotfileSelection.H:63
bool wall_distance_storage
Definition: ERF_PlotfileSelection.H:66
bool time_average_storage
Definition: ERF_PlotfileSelection.H:61
int conserved_state_size
Definition: ERF_PlotfileSelection.H:44
bool interval_mean_storage
Definition: ERF_PlotfileSelection.H:62