The groundwater flow problem#

What head does the aquifer hold, in every cell and at every time? This page gives the geometry HydroModPy builds for that head, the properties that enter it and the state it starts from. The flow equation itself is MODFLOW’s and is read at its source. For the same subject in plain words, see What HydroModPy does. What each solver supports is listed in Solvers.

Note

Scope. Three solvers read the same [flow] section: MODFLOW 6 (the default), MODFLOW-NWT and the in-house Boussinesq solver. They solve the same physical problem and not the same discrete equations. The balance of the two MODFLOW solvers is in What the solvers solve. The Boussinesq form is on Boussinesq theory. What enters and leaves the aquifer (recharge, drains, streams, lakes, wells) has its own pages: Rain and evaporation: the forcing, The daily soil reservoir and How water leaves the aquifer. Where the one-layer reading stops being true is at the end of Limits.

Notation of this page

Lengths are in meters, time in seconds, and elevation is positive up. A key accepts a value with its unit (“30 m”, “5 m/day”); the code converts it before it builds the solver input. Every symbol of the site is on Notation.

Symbol

Meaning

Unit

Set by

\(d\)

depth below the model top, the variable of the depth factor of a property

m

-

\(\Delta t\)

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

s

step_value

\(\delta t\)

solver time step, \(\delta t = \Delta t / n_\mathrm{sub}\)

s

derived

\(n_\mathrm{sub}\)

number of solver time steps in a stress period

substeps_per_period

\(h\)

hydraulic head, measured from a fixed datum

m

solved, not set

\(h_0\)

head at the start of the run

m

kind

\(z_\mathrm{top}\)

model top, the land surface

m

data.dem

\(z_\mathrm{bot}\)

bottom of the aquifer

m

kind

\(H\)

aquifer thickness, \(H = z_\mathrm{top} - z_\mathrm{bot}\)

m

kind

\(B\)

saturated thickness, \(B(h) = \min\bigl(\max(h - z_\mathrm{bot}, 0), H\bigr)\)

m

state, not a field

\(L_h\)

horizontal length of a flow path, from a divide to the stream that drains it

m

derived

\(H_c\)

thickness of the constant-thickness model

m

thickness

\(z_s\)

elevation of the flat substratum

m

substratum_elevation

\(Z_r\)

value of the substratum raster in a cell

m

path

\(\zeta\)

vertical shift of the raster bottom

m

offset

\(\lambda\)

factor applied to the thickness raster

scale

\(H_\mathrm{min}\)

smallest aquifer thickness a raster kind keeps under the top

m

min_thickness

\(j\)

layer index, from 1 at the top

-

\(n_\mathrm{lay}\)

number of layers

nlay

\(p_j\)

cumulative share of the thickness reached at the bottom of layer \(j\)

genmtd_lay

\(\rho\)

ratio of the thicknesses of two successive layers in the decay rule

lay_decay

\(K\)

horizontal hydraulic conductivity, the same along \(x\) and \(y\)

m/s

flow.param.K.field.value

\(K_z\)

vertical hydraulic conductivity, \(K / \beta\), or the parameter with the id Kv

m/s

vka

\(\beta\)

ratio \(K / K_z\)

vka

\(S_s\)

specific storage

1/m

flow.param.Ss.field.value

\(S_y\)

specific yield

flow.param.Sy.field.value

\(f(d)\)

factor that scales a property with the depth \(d\) below the top

kind

\(d_c\)

characteristic depth of the exponential depth factor

m

characteristic_depth

\(f_\mathrm{min}\)

floor of the exponential depth factor, none when the key is unset

min_factor

\(N\)

recharge rate, positive into the aquifer

m/s

flow.sinks_sources.recharge

\(\bar N\)

recharge averaged over the catchment and a period of time (R_mean_m_s on the stream-network page)

m/s

derived

\(\Phi_{n,p}\)

flow into cell \(n\) from the stress package \(p\), positive into the aquifer

m³/s

flow.sinks_sources, flow.bc

\(n, m\)

cell indices; \(\mathcal{N}(n)\) is the set of cells that share a face with \(n\)

the grid, The mesh

\(a_n\)

plan area of cell \(n\)

m²

the grid

\(G_{nm}\)

conductance between cells \(n\) and \(m\)

m²/s

derived from \(K\), the geometry and the heads

\(w_{nm}\)

width of the face shared by cells \(n\) and \(m\)

m

the grid

\(c_{nm}\)

distance from the centre of \(n\) to the face it shares with \(m\)

m

the grid

\(\varepsilon_h\)

head tolerance of the cyclic spin-up

m

tol_head

The domain#

Two surfaces bound the aquifer.

The top \(z_\mathrm{top}\) is the digital elevation model of the catchment, read from data.dem. By default the grid takes the value of the DEM at the center of each cell, and nothing else moves the top. solver.modflow6.sgrid.top_sampling.mode can ask for a statistic over the pixels of the cell instead, with a lower value for the cells that hold a channel (6. The top of a cell).

The bottom \(z_\mathrm{bot}\) comes from a depth model, chosen by domain.depth_model.kind. Four kinds exist:

Kind

Bottom

Reads

constant_thickness

\(z_\mathrm{bot} = z_\mathrm{top} - H_c\)

domain.depth_model.thickness

flat_substratum

\(z_\mathrm{bot} = z_s\)

domain.depth_model.substratum_elevation

raster_substratum

\(z_\mathrm{bot} = \min\bigl(Z_r + \zeta,\ z_\mathrm{top} - H_\mathrm{min}\bigr)\)

the raster of data.substratum, in meters, on the datum of the DEM

raster_thickness

\(z_\mathrm{bot} = \min\bigl(z_\mathrm{top} - \lambda Z_r + \zeta,\ z_\mathrm{top} - H_\mathrm{min}\bigr)\)

the raster of data.substratum, in meters below the top

A flat substratum is an elevation, not a depth: where the land surface drops under it, no aquifer is left. A raster kind:

  1. reprojects the raster onto the grid of the top;

  2. refuses the run if one cell of the domain has no raster value, so the raster must cover the whole extent of the domain, buffer included when geographic.domain_extent is "box";

  3. applies \(\lambda\) and \(\zeta\);

  4. lowers the bottom to \(z_\mathrm{top} - H_\mathrm{min}\) wherever it would come closer to the top than that, and logs a warning that counts the cells;

  5. refuses the run if every cell needs that correction, since no aquifer would remain.

Four cross-sections of one valley, each with the top and the bottom of the aquifer that one depth model gives.

Fig. 19 The four depth models on one valley, as build_domain returns them. Look at the valley floor of the two raster kinds: where the raster bottom (dotted) comes within \(H_\mathrm{min}\) of the top (8 m here), the cells (dots) are lowered to \(z_\mathrm{top} - H_\mathrm{min}\).#

Take a top of 120 m everywhere and a raster that holds 40 m, or 85 m for the elevation kind, in every cell but one. The table gives the bottom of that cell, as build_domain returns it (the check ran the function).

Depth model

Raster value

\(\zeta\), \(\lambda\)

Bottom

raster_thickness

40 m

5 m, 1

85 m

raster_thickness

40 m

0 m, 2

40 m

raster_thickness

0.5 m, with \(H_\mathrm{min} = 1\) m

0 m, 1

119 m, with a warning

raster_substratum

85 m

-5 m

80 m

A raster kind needs the raster. data.substratum takes exactly one source. A file that inherits a constant thickness removes it with thickness__delete when it switches to a raster ([domain], The grammar of a HydroModPy file).

The thickness of an aquifer is an assumption in this model, not a result. No equation below estimates it. The field of the constant thickness declares itself calibrable, in log space. In the code: Domain._build_surfaces.

The solver grid and its layers#

The grid samples \(z_\mathrm{top}\) and \(z_\mathrm{bot}\) at the center of each cell (the cell layout is on The mesh). A cell with no finite value in either surface becomes inactive in every layer. The grid is refused when \(z_\mathrm{bot} \ge z_\mathrm{top}\) on a valid cell. On a triangle or Voronoi mesh, a warning names the columns thicker than 500 m and than 10 times the median: a raster nodata value read as an elevation produces them (9. The checks the code applies).

The thickness is then cut into \(n_\mathrm{lay}\) layers. The bottom of layer \(j\) is

(22)#\[z_{\mathrm{bot},j} = z_\mathrm{top} - H\,p_j , \qquad p_{n_\mathrm{lay}} = 1 .\]

The shares \(p_j\) are the same for every cell. Three rules build them, chosen by domain.layers.genmtd_lay:

genmtd_lay

\(p_j\)

constant

\(j / n_\mathrm{lay}\)

decay, with \(\rho\) read from domain.layers.lay_decay

\((1 - \rho^{j}) / (1 - \rho^{n_\mathrm{lay}})\)

list

the running sum of domain.layers.lay_proportions

The decay rule needs \(\rho > 1\), and the file is refused otherwise: the layers then thicken with depth. With \(\rho = 2\) and four layers they hold 1, 2, 4 and 8 fifteenths of the column, from the top down. A list must sum to 1. With one layer, \(p_1 = 1\) and the column is one cell. MODFLOW 6 and MODFLOW-NWT both read the table [domain.layers], so a project has one layering whatever solver runs it. A fourth value, surfaces, gives the base of each layer instead of a share (Layers by surfaces).

Four columns of 100 m, each cut into four layers by one rule.

Fig. 21 Four layers in a column of 100 m, from layer_proportions. Look at the decay columns: the larger \(\rho\), the thinner the top layer and the thicker the bottom one.#

What the layers can represent. Every layer reuses the planar cells and their connections. With shares, only the top and the bottom of the column vary from cell to cell, and geology varies through the properties of each layer and cell (The properties). With surfaces, the base of each layer varies too, and a layer thinner than its minimum thickness is pinched out: its cell becomes a vertical pass-through cell, idomain = -1, or keeps the minimum thickness (Layers by surfaces). A pass-through cell holds no head, and MODFLOW 6 connects the cells above and below it. A change of the plan from one layer to the next, or a connection that is not the one of the plan, is not represented. MODFLOW 6 builds every grid, structured or not, as a vertex grid (DISV), never as DISU. The Boussinesq solver has no layers: it works on one triangle per column. In the code: layer_proportions, layer_stack.

The properties#

Each property is a field: one value for the whole domain, or one value per zone ([flow.param]). How a zone map becomes one value per cell is on From a zone map to the cells.

Property

Needed by a steady run

Needed by a transient run

MODFLOW 6 and MODFLOW-NWT

\(K\)

\(K\), \(S_y\), \(S_s\)

Boussinesq

\(K\)

\(K\), \(S_y\)

The Boussinesq solver reads no \(S_s\). In a steady MODFLOW run, a missing \(S_y\) or \(S_s\) is filled with zero. In a transient run, a missing one stops the run. Example 04 gives the three values, one for the whole catchment:

flow.param.K.field.value in 04_streamflow_intermittence_in_transient/project.toml
flow.param.K.field.value
  Hydraulic conductivity   m/s   valid 1e-14 .. 100
  Hydraulic conductivity of the K table, in m/s.
  form       number or "<n> m/s"
  default    not set
  calibrate  log, sampling log_uniform
  only if    kind = "homogeneous"
  current    5e-05   set by project.toml:108
flow.param.Sy.field.value in 04_streamflow_intermittence_in_transient/project.toml
flow.param.Sy.field.value
  Specific yield   -   valid 1e-06 .. 1
  Specific yield of the Sy table, dimensionless.
  form       number
  default    not set
  calibrate  log, sampling log_uniform
  only if    kind = "homogeneous"
  current    0.05   set by project.toml:113
flow.param.Ss.field.value in 04_streamflow_intermittence_in_transient/project.toml
flow.param.Ss.field.value
  Specific storage   1/m   valid 1e-12 .. 0.001
  Specific storage of the Ss table, in 1/m.
  form       number or "<n> 1/m"
  default    not set
  calibrate  log, sampling log_uniform
  only if    kind = "homogeneous"
  current    1e-05   set by project.toml:118

A depth factor. A property can carry a field_vertical_profile. The value of layer \(j\) in a column is the value of the field times \(f(d_j)\), where \(d_j\) is the depth of the middle of the layer below \(z_\mathrm{top}\). The key depth_at moves that point to the top or the base of the layer, or takes the ground for the first layer and the base for the others (surface_then_base). A thick layer reads one value, so the choice moves its K. For kind = "exponential":

(23)#\[f(d) = e^{-d/d_c}, \qquad \text{or } \max\bigl(e^{-d/d_c},\ f_\mathrm{min}\bigr) \text{ when } f_\mathrm{min} \text{ is set.}\]

Without min_factor, the factor has no floor and tends to zero with depth. The decay length \(d_c\) can also follow the ground elevation \(z_\mathrm{top}\) of the column. With characteristic_depth_high, \(d_c\) is the characteristic depth where the ground stands at or below ground_low, the high one at or above ground_high, and goes linearly between. A weathered zone that thins under the hills is written so. For kind = "tabulated", the factor is a linear or stepwise interpolation of the table you give, equal to the first and last factor outside the table. With one layer, \(d_j\) is half the thickness: the profile then gives one factor per cell and no variation with depth. A profile on fewer than five layers is warned about when the file is read. Take a column of thickness \(H = 2.5\,d_c\) and \(K\) at the middle of each equal layer. One layer gives a transmissivity off by \(-22\,\%\) to \(+75\,\%\) as the water table goes from the top to mid-column, three layers by \(-2.8\,\%\) at the top, and five layers by \(-1.0\,\%\).

The exponential depth factor against depth, with and without a floor, and the value of each layer.

Fig. 23 The depth factor for \(d_c = 20\) m, from FieldParam.vertical_factor. Each layer of a four-layer decay column takes the factor at its center (dots), not an average over its thickness. Look at the deepest layer: without a floor its factor would be 0.03, with \(f_\mathrm{min} = 0.05\) it stays at 0.05.#

Vertical conductivity. MODFLOW 6 reads \(K_z = K / \beta\), with \(\beta\) the solver.modflow6.process_specific.vka, layer by layer, so a depth factor on \(K\) reaches \(K_z\). A parameter with the id Kv replaces it with a conductivity per cell, and a file that gives Kv and a vka other than 1 is refused. MODFLOW-NWT reads the same Kv as the vertical conductivity of UPW: the code writes layvka = 0 and vka = Kv, converted to the time unit of the solver like \(K\). A Kv that is not positive is refused.

The code refuses a \(K\) that is zero, negative or not finite on an active cell. A heterogeneous \(K\) whose zones do not cover the whole domain produces exactly that. In the code: FieldParam.vertical_factor.

The conductivity tensor#

The NPF package of MODFLOW 6 reads the tensor by its principal values, \(K\) along the first axis, K22 along the second and \(K_z\) along the third, and by three angles [Langevin et al., 2017]. Four parameters complete \(K\) and Kv for it. K22 is the conductivity along the second axis, and MODFLOW 6 takes \(K\) when it is left out. angle1 turns the first axis from east towards north, counter-clockwise, so it is not a compass azimuth and N30E reads angle1 = 60. angle2 raises the first axis above the horizontal, and angle3 turns the tensor about it. All three are in degrees, zero when they are left out. Each is a [flow.param.<id>] like \(K\), homogeneous or per zone. K22 takes a vertical profile like \(K\), an angle does not. The parameters reach NPF only when the flow sets them, so a run without them writes the same files as before. A non-zero angle2 or angle3 turns XT3D on, because MODFLOW 6 reads these two angles only under XT3D, and so does a K22 whose axes leave the connections of the mesh (XT3D on irregular meshes). The file is refused with MODFLOW-NWT or Boussinesq, which would drop them, and with an angle2 outside \([-90, 90]\) degrees. The run store keeps \(K_z\) and, when set, K22 and the three angles with the other static properties (Storage layout).

[flow]
param_list = ["K", "Sy", "Ss", "K22", "angle1", "angle2"]

[flow.param.K22.field]
kind = "homogeneous"
value = "1e-6 m/s"

[flow.param.angle1.field]
kind = "homogeneous"
value = 30.0

[flow.param.angle2.field]
kind = "homogeneous"
value = 20.0

What the solvers solve#

MODFLOW 6 and MODFLOW-NWT write Darcy’s law and mass conservation for the head in each cell, by control volumes, with one head per cell at its center [Harbaugh, 2005, Langevin et al., 2017]; chapter 2 of Langevin et al. [2017] gives the control-volume form. The derivation is not repeated here. Three pieces of it are used by other pages of this site, so they are written once.

In a catchment the aquifer is mostly unconfined. The head can sit below the top of a cell, and then the thickness that carries flow is the saturated thickness

(24)#\[B(h) = \min\bigl(\max(h - z_\mathrm{bot},\ 0),\ H\bigr) .\]

For a cell \(n\), the balance of one time step is

(25)#\[\sum_{m \in \mathcal{N}(n)} G_{nm}\,(h_m - h_n) + \sum_{p} \Phi_{n,p} = \frac{1}{\delta t}\Bigl[\,S_s\,a_n\,B_n\,(h_n - h_n^\mathrm{old}) + S_y\,a_n\,(B_n - B_n^\mathrm{old})\Bigr] .\]

The left side is the water that enters the cell during the step: the exchange with the neighbors and the stress packages. The right side is the change of the volume stored. \(h^\mathrm{old}\) is the head at the start of the step. This is the one statement of the balance on the site; the solver pages refer to it. Between two cells of a layer, the conductance joins the two half cells in series:

(26)#\[\frac{1}{G_{nm}} = \frac{c_{nm}}{K_n\,B_n\,w_{nm}} + \frac{c_{mn}}{K_m\,B_m\,w_{nm}} ,\]

with \(w_{nm}\) the width of the shared face and \(c_{nm}\) the distance from the center of \(n\) to that face. Under the Newton formulation, the series is built with the full cell thicknesses and multiplied by the saturated fraction of the upstream cell ([Langevin et al., 2017]).

What HydroModPy sets:

  • Every cell is convertible. icelltype = 1 in the MODFLOW 6 NPF package, iconvert = 1 in STO, laytyp = 1 in the MODFLOW-NWT UPW package. The specific yield \(S_y\) acts while the water table is inside the cell, and \(S_s\) above the top of a full cell. In example 04, \(S_y = 0.05\) and \(S_s B \le 3 \times 10^{-4}\), a ratio of about 170.

  • No CELL_AVERAGING option. The series average of the equation above is the MODFLOW 6 default.

  • Newton, with under-relaxation, by default. MODFLOW-NWT is the Newton formulation of MODFLOW-2005 [Niswonger et al., 2011], on the same convertible layers and a structured grid. The options and the stopping tests are on The solution: Newton and IMS.

  • Voronoi faces bisect the centers. That is the case the two-point form of (26) needs. Elsewhere, the XT3D correction is on XT3D on irregular meshes.

  • The Boussinesq solver writes the same balance on triangles. Its edge flux takes the harmonic mean of \(K\) and the arithmetic mean of \(B\) of the two cells, and its storage has no \(S_s\). See Boussinesq theory.

The smoothing of \(B\) near the bottom of a cell is on The solvers of the aquifer.

Time#

The run is cut into stress periods of length \(\Delta t\), one per forcing value (Rain and evaporation: the forcing). Within a period the forcing is constant. Each period is cut into \(n_\mathrm{sub}\) equal time steps \(\delta t = \Delta t / n_\mathrm{sub}\), and the time integration is the backward Euler scheme of [Langevin et al., 2017]: (25) is written with the stress and the conductances at the end of the step. The time step multiplier is 1, so the steps of a period are equal. The one exception is solver.modflow6.runtime.mf6_ats: with it, MODFLOW 6 may cut a transient step further where the solver does not converge, never above the step asked for. The Boussinesq solver takes one step per period.

[simulation.time]
# 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"
# substeps_per_period = 1Number of solver time steps within each stress period, the one knob that buys transient accuracy. - >= 1 dev
Path
simulation.time.substeps_per_period
More

The default of 1 integrates a whole period in a single backward-Euler step, which is not a neutral choice: on a seasonally recharged hillslope drained by DRN cells it moves the monthly discharge by 4 to 28 % against a refined run, across the whole plausible bedrock range, and a calibration scored on discharge absorbs that into the fitted parameters. The right count compares the aquifer response time tau = L^2 S / (K b) with the period length, and the solver cost is linear in it; 30 gives daily steps inside monthly periods. Consumed by the MODFLOW backends as DIS NSTP / TDIS nstp, and by the Boussinesq backend, which solves each period in as many backward-Euler steps of equal length. Every solver stores one result per period: the head at the end of the period and each flux as the mean of its steps, weighted by their length.

Accepted
integer
Valid range
>= 1 (refused outside)
Unit
-

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

The solver time step is a numerical choice: a period solved in one step differs from the same period in several. Time steps gives the size of that difference on a test case.

flow.flow_regime picks the regime. A steady run is one steady period over the whole [simulation.time] window, whatever step the file writes. In a transient run, flow.first_period_steady marks the first period as steady, in the three solvers. In a steady period the right side of the balance is zero, the storage plays no part, and the heads settle where the forcing of that period puts them. Example 04 states the regime:

flow.flow_regime in 04_streamflow_intermittence_in_transient/project.toml
flow.flow_regime
  Whether the flow is solved as one equilibrium state or through time over the stress
  periods of [simulation.time].
  form       "steady" | "transient"
  default    "transient"
  value      "steady"  Solves one equilibrium state, with no storage term: one stress period over the whole [simulation.time] window, whatever its step_value says, with the forcings averaged over the window.
  value      "transient"  Solves the heads through time; it starts from the state [flow.ic] gives.
  current    "transient"   set by project.toml:100

In the code: sto_period_settings.

A long run in windows#

A long transient run can be cut into windows, and Long transient runs in windows gives the commands. Each window is a run of its own, sealed with its own final_state/, and window \(k\) starts from the final state of window \(k-1\). A window edge must fall on the end of a stress period, because a period cut in two would be another problem than the one the run in one piece solves.

# window_length = "1 year"Calendar length of the windows a long transient run is cut into, written '<n> <unit>' with unit hour, day, month or year. example value
Path
simulation.time.window_length
More

The windows start at start_datetime and follow one another; the last one ends with the simulation and may be shorter. Every window edge must fall on a stress period end. Each window is a sealed run of its own, named after the run with _w1, _w2 and so on, that starts from the final state of the window before it. The forcings and the soil reservoir are computed over the whole simulation, so the chain gives the heads of the run in one piece. Absent, the run is one window.

Accepted
string
Example
"1 year", "6 months"
# window = "all"Which windows of window_length this launch plays.
Path
simulation.time.window
More

'all' plays them one after the other and skips those already sealed with the same request. A number k, from 1, plays window k alone, which needs window k - 1 sealed first.

Values
  • "all"
Accepted
integer or "all"
Example
"all", 2

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

A chain is meant to give the same heads as the run in one piece, and it does when the state that passes from one window to the next is not changed on the way. I measured it on a transient MODFLOW 6 model of twelve monthly periods, five time steps each, on a grid of 25 by 25 convertible cells, with a variable recharge and a constant head on one edge, cut after six periods. The first window always equals the start of the run in one piece to the last bit. The second window differs from the end of the run in one piece by the size the start head was written at.

Start head of window 2

Newton

Largest difference, window 2

text, as FloPy writes it

no

1.13e-9 m

text, as FloPy writes it

yes

1.14e-9 m

binary, float64

no

none, equal to the bit

binary, float64

yes

none, equal to the bit

HydroModPy reads final_state/ in float64 and gives the head to MODFLOW 6 as a binary array of float64, so a chain of windows equals the run in one piece to the last bit. A lake stage is written with all its digits for the same reason. On a lake linked to the cells below it, a window that started again from initial_stage was 2.3e-2 m away in head and 3.6e-2 m in stage after six months, a stage written with eight decimals was 1.3e-9 m and 2.1e-9 m away, and a stage written with all its digits was equal to the bit.

One case stays short of the last bit. With SFR and its STORAGE option, final_state/ also keeps the stage of each reach and the next window gives it to MODFLOW 6 as INITIALSTAGES. Without it window 2 is 1.0e-4 m away in head and 1.0e-7 m in stage. With it the difference is 6.4e-10 m in head and 9.0e-13 m in stage. MODFLOW 6 keeps a routing state of the reach beyond its stage, and nothing reads that state again. Writing the stage with 17 digits gives the same difference, so it does not come from the text.

The starting heads of a computed start (steady_state and spinup_cyclic) are those of the run in one piece, and they apply to window 1 only. flow.restart_from is the start of window 1. The soil reservoir runs on the whole simulation, and each window takes its own periods of that run (The daily soil reservoir).

The starting heads#

The head at the start of the run, \(h_0\), is declared in the flat table [flow.ic]. Its value is the same in every layer of a column. bottom is the bottom of the deepest layer.

kind

\(h_0\)

top

\(z_\mathrm{top}\)

top_offset

\(z_\mathrm{top} - v\), with \(v\) the value

bottom

\(z_{\mathrm{bot},n_\mathrm{lay}}\)

custom

\(v\)

steady_state

the solution \(h^\star\) of the steady problem under a constant recharge, see below

spinup_cyclic

the state a cyclic run settles at, see below

In every case, a cell on an imposed head (an ocean, a stream or a side boundary) starts at that head. top is a full aquifer; the card of flow.ic.h.kind gives the default.

The solver does not read this table. prepare_solver turns it into one initial state of the frozen Model, and the backend builds its start heads from that state. The auxiliary solves below are two variants of the Model: steady_variant for steady_state, and cycle_variant for each cycle of spinup_cyclic. A variant is a new object, so the Model of the run is never changed.

The equilibrium. For steady_state, the code first solves an auxiliary steady problem with the same solver, the same grid and the same properties. It starts from the top, whatever the backend, and steady_variant gives it the constant recharge and a single steady period. Its recharge is a constant, set by flow.ic.h.source: the time mean of the record, each period by its length, or the rate that you state. The result is \(h_0\):

\[\nabla\!\cdot\!\bigl(K\,B(h^\star)\,\nabla h^\star\bigr) + \bar N + q_\mathrm{bc}(h^\star) = 0 , \qquad h_0 = h^\star ,\]

where \(\bar N\) is the constant recharge and \(q_\mathrm{bc}\) the exchanges with the boundaries per unit area, held at the value of the first period (flow.ic.h.boundary_condition_policy).

The settled cycle. For spinup_cyclic, the run repeats its own period. Cycle \(c + 1\) starts from the heads where cycle \(c\) ended, \(h_\mathrm{end}^{(c)}\), and the first cycle starts from flow.ic.h.first_cycle_from. cycle_variant hands the end heads of cycle \(c\) to cycle \(c + 1\) as its start. The loop stops when

(27)#\[\max_n \bigl|\,h^{(c+1)}_{\mathrm{end},n} - h^{(c)}_{\mathrm{end},n}\,\bigr| \le \varepsilon_h ,\]

with \(\varepsilon_h\) the flow.ic.h.tol_head, or after flow.ic.h.max_cycles cycles. The maximum counts every cell, not the mean.

Largest and mean change of the end-of-cycle heads against the cycle number, with the tolerance.

Fig. 25 The stopping test of (27), applied by cycles_have_settled to 200 cells of which 10 drift slowly. Look at the two curves: the mean change falls under \(\varepsilon_h\) at cycle 6, the largest change only at cycle 10, and the largest change decides. With the default of 4 cycles, this loop would stop before it settles.#

When the first period is steady. With flow.first_period_steady at its default, period 0 is solved as a steady state, and the heads above are only the first guess of that solve. They change the convergence and not the state reached. To make the run start from a state you choose, set it to false (see [flow.ic]).

A run can also restart from the last time step of an earlier run (flow.restart_from). That state replaces \(h_0\). In the code: build_head_initial_condition_array.

Starts the file refuses. The cycle carries the heads. It does not carry the stage of a lake, which starts again from its initial_stage at each cycle, so a file with a lake and a spinup_cyclic start is refused when it is read. hmp spinup carries both from one cycle to the next. Start from its result with flow.restart_from. That key beside a steady_state or a spinup_cyclic start is refused too, because the computed start would replace the restart without a message. The auxiliary steady solve of steady_state can leave heads that did not converge. A transport run that follows such a start stops with SolverDivergedError, since particles and solutes would follow a head field that is not a solution. The soil reservoir has a start of its own, and the two starts can come from two windows. The starting state says when that is wanted.

What enters and leaves#

The stress terms \(\Phi_{n,p}\) of the balance come from packages. Each one has its page.

Term

MODFLOW 6 package

Page

Recharge \(N\)

RCHA

Rain and evaporation: the forcing, The daily soil reservoir

Evapotranspiration that the soil did not meet, or a negative recharge routed to evaporation

EVTA

The daily soil reservoir, Rain and evaporation: the forcing

Drainage at the land surface

DRN

How water leaves the aquifer

Imposed heads: ocean, stream, sides

CHD

How water leaves the aquifer

Wells

WEL

How water leaves the aquifer

Stream reaches, lakes, flow barriers, water transfers

SFR, LAK, HFB, MVR

How water leaves the aquifer

Recharge and injection are positive when water enters the aquifer, and a well with a negative rate pumps. Where no boundary is activated, the edge of the domain carries no flow. A boundary or a sink is active when its table, under flow.bc.<name> or [flow.sinks_sources], says enabled = true, and enabled = false keeps the table and switches it off.

Limits#

  • Shallow and unconfined. Every cell is convertible. The code is built for the saturated zone of a catchment, from the surface down to a substratum that you place. The thickness is chosen, not computed.

  • No unsaturated flow. The code builds no UZF package. The water that reaches the water table is a recharge, given or computed by the daily soil store of The daily soil reservoir.

  • No density-dependent flow, no compaction, no delayed yield. The code builds neither a BUY nor a CSUB package, and the specific yield releases its water at once.

  • Constant forcing, impervious edges. The forcing is constant over a stress period. The bottom and the sides of the domain are impervious, except where a boundary is activated.

  • A bottom above the top is refused. So is a bottom that equals it, and a raster that leaves one cell without a value.

  • Only layers by surfaces pinch out. Shares give every cell the same proportions, so no layer reaches zero thickness, and the thickness cannot fall below \(H_\mathrm{min}\) with a raster kind. The thickness of a layer by surfaces is an input and is not calibrable.

  • Boussinesq has one layer and no \(S_s\). It reads \(K\) and \(S_y\) only.

  • Newton and rewetting exclude each other in MODFLOW 6.

  • A transient run with the soil reservoir refuses a steady first period. The reservoir sends a daily recharge that is zero after a dry day, and a one-period steady state would start the run from a drained aquifer.

  • Each solver has its own boundaries. What each solver supports is listed in Solvers, and the file is refused when the solver cannot carry a boundary it asks for.

Where the one-layer reading stops#

A model with one layer, and the Boussinesq solver always, are Dupuit by construction: the flow is horizontal and the head does not vary with depth [Brutsaert, 2005, Dupuit, 1863]. Over a flow path of length \(L_h\) through a saturated thickness \(B\), the vertical head difference against the horizontal one scales as \(\beta\,(B / L_h)^2\), an order of magnitude without prefactor. With \(B = 30\) m and \(\beta = 10\), that is 0.036 under hillslopes of 500 m and 0.9 under hillslopes of 100 m, where Dupuit no longer holds. Within about \(B\sqrt{\beta}\) of a stream (100 m here, one or two cells of a 75 m grid), the flow converges and bends upwards. A one-layer model leaves that resistance to the conductance of the drain or of the stream cell (How water leaves the aquifer).

The water table follows the topography, and the drains carry much of the outflow, when the criterion of Haitjema and Mitchell-Bruker [2005] exceeds 1. It compares the recharge, times the squared distance between streams, with the conductivity, the thickness and the largest rise of the land above the streams, and it assumes a uniform recharge and thickness. Below 1, the drains act along the streams only.

HydroModPy has no seepage face below the top of a cell. The drains of the top layer and the surface closures of the Boussinesq solver take the water at the cell top, and a stream imposed as a head fixes the head of the whole cell. With domain.layers.nlay above 1 and a ratio solver.modflow6.process_specific.vka, MODFLOW 6 and MODFLOW-NWT carry one head per layer, so the vertical resistance enters the solution. The code computes none of these ratios and refuses no model for its aspect ratio. A depth factor ((23)) shortens the effective thickness.

Parameters of this page#

The fields below are the ones that appear in the equations. Open a row for its card.

# kind = "constant_thickness"Depth-model kind discriminator.
Path
domain.depth_model.kind
More

Use 'constant_thickness' to define bottom as top-thickness.

Values
  • "constant_thickness" : Vertical model using one constant thickness below topography.
  • "flat_substratum" : Vertical model using one flat (constant-elevation) substratum.
  • "raster_substratum" : Vertical model reading the substratum elevation from a raster.
  • "raster_thickness" : Vertical model reading the aquifer thickness from a raster.
Accepted
"constant_thickness" | "flat_substratum" | "raster_substratum" | "raster_thickness"
# thickness = 50.0Constant aquifer thickness applied below topography (canonical metres). m > 0 only if kind = "constant_thickness" calibrable · log
Path
domain.depth_model.thickness
More

Accepts inline units, e.g. '0.2 km'.

Accepted
number or "<n> m" (a bare number is read in the canonical unit)
Valid range
> 0 (refused outside)
Unit
m
Calibration
yes, search space log, sampling log_uniform, bounds belong to the site: write them in calibration.parameters.<name>.bounds
Only if
kind = "constant_thickness"
# substratum_elevation = 0.0Flat substratum elevation applied over the full domain (canonical metres). m only if kind = "flat_substratum" calibrable
Path
domain.depth_model.substratum_elevation
More

Accepts inline units, e.g. '40 m'. This is an ABSOLUTE elevation, not a depth below topography: where the land surface drops under it, no aquifer is left. Use 'constant_thickness' to follow the relief instead.

Accepted
number or "<n> m" (a bare number is read in the canonical unit)
Unit
m
Calibration
yes, search space identity, sampling uniform, bounds belong to the site: write them in calibration.parameters.<name>.bounds
Only if
kind = "flat_substratum"
# offset = 0.0Vertical shift added to the substratum everywhere (canonical metres). m only if kind = "raster_substratum" | "raster_thickness"
Path
domain.depth_model.offset
More

Positive raises it, so it thins the aquifer. One number to move the whole surface, for a sensitivity test for example. Accepts inline units, e.g. '-5 m'.

Accepted
number or "<n> m" (a bare number is read in the canonical unit)
Unit
m
Only if
kind = "raster_substratum" | "raster_thickness"
# min_thickness = 1.0Smallest aquifer thickness kept under the top (canonical metres). m > 0 only if kind = "raster_substratum" | "raster_thickness"
Path
domain.depth_model.min_thickness
More

Where the raster places the substratum higher than top - min_thickness, it is lowered to that level and a warning counts the cells.

Accepted
number or "<n> m" (a bare number is read in the canonical unit)
Valid range
> 0 (refused outside)
Unit
m
Only if
kind = "raster_substratum" | "raster_thickness"
# scale = 1.0Factor applied to the thickness raster (dimensionless). - > 0 only if kind = "raster_thickness"
Path
domain.depth_model.scale
Accepted
number
Valid range
> 0 (refused outside)
Unit
-
Only if
kind = "raster_thickness"
path = ‹path›Path to a user substratum raster file (GeoTIFF, ASC). required only if source = "file"
Path
data.substratum.sources.path
Accepted
path
Only if
source = "file"
Workspace file
workspace:<name> reads data/substratum/<name> of the workspace, and workspace:. the folder itself
# nlay = 1Number of layers for 'constant' and 'decay'. -
Path
domain.layers.nlay
More

With 'list', the number of fractions sets it, with 'surfaces' the number of layer tables.

Accepted
integer
Unit
-
# genmtd_lay = "constant"How the aquifer thickness is split into layers: equal layers, layers that thicken with depth, the fractions you list, or one base per layer.
Path
domain.layers.genmtd_lay
Values
  • "constant" : Splits local thickness into nlay equal-fraction layers at every cell.
  • "decay" : Grows layer thickness geometrically with depth when lay_decay is above one.
  • "list" : Uses the explicit per-layer thickness fractions given in lay_proportions.
  • "surfaces" : Gives each layer its own base in the [[domain.layers.layer]] tables.
Accepted
"constant" | "decay" | "list" | "surfaces"
# lay_decay = 2.0Ratio of each layer's thickness to the thickness of the layer above it, above 1. - only if genmtd_lay = "decay" example value
Path
domain.layers.lay_decay
More

With 2, each layer is twice as thick as the one above.

Accepted
number
Unit
-
Example
2.0
Only if
genmtd_lay = "decay"
# lay_proportions = [0.2, 0.3, 0.5]Share of the thickness each layer takes, from the top. only if genmtd_lay = "list" example value
Path
domain.layers.lay_proportions
More

The shares must sum to 1.

Accepted
list of number
Example
[0.2, 0.3, 0.5]
Only if
genmtd_lay = "list"
# pinch_out = "pass_through"What a layer thinner than its min_thickness becomes, for 'surfaces'. only if genmtd_lay = "surfaces"
Path
domain.layers.pinch_out
More

Read only with that value of genmtd_lay.

Values
  • "pass_through" : The cell becomes a vertical pass-through (idomain -1, MODFLOW 6 only) and the active cell below it, or above it at the base, takes its thickness.
  • "keep_min_thickness" : The base of the layer moves down to keep min_thickness, and the layers below and the base of the aquifer with it. MODFLOW-NWT reads only this value.
Accepted
"pass_through" | "keep_min_thickness"
Only if
genmtd_lay = "surfaces"
# value = "1e-5 m/s"Hydraulic conductivity of the K table, in m/s. m/s [1e-14, 100] only if kind = "homogeneous" calibrable · log example value
Path
flow.param.K.field.value
More

A value outside 1e-14 .. 100 m/s is refused.

Accepted
number or "<n> m/s"
Valid range
[1e-14, 100] (refused outside)
Unit
m/s
Example
"1e-5 m/s"
Calibration
yes, search space log, sampling log_uniform, bounds belong to the site: write them in calibration.parameters.<name>.bounds; the valid range [1e-14, 100] caps them
Only if
kind = "homogeneous"
Same as
flow.param.<id>.field.value, with the unit and range of K
# value = "1e-5 m/s"Specific yield of the Sy table, dimensionless. - [1e-06, 1] only if kind = "homogeneous" calibrable · log example value
Path
flow.param.Sy.field.value
More

A value outside 1e-06 .. 1 is refused.

Accepted
number
Valid range
[1e-06, 1] (refused outside)
Unit
-
Example
"1e-5 m/s"
Calibration
yes, search space log, sampling log_uniform, bounds belong to the site: write them in calibration.parameters.<name>.bounds; the valid range [1e-06, 1] caps them
Only if
kind = "homogeneous"
Same as
flow.param.<id>.field.value, with the unit and range of Sy
# value = "1e-5 m/s"Specific storage of the Ss table, in 1/m. 1/m [1e-12, 0.001] only if kind = "homogeneous" calibrable · log example value
Path
flow.param.Ss.field.value
More

A value outside 1e-12 .. 0.001 1/m is refused.

Accepted
number or "<n> 1/m"
Valid range
[1e-12, 0.001] (refused outside)
Unit
1/m
Example
"1e-5 m/s"
Calibration
yes, search space log, sampling log_uniform, bounds belong to the site: write them in calibration.parameters.<name>.bounds; the valid range [1e-12, 0.001] caps them
Only if
kind = "homogeneous"
Same as
flow.param.<id>.field.value, with the unit and range of Ss
# kind = "none"Depth dependency shared over the full domain.
Path
flow.param.<id>.field_vertical_profile.kind
More

Allowed values: 'none', 'exponential', 'tabulated'.

Values
  • "none"
  • "exponential"
  • "tabulated"
Accepted
"none" | "exponential" | "tabulated"
Was
flow.param.field_vertical_profile.mode
# characteristic_depth = ‹number or "<n> m"›Characteristic depth for kind 'exponential'. m > 0 calibrable · log
Path
flow.param.<id>.field_vertical_profile.characteristic_depth
More

