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

#include <QualityRouting.hpp>

Collaboration diagram for openswmm::quality::QualitySolver:

Public Member Functions

void init (int n_nodes, int n_links, int n_pollutants)
 
void execute (SimulationContext &ctx, double dt)
 Execute one quality routing timestep.
 
void assembleExternalLoads (SimulationContext &ctx, double dt)
 Stage 1 of execute() only: reset the assembly arrays and run the five external-load adders (washoff, RDII, DWF, GW, iface) into nodes.qual_mass_in / qual_vol_in — no mixing, decay, or link update.
 
void addExtInflowLoads (SimulationContext &ctx, double dt)
 Add direct external inflow ([INFLOWS] CONCEN/MASS) pollutant loads, and the direct inflow's water, to the node assembly arrays.
 
void addCouplingLoads (SimulationContext &ctx, double dt)
 
void addWetWeatherLoads (SimulationContext &ctx, double dt)
 Add subcatchment washoff quality loads to node inflows.
 
void updateLinkQuality (SimulationContext &ctx, double dt)
 
void applyTreatment (SimulationContext &ctx, double dt)
 

Member Function Documentation

◆ addCouplingLoads()

void openswmm::quality::QualitySolver::addCouplingLoads ( SimulationContext & ctx,
double dt )

S3: 2D→1D junction drain — its water into qual_vol_in, its species mass (queued by SurfaceRouter2D, drained by assembleLateralInflows) into qual_mass_in. No-op when no 2D coupling is active.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addExtInflowLoads()

void openswmm::quality::QualitySolver::addExtInflowLoads ( SimulationContext & ctx,
double dt )

Add direct external inflow ([INFLOWS] CONCEN/MASS) pollutant loads, and the direct inflow's water, to the node assembly arrays.

The mass rates were evaluated by the inflow solver into nodes.ext_qual_mass (CONCEN rows already multiplied by the node's flow). This also folds the direct inflow volume into qual_vol_in, which is the mixing denominator — legacy divides by Node[j].inflow, a total that includes lateral inflow.

See also
Legacy: routing.c addExternalInflows() pollutant portion
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addWetWeatherLoads()

void openswmm::quality::QualitySolver::addWetWeatherLoads ( SimulationContext & ctx,
double dt )

Add subcatchment washoff quality loads to node inflows.

For each subcatchment with runoff, adds the washoff concentration × flow as mass inflow to the outlet node. Matches legacy addWetWeatherInflows() in routing.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyTreatment()

void openswmm::quality::QualitySolver::applyTreatment ( SimulationContext & ctx,
double dt )

Apply treatment expressions at nodes with treatment defined. Public since E5b: the ARD engine reuses this exact evaluator for treatment interop — it runs on the PUBLISHED nodes.conc after the ARD step and the engine absorbs the treated concentrations back into its node stores (ArdEngine::absorbTreatedNodeConc). Books its own qual_routing_reacted losses.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assembleExternalLoads()

void openswmm::quality::QualitySolver::assembleExternalLoads ( SimulationContext & ctx,
double dt )

Stage 1 of execute() only: reset the assembly arrays and run the five external-load adders (washoff, RDII, DWF, GW, iface) into nodes.qual_mass_in / qual_vol_in — no mixing, decay, or link update.

Split out (behavior-preserving refactor) so the Eulerian ARD engine (QUALITY_SOLVER EULERIAN_ARD) can consume the same source loads while replacing the CSTR transport stages — master plan §4.3 source-attribution seam.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ execute()

void openswmm::quality::QualitySolver::execute ( SimulationContext & ctx,
double dt )

Execute one quality routing timestep.

  1. Accumulate link mass flows → node quality (batch over links)
  2. Complete mixing at nodes: c_new = (c_old*V + W*dt) / (V + Vin)
  3. First-order decay: c = c * (1 - k*dt)
  4. Update link quality from upstream node
Parameters
ctxSimulation context.
dtTimestep (seconds).
Here is the call graph for this function:

◆ init()

void openswmm::quality::QualitySolver::init ( int n_nodes,
int n_links,
int n_pollutants )

◆ updateLinkQuality()

void openswmm::quality::QualitySolver::updateLinkQuality ( SimulationContext & ctx,
double dt )

Update link quality using volume-balance mixing with upstream node (DW/KW) or upstream node concentration with exponential decay (STEADY). Public for testing.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: