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
112namespace infil {
113
114// The state structs above are declared at `openswmm` scope. Re-export them
115// here so callers may also spell them `infil::HortonState` (the 2D adapter
116// contract, src/engine/2d/infil/Infil2D.hpp, uses that qualification).
120
134double horton_getInfil(HortonState& state, double precip, double depth, double dt);
135
148double modHorton_getInfil(HortonState& state, double precip, double depth, double dt);
149
168double grnampt_getInfil(GreenAmptState& state, double precip, double depth, double dt,
169 InfilModel model_type = InfilModel::GREEN_AMPT, double infil_factor = 1.0,
170 double recovery_factor = 1.0);
171
184double curvenum_getInfil(CurveNumState& state, double precip, double depth, double dt,
185 double recovery_factor = 1.0);
186
194double constant_getInfil(double rate_ftsec, double precip, double depth, double dt);
195
209void horton_init(HortonState& state, double f0, double fmin, double decay, double regen,
210 double Fmax, const SimulationOptions& opts);
211
222void grnampt_init(GreenAmptState& state, double S, double Ks, double IMD,
223 const SimulationOptions& opts);
224
232void curvenum_init(CurveNumState& state, double CN, double regen);
233
234} // namespace infil
235} // namespace openswmm
236
237#endif // OPENSWMM_INFILTRATION_HPP
Native infiltration kernels with caller-managed accepted-step state. These methods mutate the supplie...
Definition Infiltration.cpp:34
void curvenum_init(CurveNumState &state, double CN, double regen_days)
Initialize Curve Number retention and all event-history fields.
Definition Infiltration.cpp:448
void grnampt_init(GreenAmptState &state, double S, double Ks, double IMD, const SimulationOptions &opts)
Convert authored Green-Ampt parameters and initialize the upper zone.
Definition Infiltration.cpp:221
double modHorton_getInfil(HortonState &state, double precip, double depth, double dt)
Advance the linear excess-infiltration Modified Horton model.
Definition Infiltration.cpp:159
double curvenum_getInfil(CurveNumState &state, double precip, double depth, double dt, double recovery_factor)
Advance SCS Curve Number event retention with ponded-water continuation.
Definition Infiltration.cpp:466
void horton_init(HortonState &state, double f0, double fmin, double decay, double regen, double Fmax, const SimulationOptions &opts)
Convert authored Horton parameters and reset ordinary Horton history.
Definition Infiltration.cpp:42
double grnampt_getInfil(GreenAmptState &state, double precip, double depth, double dt, InfilModel model_type, double infil_factor, double recovery_factor)
Advance saturated/unsaturated Green-Ampt history and compute actual infiltration.
Definition Infiltration.cpp:428
double constant_getInfil(double rate_ftsec, double precip, double depth, double dt)
Return a stateless capacity bounded by available water.
Definition Infiltration.cpp:544
double horton_getInfil(HortonState &state, double precip, double depth, double dt)
Integrate exponential Horton capacity over one step with dry recovery.
Definition Infiltration.cpp:58
Definition ExchangeLaw.hpp:60
@ MOD_GREEN_AMPT
Definition SimulationOptions.hpp:115
@ GREEN_AMPT
Definition SimulationOptions.hpp:114
@ HORTON
Definition SimulationOptions.hpp:112
@ MOD_HORTON
Definition SimulationOptions.hpp:113
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:147
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:168