|
ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
|
The moisture data carried by the active microphysics scheme. More...
#include <ERF_DataStruct.H>

Classes | |
| struct | CompList |
| An ordered list of conserved-state components forming an aggregate moisture output variable (qt, qn, qp, moist_density). More... | |
| struct | VarAvailability |
| Whether this map decides a variable's availability, and if so whether the variable is available. More... | |
Public Member Functions | |
| MoistureComponentIndices (int qv_comp, int qc_comp, int qi_comp=absent, int qr_comp=absent, int qs_comp=absent, int qg_comp=absent, int nc_comp=absent, int ni_comp=absent, int nr_comp=absent, int ns_comp=absent, int ng_comp=absent, int nn_comp=absent) | |
| Construct the conserved-state component map. More... | |
| MoistureComponentIndices ()=default | |
| Construct an empty map, i.e. a dry run. More... | |
| CompList | total_water_comps () const |
| Components summed for total water, "qt": every mass mixing ratio. More... | |
| CompList | nonprecipitating_comps () const |
| Components summed for non-precipitating water, "qn": vapor plus the suspended condensate. Also the moist part of "moist_density". More... | |
| CompList | precipitating_comps () const |
| Components summed for precipitating water, "qp": the falling species. More... | |
| bool | has_comp (int comp) const |
| Test whether a conserved-state component holds one of the moisture variables this scheme carries. More... | |
| bool | has_reflectivity_species () const |
| Test whether the active scheme carries rain, snow and graupel in the RhoQ4/RhoQ5/RhoQ6 slots assumed by erf_derreflectivity and erf_dermaxreflectivity. More... | |
| bool | has_moisture () const |
| Test whether the active scheme carries any moisture at all. More... | |
| int | comp_for_var (const std::string &name) const |
The conserved-state component behind a single-species output name, or absent if the name is not a single species or the scheme does not carry it. More... | |
| int | qmoist_index_for_var (const std::string &name) const |
| The qmoist slot behind a moist diagnostic output name. More... | |
| VarAvailability | query_var (const std::string &name) const |
| Classify an output variable name against this index map. More... | |
| bool | has_derived_var (const std::string &name) const |
| Test whether the moist species behind a derived/plot variable name is carried by the active scheme. More... | |
Static Public Member Functions | |
| static MoistureComponentIndices | from_moisture_model (const MoistureType moisture_type) |
| Build the complete index map – conserved-state components and qmoist diagnostic slots – for a moisture model. More... | |
Public Attributes | |
| int | qv = absent |
| water vapor More... | |
| int | qc = absent |
| cloud liquid water More... | |
| int | qi = absent |
| cloud ice More... | |
| int | qr = absent |
| rain More... | |
| int | qs = absent |
| snow More... | |
| int | qg = absent |
| graupel More... | |
| int | nc = absent |
| cloud liquid water number More... | |
| int | ni = absent |
| cloud ice number More... | |
| int | nr = absent |
| rain number More... | |
| int | ns = absent |
| snow number More... | |
| int | ng = absent |
| graupel number More... | |
| int | nn = absent |
| CCN / total aerosol number. More... | |
| int | rain_accum = absent |
| accumulated surface rain More... | |
| int | snow_accum = absent |
| accumulated surface snow More... | |
| int | graup_accum = absent |
| accumulated surface graupel More... | |
| int | rel_hum = absent |
| relative humidity More... | |
| int | cond_rate = absent |
| condensation rate More... | |
Static Public Attributes | |
| static constexpr int | absent = -1 |
| not carried by the active scheme More... | |
| static constexpr int | computed_from_state = -2 |
The moisture data carried by the active microphysics scheme.
This struct is the single source of truth for the question "which moisture quantities does this run actually have?". Everything downstream of the microphysics – source terms, turbulence closures, and every output path (3D plotfiles, 2D plotfiles, subvolumes) – answers that question by querying this struct instead of enumerating MoistureType values, so a newly added scheme only has to declare its layout once, in from_moisture_model() below.
Two kinds of index live here:
In both cases the value is absent when the active scheme does not carry the quantity, so index >= 0 is the criterion for "this exists and is meaningful
to write". That is deliberately not the same test as "the storage is
allocated": several schemes allocate a wider state than they integrate (the Morrison class always allocates eleven moist components, so Morrison_NoIce owns ice slots it never fills), and writing those slots to a plotfile would publish untouched memory as if it were data.
|
inline |
Construct the conserved-state component map.
Prefer from_moisture_model() for production code: it fills in the qmoist diagnostic slots as well. This constructor exists for the callers – unit tests and kernels exercised in isolation – that only need the state map.
| qv_comp | Water vapor component index. |
| qc_comp | Cloud liquid water component index. |
| qi_comp | Cloud ice component index. |
| qr_comp | Rain component index. |
| qs_comp | Snow component index. |
| qg_comp | Graupel component index. |
| nc_comp | Cloud liquid water number concentration component index. |
| ni_comp | Cloud ice number concentration component index. |
| nr_comp | Rain number concentration component index. |
| ns_comp | Snow number concentration component index. |
| ng_comp | Graupel number concentration component index. |
| nn_comp | CCN / total aerosol number concentration component index. |
|
default |
Construct an empty map, i.e. a dry run.
|
inline |
The conserved-state component behind a single-species output name, or absent if the name is not a single species or the scheme does not carry it.
An output path can use this to copy a species without repeating the name-to-component mapping.
| name | Derived or plot variable name. |
Referenced by query_var(), and ERF::Write3DPlotFile().

