33 return p.id ==
"org.hydrocouple.openswmm.reactions" &&
34 c.reactions.configured && c.reactions.compiled && p.args.empty();
56 a(f.cell_length, f.min_cells, f.scalar_scheme, f.limiter, ard.configured, ard.dispersion_mode,
57 ard.dispersion_value, ard.conduit_disp_link, ard.conduit_disp_value, ard.bc_node, ard.bc_msx,
58 ard.bc_value, ard.bc_ts, ard.src_link, ard.src_msx, ard.src_value, ard.src_ts, ard.target_dx);
60 a(s.n_landuses, s.n_species, s.n_subcatch, s.resolved, s.bu_type, s.bu_c1, s.bu_c2, s.bu_c3,
61 s.bu_normalizer, s.bu_max_days, s.wo_type, s.wo_coeff, s.wo_expon, s.wo_sweep_effic,
62 s.wo_bmp_effic, s.init_loading, s.mcf, s.c_rain, s.snow_only, s.lid_rmvl);
65 a(sub.coverage, sub.curb_length, land.sweep_interval, land.sweep_removal, land.last_swept);
83 throw std::runtime_error(
"Unsupported reaction checkpoint version.");
91 a(l.armed, l.init, l.inflow, l.outflow, l.flooding, l.seepage, l.reacted, l.clamped,
94 a(s.buildup, s.washoff_conc, s.washoff_conc_old, s.ponded_qual, s.runon_qual_rate,
95 s.lid_drain_load, s.lid_drain_load_old, s.lid_drain_runon_load, s.led_init_buildup,
96 s.led_buildup, s.led_runoff_load, s.led_sweeping, s.led_bmp_removal, s.led_wet_deposition,
97 s.led_infil_loss, s.led_reacted, s.led_reaction_clamped, s.led_ponded_lost,
116 auto row = [](
const auto& v, std::size_t size,
bool optional =
false) {
117 if (v.size() != size && !(optional && v.empty()))
118 throw std::runtime_error(
"Reaction checkpoint inventory shape differs.");
119 for (
double value : v)
120 if (!std::isfinite(value))
121 throw std::runtime_error(
"Nonfinite reaction checkpoint inventory.");
130 throw std::runtime_error(
"Unexpected LID reaction checkpoint inventory.");
138 if (r.
lid.
node_mass.size() != std::size_t(st.count()) ||
140 throw std::runtime_error(
"LID reaction checkpoint node count differs.");
144 throw std::runtime_error(
"LID reaction checkpoint ownership differs.");
147 row(r.
lid.
mass, units * 4 * ns);
153 throw std::runtime_error(
"Negative LID checkpoint mass or water.");
158 for (
int i = 0; i < st.count(); ++i) {
160 r.
lid_enabled(st.lid[i].control) ? st.lid_state[i].cells.size() * ns : 0);
163 throw std::runtime_error(
"Negative LID retained checkpoint mass.");
165 if (!out.empty() && out.size() != nl * ns)
166 throw std::runtime_error(
"LID reaction checkpoint outlet shape differs.");
169 throw std::runtime_error(
"Infinite LID outlet concentration.");
175 throw std::runtime_error(
"Negative booster injection in checkpoint.");
177 for (
const auto* v : {&l.init, &l.inflow, &l.outflow, &l.flooding, &l.seepage, &l.reacted,
178 &l.clamped, &l.final_dry})
179 row(*v, l.armed ? ns : 0);
182 row(s.buildup, s.active() ? sc * std::size_t(s.n_landuses) : 0);
183 for (
const auto* v : {&s.washoff_conc, &s.washoff_conc_old, &s.ponded_qual, &s.runon_qual_rate,
184 &s.lid_drain_runon_load, &s.led_subcatch_load})
185 row(*v, s.active() ? sc : 0);
186 for (
const auto* v : {&s.lid_drain_load, &s.lid_drain_load_old})
187 row(*v, nn * ns,
true);
188 for (
const auto* v : {&s.led_init_buildup, &s.led_buildup, &s.led_runoff_load, &s.led_sweeping,
189 &s.led_bmp_removal, &s.led_wet_deposition, &s.led_infil_loss,
190 &s.led_reacted, &s.led_reaction_clamped, &s.led_ponded_lost})
191 row(*v, s.active() ? ns : 0);
Versioned archives of completed source-boundary state.
Canonical .rxn text from engine state (E-C3).
The central, reentrant simulation context for the new engine.
Definition CompletedSourceArchive.hpp:25
Definition OutfallExchange.hpp:17
void reactionState(CompletedSourceArchive &a, ReactionData &r)
Archive or restore persistent reaction inventories in schema version three.
Definition ReactionCheckpoint.hpp:79
void reactionModel(CompletedSourceArchive &a, const SimulationContext &c)
Append authored and resolved reaction/transport/surface configuration to a fingerprint.
Definition ReactionCheckpoint.hpp:49
void validateReactionState(const ReactionData &r, const SimulationContext &c)
Validate staged reaction state shapes, ownership and finite inventories.
Definition ReactionCheckpoint.hpp:113
bool checkpointReactionComponents(const SimulationContext &c)
Check that all authored process components fit reaction checkpoint restrictions.
Definition ReactionCheckpoint.hpp:30
std::string serializeReactionSystem(const SimulationContext &ctx)
Serialize configured native reaction metadata and scoped laws to INP section text.
Definition ReactionsWriter.cpp:127
StorageData storages
Definition NodeSubtypes.hpp:536
std::vector< std::vector< double > > node_mass
Definition ReactionData.hpp:138
std::vector< double > node_mobile_old
Definition ReactionData.hpp:139
std::vector< double > drain_conc
Definition ReactionData.hpp:142
std::vector< double > surface_conc
Definition ReactionData.hpp:141
std::vector< double > surface_export
Definition ReactionData.hpp:143
std::vector< double > surface_carry
Definition ReactionData.hpp:143
std::vector< std::vector< double > > node_outlet
Definition ReactionData.hpp:138
std::vector< double > mass
Definition ReactionData.hpp:141
std::vector< int > group_offsets
Definition ReactionData.hpp:140
std::vector< double > old_water
Definition ReactionData.hpp:141
std::vector< uint8_t > subcatchments
Definition ReactionData.hpp:144
Definition ReactionData.hpp:58
std::vector< double > msx_coupling_queue
Definition ReactionData.hpp:307
bool warned_react_failure
Definition ReactionData.hpp:281
MsxSurfaceData surface
Definition ReactionData.hpp:340
bool lid_enabled(int control) const
Test whether a LID control key occurs in the configured reaction list.
Definition ReactionData.hpp:152
std::vector< double > msx_ext_mass_in
Definition ReactionData.hpp:300
bool warned_negative_clamp
review A2: once-per-run note
Definition ReactionData.hpp:282
std::vector< double > msx_node_conc
Definition ReactionData.hpp:289
MsxRoutingLedger msx_ledger
Definition ReactionData.hpp:333
int n_species() const noexcept
Count authored reaction species.
Definition ReactionData.hpp:348
struct openswmm::ReactionData::LidState lid
std::vector< double > msx_link_conc
Definition ReactionData.hpp:290
bool configured
a reactions component applied
Definition ReactionData.hpp:342
std::vector< double > booster_mass
Definition ReactionData.hpp:192
std::vector< int > lid_controls
Definition ReactionData.hpp:135
Central, reentrant simulation context.
Definition SimulationContext.hpp:390
ReactionData reactions
Multispecies reaction system (EPANET-MSX conventions), parsed from the reactions component's config f...
Definition SimulationContext.hpp:624
int n_nodes() const noexcept
Number of nodes.
Definition SimulationContext.hpp:2357
NodeSubtypes node_subtypes
Relational side-tables for node subtypes (storage/outfall/divider).
Definition SimulationContext.hpp:574
ArdConfigData ard_config
Eulerian ARD transport component configuration, parsed from the model.ard config file registered via ...
Definition SimulationContext.hpp:632
std::vector< ProcessComponentSpec > process_component_specs
Process-component registrations parsed from [PROCESS_COMPONENTS].
Definition SimulationContext.hpp:955
int n_subcatches() const noexcept
Number of subcatchments.
Definition SimulationContext.hpp:2363
int n_links() const noexcept
Number of links.
Definition SimulationContext.hpp:2360
SubcatchData subcatches
All subcatchment state and properties.
Definition SimulationContext.hpp:594
LanduseData landuses
Definition SimulationContext.hpp:761
SimulationOptions options
Parsed simulation options (from [OPTIONS] section).
Definition SimulationContext.hpp:452
fv::FvOptions fv
Knobs for FLOW_ROUTING FV, grouped rather than spread across this struct (plan ยง4....
Definition SimulationOptions.hpp:413