OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
LidNodeExchange.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
11
12#pragma once
13#include "SubsurfaceSolver.hpp"
15#include <functional>
16
17namespace openswmm::twoD {
18// Internal water-only trial, not a runtime activation/receipt publication API.
19// column uses SI relative-to-invert elevations. max_bottom_water supplies the
20// hydraulic owner's receiving allowance (m3), including elastic pressure storage;
21// subtracting initial bottom water bounds the external inflow award only. The
22// owner must still validate the final state after forcing/internal redistribution.
24 int bed = -1;
25 const richards::Column* column = nullptr;
26 double invert = 0, max_bottom_water = 0, clogging = 1;
27};
29 int node = -1, bed = -1, cell = -1;
30 double lid_head = 0, aquifer_head = 0; // absolute SI sample heads, before trial
33 // Accepted sensible-energy packets, J, paired with accepted water. Down
34 // is LID -> aquifer; up is aquifer -> LID. They remain separate because
35 // the groundwater owner may settle the corresponding water later.
37};
39 std::string error;
40 // All arrays have stable ascending node order, independent of caller order.
41 // Original columns and aquifer remain unchanged, including on success.
42 std::vector<richards::Column> columns;
43 std::vector<richards::Report> reports;
44 std::vector<RichardsBedReceipt> receipts;
45 std::vector<std::pair<int, SubsurfaceSolver::NodeWaterBudget>> budgets;
46 int rhs = 0, newton = 0; // both proposal and bounded solves
47};
48// Freeze real cell budgets once, propose on private compatible vector batches,
49// allocate directional awards jointly, then re-solve with ODE volume limits.
50// No area-sum clamp, future-water borrowing, native-soil loss or generic-node
51// debit. The caller must jointly validate/publish actual aquifer receipts and
52// hydraulic trial state; current production mesh/checkpoint guards remain.
62 const std::vector<RichardsBedBinding>&);
63
64// Internal acceptance primitive for an actual due GW owner firing, replacing
65// that firing rather than advancing/pinning the owner at the LID cadence.
66// max_water contains the hydraulic owner's final bounds for EVERY column cell
67// (including surface and elastic storage). It must include accepted forcing.
69 int bed = -1;
71 double invert = 0, clogging = 1;
72 std::vector<double> max_water;
73};
75 double start = 0, end = 0;
76 std::vector<RichardsBedReceipt> receipts; // private accepted water awaiting the GW firing
77};
79 std::string error;
81 double balance = 0; // combined column/GW interval residual, m3
82 double routing_volume = 0; // signed column water supplied/removed by staged native routing, m3
83 std::vector<RichardsBedStep> steps;
84};
85// Serial owner boundary: freeze, trial, settle the real GW closure privately,
86// validate the final hydraulic bounds and matching water, then publish once.
87// Failures leave columns, aquifer, pending surface returns and clocks unchanged.
88// Reviewed R4 water intake/refund receipts share this physical owner firing.
89// Only water is supported. Generic mobile-node receipts are excluded for these
90// beds. Cross-tier routing, joint checkpoint and mesh activation follow.
104 double end, const std::vector<RichardsBedOwner>&);
105// Replace one actual due GW tier firing, preserving ordinary cells on that
106// tier and leaving other tiers/clocks/pending water untouched. The caller must
107// supply every bound Richards bed on the due tier. No cell is pinned/refired.
108// The whole tier, including a late ordinary-cell failure, publishes atomically.
122 double start, double end,
123 const std::vector<RichardsBedOwner>&);
124// Internal pending-receipt sequence. Column vectors advance at these shorter
125// endpoints, with full-window directional budgets frozen once. Incoming water
126// cannot replenish a donor quota or an opposite-direction receiving quota.
127// All staged columns/receipts stay private until the actual GW closure accepts
128// the aggregate at end. Every intermediate hydraulic bound must also qualify.
129// Fixed forcing/materials and frozen GW heads. A synchronous private stepper
130// may reconcile native routing after each column solve, before GW settlement.
131// It must own all mutated routing state privately; failure discards that window.
133 std::function<std::string(
134 double, double, const std::vector<richards::Column>&, const std::vector<richards::Report>&,
135 std::vector<std::vector<double>>&, std::vector<std::pair<double, double>>&)>
136 route; // gross porous withdrawals / bottom intakes, m3
137};
138
151 double start, double end,
152 const std::vector<double>& step_ends,
153 const std::vector<RichardsBedOwner>&,
154 const RichardsBedStepper* stepper = nullptr);
169 double end, const std::vector<double>& step_ends,
170 const std::vector<RichardsBedOwner>&,
171 const RichardsBedStepper* stepper = nullptr);
172}
Richards-equation soil column state and numerical integration.
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
Definition ExchangeLaw.hpp:60
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)
Atomically replace one due groundwater tier and its Richards owners across private short steps.
Definition LidNodeExchange.cpp:1161
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.
Definition LidNodeExchange.cpp:1111
RichardsBedAcceptance acceptRichardsBedsAcrossSteps(SubsurfaceSolver &gw, SurfaceStateData &surface, double start, double end, const std::vector< double > &step_ends, const std::vector< RichardsBedOwner > &input, const RichardsBedStepper *stepper)
Accept selected same-horizon Richards owners together with their groundwater cell firing across priva...
Definition LidNodeExchange.cpp:729
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 int...
Definition LidNodeExchange.cpp:683
RichardsBedTrial trialRichardsBeds(const SubsurfaceSolver &gw, double dt, const std::vector< RichardsBedBinding > &input)
Freeze actual aquifer budgets and compute a private one-interval Richards exchange trial.
Definition LidNodeExchange.cpp:647
Definition RichardsColumn.hpp:37
Definition LidNodeExchange.hpp:78
RichardsBedTrial trial
Definition LidNodeExchange.hpp:80
double balance
Definition LidNodeExchange.hpp:81
double routing_volume
Definition LidNodeExchange.hpp:82
std::string error
Definition LidNodeExchange.hpp:79
std::vector< RichardsBedStep > steps
Definition LidNodeExchange.hpp:83
Definition LidNodeExchange.hpp:23
double clogging
Definition LidNodeExchange.hpp:26
double max_bottom_water
Definition LidNodeExchange.hpp:26
const richards::Column * column
Definition LidNodeExchange.hpp:25
double invert
Definition LidNodeExchange.hpp:26
int bed
Definition LidNodeExchange.hpp:24
Definition LidNodeExchange.hpp:68
double invert
Definition LidNodeExchange.hpp:71
int bed
Definition LidNodeExchange.hpp:69
richards::Column * column
Definition LidNodeExchange.hpp:70
double clogging
Definition LidNodeExchange.hpp:71
std::vector< double > max_water
Definition LidNodeExchange.hpp:72
Definition LidNodeExchange.hpp:28
double reserved_down
Definition LidNodeExchange.hpp:31
int cell
Definition LidNodeExchange.hpp:29
int bed
Definition LidNodeExchange.hpp:29
double reserved_up
Definition LidNodeExchange.hpp:31
double accepted_up_j
Definition LidNodeExchange.hpp:36
int node
Definition LidNodeExchange.hpp:29
double accepted_up
Definition LidNodeExchange.hpp:32
double accepted_down
Definition LidNodeExchange.hpp:32
double unused_down
Definition LidNodeExchange.hpp:32
double aquifer_head
Definition LidNodeExchange.hpp:30
double requested_up
Definition LidNodeExchange.hpp:31
double accepted_down_j
Definition LidNodeExchange.hpp:36
double unused_up
Definition LidNodeExchange.hpp:32
double lid_head
Definition LidNodeExchange.hpp:30
double requested_down
Definition LidNodeExchange.hpp:31
Definition LidNodeExchange.hpp:74
std::vector< RichardsBedReceipt > receipts
Definition LidNodeExchange.hpp:76
double start
Definition LidNodeExchange.hpp:75
double end
Definition LidNodeExchange.hpp:75
Definition LidNodeExchange.hpp:132
std::function< std::string(double, double, const std::vector< richards::Column > &, const std::vector< richards::Report > &, std::vector< std::vector< double > > &, std::vector< std::pair< double, double > > &)> route
Definition LidNodeExchange.hpp:136
Definition LidNodeExchange.hpp:38
std::string error
Definition LidNodeExchange.hpp:39
std::vector< RichardsBedReceipt > receipts
Definition LidNodeExchange.hpp:44
std::vector< richards::Report > reports
Definition LidNodeExchange.hpp:43
int rhs
Definition LidNodeExchange.hpp:46
std::vector< richards::Column > columns
Definition LidNodeExchange.hpp:42
int newton
Definition LidNodeExchange.hpp:46
std::vector< std::pair< int, SubsurfaceSolver::NodeWaterBudget > > budgets
Definition LidNodeExchange.hpp:45
Definition SurfaceStateData.hpp:64