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

#include <Landuse.hpp>

Collaboration diagram for openswmm::landuse::LanduseSolver:

Public Member Functions

void init (int n_landuses, int n_pollutants)
 Set solver counts and resize landuse/pollutant parameter tables.
 
void computeBuildup (SurfaceQualitySoA &sq, const double *area, const double *curb_length, double dt, int n_subcatch)
 Batch compute buildup for all subcatchments.
 
void computeWashoff (SurfaceQualitySoA &sq, const double *runoff, const double *area, int n_subcatch)
 Batch compute washoff for all subcatchments.
 
void applyCoPollutant (SurfaceQualitySoA &sq, const double *runoff, const double *area, const int *co_pollut, const double *co_frac, int n_subcatch)
 Apply co-pollutant washoff fractions.
 

Public Attributes

std::vector< BuildupParams > buildup_params
 Per (landuse × pollutant) parameters. Index: [lu * n_pollutants + p].
 
std::vector< WashoffParams > washoff_params
 
int n_landuses_ = 0
 
int n_pollutants_ = 0
 

Member Function Documentation

◆ applyCoPollutant()

void openswmm::landuse::LanduseSolver::applyCoPollutant ( SurfaceQualitySoA & sq,
const double * runoff,
const double * area,
const int * co_pollut,
const double * co_frac,
int n_subcatch )

Apply co-pollutant washoff fractions.

After primary washoff is computed, for each pollutant p with a co-pollutant k: washoff[p] += co_frac[p] * washoff[k]. Matches legacy landuse_getCoPollutLoad().

Parameters
sqSurface quality SoA (washoff_conc modified in-place).
runoffRunoff rate per subcatchment (for mass rate conversion).
areaSubcatchment area.
co_pollutCo-pollutant index per pollutant (-1 = none).
co_fracCo-pollutant fraction per pollutant.
n_subcatchNumber of subcatchments.

runoff and area are unused in this concentration-only implementation and may be null. co_pollut/co_frac each cover n_pollutants_ when nonnull; either null returns. sq.washoff_conc covers n_subcatch*n_pollutants_ with nonnegative representable dimensions; indices outside pollutant range are skipped, nonpositive fractions skipped. Single forward pollutant pass sees earlier additions, including dependent/self references; it is not a simultaneous or cycle-checked solve. No unit conversion/generated-mass ledger, physical clock mutation or allocation. Exclusive state required; no general finite/sign validation of existing concentrations/fractions.

◆ computeBuildup()

void openswmm::landuse::LanduseSolver::computeBuildup ( SurfaceQualitySoA & sq,
const double * area,
const double * curb_length,
double dt,
int n_subcatch )

Batch compute buildup for all subcatchments.

Advance the simplified analytic buildup table using landuse-zero parameters.

For each (subcatch, pollutant):

  1. Convert current buildup to equivalent days (inverse function)
  2. Add timestep: days += dt / 86400
  3. Recompute buildup mass (forward function) All three steps are vectorisable (pow/exp/division).
Parameters
[in]areaUnused compatibility pointer, may be null; no normalization performed here.
[in]curb_lengthUnused compatibility pointer, may be null.
Note
This helper currently uses only landuse-zero parameters and flat subcatchment/pollutant state indexing. The complete coverage-weighted accepted runoff operator is surfacespecies::step; source definition documents simplified behavior and nontransactional state updates.
Parameters
[in,out]sqWritable buildup covering n_subcatch*n_pollutants_ in this helper's flat [subcatch*n_pollutants_+pollutant] indexing, regardless of sq.n_landuses. Caller must account for this simplified layout rather than treating it as full landuse-weighted runtime kernel.
[in]dtPositive finite duration s, converted to days before inverse/forward curve update.
[in]n_subcatchNonnegative number of flat subcatchment rows to update, covered by sq.buildup.
Note
The two unnamed area/curb pointers in definition are intentionally unused and may be null. Requires buildup_params at least n_pollutants_ (normally n_landuses_>=1), qualified nonnegative counts/ int products and curve parameters. Skips NONE rows; EXTERNAL lacks a series operator here and analytic helpers return0. Updates progressively without dry/snow/coverage/sweeping or mass-ledger booking, no engine clock change. No allocation/general shape/finite validation or rollback.

◆ computeWashoff()

void openswmm::landuse::LanduseSolver::computeWashoff ( SurfaceQualitySoA & sq,
const double * runoff,
const double * area,
int n_subcatch )

Batch compute washoff for all subcatchments.

Apply simplified landuse-zero washoff to flat subcatchment/pollutant arrays.

For each (subcatch, pollutant): EMC: conc = coeff (constant — trivially vectorisable) Exponential: conc = k * Q^n * B / (Q * A) (vectorisable) Rating: conc = k * (Q*A)^(n-1) (vectorisable)

Parameters
[in,out]sqWritable concentration/buildup covering n_subcatch*n_pollutants_, flat indexing independent of landuse dimension. Only selected row-zero parameters are read.
[in]runoffReadable n_subcatch runoff samples; treated as rate q in caller's coefficient convention (EXPON divides by q*area, RATING uses q*area). No internal/project unit conversion.
[in]areaReadable n_subcatch positive area samples in compatible coefficient convention.
[in]n_subcatchNonnegative count covered by both inputs and state arrays.
Note
Requires washoff_params>=n_pollutants_. NONE retains old concentration. Nonpositive q/area sets concentration0. EMC gives coefficient, EXPON uses stored buildup, RATING power law, result floored0. EXPON debits conc*q*area directly without multiplying a timestep; no duration argument or full runoff-step mass/ledger contract is provided by this helper. No coverage/BMP/physical clock advance, allocation or general finite/shape validation; exclusive simplified state access.

◆ init()

void openswmm::landuse::LanduseSolver::init ( int n_landuses,
int n_pollutants )

Set solver counts and resize landuse/pollutant parameter tables.

Parameters
[in]n_landusesNonnegative count, product with pollutants fits int.
[in]n_pollutantsNonnegative native pollutant count.
Note
resize retains overlapping old parameters, default-initializes added entries; this is not a full parameter reset. Dimension fields change before allocation, so failure can leave partial setup. No physical/native inventory/clock advance; exclusive setup ownership required.

Member Data Documentation

◆ buildup_params

std::vector<BuildupParams> openswmm::landuse::LanduseSolver::buildup_params

Per (landuse × pollutant) parameters. Index: [lu * n_pollutants + p].

◆ n_landuses_

int openswmm::landuse::LanduseSolver::n_landuses_ = 0

◆ n_pollutants_

int openswmm::landuse::LanduseSolver::n_pollutants_ = 0

◆ washoff_params

std::vector<WashoffParams> openswmm::landuse::LanduseSolver::washoff_params

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