Groundwater flow and microbes transport modelling with R and Modflow / Modpath
Groundwater flow simulation and particle tracking to forecast microbial concentration in a drinking water extraction well.
install python-gdal
)mfusg
for MODFLOW usgs, mp6
for MODPATH). If you need binaries compiled for linux (ubuntu) please contact merun.R
)Two possiblities:
run.R
or source run.R
(but don’t forget to adapt line 15 in run.R
the DIR
variable to your directory structureOpen terminal, change directory to “gwModBac” (cd path/gwModBac
), enter
Rscript --vanilla run.R sim_name 15 50 10 4 NULL 100 200 20 OK
run.R
—> path of the file run.R
sim_name
name of the simulation (an output file sim_name.txt
will be created in the directory gwModBac
)15
—> nx: number of cells along the x-direction = number of columns50
—> ny: number of cells along the y-direction = number of rows10
—> nz: number of cells along the z-direction = number of layers4
—> number of runs (but one output file with all the output together)NULL
—> no seed are used. To set a seed for the random number simulator, replace NULL
by any numeric value (e.g., 10
). With a seed, you can reproduce the simulation exactly.100
—> nx_ref: number of columns of the reference simulation (nx_ref >= nx), used to scale down the Gaussian Random Field (only used if a seed number is set)200
—> ny_ref: number of rows of the reference simulation (ny_ref >= ny), used to scale down the Gaussian Random Field (only used if a seed number is set)20
—> nz_ref: number of layers of the reference simulation (nz_ref >= nz), used to scale down the Gaussian Random Field (only used if a seed number is set)OK
[optional] —> can be anything; if the 7th argument is present, an overview plot is created for each single simulation (in the directory simulations
): same plot as in section Groundwater flow simulation and particle tracking. If absent, no plot will be created (faster).Example with fixed seed:
```
Rscript --vanilla run.R sim01 10 20 10 1 102343643 100 200 10 OK
```
Example without fixed seed and without plot:
```
Rscript --vanilla run.R sim01 10 20 10 1 NULL 100 200 10
```
run_para.R
)Only one argument: the config file *.yaml
. All the parameters as well as their prior distributions are explained in the test file sim_parameters.yaml
.
To simulate the 3D hydraulic conductivity field (random Gaussian field), you have two options:
para: TRUE
)para: FALSE
and the code read the file given by file: 'HK.txt'
): one big vector column of length (nx x ny x nz),
```
Rscript --vanilla run_para.R sim_parameters.yaml
```
Output:
projectName/simName.txt
(see sim_parameters.yaml
) with a vector column corresponding to the 10-days ahead forecastplot: TRUE
a plot projectName/simName.png
Minimal possible grid size:
para.R
data/
Some simulation results (with seed = 102343643):
For these results, I recommand to keep nz = 10 and to only vary nx and ny (more stable, better convergence).