OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
QualityRouting.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2//
3// Copyright 2026 Caleb Buahin
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
34
35#ifndef OPENSWMM_QUALITY_ROUTING_HPP
36#define OPENSWMM_QUALITY_ROUTING_HPP
37
38#include <vector>
39
40namespace openswmm {
41
43
44namespace quality {
45
46// ============================================================================
47// Constants
48// ============================================================================
49
50constexpr double ZERO_VOLUME = 0.0353147;
51constexpr double ZERO_DEPTH = 0.003281;
52
72void applyNodeTreatment(SimulationContext& ctx, int node, double dt,
73 double q_in_cfs, const double* cin);
74
75// ============================================================================
76// Quality solver
77// ============================================================================
78
80public:
81 void init(int n_nodes, int n_links, int n_pollutants);
82
95 void execute(SimulationContext& ctx, double dt);
96
108 void assembleExternalLoads(SimulationContext& ctx, double dt);
109
121 void addExtInflowLoads(SimulationContext& ctx, double dt);
125 void addCouplingLoads(SimulationContext& ctx, double dt);
126
134 void addWetWeatherLoads(SimulationContext& ctx, double dt);
135
139 void updateLinkQuality(SimulationContext& ctx, double dt);
140
147 void applyTreatment(SimulationContext& ctx, double dt);
148
149private:
150 int n_pollutants_ = 0;
151
152 // Quality mass inflow arrays are stored on NodeData (nodes.qual_mass_in[],
153 // nodes.qual_vol_in[]) so that external quality sources (user forcing, DWF
154 // quality, etc.) can contribute at the same assembly point.
155
157 void addRdiiLoads(SimulationContext& ctx, double dt);
158
160 void addDwfLoads(SimulationContext& ctx, double dt);
161
163 void addGwLoads(SimulationContext& ctx, double dt);
164
166 void addIfaceLoads(SimulationContext& ctx, double dt);
167
169 void accumulateLinkLoads(SimulationContext& ctx, double dt);
170
172 void mixAtNodes(SimulationContext& ctx, double dt);
173
175 void applyDecay(SimulationContext& ctx, double dt);
176
177};
178
179} // namespace quality
180} // namespace openswmm
181
182#endif // OPENSWMM_QUALITY_ROUTING_HPP
Definition QualityRouting.hpp:79
void addWetWeatherLoads(SimulationContext &ctx, double dt)
Add subcatchment washoff quality loads to node inflows.
Definition QualityRouting.cpp:448
void updateLinkQuality(SimulationContext &ctx, double dt)
Definition QualityRouting.cpp:950
void init(int n_nodes, int n_links, int n_pollutants)
Definition QualityRouting.cpp:158
void addExtInflowLoads(SimulationContext &ctx, double dt)
Add direct external inflow ([INFLOWS] CONCEN/MASS) pollutant loads, and the direct inflow's water,...
Definition QualityRouting.cpp:272
void addCouplingLoads(SimulationContext &ctx, double dt)
Definition QualityRouting.cpp:219
void applyTreatment(SimulationContext &ctx, double dt)
Definition QualityRouting.cpp:1074
void execute(SimulationContext &ctx, double dt)
Execute one quality routing timestep.
Definition QualityRouting.cpp:356
void assembleExternalLoads(SimulationContext &ctx, double dt)
Stage 1 of execute() only: reset the assembly arrays and run the five external-load adders (washoff,...
Definition QualityRouting.cpp:164
Definition Node.cpp:38
Definition NegativeSources.hpp:44
void applyNodeTreatment(SimulationContext &ctx, int j, double dt, double q_raw, const double *cin)
One node's [TREATMENT] application, against the CALLER's inflow figures — the seam the LEGACY pass an...
Definition QualityRouting.cpp:1102
constexpr double ZERO_VOLUME
1 liter in ft3
Definition QualityRouting.hpp:50
constexpr double ZERO_DEPTH
1 mm in ft
Definition QualityRouting.hpp:51
Definition NodeCoupling.cpp:16
Central, reentrant simulation context.
Definition SimulationContext.hpp:353