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;
123 inline amrex::Vector<std::string>
126 amrex::Vector<std::string> names = {
"density",
"rhotheta",
"rhoKE",
"rhoadv_0"};
128 names.push_back(
"smoke");
130 names.insert(names.end(), {
131 "rhoQ1",
"rhoQ2",
"rhoQ3",
132 "rhoQ4",
"rhoQ5",
"rhoQ6",
133 "rhoQ7",
"rhoQ8",
"rhoQ9",
153 if (
name ==
"smoke")
return RhoSmoke_comp;
156 if (
name.size() > 4 &&
name.compare(0, 4,
"rhoQ") == 0) {
160 for (std::size_t i = 4; i <
name.size(); ++i) {
161 const char c =
name[i];
162 if (c < '0' || c >
'9')
return -1;
163 q = 10 *
q + (c -
'0');
164 if (
q > 11)
return -1;
178 static constexpr
const char* names[] = {
179 "temp",
"theta",
"KE",
"scalar",
"soundspeed",
"reflectivity",
180 "max_reflectivity",
"mucape",
"vorticity_x",
"vorticity_y",
"vorticity_z",
181 "helicity",
"local_helicity",
"vort_stretching",
182 "magvel",
"divU",
"pres_hse",
"dens_hse",
183 "theta_hse",
"pi_hse",
"qv_hse",
"pressure",
"pert_pres",
"pert_dens",
"buoyancy",
184 "eq_pot_temp",
"VPD",
"dpdx",
"dpdy",
"dpdz",
"pres_hse_x",
"pres_hse_y",
185 "pres_hse_z",
"z_phys",
"detJ",
"h_xi",
"h_eta",
"h_zeta",
186 "mapfac",
"lat_m",
"lon_m",
"pblh",
187 "shoc_cldfrac",
"shoc_ql",
"shoc_ql2",
"shoc_cond",
"wqls_sec",
"wthv_sec",
188 "w_sec",
"thl_sec",
"qw_sec",
"qwthl_sec",
"wthl_sec",
"wqw_sec",
"w3",
189 "brunt",
"isotropy",
"shear_prod",
"buoy_prod",
"diss_tke",
190 "terrain_IB_mask",
"volfrac",
191 "ibseb_nfaces",
"ibseb_tskin",
"ibseb_sw_abs",
"ibseb_shadow",
192 "ibseb_lw_net",
"ibseb_f_sky",
"ibseb_H",
"ibseb_G",
193 "Tau11",
"Tau12",
"Tau13",
"Tau21",
"Tau22",
"Tau23",
194 "Tau31",
"Tau32",
"Tau33",
"hfx1",
"hfx2",
"hfx3",
195 "q1fx1",
"q1fx2",
"q1fx3",
"q2fx3"
198 for (
const char* candidate : names) {
199 if (
name == candidate)
return true;
216 static constexpr
const char* names[] = {
217 "u_mean",
"v_mean",
"w_mean",
"theta_mean",
218 "uu_mean",
"vv_mean",
"ww_mean",
"uw_mean",
"vw_mean",
"wtheta_mean",
219 "uu_fluct",
"vv_fluct",
"ww_fluct",
"uw_fluct",
"vw_fluct",
"wtheta_fluct",
"tke_resolved"
222 for (
const char* candidate : names) {
223 if (
name == candidate)
return true;
230 const amrex::Vector<std::string>& names)
232 return std::any_of(names.begin(), names.end(),
233 [] (
const std::string&
name) {
234 return plot3d_interval_mean_diagnostic(name);
251 if (cons_comp >= 0) {
262 if (moist_status.governed)
return moist_status.
available;
264 if (
name ==
"u_t_avg" ||
name ==
"v_t_avg" ||
name ==
"w_t_avg" ||
265 name ==
"umag_t_avg") {
271 if (
name ==
"qsrc_sw" ||
name ==
"qsrc_lw") {
278 if (
name ==
"Rt" ||
name ==
"cmu" ||
name ==
"cmu_prime" ||
name ==
"cap_ratio") {
293 for (
const auto&
name : names) {
294 if (
name ==
"pressure" ||
name ==
"pert_pres" ||
296 name ==
"eq_pot_temp" ||
name ==
"VPD" ||
name ==
"qsat" ||
297 name ==
"rel_humidity") {
304 inline amrex::Vector<std::string>
306 const amrex::Vector<std::string>& configured)
308 amrex::Vector<std::string> selected;
309 for (
const auto& count_name : requested) {
310 constexpr std::size_t suffix_size = 6;
311 if (count_name.size() > suffix_size &&
312 count_name.compare(count_name.size() - suffix_size, suffix_size,
"_count") == 0) {
313 const std::string container = count_name.substr(0, count_name.size() - suffix_size);
314 if (std::find(configured.cbegin(), configured.cend(), container) == configured.cend() ||
315 std::find(selected.cbegin(), selected.cend(), container) != selected.cend()) {
318 selected.push_back(container);
#define RhoScalar_comp
Definition: ERF_IndexDefines.H:57
#define Rho_comp
Definition: ERF_IndexDefines.H:53
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:54
#define NDRY
Definition: ERF_IndexDefines.H:15
#define NSCALARS
Definition: ERF_IndexDefines.H:26
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:66
#define NMOIST_max
Definition: ERF_IndexDefines.H:29
#define RhoKE_comp
Definition: ERF_IndexDefines.H:55
std::string name
Definition: ERF_Plotfile2DCatalog.cpp:116
@ None
Definition: ERF_LSM_Types.H:6
@ q
Definition: ERF_WSM6.H:294
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:146
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:214
bool plot3d_selection_has_interval_mean_diagnostic(const amrex::Vector< std::string > &names)
Definition: ERF_PlotfileSelection.H:229
bool plot3d_needs_pressure(const amrex::Vector< std::string > &names)
Whether any requested variable needs the pressure field computed.
Definition: ERF_PlotfileSelection.H:291
bool plot3d_fixed_variable_available(const std::string &name, const Plot3DSelectionCapabilities &caps)
Definition: ERF_PlotfileSelection.H:239
amrex::Vector< std::string > plot3d_conserved_state_names()
Names of the raw conserved-state variables, in component order.
Definition: ERF_PlotfileSelection.H:124
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:305
bool plot3d_fixed_unconditional_diagnostic(const std::string &name)
Diagnostics that every run can write, moist or dry.
Definition: ERF_PlotfileSelection.H:176
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:645
The moisture data carried by the active microphysics scheme.
Definition: ERF_DataStruct.H:251
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:566
VarAvailability query_var(const std::string &name) const
Classify an output variable name against this index map.
Definition: ERF_DataStruct.H:659
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