|
inlinestatic |
Build the complete index map – conserved-state components and qmoist diagnostic slots – for a moisture model.
This is the one place a scheme declares what it carries. The conserved layout must match the component the scheme reads and writes in its Copy_State_to_Micro / Copy_Micro_to_State pair, and the qmoist slots must match the order the scheme installs in its MicVarMap. A slot that a scheme allocates but never fills is left absent on purpose: see the class comment for why allocation is not the criterion here.
| moisture_type | Active moisture/microphysics model. |
Referenced by SolverChoice::init_params().

|
inline |
Test whether a conserved-state component holds one of the moisture variables this scheme carries.
Use this rather than enumerating moisture models when deciding whether a "rhoQn" state component is meaningful for the active scheme.
| comp | Absolute component index into the conserved state array. |
Referenced by erf_plotfile::plot3d_fixed_variable_available().

|
inline |
Test whether the moist species behind a derived/plot variable name is carried by the active scheme.
Names this map does not govern return true, so this can be used directly as a filter over a mixed list of variable names. Use query_var() instead when the caller needs to distinguish "not a moisture variable" from "available".
| name | Derived or plot variable name. |
Referenced by ERF::setSubVolVariables().


|
inline |
Test whether the active scheme carries any moisture at all.
Every moist scheme allocates water vapor, so this is equivalent to testing moisture_type != MoistureType::None without needing the enum.
Referenced by query_var(), ERF::setSubVolVariables(), ERF::Write3DPlotFile(), and ERF::WriteSubvolume().

|
inline |
Test whether the active scheme carries rain, snow and graupel in the RhoQ4/RhoQ5/RhoQ6 slots assumed by erf_derreflectivity and erf_dermaxreflectivity.
Those kernels read the precipitating species by hardcoded component, so this checks the layout and not just the presence of the species.
|
inline |
Components summed for non-precipitating water, "qn": vapor plus the suspended condensate. Also the moist part of "moist_density".
Referenced by ERF::Write3DPlotFile().


|
inline |
Components summed for precipitating water, "qp": the falling species.
Referenced by query_var(), and ERF::Write3DPlotFile().


|
inline |
The qmoist slot behind a moist diagnostic output name.
Returns absent when the scheme does not provide the diagnostic, and computed_from_state when it does provide it but not through a qmoist array – in that case the caller must derive it from the conserved state.
| name | Derived or plot variable name. |
Referenced by query_var(), and ERF::Write3DPlotFile().

|
inline |
Classify an output variable name against this index map.
This is the one table pairing output names with the data behind them. It is driven off the scheme's index map rather than an enumerated list of moisture models, so it stays correct as schemes are added. Names with no moisture dependence come back not-governed, which lets a caller walk a mixed list of variable names and only defer to this map where it applies.
| name | Derived or plot variable name. |
Referenced by has_derived_var(), and erf_plotfile::plot3d_fixed_variable_available().


|
inline |
Components summed for total water, "qt": every mass mixing ratio.
Number concentrations are excluded – they are counts, not masses.
Referenced by query_var(), and ERF::Write3DPlotFile().


|
staticconstexpr |
not carried by the active scheme
Referenced by comp_for_var(), qmoist_index_for_var(), and query_var().
|
staticconstexpr |
carried, but derived at output time from the conserved state rather than read from a qmoist slot
Referenced by from_moisture_model(), and ERF::Write3DPlotFile().
| int MoistureComponentIndices::cond_rate = absent |
condensation rate
Referenced by from_moisture_model(), and qmoist_index_for_var().
| int MoistureComponentIndices::graup_accum = absent |
accumulated surface graupel
Referenced by from_moisture_model(), and qmoist_index_for_var().
| int MoistureComponentIndices::nc = absent |
cloud liquid water number
Referenced by comp_for_var(), from_moisture_model(), and has_comp().
| int MoistureComponentIndices::ng = absent |
graupel number
Referenced by comp_for_var(), from_moisture_model(), and has_comp().
| int MoistureComponentIndices::ni = absent |
cloud ice number
Referenced by comp_for_var(), from_moisture_model(), and has_comp().
| int MoistureComponentIndices::nn = absent |
CCN / total aerosol number.
Referenced by comp_for_var(), from_moisture_model(), and has_comp().
| int MoistureComponentIndices::nr = absent |
rain number
Referenced by comp_for_var(), from_moisture_model(), and has_comp().
| int MoistureComponentIndices::ns = absent |
snow number
Referenced by comp_for_var(), from_moisture_model(), and has_comp().
| int MoistureComponentIndices::qc = absent |
cloud liquid water
Referenced by ShocDriver::apply_state_update(), comp_for_var(), ComputeDiffusivityMRF(), ComputeDiffusivityYSUNew(), ComputeN2(), ComputeN2_EB(), ShocPreprocess::fill_columns(), from_moisture_model(), GetMoistureVars(), GetThetavl(), has_comp(), ERF::HasCloudWater(), SolverChoice::init_params(), nonprecipitating_comps(), ERF::PackAtmosphericStates(), query_var(), RadiationSimple::RadiationSimple(), total_water_comps(), wrf_bdy_var_for_moisture_component(), and ERF::Write3DPlotFile().
| int MoistureComponentIndices::qg = absent |
| int MoistureComponentIndices::qi = absent |
cloud ice
Referenced by ShocDriver::apply_state_update(), comp_for_var(), ComputeDiffusivityMRF(), ComputeDiffusivityYSUNew(), ShocPreprocess::fill_columns(), from_moisture_model(), GetMoistureVars(), GetThetavl(), has_comp(), ERF::HasCloudWater(), SolverChoice::init_params(), nonprecipitating_comps(), ERF::PackAtmosphericStates(), Radiation::Radiation(), RadiationSimple::RadiationSimple(), total_water_comps(), and wrf_bdy_var_for_moisture_component().
| int MoistureComponentIndices::qr = absent |
| int MoistureComponentIndices::qs = absent |
| int MoistureComponentIndices::qv = absent |
water vapor
Referenced by ShocDriver::apply_state_update(), comp_for_var(), ComputeDiffusivityMRF(), ComputeDiffusivityYSUNew(), ComputeN2(), ComputeN2_EB(), ShocPreprocess::fill_columns(), from_moisture_model(), GetMoistureVars(), GetThetavl(), has_comp(), has_moisture(), SolverChoice::init_params(), nonprecipitating_comps(), query_var(), RadiationSimple::RadiationSimple(), total_water_comps(), wrf_bdy_var_for_moisture_component(), and ERF::Write3DPlotFile().
| int MoistureComponentIndices::rain_accum = absent |
accumulated surface rain
Referenced by from_moisture_model(), and qmoist_index_for_var().
| int MoistureComponentIndices::rel_hum = absent |
relative humidity
Referenced by from_moisture_model(), qmoist_index_for_var(), and ERF::Write3DPlotFile().
| int MoistureComponentIndices::snow_accum = absent |
accumulated surface snow
Referenced by from_moisture_model(), and qmoist_index_for_var().