|
| void | bookNegativeSourceClamp (SimulationContext &ctx, int node, int p, double shortfall) |
| | Book one pollutant-row clamp: count it and un-book the shortfall from the external-extraction ledger row.
|
| |
| void | bookNegativeAgeClamp (SimulationContext &ctx, int node) |
| | Age-row clamp: counted, not ledgered (no age row until A2c) and not warned per-clamp (see bookNegativeSourceClamp's note).
|
| |
| void | bookNegativeCellSourceClamp (SimulationContext &ctx, int conduit, double shortfall) |
| | P1.4: book one ARD cell-source clamp. Counted, NOT ledgered — and the reason is structural, not an omission.
|
| |
| void | summarizeNegativeSourceClamps (SimulationContext &ctx) |
| | End-of-run summary (pushed once by SWMMEngine::end when anything clamped; gates read ctx.warnings, so .rpt ordering is not load-bearing).
|
| |
| bool | linkTakesUpstreamValue (const SimulationContext &ctx, int link) |
| | Test whether a link has no mixed conduit water pool.
|
| |
| double | conduitMixingInflow (const SimulationContext &ctx, int link, double dt) |
| | Calculate a conduit quality mixing inflow from accepted hydraulic balance.
|
| |
| bool | linkIsDry (const SimulationContext &ctx, int link) |
| | Test the accepted conduit water/depth effective-zero thresholds.
|
| |
| bool | nodeIsReactor (const SimulationContext &ctx, int node) |
| | Select storage or retained-water node mixing.
|
| |
| double | storageEvapFactor (const SimulationContext &ctx, int node) |
| | Calculate storage concentration increase from non-LID evaporation.
|
| |
| void | updateUntreatedStorageHrt (SimulationContext &ctx, double dt) |
| | Advance residence time only for untreated storage nodes under active native reactions.
|
| |
| bool | nodeIsDry (const SimulationContext &ctx, int node, double q_in) |
| | Test node effective dryness only when mixing inflow is negligible.
|
| |
| void | applyNodeTreatment (SimulationContext &ctx, int j, double dt, double q_raw, const double *cin) |
| | Resolve one node's compiled co-treatment laws and book accepted pollutant removal.
|
| |
| void openswmm::quality::applyNodeTreatment |
( |
SimulationContext & | ctx, |
|
|
int | j, |
|
|
double | dt, |
|
|
double | q_raw, |
|
|
const double * | cin ) |
Resolve one node's compiled co-treatment laws and book accepted pollutant removal.
One node's [TREATMENT] application, against the CALLER's inflow figures — the seam the LEGACY pass and the LARD MIX share.
- Parameters
-
| [in,out] | ctx | Compiled treatment rows and shared cin/removal scratch, node concentrations/HRT and reacted mass ledger. Requires all configured node/pollutant/subtype arrays prepared. |
| [in] | j | Valid nonnegative native node index (node in declaration); absent treatment mask returns. |
| [in] | dt | Accepted routing duration s; positive finite required for ordinary HRT/mass bookkeeping. |
| [in] | q_raw | Caller-complete inflow ft3/s (q_in_cfs in declaration); caller selects its assembly source. |
| [in] | cin | Borrowed np inflow concentrations, null supplies zeros; may equal treat.cin.data(). |
- Note
- Uses display flow/depth/area, average native volume ft3, HRT hours and dt seconds for expression variables. Resolves R references recursively with cycle sentinel; invalid/cyclic references become0, no explicit warning/error result. Removal clamps0..1, concentration result cannot increase node; zero inflow suppresses removal-typed expression. Updates storage HRT and positive net lost-mass ledger; shared scratch overwritten. No water/clock advance. Temporary vectors/evaluation can throw after HRT or earlier pollutant changes; exclusive context/compiled-table lifecycle, no rollback.
Evaluates the node's compiled expressions (removal- and concentration-typed, with co-treatment resolution and cycle detection), rewrites nodes.conc for every treated pollutant and books the removed mass into qual_routing_reacted. The inflow concentration and rate come from the CALLER because the two engines hold them in different places: LEGACY accumulates qual_mass_in/qual_vol_in, while LARD's node inflow lives in its solver-internal drain accumulators — reading the LEGACY arrays under LARD made an R-typed expression a literal no-op (cin read 0, and cOut = (c_in > 0) ? … : c_node kept the untreated value; P2.3's first draft shipped exactly that).
- Argument q_in_cfs: Inflow rate feeding the node this interval, ft³/s.
- Argument cin: Per-pollutant inflow concentration, length
np.
- Argument ctx (in,out): Prepared node concentrations/HRT, compiled treatment and shared scratch/ledgers.
- Argument node (in): Valid native node ID; source definition calls it j.
- Argument dt (in): Accepted positive finite routing interval s.
- Argument q_in_cfs (in): Complete caller inflow ft3/s; source definition calls it q_raw.
- Note
- cin may be null (zeros) or alias treatment cin scratch; other borrowed inputs remain stable. Exclusive once-per-interval treatment; no hydraulic or clock change.
| void openswmm::quality::bookNegativeCellSourceClamp |
( |
SimulationContext & | ctx, |
|
|
int | conduit, |
|
|
double | shortfall ) |
|
inline |
P1.4: book one ARD cell-source clamp. Counted, NOT ledgered — and the reason is structural, not an omission.
The node seam un-books its shortfall from qual_routing_ex_in because the loaders booked the signed request there in advance. Cell sources have no such row to correct:
[TRANSPORT_SOURCES] rows resolve to MSX species rows only — ArdEngine.cpp pushes np + src_msx[i], so a cell source can never name a pollutant; and
- MSX species have no mass-balance row at all. The ARD component writes to
ctx.mass_balance nowhere.
So a per-pollutant row for this would be permanently zero, and inventing an MSX row here would be a third self-consistent balance (lesson 147) bolted on inside a defect fix. Giving MSX species real ledger rows (sizing the qual_* vectors by np + nm) is a deliberate, separate round — until it lands, the delivered mass reaches qual_routing_final through the end-of-run inventory sweep and therefore surfaces as CONTINUITY ERROR rather than as a labelled term. Recorded, not hidden.
- Parameters
-
| conduit | mesh conduit row of the first clamp (diagnostic only). |
| shortfall | the UNMET extraction (positive, internal mass units). |
| [in,out] | ctx | Mutable shared extraction count/shortfall and first-element diagnostics only. |
- Note
- Caller supplies finite positive unmet native extraction and already performs its actual physical/native receipt booking. This helper does not repair any mass ledger or remove inventory. Counts every call; requires serialized diagnostic ownership, allocation-free/no clock mutation.
| double openswmm::quality::conduitMixingInflow |
( |
const SimulationContext & | ctx, |
|
|
int | link, |
|
|
double | dt ) |
Calculate a conduit quality mixing inflow from accepted hydraulic balance.
- Parameters
-
| [in] | ctx | Stable covered link/type/subtype hydraulic arrays. |
| [in] | link | Valid nonnegative native link index, unchecked. |
| [in] | dt | Accepted interval s; nonpositive omits volume correction. Positive finite duration required for ordinary routing. |
- Returns
- Nonnegative ft3/s: absolute KW upstream flow or link flow; DYNWAVE/FV add (new volume
- barrel seep/evap losses - old volume)/dt for dt>0.
- Note
- Read-only and allocation-free; no generic finite/physical validation.
The mixing inflow rate a conduit sees over one step (legacy findLinkQual): KW's accepted upstream flow, or |Link.newFlow| for single-rate models, plus — under a single-rate dynamic model only — the volume the conduit gained together with what it lost to seepage and evaporation, the sum clamped at zero.
| bool openswmm::quality::linkTakesUpstreamValue |
( |
const SimulationContext & | ctx, |
|
|
int | link ) |
Test whether a link has no mixed conduit water pool.
- Parameters
-
| [in] | ctx | Stable covered link/type/subtype hydraulic arrays. |
| [in] | link | Valid nonnegative native link index, unchecked. |
- Returns
- True for non-conduit type or DUMMY section; no flow/depth check.
- Note
- Read-only and allocation-free; no generic finite/physical validation.
Legacy findLinkQual's opening test: a non-conduit link — pump, orifice, weir, outlet — or a conduit with a DUMMY cross-section holds no water, so it takes its upstream node's value outright, with no mixing, no evaporation factor and no reaction.