![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
#include <SimulationContext.hpp>
Public Member Functions | |
| void | resize_quality (int n_pollutants) |
| Resize and zero all pollutant continuity arrays. | |
| void | reset () |
| Reset continuity totals while retaining pollutant array sizes and initial buildup. | |
| double | runoff_error () const |
| Runoff continuity error (fraction). | |
| double | routing_error () const |
| Routing continuity error (fraction). | |
| double | gw_error () const |
| Groundwater continuity error (fraction). Gap #72. | |
Public Attributes | |
| double | runoff_rainfall = 0.0 |
| Total rainfall volume (ft3) | |
| double | runoff_runon = 0.0 |
| Outfall-routed runon volume (ft3), legacy RUNOFF_RUNON. | |
| double | runoff_evap = 0.0 |
| Total evaporation volume (ft3) | |
| double | runoff_infil = 0.0 |
| Total infiltration volume (ft3) | |
| double | runoff_runoff = 0.0 |
| Total surface runoff volume (ft3) | |
| double | runoff_lid_drain |
| LID drain-to-node outflow (ft3), legacy RUNOFF_DRAINS / VlidDrain. | |
| double | runoff_snowremov = 0.0 |
| Total snow removal volume (ft3) | |
| double | runoff_init_store = 0.0 |
| Initial surface storage (ft3) | |
| double | runoff_final_store = 0.0 |
| double | runoff_init_snow = 0.0 |
| double | runoff_final_snow = 0.0 |
| double | rdii_rainfall = 0.0 |
| double | rdii_produced = 0.0 |
| double | routing_dry_weather = 0.0 |
| double | routing_wet_weather = 0.0 |
| double | routing_gw_inflow = 0.0 |
| double | routing_link_gw_inflow = 0.0 |
| double | routing_rdii = 0.0 |
| double | routing_external = 0.0 |
| double | routing_flooding = 0.0 |
| double | routing_coupling_out = 0.0 |
| double | routing_outflow = 0.0 |
| double | routing_evap_loss = 0.0 |
| double | routing_seep_loss = 0.0 |
| double | routing_init_storage = 0.0 |
| double | routing_final_storage = 0.0 |
| std::array< double, 11 > | routing_report {} |
| double | routing_forcing_inflow = 0.0 |
| Cumulative user-forced lateral inflow (ft3) | |
| std::vector< double > | routing_forcing_qual_inflow |
| Per-pollutant cumulative user-forced quality mass. | |
| double | gw_infil = 0.0 |
| Cumulative infiltration to GW (ft) | |
| double | gw_upper_evap = 0.0 |
| Cumulative upper zone evaporation (ft) | |
| double | gw_lower_evap = 0.0 |
| Cumulative lower zone evaporation (ft) | |
| double | gw_lower_perc = 0.0 |
| Cumulative deep percolation (ft) | |
| double | gw_lateral_flow = 0.0 |
| Cumulative lateral GW flow (ft) | |
| double | gw_init_storage = 0.0 |
| Initial GW storage (ft) | |
| double | gw_final_storage = 0.0 |
| double | gw_infil_2d_recharge = 0.0 |
| double | step_flooding = 0.0 |
| double | step_outflow = 0.0 |
| double | step_dw_inflow = 0.0 |
| double | step_gw_inflow = 0.0 |
| double | step_rdii_inflow = 0.0 |
| double | step_ext_inflow = 0.0 |
| double | last_step_flow_error = 0.0 |
| double | step_ext_withdrawal = 0.0 |
| std::vector< double > | qual_init_buildup |
| Initial buildup mass. | |
| std::vector< double > | qual_final_buildup |
| Final buildup mass. | |
| std::vector< double > | qual_ponded_lost |
| Ponded mass written off when a surface dried (legacy FINAL_LOAD) | |
| std::vector< double > | qual_surface_buildup |
| Accumulated buildup during sim. | |
| std::vector< double > | qual_wet_deposition |
| Wet deposition mass. | |
| std::vector< double > | qual_sweeping |
| Mass removed by sweeping. | |
| std::vector< double > | qual_bmp_removal |
| BMP treatment removal. | |
| std::vector< double > | qual_infil_loss |
| Mass lost to infiltration. | |
| std::vector< double > | qual_runoff_load |
| Mass load in surface runoff. | |
| std::vector< double > | qual_routing_wet |
| Wet weather quality inflow to routing. | |
| std::vector< double > | qual_routing_outflow |
| Quality mass leaving at outfalls. | |
| std::vector< double > | qual_routing_flood |
| Quality mass lost to flooding. | |
| std::vector< double > | qual_routing_init |
| Initial stored quality mass. | |
| std::vector< double > | qual_routing_final |
| Final stored quality mass. | |
| std::vector< double > | qual_routing_reacted |
| Quality mass lost to decay. | |
| std::vector< double > | qual_routing_ii_in |
| RDII quality mass inflow. | |
| std::vector< double > | qual_routing_dw_in |
| Dry weather quality mass inflow. | |
| std::vector< double > | qual_routing_gw_in |
| Groundwater quality mass inflow. | |
| std::vector< double > | qual_routing_ex_in |
| External (interface file) quality mass inflow. | |
| std::vector< double > | qual_routing_seep |
| Quality mass lost to seepage. | |
| std::vector< double > | qual_routing_evap |
| std::vector< double > | qual_routing_final_dry |
|
inline |
Groundwater continuity error (fraction). Gap #72.
|
inline |
Reset continuity totals while retaining pollutant array sizes and initial buildup.
Restores default scalar values, preserves qual_init_buildup values, and zeroes every other pollutant continuity array. Owned vector storage is moved aside and restored rather than resized; initial buildup is computed once by quality initialization.
|
inline |
Resize and zero all pollutant continuity arrays.
Replaces all prior pollutant totals, including initial buildup and runtime forcing loads; scalar totals are unchanged. Allocation failure can interrupt the sequence of independent assignments.
| [in] | n_pollutants | Nonnegative pollutant count matching the model registry; no negative guard before conversion to size_t. |
|
inline |
Routing continuity error (fraction).
|
inline |
Runoff continuity error (fraction).
| double openswmm::SimulationContext::MassBalance::gw_final_storage = 0.0 |
Final GW storage (ft)
| double openswmm::SimulationContext::MassBalance::gw_infil = 0.0 |
Cumulative infiltration to GW (ft)
| double openswmm::SimulationContext::MassBalance::gw_infil_2d_recharge = 0.0 |
U3 (track I-b, 2026-09-07): the part of the groundwater's infiltration input that arrived from the 2D surface ([2D_OPTIONS] INFIL_DESTINATION SUBCATCH_AQUIFER), ft³ — the same unit as gw_infil (rate × area × dt). Already inside it: the recharge is added to each subcatchment's infiltration rate before GWSolver::execute books it, so this is a diagnostic split, not a second inflow. Booked at delivery, in the same loop as mass_balance_2d.infil_to_aquifer (G1-c item 1), so the two are the same volumes in two units.
| double openswmm::SimulationContext::MassBalance::gw_init_storage = 0.0 |
Initial GW storage (ft)
| double openswmm::SimulationContext::MassBalance::gw_lateral_flow = 0.0 |
Cumulative lateral GW flow (ft)
| double openswmm::SimulationContext::MassBalance::gw_lower_evap = 0.0 |
Cumulative lower zone evaporation (ft)
| double openswmm::SimulationContext::MassBalance::gw_lower_perc = 0.0 |
Cumulative deep percolation (ft)
| double openswmm::SimulationContext::MassBalance::gw_upper_evap = 0.0 |
Cumulative upper zone evaporation (ft)
| double openswmm::SimulationContext::MassBalance::last_step_flow_error = 0.0 |
legacy massbal_getStepFlowError() of the PREVIOUS routing step — 1 - outflow/inflow of that step's StepFlowTotals, formed at the end of updateRoutingMassBalance — which isInSteadyState compares with SysFlowTol at the start of the next step.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_bmp_removal |
BMP treatment removal.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_final_buildup |
Final buildup mass.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_infil_loss |
Mass lost to infiltration.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_init_buildup |
Initial buildup mass.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_ponded_lost |
Ponded mass written off when a surface dried (legacy FINAL_LOAD)
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_routing_dw_in |
Dry weather quality mass inflow.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_routing_evap |
Quality mass lost to evaporation
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_routing_ex_in |
External (interface file) quality mass inflow.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_routing_final |
Final stored quality mass.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_routing_final_dry |
Mass booked to final storage as a link went dry, accumulated over the run (legacy massbal_addToFinalStorage). Legacy adds the end-of-run stored mass ON TOP of this running total (massbal.c:885), so it is kept apart from qual_routing_final, which SWMMEngine recomputes from state every routing step.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_routing_flood |
Quality mass lost to flooding.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_routing_gw_in |
Groundwater quality mass inflow.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_routing_ii_in |
RDII quality mass inflow.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_routing_init |
Initial stored quality mass.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_routing_outflow |
Quality mass leaving at outfalls.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_routing_reacted |
Quality mass lost to decay.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_routing_seep |
Quality mass lost to seepage.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_routing_wet |
Wet weather quality inflow to routing.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_runoff_load |
Mass load in surface runoff.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_surface_buildup |
Accumulated buildup during sim.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_sweeping |
Mass removed by sweeping.
| std::vector<double> openswmm::SimulationContext::MassBalance::qual_wet_deposition |
Wet deposition mass.
| double openswmm::SimulationContext::MassBalance::rdii_produced = 0.0 |
| double openswmm::SimulationContext::MassBalance::rdii_rainfall = 0.0 |
| double openswmm::SimulationContext::MassBalance::routing_coupling_out = 0.0 |
C2 (2026-09-07): cumulative water the 1D→2D coupling spill removed from coupled nodes (ft³). It used to be folded into routing_flooding, which reported a coupling TRANSFER under "Flooding Loss" — the water did not flood, it went to the 2D surface, where MassBalance2D::coupling_1d_to_2d_in books it arriving. Both ledgers are individually right; only the 1D report row was misleading, and a modeller reading it saw flooding they did not have.
It remains an OUTFLOW of the 1D system, so routing_error() counts it exactly as before — this change moves a number between report rows, it does not move water.
[2D_OPTIONS] COUPLING_IN_FLOODING YES restores the old grouping for run-to-run comparison against previous versions.
| double openswmm::SimulationContext::MassBalance::routing_dry_weather = 0.0 |
| double openswmm::SimulationContext::MassBalance::routing_evap_loss = 0.0 |
| double openswmm::SimulationContext::MassBalance::routing_external = 0.0 |
| double openswmm::SimulationContext::MassBalance::routing_final_storage = 0.0 |
| double openswmm::SimulationContext::MassBalance::routing_flooding = 0.0 |
| double openswmm::SimulationContext::MassBalance::routing_forcing_inflow = 0.0 |
Cumulative user-forced lateral inflow (ft3)
| std::vector<double> openswmm::SimulationContext::MassBalance::routing_forcing_qual_inflow |
Per-pollutant cumulative user-forced quality mass.
| double openswmm::SimulationContext::MassBalance::routing_gw_inflow = 0.0 |
| double openswmm::SimulationContext::MassBalance::routing_init_storage = 0.0 |
| double openswmm::SimulationContext::MassBalance::routing_link_gw_inflow = 0.0 |
G-X4 (2026-09-20): water the two-zone [2D_AQUIFER] handed to conduits running below the water table (ft³, ≥ 0) — a gaining reach, the inflow term legacy SWMM has no conduit source for. It is the negative half of seep_loss_rate; the positive half stays routing_seep_loss, so the two never net each other out and a deck can report both in the same run.
| double openswmm::SimulationContext::MassBalance::routing_outflow = 0.0 |
| double openswmm::SimulationContext::MassBalance::routing_rdii = 0.0 |
| std::array<double, 11> openswmm::SimulationContext::MassBalance::routing_report {} |
The eleven routing flow terms above (dry weather, wet weather, groundwater, conduit GW, RDII, external, flooding, coupling out, outflow, evaporation, seepage — in that order) for the printed Flow Routing Continuity block. FV uses accepted-window volumes; its published rates are already interval means. Other routing models retain legacy half-step integration of previous/current rates. The ledger above remains the exact cross-domain authority.
| double openswmm::SimulationContext::MassBalance::routing_seep_loss = 0.0 |
| double openswmm::SimulationContext::MassBalance::routing_wet_weather = 0.0 |
| double openswmm::SimulationContext::MassBalance::runoff_evap = 0.0 |
Total evaporation volume (ft3)
| double openswmm::SimulationContext::MassBalance::runoff_final_snow = 0.0 |
The same quantity at the end of the run (ft3). Legacy RunoffTotals.finalSnowCover.
These two, and runoff_snowremov, were the whole of F8. The ledger had no snow terms at all, so on any deck with a [SNOWPACKS] section the starting pack was unaccounted INPUT and the surviving pack unaccounted OUTPUT, and the printed continuity percentage was not a meaningful number. Measured on the snow parity deck: -8.193 % before, +1.419 % after.
| double openswmm::SimulationContext::MassBalance::runoff_final_store = 0.0 |
Final surface storage (ft3)
| double openswmm::SimulationContext::MassBalance::runoff_infil = 0.0 |
Total infiltration volume (ft3)
| double openswmm::SimulationContext::MassBalance::runoff_init_snow = 0.0 |
Snow water equivalent PLUS free water held in every pack at the start of the run (ft3). Legacy RunoffTotals.initSnowCover, summed from snow_getSnowCover (snow.c:587).
| double openswmm::SimulationContext::MassBalance::runoff_init_store = 0.0 |
Initial surface storage (ft3)
| double openswmm::SimulationContext::MassBalance::runoff_lid_drain |
LID drain-to-node outflow (ft3), legacy RUNOFF_DRAINS / VlidDrain.
| double openswmm::SimulationContext::MassBalance::runoff_rainfall = 0.0 |
Total rainfall volume (ft3)
| double openswmm::SimulationContext::MassBalance::runoff_runoff = 0.0 |
Total surface runoff volume (ft3)
| double openswmm::SimulationContext::MassBalance::runoff_runon = 0.0 |
Outfall-routed runon volume (ft3), legacy RUNOFF_RUNON.
| double openswmm::SimulationContext::MassBalance::runoff_snowremov = 0.0 |
Total snow removal volume (ft3)
| double openswmm::SimulationContext::MassBalance::step_dw_inflow = 0.0 |
| double openswmm::SimulationContext::MassBalance::step_ext_inflow = 0.0 |
| double openswmm::SimulationContext::MassBalance::step_ext_withdrawal = 0.0 |
legacy addExternalInflows (routing.c): a node's NEGATIVE external flow (a withdrawal) is booked as system OUTFLOW, not as a negative external inflow; summed here per step, ahead of the outfall and flooding terms as legacy's StepFlowTotals.outflow is.
| double openswmm::SimulationContext::MassBalance::step_flooding = 0.0 |
| double openswmm::SimulationContext::MassBalance::step_gw_inflow = 0.0 |
| double openswmm::SimulationContext::MassBalance::step_outflow = 0.0 |
| double openswmm::SimulationContext::MassBalance::step_rdii_inflow = 0.0 |