4 #ifndef ERF_PLOTFILE_SELECTION_H_
5 #define ERF_PLOTFILE_SELECTION_H_
10 #include <AMReX_Vector.H>
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;
125 inline amrex::Vector<std::string>
128 amrex::Vector<std::string> names = {
"density",
"rhotheta",
"rhoKE",
"rhoadv_0"};
129 #if (NSCALARS_DUST == 1)
130 names.push_back(
"rhoadv_dust");
131 #elif (NSCALARS_DUST > 1)
132 for (
int n = 0; n <
NSCALARS_DUST; ++n) { names.push_back(
"rhoadv_dust_" + std::to_string(n)); }
135 names.push_back(
"smoke");
137 names.insert(names.end(), {
138 "rhoQ1",
"rhoQ2",
"rhoQ3",
139 "rhoQ4",
"rhoQ5",
"rhoQ6",
140 "rhoQ7",
"rhoQ8",
"rhoQ9",
159 #if (NSCALARS_DUST == 1)
160 if (
name ==
"rhoadv_dust")
return RhoDust_comp;
161 #elif (NSCALARS_DUST > 1)
163 if (
name ==
"rhoadv_dust_" + std::to_string(n))
return RhoDust_comp + n;
167 if (
name ==
"smoke")
return RhoSmoke_comp;
170 if (
name.size() > 4 &&
name.compare(0, 4,
"rhoQ") == 0) {
174 for (std::size_t i = 4; i <
name.size(); ++i) {
175 const char c =
name[i];
176 if (c < '0' || c >
'9')
return -1;
177 q = 10 *
q + (c -
'0');
178 if (
q > 11)
return -1;
192 static constexpr
const char* names[] = {
193 "temp",
"theta",
"KE",
"scalar",
"soundspeed",
"reflectivity",
194 "max_reflectivity",
"mucape",
"vorticity_x",
"vorticity_y",
"vorticity_z",
195 "helicity",
"local_helicity",
"vort_stretching",
196 "magvel",
"divU",
"pres_hse",
"dens_hse",
197 "theta_hse",
"pi_hse",
"qv_hse",
"pressure",
"pert_pres",
"pert_dens",
"buoyancy",
198 "eq_pot_temp",
"VPD",
"dpdx",
"dpdy",
"dpdz",
"pres_hse_x",
"pres_hse_y",
199 "pres_hse_z",
"z_phys",
"detJ",
"h_xi",
"h_eta",
"h_zeta",
200 "mapfac",
"lat_m",
"lon_m",
"pblh",
201 "shoc_cldfrac",
"shoc_ql",
"shoc_ql2",
"shoc_cond",
"wqls_sec",
"wthv_sec",
202 "w_sec",
"thl_sec",
"qw_sec",
"qwthl_sec",
"wthl_sec",
"wqw_sec",
"w3",
203 "brunt",
"isotropy",
"shear_prod",
"buoy_prod",
"diss_tke",
204 "terrain_IB_mask",
"volfrac",
205 "ibseb_nfaces",
"ibseb_tskin",
"ibseb_sw_abs",
"ibseb_shadow",
206 "ibseb_lw_net",
"ibseb_f_sky",
"ibseb_H",
"ibseb_G",
207 "Tau11",
"Tau12",
"Tau13",
"Tau21",
"Tau22",
"Tau23",
208 "Tau31",
"Tau32",
"Tau33",
"hfx1",
"hfx2",
"hfx3",
209 "q1fx1",
"q1fx2",
"q1fx3",
"q2fx3"
212 for (
const char* candidate : names) {
213 if (
name == candidate)
return true;
230 static constexpr
const char* names[] = {
231 "u_mean",
"v_mean",
"w_mean",
"theta_mean",
232 "uu_mean",
"vv_mean",
"ww_mean",
"uw_mean",
"vw_mean",
"wtheta_mean",
233 "uu_fluct",
"vv_fluct",
"ww_fluct",
"uw_fluct",
"vw_fluct",
"wtheta_fluct",
"tke_resolved"
236 for (
const char* candidate : names) {
237 if (
name == candidate)
return true;
244 const amrex::Vector<std::string>& names)
246 return std::any_of(names.begin(), names.end(),
247 [] (
const std::string&
name) {
248 return plot3d_interval_mean_diagnostic(name);
265 if (cons_comp >= 0) {
276 if (moist_status.governed)
return moist_status.
available;
278 if (
name ==
"u_t_avg" ||
name ==
"v_t_avg" ||
name ==
"w_t_avg" ||
279 name ==
"umag_t_avg") {
285 if (
name ==
"qsrc_sw" ||
name ==
"qsrc_lw") {
292 if (
name ==
"Rt" ||
name ==
"cmu" ||
name ==
"cmu_prime" ||
name ==
"cap_ratio") {
307 for (
const auto&
name : names) {
308 if (
name ==
"pressure" ||
name ==
"pert_pres" ||
310 name ==
"eq_pot_temp" ||
name ==
"VPD" ||
name ==
"qsat" ||
311 name ==
"rel_humidity") {
318 inline amrex::Vector<std::string>
320 const amrex::Vector<std::string>& configured)
322 amrex::Vector<std::string> selected;
323 for (
const auto& count_name : requested) {
324 constexpr std::size_t suffix_size = 6;
325 if (count_name.size() > suffix_size &&
326 count_name.compare(count_name.size() - suffix_size, suffix_size,
"_count") == 0) {
327 const std::string container = count_name.substr(0, count_name.size() - suffix_size);
328 if (std::find(configured.cbegin(), configured.cend(), container) == configured.cend() ||
329 std::find(selected.cbegin(), selected.cend(), container) != selected.cend()) {
332 selected.push_back(container);
#define RhoScalar_comp
Definition: ERF_IndexDefines.H:65
#define Rho_comp
Definition: ERF_IndexDefines.H:61
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:62
#define NDRY
Definition: ERF_IndexDefines.H:15
#define NSCALARS
Definition: ERF_IndexDefines.H:34
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:78
#define NMOIST_max
Definition: ERF_IndexDefines.H:37
#define RhoKE_comp
Definition: ERF_IndexDefines.H:63
#define NSCALARS_DUST
Definition: ERF_IndexDefines.H:30
std::string name
Definition: ERF_Plotfile2DCatalog.cpp:139
@ None
Definition: ERF_LSM_Types.H:6
@ q
Definition: ERF_WSM6.H:296
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:153
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:228
bool plot3d_selection_has_interval_mean_diagnostic(const amrex::Vector< std::string > &names)
Definition: ERF_PlotfileSelection.H:243
bool plot3d_needs_pressure(const amrex::Vector< std::string > &names)
Whether any requested variable needs the pressure field computed.
Definition: ERF_PlotfileSelection.H:305
bool plot3d_fixed_variable_available(const std::string &name, const Plot3DSelectionCapabilities &caps)
Definition: ERF_PlotfileSelection.H:253
amrex::Vector< std::string > plot3d_conserved_state_names()
Names of the raw conserved-state variables, in component order.
Definition: ERF_PlotfileSelection.H:126
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:319
bool plot3d_fixed_unconditional_diagnostic(const std::string &name)
Diagnostics that every run can write, moist or dry.
Definition: ERF_PlotfileSelection.H:190
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:673
The moisture data carried by the active microphysics scheme.
Definition: ERF_DataStruct.H:279
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:594
VarAvailability query_var(const std::string &name) const
Classify an output variable name against this index map.
Definition: ERF_DataStruct.H:687
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