Vertical factor is exp(-depth/characteristic_depth). Calibrate it with [calibration.parameters."K.characteristic_depth"] (or the field's own id); the range belongs to the site, so a file has to state it.

Accepted
number or "<n> m" (a bare number is read in the canonical unit)
Valid range
> 0 (refused outside)
Unit
m
Calibration
yes, search space log, sampling log_uniform, bounds belong to the site: write them in calibration.parameters.<name>.bounds
# min_factor = ‹number›Optional floor factor for kind 'exponential'. [0, 1] calibrable
Path
flow.param.<id>.field_vertical_profile.min_factor
More

If provided, factor is max(exp(-depth/characteristic_depth), min_factor). Calibrate it with [calibration.parameters."K.min_factor"].

Accepted
number
Valid range
[0, 1] (refused outside)
Unit
-
Calibration
yes, search space identity, sampling uniform, bounds belong to the site: write them in calibration.parameters.<name>.bounds
[solver.modflow6.process_specific]
# vka = 1.0Uniform vertical anisotropy ratio kh/kv (dimensionless, > 0); k33 = k / vka. - > 0 calibrable · log expert
Path
solver.modflow6.process_specific.vka
More

Default 1.0 is vertically isotropic. For spatial control declare a per-cell 'Kv' flow parameter instead, which is mutually exclusive with a non-unit vka and is a direct conductivity, never a mode-switched value. Vertical anisotropy is grid-aligned and needs no XT3D. The rest of the tensor is set by the flow parameters 'K22', 'angle1', 'angle2' and 'angle3'; a tilt, or a K22 off the grid axes, turns XT3D on.

Accepted
number
Valid range
> 0 (refused outside)
Unit
-
Calibration
yes, search space log, sampling log_uniform, bounds belong to the site: write them in calibration.parameters.<name>.bounds
# flow_regime = "transient"Whether the flow is solved as one equilibrium state or through time over the stress periods of [simulation.time].
Path
flow.flow_regime
See
simulation.time
Values
  • "steady" : Solves one equilibrium state, with no storage term: one stress period over the whole [simulation.time] window, whatever its step_value says, with the forcings averaged over the window.
  • "transient" : Solves the heads through time; it starts from the state [flow.ic] gives.
Accepted
"steady" | "transient"
Example
"steady", "transient"
# 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
# kind = "top"Initialize head at the top surface (full aquifer).
Path
flow.ic.h.kind
Values
  • "top" : Initialize head at the top surface (full aquifer).
  • "top_offset" : Initialize head at the top surface minus a vertical offset value.
  • "bottom" : Initialize head at the bottom surface (empty aquifer).
  • "custom" : Initialize head with one explicit numeric value.
  • "steady_state" : Initialize a transient run from a same-solver steady solve.
  • "spinup_cyclic" : Initialize a transient run by repeating it until the state stops moving.
Accepted
"top" | "top_offset" | "bottom" | "custom" | "steady_state" | "spinup_cyclic"
# value = ‹any value›Number the starting state reads, in metres: the head for kind 'custom', the depth below the top for kind 'top_offset'. m
Path
flow.ic.h.value
More

The other kinds refuse it.

Accepted
any value
Unit
m
# source = ‹"recharge" | "mean_recharge" | "prescribed"›Forcing source used by the initialization solve. only if kind = "steady_state"
Path
flow.ic.h.source
More

'mean_recharge' is an alias for source='recharge' with recharge_statistic='time_mean'. 'prescribed' holds the solve at the single rate given by rate instead of reading the chronicle.

Values
  • "recharge"
  • "mean_recharge"
  • "prescribed"
Accepted
"recharge" | "mean_recharge" | "prescribed"
Only if
kind = "steady_state"
# boundary_condition_policy = ‹"first_period"›Policy used for transient boundary-condition chronicles during the steady initialization solve. only if kind = "steady_state"
Path
flow.ic.h.boundary_condition_policy
Values
  • "first_period" no explanation
Accepted
"first_period"
Only if
kind = "steady_state"
# max_cycles = 4Most cycles the loop may run. - [1, 50] only if kind = "spinup_cyclic"
Path
flow.ic.h.max_cycles
More

A loop that runs out of cycles still hands back its last state and says so, rather than reporting a convergence that did not happen. A count.

Accepted
integer
Valid range
[1, 50] (refused outside)
Unit
-
Only if
kind = "spinup_cyclic"
# tol_head = "0.01 m"Largest head change between two cycles that counts as settled, anywhere in the domain. m only if kind = "spinup_cyclic"
Path
flow.ic.h.tol_head
More

One centimetre is a starting point; the honest check is to loosen it and see whether what you report moves.

Accepted
number or "<n> m" (a bare number is read in the canonical unit)
Unit
m
Only if
kind = "spinup_cyclic"
# first_cycle_from = "top"Where cycle one starts. only if kind = "spinup_cyclic"
Path
flow.ic.h.first_cycle_from
More

'top' is the water table at the surface, which the cycling then drains. 'steady_state' starts from the equilibrium under the mean forcing, which is closer and usually saves a cycle.

Values
  • "top"
  • "steady_state"
Accepted
"top" | "steady_state"
Only if
kind = "spinup_cyclic"
# sim_id = ‹string›Id of the sealed run whose last heads seed this one
Path
flow.restart_from.sim_id
Accepted
string
# path = ‹string›Field store or run directory, relative to the project root or absolute
Path
flow.restart_from.path
Accepted
string

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

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

The top, the bottom and the raster depth models

hydromodpy/model/domain/domain.py (Domain._build_surfaces, Domain._substratum_from_raster), hydromodpy/model/domain/depth_model_config.py

Reading the substratum raster

hydromodpy/model/domain/build.py (read_substratum_source)

Layers, the check bottom below top

hydromodpy/model/domain/layering.py (layer_proportions, layer_stack, pinch_out, assert_bottom_below_top), hydromodpy/solver/modflow_grid/discretization_spatial.py (build_spatial_discretization)

The properties, per cell and per layer

hydromodpy/solver/modflow6/support/property_mapping.py (resolve_k33_field, K_TENSOR_NPF_NAMES), hydromodpy/model/properties/property_table.py, resolve_required_flow_properties

The depth factor

hydromodpy/model/properties/vertical_profile.py (vertical_factor, read by FieldParam.vertical_factor), SolverMesh.layer_center_depths

The MODFLOW 6 balance: NPF, STO, IC, Newton

hydromodpy/solver/modflow6/build.py (run_pre_processing), hydromodpy/solver/modflow6/builders/solver_options.py (newton_options)

The MODFLOW-NWT balance: UPW

hydromodpy/solver/modflow_nwt/nwt/_pre_processing.py

Steady and transient periods

hydromodpy/solver/modflow_grid/discretization_temporal.py, hydromodpy/solver/modflow6/builders/period_forcing.py (sto_period_settings)

The Model a solver reads, and its variants

hydromodpy/model/model.py (Model, steady_variant, cycle_variant, model_from_flow)

The windows of a chain

hydromodpy/core/time/window.py (chain_windows, window_grid), hydromodpy/project/windows.py (run_windows), hydromodpy/results/storage/final_state.py (FinalState)

The starting heads

hydromodpy/model/initial_config.py (initial_state_of), hydromodpy/model/initial/state.py (the five states), hydromodpy/model/initial/heads.py (cycles_have_settled), hydromodpy/solver/modflow6/builders/initial_conditions.py (build_start_heads)

See also#