Richards Water Flow Guide
RichardsModel simulates vertical water flow in a variably saturated soil.
The mixed-form finite-volume scheme updates total water storage using a single
Darcy flux at each face. It uses backward Euler with Newton iteration and
adaptive substeps. The mixed-form discretization follows the approach described
by Celia, Bouloutas, and Zarba (1990).
Equation, grid, and units
dS/dt = -dq/dz
q = -K(psi) * (dpsi/dz + 1)
S(psi) = theta(psi) + Ss * integral from 0 to psi of Se(h) dh
Here psi is pressure head, theta is volumetric water content, and Se is
effective saturation. vg.storageFun(psi, pars) evaluates total storage
S, and vg.CFun(psi, pars) evaluates its derivative with respect to head.
z increases upward
── top face, q[-1]
● top cell centre, z[-1]
── interior face, halfway between centres
● ...
── interior face
● bottom cell centre, z[0]
── bottom face, q[0]
Supply strictly increasing cell-centre elevations. The boundary faces are half
the nearest cell spacing beyond the first and last centres. A one-cell grid
has thickness 0.1 in the chosen length unit. The model exposes the face
elevations as zFaces and cell thicknesses as dzCell.
Use one consistent length unit for elevations and pressure head, and one time
unit for all times. Conductivity and flux use length per time. The van
Genuchten alpha and specific storage Ss use inverse length. The bundled
soil presets use metres and days.
Boundaries and output times
Flux is positive upward, so a negative top flux is infiltration. Supply
qTop or set qTop=None and supply psiTop for a prescribed top pressure
head. The default qTop=-0.01 takes precedence over psiTop. At the bottom,
qBot takes precedence over psiBot. With both omitted, the bottom is
free-draining (q = -K at the bottom cell). Set a face flux to zero for a
closed boundary. At interior faces and prescribed-head faces, the solver
uses the arithmetic mean of the two conductivities.
A scalar t is the duration of a run starting at zero. An array t gives
all output times and can start at a nonzero time. psi has shape (T, n)
and q has shape (T - 1, n + 1). The rows of q are time averages of
accepted substep fluxes within each output interval. After a successful solve,
psi0 is a copy of the final head profile. Set it again to rerun from the
original initial conditions.
Solver controls
All controls are optional keywords on solve(). The span is the last output
time minus the first.
| Keyword | Default | Purpose |
|---|---|---|
dt_initial |
1e-4 * span |
Starting substep size, limited by dt_max |
dt_min |
1e-10 * span |
Lower limit when retrying rejected steps |
dt_max |
span |
Upper limit on substep size |
time_tol |
1e-5 |
Dimensionless local error control based on changes in water content. Use np.inf to disable it. |
max_steps |
10000 + ceil(interval / dt_max) |
Maximum attempted substeps per output interval |
For cell i and a substep of length dt, Newton iteration solves
dzCell[i] * (S_new[i] - S_old[i]) = dt * (q_new[i] - q_new[i+1])
A substep converges when the water-content residual in every cell is at
most 1e-10 and the last head update divided by abs(psi) + 1/alpha is
at most 1e-8. An exactly zero initial residual also converges. The
solver retries a failed Newton solve at half its time-step size. It adjusts
accepted step sizes using the Newton iteration count and a local error
estimate based on successive water-content rates.
stats reports accepted steps, Newton iterations, and rejected
substeps. The method is first order in time. Reduce time_tol or dt_max
when the head or water content profile needs greater time accuracy.
Checking the water balance
import numpy as np
from porousmedialab import vg
from porousmedialab.column import Column
from porousmedialab.richardsmodel import RichardsModel
column = Column(length=1.0, dx=0.05, tend=0.1, dt=0.01)
z = (np.arange(20) + 0.5) / 20
soil = vg.HygieneSandstone()
model = RichardsModel(z, column.time, np.full(z.size, -1.0),
qTop=-0.01, qBot=0.0, soil_params=soil)
model.solve()
water = model.water_storage()
net_inflow = np.diff(model.t) * (model.q[:, 0] - model.q[:, -1])
residual = water[1:] - water[0] - np.cumsum(net_inflow)
water_storage() integrates total storage over the column per unit area.
Summing the cell equations cancels each interior face flux, leaving
only the boundary terms. The residual measures the difference between
the integrated storage change and cumulative net inflow at each output
time, up to floating-point error and the nonlinear solver tolerance.
Mapping water flow to a Column grid
flow = model.to_column(column)
cell_balance = flow.balance_residual()
The column time grid must equal the solved model’s output times. The column
depths must lie inside the Richards domain and increase downward from the
surface. By default the surface is the top Richards face. Pass
z_surface to use another reference elevation.
ColumnWaterFlow.theta and storage have shape (N, T) and contain
control-volume averages. theta is volumetric water content and storage
includes elastic storage. Its q has shape (N + 1, T - 1) and is positive
downward, so infiltration enters at positive q[0]. The control-volume
faces are the end nodes and the midpoints between nodes. The
balance_residual() check uses total storage and compares each cell’s change
against the net inflow over each output interval.
Pass the mapped flow to Column.set_water_flow after adding the tracer.
The optional inflow_concentration boundary supplies solute with rainfall,
retains it during evaporation, and exports it during bottom drainage.
column.add_species(theta=0.3, name='Cl', D=0.01, init_conc=1.0,
bc_top_value=0.0, bc_top_type='total_flux',
bc_bot_value=0.0, bc_bot_type='total_flux')
column.set_water_flow(flow, species='Cl', advection='upwind')
column.change_boundary_conditions('Cl', 0, 1.0, 'inflow_concentration',
0.0, 'inflow_concentration')
column.solve(verbose=False)
For a bound tracer, flow.theta weights diffusion and flow.storage weights
inventory and aqueous Henry partitioning. With balanced flow and compatible
boundary concentrations, a uniform tracer stays uniform. Inspect solute
exchange with column.boundary_flux('Cl').
Column water-flow boundary conditions
Limits
- Each run uses one set of scalar soil parameters.
- Fixed-flux boundaries keep their prescribed flux during ponding. Supply a pressure-head boundary to prescribe a ponded surface.
- With
Ss=0, a fully saturated column requires a pressure-head boundary to determine its pressure level. A closed column withSs=0can only accept water up to the available pore space. - Very dry, steep retention curves can prevent convergence. For example,
HygieneSandstone with initial head at or below −20 m can fail even with
adaptive substeps. Exhausting the minimum step size or the substep budget
raises
RichardsConvergenceError.