Skip to content

Infiltration: Green-Ampt and curve number - #14

Merged
hgopalan merged 1 commit into
developmentfrom
claude/infiltration
Nov 23, 2026
Merged

hgopalan merged 1 commit into
developmentfrom
claude/infiltration

Conversation

@hgopalan

@hgopalan hgopalan commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Related to the development plan: infiltration.

Summary

Rain that falls on soil partly soaks in. Until now FLUME kept all of it on the surface. This PR adds two infiltration models that take water out of each cell:

  • Green-Ampt (flume.infiltration.type = green_ampt): a physical model of a wetting front moving down into the soil, as in the EPA SWMM Reference Manual, Volume I (Rossman and Huber, 2016, section 4.4). It acts on rain and on ponded water.
  • Curve number (flume.infiltration.type = curve_number): the NRCS runoff curve number (NEH Part 630, chapter 10; Woodward et al., 2003), used as a loss on the rain. Water that runs onto a cell from its neighbours is not infiltrated.

The soil parameters come from one value or from an ESRI ASCII map, per cell. Impervious cells are given by value (K = 0 or CN = 100); building cells infiltrate nothing. A cell never loses more water than it holds. The depth each cell has lost is written to the plotfiles as infiltrated_depth, so the water of a run can be balanced.

The PR also changes one line of the rain source (add_rain_depth): when the rounding carry is negative and larger than the depth of a dry cell, the cell is left at its depth and the carry is kept. Before, the cell could go below 0. This path was added with prescribed rain in commit 1880669. It is not reached on development, because a cell there never empties while it rains; infiltration empties cells, and the single-precision suite reached it at step 5706. The new test infiltration_green_ampt_burst reaches it in three steps.

Bit identity: runs without infiltration are bit-identical to development, except a rain run in which a dry cell would have gone below 0 (none of the existing tests). All existing tests pass unchanged; no gold changes.

Theory

Green-Ampt. With $K$ the saturated hydraulic conductivity (m/s), $\psi$ the suction head at the wetting front (m), $\theta$ the moisture deficit, $M = \psi,\theta$ (m), $F$ the cumulative infiltration of the cell (m) and $W$ the water the cell holds at the end of the step (m), the step of length $\Delta t$ uses $i = W/\Delta t$. The surface is saturated once

$$F \ge F_s = \frac{K M}{i - K}, \qquad i > K .$$

Below $F_s$ the cell loses $W$ (or reaches $F_s$ at the rate $i$). From $F_s$ on, $F$ follows the integrated equation over the rest of the step $\tau$:

$$K\,\tau = (F_2 - F_1) - M \ln\frac{F_2 + M}{F_1 + M} .$$

What: the root $x = F_2 - F_1$ is found by Newton's method in double precision, from the bound $K\tau + \sqrt{2MK\tau}$, so the iterates fall to the root from above. Why: the integrated equation is exact for any step, so the ponded result does not depend on $\Delta t$.

Curve number. With $P$ the rain fallen on the cell since the start (m), $CN$ the curve number, $S = 25.4,(1000/CN - 10)$ mm the potential retention and $I_a = \lambda S$ the initial abstraction ($\lambda$ = ia_ratio), the cumulative loss is

$$L(P) = \begin{cases} P, & P \le I_a,\\[2pt] I_a + \dfrac{(P - I_a)\,S}{P - I_a + S}, & P > I_a, \end{cases}$$

which is $P - Q(P)$ written without cancellation. Each step the cell loses $L(P_{\mathrm{end}}) - L(P_{\mathrm{start}})$, never more than it holds. Why compensated sums: $P$ and $F$ add one small increment per step over many steps; both are kept as compensated sums, so the loss does not drift (279217 steps: 1.4e-17 m, against 1.2e-5 m with a plain sum).

The user gives a curve number that matches $\lambda$; FLUME does not convert. The documentation gives the conversion of Woodward et al. (2003) for $\lambda = 0.05$.

Changes

  1. Source/FLUME_Infiltration.H, Source/FLUME_Infiltration.cpp (new): the classes Infiltration, GreenAmpt and CurveNumber. Each owns its fields (parameters, infiltrated_depth and the carries of its sums) and its plotfile output. One ParallelFor kernel per model. Values out of range abort and name the key and the file.
  2. Source/FLUME_Source.cpp, Source/FLUME_Flood.cpp: the infiltration source is built after the rain and before the friction, and gets the building map.
  3. Source/FLUME_Inputs.H, Source/FLUME_Inputs.cpp: the new keys, read and range-checked; they join the check for unknown flume keys, and a key of the model not selected aborts.
  4. Source/FLUME_Rain.cpp:add_rain_depth, Source/FLUME_Rain.H: a negative carry never takes a dry cell below 0 (see Summary).
  5. Source/FLUME_IO.cpp: infiltrated_depth in the plotfiles.
  6. Tests/Infiltration/ (new): decks, synthetic grids (make_infiltration_grids.py writes them), check_infiltration.py, README.md and InfiltrationTests.cmake.
  7. Docs: Inputs.rst (table below), theory/SourceTerms.rst (models, limits), Verification.rst, TestCatalog.rst, Running.rst, References.rst.
Input Default Effect
flume.infiltration.type none none, green_ampt or curve_number (needs rain)
flume.infiltration.green_ampt.conductivity / _file required $K_s$, mm/h, finite, $\ge 0$; 0 is impervious
flume.infiltration.green_ampt.suction / _file required $\psi_s$, mm, finite, $\ge 0$
flume.infiltration.green_ampt.deficit / _file required $\theta_d$, finite, in [0, 1]
flume.infiltration.cn.number / _file required $CN$, finite, in (0, 100]; 100 is impervious
flume.infiltration.cn.ia_ratio 0.2 $\lambda$, finite, in [0, 1)

Results

Test Result (double precision)
Green-Ampt, ponded, 6 h F = 91.75 mm; largest difference to the implicit solution 2.9e-11 m (a time shift of 3.7e-6 s from the first step)
Green-Ampt, rain 36 mm/h, 2 h F = 50.60 mm, 21.40 mm on the surface; difference 7.6e-17 m
Curve number 75, rain 36 mm/h, 2 h loss 50.30 mm of 72 mm; difference 1.4e-17 m
Curve number 65.31, $\lambda = 0.05$ difference 1.4e-17 m
Curve number, 279217 steps difference 1.4e-17 m (4.5e-9 m in single precision)
Green-Ampt mass balance, map with buildings infiltrated plus surface water equals rain to 5.7e-14 (relative)

In the closed-form cases each cell's depth plus its infiltrated depth equals the water it received to 4 machine epsilons, in double and in single precision.

Test(s)

New (38 tests, all pass in double and single precision):

  • infiltration_green_ampt_ponded, infiltration_green_ampt_ponded_moving: the implicit ponded solution.
  • infiltration_green_ampt_rain: saturation time and the integrated equation under rain.
  • infiltration_curve_number_rain, infiltration_curve_number_ia_ratio, infiltration_curve_number_many_steps, infiltration_curve_number_map: the curve-number formula.
  • infiltration_green_ampt_balance: infiltrated volume in the mass balance, on a map with buildings and impervious columns, 2 ranks.
  • infiltration_green_ampt_cap, infiltration_green_ampt_cap_moving: a cell never loses more than it holds.
  • infiltration_green_ampt_burst: the rain carry fix, 2 ranks.
  • abort_infiltration_*: every range check and key conflict aborts with the key name.

Each test was shown to fail on a one-line mutant (or, for the burst test, without the rain fix) before it was committed.

Full suite, local (macOS, MPI, 4 processes):

Build Result
Release, double 455 of 455 pass
Release, single 456 of 456 pass on the second run. On the first run lake_at_rest_second_order_np1 failed once; it has no rain or infiltration, and it passed in 11 later runs (10 repeats under -j 4 and the full suite).
Infiltration and rain tests with amrex.init_snan=1, amrex.fpe_trap_invalid=1, amrex.the_arena_init_size=0 126 of 126 pass, one box per rank (fabarray.mfiter_tile_size = 1024 1024 1024) and with 4 x 4 tiles

Not in this PR

  • Recovery of the soil between storms (Rossman and Huber, 2016, section 4.4.2). A run is one storm. Full recovery takes $75/\sqrt{K_s}$ hours ($K_s$ in in/h), for example 106 h for $K_s$ = 0.5 in/h, longer than the runs FLUME is used for.
  • The ponded head in the Green-Ampt suction term (eq. 4-27); the documentation lists it under Limitations.
  • Infiltration of run-on water by the curve-number model.
  • Conversion of curve numbers between initial abstraction ratios.

References

  • L. A. Rossman and W. C. Huber, Storm Water Management Model Reference Manual, Volume I – Hydrology (Revised), EPA/600/R-15/162A, 2016.
  • USDA NRCS, National Engineering Handbook, Part 630 Hydrology, chapter 10, Estimation of Direct Runoff from Storm Rainfall.
  • D. E. Woodward, R. H. Hawkins, R. Jiang, A. T. Hjelmfelt, J. A. Van Mullem and Q. D. Quan, Runoff curve number method: examination of the initial abstraction ratio, World Water & Environmental Resources Congress 2003, doi:10.1061/40685(2003)308.

🤖 Generated with Claude Code

Two loss models as sources, acting after the rain and before the
friction (flume.infiltration.type = green_ampt or curve_number), with
per-cell parameters from one value or an ESRI ASCII grid.

- Green-Ampt for one storm after Rossman and Huber (2016, section 4.4):
  saturation at F_s = K M / (i - K), then the integrated equation solved
  by Newton's method in double precision from an upper bound.
- Curve number as a loss on the rain (NRCS NEH 630 ch. 10; Woodward et
  al., 2003), with flume.infiltration.cn.ia_ratio (default 0.2, [0, 1)).
- Impervious by value (K = 0, CN = 100); building cells infiltrate
  nothing. A cell never loses more water than it holds; the discharge
  is scaled with the depth and zeroed at or below the dry depth.
- The infiltrated depth and the rain total are compensated sums; the
  infiltrated depth is written to the plotfiles (infiltrated_depth).
- Rain: a negative rounding carry no longer takes a dry cell below 0;
  the cell keeps its depth and the carry is kept (path added in
  1880669, reached only once cells empty while it rains).

Ghost cells: the infiltration kernels read and write valid cells only;
no ghost fill is added. NaN guards: the Newton step stops on a
non-positive or NaN residual or slope; the curve-number loss returns P
when S overflows (Ia infinite or NaN).

Tests: ponded Green-Ampt against its implicit solution, the curve-number
loss against its formula, the infiltrated volume in the mass balance,
the depth cap, a rain burst for the carry fix and the input aborts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hgopalan
hgopalan merged commit e8603e5 into development Nov 23, 2026
9 of 11 checks passed
@hgopalan
hgopalan deleted the claude/infiltration branch November 23, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant