70#ifndef OPENSWMM_ENGINE_2D_SUBSURFACE_SOLVER_HPP
71#define OPENSWMM_ENGINE_2D_SUBSURFACE_SOLVER_HPP
158 void bookSurfaceEt(
int cell,
double dt,
double potential_rate,
double actual_surface_volume);
167 void bookAreaEt(
int cell,
double dt,
double potential,
double owner_evaporation,
176 bool active() const noexcept {
return state_.active; }
215 return recharge_backend_.threads ? recharge_backend_.threads() : 0;
228 const std::vector<uint8_t>&
coverage() const noexcept {
return covered_; }
236 return cell >= 0 &&
static_cast<std::size_t
>(cell) < covered_.size() &&
237 covered_[
static_cast<std::size_t
>(cell)] != 0;
388 const std::vector<double>& pollut_decay, std::vector<std::string>& warnings);
398 const auto u =
static_cast<std::size_t
>(cell);
399 return state_.hg[u] * state_.theta_s[u] * state_.area[u];
424 if (!tr_.active() || !(vol > 0.0) || cell < 0 || cell >= tr_.n_cells || species < 0 ||
425 species >= tr_.n_species)
430 const auto u =
static_cast<std::size_t
>(cell);
431 const auto k = tr_.idx(species, cell);
432 const double mob = tr_.dissolvedFraction(species, cell, state_.theta_s[u]);
433 double m = vol * (tr_.sat_mass[k] / v) * mob;
434 if (heat_.active() && species == tr_.temp_row) {
435 heat_link_out_volume_[u] += vol;
436 bookPresetHeatOut(cell, vol, m);
438 if (!tr_.signedRow(species)) {
441 m = std::min(m, avail);
445 bookPresetPorewaterOut(cell, species, m);
446 tr_.lout_mass[k] += m;
447 if (tr_.n_layers > 0 && heat_.active())
460 const auto u =
static_cast<std::size_t
>(cell);
461 return state_.hu[u] * state_.area[u];
487 return std::any_of(source_owned_.begin(), source_owned_.end(), [](
bool x) { return x; });
512 return source_receipts_.at(cell);
530 const std::vector<SurfaceReturnReceipt>&
sourceReturns()
const {
return source_returns_; }
596 for (
const double v : state_.dt_cell)
673 double accepted_end = -1.0);
708 const std::vector<GwResolvedBoundary>&
boundaries() const noexcept {
return boundaries_; }
745 void setSources(std::vector<GwResolvedSource> sources);
768 pending_surface_.clear();
769 std::fill(pending_flag_.begin(), pending_flag_.end(), 0);
770 for (
int i = 0; i < state_.n_cells; ++i)
771 if (state_.xacc_to_surface[i] > 0.0)
772 markPendingSurface(i);
784 return tier >= 0 && tier < static_cast<int>(cells_by_tier_.size()) &&
785 !cells_by_tier_[
static_cast<std::size_t
>(tier)].empty();
794 return tier >= 0 && tier < static_cast<int>(faces_by_tier_.size()) &&
795 !faces_by_tier_[
static_cast<std::size_t
>(tier)].empty();
802 int tierCount() const noexcept {
return static_cast<int>(cells_by_tier_.size()); }
811 const std::vector<long>&
tierFirings() const noexcept {
return tier_firings_; }
922 void bookLinkContact(
int cell,
double volume, const std::vector<
double>& concentration,
923 double elevation_begin,
double elevation_end);
932 int contactLayer(
int cell,
double elevation) const noexcept;
1000 node_row_conc_ = rows;
1001 node_row_ns_ = n_species;
1176 return richards_down_cum_;
1209 const std::vector<int>& mobile = {});
1221 std::string
retainLidReceipts(
double start,
double end,
const std::vector<RichardsBedReceipt>&);
1277 return lid_receipts_;
1329 double storage() const noexcept {
return state_.storage(); }
1426 return tr_.n_layers > 0 || !tr_.generated_age.empty() || !boundaries_.empty() ||
1427 !reactors_.empty() ||
1428 (tr_.active() && std::any_of(source_owned_.begin(), source_owned_.end(),
1429 [](
bool owned) { return owned; }));
1465 double infiltrationStorageDeficit(
int cell)
const noexcept;
1471 const std::vector<RichardsBedOwner>&);
1473 int,
double,
double,
1474 const std::vector<RichardsBedOwner>&);
1477 const std::vector<double>&,
1478 const std::vector<RichardsBedOwner>&,
1499 std::vector<std::string>& warnings);
1510 void resolveClosures(std::vector<std::string>& warnings);
1571 void fireGwCellList(
const std::vector<int>&,
double dt,
SurfaceStateData&,
double time,
1572 double accepted_end);
1573 std::vector<bool> source_owned_;
1574 std::vector<std::string> source_species_;
1575 std::vector<double> source_cell_end_;
1576 std::vector<std::vector<SurfaceIntakeReceipt>> source_receipts_;
1577 std::vector<SurfaceReturnReceipt> source_returns_;
1578 double source_firing_end_ = 0.0;
1579 double source_completed_end_ =
1581 double gather_fraction_ = 1.0;
1590 double consumePending(
double& value)
noexcept {
1591 const double take = value * gather_fraction_;
1603 double link_out = 0;
1605 double boundary_in = 0, boundary_out = 0;
1606 const std::vector<GwBoundaryPulse>* boundaries =
nullptr;
1607 double hg_final = 0;
1608 double runtime_dt = 0.0, requested_source_out = 0.0;
1609 double v_sat0 = 0.0, v_uns0 = 0.0;
1610 double lateral = 0.0;
1611 double node_out = 0.0;
1612 double infil_in = 0.0;
1614 double source_in = 0.0, source_out = 0.0;
1615 const std::vector<double>* source_mass =
nullptr;
1616 double recharge = 0.0;
1624 double handover = 0.0;
1625 double grid_volume =
1627 double lid_in_j = 0.0;
1632 double paired_refund = 0.0;
1633 const std::vector<double>* refund_mass =
nullptr;
1634 std::vector<double>* dunne_mass =
nullptr;
1635 std::vector<double>* excess_mass =
nullptr;
1636 double reject = 0.0;
1638 std::vector<std::string> transport_units_;
1639 struct GroundReactor {
1640 std::vector<ReactionExprForm> forms;
1641 std::vector<RxExprSpan> expressions;
1643 const ReactionData* reactions_ =
nullptr;
1644 transport::RxWorkspace reaction_workspace_;
1645 std::vector<GroundReactor> reactors_;
1646 std::string reaction_identity_;
1664 void reactCell(
int cell,
double dt,
double hg);
1690 void fireCellSpecies(
int i,
const CellFlux& f);
1691 void fireLayerSpecies(
int i,
const CellFlux& f);
1709 void reactPorewaterCell(
int cell,
double dt,
double hg);
1730 void fireGroundHeatSpecies(
int i,
const CellFlux& f)
noexcept;
1739 std::string groundWaterIncrement(
int cell,
const CellFlux&, std::vector<double>&)
const;
1740 void fireGroundPorewaterSpecies(
int i,
const CellFlux& f)
noexcept;
1753 double gatherLateral(
int i)
noexcept;
1764 double gatherLateralMass(
int i,
int s)
noexcept;
1766 bool scopeCoversCell(
int i,
GwScope scope,
const std::string& tag,
int cell)
const noexcept;
1768 double gatherNodeMass(
int i,
int s)
noexcept;
1770 double pollutantDecay(
int s,
const std::vector<double>& pollut_decay)
const noexcept;
1783 double gatherNode(
int i)
noexcept;
1790 double specificYield(std::size_t u,
const soil::Params& p,
double ts,
double L0,
GwClosure cl,
1791 double* theta_bot_out)
const noexcept;
1792 void markPendingSurface(
int i)
noexcept;
1794 void publishCellInfiltration(
int, SurfaceStateData&,
double interval,
double time);
1795 std::vector<std::vector<std::size_t>> cell_beds_;
1796 RuntimeSources runtime_sources_;
1797 std::vector<GwResolvedBoundary> boundaries_;
1798 std::vector<std::vector<std::size_t>> cell_boundaries_;
1799 std::vector<GwResolvedSource> sources_;
1800 std::vector<std::vector<std::pair<std::size_t, double>>> cell_sources_;
1801 SubsurfaceState state_;
1802 SubsurfaceTransportState tr_;
1803 GroundHeatState heat_;
1804 std::vector<double> heat_link_out_volume_;
1808 heat_preset_out_water_;
1809 std::vector<double> heat_node_out_volume_,
1810 heat_node_gathered_out_;
1811 std::vector<double> porewater_preset_out_;
1821 void bookPresetHeatOut(
int cell,
double volume,
double temperature_volume)
noexcept;
1831 std::string conductGroundWithLids(
int cell,
double seconds);
1842 void bookPresetPorewaterOut(
int cell,
int species,
double mass)
noexcept;
1851 double saturatedPorewaterMobileMass(
int cell,
int species)
const noexcept;
1852 struct ThermalFaceSlice {
1853 int left = 0, right = 0;
1854 double low = 0, high = 0;
1856 struct ThermalFace {
1857 double distance_left = 0, distance_right = 0;
1858 std::vector<ThermalFaceSlice> slices;
1860 std::vector<ThermalFace> heat_faces_;
1861 std::vector<double> heat_pending_left_, heat_pending_right_, heat_dt_;
1875 std::string initLateralHeat();
1884 void fireLateralHeatFace(
int edge,
double seconds);
1892 void gatherLateralHeat(
int cell)
noexcept;
1894 std::vector<GwNodeBed> node_beds_;
1895 std::vector<double> bed_exchange_cum_;
1898 std::vector<double> cell_completed_, richards_down_cum_, richards_up_cum_;
1899 std::vector<bool> richards_bed_owned_;
1900 bool lid_receipts_enabled_ =
false;
1901 std::vector<std::vector<PendingLidBed>> lid_receipts_;
1902 std::vector<double> lid_booked_end_;
1903 std::vector<bool> mobile_lid_bed_;
1904 std::vector<double> lid_bed_factor_;
1905 std::vector<double> node_pending_down_, node_pending_up_;
1906 std::vector<LidBedDiagnostic> lid_bed_diagnostics_;
1907 bool richards_clock_valid_ =
true;
1912 std::vector<double> bed_gathered_;
1917 std::vector<double> node_drawn_gw_;
1919 std::vector<double> node_concentrations_;
1920 const double* node_row_conc_ =
nullptr;
1921 int node_row_ns_ = 0;
1923 const MeshData* mesh_ =
nullptr;
1924 const InertialEdges* edges_ =
nullptr;
1925 const SolverOptions2D* opts_ =
nullptr;
1927 GwRechargeBackend recharge_backend_;
1928 std::vector<OpenSwmmGwRechargeInputV1> recharge_inputs_;
1929 std::vector<double> recharge_values_;
1930 std::vector<int> recharge_slots_;
1931 uint64_t recharge_batches_ = 0, recharge_cells_ = 0;
1932 void prepareRechargeBatch(
const std::vector<int>&);
1933 double rawRecharge(
int cell,
const soil::Params&,
double length)
const noexcept;
1935 std::vector<std::vector<int>> cells_by_tier_;
1936 std::vector<std::vector<int>> faces_by_tier_;
1937 std::vector<uint8_t> face_tier_;
1938 std::vector<long> tier_firings_;
1939 std::vector<int> pending_surface_;
1940 std::vector<uint8_t> pending_flag_;
1941 std::vector<int> cell_nface_;
1942 std::vector<double> node_exchange_vol_;
1943 long drain_cap_binds_ = 0;
1944 long node_refunds_ = 0;
1945 bool accumulators_pending_ =
false;
1949 std::vector<int> subcatch_outlet_node_;
1952 std::vector<int> cell_subcatch_;
1955 std::vector<uint8_t> covered_;
1957 int bed_gathered_cell_ = -1;
1958 bool et_boundary_ =
false, et_caprise_ =
false;
1959 std::vector<int> reaction_rows_;
1964 struct CellScratch {
1965 std::vector<double> receipt_mass;
1966 std::vector<double> refund_mass, dunne_mass, excess_mass;
1967 CellScratch() =
default;
1968 CellScratch(
const CellScratch&)
noexcept {}
1969 CellScratch& operator=(
const CellScratch&)
noexcept {
return *
this; }
1970 CellScratch(CellScratch&&) noexcept = default;
1971 CellScratch& operator=(CellScratch&&) noexcept = default;
Conservative surface exchange reservations and donor water limits.
Thermal state and exchange bookkeeping for fixed ground layers.
Groundwater boundary forcing series and evaluation.
Backend contract for groundwater recharge operations.
Immutable groundwater source series in elapsed simulation time.
Reaction kinetics integration over one reaction step (phase R3): EUL / RK5 (Cash–Karp) / ROS2 / BDF2 ...
Runtime coupling state and canonical transport exchange quantities.
G-steps 4 and 5 — closure B: the σ-coordinate explicit unsaturated column with a moving lower boundar...
G-step 1 — state, parameters and options for the two-zone groundwater kernel (TWO_ZONE_GROUNDWATER_EX...
T7.1 — species / age / enthalpy carried by the two-zone groundwater kernel (GW transport plan §3....
Definition CompletedSourceArchive.hpp:25
The two-zone kernel. Owned by SurfaceRouter2D; driven by the marcher's tier hooks.
Definition SubsurfaceSolver.hpp:128
const std::vector< SurfaceIntakeReceipt > & pendingSourceReceipts(int cell) const
Borrow queued reviewed-source intake provenance for one receiver cell.
Definition SubsurfaceSolver.hpp:511
double sourceCompletedTime(int cell) const
Read the receiver's completed reviewed-source horizon.
Definition SubsurfaceSolver.hpp:522
std::string configureLidReceipts(const std::vector< int > &beds, const std::vector< int > &mobile={})
Bind reviewed Richards and mobile-LID water/optional-temperature receipt ownership.
Definition LidNodeExchange.cpp:26
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 separ...
Definition SubsurfaceSolver.cpp:1968
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 ...
Definition SubsurfaceSolver.cpp:489
void setSources(std::vector< GwResolvedSource > sources)
Replace resolved project aquifer sources and rebuild per-cell weighted lookup.
Definition SubsurfaceSolver.cpp:4148
std::string rk2ProfileError() const
Coupled SSP-RK2: spatial CLOSED_FORM/ENSLAVED/SIGMA water only, authored wells and HEAD/FLOW edges.
Definition SubsurfaceSolver.cpp:4438
bool tierHasCells(int tier) const noexcept
True when the tier's cell list is non-empty.
Definition SubsurfaceSolver.hpp:783
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.
Definition SubsurfaceSolver.cpp:2142
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 resul...
Definition SubsurfaceSolver.hpp:1097
friend class ExplicitInertialSolver
Definition SubsurfaceSolver.hpp:1468
double pendingBedDown(int bed) const noexcept
Sum gross unconsumed LID-to-aquifer water for one bed.
Definition LidNodeExchange.cpp:53
SubsurfaceState & state() noexcept
Borrow mutable canonical SI hydraulic state and accumulators.
Definition SubsurfaceSolver.hpp:248
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...
Definition SubsurfaceSolver.cpp:4220
std::string nodeWaterBudget(int cell, double interval, NodeWaterBudget &) const
Read a validated finite node-trial water budget for one aquifer cell.
Definition SubsurfaceSolver.cpp:1494
const std::vector< double > & richardsBedUpCumulative() const noexcept
Borrow cumulative accepted aquifer-to-LID water per resolved bed.
Definition SubsurfaceSolver.hpp:1185
std::string initHeat(SimulationContext &, const GwTransportData &)
Initialize canonical porous thermal layers and paired producer/lateral receipt storage.
Definition SubsurfaceSolver.cpp:3171
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 produce...
Definition SubsurfaceSolver.cpp:2047
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 ...
Definition SubsurfaceSolver.hpp:957
void refreshSigmaPorewaterReservations(int cell) noexcept
Refresh one cell's physical/SIGMA outgoing reservation view without propagating exceptions.
Definition SubsurfacePorewater.cpp:139
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 specie...
Definition SubsurfaceSolver.cpp:1338
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 aqui...
Definition SubsurfaceSolver.hpp:228
long drainCapBinds() const noexcept
Firings on which the aquifer→node drain cap actually clamped Q. Zero means the deck cannot see anythi...
Definition SubsurfaceSolver.hpp:1117
std::string configureSourceReceipts(const std::vector< int > &cells)
Bind exclusive reviewed-source receipt ownership to selected receiver cells.
Definition SubsurfaceSolver.cpp:1819
const std::vector< long > & tierFirings() const noexcept
Per-tier firing counts — the G-A telemetry (swmm_gw2d_get_tier_histogram).
Definition SubsurfaceSolver.hpp:811
void retainSourceReceipt(const SurfaceIntakeReceipt &)
Retain intake provenance for a reviewed-source-owned positive receipt.
Definition SubsurfaceSolver.cpp:1845
std::string transportRestartState() const
Capture the extended groundwater continuation needed beyond the ordinary hotstart payload.
Definition SubsurfaceCheckpoint.cpp:718
bool lidReceiptsEnabled() const noexcept
Read whether reviewed LID/aquifer receipt ownership was enabled.
Definition SubsurfaceSolver.hpp:1239
GroundHeatState & heat() noexcept
Borrow mutable prepared physical-layer thermal and porewater owner.
Definition SubsurfaceSolver.hpp:289
double takeToSurface(int cell) noexcept
Volume (m³) the subsurface owes the surface twin — Dunne and exfiltration — drained by the surface at...
Definition SubsurfaceSolver.cpp:2101
const std::vector< SurfaceReturnReceipt > & sourceReturns() const
Borrow queued source-attributed refunds and physical emergence.
Definition SubsurfaceSolver.hpp:530
double pendingLidUp(int cell) const noexcept
Sum gross pending aquifer-to-LID water across one cell's beds.
Definition LidNodeExchange.cpp:74
void publishRk2Infiltration(SurfaceStateData &, double dt, double time)
Publish the current coupled stage's bounded instantaneous intake capacity.
Definition SubsurfaceSolver.cpp:4597
double pendingSaturatedMassExport(int cell, int species) const noexcept
Sum nonnegative queued saturated native inventory exports.
Definition SubsurfaceSolver.cpp:1466
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...
Definition SubsurfaceSolver.cpp:2026
int tierCount() const noexcept
Read the number of stored groundwater cell-tier lists.
Definition SubsurfaceSolver.hpp:802
const std::vector< double > & nodeExchangeVolumes() const noexcept
Per-node exchange volume this advance (m³ SI, + out of the aquifer into the pipe)....
Definition SubsurfaceSolver.hpp:1066
const SubsurfaceState & state() const noexcept
Borrow read-only canonical SI hydraulic state and accumulators.
Definition SubsurfaceSolver.hpp:255
bool hasRk2Reactions() const noexcept
Test whether any scoped reactor or positive first-order native decay is configured.
Definition SubsurfaceReactions.cpp:425
void advanceRk2Heat(double seconds, double sample_time)
Advance independent ground conduction with RK2 at a held thermal forcing sample time.
Definition SubsurfaceSolver.cpp:4207
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,...
Definition SubsurfaceSolver.cpp:1998
int rechargeThreads() const noexcept
Query the extension's recorded worker-team size when that callback exists.
Definition SubsurfaceSolver.hpp:214
std::string initReactions(SimulationContext &ctx)
Resolve scoped subsurface expression laws into per-cell saturated/unsaturated reactors.
Definition SubsurfaceReactions.cpp:49
void publishInfiltration(SurfaceStateData &surf, double interval, double time)
Publish the aquifer's held rate; publication never restores spent storage.
Definition SubsurfaceSolver.cpp:1914
void setLidBedClogging(int bed, double factor)
Replace the multiplier applied to one resolved bed's subsequent node exchange conductance.
Definition SubsurfaceSolver.hpp:1319
uint64_t rechargeBatches() const noexcept
Read successful validated raw-recharge extension batch evaluations.
Definition SubsurfaceSolver.hpp:199
double storage() const noexcept
Storage now, for the continuity ledger.
Definition SubsurfaceSolver.hpp:1329
const std::vector< double > & richardsBedDownCumulative() const noexcept
Borrow cumulative accepted LID-to-aquifer water per resolved bed.
Definition SubsurfaceSolver.hpp:1175
void blendRk2Water(const SubsurfaceSolver &initial, double end)
Form the conservative half-beginning/half-two-Euler-state SSP groundwater endpoint.
Definition SubsurfaceSolver.cpp:4635
void setNodeRowConc(const double *rows, int n_species) noexcept
Borrow node-major producer composition for subsequent node/aquifer exchanges.
Definition SubsurfaceSolver.hpp:999
double specificYieldOf(int cell) const noexcept
The specific yield the column ACTUALLY uses for cell, from the one definition. Exposed so a test neve...
Definition SubsurfaceSolver.cpp:1417
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/fac...
Definition SubsurfaceSolver.cpp:644
RuntimeSources & runtimeSources() noexcept
Borrow mutable copied runtime source prescriptions, receipts and derived lookups.
Definition SubsurfaceSolver.hpp:683
bool tierHasFaces(int tier) const noexcept
Test whether one stored tier has a nonempty firing list.
Definition SubsurfaceSolver.hpp:793
friend class CommonSourceStage
Definition SubsurfaceSolver.hpp:1467
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 ro...
Definition SubsurfaceSolver.cpp:1603
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 ...
Definition SubsurfaceSolver.hpp:1086
const GwRechargeBackend & rechargeBackend() const noexcept
Borrow the current optional raw-recharge extension descriptor.
Definition SubsurfaceSolver.hpp:193
std::string refreshSigmaPorewater(int cell)
Rebuild fixed-depth porewater overlap/reservations from accepted SIGMA state.
Definition SubsurfacePorewater.cpp:90
void fireGwFaces(int tier, double dt)
Lateral Darcy on the faces of one tier; books ±ΔV into eacc_L/R.
Definition SubsurfaceSolver.cpp:699
void setBoundaries(std::vector< GwResolvedBoundary >)
Replace validated SI exterior boundaries and rebuild their per-cell lookup/stability.
Definition SubsurfaceSolver.cpp:4139
const SubsurfaceTransportState & transport() const noexcept
Borrow read-only native species/age/temperature transport inventories and ledgers.
Definition SubsurfaceSolver.hpp:279
const std::vector< GwResolvedBoundary > & boundaries() const noexcept
Borrow resolved exterior groundwater hydraulic/quality boundary descriptors and receipts.
Definition SubsurfaceSolver.hpp:708
long nodeRefunds() const noexcept
Firings on which a column went short and the node's share of the overdraw was refunded — into the aqu...
Definition SubsurfaceSolver.hpp:1127
double unreservedDrainableWater(int cell) const noexcept
Compute drainable aquifer water after gross promised exports.
Definition SubsurfaceSolver.cpp:1437
double pendingLidDown(int cell) const noexcept
Sum gross pending LID-to-aquifer water across one cell's beds.
Definition LidNodeExchange.cpp:65
void compactPending() noexcept
Drop drained cells from pendingSurfaceCells(). Serial; call from the marcher's rebuild,...
Definition SubsurfaceSolver.cpp:2116
const std::vector< std::vector< PendingLidBed > > & pendingLidReceipts() const
Borrow per-bed queued accepted LID/aquifer interval receipts.
Definition SubsurfaceSolver.hpp:1276
double pendingBedUp(int bed) const noexcept
Sum gross unconsumed aquifer-to-LID water for one bed.
Definition LidNodeExchange.cpp:59
std::string completeLidThermalInterval(SimulationContext &)
Publish persistent LID physical energy for the already accepted paired hydraulic interval.
Definition LidNodeExchange.cpp:295
double cellCompletedTime(int cell) const
Read one groundwater cell's accepted firing horizon.
Definition SubsurfaceSolver.hpp:1167
void settle(SurfaceStateData &surf)
Compact drained surface-return bookkeeping before scheduler transitions. Pending edge/node water rema...
Definition SubsurfaceSolver.cpp:4318
const GwOptions & options() const noexcept
Borrow the solver's resolved groundwater option copy.
Definition SubsurfaceSolver.hpp:561
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 int...
Definition SubsurfaceSolver.cpp:1119
bool active() const noexcept
Read whether the resolved groundwater kernel is active.
Definition SubsurfaceSolver.hpp:176
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)⌉,...
Definition SubsurfaceSolver.cpp:631
bool sourceReceiptOwnershipBound() const
Internal reviewed-source ownership. Must bind before pending exchange.
Definition SubsurfaceSolver.hpp:486
std::string initPorewater()
Initialize canonical native inventories on fixed physical porous thermal layers.
Definition SubsurfacePorewater.cpp:23
bool covers(int cell) const noexcept
Test resolved aquifer coverage with an index guard.
Definition SubsurfaceSolver.hpp:235
int contactLayer(int cell, double elevation) const noexcept
Locate a conduit contact in the current unsaturated SIGMA layers.
Definition SubsurfaceSolver.cpp:2035
bool needsTransportRestart() const noexcept
Test whether current transport ownership requires its extended restart payload.
Definition SubsurfaceSolver.hpp:1425
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
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 ...
Definition SubsurfaceSolver.hpp:423
std::string refreshPorewaterContactLedger()
Rebuild the signed soil-side contact receipt from the canonical layer increments after the mesh/chann...
Definition SubsurfacePorewater.cpp:149
std::string restoreTransportRestart(const std::string &bytes, bool apply)
Validate or adopt an extended groundwater hotstart against this prepared model identity.
Definition SubsurfaceCheckpoint.cpp:730
const RuntimeSources & runtimeSources() const noexcept
Borrow read-only copied runtime source prescriptions, receipts and derived lookups.
Definition SubsurfaceSolver.hpp:690
void acknowledgeSourceReturns(double completed_through)
Erase source return receipts whose availability horizon has been adopted.
Definition SubsurfaceSolver.cpp:1849
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...
Definition SubsurfaceReactions.cpp:25
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.
Definition SubsurfaceSolver.cpp:305
double takeToSurfaceMass(int cell, int species) noexcept
…and takes back what saturation excess and rejection carried up. Drained by the surface cell in the s...
Definition SubsurfaceSolver.cpp:1853
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 b...
Definition SubsurfaceSolver.cpp:1809
friend RichardsBedAcceptance acceptRichardsBedsForTierAcrossSteps(SubsurfaceSolver &, SurfaceStateData &, int, double, double, const std::vector< double > &, const std::vector< RichardsBedOwner > &, const RichardsBedStepper *)
Atomically replace one due groundwater tier and its Richards owners across private short steps.
Definition LidNodeExchange.cpp:1161
SubsurfaceTransportState & transport() noexcept
The transported tuple, sized from TransportPolicy at initTransport and inert (active() == false) unti...
Definition SubsurfaceSolver.hpp:271
double pendingLidWater() const noexcept
Read signed water stored in reviewed LID receipt queues awaiting groundwater adoption.
Definition LidNodeExchange.cpp:83
void restorePendingSurface()
Rebuild pending-surface cell flags/list from positive xacc_to_surface water.
Definition SubsurfaceSolver.hpp:767
double unsatVolume(int cell) const noexcept
…and of its unsaturated column store (m³), whatever closure holds it.
Definition SubsurfaceSolver.hpp:459
uint64_t rechargeCells() const noexcept
Read the cumulative raw-recharge input rows accepted from successful extension batches.
Definition SubsurfaceSolver.hpp:207
const GroundHeatState & heat() const noexcept
Borrow read-only prepared physical-layer thermal and porewater owner.
Definition SubsurfaceSolver.hpp:296
void advanceRk2Reactions(double seconds)
Apply symmetric reaction/decay composition to every covered coupled groundwater cell.
Definition SubsurfaceReactions.cpp:429
friend RichardsBedAcceptance acceptRichardsBedsForTier(SubsurfaceSolver &, SurfaceStateData &, int, double, double, const std::vector< RichardsBedOwner > &)
Atomically replace one due groundwater tier and its Richards owners over one interval.
Definition LidNodeExchange.cpp:1111
void resetNodeExchangeVolumes() noexcept
Zero the per-node ledger at the start of a routing batch.
Definition SubsurfaceSolver.cpp:1114
friend RichardsBedAcceptance acceptRichardsBedsAcrossSteps(SubsurfaceSolver &, SurfaceStateData &, double, double, const std::vector< double > &, const std::vector< RichardsBedOwner > &, const RichardsBedStepper *)
Accept selected same-horizon Richards owners together with their groundwater cell firing across priva...
Definition LidNodeExchange.cpp:729
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 ga...
Definition SubsurfaceSolver.cpp:2015
void fireGwRk2Cells(double dt, SurfaceStateData &, double time)
Run a tier-zero groundwater Euler evaluation within the shared RK2 transaction.
Definition SubsurfaceSolver.cpp:4170
double infiltrationHeadroom(int cell) const noexcept
Compute current unreserved unsaturated receiver capacity.
Definition SubsurfaceSolver.cpp:1870
std::string retainLidReceipts(double start, double end, const std::vector< RichardsBedReceipt > &)
Adopt a completed reviewed Richards water/heat receipt interval.
Definition LidNodeExchange.cpp:111
friend RichardsBedAcceptance acceptRichardsBedsAtFiring(SubsurfaceSolver &, SurfaceStateData &, double, double, const std::vector< RichardsBedOwner > &)
Accept selected same-horizon Richards owners together with their groundwater cell firing over one int...
Definition LidNodeExchange.cpp:683
double minDtCell() const noexcept
G1-c (2026-09-19): the smallest per-cell stability step after refreshDtCell (s), or 1e30 s when no st...
Definition SubsurfaceSolver.hpp:594
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),...
Definition SubsurfaceSolver.hpp:1015
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 ...
Definition SubsurfaceSolver.cpp:2172
double pendingHeat(int cell) const noexcept
Read signed unconsumed lateral physical heat for a cell.
Definition SubsurfaceSolver.cpp:3141
void setRechargeBackend(GwRechargeBackend backend)
Replace the owned optional pure raw-recharge evaluator descriptor.
Definition SubsurfaceSolver.hpp:186
const std::vector< LidBedDiagnostic > & lidBedDiagnostics() const
Borrow the latest accepted LID/aquifer request/reservation/settlement samples per bed.
Definition SubsurfaceSolver.hpp:1291
Definition OutfallExchange.hpp:17
Definition MeshCheckpointState.hpp:18
Definition ExchangeLaw.hpp:60
GwScope
Scope of a per-cell row.
Definition GwTransportData.hpp:65
GwClosure
Unsaturated-zone closure, resolved per cell from AUTO at initialize.
Definition SubsurfaceData.hpp:70
Definition ExchangeLaw.hpp:60
Structure-of-Arrays storage for all nodes.
Definition NodeData.hpp:125
Central, reentrant simulation context.
Definition SimulationContext.hpp:390
Definition GroundHeat.hpp:45
Definition SubsurfaceData.hpp:79
[2D_AQUIFER_OPTIONS]. Defaults are the plan's starred values.
Definition SubsurfaceData.hpp:142
Definition GwRechargeBackend.hpp:17
Every [GW_*] authoring row of one model.
Definition GwTransportData.hpp:187
Project-unit → SI multipliers for the four kinds of aquifer number.
Definition SubsurfaceData.hpp:374
Canonical unique interior-edge layout + per-cell incidence for the local-inertial scheme.
Definition InertialEdges.hpp:60
SoA storage for 2D mixed triangle/quad mesh geometry and topology.
Definition MeshData.hpp:65
Definition LidNodeExchange.hpp:78
Definition LidNodeExchange.hpp:68
Definition LidNodeExchange.hpp:28
Definition LidNodeExchange.hpp:132
Definition SubsurfaceSolver.hpp:114
std::vector< std::string > names
Definition SubsurfaceSolver.hpp:120
int n_species
Definition SubsurfaceSolver.hpp:115
int age_row
Definition SubsurfaceSolver.hpp:118
int n_msx
Definition SubsurfaceSolver.hpp:117
int temp_row
Definition SubsurfaceSolver.hpp:119
int n_pollut
Definition SubsurfaceSolver.hpp:116
Definition RuntimeCoupling.hpp:44
Definition SolverOptions2D.hpp:257
Everything the parser fills, before resolution onto cells.
Definition SubsurfaceData.hpp:391
Definition SubsurfaceSolver.hpp:1279
double end
Definition SubsurfaceSolver.hpp:1280
double accepted_down
Definition SubsurfaceSolver.hpp:1282
double reserved_up
Definition SubsurfaceSolver.hpp:1281
double start
Definition SubsurfaceSolver.hpp:1280
double reserved_down
Definition SubsurfaceSolver.hpp:1281
double groundwater_head
Definition SubsurfaceSolver.hpp:1280
double requested_down
Definition SubsurfaceSolver.hpp:1281
double lid_head
Definition SubsurfaceSolver.hpp:1280
double requested_up
Definition SubsurfaceSolver.hpp:1281
double accepted_up
Definition SubsurfaceSolver.hpp:1282
double groundwater_time
Definition SubsurfaceSolver.hpp:1280
Definition SubsurfaceSolver.hpp:1148
double receiver
Definition SubsurfaceSolver.hpp:1149
double donor
Definition SubsurfaceSolver.hpp:1149
double head
Definition SubsurfaceSolver.hpp:1149
Definition SubsurfaceSolver.hpp:1188
double end
Definition SubsurfaceSolver.hpp:1189
double up
Definition SubsurfaceSolver.hpp:1189
double down_j
Definition SubsurfaceSolver.hpp:1189
double start
Definition SubsurfaceSolver.hpp:1189
bool heat_applied
Definition SubsurfaceSolver.hpp:1190
double down
Definition SubsurfaceSolver.hpp:1189
double up_j
Definition SubsurfaceSolver.hpp:1189
Per-cell resolved parameters and state (SoA).
Definition SubsurfaceData.hpp:219
Species mass in both aquifer zones, and where mass crossed a boundary.
Definition SubsurfaceTransportState.hpp:69
Definition SurfaceExchange.hpp:35
Definition SurfaceStateData.hpp:64
Definition SigmaColumn.hpp:91
Definition SoilCharacteristic.hpp:91