Richards
Solving The Richards equation with temporally periodic surface boundary conditions

This is a model for solving the richards equation for unsaturated groundwater flow in one dimension. For background information on the equations used here, please see Chapter 7, Section 4 of Margulis, S. "Introduction To Hydrology." Used as textbook in C&EE 150 (2014).

  • The model uses a nonuniform, finite-volume grid. The surface cell is the smallest, with larger cells at depth.
  • The particular ratio of cell depths can be controlled and a maximum cell depth can be set.
  • The model is set up to use a fully saturated bottom boundary and a top boundary that goes through cycles of full saturation and full dryness. The cycle is meant to simulate periodic wetting events and the amount of water that penetrates to the bottom boundary for different cycle properties and physical parameters.
  • There are three different main programs that generate three different executables.
    1. main.cc is compiled into richards.exe, which integrates the model without any cycling. This program is most useful for testing. The scripts/plot_out.py program plots the results generated by theis program.
    2. main_periodic.cc is compiled into richards_periodic.exe, which spins up the model with cyclical surface wetting, then integrates over a single cycle and writes results. The scripts/plot_period.py script is meant to plot the results of this program.
    3. main_periodic_batch.cc is compiled into richards_periodic_batch.exe, and this program is more involved. It sweeps over ranges of parameters, spinning up and integrating the model for all possible combinations of these parameters. It writes the results of a single cycle for all the combinations. Integrations are performed in parallel, on however many threads you have available. Some of the settins in the input settings file are overridden inside the program.

The first two programs require two input arguments at the command line:

  1. the path of a settings file
  2. the path of an output directory

The third program requires three command line arguments:

  1. the path of a settings file
  2. the domain depth
  3. the path of an output directory

What is a settings file? An example should be included in the repository as settings.txt. This file is the means by which the model is configured. Each program reads and parses the file for information about how to set up the grid, physical parameters, integration settings, and output options. Browse that sample file for a complete list of the settings. The final section of that file, "tracker and output settings", controls which model variables are written to file as part of the model output.

To compile the model, edit the first four variables in the Makefile, then run make. The model runs on top of ODE solvers from libode, which must be downloaded and compiled first.

After things are compiled, a quick test would consist of:

./bin/richards_periodic.exe settings.txt out
cd scripts
python plot_period.py
cd ..