This repository implements physics-informed neural networks (PINNs) and a DeepONet for one-dimensional unsaturated soil water flow governed by the Richards equation. The main implementation lives in piml_models/, where three complementary approaches are provided:
| Model | Directory | Purpose |
|---|---|---|
| Forward PINN | piml_models/forward_pinn/ |
Solve the Richards equation for a fixed upper-boundary flux and soil parameters |
| Inverse PINN | piml_models/inverse_pinn/ |
Estimate Mualem-van Genuchten hydraulic parameters from sparse synthetic data |
| DeepONet | piml_models/deepONet/ |
Learn a solution operator that generalizes over upper-boundary flux functions (Gaussian infiltration scenarios) |
Reference solutions from HYDRUS-1D are stored under hydrus_data/ and used for validation and data-driven terms in the loss.
Physics-informed neural networks embed governing PDEs, initial conditions, and boundary conditions directly into the training loss, so the network respects hydrological physical laws even where data are sparse.
The DeepONet extends this idea: a branch network encodes the upper-boundary flux (sampled at sensor locations in time), and a trunk network maps spatial–temporal coordinates
All three models use Mualem-van Genuchten constitutive relations, nondimensionalization of the Richards equation, and MLflow for experiment tracking.
The (mixed-form) Richards equation is:
where:
-
$\theta$ — volumetric water content [m³/m³] -
$\psi$ — matric head [m] -
$z$ — depth (positive upward) [m] -
$t$ — time [days] -
$K(\psi)$ — hydraulic conductivity [m/days]
Constitutive relations (Mualem-van Genuchten) link
Each subdirectory is a self-contained training pipeline with main.py as the entry point.
- Solves the Richards equation for prescribed initial and boundary conditions and fixed soil hydraulic parameters.
- Physics loss: PDE residual, initial condition, upper/lower boundary fluxes.
- Comparison against HYDRUS output.
- Sensitivity analysis via
main_sensitivity.py.
- Treats van Genuchten parameters
$(\alpha, n, K_s)$ as learnable quantities alongside the neural network weights. - Combines physics loss with sparse matric head data (from HYDRUS).
- Useful for parameter estimation when direct laboratory measurements are limited.
-
Branch subnet: encodes the upper-boundary flux function
$q(t)$ at fixed sensor times. -
Trunk subnet: maps
$(z, t)$ to matric head$\psi$ . - Trained on families of Gaussian flux scenarios parameterized by
$(a, b)$ seerain.pyfor flux definitions. - Enables fast inference for unseen boundary conditions after training.
Shared utilities in each package include model.py, losses.py, sampling.py, train.py, soilFunctions.py, readHydrus.py, and configurator.py.
pinn_soil_water_model/
├── README.md
├── requirements.txt
├── piml_models/ # Main implementations (PINNs + DeepONet)
│ ├── forward_pinn/
│ ├── inverse_pinn/
│ └── deepONet/
├── hydrus_data/ # HYDRUS-1D reference simulations
│ ├── constantUB/
│ ├── gaussianTrain/
│ ├── gaussianTest/
│ └── ...
├── notebooks/ # Exploratory notebooks and tutorials
├── plots/ # Figures for thesis / reports
└── evaluation/ # Saved evaluation outputs
-
Install dependencies
pip install -r requirements.txt
Core packages: PyTorch, NumPy, pandas, matplotlib, scikit-learn, MLflow.
-
Run a model (from the respective subdirectory)
cd piml_models/forward_pinn python main.pycd piml_models/inverse_pinn python main.pycd piml_models/deepONet python main.pyEach run logs hyperparameters, metrics, and artifacts to a local MLflow database (
mlflow.dbin that directory). -
HYDRUS data — Ensure reference
.outfiles are present underhydrus_data/before training models that load numerical solutions.
- Forward simulation: PINN solution for a single boundary flux and soil type.
-
Parameter estimation: Inverse PINN to infer hydraulic properties from
$\psi(z,t)$ observations. - Operator learning: DeepONet surrogate for rapid scenario analysis over varying rainfall / irrigation fluxes.
- Validation: Compare PIML predictions against HYDRUS-1D and published soil hydraulic curves.
- Raissi, M., Perdikaris, P., & Karniadakis, G. E. (2019). Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational Physics.
- Lu, L., Jin, P. & Karniadakis, G. E. (2021). DeepONet: Learning nonlinear operators for identifying differential equations based on the universal approximation theorem of operators. Nature Machine Intelligence.
- Bittelli, M., Campbell, G. S., & Tomei, F. (2015). Soil Physics with Python: Transport in the Soil–Plant–Atmosphere System. Oxford University Press.