Water Quality Model
1. Overviewβ
HydroPol2D simulates pollutant transport using a build-up and wash-off formulation coupled to the hydrodynamic model.
The model tracks:
- pollutant mass stored on the surface,
- pollutant removal due to flow (wash-off),
- redistribution between neighboring cells,
- export through outlet boundaries.
Figure 1. The three steps of the mass-based water-quality model. Build-up in dry weather sets the starting mass, wash-off carries it out of each cell through the faces the water leaves by, and transport moves it from cell to cell to the outlet.
The governing variable is:
where:
- = pollutant mass per cell
The model is fully mass conservative and dynamically coupled to flow routing.
The current validation focuses on the mass-based wash-off mode
(flag_wq_model = 0). The validation uses SWMM-style buildup parameter scales
for total suspended solids, but the truth source is an analytical mass-balance
solution rather than a SWMM numerical run or a calibrated field pollutograph.
2. Pollutant storageβ
Each cell stores a pollutant mass:
The corresponding areal concentration is:
where:
- = cell area
Minimum and maximum thresholds are defined:
- β minimum active pollutant mass
- β saturation limit
Below a threshold:
3. Hydrodynamic couplingβ
The water quality model uses the discharge , in , that leaves a cell through each face in the routing step. Python takes directly from the face discharges of the routing solver.
MATLAB stores the outflows of a grid cell as depth rates over the cell area
with units
and converts each one to a discharge before the wash-off is computed
4. Wash-off formulationβ
Two wash-off formulations are implemented.
4.1 Rating-curve wash-off modelβ
This mode exists only in MATLAB, and only on the regular grid, since a MATLAB mesh run refuses it. Python has only the mass-based mode of section 4.2.
When flag_wq_model = 1, the wash-off is:
where:
- = pollutant mass flux
- = empirical coefficients
- = flow rate
The storage correction factor is:
where:
- = residual pollutant mass threshold
This formulation ensures that:
- wash-off increases with flow,
- wash-off increases with available pollutant mass.
4.2 Mass-based wash-off modelβ
When flag_wq_model = 0, the formulation becomes:
This formulation assumes:
- wash-off is proportional to available pollutant mass,
- transport increases with flow magnitude.
5. Directional pollutant fluxesβ
Pollutant fluxes are computed for each direction through which water leaves the cell. On the regular grid the directions are
- left
- right
- up
- down
- outlet
MATLAB treats the outlet as a fifth direction of the outlet cells. Python carries the outlet flow on the faces at the edge of the grid, so there the outlet flux is the flux through a boundary face. On a Voronoi or quadtree mesh, both codes use every edge through which water leaves the cell, and an edge on the domain boundary exports the pollutant out of the model.
The total pollutant outflow from a cell is:
Incoming pollutant fluxes are computed from neighboring cells:
6. Net pollutant balanceβ
The net pollutant rate is:
The mass balance equation is:
This formulation accounts for:
- pollutant removal due to wash-off,
- pollutant redistribution across the grid.
7. Adaptive time stepping (critical feature)β
To ensure stability and avoid negative mass, HydroPol2D splits the hydraulic time step into equal sub-steps:
where:
- the maximum runs over the cells that hold pollutant (),
- is the gross outflow rate of a cell at the start of the step, without the incoming flux ,
- rounds up to the next integer.
In each sub-step the wash-off is computed again from the current mass. A cell whose outflow would remove more than it holds has its outflows scaled down so that . The mass is then updated:
Python and MATLAB both use this scheme. The sub-steps run inside the hydraulic step, so the water quality model does not shorten the model time step.
This ensures:
- no negative pollutant mass,
- numerical stability,
- accurate mass conservation.
8. Mass conservation and correctionsβ
After updating:
- negative values are removed:
- rounding is applied to avoid numerical noise.
Mass lost due to numerical corrections is tracked:
9. Pollutant concentrationβ
Pollutant concentration is computed as:
where:
- = total pollutant outflow of the cell
- = total water discharge that leaves the cell
- the factor 1000 converts to
Python computes this way and sets in a cell that no water leaves. On the regular grid, MATLAB computes the same ratio from the depth rates of section 3, as with in kg/h, the total outflow rate in mm/h and in mΒ². It uses no less than 10 mm/h for (section 12).
10. Outlet concentrationβ
The outlet concentration is computed as:
where the sums run over the faces through which water leaves the domain, is the pollutant flux through such a face averaged over the time step , and is the water discharge through it . On the regular grid, MATLAB computes the same ratio as the pollutant mass that reaches the outlet in the time step, in kg, divided by the outlet water volume of the step, in litres, times .
11. Total washed massβ
The cumulative washed pollutant mass is:
12. Numerical constraintsβ
The model enforces:
- minimum pollutant threshold:
- a minimum flow for the cell concentration, in MATLAB on the regular grid only:
MATLAB applies this floor only to the total outflow rate in the denominator of the cell concentration of section 9, so a cell with very little outflow does not report a very large concentration. It does not change the wash-off, the mass balance or the outlet concentration. Python has no such floor, and its cells that no water leaves have .
Summaryβ
The HydroPol2D water quality model:
- tracks pollutant mass per cell,
- computes wash-off as a function of flow and storage,
- redistributes pollutants across the domain,
- ensures strict mass conservation,
- uses adaptive time stepping to maintain stability.
It provides a robust and flexible framework for simulating pollutant transport coupled with hydrologic and hydrodynamic processes. Current validation evidence supports controlled buildup/washoff mass-balance behavior; site-specific pollutant prediction still requires local pollutant parameters, observations, and calibration.