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[] = {
80 "HGW",
"HSW",
"HCB",
"HGS",
"KS",
"K",
81 "THETA",
"PHI",
"FI",
"FU",
"A"
85static const char* GW_VAR_DESCRIPTIONS[] = {
86 "Water table height above aquifer bottom (ft or m)",
87 "Surface-water head at the receiving node above aquifer bottom (ft or m)",
88 "Channel bottom height above aquifer bottom (Hstar) (ft or m)",
89 "Ground surface height above aquifer bottom (ft or m)",
90 "Saturated hydraulic conductivity (in/hr or mm/hr)",
91 "Unsaturated hydraulic conductivity (in/hr or mm/hr)",
92 "Upper-zone moisture content (fraction)",
93 "Soil porosity (fraction)",
94 "Surface infiltration rate (in/hr or mm/hr)",
95 "Upper-zone percolation rate (in/hr or mm/hr)",
96 "Subcatchment area (ac or ha)"
115int gwf_validate(
const std::string& expr, std::string& msg,
int& col);
140 std::vector<double>
a3;
175 void init(
int n_subcatch);
196 const double* infil_rate,
const double* sw_head,
197 const double* frac_perv,
const double* perv_evap_rate);
206 static void batchUpperPerc(
216 static void batchGWFlow(
Mathematical expression parser and evaluator.
#define OPENSWMM_RESTRICT
Definition XSectBatch.hpp:57
Definition Groundwater.hpp:173
GWSoA & state()
Definition Groundwater.hpp:199
const GWSoA & state() const
Definition Groundwater.hpp:200
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)
Compute groundwater for all subcatchments (batch).
Definition Groundwater.cpp:255
void init(int n_subcatch)
Definition Groundwater.cpp:82
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] flow expression without compiling or storing it.
Definition Groundwater.cpp:592
Definition NodeCoupling.cpp:16
Central, reentrant simulation context.
Definition SimulationContext.hpp:353
Definition Groundwater.hpp:121
void resize(int n)
Definition Groundwater.cpp:47
std::vector< double > total_depth
Aquifer thickness (ft)
Definition Groundwater.hpp:135
std::vector< double > gw_flow
Lateral GW flow to node (cfs)
Definition Groundwater.hpp:151
std::vector< double > upper_evap
Upper zone evap (ft3/sec)
Definition Groundwater.hpp:152
std::vector< mathexpr::Expression > lateral_expr
Per-subcatch compiled lateral flow expression (added to standard formula).
Definition Groundwater.hpp:162
std::vector< double > lower_loss_coeff
Deep percolation coeff.
Definition Groundwater.hpp:134
std::vector< double > b2
Surface water interaction.
Definition Groundwater.hpp:139
std::vector< double > theta
Upper zone moisture content (0-φ)
Definition Groundwater.hpp:144
std::vector< double > tension_slope
Definition Groundwater.hpp:130
std::vector< double > porosity
Definition Groundwater.hpp:125
std::vector< double > old_flow
Previous step GW flow (for trapezoidal avg)
Definition Groundwater.hpp:148
std::vector< int > upper_evap_pat
Pattern index for monthly evap adjustment (-1 = none)
Definition Groundwater.hpp:132
std::vector< double > field_cap
Definition Groundwater.hpp:126
std::vector< double > max_infil_vol
Definition Groundwater.hpp:158
std::vector< double > lower_evap_depth
Definition Groundwater.hpp:133
std::vector< double > k_slope
Exponential decay slope.
Definition Groundwater.hpp:129
int n_subcatch
Definition Groundwater.hpp:122
std::vector< double > deep_loss
Definition Groundwater.hpp:154
std::vector< mathexpr::Expression > deep_expr
Per-subcatch compiled deep percolation expression (replaces standard formula).
Definition Groundwater.hpp:164
std::vector< double > b1
GW outflow.
Definition Groundwater.hpp:138
std::vector< double > wilt_point
Definition Groundwater.hpp:127
std::vector< double > a3
Cross-interaction.
Definition Groundwater.hpp:140
std::vector< double > upper_evap_frac
Definition Groundwater.hpp:131
std::vector< double > lower_depth
Lower zone depth (ft)
Definition Groundwater.hpp:145
std::vector< double > k_sat
Saturated conductivity (ft/sec)
Definition Groundwater.hpp:128
std::vector< double > a1
Definition Groundwater.hpp:138
std::vector< double > h_star
Threshold water table height (ft)
Definition Groundwater.hpp:141
std::vector< double > a2
Definition Groundwater.hpp:139
std::vector< double > lower_evap
Lower zone evap (ft3/sec)
Definition Groundwater.hpp:153