OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
GroundwaterConcentration.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
11
12#ifndef OPENSWMM_GROUNDWATER_CONCENTRATION_HPP
13#define OPENSWMM_GROUNDWATER_CONCENTRATION_HPP
14#include "SubsurfaceSolver.hpp"
15#include <algorithm>
16namespace openswmm::twoD {
17// Legacy BULK reports total inventory per water volume. The explicit LAYERED
18// profile reports a capacity-weighted dissolved concentration for both zones.
33inline double groundwaterZoneConcentration(const SubsurfaceSolver& gw, int cell, int species,
34 bool saturated) {
35 const auto& tr = gw.transport();
36 const auto& state = gw.state();
37 const auto k = tr.idx(species, cell);
38 double capacity = saturated ? gw.satVolume(cell) : gw.unsatVolume(cell);
39 if (tr.n_layers > 0 && species != tr.age_row && species != tr.temp_row) {
40 const double thickness =
41 saturated ? state.hg[cell] : std::max(0., state.zs[cell] - state.hg[cell]);
42 capacity += state.area[cell] * thickness * tr.kd[k] * tr.rho_b[cell];
43 }
44 const double mass = saturated ? tr.sat_mass[k] : tr.unsat_mass[k];
45 return capacity > 0 ? mass / capacity : 0;
46}
47}
48#endif
G-steps 3, 6-12, 16 — the two-zone groundwater kernel: saturated FV update, lateral Darcy,...
The two-zone kernel. Owned by SurfaceRouter2D; driven by the marcher's tier hooks.
Definition SubsurfaceSolver.hpp:128
SubsurfaceState & state() noexcept
Borrow mutable canonical SI hydraulic state and accumulators.
Definition SubsurfaceSolver.hpp:248
double satVolume(int cell) const noexcept
Water volume of one cell's saturated zone (m³) — the denominator for a saturated concentration.
Definition SubsurfaceSolver.hpp:397
SubsurfaceTransportState & transport() noexcept
The transported tuple, sized from TransportPolicy at initTransport and inert (active() == false) unti...
Definition SubsurfaceSolver.hpp:271
double unsatVolume(int cell) const noexcept
…and of its unsaturated column store (m³), whatever closure holds it.
Definition SubsurfaceSolver.hpp:459
Definition ExchangeLaw.hpp:60
double groundwaterZoneConcentration(const SubsurfaceSolver &gw, int cell, int species, bool saturated)
Derive a reported bulk-zone concentration using the active transport ownership model.
Definition GroundwaterConcentration.hpp:33