Gv8 Tutorial Manual-4
Gv8 Tutorial Manual-4
Gv8 Tutorial Manual-4
Introduction
Written by
John Doherty
Watermark Computing
Jim Rumbaugh
Environmental Simulations, Inc.
This tutorial demonstrates some of the advanced and exciting opportunities for model calibration available
through PEST and supplementary software available through the Groundwater Data Utilities. By the time
you have finished this exercise you will have:
- used pilot points as a means of characterising the spatial distribution of an aquifer hydraulic
property;
- used PEST’s advanced regularisation functionality in conjunction with geostatistically-based
regularisation constraints;
- used Groundwater Vistas to assist in PEST input file preparation.
This exercise is based on the Groundwater Visas (GV) graphical user interface (GUI), which simplifies the
use of PEST and some of the utility programs related to pilot point calibration.
Strategy used in the Present Exercise
In the present exercise MODFLOW will only be run as a “forward model”; ie. it will be run to calculate
outputs - in this case head outputs. Furthermore, spatial interpolation of MODFLOW-generated heads to
the sites of bores will not be undertaken using the MODFLOW-2000 observation process; rather it will be
undertaken using Groundwater Vistas’ targpest program. In some contexts, as is demonstrated below, this
facilitates preparation for a PEST run. Furthermore, the same utilities can be used to interpolate MT3DMS
concentration outputs to the sites of bores. (There is no observation process within MT3DMS to do this, so
the use of such external spatial interpolation software is a necessity.)
In the present exercise the spatial distribution of transmissivity (rather than of hydraulic conductivity)
within the model domain will be estimated on the basis of borehole head and concentration measurements.
Estimation of transmissivity is entirely appropriate in the present case because we will be simulating steady
state water levels in a heterogenous aquifer in which the spatial distribution of bedrock depth is only poorly
known. Because parameter estimation is restricted to transmissivity only, the MODFLOW bcf package will
be used in preference to the MODFLOW-2000 lpf or huf packages. Use of this strategy allows us to set the
MODFLOW LAYCON variable to zero for the single layer comprising the model; this allows MODFLOW
to run quickly (an advantage in the present circumstances), and removes the possibility of any numerical
problems being encountered through the drying and rewetting of cells.
For the present exercise the MODFLOW, rather than MODFLOW-2000, version of MODFLOW is used.
However use of MODFLOW-2000 would be almost identical.
A river runs along the south-western boundary of the study area, simulated by a line of fixed head cells in
the model; the head in the river is 20m. To the north-east of the river, and running parallel to it, is a broad
band of alluvium. Not many holes have been drilled all of the way through this alluvial material into the
rocks which underlie it; hence information on basement depth is only sporadic. Nevertheless, based on
those holes that have been drilled to date, alluvial thickness seems to average about 30m. An old creek
channel, oriented in a north-easterly direction, exists in the north of the study area. The alluvium in this old
creek channel is not quite as thick, and not quite as hydraulically conductive, as that in the main alluvial
band running parallel to the river. To the east and west of this old creek channel are basaltic rocks. Though
not as permeable as the alluvium, these rocks are nevertheless able to conduct water through fractures and
vesicles, the latter occurring especially at the interface between successive flows.
Because the present study area is actually a figment of my imagination, I am able to disclose to you the
“real” distribution of transmissivity within the geological units which underlie it; see Figure 2. (This was
generated with the help of a stochastic field generator based on Mejia’s algorithm.) Within the main
alluvial unit, transmissivity varies between about 65 m2|day and 140 m2|day, being generally higher
downstream and closer to the river. Within the old creek system, transmissivity varies between 60m2|day
and 80m2|day. Transmissivity is uniformly 20m2|day in the western basalt and uniformly 30m2|day in the
eastern basalt.
Effective porosity of all alluvial material is 0.07.
The north-west and south-east boundaries of the model domain have been chosen to coincide with
groundwater flow lines. The north and north-eastern boundaries coincide with a groundwater divide.
Recharge to the groundwater system is different within each of the geological units prevailing in the study
area. Within the broad alluvial system associated with the river, recharge is 7×10-4m|day (about 255
mm|yr), while within the smaller alluvial unit comprising the old creek system, recharge is 5×10-4m|day
(about 180 mm|yr). In the basalt unit to the west of this, recharge is 1×10-4m|day (about 36 mm|yr) whereas
in the basalt unit to the east of the old creek system, recharge is 2×10-4m|day (about 72 mm|yr).
The focus of interest in the present study is a site whose dimensions are about 60m ×60m situated within
the main alluvial unit near the place where it is joined by the old creek system; see Figure 2. Drilling and
water sampling within the main alluvial unit to the south-west of that site has revealed a contaminant plume
originating from under the site. A study of management records at the site has revealed that leakage has
probably been occurring for about 1500 days; however as soon as it was detected, measures were
immediately taken to prevent any further leakage. The contaminant leakage rate was such that there was
minimal effect on the overall groundwater recharge rate under the site. However recharge waters entering
the groundwater system under the site over the 1500 days during which leakage took place contained
contaminant at a concentration of 100 units|m3.
Figure 3 shows the steady state piezometric surface within the study area, as well as the disposition of the
contaminant plume at the time its presence was first detected, ie. after 1500 days of continuous leakage. As
is the case for the geological map pictured in Figure 2, when we come to calibrate a model for this study
area shortly, we will not have the luxury of knowing either the head or contaminant distribution in anything
like the detail pictured in Figure 3.
Figures 4 and 5 depict the fate of the contaminant over time if no remedial action is taken. Over a period of
5000 days, starting at the time of commencement of leakage into the groundwater system, 324112 units of
contaminant will enter the river at the lower end of the groundwater system. Only about 15 of these units
entered the river during the 1500 days of leakage. A total of 378000 units of contaminant actually entered
the groundwater system under the leaking site during the 1500 days over which leakage took place.
If we had complete knowledge of the hydraulic properties of the system it would be a simple matter to
simulate the efficacy of the proposed remediation strategy on a computer, and thereby ensure that the
regulatory requirement is met. Unfortunately, many modelling efforts are conducted under the pretence that
such perfect knowledge of the system exists, for they do not take account of the fact that uncertainties in
model parameterisation can lead to large uncertainties in model predictions. For the purposes of the present
practical exercise we will assume that we know a lot about the system - more than we would probably
know in real life; we will assume that our knowledge of recharge, the source concentration of the
contaminant, the disperssivity and effective porosity of the subsurface, and the amount of time over which
the contaminant was leaking, are all perfect. However we will acknowledge that we do not know the details
of the geologically complex medium pictured in Figure 2. Hence we will parameterise our model in a way
that accommodates the existence of such geological heterogeneity, and explore the predictive uncertainty
arising from our lack of knowledge of the details of this heterogeneity.
But before we do any of that, let us find the “answer at the back of the book” by running a
MODFLOW|MT3DMS model on the basis of the “true” geological conditions.
The model is run over two stress periods, the first of 1500 days duration and the second of 3500 days
duration; during the second stress period the extraction bore operates continuously. Steady state conditions
are assumed to prevail over both stress periods. (This is a slight violation of reality as some time must
elapse before water levels adjust to the introduction of pumping; however as the adjustment time is not
large in comparison to the length of the stress period, the errors incurred by this assumption are likely to be
minimal. Use of this strategy has the beneficial effect that file transfer between MODFLOW and MT3D is
minimised, for only a steady state flow field needs to be passed between the two models during every stress
period.)
The model possesses only a single layer, three-dimensional aspects of the flow and transport processes
being neglected for the present purposes.
Run the model now from Groundwater Vistas by pressing the calculator button on the toolbar.
Create datasets when prompted.
Import the results of the simulation for the first stress period and first time step. The default stress period is
2 when you are prompted to import the results. You must change it to 1 in order to have your plot look like
the one below.
Your contours should be the same as those shown below:
Zone 2
Zone 1 Zone 4
You can see these zones by opening the Groundwater Vistas model called ex1a.gwv. Select
Props|Hydraulic Conductivity and your screen should look like the one below:
The placement of pilot points at the locations shown in Figure 8 is somewhat subjective. Nevertheless a
strategy was followed in choosing their locations:-
- One point was assigned to each of zones 3 and 4 to make them effectively uniform, as described
above.
- Where more than one point was assigned to a zone, the points were distributed pervasively
through the zone, including right up to the zone boundaries (especially the downstream boundary,
as this gives PEST the chance to implant continuous geological structures in the subsurface which
may have a pronounced effect on the movement of contaminants within it).
- Pilot point density was increased where there is greater density of observation points.
Conventional wisdom dictates that the number of parameters involved in a parameter estimation exercise
should be kept to a minium. However when using pilot points in conjunction with PEST’s new
“regularisation” mode, the opposite is often true. PEST’s regularisation functionality prevents the onset of
numerical instability, which often accompanies attempts to solve over-parameterised inverse problems.
Furthermore, a superfluity of pilot points allows PEST to achieve a much better fit between model
outcomes and field observations. PEST’s regularisation functionality will be discussed shortly. For the
moment, we will use pilot points without regularisation in parameterising our model.
Spatial Interpolation using Pilot Points
The use of pilot points in characterising the spatial distribution of a hydraulic property must be
accompanied by a mechanism whereby hydraulic property values assigned to pilot points are spatially
interpolated to the cells of the finite difference grid. If using programs provided with the Groundwater Data
Utilities, spatial interpolation is accomplished using the kriging algorithm. Kriging is a method of spatial
It is always a good idea to create a new set of MODFLOW input files after making changes to PEST
options. Select Model|MODFLOW|Create Datasets now. Confirm that these settings have been turned on
and then select Model|PEST|Create Data Sets. You should see some DOS windows come up as GV runs
the PEST utility software.
Program PPK2FAC will now be run in order to generate a set of kriging factors by which the transmissivity
at each cell centre can be calculated from the transmissivities assigned to the pilot points.
After PKKFAC has run to completion three new files will exist in your working directory. Factors1.dat
contains kriging factors for all active cells in the model domain. Sd1.ref contains a MODFLOW-compatible
Interpolation of hydraulic property values assigned to pilot points to the centres of cells comprising the
finite difference grid is undertaken using program FAC2REAL. In a pilot point file, the value assigned to
each point comprises the fifth element of each line. GV creates this file and calls it points#.dat where # is
the layer number. In this example, there is only one layer so the file is called points1.dat.
FAC2REAL writes a MODFLOW-compatible array of real numbers to a file named root#._kx where # is
the layer number and root is your root file name for the MODFLOW run (ex1a in this example). The
elements of this array are comprised of numbers interpolated from the sites of pilot points to the centres of
finite-difference cells comprising zones 1, 2, 3 and 4 of the model domain. Spatial interpolation is carried
out by applying the kriging factors calculated by PPK2FAC to the pilot point values supplied in the fifth
column of the pilot points file. It is important to note the following aspects of the interpolation process
carried out by FAC2REAL.
FAC2REAL can apply upper and lower limits to interpolated values at cell centres. This can be very useful,
for interpolated values can sometimes be higher or lower (even negative) than any of the values assigned to
the pilot points; this is more likely to happen when pilot points are close together and when the Gaussian
variogram is used. In the present instance the lower interpolation limit is set uniformly at 10-6 and the upper
After a PEST run is complete, optimised parameter values are listed in the run record file (in this case
ex1a.rec). They are also recorded in a “parameter value file”, in this case ex1a.par. You can look at these
files from GV by selecting Model|PEST|View Main Output File or Model|PEST|View Parameter
Estimates. GV launches a text editor (notepad by default) to show these output files.
As usual, MODFLOW-generated heads are to be found in ex1a.hds. You can select Plot|Import Results
and click OK to view the calibrated heads. Select Plot|Calibration|Stats-Plots to see the calibration
statistics. If you click the button to plot observed versus simulated heads, your plot should look similar to
the following:
A comparison of Figure 10 with Figure 2 (which shows the “true” transmissivity distribution) reveals that
although the “calibrated” transmissivity field has certain things in common with the true field (for example,
the tendency of transmissivities to increase toward the eastern end of the river alluvium), there are
nevertheless significant differences between the two transmissivity fields. Remember, however, that both
transmissivity fields result in a perfect fit between model-generated heads at boreholes and their respective
field-measured counterparts.
The difference between the “true” and calibrated transmissivity fields is depicted in Figure 11. Differences
as high as ±40m2|day can be seen within the river alluvium. It is thus apparent that the transmissivity
distribution within the river alluvium cannot be uniquely determined through calibrating the model against
water levels measured in available bores. In fact, the transmissivity distribution shown in Figure 10 is just
one of an infinite number of transmissivity fields that would also have resulted in a perfect, or near-perfect,
fit between model outcomes and field measurements. The big question is, given the uncertainty in the
transmissivity field determined through the calibration process, what is the uncertainty in model predictions
of contaminant movement, and hence in its predictions regarding the efficacy of the remediation system?
If MT3DMS is now run on the basis of the transmissivity field shown in Figure 10 in order to evaluate the
efficacy of the remediation system, it is found that the amount of contaminant entering the river over the
5000 day simulation time is 2167 units.
When writing the new PEST control file, PPKREG sets the PESTMODE variable to “regularisation”, ie. it
informs PEST that it must run in “regularisation” mode. When run in this mode, a number of control
variables are required in the PEST control file, in addition to those required when PEST is run in
“parameter estimation” mode. One of these variables is PHIMLIM. This specifies the degree of model-to-
measurement misfit that is allowed to occur in the present optimisation process. Because the attainment of a
good model-to-measurement fit, and the simultaneous enforcement of homogeneity constraints, may place
conflicting requirements on parameter values, a compromise between the two must be reached. The user
determines the “compromise level” by setting a maximum model-to-measurement misfit that he|she will
tolerate, this misfit being expressed in terms of the “measurement objective function”. The maximum
permissible value of the measurement objective function (ie. PHIMLIM) should be set a little higher than
the objective function that it is possible to achieve without any regularisation constraints being enforced.
From our previous run we know that we can obtain an objective function of almost zero without
regularisation. In the present case we set PHIMLIM at 0.1, thus informing PEST that we will tolerate an
rms model-to-measurement misfit of 7 cm. (Divide 0.1 by the number of observations, then take the square
root to obtain this figure.)
A comparison between Figure 12 and Figure 2 indicates that the calibrated transmissivity distribution
depicted in Figure 12 does indeed replicate the general rise in transmissivity to the south-east that is present
Now, considering that most of the tasks in 1 through 5 above need to be done at the command line, this
makes SVD a bit difficult to implement in practice (unless you are over 40 and still remember DOS).
Recognizing this problem, we have created a special menu in Vistas that duplicates the steps above. All
you have to do is execute the menu commands from top to bottom without skipping a step and it is
relatively easy to use SVD. This new menu is under Model|Pest|SVD Assist|… as shown below:
Setting Up Pest
This example is a variation on the basic Groundwater Vistas tutorial model. We created a heterogeneous
hydraulic conductivity field, ran this hypothetical model, and extracted water level targets. You will start
with a homogeneous model, add calibration targets, add pilot points, and then use SVD to calibrate the
model. Start by opening the GV file called New_GV8_tutorial_pilotstart.gwv (NOTE: there are several
files with similar names – be sure to get the right one). After opening this model, your screen should look
like the one below:
After the run finishes, we need to run SVDAPREP to reconfigure the Pest control file to use a set of super
parameters. A super parameter is a linear combination of the base parameters (pilot points in our case).
The question that is always asked is how many super parameters should you use? A new utility called
SUPCALC estimates the minimum and maximum number of super parameters for a calibration. To run
SUPCALC, first select Model|Pest|Options and select the Regularization tab. The value of PHIMLIM is
the objective function (sum of squared residuals) you think is reasonable to attain. Since this is a synthetic
The important thing to note is the minimum and maximum number of super parameters which in this case
should be around 15 to 42. We will use 40 but you might also try a lower value to see if it makes a
difference.
To continue the calibration, select Model|Pest|SVD Assist|Launch SVDAPREP. A dialog is displayed
with 3 options. Change the number of super parameters to 40 (between the range shown above from
SUPCALC) and make sure the super parameter calculation option is set to 1. Click OK and GV will run
the SVDAPREP utility to create a new Pest file (called t2p_svd.pst).
Next, select Model|Pest|SVD Assist|Launch SVD Run. You should now see that Pest is running the
model 40 times per iteration (80 times after the first iteration when it switches to central differencing). Let
it go 10 iterations. If you get tired of waiting, use Model|Pest|Stop Pest Run to kill the run. Pest always
ends gracefully though so you can still use the results even if you end the run prematurely.
In order to have the right results for the next session on Null Space Monte Carlo, allow the run the go for
10 iterations. After it starts on the 10th iteration, select Model|Pest|Stop Pest Run. The last step is to use
Model|Pest|SVD Assist|Create Final Run. This tells GV to run PARREP to assemble the final set of
parameters, modify the Pest file to make only one model run, and run Pest with that final dataset.
To view the results of that final calibration run, use Plot|Import Results and click OK. Your screen
should look like the following (the following is based on 10 iterations – you will also have to change the
contouring parameters a bit):
Save this as your final calibrated model using a new file name.
Now, open your previous Groundwater Vistas file (New_GV8_tutorial_pilotsetup.gwv) that contained the
setup for this calibration. Select Model|Pest|Update Parameters. Answer Yes to reset the parameters and
NO to reset hydraulic conductivity values. This will update our pilot points to the final calibrated values
but not import the final Kx and Kz matrices. This will serve as the starting point for the next session where
we explore the new Null Space Monte Carlo procedure.
Select File|Save As and name the file New_GV5_tutorial_NullSpace.gwv which we will use in the next
session.
This model should be ready to run Pest to compute the sensitivity run. All of the preparation for using
Beopest is exactly the same as for a normal Pest run. You can use it for non-SVD Assist calibrations as
well. We are showing the SVD Assist example because it is more complicated than a normal calibration
run.
Start by creating 4 new folders where the “agent” simulations will be run. An agent is the version of pest
that will actually make the individual model runs. The “manager” is the version of pest that does the actual
calibraiton and directs the agents to make model runs. Note that in previous versions of Groundwater
Vistas and Pest, these terms were Master and Slave. However, those terms are not politically correct so
they have been changed.
Create the 4 new folders under the c:\gwv8\models directory. Call them run1, run2, run3, and run4. In File
Explorer your models folder should look like the following:
Create a new set of MODFLOW files and run MODFLOW to make sure that all of the input files exist for
this simulation.
Note that the directory names above should be on the same computer as the main beopest manager run.
You are not limited to this, though. You can also have use other computers as long as they have internet
access so they can access the IP address of the manager computer. In this case, though, you will have to
copy the contents of the manager working directory to those other computers manually.
The Beopest set up is now complete. Select Model|Pest|SVD Assist|Create Sensitivity Run. This sets up
the sensivity Pest run in the main working directory (c:\gwv8\models) where the manager for Beopest will
operate. Now copy the contents of this directory to each of the agent directories. GV will do this for you
by selecting Model|Pest|Beopest/Pest_HP/Setup Beopest/Pest_HP. Console windows will flash on your
screen as GV8 uses DOS commands to copy the directory contents. It will then display some information
in Notepad to show you what was done:
Type RunManager and hit the enter key. This runs a batch file that GV8 created for you.
You should see the same sort of Pest result in the manager window and each agent should be making lots of
model runs. When the manager run is finished with the 402 sensitivity simulations, return to the SVD
Assist menu and select Model|Pest|SVD Assist|Launch SVDAPREP.
After about 10 iterations have been completed, use Model|Pest|Stop Pest Run. Now you have to use the
Model|Pest|SVD Assist|Create Final Run, to complete the calibration.
• If you have a multi-core CPU on your computer, you can generally use as many console windows
as you have cores. In some cases, you can use even more than the number of cores. However you
may need to experiment as the more simultaneous runs you have, the more interference you will
have been runs. Thus, individual run times will be longer as you add more consoles.
• You should cut down on unnecessary output from MODFLOW as writing to disk will slow each
of the simulations.
Introduction
Another powerful new feature in Pest is called Null Space Monte Carlo. In this procedure, you can create
any number of calibrated versions (called realizations) of your model. You saw in the last session that
Singular Value Decomposition or SVD can dramatically reduce the time needed to calibrate very complex
models. The Null Space Monte Carlo technique is designed to work on a model calibrated using SVD
Assist with many parameters, as in a pilot point calibration. While pilot points are not required for Null
Space Monte Carlo, a large number of parameters is a requirement.
Null Space Monte Carlo would be used after finalizing a calibration using SVD Assist. The procedure then
uses the following steps:
Set Options. There are some options to set prior to running the Null Space Monte Carlo simulation. You
need to reset the number of super parameters to be the same as you used in the previous SVD Assist run,
for example.
Get Covariance Matrices. This step is only needed when you are using the random method for generating
new pilot point values or if you have non-pilot point parameters in the calibration. If neither of these two
situations are true, then GV will gray out this menu selection.
Update Jacobian Matrix. Remember that the Jacobian matrix is the matrix of sensitivities where the
change in residual at each observation is divided by the change in the parameter value. When you run SVD
Assist, the Jacobian Matrix is based on the initial parameter values. Pest needs to update this matrix using
the final parameter values after the calibration is finished. Thus, this step will require one model run per
parameter.
Generate Realizations. A realization is a set of parameters based on the original calibration but modified
using either a random number generator or a geostatistical field generator. It is not clear which is better as
this technique is so new.
Calibrate Realizations. The realizations generated in step 4 will generally result in a degradation in model
calibration. Pest is now run through a large batch file to tweak each realization back into calibration. Only
a couple of iterations are allowed to keep run time to a reasonable level so that some realizations might not
be accepted in the end.
Now, considering that most of the tasks in 1 through 5 above need to be done at the command line, this
makes Null Space Monte Carlo even more difficult to implement than SVD Assist. As with SVD Assist,
however, Groundwater Vistas has been configured to make this as simple as possible. This new menu is
under Model|Pest|Null Space Monte Carlo|… as shown below:
GV now asks if you want to continue. If there were errors, you should say NO. If there are only warnings,
as shown above, then say YES.
Pest will run. Note that the initial objective function (phi) should be the same as for your final calibration.
If you ran 10 iterations of SVD, then it should be near 31:
Run SVDAPREP
Now, SVDAPREP must be run again to generate a revised SVD Pest control file that will be used to
recalibrate each realization. GV will regenerate a main Pest control file, run SVDAPREP, and finally
revise the SVDAPREP-generated Pest control file to reset some variables.
Select Model|Pest|Null Space Monte Carlo|Run SVDAPREP
Groundwater Vistas will first ask if you want to turn off regularization. It is probably best to answer YES.
Without regularization, you get the first optimization iteration of each realization free (that is, no model
runs). That can be quite a time savings. Probably the best approach is to try it the first time without
regularization and then if it does not yield good results, run another set of runs with regularization.
Answer YES to this prompt:
Hopefully Pestchek found no errors and only a few warnings as shown below. Close notepad after viewing
the file.
The SVDAPREP options should be filled out for you already. You should just confirm that the number of
super parameters is correct (40 in our example). Note that the flag labeled “Automatically Calculate
Derivatives” in ON. This tells Pest to run no model simulations in the first iteration.
Click OK to continue:
We should now have all of the many files we need to run Null Space Monte Carlo. If you go into Windows
Explorer and browse to the c:\gwv8\tutorial\work directory and sort by date, you should see the most
recently modified file is t2_svd.pst which is the final product of this whole sequence of commands.