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

Classes

class  QualitySolver
 

Functions

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)
 
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)
 
void applyNodeTreatment (SimulationContext &ctx, int node, double dt, double q_in_cfs, const double *cin)
 One node's [TREATMENT] application, against the CALLER's inflow figures — the seam the LEGACY pass and the LARD MIX share.
 

Variables

constexpr double ZERO_VOLUME = 0.0353147
 1 liter in ft3
 
constexpr double ZERO_DEPTH = 0.003281
 1 mm in ft
 

Function Documentation

◆ applyNodeTreatment()

void openswmm::quality::applyNodeTreatment ( SimulationContext & ctx,
int node,
double dt,
double q_in_cfs,
const double * cin )

One node's [TREATMENT] application, against the CALLER's inflow figures — the seam the LEGACY pass and the LARD MIX share.

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).

Parameters
q_in_cfsInflow rate feeding the node this interval, ft³/s.
cinPer-pollutant inflow concentration, length np.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bookNegativeAgeClamp()

void openswmm::quality::bookNegativeAgeClamp ( SimulationContext & ctx,
int node )
inline

Age-row clamp: counted, not ledgered (no age row until A2c) and not warned per-clamp (see bookNegativeSourceClamp's note).

Here is the caller graph for this function:

◆ bookNegativeCellSourceClamp()

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:

  1. [TRANSPORT_SOURCES] rows resolve to MSX species rows onlyArdEngine.cpp pushes np + src_msx[i], so a cell source can never name a pollutant; and
  2. 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
conduitmesh conduit row of the first clamp (diagnostic only).
shortfallthe UNMET extraction (positive, internal mass units).

◆ bookNegativeSourceClamp()

void openswmm::quality::bookNegativeSourceClamp ( SimulationContext & ctx,
int node,
int p,
double shortfall )
inline

Book one pollutant-row clamp: count it and un-book the shortfall from the external-extraction ledger row.

Note
NO per-clamp warning. There was one until 2026-08-29; it fired on every correct extraction deck, because during fill every cell is near-empty and any extraction clamps trivially (measured: 108 clamps on a deck extracting 40 % of its inflow). A notice that fires on ordinary models is one users learn to ignore — which destroys it on the models where it matters (lesson 148). The end-of-run summary carries the count and the unmet mass; that is the diagnostic.
Parameters
shortfallthe UNMET extraction (positive, internal mass units).
Here is the caller graph for this function:

◆ summarizeNegativeSourceClamps()

void openswmm::quality::summarizeNegativeSourceClamps ( SimulationContext & ctx)
inline

End-of-run summary (pushed once by SWMMEngine::end when anything clamped; gates read ctx.warnings, so .rpt ordering is not load-bearing).

Variable Documentation

◆ ZERO_DEPTH

double openswmm::quality::ZERO_DEPTH = 0.003281
constexpr

1 mm in ft

◆ ZERO_VOLUME

double openswmm::quality::ZERO_VOLUME = 0.0353147
constexpr

1 liter in ft3