Rain and evaporation: the forcing#

The aquifer model does not see days: it sees stress periods, and one rate per cell for each period. This page gives the rules that turn daily series and daily grids into those rates. How the outputs are put back on the same periods is on Time alignment of outputs and observations. The keys are in [flow.sinks_sources.recharge] and [simulation].

The period, unit, coverage and runoff rules are the same under the three solvers; sections 5 and 7 note where they differ. The daily soil reservoir (The daily soil reservoir) is here one more source of daily grids.

Notation of this page

\(k\) is a stress period, \(n_\mathrm{per}\) the number of periods. \(j\) is one sample of a record, stamped \(t_j\). Rates are volumes per area and per time, so lengths per time. A positive recharge adds water to the aquifer; a positive ETP removes it. Every symbol of the site is on Notation.

Symbol

Meaning

Unit

Set by

\(\Delta t\)

length of a stress period, the stretch of time that gets one forcing value

s

step_value

\(A\)

catchment area

m²

geographic.catchment

\(N\)

recharge rate, positive into the aquifer

m/s

flow.sinks_sources.recharge

\(t_0, t_\mathrm{end}\)

first and last day of the run, the last day included

date

start_datetime, end_datetime

\(b_k\)

edge \(k\) of the stress periods; period \(k\) is \([b_k, b_{k+1})\) and is stamped \(b_{k+1}\)

date

derived from step_value

\(n_\mathrm{per}\)

number of stress periods of the run

derived

\(x_j, t_j\)

sample \(j\) of a forcing record, and its stamp

mm/day, date

data.precipitation, data.etp, data.recharge, data.runoff

\(\Delta t_r\)

step of a record: the median spacing of its stamps, the interval the last sample stands for

s

derived

\(\bar x_k\)

value stress period \(k\) takes from a record

mm/day, then m/s

derived

\(N_k, E_k\)

recharge and ETP rate of stress period \(k\)

m/s

values, values

\(\hat N\)

rate a steady stress period takes

m/s

first_clim

\(N^+_k, N^-_k\)

recharge part and deficit part of a net recharge

m/s

negative_to_evt

\(Q^\mathrm{ro}_k\)

catchment runoff of period \(k\), as a volume per time

m³/s

data.runoff

\(d_\mathrm{ext}\)

extinction depth of the evapotranspiration, below its surface

m

extinction_depth, evt_extinction_depth

1. The window is cut into periods#

The edges start at \(b_0 = t_0\) and advance by one step \(\Delta t\) until the first edge that reaches the end of the last day:

(1)#\[b_{k+1} = b_k + \Delta t, \qquad b_{n_\mathrm{per}} = t_\mathrm{end} + 1\ \text{day}\quad(+ 1\ \text{hour for an hourly step}).\]

Period \(k\) is the half-open interval \([b_k, b_{k+1})\). The end date is part of the run, so the last edge is the day after it. A step that does not land on that edge is refused: the window is not aligned with the step.

Edges can also be given explicitly, as window.period_bounds. The code sets them, and no TOML key does. flow.ic of type steady_state uses this for its auxiliary steady model: one period that spans the whole window (5. Steady periods and first_clim).

In the code: build_simulation_time_boundaries.

2. One series per variable#

The data layer hands a variable over as station records or as grids. Two rules reduce them to the shape the flow needs.

Stations. Several stations are averaged at each stamp, with equal weights. A single station is used as it is.

Spatial mode. spatial_mode decides what stays a series and what stays a grid:

Mode

Stations

Grids

auto

one series

kept as a grid

homogeneous

one series

reduced to one spatial mean per stamp

heterogeneous

placed on the cells if they have coordinates, else one series

kept as a grid

Under auto, station records with coordinates become a grid only when no series can be built from them. A grid is not resampled when it is loaded: it is placed on the cells of the solver mesh once the mesh exists, by the method of interpolation_method (nearest, linear, idw or area). The ETP has the same two keys. With area, each pixel is weighted by the area it shares with the cell polygon, so the rate of a cell times its area is the integral of the grid over the cell and the volume over the domain is the integral of the grid. A cell that no finite pixel reaches takes the nearest pixel. A station source refuses area, and the default stays nearest. A grid is an xarray dataset, a NetCDF file or a GeoTIFF file. Any other record, or a file with another suffix, stops the run with an error that names what it received and the formats it reads.

In the code: resolve_forcing, and the area weights in hydromodpy/model/forcing/area_weights.py.

3. Units#

Every data manager hands rain, ETP, recharge and runoff over in mm/day. The binders convert them with the fixed factor \(1/(1000 \times 86400)\) m/s per mm/day, whatever units says. That key is read for a rate written in the file: values and a numeric first_clim are converted from it to m/s when the flow is built.

A sample is a rate. The code averages samples and never sums them: a monthly total in mm must be turned into mm/day before it is given to the model.

4. A record gets one value per period#

One rule holds for every forcing record: a series, a station, or a grid with a time axis, which is averaged cell by cell of its own grid before it is placed on the mesh.

Samples inside the period. Period \(k\) takes the weighted mean of the samples stamped inside it:

(2)#\[\bar x_k = \frac{\sum_{t_j \in [b_k,\, b_{k+1})} w_j\, x_j}{\sum_{t_j \in [b_k,\, b_{k+1})} w_j} \qquad \text{if a sample lies inside.}\]

A record with one sample per calendar month or year gives each sample the length of its month or year as \(w_j\), whether the sample is stamped at the start of the month, at its end or on the same day of each. Any other record has \(w_j = 1\). So the mean is the time mean for a record with one sample per equal step, per month or per year, and only for those. Several gridded records that cover one period are averaged with equal weights.

No sample inside. A sample is the rate of the interval from its stamp to the next stamp. The last sample stands for one step \(\Delta t_r\) of the record, the median spacing of its stamps, and a record of one sample stands for all later time. A period with no sample inside is covered when the interval of the latest earlier sample reaches into it, and takes that sample. So daily data on hourly periods, and a gap inside a record, are covered.

Not covered. A period that no interval reaches, before the first stamp or after the end of the last step, is not covered. coverage_policy decides: "error", the default, stops the run and names the periods; "warn" warns once per record; "ignore" says nothing. Under the last two, the period takes the nearest sample in time: the last one after the record, the first one before it.

Six monthly periods and a weekly record with a gap over March that ends in late April. January, February and April take the mean of their samples; March and May take the sample in force; June is not covered.

Fig. 15 A weekly record on six monthly periods, matched by samples_by_period. Each sample stands for the interval up to the next one, and the last for one step. March holds no sample and takes the one in force; May is still inside the last step; June is past it and stops the run by default.#

Four records on monthly periods from 1 January 2000, from calls of align_forcing_series_to_simulation_window:

The record

Window

Under "error"

The periods take

daily, 1 mm/day in January, 3 in February, 5 in March

January to March

runs

1, 3, 5

2 on 1 January and 6 on 1 March

January to March

runs

2, 2 (in force), 6

one sample, 4 on 1 February

January to March

stops: January is before the first stamp

4, 4, 4 under "warn"

60 daily samples from 1 January, valued 0 to 59

January to June

stops: March to June are after the last step

15, 45, then 59 four times under "warn"

The last rule. A forcing declared by a CSV file under a well, a lake, a stream network or a boundary has an aggregate key, for example flow.sinks_sources.lakes.<name>.rainfall.aggregate. "mean" is the rule above. "last" reads the record as a state that holds until it changes: period \(k\) takes the latest sample at or before \(b_k\), and no coverage check applies. The rain, ETP, recharge and runoff of the data layer have no such key.

In the code: samples_by_period, enforce_coverage.

5. Steady periods and first_clim#

A steady period stands for the long-term state a run starts from. It does not take the rate of its own dates. first_clim sets the rate \(\hat N\) of every steady stress period, and of no other period:

(3)#\[\begin{split}\hat N = \begin{cases} \dfrac{\sum_{k} \Delta t_k\, N_k}{\sum_{k} \Delta t_k} & \texttt{"mean"},\\[1.5ex] N_0 & \texttt{"first"},\\[0.5ex] F & \text{a number } F,\ \text{in the units of the values.} \end{cases}\end{split}\]

where \(\Delta t_k\) is the length of period \(k\). So the steady period receives the mean volume of the record, and a short month weighs less than a long one. The steady periods are every period of a steady run, and period 0 of a transient run when flow.first_period_steady is true, in the three solvers. A transient period keeps its own rate, whatever its index. Under MODFLOW-NWT the ETP follows the same rule with first_clim.

Four periods of equal length with rates 2, 4, 9 and 1, from calls of apply_first_clim. With lengths of 31, 28, 31 and 30 days, "mean" gives 4.025:

Period 0

"mean"

"first"

the number 7

first period steady

4

2

7

first period transient

2

2

2

Periods 1 to 3 keep 4, 9 and 1 in both rows.

A run that starts from a steady state of its own (flow.ic, kind steady_state) builds an auxiliary steady model for that state, with first_clim set to "mean", or to the prescribed rate. That model has one period and reads the rates of the run’s periods with their lengths, so the mean is the same one. The starting states are the kinds of [flow.ic].

In the code: apply_first_clim.

6. Negative recharge goes to the ETP package#

A net recharge can be negative: a series of rain minus ETP, for example. With negative_to_evt, it is split into a recharge part and a deficit part:

(4)#\[N^+_k = \max(N_k,\, 0), \qquad N^-_k = \max(-N_k,\, 0).\]

The recharge package receives \(N^+_k\) and the evapotranspiration package \(N^-_k\). A transient period keeps its own split. A steady period takes first_clim on each part: "mean" gives the time mean of \(N^+_k\) and the time mean of \(N^-_k\), "first" gives \(N^+_0\) and \(N^-_0\), and a number \(F\) gives \(\max(F, 0)\) and \(\max(-F, 0)\). So the net rate of a steady period, \(\hat N^+ - \hat N^-\), is always the one first_clim states: the time mean of the net rates, \(N_0\), or \(F\).

A negative number for first_clim needs negative_to_evt, or the file is refused. Boussinesq has no ETP package and refuses it whatever negative_to_evt says. With negative_to_evt off, a negative rate in the file is refused when it is read. The deficit is drawn from the water table near the top of each cell, down to the extinction depth \(d_\mathrm{ext}\), and not under the sea, a river head or a lake (Drains and evapotranspiration at the top of the model).

In the code: split_net_recharge.

7. What the solver does with N and E#

The recharge package adds \(N_k\) times the cell area to each cell, and the evapotranspiration package removes at most \(E_k\), less as the head falls to the extinction depth. Both are constant during a stress period. The packages are documented by MODFLOW: RCHA and EVTA in MODFLOW 6 ([Langevin et al., 2017]), RCH and EVT in MODFLOW-2005 and MODFLOW-NWT ([Harbaugh, 2005, Niswonger et al., 2011]). What HydroModPy decides is which rate reaches the ETP package:

  • MODFLOW-NWT. The loaded ETP drives the package, with the deficit of 6. Negative recharge goes to the ETP package.

  • MODFLOW 6 without a soil reservoir. The loaded ETP is ignored, with a warning if a [flow.sinks_sources.etp] table is declared. Only the deficit reaches the package.

  • MODFLOW 6 with a soil reservoir. The ETP the soil could not meet reaches the package.

  • Boussinesq. A [flow.sinks_sources.etp] table is refused.

Under MODFLOW 6 the recharge is set to zero on lake cells: the lake gets its own rain through the lake package. A bed cell of an active-shore lake recharges as land when the shore falls below its bed (Lakes and reservoirs). The law, the surface and the depth of the ETP package are on Drains and evapotranspiration at the top of the model.

8. Runoff is not recharge#

The runoff of the data layer, data.runoff, never enters the aquifer as a diffuse term. It enters the model, when it enters at all, as a volume per time:

(5)#\[Q^\mathrm{ro}_k = \bar q^\mathrm{ro}_k\,A ,\]

where \(\bar q^\mathrm{ro}_k\) is the catchment mean of the runoff, in m/s, put on the periods by the rule of 4. A record gets one value per period, and \(A\) the catchment area.

  • With an active stream network, \(Q^\mathrm{ro}_k\) is shared among the reaches by their length and routed downstream. A forcing written in the file wins over the loaded series, and a lake then gets no direct share, so the same water is not counted twice (Streams and the water mover).

  • Without a network, a declared lake receives \(Q^\mathrm{ro}_k\) directly (Lakes and reservoirs).

  • Without either, the runoff stays outside the flow.

A lake also gets the catchment mean of the loaded rain and ETP as open-water rates, unless it declares its own.

When a calibration compares a simulated drain budget with a gauge, the runoff is added to the simulated discharge, averaged on each period and multiplied by the catchment area, or by the area the gauge drains (Time alignment of outputs and observations). If a stream network already carries the runoff, nothing is added.

9. The soil reservoir as a source of grids#

With a soil reservoir (flow.sinks_sources.recharge.soil), the data layer loads rain and ETP, and the reservoir computes three daily grids in mm/day: recharge, the ETP it could not meet, and runoff. The binders take them where they would take a loaded recharge, ETP and runoff, so they go through the rules of 4. A record gets one value per period and 8. Runoff is not recharge. A daily step gives one slice per period; a monthly step gives the mean of the daily slices of the month.

A transient soil run refuses a steady first period, since that period would hold the recharge of one day only, and first_clim acts on none of its periods. A steady soil run has one period, which takes the mean of the daily recharge. The daily rules are on The daily soil reservoir.

10. ETP from the temperature#

A [data.etp] section may name a formula instead of sources. The run then loads [data.temperature] and computes the daily ETP on its grid, in mm/day, once every family is loaded. The result takes the place of a loaded ETP, so the soil, the EVT of MODFLOW-NWT, the exports and the figures read it the same way. oudin (Oudin et al. 2005) reads the temperature and the extraterrestrial radiation \(R_e\) of FAO-56 (Allen et al. 1998, eq. 21),

(6)#\[E = \frac{R_e}{\lambda \rho}\,\frac{T + 5}{100} \quad \text{if } T + 5 > 0, \text{ else } 0,\]

with \(\lambda = 2.45\) MJ/kg and \(\rho = 1000\) kg/m³. hamon (Hamon 1963) reads the temperature and the day length \(D\) in hours, by the CBM model of Forsythe et al. (1995), as ESPERE codes it,

(7)#\[E = 29.8\,D\,\frac{e_{sat}(T)}{T + 273.2}, \qquad e_{sat}(T) = 0.611\,\exp\!\left(\frac{17.3\,T}{T + 237.3}\right).\]

The day of the year is read from the date, so a leap year does not shift the seasons. The latitude of each cell comes from its centre in the CRS of the temperature grid.

11. A recharge scenario#

A scenario table replaces the loaded recharge by its mean year, month by month, repeated over the run. With dry_years, repeat and start, it puts repeat dry years in a row from start, each equal month by month to the mean of the dry_years. This is the test of consecutive droughts of Abherve (2022, section 5.3.5), who took 1975 and 1976 as the dry years and 2 or 5 of them in a row. The scenario keeps the volume of a normal year and changes only the sequence. A soil reservoir computes its own recharge, so a scenario beside it is refused.

Assumptions and limits#

  • Constant within the period. Rain, ETP and runoff are one value per period and per cell. Recharge is a flux set from outside and does not read the water table.

  • An irregular record has equal weights inside a period. Only a record with one sample per equal step, per month or per year gives a time mean inside a period. A weekly record on monthly periods, or one with gaps, counts each sample once.

  • The ETP is not read under MODFLOW 6 outside soil mode. A loaded ETP is ignored, with a warning.

  • Aggregation by last exists for declared forcings only. The data layer always takes the mean.

Parameters of this page#

# start_datetime = "2019-01-01"Simulation window lower datetime bound used by launcher-level time alignment and forcing checks. example value
Path
simulation.time.start_datetime
Accepted
date "YYYY-MM-DD"
Example
"2019-01-01"
# end_datetime = "2025-12-31"Simulation window upper datetime bound, interpreted as inclusive. example value
Path
simulation.time.end_datetime
More

Must be greater than or equal to start_datetime.

Accepted
date "YYYY-MM-DD"
Example
"2025-12-31"
# step_value = "1 month"Forcing/stress-period time-step scalar or inline token '<value> <unit>' (for example '30 day').
Path
simulation.time.step_value
More

This controls the temporal aggregation step for forcing series (for example recharge/runoff) and the resulting stress periods. Not read by a steady run (flow.flow_regime = 'steady'), which is one stress period over the whole window, its forcings averaged over it.

Accepted
integer or number or string
Example
"1 month", "10 day"
# step_unit = ‹"hour" | "day" | "month" | "year"›Unit of a bare-number step_value: the length of the stress periods and of the forcing steps.
Path
simulation.time.step_unit
Values
  • "hour" : Treats step_value as whole hours, for sub-daily forcing and stress periods.
  • "day" : Treats step_value as whole days, the common granularity for daily forcing series.
  • "month" : Treats step_value as calendar months, so the step length varies by month.
  • "year" : Treats step_value as calendar years, so the step length varies with leap years.
Accepted
"hour" | "day" | "month" | "year"
# coverage_policy = "error"What happens to a stress period that a forcing record does not cover.
Path
simulation.time.coverage_policy
More

A sample is the rate of the interval up to the next sample, and the last sample stands for one step of the record (the median spacing of its dates). A period that no sample reaches, before the first date or after the end of the last step, is not covered. 'error' stops the run, 'warn' warns once per record, 'ignore' says nothing; under 'warn' and 'ignore' the period takes the nearest sample in time. The rule is the same for a series, a station and a grid: rain, ETP, recharge, runoff and the declared CSV forcings read as rates (aggregate = 'mean').

Values
  • "error"
  • "warn"
  • "ignore"
Accepted
"error" | "warn" | "ignore"
Example
"error", "warn"
# first_period_steady = trueFor transient flow, mark the first solver stress period as steady-state.
Path
flow.first_period_steady
More

Ignored for steady flow, where all solver periods are steady.

Accepted
true | false
Example
true, false
[flow.sinks_sources.recharge]
# units = "mm/day"Unit of 'values' and of the recharge data source.
Path
flow.sinks_sources.recharge.units
More

Data-manager outputs use mm/day by convention; set it when you write 'values' in another unit. The run converts the rate to m/s.

Accepted
string
Example
"mm/day", "m/day", "m/s"
# first_clim = "mean"Recharge rate of every steady stress period: every period of a steady run, and the first period of a transient run when flow.first_period_steady is true. dev
Path
flow.sinks_sources.recharge.first_clim
More

'mean' is the mean of the per-period rates, each weighted by its length; 'first' is the rate of period 0; a number is that rate, in the units of values. A transient period keeps its own rate. The same rule holds for one value per period and for one grid per period, under every solver. With negative_to_evt, the steady period takes the rule on the recharge part and on the deficit part, so its net rate is the one stated here. Boussinesq has no EVT and refuses a negative number.

See
flow.first_period_steady
Accepted
string or number
Example
"mean", "first", 2.0
# negative_to_evt = trueWhen true, negative recharge values are routed to the solver EVT package and RCH receives the non-negative clipped recharge. dev
Path
flow.sinks_sources.recharge.negative_to_evt
More

Boussinesq has no EVT and refuses a negative rate whatever this says.

Accepted
true | false
# spatial_mode = "auto"How to interpret spatial data: 'auto' (points->homogeneous, fields->heterogeneous), 'homogeneous' (force spatial averaging), 'heterogeneous' (force per-cell discretization, including point-to-grid interpolation when stations have coordinates). dev
Path
flow.sinks_sources.recharge.spatial_mode
Values
  • "auto"
  • "homogeneous"
  • "heterogeneous"
Accepted
"auto" | "homogeneous" | "heterogeneous"
# interpolation_method = "nearest"How gridded or station data reach the cells of the solver mesh: 'nearest' (source value at the cell centre), 'linear', 'idw' (inverse distance), or 'area' (gridded data only: each pixel weighted by the area it shares with the cell, so the volume over the domain equals the integral of the grid). dev
Path
flow.sinks_sources.recharge.interpolation_method
Values
  • "nearest"
  • "linear"
  • "idw"
  • "area"
Accepted
"nearest" | "linear" | "idw" | "area"
# dry_years = []Historical years whose mean, month by month, makes the dry year, such as [1975, 1976]. experimental
Path
flow.sinks_sources.recharge.scenario.dry_years
More

Empty, the scenario is the mean year alone, repeated.

Accepted
list of integer
Example
[1975, 1976]
# repeat = 0Number of dry years put in a row, 2 or 5 in the thesis; 0 with no dry_years. year [0, 50] experimental
Path
flow.sinks_sources.recharge.scenario.repeat
Accepted
integer
Valid range
[0, 50] (refused outside)
Unit
year
# start = 1990Calendar year of the first dry year of the scenario. year experimental example value
Path
flow.sinks_sources.recharge.scenario.start
Accepted
integer
Unit
year
Example
1990
# formula = "oudin"Compute the ETP from the daily mean temperature of [data.temperature], which the run then loads, instead of loading an ETP product. experimental example value
Path
data.etp.formula
More

"oudin" uses the extraterrestrial radiation (Oudin et al. 2005), "hamon" the day length (Hamon 1963). The result is mm/day on the grid of the temperature, and every reader of [data.etp] receives it.

See
data.temperature
Accepted
string
Example
"oudin"
[flow.sinks_sources.etp]
# first_clim = "mean"ETP rate of every steady stress period, read by MODFLOW-NWT: every period of a steady run, and the first period of a transient run when flow.first_period_steady is true. dev
Path
flow.sinks_sources.etp.first_clim
More

'mean' is the mean of the per-period rates, each weighted by its length; 'first' is the rate of period 0; a number is that rate. A transient period keeps its own rate.

See
flow.first_period_steady
Accepted
string or number
Example
"mean", "first", 2.0
[solver.modflow6.process_specific]
# evt_extinction_depth = 1.0Meters; extinction depth for the EVT sink used when recharge negatives are routed to EVT. m > 0 expert
Path
solver.modflow6.process_specific.evt_extinction_depth
More

The routed deficit tapers linearly from the cell top to this depth and stops below it, so a sustained climatic deficit can saturate near this value.

Accepted
number
Valid range
> 0 (refused outside)
Unit
m

Lines generated from the models, as in the reference. Open one for its card.

The step of example 04, then the rate of its steady first month:

simulation.time.step_value in 04_streamflow_intermittence_in_transient/project.toml
simulation.time.step_value
  Forcing/stress-period time-step scalar or inline token '<value> <unit>' (for example '30
  day').
  form       integer or number or string
  default    "1 month"
  current    "1 month"   set by project.toml:39
flow.sinks_sources.recharge.first_clim in 04_streamflow_intermittence_in_transient/project.toml
flow.sinks_sources.recharge.first_clim
  Recharge rate of every steady stress period: every period of a steady run, and the first
  period of a transient run when flow.first_period_steady is true.
  form       string or number
  default    "mean"
  profile    dev
  current    "first"   set by project.toml:129

Checked by#

The tests that import the code of this page. The box is generated: a new test appears here on the next build.

In the code#

What

Where

Window and edges

hydromodpy/core/time/window.py

Station mean, spatial mode

hydromodpy/model/forcing/forcing_bridge.py

The coverage rule, for every record

hydromodpy/core/time/coverage.py

Series to periods

hydromodpy/model/forcing/time_alignment.py, hydromodpy/model/forcing/time_forcing.py

Grids and stations to cells and periods

hydromodpy/model/forcing/ (cells.py, rasters.py, stations.py)

Units, the binders, runoff and lake forcing

hydromodpy/model/boundaries/, hydromodpy/workflow/steps/data.py

Steady periods and the split of a negative recharge

hydromodpy/model/forcing/steady_periods.py

ETP formulas, and the grid they are computed on

hydromodpy/model/soil/etp.py, hydromodpy/model/forcing/etp_computed.py

The recharge scenario

hydromodpy/model/forcing/recharge_scenario.py

The recharge and ETP packages

hydromodpy/solver/modflow6/builders/recharge.py, hydromodpy/solver/modflow_nwt/nwt/payloads/recharge_etp.py, hydromodpy/solver/boussinesq/forcing/

See also#