#include <ArdEngine.hpp>
◆ absorbTreatedNodeConc()
| void openswmm::transport::ArdEngine::absorbTreatedNodeConc |
( |
SimulationContext & | ctx | ) |
|
E5b treatment interop: absorb treated node concentrations back into the node stores.
Replace represented pollutant mass only at wet nodes marked for treatment.
Called by SWMMEngine AFTER QualitySolver::applyTreatment ran on the PUBLISHED nodes.conc. Only nodes with treatment defined are touched — untreated nodes keep their store mass bit-identical (a conc→mass→conc round trip is NOT exact in floating point, so a blanket absorb would break the no-treatment parity).
- Parameters
-
| [in] | ctx | Public post-treatment node concentrations and prepared treatment mask matching owner. |
- Note
- Uninitialized/no pollutants/no treatment returns; wet node>1e-9ft3 receives c*represented water, untreated/tiny nodes remain bit-identical. Does not alter native/age/heat rows, publish or book removal again; caller treatment already owns ledger. Allocation-free, unchecked parallel extents, exclusive post-treatment phase.
◆ applySpeciesIncrements()
Validate unique cell species deltas then apply nonthermal rows and republish.
- Parameters
-
| [in,out] | ctx | Matching initialized public family stores and canonical row layout. |
| [in] | updates | Stable native-link/global-cell records, concentration_delta total-row tuples; thermal delta exactly0, finite/nonnegative candidate for every other carried row. |
- Returns
- Empty success or descriptive validation error before writes. Duplicate cell region refused. No external mass ledger, hydraulic water or clock booking. Allocations/publish can throw after accepted updates; exclusive completed coupling owner and matching row units required.
◆ applyThermalIncrements()
Add validated per-cell signed temperature increments then publish all families.
- Parameters
-
| [in,out] | ctx | Matching initialized public quality/scalar arrays; publish updates reported means. |
| [in] | updates | Stable native-link/global-cell identities and signed celsius increments degC. |
- Returns
- Empty success, descriptive message before writes for unavailable state/identity/nonfinite candidate. Repeated cell IDs allowed and prevalidated independently, so aggregate overflow is caller responsibility. Publish/allocation may throw after writes; no ledger/water/clock advance. Exclusive coupling phase.
◆ checkpointState()
| std::string openswmm::transport::ArdEngine::checkpointState |
( |
| ) |
const |
Export completed ARD numerical state without serializing live diagnostic writer.
- Returns
- Owning bytes with ready flag, fixed state arrays, node mass/volume, face flux and warnings/latch.
- Exceptions
-
| std::runtime_error | Active detailed output cannot continue from checkpoint; archive/allocation failures propagate. Does not validate finite values on save or serialize mesh/options/source row mappings, context inventory, engine clock or scratch; retain matching completed source separately. Stable owner required. |
◆ init()
Build the transport mesh and size all state; call once after the model is fully resolved (Router::init done, pollutants known).
Build a transport mesh and seed finite-volume carried species/node stores.
- Returns
- false if the mesh could not be built — the caller must fall back to the legacy quality path and surface the warnings.
- Parameters
-
| [in,out] | ctx | Fully resolved hydraulic geometry, pollutant/native species, scalar seeds/options, ARD config and output path. May ensure MSX state, resize/reseed public age/heat arrays and open detail file. |
- Returns
- True when mesh/state setup completes; false with warnings for active WALL profile, no rows, mesh errors or no cells. Caller decides legacy fallback and exposes warnings; earlier setup may remain.
- Note
- Replaces owned mesh/inventories/scratch; rows pollutants, MSX, optional age, final temperature. Mesh lengths/dispersion converted display->native ft; TARGET_DX ignored under hydraulic FV with warning. Resolves boundary/source mesh mapping, preserves age hotstart seeds but initializes thermal overrides. DETAILED_OUTPUT opens/truncates configured CSV and writes header; open failure only warns/disables writer. Allocation/IO/dependency exceptions can leave partial state; initialized=true only at final success. No hydraulic water or engine clock advance, exclusive initial lifecycle with stable dimensions.
◆ initialized()
| bool openswmm::transport::ArdEngine::initialized |
( |
| ) |
const |
|
inlinenoexcept |
Read successful mesh/state initialization flag.
- Returns
- True only after final init success; does not validate current context/layout compatibility. No allocation/mutation.
◆ restoreCheckpointState()
| void openswmm::transport::ArdEngine::restoreCheckpointState |
( |
const std::string & | bytes, |
|
|
SimulationContext & | ctx ) |
Decode completed ARD state into a fresh staging owner against compatible context.
- Parameters
-
| [in] | bytes | Archive from checkpointState with matching source/configuration/dimensions. |
| [in,out] | ctx | Matching completed native geometry/quality/options; ready snapshot calls init, which may reseed public scalar/native stores before fixed numerical state replacement. |
- Exceptions
-
| std::runtime_error | Detail path configured, init failure, archive/trailing extent error, nonfinite stored numerical values or negative node volume. Other allocations/dependencies propagate. |
- Note
- Decode mutates staging owner/context before validation, no rollback. Does not reject all negative cell area/concentration values. False-ready snapshot leaves existing owner untouched, so caller must use fresh staging owner and install only after broader physical/output validation. No engine clock advance.
◆ speciesRegions()
Export carried row concentrations over available wet thermal transport-cell regions.
- Parameters
-
| [in] | ctx | Stable canonical network row policy/names matching initialized owner. |
- Returns
- Owning link/global-cell/normalized-interval snapshots with volume m3, canonical row names and pollutant/native declared concentrations, age s and thermal degC. Requires thermal row even when other species carried; absent heat yields empty. No mutation/clock change; allocation can throw.
◆ step()
One transport step over the routing step dt.
Advance one accepted projected-hydraulic ARD routing interval and publish family means.
Pre-condition: the external quality loads for this step have been assembled into nodes.qual_mass_in / qual_vol_in (the QualitySolver loader stage). Post-condition: links.conc, nodes.conc updated; pollutant old arrays capture entry values.
- Parameters
-
| [in,out] | ctx | Completed hydraulics and freshly assembled pollutant/native/age/thermal sources; updates public current quality, entry old histories, HRT, heat/bed, reaction/clamp/forcing diagnostics. |
| [in] | dt | Positive finite accepted routing seconds; uninitialized/nonpositive returns. |
- Note
- Captures pollutant old histories at entry, projects hydraulics and refreshes rows. Resynchronizes node volume to hydraulic store, scales mass for shrinking/tiny relative-growth corrections only. CFL=.9 chooses up to512 advection/dispersion substeps; cap warns once and may exceed stability target. After transport increments age by whole dt, applies atmospheric/bed heat, HRT/kinetics and bed solute, then publishes. Detail writer advances private time and appends CSV when active. Caller applies node treatment separately then absorbs it. No hydraulic/engine clock advance. Allocation/IO/solver errors can leave partial accepted state, histories/ledgers/output without rollback; exclusive phase.
◆ thermalRegions()
Export wet transport-cell thermal regions and their SI geometry.
- Returns
- Owning channel region snapshots with native parent link, global cell region index, normalized along-link interval, volume m3, degC, length/depth m and free/wetted contact area m2. Empty when uninitialized/thermal row absent; closed geometry has free area0. No context mutation; allocation or geometry dependency may throw. Caller keeps initialized owner stable during read, snapshots later stale.
◆ totalMass()
| std::vector< double > openswmm::transport::ArdEngine::totalMass |
( |
const SimulationContext & | ctx | ) |
const |
Sum represented inventory over cells and physical node stores for every carried row.
Total species mass currently held (cells + node stores), one entry per species — the conservation ledger the unit gates check.
- Parameters
-
| [in] | ctx | Unused context retained for diagnostics interface. |
- Returns
- Owning total-row vector of concentration*ft3 inventories, age s*ft3, temperature degC*ft3; no litre/user-mass or heat-capacity conversion. No physical/clock mutation, array validation or implicit initialization. Allocation can throw; stable matching owned state required.
◆ warnings()
| const std::vector< std::string > & openswmm::transport::ArdEngine::warnings |
( |
| ) |
const |
|
inlinenoexcept |
Borrow initialization diagnostics retained by this transport owner.
- Returns
- Const reference to owner vector, nonowned, valid until owner destruction or next init/restore. Caller copies if retaining across lifecycle mutations; no allocation or context/clock change.
The documentation for this class was generated from the following files:
- /home/runner/work/openswmm.engine/openswmm.engine/src/engine/transport/components/EulerianArdComponent/ArdEngine.hpp
- /home/runner/work/openswmm.engine/openswmm.engine/src/engine/transport/components/EulerianArdComponent/ArdEngine.cpp