GWModel Course Note Outline
GWModel Course Note Outline
Modeling
Ye Zhang
University of Wyoming
⃝
c Draft date February 13, 2016
Contents
Contents i
0.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v
0.2 This Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
0.2.1 Textbook . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
0.2.2 Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii
0.2.3 Questions and Answers . . . . . . . . . . . . . . . . . . . viii
0.2.4 Homework, Projects, Exams and Grades . . . . . . . . . . viii
0.3 Basic Math Review . . . . . . . . . . . . . . . . . . . . . . . . . . ix
0.4 Homework 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
i
ii CONTENTS
Fall 2012
GEOL 5030
3 CREDITS
GRADING: S/U or A-F (It is up to each student.)
Lecture location: ESB1006
Lecture times: Tues + Thurs (9:35 am ∼ 10:50 am)
Office hours: M(4:00∼5:30 pm), F(3:00∼4:30 pm), GE 220
Email: [email protected]
Phone: 307-766-2981
—————————————————————————————————
Prerequisite:
Calculus I & II;
Geohydrology;
Matlab Programming language*
*This course emphasizes the fundamental development of mathematical mod-
els of groundwater flow and solute transport and their applications using com-
puter simulations. Students are expected to write small computer codes for
(up to 2D) problems, thus rudimentary skills in programming with Matlab are
necessary. If a student has not used Matlab before, please study an excellent
tutorial before attending this class (it will take around 3 hours):
http://faculty.gg.uwyo.edu/yzhang/teaching.html
—————————————————————————————————
0.1 Introduction
Mathematical models of groundwater flow have been used since the late 1800s.
A mathematical model consists of differential equations developed from ana-
lyzing groundwater flow (or solute transport in groundwater) and are known
to govern the physics of flow (and transport). The reliability of model predic-
tions depends on how well the model approximates the actual situation in the
vi CONTENTS
Direct or
Calculus Iterative
Techniques Solution
Methods
Compare Compare
Field Observations
0.2.1 Textbook
The set of lecture notes I developed include the essential contents for this course.
However, other books can serve as additional resources for self study:
class.
viii CONTENTS
0.2.2 Tools
In this course, exercises, homework, labs, term project, exam problems can be
solved using a variety of approaches, e.g., by hand, using Excel spreadsheet,
writing Matlab codes, using software. The popular software packages (e.g.,
MODFLOW from USGS) will be introduced in the end, when we conduct 3D
modeling of steady-state groundwater flow and advective transport.
A B C D F
90-100 80-89 70-79 60-69 < 60
Gradient Tutorial
0.4 Homework 1
Exercise 1 and Exercise 2 of the first handout.
Chapter 1
Groundwater Flow
Equations (Review)
1.1 Introduction
The first step in developing a mathematical model of almost any system is to
formulate what are known as general equations. General equations are dif-
ferential equations that are derived from the physical principles governing the
process that is to be modeled. In the case of groundwater flow, the relevant
physical principles are Darcy’s law and mass balance. By combining the math-
ematical relation describing each principle, it is possible to come up with a gen-
eral groundwater flow equation, which is a partial differential equation (PDE).
Since in groundwater studies, the fluxes (Darcy flux, average linear velocity)
are macroscopic quantities which are related to the head gradient and hydraulic
properties of the aquifer (i.e., porosity, permeability, hydraulic conductivity) by
the Darcy’s law, the PDE developed for the general groundwater flow is thus
established for macroscopic flow in porous media.1
There are several different forms of the general flow equation depending on
whether the flow is two-dimensional or three-dimensional, isotropic or anisotropic,
and transient or steady state. In the following sections, we’ll first review the
most general flow equation (heterogenous, anisotropic and transient) and then
look at the simplified equations under different simplifying assumptions (ho-
mogenous, isotropic, steady-state). To make the derivations as understandable
as possible, a simple approach is adopted: first, the general equation is devel-
oped for the simple one-dimensional case; the results are then extended to the
three-dimensional case.
1 There are even more fundamental equations developed for flow at the microscopic scale
(i.e., pore scale), based on the theory of hydrodynamics. For example, with the Naiver-Stokes
equation, hydrologists have used various approaches to prove the macroscopic Darcy’s law.
These topics are however beyond this course. Interested students may find relevant discussions
in Section 5.10 of Bear (1988).
1
2 CHAPTER 1. GROUNDWATER FLOW EQUATIONS (REVIEW)
Q ∝ ∆h Q ∝ (1/∆s) Q∝A
Q = −KA(dh/ds)
where Q is discharge rate in the s direction. The minus sign is necessary be-
cause head decreases in the direction of flow (i.e., water is always flowing from
higher hydraulic head to lower hydraulic head). If there is flow in the positive
s direction, Q is positive and dh/ds is negative2 . Conversely, when flow is in
the negative s direction, Q is negative and dh/ds is positive. The constant of
proportionality K is the hydraulic conductivity in the s direction, a property of
the porous medium and the fluid (water) filling the pores. The common units
for hydraulic conductivity are meters/year for regional studies, m/day for lo-
cal aquifer-scale studies, and cm/sec for laboratory studies. Therefore, in some
analysis, we often deviate from the rule of using the SI unit.
Another form of the Darcy’s law is written for the Darcy flux (or the
Darcy Velocity, or, the Specific Discharge) (q) which is the discharge rate per
unit cross-sectional area:
q = Q/A = −K(dh/ds)
The Darcy flux q has unit of velocity [L/T]. Darcy flux is not the actual fluid
velocity in the porous media, it is just discharge rate (Q) per unit (solid) cross-
sectional area. Since porous rock does not have a solid cross-sectional area,
Darcy flux is a not the fluid velocity.
In the real subsurface, groundwater flows in complex 3D patterns. Darcy’s
law in three dimensions is analogous to that of one dimension. In a Cartesian
2 In this case, head is decreasing with s (since flow is towards +s), so by definition: dh/ds ≃
h(s+∆s)−h(s)
∆h/∆s = ∆s
< 0, since h(s + ∆s) < h(s).
1.2. DARCY’S LAW — REVIEW 3
qx = −Kx ∂h/∂x
qy = −Ky ∂h/∂y
qz = −Kz ∂h/∂z
Kxx Kxy Kxz
K = Kyx Kyy Kyz
Kzx Kzy Kzz
Notice that in the above equation, K contains more components than what
is shown in the previous 3D Darcy’s law with only Kx , Ky , Kz . Actually, the
previous Darcy’s law is established under a special requirement: the 3 coor-
dinate axes coincide with the principal axes of the hydraulic conduc-
tivity tensor (the direction of maximum, minimum, and intermediate
hydraulic conductivity). When this requirement is satisfied, K becomes a
3 Note that K , K , K , q , q , and q are all specific to the given coordinate. When
x y z x y z
we change or rotate the coordinate, the magnitude of these component quantities will change
with respect to the coordinate.
4 CHAPTER 1. GROUNDWATER FLOW EQUATIONS (REVIEW)
⃗q = −KI⃗
we can easily verify that previous 3D Darcy’s law (with 3 principal components:
Kx , Ky , Kz ) is just a reduced form of the above equation when K is a diago-
nal tensor (under the condition that the coordinate axes are aligned with the
principal axes of K).
If we have time, I’ll show you how to do tensor transformation with changing
coordinate, i.e., relating the principal components of K to its full tensor form.
analysis. In turns out, a full tensor K of any coordinate system can be projected, by co-
ordinate transform, to a diagonal tensor K = diag[Kx , Ky , Kz ] which are defined along 3
orthogonal principal axes (the direction of each can be defined by the unit eigen vector of
K). Kx , Ky , and Kz are the corresponding eigenvalues. In hydrology, the above Kx , Ky ,
and Kz are also called principal components, the corresponding eigen vectors are sometimes
called principal axes. In Matlab, you can type “help eig” to find out how to do a eigen
analysis for a (n ×n) square symmetric matrix. Note that for tensors of n=2 or 3, we can
visualize the relations in 2D and 3D geometric coordinate (thus tensor rotation can be proved
by geometric means). But when n > 3, the eigen values and vectors cannot be visualized
geometrically. A formal introduction on eigen analysis can be found in this online textbook:
http://tutorial.math.lamar.edu/Classes/LinAlg/LinAlg.aspx (see the Chapter titled “Eigen-
values and Eigenvectors”.
1.2. DARCY’S LAW — REVIEW 5
You can see that the above relation reduces to the previous 3D Darcy’s law. It
is best if you memorize this equation, but keep in mind the underlying
assumptions.
Moreover, when analyzing 2D flow along the x-y plane (i.e., the velocity
component in the z direction does not change: qz = 0), the above relation
becomes:
{ } [ ]{ } { }
qx Kx 0 ∂h/∂x Kx ∂h/∂x
=− =−
qy 0 Ky ∂h/∂y Ky ∂h/∂y
This is because, according to Darcy’s law of this course, qz = −Kz (∂h/∂z) = 0,
since conductivity is always greater than 0, this leads to (∂h/∂z) = 0. Substi-
tuting both into the above full 3D equation leads to the current 2D form (since
the last equation becomes: qz = 0 = −Kz × 0 which no longer contains an
unknown variable).
A similar form can be written for 2D flow in the x-z plane (what do you
think it is?). Sometimes however the velocity is amenable to one-dimensional
analysis (e.g., flow in the Darcy Tube). In this case, only the one-dimensional
Darcy’s law is needed:
qs = −Ks (∂h/∂s)
Where Ks is hydraulic conductivity along the s direction (s can be aligned in
the x, y, z, or any direction of interest), ∂h/∂s is the hydraulic head gradient
along the s direction. For example, groundwater flow in consolidating clay tends
to be largely vertical, in this case, if we decide to conduct 1D analysis, we write:
qz = −Kz (∂h/∂z).
Finally, to facilitate analytical analysis by hand, many exercises in this class
make the assumption of an isotropic conductivity in the aquifer of interest,
which means: Kx = Ky = Kz = K, and the above general 3D equation can be
simplified to become:
qx ∂h/∂x
qy = −K ∂h/∂y
qz ∂h/∂z
Similarly, depending on the dimension of the flow analysis, it can be reduced to
a 2D or 1D form. For example, 2D flow in the x-y plane of an isotropic aquifer
is written as: { } { }
qx ∂h/∂x
= −K
qy ∂h/∂y
Further, a 1D form is just the Darcy’s law for an isotropic medium:
qs = −K(∂h/∂s).
Compare this equation with the 1D Darcy’s law written above: in this form,
the conductivity without a subscript (K) implies isotropy; in the previous form
(Ks or Kz ), it implies anisotropy (though flow analysis may be one-dimensional,
spatially the conductivity can be anisotropic, Ks is just the conductivity along
the direction for which flow analysis is conducted).
6 CHAPTER 1. GROUNDWATER FLOW EQUATIONS (REVIEW)
z
qx(x) qx(x+ x)
x
x x+ x
Figure 1.1: A control volume element within the saturated zone with fixed
dimensions: ∆x, ∆y and ∆z.
For example, if we pour water into a tub at 10 kg/min (mass flux in), but the
tub is leaking at 4 kg/min (mass flux out), then the water in the tub experiences
a rate of mass change at 10 −4 = 6 kg/min. This means at every minute, the
water in the tub increases by 6 kg (so the rate of change of mass is + 6kg/min).
This same mass balance principle can be applied to develop the groundwater
flow equation. Instead of the stationary tub, we’ll use the fixed and stationary
control volume again.
We will consider the mass balance for a small rectangular control volume
element within the saturated zone, as shown in Figure 1.1. The dimensions of
the element are fixed in space, regardless of compression or dilation of the aquifer
matrix or compression/expansion of pore water. For example, if the aquifer
compresses, more aquifer solids will be squeezed into the element and some
water will be displaced out of it. To make the derivation of the flow equations
as clear as possible, we will assume that the macroscopic flow in the vicinity of
this element is one-dimensional in the x direction: qx ̸= 0, qy = qz = 0. Using
mass balance and Darcy’s law, combined with the definition of specific storage
(Ss ) for a confined aquifer, we obtain for 1D flow (details given in class):
( )
∂ ∂h ∂h
(1.2) Kx = Ss
∂x ∂x ∂t
Thus the hydraulic head (h = h(x, y, z, t)) must obey this PDE to be con-
sistent with both the Darcy’s law and mass balance. Note that in equation
(1.3), the spatial gradient of the water density is considered to be negligible,
and, the principal conductivity axes must be aligned with the coordinate axes
(conductivity becomes a diagonal tensor: K=diag[Kx , Ky , Kz ]).
Equation (1.3) is the most universal form of the saturated flow equation for
a confined aquifer5 , allowing flow in three dimensions, transient flow (∂h/∂t ̸=
0), heterogenous conductivities (e.g., Kx , Ky , Kz are spatially variable), and
anisotropic porous medium (Kx ̸= Ky ̸= Kz ).
Equation (1.3) can be alternatively written in more condensed forms, e.g.,
Figure 1.2 shows two ways this equation is sometimes presented. On the other
hand, from the last of this equation:
∂h
−∇ · ⃗q = Ss
∂t
we can obtain the “most” general form of the 3D flow equation, see Figure 1.3.
Note that the most general 3D flow equation can also be written with the
Einstein summation (see Geohydrology, Advanced material, for explanation):
∂ ∂h ∂h
[Kij ] = Ss
∂xi ∂xj ∂t
Finally, equation (1.3) is just a reduced form of the most general equation under
the condition that conductivity principal directions are aligned with the axes of
the working coordinate.
Other, less general, forms of the flow equations can be derived from Equa-
tion(1.3) by making various simplifying assumptions. If the hydraulic conduc-
tivities are assumed to be homogenous (Kx , Ky , Kz are independent of x, y, z),
5 Actually, it is not. The most general form is when the coordinate axes are not aligned
with the conductivity principal axes, thus K has 9 components. This most general form of
groundwater flow equation will be presented in class, if time allows. However, many existing
groundwater programs and softwares solves equation (1.3), assuming that during the model
building stage, the coordinate system had been designed to align with the principal conduc-
tivity axes. This is a reasonable approach for many groundwater applications, however, for
complex geometry with multiple undulating layers or with intersecting structures, the most
general form may be necessary, allowing the more accurate calculations of the cross flows.
8 CHAPTER 1. GROUNDWATER FLOW EQUATIONS (REVIEW)
(6.10)
3D Law of this
course (assuming K prin-
cipal directions aligned
with coordinate axes)
Figure 1.2: Alternative forms of equation (1.3) by substituting the Darcy’s law
into the equation.
where ∇2 is called the Laplacian operator— a shorthand for the sum of the
2 2 2
second derivatives: ∇2 () = ∂∂x()2 + ∂∂y()2 + ∂∂z()2 .
In this section, all the previous equations have included the storage term
∂t ) which occurs only with transient flow ( ∂t ̸= 0). If however the flow
(Ss ∂h ∂h
∂h
is steady state ( ∂t = 0), the right-hand-side (RHS) of all the above equations
becomes zero. For example, under steady state, equation (1.5) becomes:
(1.6) ∇2 h = 0
This is a well-known PDE called the Laplace equation. Equation (1.6) has many
applications in fluid flow, heat conduction, electronics and elasticity.
The above equations in three-dimensional forms can be reduced to two or
one dimensions by simply dropping y and/or z terms from the equation. For
example, equation (1.3) can be reduced to solve a two-dimensional flow problem
in the horizontal plane (x,y axes only):
( ) ( )
∂ ∂h ∂ ∂h ∂h
Kx + Ky = Ss
∂x ∂x ∂y ∂y ∂t
1.3. 3D GENERAL FLOW EQUATION (CONFINED AQUIFER) 9
(6.10)
Figure 1.3: The most general form of the flow equation. Also shown is the
condition under which this equation is reduced to equation (1.3).
10 CHAPTER 1. GROUNDWATER FLOW EQUATIONS (REVIEW)
( ∂h )
This implies that ∂z ∂
Kz ∂z = 0 which becomes true if qz = −Kz ∂h ∂z = 0 or
∂h/∂z = 0 (envision a 3D flow field where velocity (⃗q) varies along the horizontal
plane, but its vertical component is zero).
Equation (1.3) can also be reduced to solve a two-dimensional flow problem
in the vertical plane (e.g., x,z axes only):
( ) ( )
∂ ∂h ∂ ∂h ∂h
Kx + Kz = Ss
∂x ∂x ∂z ∂z ∂t
( )
∂y = 0 which becomes true if qy = −Ky ∂y =
∂
Similarly, this implies that ∂y Ky ∂h ∂h
y
z
river 2
river 1
3D Flow
y z
river
3D Flow To a Well
y
z
Figure 1.4: Planeview (x-y plane) of groundwater flow in aquifers with corre-
sponding cross-sectional view (x-z plane). The top panel illustrates the config-
uration where flow can be modeled as 2D (in this case, qy = 0); the bottom two
panels illustrates the configurations where 3D flow must be modeled (in these
cases, qx ̸= 0, qy ̸= 0, qz ̸= 0).
12 CHAPTER 1. GROUNDWATER FLOW EQUATIONS (REVIEW)
Figure 1.5: Cross-section of actual unconfined flow (left) and the same situa-
tion as modeled with the Dupuit-Forchheimer approximation (right). Hydraulic
head contours are dashed lines. In the Dupuit-Forchheimer model, there is no
resistance to vertical flow, resulting in constant head along the vertical lines
(∂h/∂z = 0).
flux of water entering the prism from the top and bottom), the net volume flux
across the prism boundaries is equated to the rate of change in volume stored
in the prism (which is related to the storativity (S) for a confined aquifer or the
specific yield (Sy ) for an unconfined aquifer). After some equation manipula-
tions and extending 1D flow to 2D (details given in class), we find:
( ) ( )
∂ ∂h ∂ ∂h ∂h
(1.8) Tx + Ty +N =S
∂x ∂x ∂y ∂y ∂t
This equation is the general equation for two-dimensional horizontal flow in
an aquifer (under the Dupuit-Forchheimer approximation), allowing for hetero-
geneity and anisotropy in transmissivity.
Similar to the 3D flow analysis of the last section, the above two-dimensional
general equation can be simplified under various assumptions. For example, if
transmissivity is homogeneous and isotropic (Tx = Ty = T = constant):
[ 2 ]
∂ h ∂2h ∂h
(1.9) T + +N =S
∂x2 ∂y 2 ∂t
This can be simplified further to ∇2 h + N/T = (S/T )∂h/∂t. If there is zero net
vertical recharge or leakage (N=0), this becomes:
∂2h ∂2h S ∂h
(1.10) ∇2 h = 2
+ 2 =
∂x ∂y T ∂t
If flow is steady-state but net vertical recharge/leakage is nonzero, this be-
comes:
(1.11) ∇2 h = −N/T
b(x)
Qx(x) Qx(x+ x)
y
y base of aquifer
x x+ x
(1.12) ∇2 h = 0
(1.15) ∇2 (h2 ) = 0
Note that in these two last equations, the unknown is the head squared h2 .
Chapter 2
Models of groundwater flow are widely used for a variety of purposes rang-
ing from water supply studies to designing contaminant cleanup. In general,
groundwater flow system can be divided into steady-state and transient. In
a steady-state flow system, the RHS of the flow equation is zero, while it is
nonzero in transient systems (as reviewed in the last chapter).1
There are dozens of free or commercial computer programs available to do
the calculations involved with these models. In this course, by working on
our own codes, we’ll understand the fundamental mathematical principles and
numerical methods behind these computer programs.
tion field (the RHS of the transport equation is zero), though possible, is rarely solved. We
will defer the solution of the transient transport equations to Chapter 8.
15
16 CHAPTER 2. MODELING OVERVIEW FOR GROUNDWATER FLOW
in step (3). During this iteration, heads and fluxes predicted by the computer
model are compared to actual measurements of heads and fluxes observed in
the natural groundwater system. If significant discrepancies exist, the model
parameters (e.g., porosity, permeability, storativity) and boundary conditions
(specified head, specified flux) will be adjusted. The simulation is carried out
again until a suitable (and usually rather subjective) fit between predictions and
observations is achieved.
In the third step outlined above, the conceptual system should be examined
to determine which general flow equation applies. There are several different
general equations, each valid under certain conditions (as reviewed in the last
Chapter). Which one applies depends on circumstances such as:
a flux that is proportional to the vertical conductivity of the silt layer and proportional to the
head difference from the river to the underlying aquifer (hint: write a vertical Darcy’s Law
for the silt layer)
2.1. GENERAL METHODOLOGY 17
Pumping
well
Recharge
Recharge
Silt layer below
river bottom
Sand aquifer
Low-K bedrock
Figure 2.1: Examples of flow domain boundary conditions. The pumping well
is a specified flux condition at the permeable section of the well. The recharge
is a specified flux applied at the water table. The low-K bedrock is considered a
special specified flux boundary (no-flow boundary). The leaky silt layer below
the river is a mixed condition where the flux through the layer is proportional to
the difference between the head in the river and the head in the aquifer beneath
the silt layer. Where the river is in direct contact with the aquifer, there is a
specified head condition.
can be translated to another type). You may specify either, but not both. Once
the general equation is known and the boundary conditions are assessed, review
the available modeling techniques and select one that can simulate the general
equation and boundary conditions of the problem at hand. Construct the model
and adjust its parameters and/or boundary conditions as necessary to fit the
observations of the real system. The parameters that are input (conductivity,
storativity, etc.) should be within the range of measured values, or if lacking
measurements, within the range of expected values for the geologic materials
present (Figure 2.2). Also the discharge fluxes that are modeled should be
reasonable. For example, the discharge to a river segment should be similar to
the measured or expected baseflow for that river segment.
Computer programs are now widely used to develop complex two- and three-
dimensional models. These programs implement numerical (approximate) or an-
alytic (exact) solutions to the general flow equations, and allow solutions with
diverse and irregular boundary conditions. This class focuses on the numerical
solutions, i.e., the Finite Difference Method (FDM), which solve the flow or
transport equations at discrete grid points, for the unknown hydraulic head,
groundwater fluxes or solute concentrations. (For transient problems, both ini-
tial and boundary conditions are needed, the flow and transport equations are
solved at both discrete grid points and discrete times.)
On the other hand, if exists, the analytical solutions predict these values
exactly at every continuous point in space (if steady-state flow) and continuous
point in time (if transient flow). For the same problem, the numerical solution
will generally converge to the analytical solution (if exists) when the numerical
model grid employed is dense (i.e., the spacing between model grid cells is small).
18 CHAPTER 2. MODELING OVERVIEW FOR GROUNDWATER FLOW
Unconsolidated
Rocks Deposits
k (m2) K (m/s)
10-7 1
10-8 10-1
gravel
10-9 10-2
10-10 10-3
permeable basalt
karst limestone
clean sand
10-11 10-4
silty sand
10-12 10-5
metamorphic &
igneous rocks
10-13 10-6
fractured
limestone &
silt, loess
10-14 10-7
dolomite
sandstone
10-15 10-8
glacial till
10-16 10-9
10-17 10-10
marine clay
10-18 10-11
shale
metamorphic &
igneous rocks
unfractured
10-19 10-12
10-20 10-13
For example, shown in Figure 2.3a is a regional confined aquifer: along the
top boundary of this aquifer, the hydraulic head is described by the potentiomet-
ric surface which is higher than the aquifer top. Within the aquifer, groundwater
flow forms several regional flow cells. In particular, the one near the middle is
the model domain of interest. To understand the hydraulic head and streamline
distribution in this region, mathematical model needs to be built and solved.
Toth (1962) derived an analytical solution for the hydraulic head in the
solution domain (Figure 2.3b):
∞
cL 4cL ∑ cos[(2m + 1)πx/L] cosh[(2m + 1)πz/L]
h(x, z) = h0 + − 2
2 π m=0 (2m + 1)2 cosh[(2m + 1)πh0 /L]
To obtain this solution, Toth (1962) made several simplifying assumptions. For
example, the aquifer is assumed homogeneous and isotropic for which the hy-
draulic conductivity is a scalar constant value. The flow is steady-state. Under
these assumptions, the flow equation becomes the Laplace equation (see Fig-
ure 2.3b). The potentiometric surface of the confined aquifer is assumed linear.
For this 2D problem, the hydraulic head of the top aquifer boundary is thus
linear: h(x, H) = cx + h0 . Finally, the aquifer domain is assumed to be a rect-
angle (in reality, real aquifer thickness usually varies). Note that the advantage
20 CHAPTER 2. MODELING OVERVIEW FOR GROUNDWATER FLOW
1000 1200
1100
groundwater divide
groundwater divide
1150
Confined
Aquifer
Impermeable Base
z cL
h0
H
h=cx+h0
qx=0 2h 2h
qx=0
x2 + y2 =0
L
x
0 qz=0
Figure 2.3: A regional confined aquifer: (a) a geological transect of the aquifer
and its confining units; (b) the model domain and boundary conditions. Note
that the region to be modeled has a length of L and height of H, corresponding
to the “Solution Domain” shown in (a).
2.2. ANALYTICAL VERSUS NUMERICAL METHODS 21
of the analytical solution is that it is an exact solution for the above problem
under the various assumptions. A solution also exists for every point (x, z) in
space. The disadvantage is the various assumptions as required to obtain the
exact analytical solution. None of these assumptions is necessary to obtain a
numerical (approximate) solution.
For many problems, the assumptions that must be made to obtain an ana-
lytical solution will not be realistic. In these cases, to solve the mathematical
models, we must resort to approximate methods using numerical solution tech-
niques. In general, three main numerical methods are used in hydrogeology
(listed in the order of popularity): (1) Finite Difference Method (FDM); (2) Fi-
nite Element Method (FEM); (3) Boundary Element Method (AEM). The first
two methods are the most popular. They transforms the differential equation
that governs flow (or transport) into a set of algebraic equations.
Before computers became widely available, only hand calculations (develop-
ing analytical solutions for highly simplified and idealized problems) or analogue
studies were possible3 , and the numerical techniques (FDM, FEM, AEM) were
of limited value. Using computers, we can solve large number of algebraic equa-
tions by iterative methods or direct matrix-based methods (next chapter will
introduce these methods). We can test the numerical solution by comparing that
head (or solute concentration) distribution computed by the computer with that
determined from an analytical solution, if one is available. We can also check
the simulated head (or solute concentration) against the values observed in the
field. This procedure is summarized in Figure 1.
The mathematical formulations for the FDM and FEM are quite different:
the former is based on the Taylor’s Series Expansion; the later is based on the
Variational Principle which involves more advanced mathematics. In this class,
due to time limitation and the popular demand to use a software package (e.g.,
MODFLOW is based on FDM), only the FDM is introduced. The FDM has
certain advantage over FEM, e.g., it provides close approximation of mass conti-
nuity across grid cell boundaries (I’ll draw a plot on board to demonstrate what
this means). The traditional FEM’s approximation of mass continuity is weak
at the local cell boundaries. However, new approaches are continuously imple-
mented to address the FEM local mass balance problems. The hybrid Finite
Volume Method is becoming increasingly popular in the research community
since is combines the flexibility of FEM in grid cell shape (Figure 2.5) with the
local mass conservativeness of the FDM. However, FDM and FEM have simi-
larities: they are both grid-based. Compared to the analytical solution which
exists at any point in the solution domain, the numerical methods yield values
3 Before computers were commonplace and inexpensive, complex groundwater flow prob-
lems were modeled using physical models or analogs. These models would typically be a
miniature scaled model of the flow domain in a tank. The most common analog method uses
the flow of electricity through a network of wires and resistors, where voltage is analogous
to head, resistance is analogous to 1/K or 1/T, current is analogous to discharge, and ca-
pacitance is analogous to storage. However, computer simulation methods have essentially
replaced physical and analog modeling, so these methods are not discussed in this course.
Interested students can find more coverage of analog methods in Walton (1970) Groundwater
Resource Evaluation, McGraw-Hill, New York.
22 CHAPTER 2. MODELING OVERVIEW FOR GROUNDWATER FLOW
for only a fixed finite number of grid points (N ) in the solution domain. Us-
ing either FDM or FEM, we convert a partial differential equations to a set of
N algebraic equations involving N unknown values at these particular points.
However, it is important to note that there are advantages of using FEM to
solve the flow/transport problems. The most important one is its flexibility to
simulate complex internal geometry and irregular domain boundary since the
grid cells of the FEM can be of any shape. Depending on student demands, the
FEM can be taught in future, in an advanced class or seminar in hydrogeology.
For example, in Figure 2.5a, an aquifer is shown in map view, with the
locations of a well field, observation wells, and aquifer boundary. In Figure 2.5b,
c, d, three different grids are used to represent the model domain to solve
for either head (if only solving the flow equation) and concentration (if both
flow and solute equations are solved). We can immediately see that the FDM
can only give an approximate representation of the irregular boundary, while
the FEM can honor irregular boundary more realistically. Also, two different
grids are used in FDM: block-centered and mesh-centered. In this class, to
simplify the derivations, we use the block-centered grid to derive the
FD approximations of the flow and transport equations. Note that
in hydrogeology, MODFLOW, the most popular groundwater/transport code,
is based on block-centered FDM. Also, block-centered FDM is the preferred
method for most general purpose petroleum reservoir simulators (Lee et al.,
1998; Ertekin et al., 2001). The derivations for the mesh-centered grid are
very similar (only minor details vary): with the understanding for the former
method, the later one is easy to learn. Moreover, the grid spacing (∆x, ∆y) are
also of interest. The smaller we make ∆x and ∆y, the numerical approximate
solution converges to the analytical solution. The trade-off is that the number of
unknowns (N ) increases. For very large problems, e.g., radionuclide transport
at regional scale, oil reservoir simulations, the limitation on grid size is often set
by the computer code and memory. We generally select a N value that will not
be overwhelmingly large (exceeding the computation limit), but large enough
that most of the main hydrogeological features are represented.
Finally, a variety of solution techniques can be used to solve a set of linear
algebraic equations (separate classes on Numerical Linear Algebra exist, possi-
bly from the Math Department, which should cover these techniques in a more
comprehensive fashion). Based on my own past experiences, I’ve summarized
the ones often used in hydrogeology (Figure 2.4). In this class, due to time
limitation, we’ll use only some of the solution techniques. For example, though
we introduce the matrix-free iterative methods, due to their computation ineffi-
ciency, they’re no longer used very much for solving large systems of equations
which derive from large models. So, we’ll not reply on them too much. On the
other hand, the matrix-based iterative solver will only be mentioned in pass-
ing, as setting up these solvers will generally require access to a Unix cluster
on which the various libraries are usually installed (currently our PC labs do
not have these libraries). Working on Unix systems require knowledge on Unix
(e.g., compile and link to external libraries), which is beyond the purpose of this
course. Therefore, the most often used solution technique in this class is the
2.3. VALIDITY OF NUMERICAL SOLUTION 23
Full Matrix
Storage
(GaussElim.m)
Direct Solution
(Gaussian Banded Stor-
Matrix Elimination) age (Gentri.m)
Based
DGMRES from Half Band Stor-
IMSL (Matrix stored age (etc.)
as i,j,value)
Iterative Solu-
A Set of Linear
tion
Algebraic Many other solvers
Equations (e.g., LaPACK,
LinPACK, IMSL,
AZTEC, PETSc)
Matrix Free
(Iterative
Solution) Gauss-
Point Jacobi Seidel SOR
Figure 2.4: Commonly used linear solution techniques in hydrogeology and their
relations.
Figure 2.5: Finite difference and finite element representations of an aquifer region (from Wang & Anderson, 1995). (a) Map
view of aquifer showing a well field, observation wells, and aquifer boundary. (b) Finite difference grid with block-centered
nodes, where ∆x is the spacing in x direction, ∆y is the spacing in y direction, and b is the aquifer thickness at a particular
block (this thickness can vary in space). (c) Finite difference grid with mesh-centered nodes. (d) Finite element mesh with
triangular elements.
26 CHAPTER 2. MODELING OVERVIEW FOR GROUNDWATER FLOW
Fixed heads
Fixed heads
Stream -
Stream -
R
Simula
ted He Observed H
ads eads
h Unconfined
Aquifer
Figure 2.6: Vertical cross section comparing modeled heads with observed heads.
If the fluxes to streams are known to be correct (the model predicted fluxes
to streams are equal to the observed fluxes within a small random error), then
the conductivities should be increased. Why this is so can be seen from Darcy’s
law; increasing K allows the same flux of water to be transmitted with smaller
head gradients. Thus, if we increase the value of K, to provide the same (correct)
Darcy flux to the streams, the head gradient will drop, thus the simulated head
will be lower than the current estimation and the simulated head gradient will
become smaller.
On the other hand, if the conductivities specified to the model aquifer are
known to be correct (for example, we have lots of detailed measurements of K
in the aquifer to back up this claim) and the predicted fluxes to streams are too
high compared to observed fluxes, the recharge rate should be lowered. Note
that smaller recharge rate specified to the model will allow lesser amount of
water to enter the aquifer for a fixed time period, so the predicted head mound
in between the steams will be lower.
The above calibration procedure involves a trial-and-error approach by the
modeler involving both the hard hydrogeological principles (relationship be-
tween head gradient, fluxes and conductivity) and soft intuition (which parame-
ter might be the most uncertain thus requiring extensive adjustment). However,
a recent development in flow modeling is the automated estimation of parame-
ters by special computer algorithms that will optimize the calibration of models
2.5. INTERPRETING MODEL RESULTS 27
(Hill, 1992; Doherty, 2000; Hill & Tiedeman, 2007). These techniques are based
on minimizing an objective function which is defined to be a measure of the
fit between model results and actual observations. The larger the computed
objective function is, the greater the discrepancy between the model results
and corresponding real observations. One simple and common definition of the
objective function (F ) is the sum of the squared residuals (differences between
modeled and observed heads):
∑
n
( obs )2
F = hi − hsim
i
i=1
where n is the number of observed heads, hobs i is the i th observed head and
hsim
i is the modeled head corresponding to the i th observed head. The above
equation can also be modified by multiplying weighting factors times each term
in the sum. The weighting factor depends on the importance of an observation to
the overall model validity and the confidence in that observation (“True Error”
defined in Chapter 9). Automated calibration techniques will find the optimal
set of parameter values that result in a minimal value of the objective function.
Such techniques can save a modeler some time in the calibration process, but
they are no substitute for careful thinking. The automated techniques can
yield unreasonable results if insufficient constraints are supplied. Chapter 9
will discuss the methods of parameter estimation, based on both the forward
upscaling theory and the inverse regression theory.
∇2 h = −N/T
of models that maintain a fixed ratio N/T . Therefore, for many modeling
projects, it is important to have some flux measurements, e.g., well rates, aquifer
recharge/discharge rates to lakes or streams, or precipitation-induced recharge
rate to the aquifer.
After a model is calibrated to observed existing conditions in the flow sys-
tem, it is then used to predict future conditions with a different set of boundary
conditions. For example, models are often calibrated to the known flow con-
ditions at a contaminated site prior to clean-up and then used to simulate the
response of the system to various proposed remediation designs including the
addition of pumping wells, barriers and/or drains. In the geological community,
there are also scientific studies to evaluate the vulnerability of regional aquifers
under future change in climate. For example, the Global Climate Models predict
that under Global Warming, the western US may become dryer (Levi, 2008).
This would mean less recharge water will reach the regional aquifers in this re-
gion which are sources of freshwater to many communities for both domestic,
industrial and agricultural uses. Then, if the west were to become dryer, there
will be less recharge water to the aquifer to balance the (possibly increasing)
water demands due to the increased population. We need a computer model to
predict the head decline under these hypothesized scenarios.
2.7 References
Toth J, 1962, A theory of groundwater motion in small drainage basins in Center
Alberta, Canada, Journal of Geophysical Research, Vol. 67, p. 4375-4387.
Lee S H, L J Durlofsky, M F Lough and W H Chen (1998) Finite differ-
ence simulation of geologically complex reservoirs with tensor permeabilities,
SPE Reservoir Evaluation and Engineering, December, p. 567-574.
Ertekin T, J H Abou-Kassem, G R King (2001) Basic Applied Reservoir Simulation,
SPE Textbook Series, 406 p.
Hill M C (1992) A computer program (MODFLOWP) for estimating param-
eters of a transient, three-dimensional ground-water flow model using nonlinear
regression, USGS Water Resources Investigation Report, 91-484.
Doherty J (2000) Manual for PEST2000, Watermark Numerical Computing,
Brisbane, Australia.
Levi B G (2008) Trends in the hydrology of the western US bear the imprint
of manmade climate change, Physics Today, p. 16-18, April 2008.
Ye Zhang, Carl W Gable, Mark Person, 2006, Equivalent Hydraulic Conduc-
tivity of an Experimental Stratigraphy - Implications for Basin-Scale Flow Simu-
lations, Vol. 42, W05404, Water Resources Research, doi:10.1029/2005WR004720.
Ye Zhang, Carl W Gable, 2008, Two-Scale Modeling of Solute Transport in
an Experimental Stratigraphy, Journal of Hydrology, Vol. 348, p. 395-411, doi:
10.1016/j.jhydrol.2007.10.017.
30 CHAPTER 2. MODELING OVERVIEW FOR GROUNDWATER FLOW
Chapter 3
Mathematical Notations,
Definitions and Theorems
This chapter introduces the basic mathematical notations, definitions and the-
orems. It supplements the handout of Basic Math Review given earlier but
focuses more specifically on the type of problems we’ll encounter in this course.
∂T ∂2T
(ρc) =λ 2
∂t ∂z
31
32CHAPTER 3. MATHEMATICAL NOTATIONS, DEFINITIONS AND THEOREMS
The solution is T = T (t, z), the two independent variables are time t and the
z axis. Note that for PDE, the differential symbol used is ∂ (partial derivative
symbol). By definition, the partial derivative: ∂T /∂t = lim∆t→0 [T (t + ∆t, z) −
T (t, z)]/∆t.
• Initial Condition: Constrains that are specified at the initial point, gen-
erally time point, are called initial conditions. Problems with specified
initial conditions are called initial value problems.
dy
(3.1) = f (x, y)
dx
f (x, y) = p(x)q(y)
dy
= p(x)dx
q(y)
dy
(3.2) + p(x)y = q(x)
dx
Tensor: a matrix quantity which relates one vector to another. One exam-
ple is the hydraulic conductivity tensor (K) which relates the hydraulic head
⃗ with Darcy flux (⃗q): ⃗q = −KI,
gradient (I) ⃗ or written out in full:
qx Kxx Kxy Kxz ∂h/∂x
qy = − Kyx Kyy Kyz ∂h/∂y
qz Kzx Kzy Kzz ∂h/∂z
This equation is also known as the general 3D Darcy’s law (where the coordinate
axes do not aligned with the principle components of the hydraulic conductivity
tensor).
The above equation can also be written out explicitly using the rule of
matrix-vector multiplication, one for each Darcy flux component,
∂h ∂h ∂h
qx = −Kxx − Kxy − Kxz
∂x ∂y ∂z
Field
h(x)
h(x+∆x)
h(x)
∆x
x
x x+∆x
If the function contains more than one independent variables, we will need
to fix one independent variable and evaluate the function in relation to the
other independent variable. For example, h = h(x, t), we can write the forward
approximation as:
• Forward Approximation:
∆x ∂h(x, t) ∆x2 ∂ 2 h(x, t) ∆x3 ∂ 3 h(x, t)
h(x+∆x, t) = h(x, t)+ + + +. . . |f ixt
1! ∂x 2! ∂x2 3! ∂x3
n
∆xn ∂ h(x,t)
If we truncate the higher order terms (i.e., n! ∂xn , n > 2), we get:
∂h(x, t)
h(x + ∆x, t) ≈ h(x, t) + ∆x ⇒
∂x
∫b
Exercise 1 Use integration by parts, evaluate a
xex dx.
Note that the diagonal elements always satisfy aii = aii when j = i, so we only
look at the off-diagonal elements. For example, the matrix A1 is symmetric:
10.0 2.0 1.0
A1 = 2.0 23.0 5.0
1.0 5.0 1.5
aii ≥ |aij | (i = 1, . . . , n; j ̸= i)
This means, across any row in the matrix, the diagonal element is positive
and greater than the magnitude of the off-diagonal elements. For example, the
matrix A2 is diagonally dominant:
10.0 0.0 1.0
A2 = −5.0 23.0 20.0
−0.1 0.0 1.5
In A2 , for example, across the first row (i = 1), a11 > |a12 |, a11 > |a13 |. In the
second row (i = 2), a22 > |a21 |, a22 > |a23 |, etc.
A sparse matrix is one where most off-diagonal elements are equal to zero
(the diagonal elements are non-zeros), for example, the matrix A3 is considered
sparse:
10.0 0.0 0.0 0.0
3.0 23.0 0.0 0.0
A3 = 0.0
2.0 1.5 0.0
0.0 0.0 0.0 1.0
A special type of sparse matrix is the Banded Sparse matrix which arises in
finite difference (or finite element) discretization of PDEs describing groundwa-
ter flow and transport. Such banded matrices contain zeros except along the
diagonal where there are a band of elements, e.g., a 8 × 8 banded sparse matrix
can look like this:
a11 a12 0 0 0 0 0 0
a21 a22 a23 0 0 0 0 0
0 a32 a33 a34 0 0 0 0
0 0 a43 a44 a45 0 0 0
0 0 0 a54 a55 a56 0 0
0 0 0 0 a65 a66 a67 0
0 0 0 0 0 a76 a77 a78
0 0 0 0 0 0 a87 a88
transport problems. In solving the groundwater flow equation, a symmetric coefficient matrix
is produced, thus in a computer, commonly only half of the bandwidth is stored (this is a
practice common in the early days of numerical simulation where a computer has very limited
memory, e.g., 64KB). In using older codes, we’ll still see the definition of a reduced bandwidth:
mr = m/2, which defines the half band of a matrix. The same situation occurs in solving the
equation describing solute diffusion. However, whenever solving the typical solute transport
problem described by advection, dispersion, and diffusion, the coefficient matrix can be non-
symmetrical and sometimes off-diagonally dominated. Special solution technique are needed
to deal with such matrices, e.g., iterative solutions that are not restricted to any special matrix
characteristics, e.g., the IMSL DGMRES works for any general sparse non-symmetric matrix.
3.6. LINEAR ALGEBRA AND SOLUTION TECHNIQUES 39
This equation can be written alternatively using matrix vector format as:
a11 a12 . . . a1n x1
b1
a21 a22
. . . a2n
x2 b2
... ... =
... ... ...
...
an1 an2 . . . ann xn bn
A⃗x = ⃗b
where the left-hand-side (LHS) matrix An×n is the coefficient matrix of the set of
linear equations, the solution vector ⃗x = {x1 , x2 , . . . , xn }T contains the unknown
40CHAPTER 3. MATHEMATICAL NOTATIONS, DEFINITIONS AND THEOREMS
Note that compared to the original coefficient matrix (e.g., it can be a full
matrix), the new system will have different coefficient matrix and RHS
vector.
2. Back Substitution: After triangulation, the bottom equation (see above)
has only one unknown xn (i.e., x3 ). This can be solved for and the value
of xn substituted into the equation immediately above it to find xn−1 (i.e.,
x2 ). This process is repeated until we solve for the first equation to find
x1 .
To allow easy writing, we write the column vector as the transpose of a row vector, as shown
above.
4 In hydrologically modeling, typically the Direct Approach is efficient in solving smaller
problems, e.g., 1D or 2D grid with less than 10,000 nodes. The Indirect Approach is commonly
used to solve much larger problems, e.g., 3D grid with more than 10,000 nodes.
3.6. LINEAR ALGEBRA AND SOLUTION TECHNIQUES 41
the unknowns.
x1 + x2 + x3 = 1 (1)
x1 + x2 + 2x3 = 2 (2)
x1 + 2x2 + 2x3 = 3 (3)
After a set of values are obtained using the above equations (x1 , x2 , x3 , x4 ), they
become the new “guesses” (f x1 , xf2 , x
f2 , x
f4 ), and are substituted back into the
same above equation to find the next iteration values. We repeat this recursive
process until there is almost no difference between the successive approximation
of the unknown vector ⃗x. That is, another round of iteration brings a negli-
gible change in the values of x f1 , x
f2 , x
f2 , x
f4 compared to the previous round of
values. The final converged values are considered the solution set for the linear
equations.
Note that before implementing the iterative method, the diagonal elements
must be all non-zero. This can be accomplished via pivoting. We have n equa-
tions for n unknowns (x1 , x2 , . . . , xn ), thus the coefficient for each unknown (aij )
must be non-zero at least once. Therefore we can always shift the order of the
equations to make the diagonal elements non-zero.
42CHAPTER 3. MATHEMATICAL NOTATIONS, DEFINITIONS AND THEOREMS
However, the recursive relation can be fine-tuned. There are several types
of Iterative Methods which differ in implementation details:
1. Point Jacobi
2. Gauss-Seidel
3. Successive Over-Relaxation
1 ∑n
(3.8) xm+1
i = [bi − aij xm
j ] j ̸= i
aii j=1
where
xm — guess at beginning of an iteration step;
xm+1 — updated value at the end of an iteration step.
We continue the recursion (m → ∞) until some small tolerance (δ) has been
achieved:
hm+1 − hm
(3.9) max| i i
|≤δ
hmi
For example, equation (3.7) is just this condensed equation written out for
n = 4. For i = 1, we write: (j = 2, 3, 4)
xm+1
1 = 1
a11 [b1 2 − a13 x3 − a14 x4 ]
− a12 xm m m
For i = 2, we write:(j = 1, 3, 4)
xm+1
2 = 1
a22 [b2 1 − a23 x3 − a24 x4 ]
− a21 xm m m
For i = 3, we write:(j = 1, 2, 4)
xm+1
3 = 1
a33 [b3 − a31 xm
1 − a32 x2 − a34 x4 ]
m m
For i = 4, we write:(j = 1, 2, 3)
xm+1
4 = 1
a44 [b4 1 − a42 x2 − a43 x3 ]
− a41 xm m m
The above equations boil down to equation(3.7). Note that during a given
recursive round (m + 1), only the results from the last round (xm m m m
1 , x2 , x3 , x4 )
are used.
At the end of each update, we found xm+11 , xm+1
2 , xm+1
3 , xm+1
4 . These values
are compared to the previous results xm m m m
1 , x2 , x3 , x4 , for which we can find a rel-
ative difference for each unknown variable: (xm+1 1 − xm m m+1
1 )/x1 , (x2 − xm m
2 )/x2 ,
m+1
(x3 − xm3 )/xm
3 , (xm+1
4 − xm
4 )/x m
4 . From these 4 relative differences, we can
find a maximum absolute value (the highest magnitude of relative difference
3.6. LINEAR ALGEBRA AND SOLUTION TECHNIQUES 43
between iteration m and m + 1), if this maximum is still greater than δ, the
recursion continues until equation (3.9) is satisfied.
1 ∑
i−1 ∑n
xm+1
i = [bi − aij xm+1
j − aij xm
j ]
aii j=1 j=i+1
where
When j = 1, . . . , i − 1, xm+1
j are the updated value found during the current
(m + 1) iteration step;
When j = i + 1 . . . , n, xmj are the old values found during the last iteration
(m) step.
We continue the recursion (m → ∞) until the same small tolerance (δ) has
been achieved (note for each unknown variable, it is comparing its updated
value xm+1 with its previous old value xm , just like that for the Point Jacobi
Method):
hm+1 − hm
max| i i
|≤δ
hmi
For example, equation (3.7) can be rewritten for Gauss-Seidel Iteration. For
i = 1, we write: (j = 2, 3, 4)
xm+1
1 = 1
a11 [b1 2 − a13 x3 − a14 x4 ]
− a12 xm m m
xm+1
i (guess) is the initial guess for xm+1
i , estimated using the previous Gauss-
Seidel Iteration approach. In step (2), we use:
xm+1
i = xm
i + wci
class, you’re welcome to talk to me after class where I can show you some
examples of calling these solvers (mostly done on Unix clusters).
5. Compared to the Direct method, iterative methods can have trouble con-
verging or can develop instability (solution vector fluctuates greatly from
m to m + 1 without convergence as m → ∞), for highly deformed grids or
problems with large contrast in material properties. For example, in mod-
eling a multilayered aquifer-aquitard system, if the contrast in hydraulic
conductivity between aquifer and aquitard is large, iterative methods may
have trouble converging. In this case, investigate the condition number of
the matrix to see if it is approaching singular (e.g., calling a subroutine
in IMSL which computes the matrix condition number). If so, consider
improving the aspect ratio of the grid (so it is less deformed) and consider
adding buffer zones between very-high-K and very-low-K zones. More-
over, in solving transient problems (i.e., hydraulic head, temperature (T),
or velocity change with time), the convergence speed of iterative methods
can be sensitive to the choice of initial conditions.5 On the other hand,
direct methods seem generally less affected by these issues though there
is no guarantee.
6. For large problems where we’re not sure if iterative methods can provide
sufficiently accurate solutions, the same problem should be solved first by
a direct method (as long as the computer is sufficiently fast). By com-
paring the solutions using both approaches, the accuracy of the iterative
method will be ascertained. Since the iterative method can generally solve
bigger problems faster, it is still the best choice for large simulation mod-
els. However, if computer time is not excessive, verification with direct
methods is a prudent procedure to take.
7. The process of ensuring that an iterative method is giving the correct nu-
merical results (as compared to those predicted by the direct method for
the same problem) is called code verification. The process of ensuring that
an iterative method (or direct method) gives the results that are close to
the analytical (exact) solutions (when they exist) is called code validation.
However, for complicated problems with complex geometry, parameter
heterogeneity, and spatially-varying and/or time-dependent boundary con-
ditions, analytical solutions to such problems generally do not exist. In
such cases, though numerical simulations are used to model such prob-
lems, analytical solutions usually do not exist, thus the numerical codes
can be verified but not validated. In these cases, we conduct (1) grid res-
olution study (for transient problems both grid and temporal resolution
can be changed); (2) local and global mass balance analysis (for transient
problems, mass balance can be checked for every time step).
5 For example, to solve the transient responses of a geotherm field to groundwater infiltra-
tion and discharge, if the initial T field is chosen to reflect the final expected field more closely,
the iterative methods will converge to find the final solution faster than choosing an initial T
field that is far from reality (e.g., giving T a uniform value of 0 degree C).
46CHAPTER 3. MATHEMATICAL NOTATIONS, DEFINITIONS AND THEOREMS
3.7 Homework 2
1. Solve the below equations by hand to find the unknowns (x1 , x2 , x3 ) using
Gaussian Elimination. Hint: pivoting may be needed.
x1 + x2 + x3 = 1.0 (1)
x1 + 1.0001x2 + 2x3 = 2.0 (2)
x1 + 2x2 + 2x3 = 1.0 (3)
For these exercises, you must hand in your codes as well. For hand calcula-
tions, present the full steps.
(Optional) You can also find out what happens to the speed of convergence
when you increase or decrease the tolerance.
FD (or FE) discretization of the flow and transport equations, the matrix is gen-
erally well-behaved: for flow problem, the matrix is symmetric, positive-definite
(diagonally dominant), and sparse; for transport, the matrix is symmetric and
sparse, but can be off-diagonally dominant for advection-dominated problems
(in which case special solution technique is implemented, e.g., Modified Method
of Characteristics). In all these cases, we do not need to worry about switching
the orders of the unknowns as required by pivoting.
However, sometimes linear matrix problems do arise for which pivoting is re-
quired, or the matrix is not symmetric, positive-definite, or possesses any special
characteristics (for example, in solving the 1D flow equation, the coefficient ma-
trix is always tridiagonal for which a special direct Gaussian-Elimination solver
Gentri.m can be used which specifically works for this type of matrix). A case in
mind is solving the kriging or co-kriging equations (please take my Geostatistics
class to learn these methods) which have zero diagonal elements! Whenever
such cases happen (you’ll be surprised how often they do once you start doing
research), a more general solver can be used which has no special requirements
on matrix characteristics. A popular direct solver is the Gauss-Jordan method
which is capable of automatic pivoting (parallel to our hand-exercises when our
brain was doing the pivoting). For example, a full code solving a 5×5 problem
is shown below. If we write out the A⃗x = b and try to do this by hand, we soon
realize that we have to do pivoting. However, this code calls the Gauss-Jordan
method to do the pivoting and Gaussian-Elimination directly.
---------------------------------------------------------------------
% Gaussian-Jordan method of solving linear equations with full
% pivoting: this method is capable of solving non-symmetrical,
% non-positive-definite, non-diagonal-dominated matrix. IN general,
% any linear set of equations that are NOT singular (If the matrix is
% singular, there exist infinite sets of solution vectors for any one
% solve of Ax=b. That is, x cannot be uniquely determined).
INTEGER i,j,k
% OPEN(UNIT=8, FILE=’debug_jordan.data’)
OPEN(UNIT=9, FILE=’output_jordan.data’)
a(1,1)=1
a(1,2)=1
a(1,3)=1
a(1,4)=1
a(1,5)=0
a(2,1)=0
a(2,2)=95.75