![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
The two-zone kernel. Owned by SurfaceRouter2D; driven by the marcher's tier hooks. More...
#include <SubsurfaceSolver.hpp>
Classes | |
| struct | LidBedDiagnostic |
| struct | NodeWaterBudget |
| struct | PendingLidBed |
Public Member Functions | |
| std::string | initialize (const MeshData &mesh, const InertialEdges &edges, const SolverOptions2D &opts, const GwUnitFactors &uf, int n_nodes, SubsurfaceConfig &cfg, std::vector< std::string > &warnings) |
| Resolve the authored rows onto cells, seed state, size the accumulators. | |
| void | bookSurfaceEt (int cell, double dt, double potential_rate, double actual_surface_volume) |
| One surface interval: reserve actual pond evaporation first. No forcing refresh resets this budget. | |
| void | bookAreaEt (int cell, double dt, double potential, double owner_evaporation, double soil_demand) |
| SI completed footprint volumes, already paid by their surface/LID owners. Only soil_demand may reach this cell's extraction site; the rest expires. | |
| bool | active () const noexcept |
| Read whether the resolved groundwater kernel is active. | |
| void | setRechargeBackend (GwRechargeBackend backend) |
| Replace the owned optional pure raw-recharge evaluator descriptor. | |
| const GwRechargeBackend & | rechargeBackend () const noexcept |
| Borrow the current optional raw-recharge extension descriptor. | |
| uint64_t | rechargeBatches () const noexcept |
| Read successful validated raw-recharge extension batch evaluations. | |
| uint64_t | rechargeCells () const noexcept |
| Read the cumulative raw-recharge input rows accepted from successful extension batches. | |
| int | rechargeThreads () const noexcept |
| Query the extension's recorded worker-team size when that callback exists. | |
| const std::vector< uint8_t > & | coverage () const noexcept |
Mesh mode: 1 where a [2D_AQUIFER] row (*, TAG or CELL) covers the cell. An uncovered cell has no aquifer: no storage, no lateral faces, and its infiltration stays with the surface model. All 1 in PER_SUBCATCH mode. | |
| bool | covers (int cell) const noexcept |
| Test resolved aquifer coverage with an index guard. | |
| SubsurfaceState & | state () noexcept |
| Borrow mutable canonical SI hydraulic state and accumulators. | |
| const SubsurfaceState & | state () const noexcept |
| Borrow read-only canonical SI hydraulic state and accumulators. | |
| SubsurfaceTransportState & | transport () noexcept |
The transported tuple, sized from TransportPolicy at initTransport and inert (active() == false) until then. | |
| const SubsurfaceTransportState & | transport () const noexcept |
| Borrow read-only native species/age/temperature transport inventories and ledgers. | |
| GroundHeatState & | heat () noexcept |
| Borrow mutable prepared physical-layer thermal and porewater owner. | |
| const GroundHeatState & | heat () const noexcept |
| Borrow read-only prepared physical-layer thermal and porewater owner. | |
| double | pendingHeat (int cell) const noexcept |
| Read signed unconsumed lateral physical heat for a cell. | |
| std::string | initHeat (SimulationContext &, const GwTransportData &) |
| Initialize canonical porous thermal layers and paired producer/lateral receipt storage. | |
| std::string | initPorewater () |
| Initialize canonical native inventories on fixed physical porous thermal layers. | |
| std::string | refreshSigmaPorewater (int cell) |
| Rebuild fixed-depth porewater overlap/reservations from accepted SIGMA state. | |
| void | refreshSigmaPorewaterReservations (int cell) noexcept |
| Refresh one cell's physical/SIGMA outgoing reservation view without propagating exceptions. | |
| std::string | refreshPorewaterContactLedger () |
| Rebuild the signed soil-side contact receipt from the canonical layer increments after the mesh/channel synchronization has settled. | |
| void | initTransport (const RowLayoutLite &rows, const GwTransportData *gw, const std::vector< double > &pollut_decay, std::vector< std::string > &warnings) |
Size the rows and seed both stores from [GW_INITIAL_QUALITY]. Separate from initialize because the row layout needs the resolved [GW_*] sections, which the router owns. The layout names follow TransportPolicy order. | |
| double | satVolume (int cell) const noexcept |
| Water volume of one cell's saturated zone (m³) — the denominator for a saturated concentration. | |
| double | bookLinkGain (int cell, int species, double vol) noexcept |
A gaining conduit draws vol m³ of water from cell: book the mass it carries, at the cell's dissolved saturated concentration, for the cell to debit at its next firing, and return it (native units). The mass is capped at what the cell holds less what is already pending, so a cell whose saturated zone has emptied cannot export residual mass at a concentration divided by a vanishing volume. | |
| double | unsatVolume (int cell) const noexcept |
| …and of its unsaturated column store (m³), whatever closure holds it. | |
| void | bookInfiltrationMass (int cell, int species, double mass) noexcept |
The surface hands mass down with its infiltration (T7.1 seam): the mass the water it booked through bookInfiltrationFromSurface was carrying, gathered when the GW cell fires. | |
| bool | sourceReceiptOwnershipBound () const |
| Internal reviewed-source ownership. Must bind before pending exchange. | |
| std::string | configureSourceReceipts (const std::vector< int > &cells) |
| Bind exclusive reviewed-source receipt ownership to selected receiver cells. | |
| void | retainSourceReceipt (const SurfaceIntakeReceipt &) |
| Retain intake provenance for a reviewed-source-owned positive receipt. | |
| const std::vector< SurfaceIntakeReceipt > & | pendingSourceReceipts (int cell) const |
| Borrow queued reviewed-source intake provenance for one receiver cell. | |
| double | sourceCompletedTime (int cell) const |
| Read the receiver's completed reviewed-source horizon. | |
| const std::vector< SurfaceReturnReceipt > & | sourceReturns () const |
| Borrow queued source-attributed refunds and physical emergence. | |
| void | acknowledgeSourceReturns (double completed_through) |
| Erase source return receipts whose availability horizon has been adopted. | |
| double | takeToSurfaceMass (int cell, int species) noexcept |
| …and takes back what saturation excess and rejection carried up. Drained by the surface cell in the same call that takes the water. | |
| const GwOptions & | options () const noexcept |
| Borrow the solver's resolved groundwater option copy. | |
| void | refreshDtCell (const MeshData &mesh, const InertialEdges &edges) |
Per-cell stability step min(Δt_g, Δt_u), written into state_.dt_cell. Called once per rebuild; cheap enough to be unconditional (the plan's "they rarely bind"). | |
| double | minDtCell () const noexcept |
G1-c (2026-09-19): the smallest per-cell stability step after refreshDtCell (s), or 1e30 s when no stored value is smaller — the marcher folds it into the ladder's base step so a groundwater cell whose own bound is finer than every active surface cell's does not fire beyond it. | |
| void | assignTiers (double dt0, int n_tiers) |
Assign tiers from dt_cell against the marcher's dt0 and tier count, and rebuild the per-tier cell/face lists. G-A: no surface quantity enters this. | |
| int | requiredTiers (double dt0) const noexcept |
Minimum tier count the ladder needs so it reaches the slowest GW cell (K ≥ 1 + ⌈log2(Δt_gw_max/dt0)⌉, G-A point 3). The marcher grows its ladder to this before assigning. | |
| void | fireGwFaces (int tier, double dt) |
Lateral Darcy on the faces of one tier; books ±ΔV into eacc_L/R. | |
| void | fireGwCells (int tier, double dt, SurfaceStateData &surf, double time=0.0, double accepted_end=-1.0) |
| Gather + closure + node/deep/ET/Dunne for the cells of one tier. accepted_end is the common marcher's exact completed endpoint; owned cells start at their last completed firing, without rounded clock gaps. | |
| RuntimeSources & | runtimeSources () noexcept |
| Borrow mutable copied runtime source prescriptions, receipts and derived lookups. | |
| const RuntimeSources & | runtimeSources () const noexcept |
| Borrow read-only copied runtime source prescriptions, receipts and derived lookups. | |
| void | setBoundaries (std::vector< GwResolvedBoundary >) |
| Replace validated SI exterior boundaries and rebuild their per-cell lookup/stability. | |
| const std::vector< GwResolvedBoundary > & | boundaries () const noexcept |
| Borrow resolved exterior groundwater hydraulic/quality boundary descriptors and receipts. | |
| void | fireGwRk2Cells (double dt, SurfaceStateData &, double time) |
| Run a tier-zero groundwater Euler evaluation within the shared RK2 transaction. | |
| void | advanceRk2Heat (double seconds, double sample_time) |
| Advance independent ground conduction with RK2 at a held thermal forcing sample time. | |
| void | setSources (std::vector< GwResolvedSource > sources) |
| Replace resolved project aquifer sources and rebuild per-cell weighted lookup. | |
| void | settle (SurfaceStateData &surf) |
| Compact drained surface-return bookkeeping before scheduler transitions. Pending edge/node water remains owned until the next paired cell firing. | |
| void | restorePendingSurface () |
| Rebuild pending-surface cell flags/list from positive xacc_to_surface water. | |
| bool | tierHasCells (int tier) const noexcept |
| True when the tier's cell list is non-empty. | |
| bool | tierHasFaces (int tier) const noexcept |
| Test whether one stored tier has a nonempty firing list. | |
| int | tierCount () const noexcept |
| Read the number of stored groundwater cell-tier lists. | |
| const std::vector< long > & | tierFirings () const noexcept |
Per-tier firing counts — the G-A telemetry (swmm_gw2d_get_tier_histogram). | |
| void | bookInfiltrationFromSurface (int cell, double vol_m3) noexcept |
The surface books infiltration it delivered to cell i (m³) at its own (finer) cadence; the GW cell gathers it when it fires. | |
| void | publishInfiltration (SurfaceStateData &surf, double interval, double time) |
| Publish the aquifer's held rate; publication never restores spent storage. | |
| double | acceptSurfaceInfiltration (int cell, double requested, bool prescribed=false) noexcept |
| Reserve and book once, BEFORE the sender removes water (SI m3). Producers for one cell run serially, as for the existing accumulators. | |
| double | infiltrationHeadroom (int cell) const noexcept |
| Compute current unreserved unsaturated receiver capacity. | |
| double | sourceInfiltrationCapacity (int cell, double pond_m, double interval_s) const noexcept |
| Read-only soil/interface rate (m/s) for the actual donor pond head. Group headroom is allocated separately; no front or held rate advances. | |
| void | bookLinkSeepage (int cell, double vol_m3) noexcept |
| G-X3 (2026-09-19): the router books a conduit's seepage volume (m³, SI, its length-weighted share for this cell) at the routing cadence; the GW cell gathers it at its firing as a saturated-zone inflow. | |
| void | bookLinkContact (int cell, double volume, const std::vector< double > &concentration, double elevation_begin, double elevation_end) |
| Accepted leaking reach, with a linear bed elevation over its clipped length. Splits water and producer quality at actual SIGMA interfaces. | |
| int | contactLayer (int cell, double elevation) const noexcept |
| Locate a conduit contact in the current unsaturated SIGMA layers. | |
| double | takeToSurface (int cell) noexcept |
| Volume (m³) the subsurface owes the surface twin — Dunne and exfiltration — drained by the surface at its firing. | |
| const std::vector< int > & | pendingSurfaceCells () const noexcept |
Cells with pending surface-bound water, so the marcher can pin them active (a dry surface cell above an exfiltrating column must route). Call compactPending() first — takeToSurface clears flags but does not erase from this list, because it runs inside the parallel cell loop. | |
| void | compactPending () noexcept |
Drop drained cells from pendingSurfaceCells(). Serial; call from the marcher's rebuild, not from a firing. | |
| void | publishNodeConcentrations (const SimulationContext &ctx) |
T7.4: the node's own species row, [node * n_species + s], published by the router each batch — what a RECHARGING node's water carries down its bed. Null (or a zero row count) means the seam moves water only, which is what every pre-T7.4 deck did. | |
| void | setNodeRowConc (const double *rows, int n_species) noexcept |
| Borrow node-major producer composition for subsequent node/aquifer exchanges. | |
| const std::vector< double > & | nodeExchangeMass () const noexcept |
T7.4: mass the aquifer owes each 1D node this batch ([s * n_nodes + node], + out of the aquifer), flushed by the router into the node's coupling queues alongside the volume. | |
| void | bookLinkSeepageMass (int cell, int species, double mass) noexcept |
T7.4: mass a leaking conduit delivered into one cell, at the conduit's own concentration — the species twin of bookLinkSeepage. | |
| void | sampleNodeExchange (const NodeData *nodes, double dt, double end=-1) |
Node ↔ aquifer exchange, evaluated at tier-0 cadence against the batch-frozen 1D heads and booked into nacc (G-B row 3). The GW cell gathers its share when IT fires — the node is never pinned to the aquifer's tier and the aquifer is never pinned to tier 0. | |
| const std::vector< double > & | nodeExchangeVolumes () const noexcept |
Per-node exchange volume this advance (m³ SI, + out of the aquifer into the pipe). The router books it into nodes.coupling_volume through the same flow_2d_to_1d factor the surface exchange uses. | |
| void | resetNodeExchangeVolumes () noexcept |
| Zero the per-node ledger at the start of a routing batch. | |
| const std::vector< GwNodeBed > & | nodeBeds () const noexcept |
G-O: the [2D_AQUIFER_NODE] beds as resolved (cell index filled), in the authored order — parallel to SurfaceRouter2D::aquiferNodeNames(). | |
| const std::vector< double > & | bedExchangeCumulative () const noexcept |
| G-O: cumulative exchange per bed (m³, + out of the aquifer into the pipe) since the start — the results-file series behind the GUI's GwExchange plot. Never reset. | |
| long | drainCapBinds () const noexcept |
Firings on which the aquifer→node drain cap actually clamped Q. Zero means the deck cannot see anything this cap does. | |
| long | nodeRefunds () const noexcept |
| Firings on which a column went short and the node's share of the overdraw was refunded — into the aquifer's books alone, after the router had already paid the node. The defect's signature: 124 before G-W1, 0 after. | |
| double | specificYieldOf (int cell) const noexcept |
The specific yield the column ACTUALLY uses for cell, from the one definition. Exposed so a test never re-derives it: re-deriving only the CLOSED_FORM branch (as the first version of the G-W1b guard did) silently computes a number the solver never uses under SIGMA or ENSLAVED, and agrees only for as long as every fixture is closure A. | |
| double | unreservedDrainableWater (int cell) const noexcept |
| Compute drainable aquifer water after gross promised exports. | |
| double | unreservedDrainableWater (int cell, double specific_yield) const noexcept |
| double | pendingSaturatedMassExport (int cell, int species) const noexcept |
| Sum nonnegative queued saturated native inventory exports. | |
| std::string | nodeWaterBudget (int cell, double interval, NodeWaterBudget &) const |
| Read a validated finite node-trial water budget for one aquifer cell. | |
| double | cellCompletedTime (int cell) const |
| Read one groundwater cell's accepted firing horizon. | |
| const std::vector< double > & | richardsBedDownCumulative () const noexcept |
| Borrow cumulative accepted LID-to-aquifer water per resolved bed. | |
| const std::vector< double > & | richardsBedUpCumulative () const noexcept |
| Borrow cumulative accepted aquifer-to-LID water per resolved bed. | |
| std::string | configureLidReceipts (const std::vector< int > &beds, const std::vector< int > &mobile={}) |
| Bind reviewed Richards and mobile-LID water/optional-temperature receipt ownership. | |
| std::string | retainLidReceipts (double start, double end, const std::vector< RichardsBedReceipt > &) |
| Adopt a completed reviewed Richards water/heat receipt interval. | |
| std::string | completeLidThermalInterval (SimulationContext &) |
| Publish persistent LID physical energy for the already accepted paired hydraulic interval. | |
| bool | lidReceiptsEnabled () const noexcept |
| Read whether reviewed LID/aquifer receipt ownership was enabled. | |
| double | pendingLidDown (int cell) const noexcept |
| Sum gross pending LID-to-aquifer water across one cell's beds. | |
| double | pendingLidUp (int cell) const noexcept |
| Sum gross pending aquifer-to-LID water across one cell's beds. | |
| double | pendingLidWater () const noexcept |
| Read signed water stored in reviewed LID receipt queues awaiting groundwater adoption. | |
| const std::vector< std::vector< PendingLidBed > > & | pendingLidReceipts () const |
| Borrow per-bed queued accepted LID/aquifer interval receipts. | |
| const std::vector< LidBedDiagnostic > & | lidBedDiagnostics () const |
| Borrow the latest accepted LID/aquifer request/reservation/settlement samples per bed. | |
| double | pendingBedDown (int bed) const noexcept |
| Sum gross unconsumed LID-to-aquifer water for one bed. | |
| double | pendingBedUp (int bed) const noexcept |
| Sum gross unconsumed aquifer-to-LID water for one bed. | |
| void | setLidBedClogging (int bed, double factor) |
| Replace the multiplier applied to one resolved bed's subsequent node exchange conductance. | |
| double | storage () const noexcept |
| Storage now, for the continuity ledger. | |
| void | checkpoint (detail::CompletedSourceArchive &, bool model) |
| Serialize qualified groundwater identity or completed mutable owner state. | |
| void | checkpoint (detail::CompletedSourceArchive &, bool model, const double *held_air) |
| Serialize qualified groundwater identity or completed mutable owner state. | |
| std::string | initReactions (SimulationContext &ctx) |
| Resolve scoped subsurface expression laws into per-cell saturated/unsaturated reactors. | |
| std::string | rk2ProfileError () const |
| Coupled SSP-RK2: spatial CLOSED_FORM/ENSLAVED/SIGMA water only, authored wells and HEAD/FLOW edges. | |
| void | blendRk2Water (const SubsurfaceSolver &initial, double end) |
| Form the conservative half-beginning/half-two-Euler-state SSP groundwater endpoint. | |
| void | publishRk2Infiltration (SurfaceStateData &, double dt, double time) |
| Publish the current coupled stage's bounded instantaneous intake capacity. | |
| bool | hasRk2Reactions () const noexcept |
| Test whether any scoped reactor or positive first-order native decay is configured. | |
| void | advanceRk2Reactions (double seconds) |
| Apply symmetric reaction/decay composition to every covered coupled groundwater cell. | |
| bool | needsTransportRestart () const noexcept |
| Test whether current transport ownership requires its extended restart payload. | |
| std::string | transportRestartState () const |
| Capture the extended groundwater continuation needed beyond the ordinary hotstart payload. | |
| std::string | restoreTransportRestart (const std::string &bytes, bool apply) |
| Validate or adopt an extended groundwater hotstart against this prepared model identity. | |
Friends | |
| class | CommonSourceStage |
| class | ExplicitInertialSolver |
| RichardsBedAcceptance | acceptRichardsBedsAtFiring (SubsurfaceSolver &gw, SurfaceStateData &surface, double start, double end, const std::vector< RichardsBedOwner > &input) |
| Accept selected same-horizon Richards owners together with their groundwater cell firing over one interval. | |
| RichardsBedAcceptance | acceptRichardsBedsForTier (SubsurfaceSolver &gw, SurfaceStateData &surface, int tier, double start, double end, const std::vector< RichardsBedOwner > &owners) |
| Atomically replace one due groundwater tier and its Richards owners over one interval. | |
| RichardsBedAcceptance | acceptRichardsBedsAcrossSteps (SubsurfaceSolver &gw, SurfaceStateData &surface, double start, double end, const std::vector< double > &step_ends, const std::vector< RichardsBedOwner > &input, const RichardsBedStepper *stepper=nullptr) |
| Accept selected same-horizon Richards owners together with their groundwater cell firing across private short steps. | |
| RichardsBedAcceptance | acceptRichardsBedsForTierAcrossSteps (SubsurfaceSolver &gw, SurfaceStateData &surface, int tier, double start, double end, const std::vector< double > &step_ends, const std::vector< RichardsBedOwner > &owners, const RichardsBedStepper *stepper=nullptr) |
| Atomically replace one due groundwater tier and its Richards owners across private short steps. | |
The two-zone kernel. Owned by SurfaceRouter2D; driven by the marcher's tier hooks.
|
noexcept |
Reserve and book once, BEFORE the sender removes water (SI m3). Producers for one cell run serially, as for the existing accumulators.
Reserve a valid surface intake against current groundwater receiver headroom.
| [in] | cell | Prepared covered receiver cell; inactive/uncovered returns zero. |
| [in] | requested | Finite positive requested water volume m3; invalid returns zero. |
| [in] | prescribed | True bypasses the conductivity/published-capacity admission gate. False requires both Ks and a finite positive published infil_capacity; the published rate is a gate, not an additional volume-over-time limit in this method. |
| void openswmm::twoD::SubsurfaceSolver::acknowledgeSourceReturns | ( | double | completed_through | ) |
Erase source return receipts whose availability horizon has been adopted.
| [in] | completed_through | Inclusive elapsed-time horizon s. Caller supplies a valid completed consumer horizon; no finiteness/sign validation occurs. NaN removes none, positive infinity all. |
|
inlinenoexcept |
Read whether the resolved groundwater kernel is active.
| void openswmm::twoD::SubsurfaceSolver::advanceRk2Heat | ( | double | seconds, |
| double | sample_time ) |
Advance independent ground conduction with RK2 at a held thermal forcing sample time.
| [in] | seconds | Finite positive solve interval s; inactive/nonpositive returns, positive infinity throws. NaN is skipped by the nonpositive test rather than explicitly rejected. |
| [in] | sample_time | Finite elapsed forcing horizon s, interpolated without changing table cursors. |
| void openswmm::twoD::SubsurfaceSolver::advanceRk2Reactions | ( | double | seconds | ) |
Apply symmetric reaction/decay composition to every covered coupled groundwater cell.
| [in] | seconds | Finite positive reaction interval s. Inapplicable/nonpositive/NaN returns; positive nonfinite interval throws. |
| void openswmm::twoD::SubsurfaceSolver::assignTiers | ( | double | dt0, |
| int | n_tiers ) |
Assign tiers from dt_cell against the marcher's dt0 and tier count, and rebuild the per-tier cell/face lists. G-A: no surface quantity enters this.
| [in] | dt0 | Finite positive base duration s. Nonpositive selects tier zero; no general finite validation occurs. Prepared dt_cell values govern floor(log2(dt_cell/dt0)) where usable. |
| [in] | n_tiers | Requested tier count, raised to at least one. Must fit stored uint8_t cell/face tiers and caller scheduler shifts; this method does not impose an upper cap. |
|
inlinenoexcept |
G-O: cumulative exchange per bed (m³, + out of the aquifer into the pipe) since the start — the results-file series behind the GUI's GwExchange plot. Never reset.
Borrow cumulative signed exchange per resolved node bed.
| void openswmm::twoD::SubsurfaceSolver::blendRk2Water | ( | const SubsurfaceSolver & | initial, |
| double | end ) |
Form the conservative half-beginning/half-two-Euler-state SSP groundwater endpoint.
| [in] | initial | Immutable beginning-stage solver with identical prepared model, arrays, row and boundary/source identities. Must not alias this mutable solver. |
| [in] | end | Finite accepted elapsed endpoint s, strictly after enabled source cells' initial times. |
| void openswmm::twoD::SubsurfaceSolver::bookAreaEt | ( | int | cell, |
| double | dt, | ||
| double | potential, | ||
| double | evaporation, | ||
| double | soil ) |
SI completed footprint volumes, already paid by their surface/LID owners. Only soil_demand may reach this cell's extraction site; the rest expires.
Book a completed atmospheric finite-volume owner budget.
Book a completed finite atmospheric owner budget for later groundwater demand.
| [in] | cell | Covered prepared cell; inactive, PER_SUBCATCH or uncovered returns without work. |
| [in] | dt | Finite positive completed atmospheric interval s; nonpositive/NaN returns before validation, while positive nonfinite values are rejected. |
| [in] | potential | Finite nonnegative potential loss volume m3. |
| [in] | evaporation | Finite nonnegative owner evaporation volume m3. |
| [in] | soil | Finite nonnegative remaining soil demand m3; evaporation+soil must fit potential within the relative 1e-12 tolerance. Tiny permitted excess is clamped before booking soil demand. |
| std::invalid_argument | Invalid completed budget, before ledger changes. |
|
noexcept |
The surface books infiltration it delivered to cell i (m³) at its own (finer) cadence; the GW cell gathers it when it fires.
| [in] | cell | Prepared covered cell; inactive/uncovered returns without booking. |
| [in] | vol_m3 | Signed pending intake volume m3, added directly without capacity, sign or finite validation. Caller first establishes a physically accepted amount and paired composition. |
|
noexcept |
The surface hands mass down with its infiltration (T7.1 seam): the mass the water it booked through bookInfiltrationFromSurface was carrying, gathered when the GW cell fires.
| [in] | cell | Prepared receiver cell index; invalid indices are ignored. |
| [in] | species | Prepared transport row index; invalid indices or inactive transport are ignored. |
| [in] | mass | Native row inventory (concentration*m3), signed for signed rows. Zero is ignored; no finite-value or sign validation is performed. Caller supplies an amount consistent with the water receipt and row identity. |
| void openswmm::twoD::SubsurfaceSolver::bookLinkContact | ( | int | cell, |
| double | volume, | ||
| const std::vector< double > & | concentration, | ||
| double | elevation_begin, | ||
| double | elevation_end ) |
Accepted leaking reach, with a linear bed elevation over its clipped length. Splits water and producer quality at actual SIGMA interfaces.
| [in] | cell | Prepared covered receiver; inactive/uncovered returns without work. |
| [in] | volume | Positive accepted conduit intake volume m3; nonpositive/NaN returns immediately, positive infinity is rejected by validation. |
| [in] | concentration | Borrowed native concentrations in exact transport row order. Size must match n_species; all values finite and unsigned rows nonnegative. Not retained. |
| [in] | elevation_begin | Finite SI elevation m of one end of the conduit contact segment. |
| [in] | elevation_end | Finite SI elevation m of the other end; equal elevations are allowed. |
| std::invalid_argument | Invalid positive receipt volume, composition or endpoint. |
|
inlinenoexcept |
A gaining conduit draws vol m³ of water from cell: book the mass it carries, at the cell's dissolved saturated concentration, for the cell to debit at its next firing, and return it (native units). The mass is capped at what the cell holds less what is already pending, so a cell whose saturated zone has emptied cannot export residual mass at a concentration divided by a vanishing volume.
| [in] | cell | Zero-based prepared transport cell; invalid returns zero before booking. |
| [in] | species | Transport row index; invalid/inactive transport returns zero. |
| [in] | vol | Finite positive accepted conduit-gain water volume m3; nonpositive/NaN returns zero. |
|
noexcept |
G-X3 (2026-09-19): the router books a conduit's seepage volume (m³, SI, its length-weighted share for this cell) at the routing cadence; the GW cell gathers it at its firing as a saturated-zone inflow.
| [in] | cell | Prepared covered cell; inactive/uncovered returns without booking. |
| [in] | vol_m3 | Signed water volume m3, positive conduit-to-aquifer. No sign, finite-value, availability or headroom validation is performed; caller has accepted and paired the exchange. |
|
noexcept |
T7.4: mass a leaking conduit delivered into one cell, at the conduit's own concentration — the species twin of bookLinkSeepage.
| [in] | cell | Prepared receiver cell index; invalid indices are ignored. |
| [in] | species | Prepared transport row index; invalid indices or inactive transport are ignored. |
| [in] | mass | Native row inventory (concentration*m3), signed for signed rows. Zero is ignored; no finite-value or sign validation is performed. Caller supplies an amount consistent with the water receipt and row identity. |
| void openswmm::twoD::SubsurfaceSolver::bookSurfaceEt | ( | int | cell, |
| double | dt, | ||
| double | rate, | ||
| double | surface ) |
One surface interval: reserve actual pond evaporation first. No forcing refresh resets this budget.
Book unresolved atmospheric soil demand after surface evaporation.
| [in] | cell | Covered prepared cell; inactive, PER_SUBCATCH or uncovered returns without work. |
| [in] | dt | Positive elapsed duration s; nonpositive/NaN returns. Caller supplies finite dt and positive cell area because remaining calculations do not validate them. |
| [in] | rate | Potential atmospheric loss rate m/s, clamped to nonnegative. |
| [in] | surface | Actual surface evaporation volume m3, clamped into [0,rate*area*dt]. |
|
inlinenoexcept |
Borrow resolved exterior groundwater hydraulic/quality boundary descriptors and receipts.
|
inline |
Read one groundwater cell's accepted firing horizon.
| [in] | cell | Valid cell_completed_ index. |
| std::out_of_range | On invalid cell; no synchronization or firing occurs. |
| void openswmm::twoD::SubsurfaceSolver::checkpoint | ( | detail::CompletedSourceArchive & | a, |
| bool | model ) |
Serialize qualified groundwater identity or completed mutable owner state.
Archive groundwater model identity or mutable completed-owner state without a held AIR override.
| [in,out] | a | Caller-owned CompletedSourceArchive. Model mode writes deterministic identity; state mode writes or restores into an already initialized matching model. |
| [in] | model | True selects identity-only layout, false the mutable physical/receipt state. |
| void openswmm::twoD::SubsurfaceSolver::checkpoint | ( | detail::CompletedSourceArchive & | a, |
| bool | model, | ||
| const double * | held_air ) |
Serialize qualified groundwater identity or completed mutable owner state.
Archive qualified groundwater identity or completed hydraulic/native/physical receipt state.
| [in,out] | a | Caller-owned completed-source archive. For model=true use write mode; model identity signal serialization is not a general model reconstruction reader. For model=false read requires identical initialized topology/material/species/forcing identity established externally. |
| [in] | model | True writes physical model, configuration, forcing, thermal/reaction/unit and ownership identity, excluding mutable ledgers; false writes/restores canonical state and receipts. |
| [in] | held_air | Optional readable native engine air temperature degF used only for RK2 porous AIR-boundary model identity. Null samples context climate temperature; pointer is never retained. |
| std::runtime_error | Unsupported restart profile, unqualified Richards ownership, nonfinite/ negative invalid state, mismatched rows/layers/physical reservations/provenance/clocks/tiers or failed physical thermal archive validation. Archive shape/truncation/allocation errors also propagate. |
|
noexcept |
Drop drained cells from pendingSurfaceCells(). Serial; call from the marcher's rebuild, not from a firing.
Remove pending-surface list entries whose cell flags were cleared by drains.
| std::string openswmm::twoD::SubsurfaceSolver::completeLidThermalInterval | ( | SimulationContext & | ctx | ) |
Publish persistent LID physical energy for the already accepted paired hydraulic interval.
Apply completed accepted hydraulic transfers to persistent physical Richards LID energy.
| [in,out] | ctx | Matching context with persistent Richards storage/quality-transfer/port records, node/link producer temperatures degC and prepared material properties; remains alive during call. |
| std::string openswmm::twoD::SubsurfaceSolver::configureLidReceipts | ( | const std::vector< int > & | beds, |
| const std::vector< int > & | mobile = {} ) |
Bind reviewed Richards and mobile-LID water/optional-temperature receipt ownership.
| [in] | beds | Zero-based resolved groundwater bed indices owned by persistent Richards LIDs. |
| [in] | mobile | Zero-based bed indices retaining ordinary mobile-node hydraulic sampling. Lists must be disjoint/duplicate-free, exchange-enabled, resolved and at initial completed time zero, with no pending bed nacc. Empty both returns success without enabling ownership. |
| std::string openswmm::twoD::SubsurfaceSolver::configureSourceReceipts | ( | const std::vector< int > & | cells | ) |
Bind exclusive reviewed-source receipt ownership to selected receiver cells.
| [in] | cells | Zero-based receiver cells; duplicates and an empty list are accepted. Every listed cell must be in range and have no pending surface water or native exchange inventory. |
|
noexcept |
Locate a conduit contact in the current unsaturated SIGMA layers.
| [in] | cell | Covered prepared cell; invalid/uncovered or nonlayered returns -1. |
| [in] | elevation | Finite contact elevation m in the groundwater vertical datum. |
|
inlinenoexcept |
Mesh mode: 1 where a [2D_AQUIFER] row (*, TAG or CELL) covers the cell. An uncovered cell has no aquifer: no storage, no lateral faces, and its infiltration stays with the surface model. All 1 in PER_SUBCATCH mode.
|
inlinenoexcept |
Test resolved aquifer coverage with an index guard.
| [in] | cell | Zero-based cell; negative/out-of-range returns false. |
|
inlinenoexcept |
Firings on which the aquifer→node drain cap actually clamped Q. Zero means the deck cannot see anything this cap does.
| void openswmm::twoD::SubsurfaceSolver::fireGwCells | ( | int | tier, |
| double | dt, | ||
| SurfaceStateData & | surf, | ||
| double | time = 0.0, | ||
| double | accepted_end = -1.0 ) |
Gather + closure + node/deep/ET/Dunne for the cells of one tier. accepted_end is the common marcher's exact completed endpoint; owned cells start at their last completed firing, without rounded clock gaps.
Fire all cells in one due groundwater tier at their accepted ownership horizon.
| [in] | tier | Stored tier index; inactive/absent tier returns after updating source_firing_end_. |
| [in] | dt | Finite positive ordinary firing duration s. |
| [in,out] | surf | Matching surface state/recipient, mutated by accepted cell water/species/heat. |
| [in] | time | Finite ordinary start s. |
| [in] | accepted_end | Negative selects time+dt, otherwise exact completed end s for reviewed source/LID cells using their own previous completion. Must advance every selected owner. |
| std::runtime_error | Richards-owned beds lack enabled joint LID receipt acceptance, or a cell/forcing/thermal preflight rejects later work. |
| void openswmm::twoD::SubsurfaceSolver::fireGwFaces | ( | int | tier, |
| double | dt ) |
Lateral Darcy on the faces of one tier; books ±ΔV into eacc_L/R.
| [in] | tier | Selected stored face tier; inactive or absent tier returns after any required physical/SIGMA view refresh. Negative/out-of-range tier is handled by tierHasFaces(). |
| [in] | dt | Finite positive accepted firing duration s; required by caller, not validated here. |
| void openswmm::twoD::SubsurfaceSolver::fireGwRk2Cells | ( | double | dt, |
| SurfaceStateData & | surface, | ||
| double | time ) |
Run a tier-zero groundwater Euler evaluation within the shared RK2 transaction.
Evaluate one forward-Euler groundwater stage inside an owned shared RK2 transaction.
| [in] | dt | Finite positive stage duration s, caller validated. |
| [in,out] | surface | Matching staged surface owner; receives accepted return water/native state. |
| [in] | time | Finite stage start s. |
|
noexcept |
Test whether any scoped reactor or positive first-order native decay is configured.
|
inlinenoexcept |
Borrow read-only prepared physical-layer thermal and porewater owner.
|
inlinenoexcept |
Borrow mutable prepared physical-layer thermal and porewater owner.
|
noexcept |
Compute current unreserved unsaturated receiver capacity.
| [in] | cell | Zero-based receiver cell; inactive or uncovered cells return zero. |
| std::string openswmm::twoD::SubsurfaceSolver::initHeat | ( | SimulationContext & | ctx, |
| const GwTransportData & | config ) |
Initialize canonical porous thermal layers and paired producer/lateral receipt storage.
Initialize physical porous energy ownership and thermal producer/cross-tier bookkeeping.
| [in,out] | ctx | Prepared engine context and matching native species units/names, borrowed by the physical heat owner for later forcing. Must outlive solver uses and retain compatible identity. |
| [in] | config | Resolved SI groundwater thermal/material controls, borrowed for the physical owner lifetime. Positive valid thermal layer count and phase properties are required. |
| std::string openswmm::twoD::SubsurfaceSolver::initialize | ( | const MeshData & | mesh, |
| const InertialEdges & | edges, | ||
| const SolverOptions2D & | opts, | ||
| const GwUnitFactors & | uf, | ||
| int | n_nodes, | ||
| SubsurfaceConfig & | cfg, | ||
| std::vector< std::string > & | warnings ) |
Resolve the authored rows onto cells, seed state, size the accumulators.
| mesh | cell areas, centroid elevations and tags |
| edges | the marcher's unique interior-edge topology, shared |
| opts | the 2D solver options (LTS ladder, unit factors) |
| uf | project-unit → SI multipliers for the authored rows |
| n_nodes | 1D node count, to size the node-exchange ledger |
| cfg | the authored rows — read, never modified |
| warnings | advisory diagnostics appended here |
SimulationContext. That is not tidiness: it is what lets the numerical gates build a mesh, a soil and a table in twenty lines and check a conservation identity, with no engine, no project file and no units. A kernel that can only be exercised through a full model is a kernel whose failures are found late. | std::string openswmm::twoD::SubsurfaceSolver::initPorewater | ( | ) |
Initialize canonical native inventories on fixed physical porous thermal layers.
| std::string openswmm::twoD::SubsurfaceSolver::initReactions | ( | SimulationContext & | ctx | ) |
Resolve scoped subsurface expression laws into per-cell saturated/unsaturated reactors.
| [in,out] | ctx | Prepared compiled reaction system, borrowed through reactions_ on success; compiled token/term/species tables must remain alive and stable throughout solver use. |
| void openswmm::twoD::SubsurfaceSolver::initTransport | ( | const RowLayoutLite & | rows, |
| const GwTransportData * | gw, | ||
| const std::vector< double > & | pollut_decay, | ||
| std::vector< std::string > & | warnings ) |
Size the rows and seed both stores from [GW_INITIAL_QUALITY]. Separate from initialize because the row layout needs the resolved [GW_*] sections, which the router owns. The layout names follow TransportPolicy order.
| pollut_decay | the engine's [POLLUTANTS] Kdecay column (1/s), row-aligned with the layout — what a [GW_SORPTION] row with no DECAY of its own falls back to. | |
| [in] | rows | Resolved row counts, names and age/temperature indices in transport policy order. Counts, metadata and referenced species must be consistent; layout is copied, not retained. |
| [in] | gw | Optional resolved SI initial quality, dispersion, sorption and groundwater options. Null selects defaults. Borrowed only during this call; scoped layer overrides require SIGMA cells and are rejected for PER_SUBCATCH. Authored decay overrides are per day, converted to 1/s. |
| [in,out] | warnings | Reserved shared initialization diagnostics; this implementation does not append to or clear this vector. Resolution warnings are produced by the upstream resolver. |
|
inline |
Borrow the latest accepted LID/aquifer request/reservation/settlement samples per bed.
|
inlinenoexcept |
Read whether reviewed LID/aquifer receipt ownership was enabled.
|
inlinenoexcept |
G1-c (2026-09-19): the smallest per-cell stability step after refreshDtCell (s), or 1e30 s when no stored value is smaller — the marcher folds it into the ladder's base step so a groundwater cell whose own bound is finer than every active surface cell's does not fire beyond it.
|
inlinenoexcept |
Test whether current transport ownership requires its extended restart payload.
|
inlinenoexcept |
G-O: the [2D_AQUIFER_NODE] beds as resolved (cell index filled), in the authored order — parallel to SurfaceRouter2D::aquiferNodeNames().
Borrow resolved authored node/aquifer beds.
|
inlinenoexcept |
T7.4: mass the aquifer owes each 1D node this batch ([s * n_nodes + node], + out of the aquifer), flushed by the router into the node's coupling queues alongside the volume.
Borrow per-batch node transport export in species-major [species*n_nodes+node] order.
|
inlinenoexcept |
Per-node exchange volume this advance (m³ SI, + out of the aquifer into the pipe). The router books it into nodes.coupling_volume through the same flow_2d_to_1d factor the surface exchange uses.
Borrow per-batch water exchange per 1D node.
|
inlinenoexcept |
Firings on which a column went short and the node's share of the overdraw was refunded — into the aquifer's books alone, after the router had already paid the node. The defect's signature: 124 before G-W1, 0 after.
| std::string openswmm::twoD::SubsurfaceSolver::nodeWaterBudget | ( | int | cell, |
| double | interval, | ||
| NodeWaterBudget & | out ) const |
Read a validated finite node-trial water budget for one aquifer cell.
Preflight a finite aquifer node-trial donor/receiver budget without booking water.
| [in] | cell | Covered prepared active cell index; rejects invalid/inactive input. |
| [in] | interval | Finite positive proposed duration s, including interval deep-loss reservation. |
| [out] | out | Replaced only on success by SI head m, unreserved donor m3 and receiver headroom m3. |
|
inlinenoexcept |
Borrow the solver's resolved groundwater option copy.
|
noexcept |
Sum gross unconsumed LID-to-aquifer water for one bed.
| [in] | bed | Valid prepared index into node_pending_down_ and lid_receipts_, unchecked. |
|
noexcept |
Sum gross unconsumed aquifer-to-LID water for one bed.
| [in] | bed | Valid prepared index into node_pending_up_ and lid_receipts_, unchecked. |
|
noexcept |
Read signed unconsumed lateral physical heat for a cell.
Sum one cell's unconsumed incident physical conductive energy packets.
| [in] | i | Prepared cell index, called cell in the declaration; invalid or absent mapping returns zero. |
|
noexcept |
Sum gross pending LID-to-aquifer water across one cell's beds.
| [in] | cell | Valid prepared cell_beds_ index, unchecked; bed lookup/receipt shapes must match. |
|
inline |
Borrow per-bed queued accepted LID/aquifer interval receipts.
|
noexcept |
Sum gross pending aquifer-to-LID water across one cell's beds.
| [in] | cell | Valid prepared cell_beds_ index, unchecked; bed lookup/receipt shapes must match. |
|
noexcept |
Read signed water stored in reviewed LID receipt queues awaiting groundwater adoption.
|
noexcept |
Sum nonnegative queued saturated native inventory exports.
| [in] | cell | Valid prepared cell with matching edge CSR; unchecked. |
| [in] | species | Valid transport row with consistent edge-major lateral arrays; unchecked. |
|
inline |
Borrow queued reviewed-source intake provenance for one receiver cell.
| [in] | cell | Valid source_receipts_ vector index. |
| std::out_of_range | On an invalid cell; caller provides stable solver access. |
|
inlinenoexcept |
Cells with pending surface-bound water, so the marcher can pin them active (a dry surface cell above an exfiltrating column must route). Call compactPending() first — takeToSurface clears flags but does not erase from this list, because it runs inside the parallel cell loop.
| void openswmm::twoD::SubsurfaceSolver::publishInfiltration | ( | SurfaceStateData & | surf, |
| double | interval, | ||
| double | time ) |
Publish the aquifer's held rate; publication never restores spent storage.
Refresh published intake capacity and available volume for every groundwater cell.
| [in,out] | surf | Surface state receiving infil_rate where that array covers a cell. Missing surface depths are treated as zero ponding; the remaining groundwater arrays must be prepared. |
| [in] | interval | Positive publication duration s. Inactive solver or nonpositive/NaN duration returns without work; caller supplies a finite value for meaningful volume/rate conversion. |
| [in] | time | Elapsed refresh timestamp s, stored without validation. |
| void openswmm::twoD::SubsurfaceSolver::publishNodeConcentrations | ( | const SimulationContext & | ctx | ) |
T7.4: the node's own species row, [node * n_species + s], published by the router each batch — what a RECHARGING node's water carries down its bed. Null (or a zero row count) means the seam moves water only, which is what every pre-T7.4 deck did.
Copy current canonical 1D composition into a stable groundwater producer tuple buffer.
| [in] | ctx | Prepared matching node pollutant/MSX/age/heat state. MSX is matched by exact row name; missing optional backing entries yield zero. Age remains seconds and temperature degC. |
| void openswmm::twoD::SubsurfaceSolver::publishRk2Infiltration | ( | SurfaceStateData & | surface, |
| double | dt, | ||
| double | time ) |
Publish the current coupled stage's bounded instantaneous intake capacity.
Publish one RK2 stage's instantaneous closure-dependent surface intake rate.
| [in,out] | surface | Matching prepared surface depth/rate arrays; writes infil_rate for covered cells. |
| [in] | dt | Finite positive stage duration s, required for headroom cap and singular-front startup. |
| [in] | time | Finite elapsed stage publication timestamp s. |
|
inlinenoexcept |
Borrow the current optional raw-recharge extension descriptor.
|
inlinenoexcept |
Read successful validated raw-recharge extension batch evaluations.
|
inlinenoexcept |
Read the cumulative raw-recharge input rows accepted from successful extension batches.
|
inlinenoexcept |
Query the extension's recorded worker-team size when that callback exists.
| void openswmm::twoD::SubsurfaceSolver::refreshDtCell | ( | const MeshData & | mesh, |
| const InertialEdges & | edges ) |
Per-cell stability step min(Δt_g, Δt_u), written into state_.dt_cell. Called once per rebuild; cheap enough to be unconditional (the plan's "they rarely bind").
Recompute each active groundwater cell's explicit water/transport/thermal stability duration.
| [in] | mesh | Stable SI centroids for dispersion gradients, matching prepared hydraulic cells. |
| [in] | edges | Matching saturated-flow CSR/face geometry; PER_SUBCATCH may have no lateral faces. |
| std::string openswmm::twoD::SubsurfaceSolver::refreshPorewaterContactLedger | ( | ) |
Rebuild the signed soil-side contact receipt from the canonical layer increments after the mesh/channel synchronization has settled.
| std::string openswmm::twoD::SubsurfaceSolver::refreshSigmaPorewater | ( | int | i | ) |
Rebuild fixed-depth porewater overlap/reservations from accepted SIGMA state.
Reconcile the current SIGMA canonical reactors with fixed-depth physical porewater views.
| [in] | i | Valid prepared cell index, called cell in the declaration; unchecked. |
|
noexcept |
Refresh one cell's physical/SIGMA outgoing reservation view without propagating exceptions.
| [in] | cell | Valid prepared thermal cell index, unchecked even on failure handling. |
|
noexcept |
Minimum tier count the ladder needs so it reaches the slowest GW cell (K ≥ 1 + ⌈log2(Δt_gw_max/dt0)⌉, G-A point 3). The marcher grows its ladder to this before assigning.
| [in] | dt0 | Finite positive candidate base step s; inactive/nonpositive returns one. |
|
noexcept |
Zero the per-node ledger at the start of a routing batch.
Clear the per-batch node water exchange and held-node-water draw reservations.
|
inline |
Rebuild pending-surface cell flags/list from positive xacc_to_surface water.
| std::string openswmm::twoD::SubsurfaceSolver::restoreTransportRestart | ( | const std::string & | bytes, |
| bool | apply ) |
Validate or adopt an extended groundwater hotstart against this prepared model identity.
| [in] | bytes | Binary envelope from transportRestartState(), borrowed only for the call. Empty is accepted only when this model needs no extended transport/source-clock restart profile. |
| [in] | apply | False performs full private read/validation only; true move-adopts the validated private solver and rebinds its owned node concentration pointer when present. |
| std::string openswmm::twoD::SubsurfaceSolver::retainLidReceipts | ( | double | start, |
| double | end, | ||
| const std::vector< RichardsBedReceipt > & | rows ) |
Adopt a completed reviewed Richards water/heat receipt interval.
Retain one completed paired Richards interval after shared groundwater capacity preflight.
| [in] | start | Finite nonnegative elapsed interval start s, exactly each bed's prior booked end. |
| [in] | end | Finite elapsed end s, strictly greater than start. |
| [in] | rows | Unique owned-bed receipts with matching node/cell identity and finite nonnegative accepted down/up m3 plus finite signed sensible J. Zero accepted water requires zero associated J. Both directions retain gross provenance; borrowed data is copied into queues on success. |
| void openswmm::twoD::SubsurfaceSolver::retainSourceReceipt | ( | const SurfaceIntakeReceipt & | r | ) |
Retain intake provenance for a reviewed-source-owned positive receipt.
| [in] | r | Receipt with a valid prepared request.cell index, elapsed times s, volume m3 and matching native row amounts. Cell access is unchecked even when volume is nonpositive. |
|
inlinenoexcept |
Borrow cumulative accepted LID-to-aquifer water per resolved bed.
|
inlinenoexcept |
Borrow cumulative accepted aquifer-to-LID water per resolved bed.
| std::string openswmm::twoD::SubsurfaceSolver::rk2ProfileError | ( | ) | const |
Coupled SSP-RK2: spatial CLOSED_FORM/ENSLAVED/SIGMA water only, authored wells and HEAD/FLOW edges.
|
inlinenoexcept |
Borrow read-only copied runtime source prescriptions, receipts and derived lookups.
|
inlinenoexcept |
Borrow mutable copied runtime source prescriptions, receipts and derived lookups.
| void openswmm::twoD::SubsurfaceSolver::sampleNodeExchange | ( | const NodeData * | nodes, |
| double | dt, | ||
| double | end = -1 ) |
Node ↔ aquifer exchange, evaluated at tier-0 cadence against the batch-frozen 1D heads and booked into nacc (G-B row 3). The GW cell gathers its share when IT fires — the node is never pinned to the aquifer's tier and the aquifer is never pinned to tier 0.
| nodes | 1D node data, or nullptr when nothing is coupled. | |
| [in] | dt | Finite positive sampling duration s, required by the caller; no duration validation is performed here. Caps use max(dt,kTiny), whereas accepted volume uses Q*dt directly. |
| [in] | end | Elapsed sample end time s for mobile-LID diagnostics; a negative value selects the receiver cell's completed time. Does not advance the cell or node clock. |
|
inlinenoexcept |
Water volume of one cell's saturated zone (m³) — the denominator for a saturated concentration.
| [in] | cell | Valid prepared cell index in [0,state_.n_cells); bounds are unchecked. |
| void openswmm::twoD::SubsurfaceSolver::setBoundaries | ( | std::vector< GwResolvedBoundary > | rows | ) |
Replace validated SI exterior boundaries and rebuild their per-cell lookup/stability.
Replace resolved exterior groundwater boundaries and rebuild cell lookup/stability.
| [in] | rows | Owned resolved SI boundaries, moved into solver. Every row.cell must be a valid prepared cell and its signal/geometry/quality metadata must be validated before this call. |
|
inline |
Replace the multiplier applied to one resolved bed's subsequent node exchange conductance.
| [in] | bed | Valid lid_bed_factor_ index. |
| [in] | factor | Intended finite nonnegative dimensionless conductance factor; no finite/range check or clipping is performed here. |
| std::out_of_range | On invalid bed. Changes no already accepted water/receipt and performs no ownership activation; caller serializes the update with node sampling. |
|
inlinenoexcept |
Borrow node-major producer composition for subsequent node/aquifer exchanges.
| [in] | rows | Optional contiguous buffer [node*n_species+species] covering every referenced 1D node. Values use each row's native concentration, age or temperature units. Null disables pairing. |
| [in] | n_species | Published row stride/count; zero disables pairing, otherwise must match the prepared transport identity. Negative values and buffer extents are not validated. |
|
inline |
Replace the owned optional pure raw-recharge evaluator descriptor.
| [in] | backend | Owned callback/capability/diagnostic value moved into the solver. Empty evaluate selects ordinary CPU computation. Captured plugin/library resources must remain valid through every callback; this method performs no probing, ABI validation or output-cache reset itself. |
| void openswmm::twoD::SubsurfaceSolver::setSources | ( | std::vector< GwResolvedSource > | sources | ) |
Replace resolved project aquifer sources and rebuild per-cell weighted lookup.
| [in] | sources | Owned resolved SI source definitions, moved into solver. Invalid cell entries are skipped, while source signal/species shapes and weights must already be validated. |
| void openswmm::twoD::SubsurfaceSolver::settle | ( | SurfaceStateData & | surf | ) |
Compact drained surface-return bookkeeping before scheduler transitions. Pending edge/node water remains owned until the next paired cell firing.
| [in,out] | surf | Retained interface argument, unused; canonical surface state is unchanged. |
|
inline |
Read the receiver's completed reviewed-source horizon.
| [in] | cell | Valid source_cell_end_ index. |
| std::out_of_range | On invalid cell. No queue drain, validation or synchronization occurs. |
|
noexcept |
Read-only soil/interface rate (m/s) for the actual donor pond head. Group headroom is allocated separately; no front or held rate advances.
Compute a closure-dependent ponded intake rate without reserving volume.
| [in] | i | Receiver cell index; inactive or uncovered returns zero. |
| [in] | pond | Finite nonnegative ponding depth m; invalid returns zero. |
| [in] | interval | Finite positive intake duration s; invalid returns zero. |
|
inline |
Internal reviewed-source ownership. Must bind before pending exchange.
|
inline |
Borrow queued source-attributed refunds and physical emergence.
|
noexcept |
The specific yield the column ACTUALLY uses for cell, from the one definition. Exposed so a test never re-derives it: re-deriving only the CLOSED_FORM branch (as the first version of the G-W1b guard did) silently computes a number the solver never uses under SIGMA or ENSLAVED, and agrees only for as long as every fixture is closure A.
| [in] | cell | Prepared hydraulic cell; negative/out-of-range hg index returns zero. Remaining parallel cell/material arrays must have matching extents and valid closure parameters. |
|
inlinenoexcept |
Borrow read-only canonical SI hydraulic state and accumulators.
|
inlinenoexcept |
Borrow mutable canonical SI hydraulic state and accumulators.
|
inlinenoexcept |
Storage now, for the continuity ledger.
|
noexcept |
Volume (m³) the subsurface owes the surface twin — Dunne and exfiltration — drained by the surface at its firing.
| [in] | cell | Prepared receiver cell; inactive/invalid returns zero. |
|
noexcept |
…and takes back what saturation excess and rejection carried up. Drained by the surface cell in the same call that takes the water.
| [in] | cell | Receiver cell; invalid/inactive transport returns zero. |
| [in] | species | Transport row; invalid returns zero. |
|
inlinenoexcept |
Read the number of stored groundwater cell-tier lists.
|
inlinenoexcept |
Per-tier firing counts — the G-A telemetry (swmm_gw2d_get_tier_histogram).
|
inlinenoexcept |
True when the tier's cell list is non-empty.
Test whether one stored tier has a nonempty firing list.
| [in] | tier | Zero-based tier index; negative/out-of-range returns false. |
|
inlinenoexcept |
Test whether one stored tier has a nonempty firing list.
| [in] | tier | Zero-based tier index; negative/out-of-range returns false. |
|
inlinenoexcept |
Borrow read-only native species/age/temperature transport inventories and ledgers.
|
inlinenoexcept |
The transported tuple, sized from TransportPolicy at initTransport and inert (active() == false) until then.
Borrow mutable native species/age/temperature transport inventories and ledgers.
| std::string openswmm::twoD::SubsurfaceSolver::transportRestartState | ( | ) | const |
Capture the extended groundwater continuation needed beyond the ordinary hotstart payload.
|
noexcept |
Compute drainable aquifer water after gross promised exports.
| [in] | cell | Valid prepared cell index, with consistent bed/edge/contact arrays; unchecked. |
|
noexcept |
|
inlinenoexcept |
…and of its unsaturated column store (m³), whatever closure holds it.
| [in] | cell | Valid prepared cell index; all hu/area arrays must cover it. |
|
friend |
Accept selected same-horizon Richards owners together with their groundwater cell firing across private short steps.
Accept private Richards trials at the actual due groundwater owner boundary.
| [in,out] | gw | Initialized idle qualified water-only spatial groundwater owner with valid joint clock extension and gather_fraction_=1. Candidate hydraulic/receipt/clock state is copied privately. |
| [in,out] | surface | Matching qualified water-only surface state, including prepared infiltration rates and pending return ownership. Staged with groundwater before live adoption. |
| [in] | start | Finite nonnegative elapsed start s, exactly each selected completed groundwater/ reviewed-source owner horizon. |
| [in] | end | Finite elapsed end s, strictly after start and matching any completed reviewed-source horizon. Accepted endpoint is installed exactly rather than recomputed by repeated additions. |
| [in] | step_ends | Nonempty strictly increasing finite elapsed endpoints s in (start,end], ending exactly at end. Each intermediate/final column must satisfy the supplied full hydraulic bounds. |
| [in] | input | Borrowed owner descriptors with distinct nonnull writable column pointers and resolved beds. SI invert/clogging and max_water m3 for every physical cell, including mobile/elastic storage; original and every accepted state must lie within those bounds. All beds sharing a selected cell must be supplied. Input order is independent of node-sorted trial reporting. |
| [in] | stepper | Optional synchronous private routing callback between trial endpoints. Must own all routed state privately and keep it alive; supplies per-column revised water plus gross porous withdrawal/bottom-intake claims m3. Claimed original budgets cannot be replenished by opposite/future traffic. Nonempty callback error or caught std::exception rejects the staged window. |
The groundwater/surface references and writable column descriptors must be prepared for the qualified water-only profile and accessed exclusively. start/end are finite elapsed seconds with end>start and exact compatible owner clocks. A tier argument selects one complete due tier; step_ends, when present, strictly cover the same interval ending exactly at end. An optional stepper must own all routing effects privately. Full argument, result, SI buffer/bound and staged publication contracts are documented on the source definition.
|
friend |
Accept selected same-horizon Richards owners together with their groundwater cell firing over one interval.
Accept private Richards trials at the actual due groundwater owner boundary.
| [in,out] | gw | Initialized idle qualified water-only spatial groundwater owner with valid joint clock extension and gather_fraction_=1. Candidate hydraulic/receipt/clock state is copied privately. |
| [in,out] | surface | Matching qualified water-only surface state, including prepared infiltration rates and pending return ownership. Staged with groundwater before live adoption. |
| [in] | start | Finite nonnegative elapsed start s, exactly each selected completed groundwater/ reviewed-source owner horizon. |
| [in] | end | Finite elapsed end s, strictly after start and matching any completed reviewed-source horizon. Accepted endpoint is installed exactly rather than recomputed by repeated additions. |
| [in] | input | Borrowed owner descriptors with distinct nonnull writable column pointers and resolved beds. SI invert/clogging and max_water m3 for every physical cell, including mobile/elastic storage; original and every accepted state must lie within those bounds. All beds sharing a selected cell must be supplied. Input order is independent of node-sorted trial reporting. |
The groundwater/surface references and writable column descriptors must be prepared for the qualified water-only profile and accessed exclusively. start/end are finite elapsed seconds with end>start and exact compatible owner clocks. A tier argument selects one complete due tier; step_ends, when present, strictly cover the same interval ending exactly at end. An optional stepper must own all routing effects privately. Full argument, result, SI buffer/bound and staged publication contracts are documented on the source definition.
|
friend |
Atomically replace one due groundwater tier and its Richards owners over one interval.
Accept private Richards trials at the actual due groundwater owner boundary.
| [in,out] | gw | Initialized idle qualified water-only spatial groundwater owner with valid joint clock extension and gather_fraction_=1. Candidate hydraulic/receipt/clock state is copied privately. |
| [in,out] | surface | Matching qualified water-only surface state, including prepared infiltration rates and pending return ownership. Staged with groundwater before live adoption. |
| [in] | tier | Valid due tier with stored cells; every selected cell and source clock must equal start. Every bound Richards bed on this tier must appear in owners. Ordinary cells on the due tier also fire once; other tiers retain their clocks/receipts. |
| [in] | start | Finite nonnegative elapsed start s, exactly each selected completed groundwater/ reviewed-source owner horizon. |
| [in] | end | Finite elapsed end s, strictly after start and matching any completed reviewed-source horizon. Accepted endpoint is installed exactly rather than recomputed by repeated additions. |
| [in] | owners | Borrowed owner descriptors with distinct nonnull writable column pointers and resolved beds. SI invert/clogging and max_water m3 for every physical cell, including mobile/elastic storage; original and every accepted state must lie within those bounds. All beds sharing a selected cell must be supplied. Input order is independent of node-sorted trial reporting. |
The groundwater/surface references and writable column descriptors must be prepared for the qualified water-only profile and accessed exclusively. start/end are finite elapsed seconds with end>start and exact compatible owner clocks. A tier argument selects one complete due tier; step_ends, when present, strictly cover the same interval ending exactly at end. An optional stepper must own all routing effects privately. Full argument, result, SI buffer/bound and staged publication contracts are documented on the source definition.
|
friend |
Atomically replace one due groundwater tier and its Richards owners across private short steps.
Accept private Richards trials at the actual due groundwater owner boundary.
| [in,out] | gw | Initialized idle qualified water-only spatial groundwater owner with valid joint clock extension and gather_fraction_=1. Candidate hydraulic/receipt/clock state is copied privately. |
| [in,out] | surface | Matching qualified water-only surface state, including prepared infiltration rates and pending return ownership. Staged with groundwater before live adoption. |
| [in] | tier | Valid due tier with stored cells; every selected cell and source clock must equal start. Every bound Richards bed on this tier must appear in owners. Ordinary cells on the due tier also fire once; other tiers retain their clocks/receipts. |
| [in] | start | Finite nonnegative elapsed start s, exactly each selected completed groundwater/ reviewed-source owner horizon. |
| [in] | end | Finite elapsed end s, strictly after start and matching any completed reviewed-source horizon. Accepted endpoint is installed exactly rather than recomputed by repeated additions. |
| [in] | step_ends | Nonempty strictly increasing finite elapsed endpoints s in (start,end], ending exactly at end. Each intermediate/final column must satisfy the supplied full hydraulic bounds. |
| [in] | owners | Borrowed owner descriptors with distinct nonnull writable column pointers and resolved beds. SI invert/clogging and max_water m3 for every physical cell, including mobile/elastic storage; original and every accepted state must lie within those bounds. All beds sharing a selected cell must be supplied. Input order is independent of node-sorted trial reporting. |
| [in] | stepper | Optional synchronous private routing callback between trial endpoints. Must own all routed state privately and keep it alive; supplies per-column revised water plus gross porous withdrawal/bottom-intake claims m3. Claimed original budgets cannot be replenished by opposite/future traffic. Nonempty callback error or caught std::exception rejects the staged window. |
The groundwater/surface references and writable column descriptors must be prepared for the qualified water-only profile and accessed exclusively. start/end are finite elapsed seconds with end>start and exact compatible owner clocks. A tier argument selects one complete due tier; step_ends, when present, strictly cover the same interval ending exactly at end. An optional stepper must own all routing effects privately. Full argument, result, SI buffer/bound and staged publication contracts are documented on the source definition.
|
friend |
|
friend |