a tutorial
Jaime J. Carrera-Hernandez
January 2005 DRAFT version
McGill University
Department of Civil Engineering and Applied Mechanics
jaime.carrera@mail.mcgill.ca
Abstract
This tutorial shows how to develop groundwater flow models using GRASS
and MODFLOW. This is done through the Groundwater Modeling Tool for
GRASS (GMTG) or r.gmtg module which works under GRASS. This mod-
ule can be used to run stady state and transient simulations on multilayer
aquifers. The current MODFLOW packages supported by r.gmtg are those
used to simulate wells (extraction and injection), rivers, recharge and drains.
1 Introduction
This is a brief tutorial on how to develop groundwater flow models using GRASS
module r.gmtg. The user should be familiar with different modules of GRASS
such as r.reclass, r.mapcalc. For further reference on GRASS you can read the on-
line tutorials or the GRASS book by Neteler and Mitasova (2004). The problems
developed in this tutorial are taken from Chiang (2001), who developed the Pro-
cessing MODFLOW for Windows (PMWIN) software. These examples are used
to compare the results obtained using a well known MODFLOW processor with
those obtained using GMTG. This module is an improved version of the one de-
scribed by Carrera-Hernandez and Gaskin (2004) and current work is being done
to use other MODFLOW packages.
1
1.1 Description of tutorial
The examples developed in this tutorial will help you to gain a general knowl-
edge on how to use GRASS and GMT to develop groundwater flow models. The
tutorial will explain how to:
2. Import ASCII files (e.g. Digital Elevation Models and sites files) using the
module r.in.ascii
2 Module description
The r.gmt module uses GRASS as a preprocessor and postprocessor for MOD-
FLOW. It uses raster maps as input for MODFLOW simulations and then imports
the results to different raster maps with a prefix specified by the user which are
explained in table 1.
r.gmt simulation=value units=value layers=value aqtype=value[,value,. . . ] stress=value
length=value[,value,...] steps=value[,value,...] [tsmult=name[,name,. . . ]] region=name[,name,. . . ]
heads=name[,name,...] [Sy=name[,name,. . . ]] [T=name[,name,. . . ]] [K=name[,name,. . . ]]
[bottom=name[,name,. . . ]] [vcond=name[,name,. . . ]] [top=name[,name,. . . ]] [Syb=name[,name,. . . ]]
[recharge=name[,name,. . . ]] [wells=name[,name,. . . ]] [river_heads=name] [river_cond=name]
[river_elev=name] [drain=name[,name,. . . ]] drawdownin=name headsin=name
3 Requirements
If you are running GRASS under Linux you should not have any problems when
attempting to use GMT; as GMT links GRASS with MODFLOW you need to have
MODFLOW installed on your system. You need to download the source code
available from GRASS TWIKI site http://grass.gdf-hannover.de/twiki/
bin/view/GRASS/JaimeCarrera. From this site you will also need to download
the programs rddown and rheads; these files are required to import MODFLOWs
output into GRASS. All data related to this tutorial is available from the same site.
2
Table 1: Parameters needed to run a simulation using r.gmtg
Parameter Description Value
simulation Type of simulation 0 = Transient
1 = Steady state
units Time units 1 = Seconds
2 = minutes
3 = hours
4 = days
5 = years
layers Number of layers in the model int number
aqtype Type of aquifer 0 = Confined
1 = Unconfined
2 = Variable with
constant T
3 = Variable with
variable T
stress Number of stress periods int number
length Length of each stress period int number
steps Number of time steps for each stress period int number
tsmult Time step multiplier for each stress period float number
region Name of raster map with active cells string
heads Name of raster map with initial heads string
Sy Name of existing raster map(s) with primary storage co- string
efficient values
T Name of existing raster map(s) with Transmissivity. RE- string
QUIRED for CONFINED aquifers or VARIABLE con-
finment aquifers with CONSTANT T
K Name(s) of existing raster map(s) with Horizontal Con- string
ductivity. Required for UNCONFINED aquifers and
VARIABLE confinment aquifers with VARIABLE T
bottom Name of an existing raster map with aquifer bottom. Re- string
quired for unconfined and variable aquifers with variable
T
vcond Name of an existing raster map with Vertical conduc- string
tance
top Name of an existing raster map with Top of aquifer string
Syb Name of an existing raster map with Secondary Storage string
Values
recharge Name of an existing raster map with recharge values string
wells name of sites file(s) containing WELL data string
river heads Name of raster map with stage values for reaches string
river cond Name of raster map containing 3 conductance values for string
reaches
river elev Name of the raster map containing river-bed elevation string
values
drain Name of site map(s) containing drain data string
drawdowninName of raster map for DRAWDOWN simulation values string
headsin Name of raster map for HEAD simulation values string
4 Developing groundwater flow models
This section shows how to use GRASS and GMT to develop groundwater flow
models. However, it is important to stress that this tool is better when using real
world data and to develop groundwater flow models with a conceptual approach.
This tutorial only explains how to use GMT and GRASS to develop groundwa-
ter flow models and the examples are quite simple. The book by Anderson and
Woessner (1992) is a very good reference for groundwater modeling; to learn
more about MODFLOW it is strongly suggested to read its documentation (Mc-
Donald and Harbaugh, 1988).
4.1 Example 1
The first tutorial has two parts:
Creating the region to model: The first step consists in creating the region; if
you already know how to set up regions with GRASS you can skip this section.
First create a directory on which you will have all data and then change to it, then
copy or download the data files into this directory.
[jaime@civpc-08 jaime] mkdir tutorial
[jaime@civpc-08 jaime] cd tutorial
[jaime@civpc-08 tutorial]
4
Figure 1: Model domain for problem 1
5
Figure 2: GRASS initial window Figure 3: Available regions in current di-
rectory
6
(a) Coordinate system for new region (b) Description of new region
7
Figure 6: Raster map imported with r.in.ascii
basemap.map. To import it use the r.in.ascii module and name the resultant map
basemap. If this map is displayed, it should be similar to Figure 6.
GRASS:tutorial > r.in.ascii input=basemap.dat output=basemap
GRASS:tutorial > d.start x0
GRASS:tutorial > d.rast basemap
We do not know the values of the map that was just imported. To find out the
number of categories in a raster map as well as some extra information on it, the
r.info command can be used:
GRASS:/MVB/MODFLOW > r.info basemap
The module r.info shows basic information about a raster map: The lim-
its,resolution and projection; in addition the data range is also displayed. For
this map the minimum value is -1 while the maximum is 2. To find out which
areas correspond to each category you need to diplay the raster map and then use
the module r.what.
We need to assign a value of 0 to those cells that are inactive; in order to do
this, the category values of basemap are reclassified into a new raster file which
will be called boundaries. To create the new map, reclassify the category value 2
into 0 and keep the values of the other two categories.
8
GRASS:> r.reclass input=basemap output=boundaries
We will also create a map with an uniform value of 1; this map will be used to
create the remainder maps for the groundwater model, as the following maps are
still needed:
Initial Heads
Hydraulic Conductivity
Recharge values
Aquifer bottom
The basemap raster map is reclassified to map area with only one category (value
1):
The other raster maps are now created using r.mapcalc as follows:
GRASS: > r.mapcalc H.conductivity=area*160
100%
GRASS: > r.mapcalc recharge=area*.00025
100%
GRASS: > r.mapcalc initial.heads=area*15
100%
GRASS: > r.mapcalc bottom=area*0
100%
GRASS: >
9
The southern boundary is a specified flux boundary of 0.0672 m3 /day/m.In
order to account for this flux a well will be used at each cell with a flow of 0.0672
200 m which equals 13.4 m3 /day. To create a well file an ASCII file is imported
into GRASS using s.in.ascii. Open a text editor such as emacs and type in the
values of table 2 without the header and leaving a space between each value or
use the data available on the web site. Save this file as a plain text with emacs and
now import it using r.in.ascii:
GRASS: > s.in.ascii sites=cst.flux input=cst.flux d=3
GRASS: >
Now all required data to run the groundwater flow model have been set up.
Before running the simulation we need to check if all required data is available:
GRASS: > r.gmt simulation=1 units=4 layers=1 aqtype=1 stress=1
length=1 steps=1 tsmult=1 region=boundaries heads=initial.heads
K=H.conductivity bottom=bottom recharge=recharge wells=cst.flux
drawdownin=dd headsin=hd
The simulated head has been saved on file hd.lay1.stp1.tst1 where hd is the
name entered for the option headsin of GMT. The remainder parts of the file name
are generated automatically to facilitate the task of reading the results of each
simulation: hd.lay1.stp1.tst1 means that this map shows the head at layer 1, for
stress period (stp) 1 at the first time step (tst). Now we can create a vector map
to show drawdown values at increments of 0.5 m. To create this map the module
r.contour is used as follows:
GRASS:/tutorial > r.contour input=hd.lay1.stp1.tst1
output=ss.heads step=0.5 minlevel=15 maxlevel=20
Reading data.
Percent complete: 100%
FPRange of data: min = 15.000000 max = 19.270000
Minimum level will be 15.000000
Maximum level will be 19.000000
Continue?(y/n) [y] y
Now the head values for the simulation as well as the contours at every 0.5 m
can be displayed simultaneously to get a more representative map:
GRASS:/tutorial > d.mon x0
using default visual which is TrueColor
ncolors: 16777216
10
Table 2: Coordinates of wells for specified flux boundary
11
Figure 7: Resulting heads for steady-state simulation
Buttons:
Left: Establish a corner
Right: Accept box for legend
12
4.1.2 Transient simulation
The result of the steady state simulation was a map showing the head distribution
on the model domain; this head will be used as the initial head for the transient
simulation. Transient simulations require more data than steady-state simulations.
Among these data are: Specific yield (Sy ) as well as extraction and recharge rates
for each stress period. For this problem the following data are provided:
2. Recharge occurs during the wet season which lasts four months at a uniform
rate of 7.5 104 m/day.
3. Water is extracted from nine wells at a rate of 3888 m3 /day during the dry
season.
The coordinates of the nine extraction wells are in table 3 which have to be added
to the constant flux boundary wells. Any site file that is created to be used as a
well file for MODFLOW should have the following format:
East North Layer (-)Flow Id
The negative sign in flow is used to indicate that the flow is being extracted
from the aquifer; that is why for the Constant Flow boundary flow rates are posi-
tive, while extraction rates are negative.
13
Because we are using wells to simulate the constant head boundary, when
water is extracted from the aquifer both the extraction wells and the constant flux
boundary wells have to be in one file, so we need to paste these two files and create
one file. This file has to be imported into GRASS. It is important to tell grass that
the file has three dimensions (northing, easting and layer number):
GRASS:tutorial > s.in.ascii sites=wells input=wells d=3
GRASS:tutorial >
There are two seasons (stress periods) in this simulation: wet and dry, thus the
simulation will be run for 2 stress periods. The dry season has a length of 240
days (8 months of the year) with a recharge rate of 0 m/day, while the wet season
lasts the remainder 4 months (120 days) with a recharge rate of 0.00075 m/day.
For the first stress period a total of 12 time steps will be used while for the second
stress period only 6 time steps are required. As this is a transient simulation a
raster map with the Specific Yield (Sy ) is needed as well as the recharge maps for
each stress period. These maps are created using r.mapcalc:
GRASS:/MVB/MODFLOW > r.mapcalc Sy=0.06*area
100%
GRASS:/MVB/MODFLOW > r.mapcalc rch.1=0*area
100%
GRASS:/MVB/MODFLOW > r.mapcalc rch.2=0.00075*area
100%
GRASS:/MVB/MODFLOW >
The input for this simulation is:
GRASS:tutorial> r.gmt simulation=0 units=4 layers=1 aqtype=1
stress=2 length=240,120 steps=12,6 tsmult=1,1 region=boundaries
heads=hd.lay1.stp1.tst1 K=H.conductivity Sy=Sy bottom=bottom
recharge=rch.1,rch.2 wells=wells,cst.flux drawdownin=ddtr headsin=hdtr
The program will import a total of 36 raster maps: For both heads and draw-
down the output is 12 maps for stress period number one and 6 maps for stress
period two. The output of the simulation for time step 12 of stress period one
should be similar to figure 8:
14
(a) Heads for stress period 1 timestep 12
15
Wells in multiple stress periods: The same principle described in the pre-
vious item applies to wells. A well sites map is required for every stress
period of the simulation.
16
Figure 9: Modeling area for problem 2
17
Table 4: Coordinates of extraction wells
18
Figure 10: Vertical conductance variables
20
100%
GRASS:/tutorial2 > r.mapcalc hk.1=5*area
100%
GRASS:/tutorial2 > r.gmtg simulation=1 units=4 layers=3 aqtype=1,3,3
stress=1 length=1 steps=1 tsmult=1 region=active,active,active
heads=initial.heads,initial.heads,initial.heads K=hk.1,hk.2,hk.3
bottom=top.2,top.3,bot.3 top=top.2,top.3 vcond=vcond.1,vcond.2 wells=wells
river_heads=river.head river_cond=river.cond river_elev=river.bed
headsin=hdtest drawdownin=ddtest
Now display the heads map for the first layer, which should be a map similar
figure 11.
5 Concluding remarks
In this tutorial the usage of the module r.gmtg has been explained. This mod-
ule currently supports the following MODFLOW optional packages: river, wells,
recharge and drains. The drain package requires a sites map for every stress period
and the following data:
21
Figure 11: Head distribution in the first layer of example 2
22
References
Anderson, M. P. and Woessner, W. W. (1992). Groundwater flow modelling.
Neteler, M. and Mitasova, H. (2004). Open Source GIS: A GRASS GIS approach.
The Kluwer international series in engineering and computer science. 2nd edi-
tion edition.
23
1500 100 1 13.4 "Cflux"
1700 100 1 13.4 "Cflux"
1900 100 1 13.4 "Cflux"
2100 100 1 13.4 "Cflux"
2300 100 1 13.4 "Cflux"
2500 100 1 13.4 "Cflux"
2700 100 1 13.4 "Cflux"
2900 100 1 13.4 "Cflux"
3100 100 1 13.4 "Cflux"
3300 100 1 13.4 "Cflux"
3500 100 1 13.4 "Cflux"
3700 100 1 13.4 "Cflux"
3900 100 1 13.4 "Cflux"
4100 100 1 13.4 "Cflux"
4300 100 1 13.4 "Cflux"
4500 100 1 13.4 "Cflux"
4700 100 1 13.4 "Cflux"
4900 100 1 13.4 "Cflux"
24