OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::WaterAgeState Struct Reference

#include <WaterAgeData.hpp>

Collaboration diagram for openswmm::WaterAgeState:

Public Member Functions

void resize (int n_nodes, int n_links, int n_subcatch)
 Replace network and watershed age state while preserving shaped inflow prescriptions.
 
void clear ()
 Release all water-age arrays and reset seeding/hotstart flags.
 

Public Attributes

std::vector< double > node_age_vol_in
 [node], age·ft³/s
 
std::vector< double > node_age
 [node], seconds
 
std::vector< double > link_age
 [link], seconds
 
bool legacy_seeded = false
 
std::vector< double > subarea_age
 
std::vector< double > subarea_vol_prev
 
std::vector< double > subcatch_runoff_age
 
std::vector< double > subcatch_runon_age_vol_in
 
std::vector< double > node_lid_drain_age_vol_in
 
std::vector< double > subcatch_lid_drain_age_cfs
 
std::vector< double > subcatch_outfall_age_vol
 
std::vector< double > node_ext_inflow_age
 
bool hotstart_loaded = false
 

Member Function Documentation

◆ clear()

void openswmm::WaterAgeState::clear ( )
inline

Release all water-age arrays and reset seeding/hotstart flags.

Restores an empty default state, invalidating borrowed elements; source-age configuration is stored separately and unchanged.

◆ resize()

void openswmm::WaterAgeState::resize ( int n_nodes,
int n_links,
int n_subcatch )
inline

Replace network and watershed age state while preserving shaped inflow prescriptions.

Zeroes published ages (seconds), age-volume input rates, subarea volume history and pending LID/outfall accumulators. Preserves node_ext_inflow_age values if its length matches n_nodes, otherwise fills NaNs. Resets legacy_seeded/hotstart_loaded=false. Counts are unchecked and allocation failures may interrupt independent assignments; caller seeds initial ages afterward.

Parameters
[in]n_nodesNonnegative node count.
[in]n_linksNonnegative link count.
[in]n_subcatchNonnegative subcatchment count, explicitly required; subarea product must fit size_t.
Here is the caller graph for this function:

Member Data Documentation

◆ hotstart_loaded

bool openswmm::WaterAgeState::hotstart_loaded = false

A2a: set by HotStartManager::apply when a V3 file restored ages — both engines then seed from node_age/link_age instead of INITIAL_STATE (the ARD engine consumes and clears it at init).

◆ legacy_seeded

bool openswmm::WaterAgeState::legacy_seeded = false

A1b: the LEGACY mirror seeds INITIAL_STATE on its first step (the ARD engine seeds at its own init instead).

◆ link_age

std::vector<double> openswmm::WaterAgeState::link_age

[link], seconds

◆ node_age

std::vector<double> openswmm::WaterAgeState::node_age

[node], seconds

◆ node_age_vol_in

std::vector<double> openswmm::WaterAgeState::node_age_vol_in

[node], age·ft³/s

◆ node_ext_inflow_age

std::vector<double> openswmm::WaterAgeState::node_ext_inflow_age

Z1 (amendment D-Y4): [node] age (SECONDS) prescribed by an [INFLOWS] row naming __WATER_AGE__, refreshed by InflowSolver::computeAll each routing step; quiet_NaN where no row exists. The row is the more specific statement of the node's inflow age and WINS over the source table's EXTERNAL_INFLOW entry (global or node override) — the conflict is warned at init.

◆ node_lid_drain_age_vol_in

std::vector<double> openswmm::WaterAgeState::node_lid_drain_age_vol_in

A4: [node] age·ft³/s arriving through LID underdrains, accumulated in A6b beside the drain volume and consumed by the wet-weather loader. Separate from node_age_vol_in because the drain volume has its own per-runoff-step lifecycle (nodes.lid_drain_qual_vol), and the age has to be zeroed and consumed on exactly that cadence or it would be counted against a volume from a different step.

◆ subarea_age

std::vector<double> openswmm::WaterAgeState::subarea_age

[subcatch*3 + subarea] mean age of the water ponded on each subarea, SECONDS. Per-subarea rather than per-subcatchment (user decision, 2026-08-17): impervious water is systematically younger than pervious, and the three depths already exist separately.

◆ subarea_vol_prev

std::vector<double> openswmm::WaterAgeState::subarea_vol_prev

[subcatch*3 + subarea] the previous step's stored volume (ft³) — the mixing denominator. Kept here rather than recomputed because the RunoffSolver overwrites its depths in place.

◆ subcatch_lid_drain_age_cfs

std::vector<double> openswmm::WaterAgeState::subcatch_lid_drain_age_cfs

A4: [subcatch] age·ft³ (LID drain) and age·ft³ (outfall) waiting to be handed to subcatch_runon_age_vol_in when assembleRunon converts the matching volumes into run-on rates.

A3 filled subcatch_runon_age_vol_in from the subcatchment cascade ALONE, then divided it by runon_inflow — a denominator that also carries LID drain water and outfall return flow. A numerator missing terms the denominator has does not merely lose precision: it produced a run-on age BELOW every source age in the model (3.834 h of arriving water under a 4 h rain, with nothing younger than 4 h anywhere). The flow path knew about all three contributors; the age path knew about one.

◆ subcatch_outfall_age_vol

std::vector<double> openswmm::WaterAgeState::subcatch_outfall_age_vol

◆ subcatch_runoff_age

std::vector<double> openswmm::WaterAgeState::subcatch_runoff_age

[subcatch] age of the water LEAVING as runoff, SECONDS — the volume-weighted mean of the contributing subareas. This is what the wet-weather loader delivers to the outlet node, and what run-on carries to a downstream subcatchment.

◆ subcatch_runon_age_vol_in

std::vector<double> openswmm::WaterAgeState::subcatch_runon_age_vol_in

[subcatch] age·ft³/s arriving as RUN-ON from upstream subcatchments, the watershed analogue of node_age_vol_in. Without this, run-on water arrived with no age at all — the flow path adds q_runon while the quality path never did.


The documentation for this struct was generated from the following file: