MODFLOW, ParFlow, ATS and PFLOTRAN#
The hydrological end of the connection. Every other method in this section measures the subsurface; MODFLOW, ParFlow, ATS and PFLOTRAN outputs can be compared with those measurements. Parameter write-back supports MODFLOW and ParFlow.
What you can do#
Read water content, saturation and porosity out of a supported hydrological run, for one timestep or a whole series.
Carry those states through petrophysics into a geophysical property, then forward model the survey that property would produce.
Map an interpreted geophysical quantity back onto the hydrological grid.
Write MODFLOW 6 or ParFlow inputs carrying that update, as a copy. Neither writer modifies the source model and neither runs the solver.
Compare hydrological responses with and without geophysically informed structure.
Required inputs#
ATS and PFLOTRAN snapshot readers are available through the Python API. See ATS and PFLOTRAN outputs to geophysics for output formats, time units, volumetric water content and mapping cells to a geophysical mesh.
Model |
What is read |
Notes |
|---|---|---|
MODFLOW 6 |
UZF water content, porosity |
|
ParFlow |
Saturation, porosity, domain mask |
|
ATS |
Visualization HDF5 scalar cell fields, and the |
Liquid saturation, porosity, derived volumetric liquid water content; the cell centres for spatial interpolation come from ATS’s mesh file. |
PFLOTRAN |
Snapshot HDF5 time groups, single or multiple files |
Preserves native array axes and time units; the cell centres come from
the run’s |
For writing, you supply the update as an array matching the model grid exactly, in the model’s own length and time units.
Typical outputs#
Going out of the model: arrays of water content, saturation or porosity on the model grid, ready for the petrophysical conversion.
Going back in: a copy of the simulation with the mapped fields replaced.
write_modflow6_inputs accepts hydraulic_conductivity,
vertical_conductivity, specific_storage, specific_yield,
initial_head and bottom_elevation; packages, stress periods and boundary
conditions are left as configured.
Choose a workflow#
Your goal |
Start here |
|---|---|
Understand how the two directions connect |
|
Load model outputs and inspect them |
|
Predict an ERT survey from a model state |
|
Predict an EM sounding from a model state |
|
Compare several methods over one profile |
|
Write an interpreted result back into the model |
|
Run MODFLOW with geophysically informed structure |
Desktop support#
Desktop Studio carries the hydrological side in its project tree: Hydro → Geophysics for the forward direction - a survey line drawn on the model’s map, the section under it, and the simulated surveys - and ERT → Water Content for the interpretation that feeds back.
Python examples#
Ex. Loading and Processing Hydrological Model Outputs: read both model families and plot what came out.
Ex. ERT Workflow: From Hydrological Models to ERT responses and Inversion: the full hydrology-to-ERT chain.
Ex. Geophysical structure → MODFLOW → hydrological response: run and compare hydrological responses with a uniform and an interpreted interface. This one actually runs the solver.
Reading a timestep out of each model family:
import numpy as np
from PyHydroGeophysX.model_output import MODFLOWWaterContent, ParflowSaturation
idomain = np.loadtxt("examples/data/modflow/id.txt")
mf = MODFLOWWaterContent(model_directory="examples/data/modflow", idomain=idomain)
water_content = mf.load_timestep(1)
pf = ParflowSaturation(model_directory="examples/data/parflow/test2", run_name="test2")
saturation = pf.load_timestep(0)
Hydro_modular then carries a state straight through to a survey response:
hydro_to_ert, hydro_to_srt, hydro_to_tdem, hydro_to_fdem and
hydro_to_gravity. Each needs the mesh, the profile interpolation and the
petrophysical parameters alongside the model arrays, so
Hydrology to ERT walks one of them end to end rather than
compressing it here.
Relevant API#
model_output package for
MODFLOWWaterContent,MODFLOWPorosity,ParflowSaturationandParflowPorosity.Hydro_modular package for the conversions from a hydrological state to each geophysical method.
model_input package for
write_modflow6_inputs,write_parflow_inputsand the grid mapping that prepares an update.
Limitations and optional dependencies#
MODFLOW support goes through FloPy and ParFlow support through pftools, both
installed by the geophysics extra:
pip install "pyhydrogeophysx[geophysics]"
The ParFlow readers have a standalone PFB fallback and work without pftools.
ATS and PFLOTRAN HDF5 readers require the hydrology extra (h5py), loaded
only when constructing a reader:
pip install "pyhydrogeophysx[hydrology]"
These adapters provide the Python output and interpolation API. The Desktop Studio’s hydrology page, the hydro bundle and the agent workflows read MODFLOW and ParFlow only; ATS and PFLOTRAN are not available there yet. Writing inputs is not running a model: the writers produce a copy for you to run yourself, and the MODFLOW writer requires a MODFLOW 6 groundwater-flow model.