73#ifndef OPENSWMM_ENGINE_2D_QUALITY_SURFACE_QUALITY_2D_HPP
74#define OPENSWMM_ENGINE_2D_QUALITY_SURFACE_QUALITY_2D_HPP
107 std::vector<std::pair<std::string, double>>
uses;
182 bool active() const noexcept {
return active_; }
222 double dt_runoff,
double abs_time,
bool is_raining);
248 int nCells() const noexcept {
return n_cells_; }
257 int rowOf(
int s)
const noexcept {
return row_of_[
static_cast<std::size_t
>(s)]; }
266 return names_[
static_cast<std::size_t
>(s)];
275 double coverage(
int c,
int lu)
const noexcept {
return cov_[cidx(c, lu)]; }
283 double curbLength(
int c)
const noexcept {
return curb_[
static_cast<std::size_t
>(c)]; }
295 double buildup(
int c,
int lu,
int s)
const noexcept {
return bu_[bidx(c, lu, s)]; }
325 const std::vector<double>&
ledBuildup() const noexcept {
return led_bu_; }
334 const std::vector<double>&
ledWashoff() const noexcept {
return led_wo_; }
342 const std::vector<double>&
ledSweeping() const noexcept {
return led_sw_; }
350 const std::vector<double>&
ledBmp() const noexcept {
return led_bmp_; }
361 double mcf(
int s)
const noexcept {
return mcf_[
static_cast<std::size_t
>(s)]; }
372 double runoffVolume(
int c)
const noexcept {
return runoff_vol_[
static_cast<std::size_t
>(c)]; }
384 return wet_runoff_vol_[
static_cast<std::size_t
>(c)];
395 std::size_t cidx(
int c,
int lu)
const noexcept {
396 return static_cast<std::size_t
>(c) *
static_cast<std::size_t
>(n_lu_) +
397 static_cast<std::size_t
>(lu);
407 std::size_t bidx(
int c,
int lu,
int s)
const noexcept {
408 return (
static_cast<std::size_t
>(lu) *
static_cast<std::size_t
>(n_sp_) +
409 static_cast<std::size_t
>(s)) *
410 static_cast<std::size_t
>(n_cells_) +
411 static_cast<std::size_t
>(c);
415 double c0 = 0, c1 = 0, c2 = 0;
420 double coeff = 0, expon = 0, sweep_effic = 0, bmp_effic = 0;
429 const Params& param(
int lu,
int s)
const noexcept {
430 return params_[
static_cast<std::size_t
>(lu) *
static_cast<std::size_t
>(n_sp_) +
431 static_cast<std::size_t
>(s)];
444 void loadParams(
const SimulationContext& ctx);
446 bool active_ =
false;
447 int n_cells_ = 0, n_lu_ = 0, n_sp_ = 0;
449 double area_to_landarea_ = 1.0;
450 std::vector<int> row_of_;
451 std::vector<std::string> names_;
452 std::vector<double> mcf_;
453 std::vector<Params> params_;
454 std::vector<double> cov_;
455 std::vector<double> curb_;
456 std::vector<double> area_la_;
457 std::vector<double> init_;
458 std::vector<double> bu_;
459 std::vector<double> last_swept_;
460 std::vector<double> runoff_vol_;
461 std::vector<double> wet_runoff_vol_;
462 std::vector<double> led_init_, led_bu_, led_wo_, led_sw_, led_bmp_;
479 std::vector<CoverageRow2D>& rows);
493 std::vector<LoadingRow2D>& rows);
507 std::vector<CurbRow2D>& rows);
545 const char* section);
Registry that maps SWMM section tags to handler functions.
The S7 store: authored rows, resolved per-cell coverages and state, and the per-species ledgers.
Definition SurfaceQuality2D.hpp:125
const std::string & speciesName(int s) const noexcept
Read resolved per-species metadata.
Definition SurfaceQuality2D.hpp:265
std::vector< std::string > resolve(const SimulationContext &ctx, const MeshData &mesh, const SurfaceTransportState &tr, const SolverOptions2D &opts)
Bind the rows to the mesh, the land uses and the transport rows.
Definition SurfaceQuality2D.cpp:323
double runoffVolume(int c) const noexcept
Cumulative runoff volume (m³) the cell produced (the positive part of its net outflow per step,...
Definition SurfaceQuality2D.hpp:372
int nSpecies() const noexcept
Read the resolved pollutant plus MSX buildup row count, excluding age/temperature.
Definition SurfaceQuality2D.hpp:238
void initState(const SimulationContext &ctx, const MeshData &mesh)
Seed initial buildup: [2D_LOADINGS] row, else the buildup function at [OPTIONS] DRY_DAYS (legacy land...
Definition SurfaceQuality2D.cpp:587
double buildupPerArea(int c, int s) const noexcept
Total buildup of species s on cell c per unit land area (user mass / acre or ha) — what the results f...
Definition SurfaceQuality2D.cpp:620
const std::vector< double > & ledWashoff() const noexcept
Borrow cumulative net washoff delivered to surface transport after BMP per surface species.
Definition SurfaceQuality2D.hpp:334
double wetRunoffVolume(int c) const noexcept
…of which on steps fast enough to wash off (legacy MIN_RUNOFF): the volume an EMC washes off at its c...
Definition SurfaceQuality2D.hpp:383
int nLandUses() const noexcept
Read the resolved land-use count.
Definition SurfaceQuality2D.hpp:231
std::vector< LoadingRow2D > loading_rows
Definition SurfaceQuality2D.hpp:129
double buildup(int c, int lu, int s) const noexcept
Buildup of species s on land use lu of cell c, user mass per normalizer unit.
Definition SurfaceQuality2D.hpp:295
int nCells() const noexcept
< surface species (rows that build up)
Definition SurfaceQuality2D.hpp:248
int rowOf(int s) const noexcept
Transport row index of surface species s (pollutants first, then MSX).
Definition SurfaceQuality2D.hpp:257
void step(const SimulationContext &ctx, const MeshData &mesh, SurfaceStateData &state, double dt_runoff, double abs_time, bool is_raining)
One runoff step: buildup accrual, washoff into the cell rows, street sweeping.
Definition SurfaceQuality2D.cpp:639
double curbLength(int c) const noexcept
Read resolved curb normalization length.
Definition SurfaceQuality2D.hpp:283
const std::vector< double > & ledBmp() const noexcept
Borrow cumulative washoff removed by BMP treatment per surface species.
Definition SurfaceQuality2D.hpp:350
const std::vector< double > & ledSweeping() const noexcept
Borrow cumulative buildup removed by sweeping per surface species.
Definition SurfaceQuality2D.hpp:342
const std::vector< double > & ledInitBuildup() const noexcept
Per-species ledgers, user mass, cumulative.
Definition SurfaceQuality2D.hpp:316
bool active() const noexcept
Read whether the last resolution activated mesh surface quality.
Definition SurfaceQuality2D.hpp:182
std::vector< CoverageRow2D > coverage_rows
Definition SurfaceQuality2D.hpp:128
const std::vector< double > & ledBuildup() const noexcept
Borrow cumulative accrued buildup, including generated storeless-washoff supply per surface species.
Definition SurfaceQuality2D.hpp:325
double mcf(int s) const noexcept
Per-species conversion: concentration-mass units → user mass (lbs / kg).
Definition SurfaceQuality2D.hpp:361
void clearRows()
Clear all authored coverage, loading and curb-length rows.
Definition SurfaceQuality2D.hpp:145
bool authored() const noexcept
Test whether any coverage, loading or curb authoring row exists.
Definition SurfaceQuality2D.hpp:136
double coverage(int c, int lu) const noexcept
Read one resolved cell/land-use coverage fraction.
Definition SurfaceQuality2D.hpp:275
std::vector< CurbRow2D > curb_rows
Definition SurfaceQuality2D.hpp:130
Definition ExchangeLaw.hpp:60
std::string parseSqScope(const std::vector< std::string > &tokens, std::size_t &at, SqScopeKey &key, const char *section)
Parse a scoped surface-quality row prefix and expose its first payload token.
Definition SurfaceQuality2D.cpp:143
@ CELL
Definition SolverOptions2D.hpp:143
@ GLOBAL
the * row
Definition GwTransportData.hpp:66
@ TAG
every cell carrying tag
Definition GwTransportData.hpp:67
std::string parse2DCurbLengthLine(const std::vector< std::string > &tokens, std::vector< CurbRow2D > &rows)
Parse one scoped 2D curb authoring row.
Definition SurfaceQuality2D.cpp:222
SqScope
Row scope — the [2D_INFILTRATION] / [GW_*] ladder.
Definition SurfaceQuality2D.hpp:96
@ GLOBAL
Definition SurfaceQuality2D.hpp:96
std::string parse2DCoveragesLine(const std::vector< std::string > &tokens, std::vector< CoverageRow2D > &rows)
Parse one scoped 2D coverage authoring row.
Definition SurfaceQuality2D.cpp:174
std::string parse2DLoadingsLine(const std::vector< std::string > &tokens, std::vector< LoadingRow2D > &rows)
Parse one scoped 2D loading authoring row.
Definition SurfaceQuality2D.cpp:206
void registerSurfaceQualitySections(SurfaceQuality2D &sq, input::SectionRegistry ®istry)
Register [2D_COVERAGES], [2D_LOADINGS], [2D_CURB_LENGTH] writing into sq.
Definition SurfaceQuality2D.cpp:237
std::string formatSqScope(const SqScopeKey &k)
Scope key ↔ file token ("*", "TAG name", "CELL n" — 1-based).
Definition SurfaceQuality2D.cpp:132
Definition ExchangeLaw.hpp:60
Central, reentrant simulation context.
Definition SimulationContext.hpp:390
[2D_COVERAGES] — one row = the whole coverage set of its scope.
Definition SurfaceQuality2D.hpp:105
SqScopeKey key
Definition SurfaceQuality2D.hpp:106
std::vector< std::pair< std::string, double > > uses
(land use, percent)
Definition SurfaceQuality2D.hpp:107
[2D_CURB_LENGTH] — curb length per cell, project length units.
Definition SurfaceQuality2D.hpp:116
SqScopeKey key
Definition SurfaceQuality2D.hpp:117
double length
Definition SurfaceQuality2D.hpp:118
[2D_LOADINGS] — initial buildup, user mass per unit land area.
Definition SurfaceQuality2D.hpp:110
std::string species
Definition SurfaceQuality2D.hpp:112
double value
Definition SurfaceQuality2D.hpp:113
SqScopeKey key
Definition SurfaceQuality2D.hpp:111
SoA storage for 2D mixed triangle/quad mesh geometry and topology.
Definition MeshData.hpp:65
Definition SolverOptions2D.hpp:257
Definition SurfaceQuality2D.hpp:98
int cell
CELL rows, 0-based internally (1-based in the file)
Definition SurfaceQuality2D.hpp:101
std::string tag
TAG rows.
Definition SurfaceQuality2D.hpp:100
SqScope scope
Definition SurfaceQuality2D.hpp:99
Definition SurfaceStateData.hpp:64
Definition SurfaceTransportState.hpp:70