OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::groundwater::GWSolver Class Reference

Mutable two-zone groundwater state with independent scalar per-subcatchment RKF45. One owning simulation thread serializes init/execute/state edits. Initialization supplies defaults only; model loading must populate physical aquifer parameters and compile/bind optional expressions before stepping. No transactional rollback or per-call integration failure result is exposed. More...

#include <Groundwater.hpp>

Collaboration diagram for openswmm::groundwater::GWSolver:

Public Member Functions

void init (int n_subcatch)
 Initialize the owned SoA through GWSoA::resize().
 
void execute (SimulationContext &ctx, double dt, double max_evap, const double *infil_rate, const double *sw_head, const double *frac_perv, const double *perv_evap_rate, int evap_pattern_month=0)
 Integrate each active two-zone aquifer and book its groundwater water balance.
 
GWSoA & state ()
 Borrow mutable aquifer parameters, history, outputs and compiled expressions.
 
const GWSoA & state () const
 Borrow immutable aquifer state and latest endpoint outputs.
 

Detailed Description

Mutable two-zone groundwater state with independent scalar per-subcatchment RKF45. One owning simulation thread serializes init/execute/state edits. Initialization supplies defaults only; model loading must populate physical aquifer parameters and compile/bind optional expressions before stepping. No transactional rollback or per-call integration failure result is exposed.

Member Function Documentation

◆ execute()

void openswmm::groundwater::GWSolver::execute ( SimulationContext & ctx,
double dt,
double max_evap,
const double * infil_rate,
const double * sw_head,
const double * frac_perv,
const double * perv_evap_rate,
int evap_pattern_month = 0 )

Integrate each active two-zone aquifer and book its groundwater water balance.

Parameters
[in,out]ctxCompatible initialized context with at least state().n_subcatch aligned area/receiving-node/forcing rows, valid units/patterns and node hydraulic state. Uses project area to derive ft2 for balance booking. Mass balance totals are incremented; subcatchment/node hydraulic arrays are not directly assigned.
dtFinite positive seconds; divides by dt without a guard.
max_evapFinite nonnegative climate potential ft/s, resolved through each subcatchment's forcing then multiplied by its pervious fraction. DRY_ONLY is not applied to groundwater evaporation.
infil_rateRequired readable n-row ft/s over full subcatchment area.
sw_headRequired readable n-row surface-water head feet above aquifer bottom.
frac_pervRequired readable n-row pervious fraction in [0,1]; nonpositive skips ODE/state update, retaining previous outputs. The later balance loop still visits any positive-thickness aquifer, so caller inputs must be consistent.
perv_evap_rateRequired readable n-row ft/s over full area already removed by the surface, subtracted from available groundwater ET.
evap_pattern_monthOne-based runoff endpoint month; positive uses it, zero or negative uses ctx.current_date. Pattern factors apply only for an available row. Arrays may be null when n==0; otherwise must not alias owned mutable state. Uses RKF45 with legacy tolerance, ignores its status, bounds moisture/head and computes final endpoint rates plus next-step infiltration capacity. Lateral water balance uses old/new trapezoid, other losses endpoint rates. Zero-thickness rows zero four outputs; no general physical/finite validation or rollback. All stored GW/ET/deep outputs are ft/s, multiplied by full area for balance volumes. Custom GWF K uses computed upper-percolation rate; A is passed as ctx.subcatches.area multiplied by LANDAREA conversion as implemented, not independently normalized. Large batches may use the configured OpenMP team for independent aquifers; small batches and one-worker requests bypass parallel regions. Integration workspace is thread-local; the balance fold retains original subcatchment order. Caller owns acceptable model/expression units and accepted-step invocation.
Here is the call graph for this function:

◆ init()

void openswmm::groundwater::GWSolver::init ( int n_subcatch)

Initialize the owned SoA through GWSoA::resize().

Parameters
n_subcatchNonnegative model count with representable/allocatable rows. Resets scalar parameters/history/output to defaults but can retain overlapping compiled expression entries from prior state. Does not load aquifers from a context, compile expressions, update clocks or validate a physical model.

◆ state() [1/2]

GWSoA & openswmm::groundwater::GWSolver::state ( )
inline

Borrow mutable aquifer parameters, history, outputs and compiled expressions.

Returns
Owned SoA valid until destruction; init/resizing invalidates elements. Keep all rows aligned/physically qualified and bound expressions compatible with GW_VAR_NAMES before execute. Serialize edits with integration and other borrows.
Here is the caller graph for this function:

◆ state() [2/2]

const GWSoA & openswmm::groundwater::GWSolver::state ( ) const
inline

Borrow immutable aquifer state and latest endpoint outputs.

Returns
Owned SoA reference valid until destruction, with element storage invalidated by init/resize. Output flux units are ft/s over full area, not cfs. Caller serializes reading against execute and copies snapshots needed across mutation.

The documentation for this class was generated from the following files: