You are on page 1of 45

Numerical Methods for Flow and Transport in Porous Media

Benito M. Chen-Charpentier
Department of Mathematics
University of Wyoming
Laramie, WY 82071-3036
bchen@uwyo.edu
Abstract
In this short course we will start by deriving the basic conservation laws for mass, momentum and energy.
We will extend the results to mixtures in general and then to multiphase ow in porous media. We will
describe the black-oil models and the Buckley-Leverett problem. Second, we will review the basic numerical
methods for solving the dierential equations that model a uid in a porous medium. Finally, we will give
some typical problems of ow and transport and show how they can be solved numerically.
Contents
1 Equations of Motion. 2
1.1 Conservation Laws . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Mixtures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 Multiphase Flows in Porous Media . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4 Multiphase-multispecies Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2 Numerical Methods. 15
2.1 Basic Methods for Parabolic Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.2 Numerical Methods for Elliptic Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3 Numerical Methods for some Problems in Porous Media. 29
3.1 1-D Steady Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.2 Slightly Compressible Fluid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.3 Non-steady Aquifer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.4 Mixed Finite Element Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.5 Transport of a Solute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.6 Modied Method of Characteristics for Transport . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.7 Multiphase Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
1
Chapter 1
Equations of Motion.
1.1 Conservation Laws
We will start by deriving the equations of motion for a simple uid consisting of only one phase and one
component. Assume the continuum hypothesis. Let x

= (x, y, z) be a point in space.


Let v

(x

, t) be the velocity of a particle of uid moving through x

at time t.
Let (x

, t) be the mass density, so that the mass of a uid region W is


m(W, t) =
_
W
(x

, t)dV
The equations of motion are based on the following conservation principles:
1. Mass is neither created nor destroyed.
2. The rate of change of momentum equals the applied force.
3. Energy is conserved.
1. Conservation of Mass
Let W be a xed region, the rate of change of mass in this region is
d
dt
m(W, t) =
_
W

t
(x

, t)dV.
This rate of increase (decrease) of mass in W equals the rate of mass getting into (exiting) the volume:
d
dt
_
W
dV =
_
W
v

dA,
where W is the surface of W and n

is the outward unit normal vector. The divergence theorem states that:
_
W
f

dA =
_
W
divf

dV.
2
Applying it, we then have
_
W
_

t
+ div
_
v

_
_
dV = 0.
This is the conservation law in integral form. Since this is valid for all W we have the dierential conservation
form:

t
+ div
_
v

_
= 0.
2. Conservation of momentum:
Let the velocity be
v

(x

, t) =
dx

(t)
dt
and the acceleration be
a

(t) =
d
2
x

(t)
dt
2
.
Then using the chain rule we have
a

(t) =
v

x
x +
v

y
y +
v

z
z +
v

t
=
t
v

+v

.
Let
D
Dt
=
t
+v

be the material derivative, that is, the derivative following a uid particle.
First lets work with an ideal uid: the only force is the pressure, there are no tangential stresses.
The force across the surface per unit area is p(x

, t)n

, where p(x

, t) is the pressure and n

is the outward unit


normal.
Then the total force exerted on the uid through the boundary is
S
W
=
_
W
pn

dA.
...................................................................................................................................................................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .............................................................

+ -
S
W
n

For any xed vector e

:
e

S
W
=
_
W
pe

dA =
_
W
div(pe

)dV =
_
W
(grad p) e

dV.
3
The second equality is obtained using the divergence theorem and the third one by using the vector identity
div(a

) = diva

+ a

grad with a

xed. Therefore we have that the surface force due to the pressure is
S
W
=
_
W
grad p dV.
If b

(x

, t) is the body force per unit mass, usually only the force of gravity, then the total body force is
B

=
_
W
b

dV.
Therefore, for any piece of material, the force per unit volume is grad p + b

. By Newtons second law,


(which states that, for constant density, the force is equal to the mass times the acceleration), we have the
balance of momentum law

Dv

Dt
= grad p +b

.
3. Conservation of Energy
First we will deal only with mechanical energy, that is, kinetic energy. Over a volume W
t
, that always
has the same molecules, it is dened as
E
k
=
1
2
_
W
t

_
_
_v

_
_
_
2
dV
Its rate of change with time is
d
dt
E
k
=
d
dt
_
1
2
_
W
t

_
_
_v

_
_
_
2
dV
_
=
1
2
_
W
t

D
_
_
_v

_
_
_
2
Dt
dV
=
_
W
t

_
v

_
v

t
+
_
v


_
v

__
dV.
The last equality is since
1
2
D
D
_
_
_v

_
_
_
2
= v

t
+
_
v

_
v


_
v

_
as can be proven working component-wise.
Incompressible Flow
The rate of change of the kinetic energy equals the rate at which the pressure and body forces do work:
d
dt
E
k
=
_
W
t
pv

dA+
_
W
t
v

dV,
and using the divergence theorem we get:
4
_
W
t

_
v

_
v

t
+v

__
dV =
_
W
t
div(pv

) (v

b)dV.
Since the uid is incompressible the law of mass conservation,
D
Dt
+ div v

= 0, implies that divv

= 0.
Therefore the last integral is

_
W
t
_
v

p v

_
dV.
And, since the volume is arbitrary:

_
v

_
v

t
+v

__
= v

p +v

or
Dv

Dt
= p +b

which is the conservation of momentum law.


Navier-Stokes Equations
Now we will include the viscous forces, so the force acting on a surface S per unit area is p(x

, t)n

(x, t) n

, where

is the shear stress tensor, which is of rank 2.


We need more assumptions to be able to close the system. We assume that the uid is newtonian, for
which the shear tensor is given by

= 2
_
D
1
3
div v

I
_
+(div v

)I,
where is the rst coecient of viscosity,
= +
2
3
is the second coecient of viscosity and
D is the deformation tensor, given by D =
1
2
_
grad v

+ (grad v

)
T
_
.
Component-wise the deformation tensor is D
ij
=
1
2
_
u
i
x
j
+
u
j
x
i
_
.
And I is the identity matrix.
Using the divergence theorem as before, the moment balance law gives the Navier-Stokes equations:

Dv

Dt
= p + ( +)(div v

) +v

,
where v

=
_

2
x
2
+

2
y
2
+

2
z
2
_
v

.
5
1.2 Mixtures
Many real life problems involve uids that consist of more than one phase (liquid, gas) and more than
one component or species (water, methane). So we have to determine how to study solutions, or uids in
permeable media, or mixtures with chemical reactions? To answer these questions we need to obtain the
conservation laws for mixtures.
Denition: A mixture is a collection of N bodies called constituents, forming overlapping continua. At each
point in space, x

, we can have material from each constituent.


For example: Salt water has water and sodium, N
+
a
, and chloride, Cl

From a molecular point of view the


species are separated but macroscopically they occupy the same space.
Another example is sandstone, which is a porous and permeable rock, lled with water. The segregation
of the phases is observable at a microscopic scale much larger than the molecular scale. But macroscopically
sandstone and water occupy the same space.
Suppose we have N constituents, = 1, . . . , N Each one has its own motion:
x

= x

(X

, t)
X

= X

(x

, t),
where X

is the Lagrangian label of the particle initially at spatial (eulerian) position x

.
Also its own velocity:
V

_
X

, t
_
=
x

t
_
X

, t
_
; v

_
x

, t
_
= V

_
X

(x

, t), t
_
,
and its own density

