OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
Infiltration.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2//
3// Copyright 2026 Caleb Buahin
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
33
34#ifndef OPENSWMM_INFILTRATION_HPP
35#define OPENSWMM_INFILTRATION_HPP
36
37namespace openswmm {
38
40
41// ============================================================================
42// Infiltration model type
43// ============================================================================
44
45enum class InfilModel : int {
46 HORTON = 0,
53};
54
55// ============================================================================
56// Horton infiltration state (per subcatchment)
57// ============================================================================
58
60 double f0 = 0.0;
61 double fmin = 0.0;
62 double decay = 0.0;
63 double regen = 0.0;
64 double Fmax = 0.0;
65 double tp = 0.0;
66 double Fe = 0.0;
67 double Fmh = 0.0;
68};
69
70// ============================================================================
71// Green-Ampt state (per subcatchment)
72// ============================================================================
73
75 double S = 0.0;
76 double Ks = 0.0;
77 double IMDmax = 0.0;
78 double IMD = 0.0;
79 double F = 0.0;
80 double Fu = 0.0;
81 double Fumax = 0.0;
82 double Lu = 0.0;
83 double T = 0.0;
84 bool saturated = false;
85};
86
87// ============================================================================
88// SCS Curve Number state (per subcatchment)
89// ============================================================================
90
92 double Smax = 0.0;
93 double S = 0.0;
94 double Se = 0.0;
95 double P = 0.0;
96 double F = 0.0;
97 double f = 0.0;
98 double regen = 0.0;
99 double T = 0.0;
100 double Tmax = 0.0;
101};
102
103// ============================================================================
104// Infiltration functions
105// ============================================================================
106
107namespace infil {
108
109// The state structs above are declared at `openswmm` scope. Re-export them
110// here so callers may also spell them `infil::HortonState` (the 2D adapter
111// contract, src/engine/2d/infil/Infil2D.hpp, uses that qualification).
115
125double horton_getInfil(HortonState& state, double precip, double depth, double dt);
126
141double modHorton_getInfil(HortonState& state, double precip, double depth, double dt);
142
152double grnampt_getInfil(GreenAmptState& state, double precip, double depth, double dt,
154
164double curvenum_getInfil(CurveNumState& state, double precip, double depth, double dt);
165
179double constant_getInfil(double rate_ftsec, double precip, double depth, double dt);
180
192void horton_init(HortonState& state, double f0, double fmin,
193 double decay, double regen, double Fmax,
194 const SimulationOptions& opts);
195
205void grnampt_init(GreenAmptState& state, double S, double Ks, double IMD,
206 const SimulationOptions& opts);
207
215void curvenum_init(CurveNumState& state, double CN, double regen);
216
217} // namespace infil
218} // namespace openswmm
219
220#endif // OPENSWMM_INFILTRATION_HPP
Definition Infiltration.cpp:34
void curvenum_init(CurveNumState &state, double CN, double regen_days)
Initialise Curve Number parameters.
Definition Infiltration.cpp:339
void grnampt_init(GreenAmptState &state, double S, double Ks, double IMD, const SimulationOptions &opts)
Initialise Green-Ampt parameters.
Definition Infiltration.cpp:223
double modHorton_getInfil(HortonState &state, double precip, double depth, double dt)
Compute Modified Horton infiltration rate for one timestep.
Definition Infiltration.cpp:163
void horton_init(HortonState &state, double f0, double fmin, double decay, double regen, double Fmax, const SimulationOptions &opts)
Initialise Horton parameters from user input.
Definition Infiltration.cpp:42
double constant_getInfil(double rate_ftsec, double precip, double depth, double dt)
Compute constant-rate infiltration, bounded by available water.
Definition Infiltration.cpp:428
double grnampt_getInfil(GreenAmptState &state, double precip, double depth, double dt, InfilModel model_type)
Compute Green-Ampt infiltration rate.
Definition Infiltration.cpp:254
double curvenum_getInfil(CurveNumState &state, double precip, double depth, double dt)
Compute SCS Curve Number infiltration rate.
Definition Infiltration.cpp:357
double horton_getInfil(HortonState &state, double precip, double depth, double dt)
Compute Horton infiltration rate for one timestep.
Definition Infiltration.cpp:59
Definition NodeCoupling.cpp:16
@ MOD_GREEN_AMPT
Definition SimulationOptions.hpp:113
@ GREEN_AMPT
Definition SimulationOptions.hpp:112
@ HORTON
Definition SimulationOptions.hpp:110
@ MOD_HORTON
Definition SimulationOptions.hpp:111
InfilModel
Definition Infiltration.hpp:45
@ GREEN_AMPT
Definition Infiltration.hpp:48
@ CURVE_NUM
Definition Infiltration.hpp:50
@ CONSTANT
SHORTWAVE GLOBAL <W/m²> — the H3 spelling.
Definition HeatData.hpp:153
Definition Infiltration.hpp:91
double regen
Regeneration rate (1/sec)
Definition Infiltration.hpp:98
double S
Current retention (ft)
Definition Infiltration.hpp:93
double F
Cumulative infiltration (ft)
Definition Infiltration.hpp:96
double T
Time since last rainfall (sec)
Definition Infiltration.hpp:99
double Tmax
Inter-event time (sec)
Definition Infiltration.hpp:100
double f
Previous infiltration rate (ft/sec)
Definition Infiltration.hpp:97
double Se
Effective retention at event start (ft)
Definition Infiltration.hpp:94
double Smax
Max retention S = (1000/CN - 10)/12 (ft)
Definition Infiltration.hpp:92
double P
Cumulative precipitation (ft)
Definition Infiltration.hpp:95
Definition Infiltration.hpp:74
bool saturated
True when surface is saturated.
Definition Infiltration.hpp:84
double Ks
Saturated hydraulic conductivity (ft/sec)
Definition Infiltration.hpp:76
double IMD
Current moisture deficit (0-1)
Definition Infiltration.hpp:78
double Lu
Upper zone depth (ft)
Definition Infiltration.hpp:82
double S
Capillary suction head (ft)
Definition Infiltration.hpp:75
double IMDmax
Maximum initial moisture deficit (0-1)
Definition Infiltration.hpp:77
double F
Cumulative infiltration (ft)
Definition Infiltration.hpp:79
double Fu
Upper zone saturation volume (ft)
Definition Infiltration.hpp:80
double Fumax
Max upper zone saturation (ft)
Definition Infiltration.hpp:81
double T
Inter-event timer (sec, counts down)
Definition Infiltration.hpp:83
Definition Infiltration.hpp:59
double f0
Initial infiltration rate (ft/sec)
Definition Infiltration.hpp:60
double Fmax
Max cumulative infiltration (ft)
Definition Infiltration.hpp:64
double Fe
Cumulative excess infiltration (ft)
Definition Infiltration.hpp:66
double fmin
Minimum (ultimate) rate (ft/sec)
Definition Infiltration.hpp:61
double decay
Decay constant k (1/sec)
Definition Infiltration.hpp:62
double regen
Regeneration constant kr (1/sec)
Definition Infiltration.hpp:63
double tp
Cumulative infiltration time (sec)
Definition Infiltration.hpp:65
double Fmh
Cumulative infiltration for Modified Horton (ft)
Definition Infiltration.hpp:67
All SWMM simulation options parsed from [OPTIONS] section.
Definition SimulationOptions.hpp:166