42#ifndef OPENSWMM_GROUNDWATER_HPP
43#define OPENSWMM_GROUNDWATER_HPP
45#ifndef OPENSWMM_RESTRICT
47#define OPENSWMM_RESTRICT __restrict
49#define OPENSWMM_RESTRICT __restrict__
58struct SimulationContext;
60namespace groundwater {
79static const char* GW_VAR_NAMES[] = {
"HGW",
"HSW",
"HCB",
"HGS",
"KS",
"K",
80 "THETA",
"PHI",
"FI",
"FU",
"A"};
83static const char* GW_VAR_DESCRIPTIONS[] = {
84 "Water table height above aquifer bottom (ft or m)",
85 "Surface-water head at the receiving node above aquifer bottom (ft or m)",
86 "Channel bottom height above aquifer bottom (Hstar) (ft or m)",
87 "Ground surface height above aquifer bottom (ft or m)",
88 "Saturated hydraulic conductivity (in/hr or mm/hr)",
89 "Unsaturated hydraulic conductivity (in/hr or mm/hr)",
90 "Upper-zone moisture content (fraction)",
91 "Soil porosity (fraction)",
92 "Surface infiltration rate (in/hr or mm/hr)",
93 "Upper-zone percolation rate (in/hr or mm/hr)",
94 "Subcatchment area (ac or ha)"};
110int gwf_validate(
const std::string& expr, std::string& msg,
int& col);
137 std::vector<double>
a3;
188 void init(
int n_subcatch);
221 const double* sw_head,
const double* frac_perv,
const double* perv_evap_rate,
222 int evap_pattern_month = 0);
#define OPENSWMM_RESTRICT
Definition KernelPointers.hpp:9
Mathematical expression parser and evaluator.
Mutable two-zone groundwater state with independent scalar per-subcatchment RKF45....
Definition Groundwater.hpp:181
GWSoA & state()
Borrow mutable aquifer parameters, history, outputs and compiled expressions.
Definition Groundwater.hpp:228
const GWSoA & state() const
Borrow immutable aquifer state and latest endpoint outputs.
Definition Groundwater.hpp:233
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.
Definition Groundwater.cpp:280
void init(int n_subcatch)
Initialize the owned SoA through GWSoA::resize().
Definition Groundwater.cpp:87
GWVar
GW expression variable indices (matching legacy GWvariables enum).
Definition Groundwater.hpp:63
@ GWV_HSW
Surface water head.
Definition Groundwater.hpp:65
@ GWV_HCB
Channel bottom height (h_star)
Definition Groundwater.hpp:66
@ GWV_HGS
Ground surface height (total_depth)
Definition Groundwater.hpp:67
@ GWV_K
Unsaturated conductivity.
Definition Groundwater.hpp:69
@ GWV_FU
Upper zone percolation rate.
Definition Groundwater.hpp:73
@ GWV_A
Subcatchment area.
Definition Groundwater.hpp:74
@ GWV_PHI
Porosity.
Definition Groundwater.hpp:71
@ GWV_HGW
Water table height.
Definition Groundwater.hpp:64
@ GWV_MAX
Definition Groundwater.hpp:75
@ GWV_THETA
Upper zone moisture content.
Definition Groundwater.hpp:70
@ GWV_FI
Surface infiltration rate.
Definition Groundwater.hpp:72
@ GWV_KS
Saturated conductivity.
Definition Groundwater.hpp:68
int gwf_validate(const std::string &expr, std::string &msg, int &col)
Validate a GWF expression and probe the production parser without storing it.
Definition Groundwater.cpp:749
Definition ExchangeLaw.hpp:60
Central, reentrant simulation context.
Definition SimulationContext.hpp:390
Definition Groundwater.hpp:116
void resize(int n)
Resize/reset all scalar groundwater rows while retaining expression prefixes.
Definition Groundwater.cpp:49
std::vector< double > total_depth
Aquifer thickness (ft)
Definition Groundwater.hpp:130
std::vector< double > gw_flow
Lateral GW flux over full subcatchment area (ft/s)
Definition Groundwater.hpp:148
std::vector< double > upper_evap
Upper-zone evaporation flux (ft/s over full area)
Definition Groundwater.hpp:149
std::vector< mathexpr::Expression > lateral_expr
Per-subcatch compiled lateral flow expression (added to standard formula).
Definition Groundwater.hpp:159
std::vector< double > lower_loss_coeff
Deep percolation coeff.
Definition Groundwater.hpp:129
std::vector< double > b2
Surface water interaction.
Definition Groundwater.hpp:136
std::vector< double > theta
Upper zone moisture content (0-φ)
Definition Groundwater.hpp:141
std::vector< double > tension_slope
Definition Groundwater.hpp:125
std::vector< double > porosity
Definition Groundwater.hpp:120
std::vector< double > old_flow
Previous step GW flow (for trapezoidal avg)
Definition Groundwater.hpp:145
std::vector< int > upper_evap_pat
Pattern index for monthly evap adjustment (-1 = none)
Definition Groundwater.hpp:127
std::vector< double > field_cap
Definition Groundwater.hpp:121
std::vector< double > max_infil_vol
Definition Groundwater.hpp:155
std::vector< double > lower_evap_depth
Definition Groundwater.hpp:128
std::vector< double > k_slope
Exponential decay slope.
Definition Groundwater.hpp:124
int n_subcatch
Definition Groundwater.hpp:117
std::vector< double > bottom_elev
Effective aquifer bottom elevation (ft): the [GROUNDWATER] row's Ebot, else the aquifer's.
Definition Groundwater.hpp:132
std::vector< double > deep_loss
Definition Groundwater.hpp:151
std::vector< mathexpr::Expression > deep_expr
Per-subcatch compiled deep percolation expression (replaces standard formula).
Definition Groundwater.hpp:161
std::vector< double > b1
GW outflow.
Definition Groundwater.hpp:135
std::vector< double > wilt_point
Definition Groundwater.hpp:122
std::vector< double > a3
Cross-interaction.
Definition Groundwater.hpp:137
std::vector< double > upper_evap_frac
Definition Groundwater.hpp:126
std::vector< double > lower_depth
Lower zone depth (ft)
Definition Groundwater.hpp:142
std::vector< double > k_sat
Saturated conductivity (ft/sec)
Definition Groundwater.hpp:123
std::vector< double > a1
Definition Groundwater.hpp:135
std::vector< double > h_star
Threshold water table height (ft)
Definition Groundwater.hpp:138
std::vector< double > a2
Definition Groundwater.hpp:136
std::vector< double > lower_evap
Lower-zone evaporation flux (ft/s over full area)
Definition Groundwater.hpp:150