(x

, t) (mass of per unit volume of ).


The total mass of in a part P of the mixture is
M

(P) =
_
x

(P)

dV
For multiphase mixtures, we assign to each constituent a volume fraction,

(x

, t), which is the


fraction of the volume occupied by . So that in any part P of the mixture the total volume within P
occupied by is
F

(P) =
_
x

(P)

dV,
where

=
volume of
volume of mixture
. Therefore, 0

1 and
N

=1

= 1.
6
We need some denitions.
Denition.- Overall mass density:
=
_

_
N

=1

multispecies mixtures
N

=1

multiphase mixtures
Denition.- Mass fraction:
w

=
_

multispecies mixtures

multiphase mixtures
Note that
N

=1
w

= 1.
Denition.- Baricentric velocity (mass weighted mean of velocities):
v

=
_

_
1

=1

multispecies
1

=1

multiphase
The diusion velocity of a constituent with respect to the mean mixture ow velocity is

= v

.
Note that for multispecies mixtures

=
1

(v

) =
1

_
= v

= 0

.
And similarity for multiphase mixtures. For mixtures the general global balance laws are:
Multispecies
N

=1
_
d
dt
_

d V
_

d A
_

d V
_
= 0.
Multiphase
7
N

=1
_
d
dt
_

d V
_

d A
_

d V
_
= 0.
Local or dierential mixture balance laws are obtained in a similar way to the one constituent case.
Multispecies:
N

=1
_
D

Dt
(

) +

divv

div

_
= 0.
Multiphase:
N

=1
_
D

Dt
(

) +

divv

div

_
= 0.
Here
D

Dt
=
_

t
for functions of Lagrange coordinates
_
X

, t
_

t
+v

for functions of spatial coordinates (x

, t).
To write the conservation law for each constituent we need to take into account the interactions among
constituents. Let e

be a measurement of the exchange of into constituent from other constituents.


Therefore we have:
Multispecies
D

Dt
(

) +

divv

div

= e

, = 1, . . . , N.
Multiphase
D

Dt
(

) +

divv

div

= e

, = 1, . . . , N.
From the laws for the whole mixture we can see that
N

=1
e

= 0.
As a rst example, consider the transport of a dissolved contaminant by a uid.
The constituents are: S=solute(contaminant) F=uid.
So we have a multispecies mixture with no chemical reactions.
Looking at the mass balance:

= 1

= 0, g

= 0, e

= 0.
(e

is the production of constituent by chemical reaction but in this case there is none).
8
D

Dt
+

divv

t
+ div(

) = 0 = S, F

t
+ div(

) + divj

= 0,
where: j

is the diusive ux.


Consider the solute, we need a constitutive law for j

S
. Use Ficks Law:
j

S
= K
S

S
withK
S
> 0, the diusion coecient.
This implies

S
t
+ div
_

S
v

_
div
_
K
S

S
_
= 0 Advection-diusion transport equation.
Example: Fluid Flow in porous rock. Even for one uid this is multiphase. We have two constituents: F
uid, R, rock. Assume that the ow is chemically inert (no mass exchanges) and that the rock is immobile
(v

R
= 0). Lets look at the conservation of momentum law:

= v

, velocity

= t

, stress tensor
g

= b

, body forces
e

= m

, rate of momentum exchange.


The dierential conservation law is then:
D

Dt
_

_
+

divv

divt

= m

Dt
+v

_
D
Dt
(

) +

divv

. .
_
divt

= m

mass balance
Suppose the uid is inviscid:
t
F
= pI.
and that the only body force is gravity:

F
b

F
= gz, z is the depth below a reference level.
Suppose the momentum transfer is given by Stokes drag which says that m

F
is proportional to the uid
velocity:
m

F
=

F

_
v

F
_
=

v
F

, where is the uid mobility.


The conservation law is now:

F
D
F
v

F
Dt
+p
F

F
gz =

v
F

.
9
A common assumption is that the uid inertia is negligible compared with the pressure, gravity and mo-
mentum exchanges:
D
F
v

F
Dt
= 0.
So the conservation law simplies to:
v

F
=

F
_
p
F

F
gz
_
.
The uid mobility, , depends on both the uid and the rock:
=
k

F
,
where
F
is the uid dynamic viscosity and k is the permeability of the rock. So nally, we obtain the well
known Darcys law:
v

F
=
k

F
_
p
F

F
gz
_
.
To a macroscopic observer v

F
is the mean uid velocity through the pores of the rock. An observer at
the pore scale would need to use the Navier-Stokes equations on the irregular geometry given by the pores.
Darcy derived the law that has his name from experimental observations.
For many sedimentary porous media, the ow is anisotropic. To take this into account let k be a tensor
v

k
=
k

_
p
F
=
I
gz
_
Although k is supposed to depend only on the rock it is dierent for gases than for liquids. For liquids there
is friction between the liquid and the rock, there is a no-slip boundary condition between the two. For gases
the friction is negligible.
1.3 Multiphase Flows in Porous Media
Lets look at the simplest of what is commonly called multiphase ow. That is, a ow with two uid phases.
So we have three phases: rock R, aqueous uid W, and nonaqueous uid N. Assume Darcys Law holds for
both W and N:
v

W
=

W
_
p
W

W
gz
_
v

N
=

N
_
p
N

N
gz
_
.
A lot of work has been done into simplifying the problem. One possibility is to work with dierent
variables. Let = 1
R
=
W
+
N
be the porosity of the rock. Dene the saturations as
S
W
=

W

, S
N
=

N

, fraction of pore spore occupied by the respective uids.


10
So we have
S
W
+S
N
= 1.
Decompose the uid mobilities,
W
and
N
, into

W
=
k
W

W
,
N
=
k
N

N
.
k
W
and k
N
are no longer rock properties alone, since one uid blocks the ow of the other. Suppose that
the eective permeability depends on the uid saturation of the phase increasing with its saturation. This
is because the more we have of uid the less the other uid interferes with its ow.
k
W
= kk
rW
(S
W
),
k
N
= kk
rN
(S
W
), S
N
= 1 S
W
.
For two uids with a xed interfacial tension, the interfacial geometry varies with saturation so we can
expect p
N
p
W
to be a function of the saturation S
W
:
p
N
p
W
= p
CNW
(S
W
).
The capillary pressure may be a multivalued function due to hysteresis.
........................................ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .......................
......................
. . . . . . . . . . . . . . . . . . . . . . .......................
......................
. . . . . . . . . . . . . . . . ................................................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .................................................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .................................................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
........................................................................................................................................................................................................................................................................................
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
............................
. . . . . . . . . . . . . . . . . . . . . .
....... . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
P
CNW
S
W
1
2
3
Mass Balance
The dierential mass balance is given by:

t
(

) + div
_

_
= r

If we assume there is no interphase mass transfer, r

= 0.
Eliminating the mass fractions in favor of the saturations,

= S

we have

t
(S

) + div
_
S

_
= 0.
11
Substitute v

from Darcys law (which is the conservation of momentum) into the conservation of W and
N:

t
_
S
W

W
_
div
_

W
kk
rW

W
_
p
W

W
gz
_
_
= 0

t
_
(1 S
W
)
N
_
div
_

N
kk
rN

N
_
p
W
+p
CNW

N
gz
_
_
= 0.
Here, p
W
and S
W
are considered the primary unknowns. Empirical measurements are necessary to establish
the relationships
k
r
= k
r
(S
W
) = W, N
p
CNW
= p
CNW
(S
W
)

W
=
W
(p
W
)

N
=
N
(p
N
) =
N
(p
W
, p
CNW
(S
W
))
We also need initial conditions p
W
(x

, 0), S
W
(x

, 0). These are known from measurements and interpolated to


get the desired functions.
The nal thing that we need are boundary conditions. Specify p
W
at the boundaries of the ow region.
Also, specify the normal ux of aqueous uid across the boundaries. That is, give
v

W
n

W
_
p
W

W
gz
_
n

Many times, such as in oil reservoirs, there is no ux at the boundary: v

W
n

= 0.
1.4 Multiphase-multispecies Flows
Many mixtures of interest, such as oil reservoirs, consist of several phases and several species. They consist
of several phases including rock, oil, water and gas. They also consist of many molecular species such as
methane, propane, water and salt.
Let the species be i = 1, . . . N+1 and consider three uid phases, aqueous(W), oil(O) and gas(G) and one
rock phase(R). One of the species is the rock material, for example, sandstone. In contamination problems,
the phase may be rock, water and DNAPL (dense nonaqueous phase liquids) or maybe even bacteria. We
will concentrate on modelling an oil reservoir.
In this mixture each pair (i, ) with i chosen from the species indices and from the phases is a
constituent. Example: methane in gas is one constituent and methane in oil is another.

i
, intrinsic mass density of species i in phase (mass of i/unit volume of )

, volume fraction of phase


12
S

, saturation of phase =

/, = 1
R
, porosity

=
N

i=1

i
, intrinsic mass density of phase
W

i
=

, mass fraction of species i in phase [mass i/mass ]


=

=R
S

, bulk density of uids [mass of uids/volume]


W
i
=
_

_

=R
S

i
, total mass fraction of species i in the uids [mass of i/mass of uids]
The baricentric velocity of phase is
v

=
1

i=1

i
v

i
.
The diusion velocity of species i in phase is
u

i
= v

i
v

.
Constraints
N

i=1
W
i
=
N

i=1
W

i
= 1, for every

=R
S

= 1
N

i=1

i
u

i
= 0

.
The mass balance law for constituent (i, ) is:

t
(

i
) + div
_

i
v

i
_
= r

i
.
exchange terms
()
Rewrite () as

t
_
S

..

i
. .
_
+ div
_
S

..
_
+ divj

i
= r

i
,

i
velocity of phase
()
where j

i
= S

i
u

i
is the diusive ux.
Assume no intraphase chemical reactions and

=R
r

i
= 0 for each species.
13
Sum () over all uid phases to get the total balance law for each species.

t
(W
i
) + div
_

_
S
W

W
W
W
i
v

W
+S
O

O
W
O
i
v

O
+S
G

G
W
G
i
v

G
__
+div
_
j

W
i
+j

O
i
+j

G
i
_
= 0 i = 1, . . . W.
Assume Darcys law for each phase
v

=
kk
r

(p

gz) = W, O, G.
Assume the hydrodynamic dispersion is small
j

W
i
+j

O
i
+j

G
i
0

t
_

_
S
W

W
W
W
i
+S
O

O
W
O
i
+S
G

G
W
G
i
_
div
_
kk
rW

W
W
W
i

W
_
p
W

W
g
z
_
+
kk
rO

O
W
O
i

O
_
p
O

O
gz
_

kk
rG

G
w
G
i

G
_
p
G

G
gz
_
_
= 0 i = 1, . . . N.
To close the system, we need some supplementary constraints. Some are the equations of state:

(W

1
, , W

N
, p

) = W, O, G
W

i
= W

i
(W
1
, , W
N
, p

) = W, O, G
S

= S

(W
1
, , W
N
, p

) = W, O, G,
which may be given explicitly, implicitly or in tabular form.
The other constraints are the constitutive relations:
p
O
p
W
= p
COW
= p
COW
(S
O
, S
G
)
p
G
p
O
= p
CGO
(S
0
, S
G
)
k
r
= k
r
(S
0
, S
G
= W, O, G.
The previous material is based partially on [2], [6], [3] and [4].
14
Chapter 2
Numerical Methods.
2.1 Basic Methods for Parabolic Equations
We will review some numerical methods for parabolic dierential equations. We will look at
Finite Dierence Methods
Weighted Residual Methods
Finite Volume Methods
Characteristic Methods
Nonstandard Methods
Other Methods
Finite Dierence Methods
They are the easiest to think about:
Replace derivatives by nite dierences

_
du
dx
_
i

u
i+1
u
i
x
forward dierence

_
du
dx
_
i

u
i
u
i1
x
backward dierence

_
du
dx
_
i

u
i+1
ui1
x
central dierence

_
d
2
u
dx
2
_
i
=
d
dx
_
du
dx
_
i

1
x
_
_
du
dx
_
i+1

_
du
dx
_
i
_
=
1
x
_
u
i+1
u
i
x

u
i
u
i1
x
_
=
u
i+1
2u
i
+u
i1
x
2
We will start with an ordinary dierential equation example:
Second order equation
d
2
u
dx
2
+ 2 = 0
15
with Dirichlet boundary conditions:
u = 0 at x = 0
u = 0 at x = 1.
Replacing the second derivative by nite dierences we obtain:
u
i+1
2u
i
+u
i1
x
2
+ 2 = 0,
which is a system of equations in u
i
.
If x = 1/2, then we have three points. With u
0
= 0 and u
2
= 0 from the boundary conditions, we have
u
1
= 1/4 which is the exact value at x = 1/2.
The nite dierence solution is
-
6
x
y
.5 1
.25
.5

H
H
H
H
H
H
H
H
H
Method of Weighted Residuals
We seek an approximate solution u of the form
u(x) =
N

i=0
u
i

i
(x)

Unknown Known
Coecients Basic functions
The basis functions (Legendre, trigonometric, piecewise Lagrange) are usually chosen to satisfy the b.c. but
not the equation.
When we substitute the approximation of the true solution into an equation Lu = f, we get a residual, R:
R( u) = L u f
The residuals are made zero in an average sense: Pick N weighting functions w
j
, j = 1, 2, . . . , N.
Dene the weighted average as:
< w, u >=
_

wudx
and make
< w
j
, R( u) >= 0 j = 1, 2, . . . , N,
16
which is a system of N linear equations.
Weighted Residual Methods
Subdomain: divide the domain into subdomains
j
not necessarily disjoint and choose
w
j
=
_
1 (x, y)
j
0 otherwise
Collocation: pick N points (x
j
, y
j
) in and choose w
j
(x, y) = ((x, y) (x
j
, y
j
))
< w
j
, R u >=
_

((x, y) (x
j
, y
j
)) R( u)dxdy =
R( u(x
j
, y
j
)) = 0
So equation is satised exactly at (x
j
, y
j
).
Least squares
w
j
=
R
u
j
_

R
R
u
0
dx =
1
2
_

R
2
u
j
dx = 0
Bubnov-Galerkin
w
j
=
j
Finite Elements
The method of nite elements requires that the basis functions,
j
(x) be nite elements, that is, they be
zero except for a small portion of the domain.
Lets start with a one-dimensional example:
du
dx
+bu = h 0 < x < 1
u(0) = 1
Dene grid: x
0
, x
1
, . . . , x
N
Let
{
j
(x)}
N
j=0
be piecewise Lagrange polynomials on x
0
, x
1
, . . . , x
N

j
(x) =
_

_
x x
j1
x
j
x
j1
x
j1
x x
j
x
j+1
x
x
j+1
x
j
x
j
< x x
j+1
0 otherwise
17
The piecewise linear basis functions are:
-
6
x
y
x
1
x
2
x
3
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@

0

1

2
u
0
is known from the b.c.:
u(0) = u(0) = u
0
= 1
u(x) =
0
(x) =
N

j=1
u
j

j
(x)
The residual is then: R( u) =

0
+
N

j=1
u
j

j
+k
_
_

0
+
N

j=1
u
j

j
_
_
h. In this method the weight functions
are the same as the basis functions so pick w
j
=
j
j = 1, . . . N.
_
1
0
R( u)
j
dx = 0 j = 1, . . . , N
The above integrals involve only basis functions. They can usually be calculated exactly, as in this case,
or using Gaussian quadrature formulas. We obtain a system of sparse linear equations, which can be solved
using a Gaussian elimination method designed for tridiagonal matrices known as the Thomas algorithm.
Collocation
The collocation method is similar diering only in the choice of weight functions:
Choose grid
Choose collocation points (where solution is exact)
Dene basis functions,
j
Satisfy Dirichlet boundary conditions
Write approximating function
u(x) =
0
(x) +
2

j=1
u
j

j
(x)
Substitute approximate solution into equation and nd residual function
Dene weight functions, w
i
(x) = (x x
i
)
18
Multiply residual by weight functions and integrate
Integrals are immediate because of the functions
Solve sparse linear system
Finite Volume Methods
Consider
d
2
u
dx
2
2 = 0, 0 < x < 1
. Divide the domain into nite volumes and integrate the equation
_
x
i+1
x
i1
_
d
2
u
dx
2
2
_
dx = 0
. Integrating
du
dx

x
i+1
x
i1

_
x
i+1
x
i1
2dx = 0
x
i1
x
i
x
i+1
V
i
S
i
S
i+i
Finite volume methods can be based on nite dierences or on nite elements. Using nite dierences:
u
i+1
u
i
x

u
i
u
i1
x
= 2x.
Using nite elements the method is:
Choose basis functions
Write approximate solution as linear combination
Substitute into integrated expression
Get same results as for nite dierences.
Parabolic equations
Parabolic equations are of the form
u
t
= f(u
xx
, u
x
, u, x, t)
19
An example is
u
t
= u
xx
0 < x < 1, 0 < t
u(x, 0) = f(x)
u(0, t) = g
0
(t), u(1, t) = g
1
(t)
The simplest method is the method of lines which consists of
Discretize the x part of the equation using nite dierences or nite elements
Get a system of ordinary dierential equations in time
Solve using Euler, Runge-Kutta, etc. Usually the method is Euler or backward Euler or an average of
both.
The numerical method that we choose needs to have some properties:
Consistency: The discretized equations approach the exact equation as the grid is rened.
Convergence: The approximate solution approaches the exact solution as the grid is rened.
Stability: Errors dont grow.
The proof of consistency is easy, but have we really want is that we have convergence. The easiest way of
proving convergence is to use the Lax equivalence theorem:
If the scheme inconsistent, then stability convergence.
Model equation
The heat equation is
u
t
= Du
xx
, 0 < x < x
max
, 0 < t u(x, 0) = u
I
, 0 < x < x
max
u(0, t) = u
2
u(x
max
, t) = u
k
_
t > 0
If we use an explicit scheme
u
n+1
j
u
n
j
=
t
x
2
_
u
n
j1
2u
n
j
+u
n
j+1
_
.
t is stable if
=
t
x
2

1
2
,
which gives a restriction to very small time steps.
Explicit molecule:
20
t
n+1
t
n
x
i1
x
i
x
i+1
x x
x
x
Fully Implicit:
u
n+1
j
u
n
j
=
_
u
n+1
j1
2u
n+1
j
+u
n+1
j+1
_
(1 + 2)u
n+1
j

_
u
n+1
j+1
+u
n+1
j1
_
= u
n
j
This scheme is unconditionally stable, but we need to solve a system of algebraic equations. It also introduces
articial viscosity.
The implicit molecule is
t
n+1
t
n
x
i1
x
i
x
i+1
x x
x
x
Crank-Nicolsons method is an average of the explicit and implicit methods:
u
n+1
j
u
n
j
=
_

_
u
n+1
j+1
2u
n+1
j
+u
n+1
j1
_
+(1 )
_
u
n
j+1
2u
n
j
+u
n
j1
_
]
= 0 explicit
= 1 full implicit
=
1
2
Crank Nicolson
Crank-Nicolsonscheme is unconditionally stable, has better accuracy than the fully implicit method but
still requires solution of algebraic systems
The Crank-Nicolsons molecule is
21
x
Unphysical oscillations
y
t
n+1
t
n
x
i1
x
i
x
i+1
x x
x x
x
x
Convection-diusion equations
A model equation is
u
t
=
1
Pe

2
u
x
2

u
x
,
where Pe=Peclet number =
vx
max

. Applying Crank-Nicolson to the equation we get


u
t

u
n+1
i
u
n
i
t
u
x

1
2
u
n+1
i+1
u
n+1
i1
2x
+
1
2
u
n
i+1
u
n
i1
2x

2
u
x
2

1
2
_
u
n+1
i+1
2u
n+1
i
+u
n+1
i1
_
x
2
+
1
2
_
u
n
i+1
2u
n
i
+u
n
i1
_
x
2
.
The truncation error is (t
2
+ x
2
)
If x >
2
Pe
we have spurious oscillations that produce instabilities.
The convection-diusion equation is also written as
c
t
+v
c
x


x
(Dcx) = 0,
where v is the velocity of the uid, and D is the diusion coecient. For most problems in porous media,
the convection term dominates. For example in modeling transport of a solute in a uid. Then the behavior
22
is close to that of hyperbolic equations. Which means that the numerical scheme needs to move information
in the same direction as the dierential equation. Upwind schemes are designed to do it:
If v > 0, forward dierences:
t
n+1
t
n
x
i1
x
i
x x
x
and if v < 0 then use backward dierences:
t
n+1
t
n
x
i
x
i+1
x
x
x
For nite elements the same eect is obtained with the Petrov-Galerkin method, which uses weight
functions that are larger in the direction of propagation.
Characteristic Methods
The method of characteristics is used to integrate the hyperbolic (transport) part. The main problem is
that the mesh gets deformed.
t
n
t
n+1
x
1
x
2
x
3
x
4
A
A
A
A
A
A
A
A
AK 6


x
1
x
2
x
3
x
4
One way to deal with this is to use the modied method of characteristics (MMOC), which uses a regular
mesh and integrates back along the characteristics. The characteristic does not get back at a grid point, but
since we know the solution at that time level we can interpolate to nd the value at this back track point.
This is a lagrangian method.
If we consider the transport equation
c
t
+v
c
x


x
_
D
c
x
_
= R(c)
23
The modied method of characteristics is
Dc
Dt
=
c
t
+v
c
x

C
n+1
(x) C
n
(x v
n
t)
t
*
x
i2
x
i1
x
i
x
i+1
time level (n)
particle path
concentration profile
x
i
n
x
i2
x
i1
x
i
x
i+1
time level (n+1)
*
Finite-Dierence Approximation (FD):
C
n+1
i
C
n
(x
i
v
n
t)
t

x
(D
x
C
n+1
)
i
= R(C
n+1
i
)
Other Methods
Mixed nite elements. Write second order equation as system of rst order equations
Eulerian-Lagrangian Methods: approximate part of the equation using Lagrangian coordinates (fol-
lowing physical particles) and part using Eulerian coordinates
ELLAM (Eulerian-Lagrangian localized adjoint method)
Particle in cell: Follow the motion of particles
Nonstandard methods: Integrate transport-reaction part exactly using characteristics
24
2.2 Numerical Methods for Elliptic Equations
In two dimensions Poissons equation is
u
xx
+u
yy
= f(x, y) in (0, 1) (0, 1)
u = u

(x, y) on the boundary


Finite dierence approximation
u
i+1,j
2u
i,j
+u
i1,j
x
2
+
u
i,j+1
2u
i,j
+u
i,j1
y
2
= f
ij
i = 1, . . . , N 1
j = 1, . . . , M 1
x
i
= ix x =
1
N
y
j
= jy y =
1
M
.....................................................................................................................................................................................
.....................................................................................................................................................................................
.....................................................................................................................................................................................
................................................................................................................................................................................................................................................................................
................................................................................................................................................................................................................................................................................
................................................................................................................................................................................................................................................................................
................................................................................................................................................................................................................................................................................
0
M
N
x
x
x
x
x
(N 1)(M 1) interior points with unknowns.
Solving for u
ij
u
ij
=
1
2x
2
+ 2y
2
_
(u
i+1,j
+u
i1,j
) y
2
+ (u
i,j+1
+u
i,j1
) x
2
+f
ij
x
2
y
2

=
1
(u
i+1,j
+u
i1,j
) +
2
(u
i,j+1
+u
i,j1
) +f
ij
,
where
1
=
y
2
2x
2
+ 2y
2
,
2
=
x
2
2x
2
+ 2y
2
, =
x
2
y
2
2x
2
+ 2y
2
.
Iterative Methods
Jacobi
u
(n+1)
ij
=
1
_
u
(n)
i+1,j
+u
(n)
i1,j
_
+
2
_
u
(n)
i,j+1
+u
(n)
i,j1
_
+f
ij
Gauss-Seidel Use updated variables as soon as they are available:
u
(n+1)
ij
=
1
_
u
(n)
i+1,j
+u
(n+1)
i1,j
_
+
2
_
u
(n)
i,j+1
+u
(n+1)
i,j1
_
+f
ij
25
SOR
u
(n+1)
ij
=
1
_
u
(n)
i+1,j
+u
(n+1)
i1,j
_
+
2
_
u
(n)
i,j+1
+u
(n+1)
i,j1
_
+f
ij
u
(n+1)
ij
= u
(n)
i,j
+w
_
u
(n+1)
i,j
u
(n)
ij
_
with 0 < w < 2 for convergence (w = 1 Gauss Seidel).
Line iterative methods: improve all points in a line at the same time.
Line Jacobi
u
(n+1)
ij

1
_
u
(n+1)
i+1,j
+u
(n+1)
i1,j
_
=
2
_
u
(n)
i,j+1
+u
(n)
i,j1
_
+f
ij
In each iteration we have to solve a tridiagonal system (direct method).
Line Gauss-Seidel (by columns)
u
(n+1)
ij

1
_
u
(n+1)
i+1,j
+u
(n+1)
i1,j
_
=
2
_
u
(n)
i,j+1
+u
(n+1)
i,j1
_
+f
ij
Line SOR (by columns)
u
(n+1)
i,j

1
_
u
(n+1)
i+1,j
+u
(n+1)
i1,j
_
=
2
_
u
(n)
i,j+1
+u
(n+1)
i,j1
_
+f
ij
u
(n+1)
ij
= u
(n)
i,j
+w
_
u
(n+1)
i,j
u
(n)
i,j
_
Alternating Direction Methods
Consist of a row line iteration, then a column line iteration and so on.
For example, ADLSOR is:
u
(n+
1
2
)
i,j

1
_
u
n+
1
2
)
i+1,j
+u
(n+
1
2
)
i1,j
_
=
2
_
u
(n)
i,j+1
+u
(n+
1
2
)
i,j1
_
+f
ij
u
(n+
1
2
)
ij
= u
(n)
i,j
+w
_
u
(n+
1
2
)
i,j
u
(n)
i,j
_
u
(n+1)
i,j

2
_
u
(n+1)
i,j+1
+u
(n+1)
i,j1
_
=
1
_
u
(n+
1
2
)
i+1,j
+u
(n+1)
i1,j
_
+f
ij
u
(n+1)
i,j
= u
(n+
1
2
)
i,j
+w
_
u
(n+1)
i,j
u
(n+
1
2
)
k,j
_
One advantage is that the inuence of b.c. spreads faster into the whole domain.This implies better conver-
gence.
Conjugate Gradient Methods
26
Symmetric matrices: Conjugate gradient and preconditioned conjugate gradient
Nonsymmetric matrices: Orthomin, GMRES, . . . .
Finite Elements In 1-D we have for piecewise linear basis functions,that are given by piecewise Lagrange
polynomials. They can also be written in terms of functions dened in [1, 1]:
1 1

Figure 2.1: Linear basis functions in terms of

1
() =
1
2
(1 )
1
() =
1
2
(1 +)
or

i
=
1
2
(1 +
1
) where
i
= 1, 1
In two dimensions the easiest is to form the product of two one-dimensional bases, one in each direction
=
1
4
(1 +
i
) (1 +
i
)
Triangular elements
The linear basis functions are of the form
(x, y) = ax +bx +c making it one at one node and zero at the others we get

i
(x, y) =
x(y
j
y
k
) +y(x
k
x
j
) + (x
j
y
k
x
k
y
j
)
det(P)
where (i, j, k) is a cyclic permutation of (1, 2, 3)
and P is
_
_
x
i
y
i
1
x
j
y
j
1
x
k
y
k
1
_
_
27
(1,1)
(1,1)
(1,1)
(1,1)
Figure 2.2: Example of a 2-D linear basis function
A
2
A
3
A
1
(x
3
, y
3
)
(x
2
, y
2
)
(x
1
, y
1
)
(x, y)
Figure 2.3: A triangular element
Let P
i
be the matrix obtained from P when (x
i
, y
i
) is replaced by (x, y) then
i
=
det(P
i
)
det(P)
or in terms of the areas of the triangles (since A =
1
2
det(P))

i
(x, y) =
A
i
A
All three
i
are not independent since
A
i
+A
2
+A
3
= A
and
3
= 1
1

2
28
Chapter 3
Numerical Methods for some
Problems in Porous Media.
3.1 1-D Steady Flow
We consider the steady ow of water through a porous medium consisting of three zones with dierent
hydraulic properties. Water is injected at a unit rate into the left side of the medium and at the right end
the head is maintained at at constant value of 5.
The ow is given by Darcys law:
v =
kg

_
1
g
p
x
+
z
x
_
.
Dene the hydraulic head as h = p/(g) +z and the hydraulic conductivity coecient as K = gk/, then
Darcys law is
v = K
h
x
.
We discretize the medium using three elements, and four nodes: at the left end, two at the boundaries
between elements and one at the right end.
4
Q=1 h=5
1 2
1 2 3 4
Figure 3.1: Three element composite porous medium
Consider an element e with local nodes 1 and 2. The ow is positive if it is entering the element. We
will use linear basis functions. Darcys equation at each node is
Q
1
= KA
h
1
h
2
L
and
Q
2
= KA
h
2
h
1
L
,
29
where K is the hydraulic conductivity, A the cross-sectional area and L the length of the element.
Writing the system in matrix form
_
KA
L

KA
L

KA
L
KA
L
_
e
_
h
1
h
2
_
e
=
_
Q1
Q
2
_
e
,
or
[C]
e
h
e
= Q
e
.
Here the e denotes we are working at the element level.
To assemble the global set of equations, we write the above equations for each node: For element 1
_

_
c
(1)
11
c
(1)
12
0 0
c
(1)
21
c
(1)
22
0 0
0 0 0 0
0 0 0 0
_

_
_

_
h
1
h
2
h
3
h
4
_

_
=
_

_
Q
1
1
Q
1
2
0
0
_

_
.
For element 2
_

_
0 0 0 0
0 c
(2)
11
c
(2)
12
0
0 c
(2)
21
c
(2)
22
0
0 0 0 0
_

_
_

_
h
1
h
2
h
3
h
4
_

_
=
_

_
0
Q
2
1
Q
2
2
0
_

_
.
For element 3
_

_
0 0 0 0
0 0 0 0
0 0 c
(3)
11
c
(3)
12
0 0 c
(3)
21
c
(3)
22
_

_
_

_
h
1
h
2
h
3
h
4
_

_
=
_

_
0
0
Q
3
1
Q
3
2
_

_
.
Adding the three matrices we get
[C]h = Q,
where
h =
_

_
h
1
h
2
h
3
h
4
_

_
,
Q =
_

_
Q
(1)
1
Q
(1)
2
+Q
(2)
1
Q
(2)
2
+Q
(3)
1
Q
(3)
2
_

_
,
and
[C] =
_

_
c
(1)
11
c
(1)
12
0 0
c
(1)
21
c
(1)
22
+c
(2)
11
c
(2)
12
0
0 c
(2)
21
c
(2)
22
+c
(3)
11
c
(3)
12
0 0 c
(3)
21
c
(3)
22
_

_
.
Note that c
ij
= c
ji
. Enforcing the continuity of ow at the internal nodes 2 and 3: Q
(1)
2
= Q
(2)
1
and
Q
(2)
2
= Q
(3)
1
, so the right hand side vector becomes
Q =
_

_
Q
(1)
1
0
0
Q
(3)
2
_

_
.
30
Using the boundary conditions we have Q
(1)
1
= Q
1
= 1. The other boundary condition h
4
= 5 has to be
incorporated carefully to keep the symmetry of the system:
_

_
c
11
c
12
c
13
0
c
21
c
22
c
23
0
c
31
c
32
c
33
0
0 0 0 0
_

_
=
_

_
h
1
h
2
h
3
h
4
_

_
=
_

_
1 5c
14
5c
24
5c
34
5
_

_
.
Finally we need to solve the linear system.
3.2 Slightly Compressible Fluid
The continuity equation is now
v
x
= ( +)
p
t
.
Since
h
t
=
1
g
p
t
the equation of continuity can be written as
( +)
p
t
= g( +)
h
t
= S
s
h
t
,
where S
s
= g( + ) is called the specic storage. Combining this equation and the continuity equation
with Darcys law we obtain

x
_
K
h
x
_
= S
s
h
t
.
Consider the above equation on 0 x X, with the initial and boundary conditions h(x, 0) = h)0, h(0, t) = 0
and h(X, t) = 0. Using the Galerkin nite element approach, approximate h by
h(x, t) =
n

J=0

J
(x)h
J
(t).
Substituting this approximation, multiplying by the weight function
I
(x), integrating over x and integrating
by parts the term with the second x derivative we get:

J
_
_
X
0

I
x
d
J
dx
h
J
d x +
_
X
0
S
s

J
dh
J
dt
d x
_
= 0.
Or

J
_
C
IJ
h
J
+M
IJ
dh
J
dt
_
= 0, forI = 2, 3, . . . , n 1.
Here
C
IJ
=
_
X
0
K
d
I
dx

J
dx
d x
and
M
IJ
=
_
X
0
S
s

J
d x.
31
The time derivative can be approximated by nite dierences or nite elements. Lets do nite dierences.
Use a super index k + to denote the time level, with 0 1:

_
C
IJ
h
k+
J
+M
IJ
(
dh
J
dt
)
k+
_
= 0.
The time derivative is approximated as
(
dh
J
dt
)
k+
= (h
k+1
J
h
k
J
)/t
and the values of the head at k + by
h
k+
J
= (1 )h
k
J
+
k+1
J
.
Our system is now

_
C
IJ
[h
k+1
J
+ (1 )h
k
J
] +
M
IJ
t
(h
k+1
J
h
k
J
)
_
= 0.
For = 0 we obtain the following explicit scheme

[
M
IJ
t
h
k+1
J
=

(
M
I
J
t
C
IJ
]h
k
J
.
For = 1 the scheme is fully implicit. After moving all the terms at the new time level k + 1 to the left
and all the terms at the k level to the right we have

[C
IJ
+
M
IJ
t
]h
k+1
J
=

M
IJ
t
h
k
J
.
And nally for = 1/2 we have the Crank-Nicolson scheme

[
C
IJ
2
+
M
IJ
t
]h
k+1
J
=

[
M
IJ
t

C
IJ
2
]h
k
J
.
The explicit scheme is the easiest to solve but is only conditionally stable. Both the implicit and Crank-
Nicolson are unconditionally stable.
The two previous examples are from [3].
32
3.3 Non-steady Aquifer
Consider an aquifer with uniform thickness b and assume that it is uniform in the vertical direction. Assume
that there is recharge from precipitation or extraction by wells given by a function R, the volume of water
added or subtracted per unit time per unit area. Take a small rectangular region of size x by y by b.
The continuity equation is now
v = R/b.
Substituting Darcys law v = Kh we get

2
h
x
2
+

2
h
y
2
=
R(x, y)
T
.
where T is the transmissivity dened as T = Kb. The nite dierence form of this Poisson equation is
h
i1,j
2h
i,j
+h
i+1,j
(x)
2
+
h
i,j1
2h
i,j
+h
i,j+1
(y)
2
=
R
T
.
It can be solved using Gauss-Seidel iteration.
For problems with pumping of water through wells we need to introduce the storage coecient S which
represents the volume of water released from storage per unit area per unit decline of head
S =
V
w
xyh
,
where V
w
is the volume of water released from storage within the element of volume with area xy and
thickness b. Adding this term to the continuity equation we get
v =
R
b

S
b
h
t
.
Substituting Darcys law we get

2
h
x
2
+

2
h
y
2
=
S
T
h
t

R(x, y, t)
T
.
If we use a forward dierence time approximation
h
t

h
n+1
ij
h
n
ij
t
and the usual approximation for the second space derivatives we get
h
n
i1,j
2h
n
i,j
+h
n
i+1,j
(x)
2
+
h
n
i,j1
2h
n
i,j
+h
n
i,j+1
(y)
2
=
S
T
h
n+1
ij
h
n
ij
t

R
n
ij
T
.
Letting x = y = a and solving for h
n+1
ij
h
n+1
ij
=
_
1
4Tt
Sa
2
_
h
n
ij
+
_
4Tt
Sa
2
__
h
n
i1,j
+h
n
i+1,j
+h
n
i,j1
+h
n
i,j+1
4
+
R
n
ij
t
S
_
.
This example is done in [5].
33
3.4 Mixed Finite Element Example
Assume a rigid porous medium saturated with a viscous, incompressible uid, If the medium is also assumed
to be homogeneous and isotropic and the uid and solid are in thermal equilibrium, the equations of the
uid are
u
i
x
i
= 0 (3.1)

u
j
t
+
_
c

u +

_
u
i
=

x
j
_
P
ij
+
e
_
u
i
x
j
+
u
j
x
i
__
+f
i
. (3.2)
Here is the density, is the permeability, is the porosity, c is the inertia coecient and u is the
magnitude of the velocity. is the viscosity coecient, P is the pressure, f is the body force, and the
subindex e refers to eective viscosity. We sum over repeated indices.
The above system is a generalization of the Darcys equations for isothermal ow in a saturated medium.
It is called the Forchheimer-Brinkman model.
The boundary conditions are the same as for viscous ow: Dirichlet boundary conditions:
u
i
= f
u
i
(s, t) on
u
or Neumann boundary conditions:

i
=
ij
(s, t)n
j
(s) = f

i
(s, t) on

,
where s is the coordinate along the boundary, t is time, n
i
the outward unit normal and the boundary.
The weak form of the above equations is obtained by multiplying by weight functions (Q, w) and inte-
grating over the domain .
Using the shorthand f
1
= 0 and f
2
= f
3
for equations 3.1 and 3.2we get
_

Qf1dx = 0
and
_

w f
2
dx =
_

w f
3
dx.
Integrating by parts the term inside the square brackets in the second equation we get
0 =
_

Q(
u
i
x
i
dx
0 =
_

_
w
i

u
j
t
+w
i
_
c

u +

_
u
i
+
w
i
x
j
_
P
ij
+
e
(
u
i
x
j
+
u
j
x
i
)
_
w
i
f
i
_
dx
_

w
i

i
ds.
As in any Galerkin nite element approximation we write u and P in terms of basis functions and use the
same basis functions for the weight functions
u
i
(x, t) =
M

m=1

m
(x)u
m
i
(t) =
T
u
i
34
P(x, t) =
L

l=1

i
(x)P
l
(t) =
T
P
Q = and w = .
Substituting into the equations for conservation of mass and momentum we get

__

T
x
i
dx
_
u
i
= 0
_
_

T
dx
_
u
i
+
_
_

(
T
u)
T
dx
_
u
i
+
__

T
dx

u
i
+
_
_
O
mega
e

x
j

T
x
j
dx
_
u
i
+
_
_

T
x
j

T
x
i
dx
_
u
i

_
_

x
i

T
dx
_
P
=
__

f
i
dx

+
__

i
ds
_
The above equations can be written in matrix form as

Q
T
u = 0
and

M u +

C(u)u +

Au +

Ku

QP =

F
where u = (u
1
, u
2
, u
3
)
T
and

M =
_

T
dx

C(u) =
_

(
T
u)
T
dx

A =
_


T
dx

K
ij
=
_

T
x
j

T
x
i
dx

Q
i
=
_

x
i

T
dx

F
i
=
_

f
i
dx +
_

i
ds.
Writing it as a single matrix equation
_

M 0
0 0
_ _
u

P
_
+
_

C(u) +

A+

K

Q
T
0
_ _
u
P
_
=
_

F
0
_
.
For Darcys case, c = 0 and
e
= 0, the system simplies to
_
0 0
0 0
_ _
u

P
_
+
_

A

Q
T
0
_ _
u
P
_
=
_

F
0
_
.
It can be shown that for the discrete system not to be overconstrained the basis functions for the pressure
must be at least one order lower than the basis functions for the velocity. Furthermore, the pressure does
not need to be continuous across elements. The Ladyzhenskaya-Babuska-Brezzi (LBB) condition needs to
be satised, so there are additional restrictions on which basis functions work with the given elements.
For 2-D problems a common element is a rectangle with nine nodes, one in each corner, one in the middle
of each side and one in the center. The velocity is represented using biquadratic Lagrange functions. The
35
pressure can be given as a bilinear which is continuous across elements and dened at the corners of the
rectangle. Or it could be given as bilinear but discontinuous.
This section was inspired by [4].
36
3.5 Transport of a Solute
The transport of a nonreactive, nonradioactive solute in the absence of adsorption is given by

t
c +

x
i
v
i
c =

x
i
_
D
ij
c
x
j
_
,
where summation over repeated indices is assumed. c is the concentration of the solute per unit volume, D
ij
is the dispersion coecient and the porosity. To obtain the velocity we need solve the pressure equation
H
p
t
+

x
i
[M
ij
(
p
x
j
+g
j
)] = 0
where H = ( +) and M
ij
= k
ik
/ and substitute the pressure into Darcys law
v
i
=
k
i
j

(
p
x
j
+g
j
).
To simplify notation lets introduce the central dierence u
r
= u
r+1/2
u
r1/2
and the backward
dierence
t
u
r
= u
r
u
r1
and use a subindex to denote the variable with respect to we take the dierence.
1
x
i

x
i
_
D
ij

x
j
x
j
c
_
+
k
ij

_

x
i
x
j
p +g
j
_

x
i
x
i
c =

t

t
(c)
H
t

t
p +
1
x
i

x
i
_
M
ij
(
1
x
j

x
j
p +g
j
)
_
= 0.
We have a system of 2N nonlinear equations in 2N unknowns, p and c, where N is the number of nodal
points. These equations are weakly nonlinear and are usually solved sequentially. That is, rst solve for the
pressure, and nd the velocity, and then solve for the concentration. Explicit nite dierence schemes are
commonly used, in spite of having to restrict the time step to avoid nonphysical oscillations. But implicit
methods that dont have this restriction, introduce articial diusion. They also require to calculate second
cross derivatives which increase the number of o-diagonal elements in the system matrix.
The material in this section is based on [3].
37
3.6 Modied Method of Characteristics for Transport
Problem Description 1.- Fluid ow equation
In this section we consider transient groundwater ow in a 2-D aquifer. There is a dissolved solute that is
transported by the ow and also diuses.
The pressure equation is
S
p
t
(Kp) = f,
where S(x, t) is the specic storage, p(x, t) is the pressure or hydraulic head, K(x, t) is the saturated hydraulic
conductivity and f(x, t) represents the sources or sinks.
As before this equation is derived by combining the mass balance law
S
p
t
+ v = f
with Darcys law for the groundwater velocity
K
1
v +p = 0.
Numerical Solution of the Flow Equation
S
p
t
(Kp) = f vs.
_

_
S
p
t
+ v = f
K
1
v +p = 0
Mixed Finite-Element Method
variational formulation:
_

K
1
v
h
w
_

p
h
w = 0, w W
h
= W
x
h
W
y
h
_

qS
p
h
t
+
_

q v
h
=
_

qf, q Q
h
lowest-order Raviart-Thomas spaces Q
h
, W
h
forward-dierence and matrix splitting
Or writing it as a matrix system:
_
D N
N
T
t
1
M
_ _
U
P
_
n+1,m+1
=
_
D A N
N
T
t
1
M
_ _
U
P
_
n+1,m
+
_
0
G
_
n
.
38
Multigrid based solver at each iteration level
Pressure and velocity nodal values:
* * *
P
0
P
1
P
n1
V
0
V
1
V
2
V
n1
V
n
x
0
x
1
x
2
x
n1
x
n
The error estimates:
the approximate pressures and velocities obey equal-order L
2
global error estimates that are O(x).
Problem Description 2.- Solute transport equation
The convection-dispersion-reaction equation for single species transport in a 2-D aquifer is
c
t
+ (vc) (D c) = r(c),
where c(x, t) is the solute concentration, v(x, t) is uid (barycentric) velocity, r(c) are the reaction and
source terms and D(v) is the hydrodynamic dispersion tensor:
D(v) = d
m
_
1 0
0 1
_
+
d
L
|v|
_
v
2
x
v
x
v
y
v
y
v
x
v
2
y
_
+
d
T
|v|
_
v
2
y
v
y
v
x
v
x
v
y
v
2
x
_
,
where d
m
is the molecular diusion coecient, and d
L
and d
T
are the longitudinal and transverse dispersiv-
ities.
The derivation of the transport equation is based on combining the mass balance law
c
t
+ (vc) + j = r(c)
with Ficks law for the diusive ux
j = D c.
It is important to remember the changing nature of the solute transport equation
hyperbolic (convection-dominated) preserves sharp fronts
parabolic (diusion-dominated) smoothes sharp fronts
Numerical Solution of the Transport Equation
c
t
+v c (D c) = r(c).
A very reliable method to solve the above equation is the MMOCGalerkin Method. Its two parts are
39
1. Modied method of characteristics:
c
t
+v c =
Dc
Dt
(x, t
n+1
)
c(x, t
n+1
) c( x
n
, t
n
)
t
,
where the backtrack point is x
n
= x v t
2. Galerkin nite-element method:
1
t
_

(c
n+1
h
c
n
h
) +
_

Dc
n+1
h
=
_

r(c
n+1
h
).
Gauss quadrature method is used to calculate c
n
h
(x) = c
n
h
( x
n
). Also Picards iteration is needed to
accommodate r(c
n+1
h
)
Following particle paths:
*
x
i2
x
i1
x
i
x
i+1
time level (n
)

particle path
concentration profile
x
i
n
x
i2
x
i1
x
i
x
i+1
time level (n+
1)

*
An alternative numerical solution of the transport equation
c
t
+v c (D c) = r(c)
It is called the MMOC Streamline Diusion Method
Modied method of characteristics:
c
t
+v c =
Dc
Dt
(x, t
n+1
)
c(x, t
n+1
) c(x v
n+1
t, t
n
)
t
Streamline diusion method: +v
1
t
_

(c
n+1
h
c

h
) +
_

(v c
n+1
h
)(v )
+
_

D c
n+1
h
=
_

r(c
n+1
h
).
The new integral term mimics the longitudinal entries of the hydrodynamic dispersion tensor D(v)

_
v
2
x
v
x
v
y
v
y
v
x
v
2
y
_
.
The error estimates for the combined MMOC-SD method are L
2
error bounds: O(x + t).
40
3.7 Multiphase Flow
Here we consider an oil reservoir with two phases: water and oil. Darcys law is
v
if
=
k
ij
k
rf

f
_
p
f
x
j
+
f
g
z
x
j
_
, f = w, o.
To account for volume changes due to the dierent pressures at the reservoir and at the surface it is convenient
to introduce a formation volume factor, B
f
= V
f
/V
fs
. Thus we obtain the following continuity equations


x
i
_
v
if
B
f
_
=

t
_
S
f
B
f
_
,
where S
f
is the saturation of phase f, dened as
f
/, with
f
the volume fraction occupied by uid f and
is the porosity. Substituting the Darcys velocities into this equation we get

x
i
_
k
ij

f
B
f
_
p
f
x
j
+
f
g
z
x
j
__
=

t
_
S
f
B
f
_
,
where
f
is the mobility factor dened as
f
= k
rf
/
f
.
Averaging over the vertical thickness b

x
i
_
b
k
ij

f
B
f
_
p
f
x
j
+
f
g
z
x
j
__
= b

t
_
S
f
B
f
_
.
Assuming k
12
= k
21
= 0 the nite dierence form can be written
1
(x
i
)
2

x
i
_
bk
ii

f
B
f
(
x
i
p
f
+
f
g
x
i
z)
_
=
1
t

t
_

S
f
B
f
_
. (3.3)
All the terms in the left hand side are evaluated at time s + 1, which gives a coupled nonlinear system of
equations.
The Implicit pressure-Explicit Saturation method (IMPES) proposes to be a more ecient method. The
idea is to eliminate the saturation terms and obtain an equation that contains only the pressure as the
dependent variable. This equation is solved using an implicit nite dierence approximation. Then the
saturation can be solved explicitly from the original equations.
Assume that the capillary pressure p
cow
= p
o
p
w
does not change over a time step. Therefore
t
p
w
=

t
p
o
and letting p p
o
gives

x
i
[a
wi
(
x
i
p
x
i
p
cow
+
w
g
x
i
z)] =
d
w1
t

t
p +
d
w2
t

t
S
w
and

x
i
[a
oi
(
x
i
p +
o
g
x
i
z)] =
d
o1
t

t
p +
d
o2
t

t
S
o
,
where
a
fi
=
bk
ii

f
(x
i
)
2
B
f
i = 1, 2,
d
f1
=
1
t
_
(S
f
)
s
(1/B
f
)
dp
f
+
S
fs
B
fs+1
d
dp
_
,
41
and
d
f2
= (/B
f
)
s+1
.
Here s refers to the time level. Remembering that S
w
+ S
o
= 1, we reduce the above two equations to an
equation in the pressure by multiplying the rst one by d
o2
, the second one by d
w2
and adding
d
o2

x
i
[a
wi
(
x
i
p
x
i
p
cow
+
w
g
x
i
z)] +d
w2

x
i
[a
oi
(
x
i
p +
o
g
x
i
z)] =
_
d
o2
d
w1
t
+
d
o1
d
w2
t
_

t
p.
Using the capillary pressure at time s, we can rewrite this equation in a similar for to that for a one-phase
ow:

x
i
[a
wi
(
x
i
p +
w
g
x
i
z)] +
d
w2
d
o2

x
i
[a
oi
(
x
i
p +
o
g
x
i
z)] =
_
d
w1
t
+
d
o1
d
w2
d
o2
t
_

t
p +
x
i
(a
wi

x
i
p
cow,s
).
This is an implicit nonlinear dierence equation for p
s+1
. Equations (3.3), f = o, w can now be solved
explicitly for the saturations.
Similar procedures can be used for the case of three phases: water, oil and gas. For more information see
[2], [6] and [3].
42
Bibliography
[1] Jacob Bear, Dynamics of Fluids in Porous Media, Dover Publications, New York, 1988.
[2] Myron Allen et al., Numerical Modeling in Science and Engineering, John Wiley and Sons, New York,
1988.
[3] Peter Huyakorn and George Pinder, Computational Methods in Subsurface Flow, Academic Press, Lon-
don, 1983.
[4] J. N. Reddy and D. K. Gartling,The Finite Element Method in Heat Transfer and Fluid Dynamics, CRC
Press, Boca Raton, 1994.
[5] Herbert Wang and Mary Anderson, Introduction to Groundwater Modeling, W. H. Freeman, San Fran-
cisco, 1982.
[6] Zhangxin Chen et al, Computational Methods for Multiphase Flow in Porous Media, SIAM, Philadelphia,
2006.
43

You might also like