Documentos de Académico
Documentos de Profesional
Documentos de Cultura
(p
f
g) (2.3)
It states that the pressure forces (p) balance viscous forces in the pores (
v
k
) and
gravity (
f
g). Here k is the permeability tensor dened for the domain, and
f
are
dynamic uid viscosity and uid density (strong functions of pressure for compressible
uid) respectively, p is gradient vector of pore pressure in space and g is vector of
acceleration due to gravity. (p
f
g) is the net ow potential of the velocity v.
Form of mass balance dierential equation in a homogeneous reservoir with single-
phase ow becomes,
c
t
p
t
+ v = f (2.4)
where c
t
has been introduced as the total compressibility to account for volume
changes in accumulation term. It is a sum of uid compressibility (saturation weighted
in multiphase ow) and solid compressibility.
CHAPTER 2. THE PHYSICAL AND MATHEMATICAL MODEL 13
Eqn. (2.4) is the common form of the equation for traditional reservoir simulation
where stress is assumed to be constant and rock compressibility account for the entire
mechanical response of the system. In more general form, variation in mass (or volume
if density is assumed to be constant) can be written as,
1
M
_
1 +
b
2
M
K
o
_
(p p
o
) +
b
3K
o
tr =
m
f
(2.5)
where M is Biots modulus, b is Biots coecient (0 < b 1), K
o
is drained bulk
modulus of the composite system and p
o
is initial uid pressure. Superscript of zero
signies initial or reference conguration and has been assumed to correspond to zero
stress and pressure for subsequent derivations. tr denotes trace of stress tensor and
similar notation will be used for trace of strain.
Biot modulus M quanties the compressibility of uid and solid grains and is
obtained from microscopic properties of the system (uid and solid bulk moduli):
1
M
=
K
f
+
b
K
s
(2.6)
where K is undrained bulk modulus (a macroscopic quantity similar to K
o
), K
f
and K
s
are uid and solid microscopic moduli.
Biot coecient b is related to the bulk moduli of the solid skeleton K
s
by eqn. (2.7).
b = 1
K
o
K
s
(2.7)
b is a measure of grain compressibility. For soil it is close to 1, its maximum value,
and for rocks and concrete it is in the range of 0.4-0.6.
Eqn. (2.5) can also be written in terms of undrained bulk modulus K as follows,
1
M
_
K
K
o
_
p
t
+ b1
t
_
K
K
o
_
s
_
u
t
_
+ v = f (2.8)
Boundary conditions for the ow problem can be of either Dirichlet or Neumann
type:
p = p on
p
CHAPTER 2. THE PHYSICAL AND MATHEMATICAL MODEL 14
v n =
k
_
p
n
f
g
_
= v on
v
(2.9)
where
p
n
= p n (2.10)
In almost all the test cases described in subsequent chapters, the system boundaries
are considered to be impervious (no-ow-boundary), i.e.,
v n = 0 on
2.1.2 Solid Deformation
When uid ows through a porous medium there are three forces acting, per unit
volume, on the solid matrix: the solid weight, the buoyancy, and the drag or seepage
force [39, 44, 6]. These forces are automatically taken into account in our formulation
and expressed below in mathematical form.
The mechanical response of the coupled system is governed by overall momentum
balance equation as given below:
+ g = 0 (2.11)
Here, we note that mass force term corresponding to relative motion of solid and
uid phases have been ignored for small deformation, low frequency scenario prevailing
in most of the hydrocarbon reservoirs. Its retention is computationally undesirable
and its inuence is small. Also, here is the total density of the system (a macroscopic
quantity) computed using following relation:
=
f
+ (1 )
s
(2.12)
where
s
is solid density.
Now, we introduce eective stress, denoted by
eff
in mathematical represen-
tations and which is the actual force behind skeleton straining not the total stress
experienced by the solid grains.
eff
is dened such that it depends only on total
stress and pore pressure p as in eqn. (2.13).
CHAPTER 2. THE PHYSICAL AND MATHEMATICAL MODEL 15
eff
= bp1 (2.13)
and its relation with deformation or grain displacement is discussed in Section 2.
Boundary conditions linked to above equations are of two types: forced (Dirichlet
or essential) and natural (Neumann type) applying to displacement unknowns and
total stress:
u = u on
u
(prescribed displacement)
n = t on
t
(prescribed traction)
Stress and displacement boundary conditions are applied in various test cases some
of which will be discussed in Chapter 6. Pressure boundary conditions have been
applied in terms of xed well pressures in the eld at designated element centers.
2.2 Constitutive Models
Constitutive models provide the essential relationships between various macroscopic
and microscopic properties of a continuum and are necessary to complete the set of
equations governing the response of the matter under loading or perturbation of state.
They also determine the degree of nonlinearity we allow in our problem denition
which has a direct bearing on subsequent phases of solution development. As we
presented assumptions behind our governing equations, similarly we can mention the
important assumptions behind the constitutive models we are going to select for our
formulation:
1. The macroscopic constitutive theory assumes that at the micron-scale, the ma-
terial is homogeneous, and that as a result the strain eld is homogeneous and
stress is uniform in a region surrounding each point in the solid.
2. Laws of thermodynamics hold in our constitutive relations
3. These relations conform to the experimental observations
CHAPTER 2. THE PHYSICAL AND MATHEMATICAL MODEL 16
Any porous deposit can broadly be considered as a two-phase (solid and uids)
medium characterized by
1. a total stress
2. displacements of solid phase u
3. strain rate of solid phase
=
s
u (2.14)
as solid phase terms and uid phase terms are
1. uid phase pressure(s)
2. uid phase saturation(s)
2.2.1 Fluid Component
Constitutive relations for owing uids in porous media are usually given by density
relations (expressions relating phase density to phase pressure and temperature) and
are also termed as equations of state as they act on state variables.
c
f
=
1
f
p
(2.15)
When c
f
is held constant with respect to pressure we arrive at exponential relation
for density evolution as a function of pressure,
f
=
o
exp [c
f
(p p
o
)] (2.16)
2.2.2 Solid Component
Deformation of solid phase or skeleton depends on the eective stress which, as a
part of constitutive model, is linked to skeleton (solid grains and occluded porosity
1
)
strain and material specic property (may be a constant, depends on the behavior of
porous medium). Based on the compaction behavior measured in the laboratory and
1
unconnected pore spaces
CHAPTER 2. THE PHYSICAL AND MATHEMATICAL MODEL 17
observed in the eld, the constitutive model required for reservoir deformation could
vary from a simple linear-elastic model to a sophisticated elasto-plastic model. Here,
we consider an isothermal, linear poroelastic model, applicable to our system, with
following features,
1. The material is perfectly reversible (net work done on the solid subjected to a
closed cycle of strain is zero).
2. The stress at a point in the solid depends only on some appropriate measure
of strain at that point, and is independent of history or rate of loading.
3. The relationship between stress and strain is linear, stress is proportional to
strain and vice-versa.
4. Strains are small enough that the measure of innitesimal strain accurately
approximates the more rigorous nonlinear measures.
Hookes law, often used to mathematically represent the third assumption, is given
as
= C (2.17)
In more general circumstances, when we would like to track nonlinear deformations
(hardening, softening, creep etc.) the stress-strain relation is expressed as follows
= f (p, , stress history ) (2.18)
Stress and strain are tensor quantities but are usually written and implemented
as vector quantities in the engineering notation. Similarly, C, a four-rank tensor, is
transformed into a matrix D, Hookes proportionality coecient, under assumption
of isotropic conditions. D is usually computed from Youngs modulus E and Poissons
ratio . Since we have pointed out that it is the eective stress which characterizes
the deformation in the system, applying Hookes law over poroelastic continuum gives
us
eff
= D (2.19)
CHAPTER 2. THE PHYSICAL AND MATHEMATICAL MODEL 18
Stress and strain tensor can be expressed in terms of a volumetric component
and a deviatoric component. Volumetric and deviatoric split of strain tensor can be
expressed as in eqn. (2.20)
=
1
2
v
1 +e (2.20)
where e is deviatoric part of the strain tensor.
Strain is linked to grain displacement in such a way that the coupling between ow
and mechanical equations is only present in the volumetric component (no coupling
is present in deviatoric part). This relation is given in eqn. (2.21).
=
s
u =
1
2
_
grad u + grad
T
u
_
(2.21)
that is
=
_
u
x
1
2
_
u
x
+
u
y
_
sym
u
y
_
(2.22)
where
s
u denotes the symmetric part of the solid displacement gradient.
Volumetric strain is quantied as trace of the strain tensor,
v
= (
xx
+
yy
) =
trace () = tr and D can be expressed in terms of Youngs modulus E and Poissons
ratio ,
D =
E (1 )
(1 + ) (1 2)
1
1
0
1
1 0
0 0
12
2(1)
(2.23)
Following engineering notation
2
we can express stress and strain tensors as vectors.
In plane strain the stress and strain vectors are given as,
= (
xx
,
yy
,
xy
)
T
, = (
xx
,
yy
, 2
xy
)
T
We follow the sign convention of positive stresses in tension and positive pressure
in compression.
2
Engineering notation or an indicial notation helps to condense large mathematical expressions,
yet with a syntax that translates directly to program code.
CHAPTER 2. THE PHYSICAL AND MATHEMATICAL MODEL 19
In general, the tangent matrix C depends on the eective stress
eff
and on load-
ing direction but for simplied linear poroelasticity, isotropic conditions, is constant.
2.3 Characteristic Time
Analysis of characteristic times in a physical process of coupled phenomena is an
interesting topic in itself which can be utilized in designing and implementing the
simulation of such processes on computer [14]. This is of special signicance in a
coupled geomechanical and ow modeling as discussed below.
The relative time scales associated with consolidation and mechanical loading
should be appreciated while applying the time integration step. Mechanical defor-
mation involves a stationary vector equation as no time derivative is present in it.
Mechanical eects occur almost instantaneously, on the order of seconds or fractions
of seconds. However, uid ow is a long-term process: the dissipation associated
with consolidation takes place over hours, days or weeks. In practice, therefore, some
simulators do not attach any time frame with any of the mechanical sub-steps taken
in association with uid-ow steps in order to satisfy quasi-static equilibrium. When
compared to diusion eects, mechanical eects are treated as instantaneous and the
time dependency therein comes from varying total stress.
There are two characteristics times involved in simulating a uid-structure inter-
action problem. Expressions for these times are given below.
Fluid characteristic time
t
fluid
c
=
L
2
c
k
_
1
M
+
b
2
K
o
+
4
3
G
_
(2.24)
where L
c
is the characteristic length or dimension of the system, usually chosen
to be the smallest elements size to give conservative values, and G is the so-
called shear modulus of the material.
Mechanical characteristic time
t
mech
c
=
_
_
K +
4
3
G
_
L
c
(2.25)
CHAPTER 2. THE PHYSICAL AND MATHEMATICAL MODEL 20
where undrained bulk modulus is given by
K = K
o
+ b
2
M (2.26)
Actual diusion process within a system is governed by the ratio of diusivity
from mechanical and uid ow physics computed using above expressions. Relative
time scales may be estimated by considering the ratio of characteristic times for the
coupled and undrained processes. Assuming b = 1 we can write this ratio as follows,
t
f
c
t
m
c
=
M + K +
4G
3
L
c
(k/)
_
1
M
+
1
K +
4G
3
_
(2.27)
Again, G here is shear modulus. K
o
is drained bulk modulus and K is undrained
bulk modulus. Substituting common values in above equation results in a time ratio
of 10
8
L
c
for sandstone, 10
10
L
c
for limestone and 10
6
L
c
for clay.
Knowledge of characteristic time involved in a physical process can help us in
three ways:
1. guide us in choosing a suitable transient scale
2. guide us in choosing a suitable linear solver for individual processes
3. designing useful validation case studies for numerical experiments
In short, eciency of the code and its output can be optimized.
2.4 Porosity and Permeability Functions
Concept of True Porosity is presented in [33, 13] which also mentions its role in captur-
ing stress-sensitive character of the reservoir by incorporating stress dependent ow
properties in real-eld applications. Eqns. (2.28) and (2.29) gives a relation between
true porosity (based on a Lagrangian description with a deformable mesh congura-
tion) and reservoir porosity (based on a Eulerian description of the mesh conguration
which is xed in time) via volumetric strain present in the porous medium.
true
= 1 (1
0
) e
v
(2.28)
CHAPTER 2. THE PHYSICAL AND MATHEMATICAL MODEL 21
reservoir
=
0
+ (e
v
1) (2.29)
Permeability can be linked to porosity evolution in time using power law models
of the following form:
k
k
i
=
_
i
_
n
(2.30)
Here exponent n has been taken as 5.6 (experimentally veried for high-permeability
rocks [11]). In [11], interesting discussion is also given on computation of stress de-
pendent productivity index for real-eld scenarios.
2.5 Summary
Summarizing the complete discussion on mathematical model for coupled geomechan-
ical simulation we arrive at following set of equations (in integral form) to be subjected
to discretization techniques.
Fluid mass balance equation
_
c
t
p
t
d +
_
vd =
_
fd (2.31)
Darcys law
_
_
k
_
1
vd =
_
(p g) d (2.32)
Linear momentum balance equation
_
d+
_
gd = 0 (2.33)
Denitions, governing and constitutive equations together with appropriate bound-
ary conditions in the discretized system provide an equation set for which unique
CHAPTER 2. THE PHYSICAL AND MATHEMATICAL MODEL 22
solutions can be obtained for a large variety of coupled geomechanical problems. Pri-
mary unknowns of the system are v, p and u and their determination by numerical
nite element process is described in the next couple of chapters.
Chapter 3
Numerical Models Discretization
In Chapter 2 we described the mathematical model for coupled single-phase ow and
geomechanics. In this chapter we will develop numerical models that will enable us
to implement the mathematical model in a computer simulation code. This entails
a discussion on spatial and temporal discretization of the governing equations as the
rst step. Learning from our development using a nite volume approach (Appendix
B) we decided to study and investigate the mixed nite element space discretization
scheme for our prototypical coupled geomechanical simulator.
3.1 Motivation behind Mixed Finite Element Frame-
work
Main reason why one might not choose standard nite element techniques for dealing
with such problems is to avoid non-physical pressure oscillations. A more elaborate
reasoning can be given in terms of the invertibility of the matrix (pressure Schur
complement) encountered in solving ow problem for both velocity and pressure si-
multaneously.
The matrix system for a single-phase ow can be written as in eqn. (3.1).
_
A B
T
B C
_ _
v
p
_
=
_
f
g
_
(3.1)
23
CHAPTER 3. NUMERICAL MODELS DISCRETIZATION 24
where A and B
T
are integrals from Galerkin form of Darcys law linking velocity
unknowns to pressure unknowns. And B and C are Galerkin integrals from mass
balance or pressure equation. Diagonal block C is zero for incompressible uids and
system is indenite. Terms on right hand side are known sources/sinks of individual
equations and we solve for v and p vectors.
Individually, we can solve for velocity vector using the rst equation,
v = A
1
f A
1
B
T
p (3.2)
Substituting in the second equation and solving for the pressure unknowns gives,
BA
1
B
T
p = g BA
1
f (3.3)
Now, if the matrices come from a discretization where the velocity and the pressure
are approximated with the same type of elements, then the pressure Schur complement
BA
1
B
T
is singular and pressure oscillates [44] in the solution. Babuska-Brezzi,
or LBB, stability conditions address this very issue in the sense that they provide
guidelines for the approximation of the pressure and velocity unknowns in terms of
nite element shape functions. A mathematical convergence theory for mixed nite
element methods of the type discussed later in this chapter has been established using
the LBB conditions as key technical ingredient [30]. There is another reasoning given
behind the necessity of using mixed nite element especially when solving divergence-
free, (nearly) incompressible problems ( 0.5) which suer from the well-known
Mesh Locking phenomenon. In short,by using mixed elements we ensure that there
exist a unique solution to our problem depending continuously on the data. However,
there are other ways to satisfy/bypass the Babuska-Brezzi conditions such as penalty
method and the articial compressibility method [19, 44, 21].
Mixed elements for our ow problem, which resembles the Poissons equation,
satisfy the Babuska-Brezzi conditions with
W = H (div; ) (3.4)
= L
2
() (3.5)
CHAPTER 3. NUMERICAL MODELS DISCRETIZATION 25
where W and are suitable Hilbert spaces for v and p, respectively. In the case of
velocity spaces, we require continuity of the normal component of the velocity across
elements. One such popular element is the Raviart-Thomas element of order zero, in
which the x and y components of the velocity are linear functions on each element.
Pressure can be interpolated using a piecewise constant space.
Reiterating the fact that to simultaneously solve for uid velocity, uid pressure
and rock deformation over a single (structured/unstructured) grid under single-phase
compressible ow, variables of the ow sub-problem are spatially discretized using
mixed nite elements (Raviart-Thomas element of order zero) and appropriate shape
functions. Pressure is dened as a piecewise constant variable with local denition at
element centers and uid uxes are dened on the element faces (in three dimensional
elements) or element edges (in two dimensional elements, see Figure 3.2). This entails
use of special mapping and general numbering for the unknowns. Special mapping is
required because the isoparametric mapping does not preserve the continuity in the
normal direction and the mapped elements (from reference to global) do not reside in
H (div; ).
Variables in mechanical sub-problem are discretized using standard nite element
technique, which means displacements are nodal quantities with isoparametric map-
ping (basis function nodes are located at same place as geometric nodes having degree
of freedoms). Isoparametric mapping entails using same shape functions for interpo-
lating the unknown function over element and mapping the reference element to global
coordinates. In 2D each node is associated with two unknowns, that is, displacement
in x direction and displacement in y direction.
3.2 Spatial Discretization
Displacement of the solid skeleton, pore pressure and uid ux are taken as primary
unknowns of the model. Without going into details of the nite element method which
is described elsewhere [44], we can discretize the problem by introducing appropri-
ate shape functions for the pressure p, velocity v in mixed form and displacement u
variables in standard Galerkin nite element form. These three unknowns are inter-
polated using dierent interpolation functions, each suited to the individual needs of
CHAPTER 3. NUMERICAL MODELS DISCRETIZATION 26
Figure 3.1: Locations of the dierent unknowns (degrees of freedom) on triangles and
quadrilaterals
Figure 3.2: Sketch of the interpolation functions on triangles
the variables. The behavior of these interpolation functions is sketched in Figure 3.1.
The displacement interpolation function N
a
(x) attains a value of unity at node
a and zero at the remaining nodes. The velocity interpolation function
e
(x) is
designed to have a unit ux over edge e and zero uxes across remaining edges. Sim-
ilarly, for piecewise constant discontinuous pressure eld, the interpolation function
i
(x) takes a value of one over element i.
As can be seen from Figures 3.1 and 3.2, dierent variables are dened at dierent
locations as opposed to nite volume approach, where all the variables are basically
dened at volume center. This nite volume approach is not optimized in itself and
may lead to non-convergent solution. The mixed nite element approach is locally
CHAPTER 3. NUMERICAL MODELS DISCRETIZATION 27
mass conservative and capable of solving nearly incompressible uid ow problems.
There is a single computational grid discretizing the entire domain and it handles all
the variables at every time step for improved consistency.
The interpolation of each eld (velocity, pressure and displacement) is then given
by,
v =
nv
e=1
e
(x)V
e
(3.6)
p =
n
p
i=1
i
(x)P
i
(3.7)
u =
nu
a=1
N
a
(x)U
a
(3.8)
where V
e
, P
i
and U
a
are the individual degrees of freedom or unknowns. We note that
space of interpolation functions are dierent for velocity, pressure and displacement
unknowns.
Velocity approximation function v L
2
() H (div; ) (3.9a)
Velocity weighting function w L
2
() H (div; ) (3.9b)
where restricting the test functions w such that
w.n = 0 on
N
which also means w H
0,N
(div; )
N
denotes Neumann boundary (velocity or pressure gradient specied) and
D
denotes Dirichlet boundary. Similarly, for pressure and displacement we have,
Pressure approximation function p L
2
() (3.10a)
Pressure weighting function q L
2
() (3.10b)
CHAPTER 3. NUMERICAL MODELS DISCRETIZATION 28
Displacement approximation function u
_
H
1
()
_
2
(3.11a)
Displacement weighting function r
_
H
1
()
_
2
(3.11b)
Employing the Galerkin method, where the weighting functions are identical to
the trial functions, over the set of governing equations presented in Chapter 2 we
obtain following equations,
_
c
t
p
t
.qd +
_
vqd =
_
fqd, q L
2
() (3.12)
_
k
1
v wd
_
p wd =
_
D
pw nd, w H
0,N
(div; ) (3.13)
_
r. ( ) d +
_
r. (g)d = 0 (3.14a)
_
B
T
a
d
_
N
a
td
_
N
a
.gd = 0 (3.14b)
_
rs
N
a,s
d
_
N
a
rs
n
s
d
_
N
a
.gd = 0 (3.14c)
Eqn. (3.14c) is same equation as eqn. (3.14b) but written in indicial notation.
There, as per engineering notation, a sum over repeated indices is implied.
The discrete strain vector is expressed by
=
n
j=1
B
j
U
j
(3.15)
CHAPTER 3. NUMERICAL MODELS DISCRETIZATION 29
In eqn. (3.14b) and eqn. (3.15)
B
i
=
N
i,x
0
0 N
i,y
N
i,y
N
i,x
(3.16)
in plane stress and plane strain
1
.
At this point we remark on the characteristics of these equations as follows.
Fluid ow problem
Velocity is the primary unknown dened on edges and pressure unknowns
can be understood as Lagrange Multipliers (similar to v-p formulation [21])
Dirichlet boundary conditions (dening pressure values) become Neumann
boundary conditions. Element centered pressure values are extrapolated
to constant edge pressure values
Neumann boundary conditions (dening velocity or pressure gradient val-
ues) become Dirichlet boundary conditions
We assume that permeability (tensor) is non-zero here for its inverse to
be dened
Mechanical deformation problem
Nodal displacement are degree of freedom to be solved for.
This space discretization scheme results in a system of three discrete equations
corresponding to Darcys law, mass balance and linear momentum or force balance:
_
f
V
f
f
d +
_
j
c
t
i
dp
i
dt
d =
_
i
fd, i (1, n
e
) (3.17)
1
Plane stress and plane strain provides approximate model for analysis of specic body shapes
in 2D. Two-dimensional analysis for thin plate-like structures falls under plane stress and two-
dimensional analysis for bodies having the shape of a long prismatic cylinder, where loads are
uniformly distributed in the third dimension and act perpendicular to the cylinder, falls under plane
strain
CHAPTER 3. NUMERICAL MODELS DISCRETIZATION 30
_
k
1
f
V
f
f
d
_
i
P
i
i
d =
_
e
n pd, e (1, n
ed
)
(3.18)
n
b=1
B
T
a
DB
b
d U
b
N
a
td
_
N
a
gd = 0 i (1, n) (3.19)
Flow equations are part of the well-understood theory in reservoir simulation
community whereas geomechanical equations need some clarication at this stage.
In eqn. (3.19) for each a we have a vector equation with two components (in plane
stress/strain). The element matrix can be viewed as a block matrix with n
e
n
e
blocks
_
e
B
T
a
DB
b
d, a, b = 1, . . . , n
e
where n
e
is the number of nodes in the element.
The element vector can also be written in block form, with block number i taking the
form of the right-hand side in eqn. (3.19). A nice feature of this formulation is that
plane stress, plane strain, axisymmetric, and general three-dimensional problems can
straightforwardly be treated in a unied notation and implementation.
3.3 Temporal Discretization
In last section we presented the discrete form of the problem as a set of ODEs.
At this point, the only derivative appearing is that of time which require separate
discretization to convert the ODEs to a set of algebraic equations.
Time derivative of pressure is discretized in a central-dierence fashion common
in nite dierence scheme.
dp
dt
t
p
i
=
p
n+1
i
p
n
j
t
(3.20)
In eqn. (3.20) n denotes current level of time during simulation at which entire
degree of freedom vector is known and readily available for explicit use. n+1 denotes
next time level at which equations have to be solved for new degree of freedom vector.
CHAPTER 3. NUMERICAL MODELS DISCRETIZATION 31
Fully implicit scheme has been preferred over other possible options to solve the cou-
pled diusion-deformation problem to avoid time step constraints and inadmissibility
of displacement solutions under inelasticity (see Appendix A). However, to preserve
generality of the code, a parameter has been introduced in our discretization to
control the degree of implicitness granted to the solution scheme.
We will carry forward with our time discretization and present the residual and
tangent terms with coecient to solve for
_
v
n+
, p
n+
, u
n+
_
where
v
n+
= v
n+1
+ (1 ) v
n
(3.21)
and so on for pressure and displacements.
Time dependence in the coupled geomechanics arises from uid ow part or dif-
fusion of the pressure within the system. Problems in geomechanics may involve
time-dependent loadings, although the time scale is not suciently fast to require
inclusion of the acceleration term u
,tt
in the governing vector PDE (see Chapter 2).
That is, the term u
,tt
is much smaller in inuence than the inner stresses,
rs,s
, in the
body and therefore such problems are often referred to as quasi-static problems. This
feature of the mechanical model is encashed upon in implementation of the so-called
Iteratively Coupled Methods [33, 42] where a stationary elasticity problem is solved at
each time level and the boundary conditions may change from one time level to the
next.
Incorporating the time discrete form of the pressure derivative from eqn. (3.20)
we arrive at following residual equations.
Velocity or ux equation:
R
v
e
=
_
fl
g d +
_
e
e
p d
_
e
k
1
v d (3.22)
Pressure equation:
R
p
e
=
_
i
fd +
_
i
vd +
_
i
(
0
c)
t
pd +
_
i
(
o
b)
t
vol
d (3.23)
CHAPTER 3. NUMERICAL MODELS DISCRETIZATION 32
Displacement equation:
R
u
e
=
o
t
e
N
a
gd +
_
e
t
N
u
td
_
e
B
T
a
d
(3.24)
These equations are nonlinear as coecients depend on the value of degrees of free-
dom.
3.4 Linearization
After discretization of the variables, next step is linearization of the non-linear equa-
tions so as to apply Newtons iterative scheme over this linear system to solve for
change in variables at every time step. Our strategy here will be rst to look at
the general structure of the linearized system and its compatibility with the iterative
solver and then we will present and explain expressions specic to our development
which is subsequently inserted into the linear system.
The linear system is comprised of a tangent matrix S also called as Jacobian
matrix, a right hand side residual vector R and a vector of unknowns or degree of
freedom vector X. Denoting the tangent matrix components as S
ij
, residual vector
components as R
i
and unknown vector terms as P
j
we have following system to
submit to our non-linear solver:
S X = R (3.25)
where individual components of the tangent matrix is given as
S
(k)
ij
=
R
n+1,k
i
X
j
(3.26)
The linear system is solved at every time step using Newton
Ss iterative scheme.
The scheme applies correction vectors V, P and U to make the right hand side
term or residual vector zero. Jacobian or tangent matrix has an interesting block
structure e.g. S
pu
and S
up
are blocks present due to coupling between mechanical
deformation and mass balance equations. The complete tangent matrix can be made
CHAPTER 3. NUMERICAL MODELS DISCRETIZATION 33
symmetric positive denite under linear elasticity or small deformation paradigm.
Iterative solver involves the services of a linear solver which can be chosen from
a list of possible options (e.g. Conjugate Gradient, GMRES, BiConjugate Gradient
etc.) albeit restricted by the symmetry and positive deniteness of the tangent matrix.
Since convergence of a non-linear solver depends on its linear solver in an iterative
scheme we certainly need to pay close attention to the details of the linear solver in
any simulation development exercise. Also, depending on the condition number of the
tangent matrix, we may need to apply the services of some suitable preconditioners
for faster convergence of the non-linear solver. We utilize the coupling inherent in the
linear system to help us divide the problem in blocks or modules which are addressed
relatively independently from each other before being assembled for solution.
Expanding the linear system, that is, tangent matrix and residual vector is nec-
essary to explain the reasoning behind our approach and to appreciate its benets in
capturing the embedded physics of coupled processes in a geomechanical simulation.
Linearized matrix-vector system submitted to solver can be expressed in following
manner (eqn. (3.27)),
S
vv
S
vp
0
S
pv
S
pp
S
pu
0 S
up
S
uu
(k)
V
n+1
P
n+1
U
n+1
(k)
=
R
v
R
p
R
u
(k)
(3.27)
One obvious aspect of Jacobian matrix is that it is block-structured in appearance
and it exhibits the coupling between dierent physical processes in terms of separate
blocks e.g. S
pu
and S
up
captures the coupling between uid mass balance equation
and Darcy s law. Consequently each block can be computed separately and almost
independently in its own integrand function before being assembled into one big ma-
trix at element level and later at global level. Block-structure matrices not only ease
the storage requirements, they provide an essential ordering structure to the degree
of freedom vector which should not be compromised even if it means that a block ma-
trix can not be subjected to Gaussian Elimination procedure for code testing purposes
[23].
Now let us look at the expressions for block terms of tangent matrix for an arbi-
trary element in our grid. We suggest the reader to refer to eqns. (3.22) to (3.24) for
CHAPTER 3. NUMERICAL MODELS DISCRETIZATION 34
derivation of the terms given in eqns. (3.28) to (3.34).
Velocity or ux equation:
S
vv
e
=
_
e
k
1
l
d (3.28)
S
vp
e
=
_
e
e
j
d (3.29)
Pressure equation:
S
pv
e
=
_
i
l
d (3.30)
S
pp
e
=
1
t
_
i
(
0
c)
j
d (3.31)
S
pu
ib
=
1
t
_
0
bN
T
b
d (3.32)
Displacement equation:
S
up
aj
=
1
t
_
e
N
a
o
b
j
d (3.33)
S
uu
ab
=
o
t
_
e
B
T
a
CB
b
d (3.34)
At convergence the solution vector is updated by the vector of change in variables
i.e. x or X and the loop continues till it reaches the end of simulation time.
3.5 Conditioning of Tangent Matrix
As can be observed from eqn. (3.1), the structure of the tangent matrix for ow equa-
tions (mass balance and Darcys law) is such that it has rst diagonal block with
permeability and viscosity appearing as coecient and second diagonal block with
total compressibility appearing as coecient. When we solve real eld cases over
CHAPTER 3. NUMERICAL MODELS DISCRETIZATION 35
the geomechanical simulator (fully coupled or iteratively coupled) and assemble this
matrix for our linear system, it turns out to be highly ill-conditioned because the diag-
onal terms dier in large orders of magnitude. In SI unit system, block corresponding
to Darcys law is of the order of 10
12
and block corresponding to accumulation term
from mass balance equation is of the order of 10
10
, whereas o-diagonals are usually
of the order of 10
3
leading to very high condition number of the matrix and an
ill-posed problem for the linear solver.
To address this problem we compute a multiplication factor t
c
for the mass balance
equation (incorporating Darcys law into it) shown in eqn. (3.35)
c
t
p
t
D
+
_
/
t
c
(p g)
_
= f t
c
(3.35)
where
p
t
=
1
tc
p
t
D
This factor t
c
which can be computed (eqn. (3.36)) such that both accumulation
term and the permeability term are similar in order of magnitude to improve matrix
conditioning as well as to simplify specifying simulation time in data deck. The unit
of time can now be in days even if rest all input parameters are in SI units (in SI unit,
if we do not scale our problem, we need to take time in seconds which is cumbersome
for practical eld simulations).
t
c
=
_
t
kc
t
(3.36)
where t is the time step in simulator in original SI units. If we take t = 86400
seconds which is 1 day we obtain t
c
10
10
as our scaling factor.
3.6 Summary
Mixed nite element discretization scheme was applied for uid pressure and uxes to
address issues of stability and local mass conservation in space. Implicit integration
was inarguably the method of choice for time discretization to avoid the time step
constraints
2
. In the next chapter on coupling strategies, we have investigated fully
2
Also, to ensure admissibility of the deformation in plastic domain implicit time integration is
mandatory as highlighted in Appendix A.
CHAPTER 3. NUMERICAL MODELS DISCRETIZATION 36
coupled as well as iteratively coupled solution schemes, considering the substantial
impact it can have on the cost and eciency of the simulator.
Chapter 4
Coupling Strategies
In the last chapter we applied discretization techniques over our mathematical model
and came up with the matrix-vector system to solve for primary unknowns of the
system. The next logical step is implementing this numerical model into a reservoir
simulator code to test and validate its applicability and analyze the results obtained
subsequently. However, as we have pointed out in the introductory sections, the two
processes of uid ow and mechanical deformation in the reservoir are governed by
separate physical phenomena which are coupled to each other over the domain [25]
and the degree of coupling depends on the particular scenario or case, thus necessi-
tating judgmental input from the model user. Therefore, it becomes of paramount
importance to us to address the issue of coupling, as applied to simulator development,
with its possible impact on numerical eciency of the code. In this chapter we will
expand our discussion on various types of coupling, their subtleties and dierentiating
nature and their role in designing the ow chart and algorithm for simulator develop-
ment. We will end the chapter with a clear understanding of our approach selected to
represent this important aspect and it will lead us straight into the implementation
phase of this research.
4.1 Denition of Coupling
Many times the physical description of the problem-setting suces to convey the
meaning of a coupled problem. In this context we can refer to the denition of a
37
CHAPTER 4. COUPLING STRATEGIES 38
coupled problem and mixed formulation for their solution[43].
Coupled formulations are those applicable to multiple domains and depen-
dent variables which usually (but not always) describe dierent physical
phenomena and in which
neither domain can be solved separately from the other
neither set of dependent variables can be explicitly eliminated (at
PDE level).
Mixed formulation are those applicable to a single domain in which equa-
tions and boundary conditions describing the physical phenomenon and
used for the numerical solution contain a number of dependent variables
which could by reduced by elimination, still maintaining a soluble prob-
lem.
We should also note in conjunction with these denitions that a coupled prob-
lem can turn into an uncoupled problem under certain circumstances. For example,
steady state thermal stress (or poromechanical stress) are generally uncoupled as
the temperature (or pressure distribution) can be independently determined from
the deformation (and stress) elds. Same argument can be extended towards mixed
methods and we can state that in separate domains of a coupled problem both mixed
and irreducible (antonym of mixed) forms can occur.
4.2 Levels of Coupling
One of the pioneering works on summarizing the dierent levels of coupling in a
coupled geomechanical simulation is by [34, 17, 40] published recently. Here, we will
discuss those concepts briey and review their applicability in relation to our work.
Following the notation of [34] the linear system for single-phase geomechanical
simulation in Newton-Raphson method can be written as in eqn. (4.1).
_
K L
L
T
E
_
(k)
_
u
p
_
(k+1)
=
_
R
s
R
f
_
(k)
(4.1)
CHAPTER 4. COUPLING STRATEGIES 39
where K is the classical stiness matrix, E is the ow matrix, L is the coupling matrix
for ow unknowns in the force balance equations and L
T
is the coupling matrix due
to displacement unknowns within the ow equations. Complete matrix is evaluated
at current time level k to solve for u and p, that is, variations in displacement and
pressure unknowns respectively, which is evaluated at next time level k+1. Explicitly
these variations are given as u
k+1
= u
k+1
u
k
and p
k+1
= p
k+1
p
k
Occupying the right hand side, R
s
and R
f
are residual of solid force balance and
uid ow equations which are evaluated at current time level k. Coupling matrices
are transpose of each other but also opposite in sign. To provide symmetry to the
system we multiply the ow equation by -1 to obtain following system,
_
K L
L
T
E
_
(k)
_
u
p
_
(k+1)
=
_
R
s
R
f
_
(k)
(4.2)
Using the notation of [5], E = TD, where T is the symmetric transmissibility
matrix, D is the accumulation (block diagonal) matrix, and R
f
= Q Tp
k
is the
mass balance residual with Q denoting the vector of well (source/sinks as boundary
conditions) terms.
At this point we can make use of the system described in eqn. (4.2) to review
dierent types of coupling methods.
1. Decoupled
2. Explicitly Coupled
3. Iteratively Coupled
4. Fully Coupled
Decoupled: If we consider the ow part of problem separate from the mechanical
part and solve two linear systems, sequentially, instead of one system then it is
called a decoupled method. The only way ow part is aware of mechanical state
of the system is to incorporate new or updated porosity and/or permeability
into the ow equations. These ow properties are computed explicitly using
converged displacement values of last time step in mechanical domain. And the
CHAPTER 4. COUPLING STRATEGIES 40
only way mechanical part is aware of the existence of the ow in the reservoir
is via pressure loads applied on nodes of mechanical grid as boundary terms.
These nodal pressures are computed using the cell center pressures of the grid
used in ow part. Mathematically, when we consider only ow sub-problem we
are interested in solving eqn. (4.3),
(TD) p
k+1
= R
f
= QTp
k
(4.3)
under the assumption of constant stress. Similarly, when we assume pressures
do not change in momentum balance equation as part of the unknowns, we
successfully decouple this part to arrive at classical elasticity equations,
Ku
k+1
= R
s
Lp
k+1
(4.4)
Here pressure, known from the converged solution of ow system at last time
step is applied as external load. Decoupled methods attempt to simulate the
geomechanical behavior of the reservoir in two ways:
By allowing a variable rock compressibility in the ow equations (computed
using deformation analysis in mechanical part for specic and expected
containment type in the reservoir). This amounts to modifying D block
matrix in ow system and no explicit stress computation is necessary. How-
ever, we can compute zero-dimensional (scalar) average measures of stress
level from average pressures (assuming zero lateral strain) as in eqn. (4.6)
and incorporate it in our decoupled ow equation to improve the accuracy.
Modied ow system then appears as in eqn. (4.5).
(TD) p
k+1
= QTp
k
+L
T
u
avg
k+1
(4.5)
havg
= b
_
1 2
1
_
p
avg
(4.6)
havg
is average stress in horizontal direction.
Compute stresses based on the pressure solution of ow part for entire
CHAPTER 4. COUPLING STRATEGIES 41
simulation period. This amounts to almost no coupling or minimal cou-
pling (if we allow recomputation and updation of ow properties, that is,
porosity and permeability based on their relationships with eective stress,
at specied time steps).
Explicitly Coupled: This type of coupling is achieved by lagging the coupling
blocks one time step behind. As an example, if we have pressure values from
the last ow solution we advance the mechanical system using eqn. (4.7).
Ku
k+1
= R
s
Lp
k+1
(4.7)
And then we advance our ow sub-problem as given by eqn. (4.8), however L
T
here is not exactly implemented because the ow discretization (usually nite-
dierence) might not conform to mechanical discretization (nite-element). In-
stead, as mentioned in case of decoupled method above, porosity and perme-
ability are explicitly computed as functions of eective stress to preserve some
degree of coupling in transmissibility matrix and also accumulation matrix.
(TD) p
k+1
= QTp
k
+L
T
u
k
(4.8)
One such implementation of explicit coupling is in the 3D mixed nite element
black-oil reservoir simulator by Minko [29]. In that simulator, solid mechanics
code is provided by Sandia National Laboratory.
Iteratively Coupled: The iterative method proceeds by solving the sequence of
ow part and mechanical part a number of times, per time step to achieve
desired degree of convergence in solutions. In this way, it becomes a subset of
fully coupled method (discussed next) (which always converges, theoretically, by
simultaneous solve of complete system eqns. (4.2)) and a superset of explicitly
coupled scheme discussed in last item. Under iterative scheme the solution
approaches the problem according to eqns. (4.9),
(TD) p
k+1,+1
= QTp
k
+L
T
u
k+1,
(4.9a)
CHAPTER 4. COUPLING STRATEGIES 42
Ku
k+1,+1
= R
s
Lp
k+1,+1
(4.9b)
here refers to iteration number at new time step k + 1 and usually it is
choosed to minimize the computational cost. As can be noticed, mechanical
system uses the latest solution of pressure eld from p
k+1,+1
of ow system.
At convergence, p
= p
k+1
and u
= u
k+1
and the solution is identical to
fully coupled system. As pointed out under explicitly coupled scheme, coupling
block L
T
in eqn. (4.9a) is implemented by making porosity a function of pressure
and mean stress (or some suitable stress invariant such as I
1
) and by making
permeability/trasmissibility a function stress (explicitly T = T
k
or implicitly
T = T
)
Fully Coupled: This approach tackles the complete system (eqns. (4.2)) at once
in a Newtons iterative scheme and therefore is computationally expensive es-
pecially for larger grids. Fully coupled methods are most benecial if single
computational grid is employed to discretize both ow and mechanical parts.
Fully coupled system has unconditional convergence property for implicit time
integration and provides internal consistency in coding and analyzing the re-
sults.
When the sub-problems are discretized on dierent grids using dierent methods
then the individual simulators transfer their solutions, or functions thereof, to each
other in a black-box fashion. Porosity (and/or permeabilities) computed from stress
solutions are transferred to a ow-only simulator and stress simulator computes in
situ stress changes and rock displacements using the nodal loads from pressure. At
every time step iterations are performed between the uid ow simulator and the
geomechanical simulator to ensure accuracy of pore volume changes (and/or perme-
ability). One shortcoming pointed out with regard to this coupling approach is its
incapability to deal with negative compressibility scenarios when rock dilates during
shearing under excessive pressure drop [20].
CHAPTER 4. COUPLING STRATEGIES 43
4.3 Iteratively Coupled Methods
In last section we described dierent types and degree of coupling outlined in the liter-
ature. Benets and shortcomings of each one of them has also been briey reviewed.
At this point, we are ready to present and discuss the iteratively coupled method
proposed in this work. Although we have implemented and analyzed the results from
both fully coupled and iteratively coupled schemes, our objective remains to inves-
tigate and implement an iteratively coupled scheme which is stable, convergent and
computationally less expensive than the fully coupled approach. we will see next,
and in later chapters too, that it is the stability that is more dicult to ensure for an
iterative scheme than the economy of the computation.
Iteratively coupled schemes are characterized by dividing the complete problem
in subproblems and then solve each of the sub-problem sequentially while ensuring
full convergence of the solution at every time step. The iteratively coupled analysis
decomposes the coupled system of equations into two subsystems of equations that
correspond to the governing equations of the ow simulator and geomechanics model
through a data exchange interface. Our approach is based on a single discretized grid
for numerical solution of the sub-problems.
Mathematically, a staggered scheme or iteratively coupled scheme can be expressed
by modifying our linear system presented in Chapter 3, by making the contributions
from coupling blocks zero.
S
vv
S
vp
0
S
pv
S
pp
0
0 0 S
uu
(k)
V
n+1
P
n+1
U
n+1
(k)
=
R
v
R
p
R
u
(k)
(4.10)
This basically means to solve eqn. 4.11 and eqn. 4.12 sequentially. The order of
solving these two systems can have some impact on the eciency and convergence of
the code but some coupled problems, however, in our case the order did not produce
any large impact.
[S
uu
]
(k)
_
U
n+1
_
(k)
= {R
u
}
(k)
(4.11)
CHAPTER 4. COUPLING STRATEGIES 44
_
S
vv
S
vp
S
pv
S
pp
_
(k)
_
V
n+1
P
n+1
_
(k)
=
_
R
v
R
p
_
(k)
(4.12)
Now, under iteratively coupled schemes the traditional approach has been that of
drained split where pressure is frozen during the mechanical solve and solid congu-
ration is frozen during the ow part of the problem. Although this might appear the
immediate choice it is not the natural choice or the most stable choice. Undrained
split or the split in which uid mass content is frozen during the mechanical solve is
actually a scheme which is unconditionally stable in its implementation [18, 31, 43].
In next section we describe these two types of iteratively coupled method.
4.4 Variants of Iterative Coupling
For every time step there are more than one outer iterations (each outer iteration
involves one solve of ow sub-problem and one solve of mechanical sub-problem). Sub-
problems solve themselves using Newton
fl
gd +
_
e
.
e
pd
_
e
k
1
vd (4.13)
S
vv
e
=
_
e
k
1
l
d (4.14)
S
vp
e
=
_
e
.
e
j
d (4.15)
Pressure equation:
R
p
e
=
_
i
fd +
_
i
.vd +
_
i
_
1
M
_
t
pd +
_
i
(b)
t
v
d (4.16)
S
pv
e
=
_
i
.
l
d (4.17)
S
pp
e
=
1
t
_
i
_
1
M
_
j
d (4.18)
Displacement equation:
CHAPTER 4. COUPLING STRATEGIES 46
set m = 0
U
(k)
, P
(k)
U
(k+1)
, P
undrained U
(k+1)
, P
(k+1)
fix U = U
(k+1)
U
(k+1)
, P
(k+1)
fluid does not escape and P
undrained
is computed locally
Figure 4.2: Undrained Split
R
u
e
=
1
t
e
N
a
gd +
_
e
t
N
u
td
_
e
B
T
a
d
(4.19)
S
uu
ab
=
1
t
_
e
B
T
a
CB
b
d (4.20)
=
o
tr 1 + 2 b (p p
o
) 1 (4.21)
4.4.2 Undrained Split
The other option for iterative coupling is that of undrained split where uid mass
content is frozen instead of uid pressure, which means uid is not allowed to leave
or enter into the system when its conguration is changing under the applied load.
This has a direct consequence on the pressure which is allowed to vary during the
undrained split, in such a way that uid mass is preserved intact. Of course, during
the ow solve when solid conguration is xed, uid mass content varies as governed
by the mass balance equation. This is similar to adiabatic/isentropic split in thermo-
mechanical problems [36, 32]. Many authors and researchers have looked at this
particular scheme in the past e.g. [31, 3, 4, 43]. This scheme can graphically be
illustrated as in Figure 4.2.
It is a novel idea as it combines the staggeredness or sequential advancement of the
solution of the complete problem with the unconditional stability of the fully coupled-
fully implicit approach. However, the extra benet of unconditional stability (that is,
possibility of simulating by large time steps) comes at the cost of quasi-incompressible
behavior induced into the system because when deformation is being generated within
CHAPTER 4. COUPLING STRATEGIES 47
the system, at the time of mechanical phase, the uid mass content is xed (hence
called undrained) and this causes pressure build-up in the region. System stiness
is increased (as expected on account of preserving the mass and adding the extra
force on the soil skeleton to enforce no-ow condition over the entire system during
the deformation phase) leading to additional nonlinear iterations. In the next phase
when ow sub-problem is tackled, uid is allowed to ow in and out of the system
letting the excess pressure to dissipate.
Implementing undrained split results in modication of the tangent matrix and
residual vector in mechanical problem. Suciently accurate predictors are supplied
to the problem at every time step for pressure, displacement and uxes. Below we
look at the specic forms of the residual and Jacobian blocks from displacement
equation (pressure and velocity terms are same as given above for drained split) for
any arbitrary element:
Displacement equation:
R
u
e
=
1
t
e
N
a
gd +
_
e
t
N
u
td
_
e
B
T
a
d +
_
e
B
T
a
1bpd +
_
e
B
T
a
b
2
M11
t
d
(4.22)
S
uu
ab
=
1
t
_
e
B
T
a
_
C+ b
2
M11
t
_
B
b
d (4.23)
= tr 1 + 2 bM
_
m
f
o
_
1 (4.24)
= tr1 + 2 (4.25)
4.5 Fully Coupled vs. Iteratively Coupled
At convergence we expect same results from iteratively coupled (both drained and
undrained splits) and fully coupled approaches, at least theoretically, because itera-
tively coupled scheme is nothing but a modied Newtons scheme where the Jacobian
CHAPTER 4. COUPLING STRATEGIES 48
matrix is not in its exact form hence convergence is no longer quadratic. However,
iteratively coupled approach has numerical eciency and benet in terms of the size
of the linear system to be solved (iteratively coupled scheme entails solving of the
ow problem rst, which involves tightly coupled uxes and pressures, and subse-
quently solving for loosely coupled displacement eld in mechanical phase. This is in
contrast to fully coupled methods handling of a large system of uxes, pressure and
displacement simultaneously). It oers exibility and modularity to the code as the
two subproblems can be solved using two dierent linear solvers now depending on
the requirement of each subproblem.
Fully coupled method is most robust in a sense that it requires all the equations
being set up in one Jacobian matrix, therefore more consistent at every solve of
the system. The degree of coupling between the mechanical phase and ow phase
(which is determined by the reservoir types and its exploitation history) can guide
us which method to choose from iteratively coupled and fully coupled approaches
because poor choice can result in iteratively coupled scheme consuming unwarranted
nonlinear iterations to achieve convergence between the two subproblems and hence
failing its very purpose. Other issues pointed out with iteratively coupled methods
are with respect to stability and uniqueness of the solution, especially observed for
tightly coupled problems.
4.6 Summary
Geomechanical simulation involves dealing with physically coupled processes of uid
ow and solid deformation. Physical couplings have been subdivided as coupling
throughout the domain and coupling at an interface. Our case falls under the former
type of coupling. It requires an integrated treatment of coupled elds and concurrent
computation of response variables to honor the dynamic interactions between the
elds. In this chapter we have motivated the need to implement both fully coupled
and iteratively coupled schemes of solution and next chapter is precisely devoted to
address this need.
Chapter 5
Implementation in Dipack
In last three chapters we have described the mathematical model with its discretiza-
tion and we have also selected our choice of coupling strategy to solve the geomechan-
ical problem. In this Chapter we intend to provide the implementation details of the
simulator developed as part of this research. Our objective is to explain the funda-
mental as well as non-standard features of our implementation without resorting to
rigorous discourses on coding and debugging principles followed, which is elaborated
in Appendix C of this report.
5.1 Brief Introduction on Dipack
Dipack is a C++ programming environment suitable for simulator development in
an object-oriented framework using nite element, nite volume or nite dierence
schemes [28]. The development environment of Dipack provides access to a large
suite of data structures and routines which can be smoothly applied in application
codes written in C++ for building simulator based on numerical solution of PDEs.
It oers vast set of reusable libraries to code and control nite element discretization
schemes, grid and data structures and degree of freedom vector manipulations. The
software package is maintained and licensed by inuTech (Innovative Numerical Tech-
nologies), a German consulting company oering software and consulting services in
49
CHAPTER 5. IMPLEMENTATION IN DIFFPACK 50
the mathematical and engineering area
1
.
5.2 Distinctive Features of the Simulator
We will focus on particular features of our implementation, some of which are standard
and worth discussion on account of their importance and some are non-standard
features which needs to be highlighted. In the following list of items, we will revisit
many of the concepts outlined and proposed in previous chapters such as those on
discretization and coupling strategies.
5.2.1 Discretization
Mixed nite element grid with hybrid discretization of ow variables is a non-standard
feature for a reservoir simulator. We can explain this feature in light of Raviart-
Thomas element of order zero that we have used in our discretization to approximate
H(div; ) spaces. Pressure and velocity are discontinuous across elements, however,
normal component of velocity vector is continuous across elements to ensure mass
conservation at local level. These elements are identied by following interpolation
functions:
e
=
_
a + dx
b + dy
_
(5.1)
The constants a, b, c and d are determined such that
e
n
f
=
1, if i = j;
0, if i = j.
(5.2)
where
e
are the basis functions and n
f
are the normal vectors associated with the
sides e and f, respectively. This provides a global denition of the element. There are
three basis function nodes and three geometric nodes which are located at dierent
positions in the element. For a RT
0
triangular elements we can derive the three basis
1
inuTech develops and markets the Dipack Product Line for numerical modeling and simulation
and works closely together with its partner Simula Research Laboratory with respect to Dipack
development.
CHAPTER 5. IMPLEMENTATION IN DIFFPACK 51
functions by applying eqns. (5.1)-(5.2) to the reference element geometry. In (
1
,
2
)
co-ordinates,
1
(
1
,
2
) =
1
, (5.3a)
2
(
1
,
2
) =
2
1
, (5.3b)
3
(
1
,
2
) = 1
1
, (5.3c)
1
(
1
,
2
) = 1
2
, (5.4a)
2
(
1
,
2
) =
2
2
, (5.4b)
3
(
1
,
2
) =
2
. (5.4c)
are element basis functions in
1
and
2
directions, respectively.
Similarly, we have co-ordinates of basis function nodes as
q
1
= (1/2, 0) , (5.5a)
q
2
= (1/2, 1/2) , (5.5b)
q
3
= (0, 1/2) . (5.5c)
And the expression for interpolating vector velocity eld using these basis func-
tions in a RT
0
element is given by,
v =
e
V
e
e
v is the approximation of exact velocity vector, as we explained in Chapter 3 on
discretization using Galerkin methods.
Dipack not only provides element denitions for vector elements such as RT
0
(which is not the same as for vector elements composed of scalar components as in
case of displacement-only discretization in elasticity problems), it also provides the
necessary mapping between the reference element and the global element to ensure
CHAPTER 5. IMPLEMENTATION IN DIFFPACK 52
eqn. (5.2) and continuity in normal direction. Dipack implements the following
mapping for velocity basis functions,
(x) =
1
det B
e
.
ref
_
M
1
e
(x)
_
(5.6)
based on the ane geometric mapping expression of
x = M
e
() = x
e
+B
e
.
This mapping is called special mapping as opposed to general isoparametric map-
ping used for displacement unknowns where the nodal degree of freedom is a vector
quantity and basis function is a scalar. This implementation is reected in evaluation
of basis function components and its derivative at a given basis function node, in a
given co-ordinate direction.
Another aspect of our discretization is that since we have more than one unknown
(displacement components) per node, we need to treat the interaction between the
displacement vector eld and the unknowns in the linear system carefully. The degree
of freedom vector is composed of velocity unknowns in x direction then pressure
unknowns and then displacement elds x and y component. Arrangement of the
variation vector in Newtons method for fully coupled approach is as follows,
x = {v
x1
, v
x2
, . . . , p
1
, p
2
, . . . , u
x1
, u
y1
, u
x2
, u
y2
, . . .}
T
In iteratively coupled approach as there are two linear systems corresponding
to ow subproblem and mechanical subproblem, we have two variation vectors, one
comprising of velocity and pressure and the other, only mechanical displacement.
Specics of the numbering followed in this arrangement is given later as one of features
of implementation.
5.2.2 Levels of Implicitness
This refers to the dierent levels of implicitness in time integration of our simulator
equations. We have mentioned in Section 3.3 about the role of parameter in our
discretized equations. Its sole purpose is to control the degree of implicitness in our
CHAPTER 5. IMPLEMENTATION IN DIFFPACK 53
Table 5.1: Levels of implicitness in time domain
Method
0 Forward Euler; Explicit
0.5 Crank-Nicolson; Mid-point rule
1 Backward Euler; Fully Implicit
solution scheme. Table 5.1 gives the three major varieties of solution methods in time
domain based on -rule.
Since is a user supplied input in the data deck, it can be varied to observe its
inuence on the eciency and stability of the code.
5.2.3 Levels of Coupling
Chapter 4 described the dierent types of coupling strategies with regard to solving a
coupled geomechanical and ow problem. It also highlighted drained and undrained
splits as variants of our approach in implementing iteratively coupled scheme.
Fully coupled scheme is implemented in standard fashion and derives straight
from the developed system of equations in Chapter 3. What needs to be mentioned,
however, is utilization of blocky structure of the Jacobian matrix S for assembling the
linear system. We dene and prepare each block separately, almost independent from
each other. This is a classic example of data structure abstraction and inheritance
that Dipack is capable of providing for our implementation.
Regarding iteratively coupled methods, we implement them separately in a dier-
ent simulator than the one designed for fully coupled scheme. This allowed us rig-
orous testing and investigation of each simulator independently and also diminished
the amount of debugging code generated in each case. Iteratively coupled simulator
is implemented as shown in Figure 5.1.
Under iteratively coupled approach we divide the complete problem in two sepa-
rate parts and solve them sequentially while ensuring convergence of the nal solution
at every time step. As depicted below in Figure 5.1, for every time step few Gauss-
Seidel iterations are performed over the sub-problems to get a converged solution.
CHAPTER 5. IMPLEMENTATION IN DIFFPACK 54
New time step
GaussSeidel iteration
Mechanics
Flow
Converged ?
No
Yes
Figure 5.1: Flow chart of iteratively coupled scheme of solution
5.2.4 Boundary Conditions
Boundary conditions in a nite element simulator are of two types, either natural
or essential conditions. The former type of conditions involve integrals along (part
of) the boundary, whereas essential conditions involve manipulation of linear systems
and specication of nodal values. Implementation of the boundary conditions requires
knowledge of two things:
1. the sides of an element that are subjected to a certain type of natural conditions,
and
2. the nodes in the mesh that are subjected to a particular type of essential con-
dition.
CHAPTER 5. IMPLEMENTATION IN DIFFPACK 55
Boundary information in Dipack is represented by the concept of boundary in-
dicators. A set of q binary-valued binary indicators is introduced, their values being
on or o. These q boundary indicators are dened at all the nodes in the mesh, with
values that can vary among the nodes. For example, at one node, boundary indicators
1, 2, and q can be on, the others being o, whereas at another node, only indicators
1 and q 1 can be on. If boundary indicator i is on at a node, we say that the node
is marked with indicator i.
A boundary indicators is associated with a particular boundary condition. Below
we consider examples for Dirichlet and Neumann conditions:
Essential Condition : As an example, indicator 1 can be used to mark nodes sub-
jected to a homogeneous Dirichlet condition u = 0. At the point where this
boundary condition is being applied in Dipack implementation, we simply scan
all the nodes and check if a node is marked with boundary indicator 1, using a
boolean function available as member of grid object. If so, special actions are
taken to assign the essential condition at that node(s).
Natural Condition : To implement a natural condition we check if a side in an
element has a boundary indicator We dene a side in an element as marked
with a certain boundary indicator if all nodes on that sides are marked with the
particular indicator. Scanning is provided by a boolean function member of the
specic nite element.
When boundary indicators are not dened explicitly, Dipack make use of its
default indicators which are dened for each side of domain. However, for complicated
and hybridized boundary conditions we need to redene this set of default indicators
using the functionality provided by the grid object. We can also extend the boundary
indicators to cover larger domain (new nodes) and we can add dierent material
types (having dierent physical properties or constants) to generate and manipulate
the custom grid, all using the grid functionalities.
Traction-free boundaries appear as natural boundary conditions in the present
problem. Essential boundary conditions (v
i
and/or p and/or u
j
known at a node) are
incorporated in the matrix system by substituting the equation corresponding to the
actual degree of freedom by the boundary condition. While doing so, we attempt to
CHAPTER 5. IMPLEMENTATION IN DIFFPACK 56
preserve the symmetry of matrix S. The surface integral over is implemented for
normal tractions only, however, is extensible to incorporate inclined traction vectors.
5.2.5 Initialization
Initialization is a necessary step in solving an initial-boundary value problem such
as diusion. An initial state on the eld concerned should be determined before
the transient process is analyzed. In our case we need to initialize the data elds
corresponding to pressure, velocity and displacement and by initialization here we
primarily mean setting values of unknown degrees of freedom at time zero, that is,
before starting the simulation. Pressure initialization is commonly performed by
following gravity-capillary equilibrium principles in most of the reservoir simulators.
This routine takes datum pressure and depth, inclination or tilt of the grid as input to
compute pressure in each element of the grid. Capillary eects are absent in single-
phase ow. Displacement eld is initialized from initial (total or eective) stress
eld supplied as part of the input data. This initial stress could be overburden or
lateral conning or both and is used in static analysis to determine initial strain and
displacement eld. Besides initialization at simulation time zero there is another
initialization required for Gauss-Seidel like schemes which are referred to as predictor
values in many literature. This can be computed as some kind of average of data
elds at last two time steps or some other ingenuous method can be applied for faster
convergence of Gauss-Seidel (outer iterations) loop [43, 26].
We have implemented functionality for setting initial condition as soon as the
time loop begins in the simulator. To provide generality to the code, initialization is
performed using eld variables instead of scalar values for every degree of freedom.
Input format of these eld variables is also exible, we can set the format to either a
function, a le or constant values. Function format grants highest degree of generality
by providing member functions evaluated at every spatial point of the grid. File
format allows input of the entire initial eld in terms of a Dipack readable le.
Constant values assign xed numeric values to initialize the eld, usually applied for
material constants.
CHAPTER 5. IMPLEMENTATION IN DIFFPACK 57
5.2.6 Numbering of Unknowns
An important aspect of assembly of the linear system, following discretization, is
related to the numbering scheme used for various degrees of freedom. It can be
classied as either a general numbering scheme or a special numbering scheme. Mixed
nite element discretization results in a system of linear algebraic equations and the
book-keeping of element degrees of freedom with respect to linear system degrees of
freedom is non-trivial. In other words, we need to pay close attention to the numbering
system used to build vector of unknowns both on element level as well as on global
level. There are two numbering systems in use:
1. General Numbering
2. Special Numbering
General Numbering : Let us denote n as the number of nodes in the element and m
as number of unknown scalar elds (e.g. two components of displacement vector
eld in x and y, for a 2D analysis). Then the strategy for general numbering,
at the element level, is as follows:
u
1
1
, u
1
2
, . . . , u
1
n
, u
2
1
, . . . , u
2
n
, . . . u
m
1
, . . . , u
m
n
(5.7)
Here u denotes element degrees of freedom. Superscript and subscript refers to
eld number and node number respectively. This can be generalized for cases
where number of nodes vary from eld to eld e.g.
u
1
1
, u
1
2
, . . . , u
1
n
1
, u
2
1
, . . . , u
2
n
2
, . . . u
m
1
, . . . , u
m
nm
(5.8)
where we have n
j
degrees of freedom for eld number j. Now the global number-
ing based on this local numbering scheme is constructed from a simple algorithm
that results in a reasonable small bandwidth: for each element we run through
each local degree of freedom and increase the corresponding global number by
one, provided the local degree of freedom has not been given a global number
in a previously visited element.
CHAPTER 5. IMPLEMENTATION IN DIFFPACK 58
Special Numbering : Special numbering follows the same rule or structure at ele-
ment level and global level. Assuming isoparametric mapping and denoting total
number of nodes by n and total number of unknowns by m we have following
strategy for numbering the degrees of freedom of linear system:
u
1
1
, u
2
1
, . . . , u
m
1
, u
1
2
, . . . , u
m
2
, . . . u
1
n
, . . . , u
m
n
(5.9)
where u
j
i
is the degree of freedom of scalar eld number j at node i. Given a
global node i and a scalar eld number j, the global degree of freedom number
is m(i 1) + j.
We use general numbering for velocity degrees of freedom and special numbering
for displacement degrees of freedom, which helps to optimize the Jacobian bandwidth
while preserving the block structure of our matrix.
5.2.7 Adaptive Time Stepping
In many physical problems it is of interest to follow a rapidly changing event (such as
a sudden drop in pressure due to opening of well) by a much slower one (such as post
opening deformation or consolidation analysis). Each of these require a dierent time
step length to produce economic computation. While such time steps can be entered
into the computation a priori (separate computation of characteristics times for uid
diusion and mechanical deformation, for each specic problem) it is desirable to
incorporate into the programs an automatic, self-adaptive, procedure which adjusts
the time step so as to achieve computational eciency without sacricing accuracy.
More work is now in progress in this important area but some possibilities and their
application have been already discussed and implemented (e.g. time stepping criterion
based on maximum change in average displacement or pressure per element). In this
work we have incorporated adaptive time stepping based on number of nonlinear
(Newton) iterations.
For following problems,
Problems with non-equilibrium initial conditions (e.g. initial stress boundary
conditions are not in equilibrium with initial displacement eld, pressure eld
and/or ow eld.)
CHAPTER 5. IMPLEMENTATION IN DIFFPACK 59
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05
1
0.5
0
0.5
1
1.5
2
Time
O
b
s
e
r
v
a
t
i
o
n
N
o
d
e
P
r
e
s
s
u
r
e
Figure 5.2: Adaptive time stepping - capturing pressure transient
Highly sti problems, low uid compressibility, quasi-static mechanical problem
coupled to transient ow problem
Problems having small characteristic time
one perhaps needs to adapt the time marching scheme in such a way so that the
short duration transients are captured in the solution. Below is an illustration of
this exible time stepping where single stepping has been used in the beginning when
most of the transient is expected and based on the convergence status of the linear
solver, it is decided if time step need to be decreased or increased or single stepping
has to be stopped in favor of full solve if time step can not be cut below a minimum
threshold.
Dipack also has a simpler way of controlling the time step size during run-time
via a input string in the data deck for the time integration parameters. This string
can be made suciently complicated to apply variable time steps, though, it is not
CHAPTER 5. IMPLEMENTATION IN DIFFPACK 60
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05
9
8
7
6
5
4
3
2
1
x 10
3
O
b
s
e
r
v
a
t
i
o
n
N
o
d
e
V
e
r
t
i
c
a
l
D
i
s
p
l
a
c
e
m
e
n
t
Time
Figure 5.3: Adaptive time stepping - capturing displacement transient
CHAPTER 5. IMPLEMENTATION IN DIFFPACK 61
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0.18
0.2
Simulation Time t
T
i
m
e
S
t
e
p
C
o
m
p
u
t
e
d
(
d
t
)
Figure 5.4: Adaptive Time Stepping - Linear Evolution of t in Accordance with
Transient
CHAPTER 5. IMPLEMENTATION IN DIFFPACK 62
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35
10
5
10
4
10
3
10
2
10
1
10
0
Simulation Time t
T
i
m
e
S
t
e
p
C
o
m
p
u
t
e
d
(
d
t
)
Figure 5.5: Adaptive time stepping - logarithmic evolution of t in accordance with
transient
CHAPTER 5. IMPLEMENTATION IN DIFFPACK 63
precisely an adaptive technique as such for obvious reasons.
5.2.8 Variable Coecients
Spatially varying or heterogeneous coecient (such as permeability, compressibility,
porosity, Youngs modulus, Poissons ratio etc.) are implemented in Dipack with
large amount of exibility with a range of formats and assignment possibilities such
as,
1. a constant
2. an explicit formula realized as functions or objects
3. piecewise constant eld over material subdomains
4. a nite element or nite dierence eld on le (compatible to Dipack)
We can also have vector coecients (useful in case of anisotropic quantities such
as permeability).
5.2.9 Stress Computation
Other feature of interest is computation of stresses (and dierent types of scalar
equivalent stress measures) from the displacement eld. Having computed the latter,
the stress tensor eld can be computed using Hookes law. Since the stresses are linear
combinations of the derivatives of the displacement components, the computed stress
tensor eld will be discontinuous over the element boundaries whereas we would like
to have a continuous stress led (until unless the elastic constant E and themselves
are discontinuous) so as to plot and analyze it. We have two possible choices, not
exactly supplementary though.
1. Smooth out the stress eld to remove undesired discontinuities and plot the
stress eld map. We use such maps to visualize the eect of high shear or
normal stress on the alterations in ow properties (e.g. permeability) in the
eld. Objective here remains to optimally smooth the discontinuities arising
from the nite element interpolation functions, but keep the discontinuities due
to layered media (having dierent elastic constant).
CHAPTER 5. IMPLEMENTATION IN DIFFPACK 64
2. Compute equivalent measures of stress levels and/or stress invariants from the
stress tensor. Plotting stress invariants (deviatoric vs. isotropic or hydrostatic)
in stress space (see Appendix A) helps in analyzing the critical failure status of
a material. Besides, such smooth scalar measures are easier to interpret than
tensor elds. We will look at one such measure of equivalent stress implemented
in our simulator and called von Mises stress. In terms of stress tensor this
equivalent stress m reads,
m=
_
3
2
rs
rs
(5.10)
where
rs
is the stress deviator given as,
rs
rs
1
3
kk
rs
(5.11)
5.2.10 Linear Solver
Iterative solver has its own class, functions, properties and routines as we will see
in Appendix C. Iterative coupling between ow sub-problem and mechanical sub-
problem is achieved through a redesign of the simulator code provided in last sec-
tion under fully coupled simulator. We use conjugate gradient method (and similar
methods of Krylov subspace family) to solve our linear system in fully coupled im-
plementation. For iteratively coupled implementation, however, we have the option
of choosing two dierent linear solvers for the two dierent sub-problems so as to
optimize the performance of each sub-system.
Our discretization results in a symmetric systems of algebraic equations. Krylov
subspace methods take advantage of this symmetry in the sense that iterations become
inexpensive in terms of computational cost and storage requirements. The framework
from which the implementations of Krylov methods are derived takes care of the
allocation and initialization of the residual vectors needed by the given combination
of a linear system and a linear solver. Implementation also includes the exibility to
apply preconditioners over the residual vectors
2
.
As pointed out, for problems where the coecient matrix (Jacobian in Newtons
2
usually, Krylov iterations recursively update the residual vector, however, a subset of this family
of methods work on preconditioned residual s
= M
1
(b Ax
) = M
1
r
and 90
2. 0.01 90
3. 0.001 90
4. 0.0001 90
Permeability field
East
N
o
r
t
h
0.0 30.000
0.0
30.000
1.000
10.000
100.000
1000 mD
Figure 6.24: Example 3 - Permeability eld
CHAPTER 6. REPRESENTATIVE NUMERICAL SIMULATIONS 93
0 0.5 1
0
0.5
1
8
6
4
2
0
2
4
6
8
Figure 6.25: Example 3 - Pressure eld
CHAPTER 6. REPRESENTATIVE NUMERICAL SIMULATIONS 94
0 1
0
1
Figure 6.26: Example 3 - Streamline eld
CHAPTER 6. REPRESENTATIVE NUMERICAL SIMULATIONS 95
0 0.2 0.4 0.6 0.8 1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
x
z
von Mises Equivalent Stress map on deformed grid
2
4
6
8
10
12
14
16
Figure 6.27: Example 3 - Equivalent stress eld
the choice of equivalent stress, it broadly depends upon the choice of the user and the
simulator is capable of reporting the scalar stress levels in the eld in terms of stress
invariants I
1
and
J
2
or mean stress measures.
6.3.3 MandelCryer Eect
One of the characteristic of any multi-dimensional geomechanical simulator is its
ability to capture the so-called Mandel-Cryer eect. such eects are present due
to non-zero Poissons ratio or multi-dimensional strain (lateral strain generated as
a result of longitudinal strains in the system). As soon as depletion begins in the
system, load bearing capacity of the bulk system (solid with uid) is reduced resulting
in additional load being transferred to adjacent solid grains. This phenomenon leads
to a squeezing eect farther away from point of depletion and enhanced total stress,
also called redistribution of total stress, hence increased pore pressure which lasts
temporarily and shows up as a hump in pressure prole (Figure 6.28).
In Figure 6.28 we also notice that a ow-only simulation can be carried out using
a coupled geomechanical simulator if we specify the system to be incompressible (or
Poissons ratio = 0.5).
CHAPTER 6. REPRESENTATIVE NUMERICAL SIMULATIONS 96
0 2 4 6 8 10
0
1
2
3
4
5
6
7
Time(x1E3)
P
r
e
s
s
u
r
e
Drained Split (Explicit)
Drained Split (Converged)
No geomechanics or uncoupled case
Drained Split (Incompressible case)
Wells (injectorproducer pair)
opened
No wells
MandelCryer effect
Figure 6.28: Example 3 - Mandel-Cryer Eect
CHAPTER 6. REPRESENTATIVE NUMERICAL SIMULATIONS 97
6.3.4 Observations
As we have mentioned in Chapter 1 while introducing iteratively coupled and fully
coupled numerical schemes of solution, at convergence all numerical methods yield
the same nal solution and that was observed for the heterogeneous case presented
above which was actually run on both fully coupled and iteratively coupled simulators.
Run-time of iteratively coupled simulator was at least ve times smaller than that
of fully coupled simulator for this example case. It highlights the potential benets
associated with the undrained split iteratively coupled method over other coupling
methods. Results (Figure 6.25, Figure 6.26, Figure 6.27) obtained from both fully
coupled and iteratively coupled schemes were exactly same at convergence.
6.4 Example 4: Big Field Case
Here we look at the fully coupled simulation results for a slightly larger grid. Purpose
of this simulation was to test the performance of the code on a larger system, that is,
a system with more degrees of freedom than encountered in previous examples. Also,
it simulates realistic eld scenarios with complicated geology and layered material
properties. All parameters have been chosen to mimic real eld values and simulation
was carried out for 20 days with a constant time step of 1 day.
6.4.1 Model Description
Problem setting has been sketched in Figure 6.29. Permeability eld is heterogeneous
and plotted in Figure 6.30. This is a larger grid with number of elements = 1250
and simulations run on this grid have eld scale parameters and units. Dimension
of the grid is [0, 3000] [0, 800] in meters. Wells have multi-block completions with
injector having a xed BHP (bottom hole pressure) control and producer having a
xed rate control. Injector is injecting in 10 blocks near bottom whereas producer
is producing from 5 blocks in the middle of the reservoir. Simulation results for
interpolated pressure eld, interpolated streamline eld and equivalent stress eld
are displayed in Figure 6.31, Figure 6.32 and Figure 6.33, respectively.
CHAPTER 6. REPRESENTATIVE NUMERICAL SIMULATIONS 98
Figure 6.29: Example 4 - Big Field problem setting with original undeformed grid
Permeability field
Horizontal
V
e
r
t
i
c
a
l
0 3000m
0
800m
1.000
10.000
100.000
1000.00
Figure 6.30: Example 4 - Big Fields permeability map
CHAPTER 6. REPRESENTATIVE NUMERICAL SIMULATIONS 99
Table 6.5: Example 4 - Input parameters for Big Field simulation
Parameter Value
Top depth (m) 3000
Top pressure (MPa) 10000
Eective porosity 0.25
Initial stress
0
(MPa) 10000
Overburden stress (MPa) 10000
Youngs modulus E (MPa) 10000
Poissons ratio 0.35
Biot modulus M (MPa) 10000
Biots coecient 0.9
Elasticity type Plane Strain
Fluid viscosity (Pa/sec) 0.01
Fluid compressibility c
t
0.001
Total density (gm/cc) 2.2
Fluid density
f
(gm/cc) 0.8
Grid inclination 90
J
2
) to analyze material failure given a failure envelope.
We have not modeled failure of the material in our geomechanical simulator at
this point therefore we do not see failure envelope in Figure 6.46.
CHAPTER 6. REPRESENTATIVE NUMERICAL SIMULATIONS 109
Horizontal displacement field
units: meter
100
90
80
70
60
50
40
30
20
10
0
500
1000
1500
2000
2500
3000
0
100
200
300
400
500
600
700
800
0
20
40
60
80
100
120
Figure 6.40: Example 6 - Rened Grid models horizontal displacement eld
CHAPTER 6. REPRESENTATIVE NUMERICAL SIMULATIONS 110
Vertical displacement field
units: meter
0
-50
-100
-150
-200
-250
0
500
1000
1500
2000
2500
3000
0
100
200
300
400
500
600
700
800
-300
-250
-200
-150
-100
-50
0
Figure 6.41: Example 6 - Rened Grid models vertical displacement eld
CHAPTER 6. REPRESENTATIVE NUMERICAL SIMULATIONS 111
0 1500 3000
0
400
800
Horizontal distance (m)
V
e
r
t
i
c
a
l
d
i
s
t
a
n
c
e
(
m
)
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
x 10
7
Injector (fixed BHP)
Producer (fixed rate)
Pressure (N/m
2
)
Figure 6.42: Example 6 - Rened Grid models pressure eld
0 3000
0
800
Horizontal distance (m)
V
e
r
t
i
c
a
l
d
i
s
t
a
n
c
e
(
m
)
Injector
Producer
Figure 6.43: Example 6 - Rened Grid models streamline eld
CHAPTER 6. REPRESENTATIVE NUMERICAL SIMULATIONS 112
0 100 200 300 400 500 600 700 800
250
200
150
100
50
0
50
100
150
200
250
Depth (m)
D
i
s
p
l
a
c
e
m
e
n
t
(
m
)
Vertical displacement
Magnitude of total displacement vector
Crosssection at x= 100m
Figure 6.44: Example 6 - Rened Grid models displacement prole at x = 100m
0 100 200 300 400 500 600 700 800
3000
2000
1000
0
1000
2000
3000
Depth (m)
S
t
r
e
s
s
o
r
P
r
e
s
s
u
r
e
(
p
s
i
)
von Mises Stress
Invariant I
1
Invariant sqrt(J
2
)
Pressure
Crosssection at x = 100 m
Figure 6.45: Example 6 - Rened Grid models stress and pressure prole at x =
100m
CHAPTER 6. REPRESENTATIVE NUMERICAL SIMULATIONS 113
3000 2500 2000 1500 1000 500
40
60
80
100
120
140
160
180
200
220
Isotropic stress (Invariant I
1
), psia
D
e
v
i
a
t
o
r
i
c
s
t
r
e
s
s
(
I
n
v
a
r
i
a
n
t
J
2
)
,
p
s
i
a
Evolution in time of the stress state at observation node
Figure 6.46: Example 6 - Stress space for the observation node in Rened Grid model
CHAPTER 6. REPRESENTATIVE NUMERICAL SIMULATIONS 114
0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01
0
1
2
3
4
5
6
7
8
Time
P
r
e
s
s
u
r
e
Evolution of pressure at observation node
(=0.15, b=0.7)
(=0.25, b=0.7)
(=0.45, b=0.7)
(=0.35, b=0.9)
(=0.499, b=0.9)
(=0.499, b=0.3)
No Geomechanics
Figure 6.47: Example 7 - Eect of and b
6.6.3 Observations
Rening has increased the number of elements to 3600 which adds signicant com-
putational cost over smaller models as each element carries more than one degree of
freedom. Run-time on standard machine varied between 20 hours to 1 day.
6.7 Example 7: Sensitivity on Poissons ratio and
Biots coecient
A set of simulations have been run with varying and b to understand their inuence
on the geomechanical results.
6.7.1 Results
We will only look at the evolution of pressure at observation node in following picture
(Figure 6.47).
CHAPTER 6. REPRESENTATIVE NUMERICAL SIMULATIONS 115
6.7.2 Observations
Broadly, we can conclude that Poissons ratio aect the degree of hump observed in
pressure (explained earlier under section on Mandel-Cryer Eect), higher is the ratio,
lower is the hump because compressibility drops with . An incompressible system is
poor in communicating strain observed in one dimension to other dimensions which
is actually the source of this pressure hump.
Another point worth looking at is the initial build-up in pressure before wells are
opened up. In this interval there are no wells in the eld and boundaries are no-ow
type even then we observe the pressure build-up. The reason is equilibrium forces due
to gravity on the initial pressure eld. If we initialize our pressure eld according to
gravity equilibrium before starting the simulation then we will not observe the build-
up. Initialization of pressure, velocity and displacement has been implemented in the
code however initialization by simulator is also an option which not only provides a
validation of the initialization routine it also helps in achieving complex equilibrium
beyond the capabilities of explicit initialization. Another way to initialize has been
to introduce a dummy well in the system to achieve stress boundaries-pore pressure-
gravity equilibrium however that may warrant careful tracking of uid mass-in-place
as the dummy well might produce some uids during such initialization [1].
6.8 Example 8: Unstructured Grid
An example case was simulated using an unstructured grid (generated using GEOM-
PACK [22]) for the boundary conditions similar to Example 5 (constant BHP injector
and constant rate producer in a eld with overburden stress and laterally conned
sides).
6.8.1 Model Description
Problem setting is sketched in Figure 6.48. Model was simulated for 10 days only
with following set of input parameters as given in Table 6.8.
CHAPTER 6. REPRESENTATIVE NUMERICAL SIMULATIONS 116
Horizontal distance (m)
V
e
r
t
i
c
a
l
d
i
s
t
a
n
c
e
(
m
)
Material type 1
Material type 2
Overburden Stress
Figure 6.48: Example 8 - Unstructured grids problem setting
CHAPTER 6. REPRESENTATIVE NUMERICAL SIMULATIONS 117
Table 6.8: Example 8 - Input parameters for Unstructured Grid eld simulation
Parameter Value
Number of elements 500
Top depth (m) 3000
Top pressure (MPa) 10000
Eective porosity 0.25
Initial stress
0
(MPa) 10000
Overburden stress (MPa) 10000
Youngs modulus E (MPa) 10000
Poissons ratio 0.35
Biot modulus M (MPa) 10000
Biots coecient 0.9
Elasticity type Plane Strain
Fluid viscosity (Pa/sec) 0.01
Fluid compressibility c
t
0.01
Total density (gm/cc) 2.2
Fluid density
f
(gm/cc) 0.8
Grid inclination 90
J
2
) on y-axis and
hydrostatic or isotropic stress (I
1
) on x-axis as shown in Figure A.1.
Essential component of a stress space is the failure envelope of the material type
subjected to loading/unloading conditions. We can see from the adjacent gure (Fig-
ure A.1) that as uid pressure is changing in the eld and eective stresses are in-
creasing, the material points or grid blocks also deforms in response to these stresses,
primarily due to shear or deviatoric component of the stress tensor. The failure en-
velope denes the admissible region in stress space for the deforming media. When
the material point has experienced so much shear as to reach the failure cap, it fails
plastically without further increase in stress (under hardening or softening stress may
still increase or decrease in plastic domain).
A.2 Geomechanical Simulation
To investigate the behavior of a system under simple loading and depletion condition
we designed a two dimensional Black-Oil data set over a quarter to ve spot water
ood in Eclipse (Figure A.2). Eclipse outputs eective stresses and principal stresses
under geomechanical simulation mode. We computed two sets of stress invariants I
1
APPENDIX A. PLASTICITY COMPUTATIONS 129
failure envelope
elastic domain
initial state
final state
inadmissible
trial state
I
1
J
2
return map
Total strain = Elastic strain + Plastic strain
Figure A.1: Stress space
and J
2
from two separate eective stress tensors - one directly output by Eclipse and
another computed out of principal stresses in our code. There were slight dierences
between these two eective stresses and so the stress invariants were also dierent.
Stress invariants are plotted over the stress space for every grid block of the sim-
ulation grid at every time step, to see the evolution of deformation in the porous
media under pre-specied stress boundary conditions. We can notice that almost all
the blocks move towards the failure cap which is a straight line of constant cohesive
strength and angle of friction in this hypothetical case. This behavior is anticipated
under the existing depletion and loading scenario. However what is not acceptable
is the points lying outside and beyond the failure region (Figure A.3) at late times
when system has undergone plastic deformation.
A.3 Return Map Algorithm
Main message being conveyed here is that to preserve admissibility of the solution-set
in plastic domain, one has to employ to specic techniques which ensure that points
lying outside the envelope are brought back onto the envelope. One such technique is
Return Map Algorithm. Detailed discussion on Returned Map Algorithm is beyond
the context of this report.
APPENDIX A. PLASTICITY COMPUTATIONS 130
Z Axis
X Axis
Injector
Y Axis
Producer
-0.01320 -0.00227 0.00866 0.01959
Vertical Rock Displacement, ft
-0.02412
Figure A.2: Eclipse output - pressure map at end of simulation
3000 2500 2000 1500 1000 500 0 500 1000 1500
0
50
100
150
200
250
300
350
400
450
500
Isotropic stress (Invariant I
1
), psia
D
e
v
i
a
t
o
r
i
c
s
t
r
e
s
s
(
I
n
v
a
r
i
a
n
t
J
2
)
,
p
s
i
a
Evolution in time of the
stress state of all the cells
Failure envelope
Figure A.3: Visualizing the state of stress for the entire eld in stress space
APPENDIX A. PLASTICITY COMPUTATIONS 131
A.4 Implicit Time Integration
Explicit solutions suer from instability and oscillations during transients in the sys-
tem if time step chosen for integration is above a constraint which is usually too small
to be practical. Therefore, we vouch for implicit integration in time to avoid such
constraints and also to ensure admissible solutions in inelastic domain.
Appendix B
Finite Volume Framework
After investigating the behavior and features of commercial simulators we decided to
develop our own coupled geomechanical simulator, especially oriented towards imple-
menting new solution strategies and related research. With respect to simulation and
modeling, main issues that still confront us are the coupling and discretization strate-
gies. Geomechanics is based on the solution of a coupled problem of uid and solid
interactions. And the degree of coupling granted to the solution scheme inuences
the cost and stability of the solution provided. Discretization becomes important on
account of dissimilar nature of the variables involved in the simulation which has a
bearing on the overall accuracy and stability of the scheme. To solve ow problem,
our rst choice was nite volume method for space discretization of dierent variables
as this method not only ensures stability and local mass conservation on an element
by element basis, it is also cheap in computational resources when compared to its
counterpart in nite element family of methods e.g. mixed nite element. Another
great advantage in the direction of nite volume method was that of straightforward
handling of dierent types of variables that we are dealing with in coupled geome-
chanical simulation i.e. pore pressure, phase saturations, and uid uxes. Pressure
and saturation are situated at volume center whereas uxes are dened on the edges
of a two dimensional CV (control volume) and faces of a three dimensional CV.
132
APPENDIX B. FINITE VOLUME FRAMEWORK 133
B.1 Mathematical Formulation
We consider only ow part of the complete geomechanical problem. Mass balance
equation over a representative element volume (control volume) is given by:
c
t
p
t
+ F = f
source
(B.1)
where c
t
is total system compressibility, F is uid volumetric ux and f
source
is the
source term in the equation.
F
t
n =
_
k
1
(p g)
_
t
n (B.2)
In integral form the same equation can be written as following:
_
V
I
c
t
p
I
t
dV +
nface
F=1
_
V
IF
F
t
.nd=
_
V
I
f
source
dV (B.3)
where nface denotes number of faces of the control volume over which volume (or
mass in case of varying uid density) integration is performed. Following gure helps
in visualizing the ow dened over control volumes.
Now the next step is to discretize the system (and the governing partial dierential
equation) and linearize it to yield the solve the problem via Newtons method. Hence
we compute residual vector and tangent matrix to prepare the system Ax= b for a
linear solver.
R
I
=
_
V
I
c
t
p
I
t
dV +
nface
F=1
_
V
IF
F
t
.nd
_
V
I
f
source
dV (B.4)
S
IJ
=
R
I
P
J
(B.5)
S
IJ
=
_
V
I
c
t
1
t
IJ
dV
nface
F=1
_
V
IF
1
k
1
IF
.
1
L
IF
.d
.
FJ
(B.6)
APPENDIX B. FINITE VOLUME FRAMEWORK 134
Figure B.1: Finite volume grid
APPENDIX B. FINITE VOLUME FRAMEWORK 135
Integrands function, which is the kernel of the simulator design, is completely
based on the form of this residual and tangent blocks, computed over each volume
or face. There are two types of integrands - face integrands and volume integrands
corresponding to the ux term and the accumulation term in the partial dierential
equation. Flux integration is performed for every face in the grid, separately for
interior volume faces and boundary faces. Then accumulation terms are computed
for every nite volume once. This sequence is repeated over the grid to build up
the complete residual vector and tangent matrix, as dened above under Newtons
iterative scheme of solving a nonlinear problem.
B.2 Implementation Details
Single phase porous media ow for compressible uids was modeled and implemented
in C++ using Dipack libraries. The ow chart of the program is very simple:
1. Read input le
(a) Read grid le for dimensions, grid properties
(b) Read uid properties and solution time domain
(c) Read linear solver type and parameters
2. Start simulation or time loop
(a) apply initial conditions for unknowns (pressures)
(b) solve at a given time step
i. apply essential boundary conditions for unknowns
ii. initial guess for Newton method is taken from previous solution set
iii. make (assemble) the linear system Ax = b with essential boundary
conditions imposed over it
A. integrate in space for elemental A and b
iv. solve the linear system using conjugate gradient
v. check for convergence of the solution and loop for few nonlinear iter-
ations every time step. Move to new time step on convergence
APPENDIX B. FINITE VOLUME FRAMEWORK 136
Figure B.2: Pressure map from the nite volume simulator
3. Print output les. This involves generating ASCII output les for pressure data
over the eld in a format suitable to read and plot using other plotting softwares.
B.3 Numerical Experiments
Results from a test case has been plotted below to validate the nite volume imple-
mentation for a single phase ow simulator. This is a case of homogeneous 21 21
grid with an injector in the middle of the grid and four producers on four corners of
this box shaped grid. All wells are constant pressure wells and it is a no-ow boundary
reservoir. Steady state pressure map solution is shown below:
B.4 Observations
Finite volume framework was the rst choice to develop our in-house coupled geo-
mechanical simulator. It oers some obvious benets not matched by any other
APPENDIX B. FINITE VOLUME FRAMEWORK 137
discretization technique being considered during or research such as inherent local
mass conservation and stability of solution provided at a lower cost, straightforward
extension to multiphase transport through saturation unknowns and incorporation
of nonlinearities from relative permeabilities. However, on account of some software
issues, later we switched to mixed nite element approach which has been described
in next chapter.
Appendix C
Relevant Dipack Routines
Dipack implementation proceeds in a logical and object-oriented fashion and it ben-
ets hugely from its emphasis on application of abstract data types [24, 23]. In
Dipack most of the functionalities are grouped in class hierarchies which have the
common feature of existence of an associated parameter class. We can summarize
the process of constructing a typical nite element solver or simulator in Dipack
to understand the specics of our implementation. The simulator is realized as a
class. Standard nite element algorithms can be inherited by having class FEM as
base class. For mixed nite element framework we have to inherit from class MxFEM
which is recognized as child of FEM. It is then necessary for the simulator class to
implement the viral function integrands for dening the integrands in the integrals
of the nite element equations after discretization of mathematical model. Class FEM
(and consequently MxFEM) is derived from SimCase, which allows multiple loops and
handling of numerical experiments through the nu system.
The data structures in a nite element solver are typically a grid (derived from
class GridFE), a nite element eld over the grid (derived from class FieldFE for
a scalar eld or FieldsFE for a vector eld such as displacement, velocity), an in-
terface to linear systems and linear solvers (derived from LinEqAdmFE), a mapping
between the eld representation and the linear system representation of the primary
unknown(s) (derived from class DegFreeFE), and perhaps some problem-dependent
constants and functions (like in our case heterogeneous permeability and porosity
eld, initial pressure and stress eld etc. They require additional data structures
138
APPENDIX C. RELEVANT DIFFPACK ROUTINES 139
derived from FieldFE or just a global function). The relations between a solver, its
base classes, and its internal data structures are shown in Figure C.1.
The standard member functions in a simulator are
adm for administering the menu system,
define for dening the items on the menu,
scan for reading input data from the menu system and initializing the internal
objects (grid, elds, etc.),
integrands (ElmMatVec, FiniteElement) for dening the integrands of the
element-level nite element conditions,
fillEssBC for marking essential boundary conditions
solveProblem for the main program ow of the solver,
resultReport for writing results.
Other routines employed in our code, though optional, are
calcElmMatVec for computing the element matrix and vector (normally, this
function will call the corresponding default version in class FEM and just do
some additional task, like debug output or surface integrals),
integrands4side for dening the integrands corresponding to boundary inte-
grals in the weak formulation,
saveResults for storing results on le,
solveAtThisTimeStep for advancing the solution one time step in time-dependent
problems
makeAndSolveLinearSystem for dening and solving the linear system in iter-
ation methods for nonlinear algebraic equations
In what follows, we look at some important classes and functionalities provided
by Dipack.
APPENDIX C. RELEVANT DIFFPACK ROUTINES 140
SimCase
FEM, MxFEM
Simulator Class
LinEqAdmFE
DegFreeFE,
BasisFuncGrid
GridFE
FieldFE,
FieldsFE
Figure C.1: A sketch of simulator class, its base classes and internal objects. A solid
line indicates class derivation (is-a relationship), whereas dashed lines represent a
pointer/handle (has-a relationship).
APPENDIX C. RELEVANT DIFFPACK ROUTINES 141
C.1 Fully Coupled Simulator
To implement fully coupled geomechanical simulator we basically need to solve the
linear system developed as a result of numerical discretization of the model equations
(Chapter 3). We design the program ow chart to highlight the data structures and
functionality we need in our simulator class. We look at the possibilities of inheritance
and abstraction made available to us by Dipack. Then we declare and dene our
class as a child to two parent classes - mixed nite element method (MxFEM) and
nonlinear equation solver (NonLinEqSolverUDC) to inherit the functionality required
to dene and populate a mixed nite element framework having data elds, geometric
grid, basis function grid with capabilities to operate on them to solve the nonlinear
system of tangent matrix and residual vector while marching ahead in time.
C.2 Iteratively Coupled Simulator
Implementation of iterative coupling or operator-splitting technique is slightly com-
plicated. It is implemented by extending the data structures to include a manager
class which manages calls to FlowS sub-problem and MomentumS sub-problem at every
time step. All three are dierent classes. They are connected to each other but only
through manager class which also connects to a fourth class named CommonRel (see
Figure C.2) storing all the functions and parameters common to both ow and me-
chanical subclasses.
C.3 Important Class Denitions
Although the simulator uses a large number of classes and data types and the detailed
structure tree of the Dipack is substantially huge to present, looking at following
classes suces the purpose. We can gain some outlook towards basic understanding
of the simulator besides acknowledging a few points unique to it.
ElmDef : Denition of the reference element is provided by subclasses of this par-
ent class which denes all the elements. In other words, objects of subclasses
APPENDIX C. RELEVANT DIFFPACK ROUTINES 142
Momentum
MomentumS
FlowS
Flow
Manager
CommonRel
Figure C.2: Class structure for iteratively coupled simulator. Relation between solver
classes and the pool of common relations in the simulator for coupled uid ow and
geomechanics is shown with solid arrows indicating inheritance (is-a relationship)
and dashed arrows indicating pointers (has-a relationship).
APPENDIX C. RELEVANT DIFFPACK ROUTINES 143
inherited from this class provide local denition of the basis functions used in
interpolation
FieldFE and FieldsFE : They contain a grid with nodal eld values and built-in
evaluation at arbitrary spatial points.
FiniteElement : It is designed to oer easy access to the global element i.e. the
basis functions, their global derivatives and the Jacobi determinant (here one
has to be pay attention to the convexity of the element geometry within the
grid), evaluated at a point in the reference domain
r
(corresponding to a
physical point x in
e
). Class FiniteElement is naturally based on a layered
design where it gains its information from instance of classes BasisFuncGrid,
ElmDef, BasisFuncAtPt, and GridFE. In the case of a mixed nite element one
needs a FiniteElement object for each type of basis functions. This is provided
by the class MxFiniteElement, which contains an array of pointers (handles) to
FiniteElement objects and much of the same interface as class FiniteElement.
Scalar nite element elds are represented by FieldFE and rely on information
from FiniteElement, BasisFuncGrid, and GridFE objects. FieldFE objects
are designed to represent the solution eld and can be evaluated and dierentiate
(FieldFEAtItgPt) at arbitrary points.
GridFE : An important class as it may sound, stores/exchanges information on the
elements, in particular the geometry nodes, their connectivity, and boundary
indicators (for imposing essential boundary conditions). Similarly, class Bas-
isFuncGrid contains the basis function nodes, their connectivity, the boundary
indicators at basis function nodes, etc. Class BasisFuncGrid keeps a handle to
GridFE object as it needs complete information of all the geometry and basis
function nodes and their associated data. Together, GridFE and BasisFunc-
Grid classes organize the global topology of the geometry and basis function
information as may be required in specic discretization schemes.
BasisFuncGrid : Actually to understand the dierence in implementation of a mixed
element and standard nite element discretization, one needs to pay attention
to the properties and characteristics of the BasisFuncGrid. This class simply
APPENDIX C. RELEVANT DIFFPACK ROUTINES 144
uses GridFE object for looking up basis function nodes and degrees of freedom in
scalar elds (e.g. pressure), in case of isoparametric mapping used by standard
nite elements and hence BasisFuncGrids presence is not felt at all in such
type of elements. However, if non-parametric elements are employed in the
discretization then we need to allocate and initialize a BasisFuncGrid explicitly
for each scalar eld (components of velocity vector in our case).
LinEqAdmFE : This deals with the linear system information only.
DegFreeFE : It acts as the link between grid/eld objects and linear system objects
by exchanging information on ordering of unknowns.
FieldsFEatItgPt : The class oers representation of derivatives of nite element
elds, computed at optimal (or nodal) locations in each element. The locations
are dictated by an ElmItgRules object, which means that the points must
coincide with those of a supported integration rule. Usually, the class is used to
sample derivatives of nite element elds at the reduced Gauss points. The class
is integrated with class FEM for computing smooth elds based on the scattered
point values in each element.
Finite volume implementation in Dipack uses following important classes:
FieldFV : This class implements a scalar eld suited for nite volume and dierence
methods. It accesses GridFV objects to retrieve information on grid geometry,
basis function nodes and interpolation functions. It also has an array containing
the point values at the grid points.
GridFV : This is the counterpart of GridFE class created for nite volume methodol-
ogy. As expected, it provides functionality and data structures to store, operate
and exchange information on geometric setting, physical mapping and connec-
tivity to degree of freedoms.
C.4 Important Functionalities
These matrix-vector components are computed at element level within appropriate
functions (over domain) which are then subjected to essential boundary conditions.
APPENDIX C. RELEVANT DIFFPACK ROUTINES 145
For boundary conditions applied over multiple elements (e.g. lateral traction on sides
of the grid) integrands4side() functions computes the additional contribution at
element level which then updates the residual. Assembly of the element matrix-vector
terms within the global counterparts A and b or S and R are performed by Dipacks
in-built routine once the matrix and vectors are initialized properly and in accordance
with degree of freedoms present on the actual grid, which is not necessarily a trivial
task especially within a hybrid scheme of mixed nite element and standard Galerkin
nite element discretizations.
Field Unknowns : Primary unknowns are FieldsFE (velocity and displacement
vector elds) and FieldFE (scalar pressure eld) objects where FieldsFE ob-
ject is just an array of handles to FieldFE objects for each component in the
vector eld. All the FieldFE functionality is therefore immediately available
for FieldsFE objects. To treat more than one unknown at a node in case of
a vector eld such as displacement we control the interaction between the vec-
tor eld (FieldsFE) and the unknowns in the linear system carefully. We use
vec2eld and eld2vec functionality of the DegFreeFE object which takes care
of the relation between degrees of freedom in a eld representation (here a set
of FieldsFE and FieldFE objects) and the ordering of the equations and un-
knowns in the linear system. Same ordering prevails at element level and is
therefor instrumental in coding the integrands function.
PDE coecients : Coecients of the PDE which vary in the space (e.g. permeabil-
ity, porosity, compressibility etc.) are implemented using exible FieldFormat
and Handle(Field) tools available from Dipack.
Boundary conditions : Traction-free boundaries appear as natural boundary con-
ditions in the present problem. Essential boundary conditions (v
i
and/or p
and/or u
j
known at a node) are incorporated in the matrix system by sub-
stituting the equation corresponding to the actual degree of freedom by the
boundary condition. While doing so, we sincerely attempt to preserve the sym-
metry of matrix S. The surface integral over is implemented for normal
tractions only.
APPENDIX C. RELEVANT DIFFPACK ROUTINES 146
Stress Computation : We evaluate and smooth the derivatives of displacement
elds using the functionality oered by FieldsFEatItgPt class of Dipack (also
see Subsection 5.2.9 in Chapter 5).
C.5 Code Structure
C.5.1 Header and Source Files
Denition of a class, its member functions and member variables (data structures)
involves generating problem-specic header les as a rst step which inherits most
of its functionality and character from a group of pre-compiled parent classes avail-
able with Dipack libraries. These header les are then modied to include all the
necessary data structures needed to solve the problem. Below is a section from the
simulator header le demonstrating main functionality of the class. It only shows the
most important members of the class for easy reference in the forthcoming discussion.
Program C.1: The Header File
1 class PoissonBlocks : public MxFEM , public NonLinEqSolverUDC
2
3
4 /* ***************** Member Functions ****************** */
5
6
7 // general scanning routine from input data file for all
parameters , calls scangrid ()
8 scan()
9 // read the grid file or prepare a grid file
10 scanGrid ()
11 // set boundary conditions by calling following 3 functions
12 fillEssBC ()
13 // set velocity boundary conditions using degree of freedom
object
14 fillEssBC4V ()
15 // set pressure boundary conditions using degree of freedom
object
16 fillEssBC4P ()
APPENDIX C. RELEVANT DIFFPACK ROUTINES 147
17 // set displacement boundary conditions using degree of freedom
object
18 fillEssBC4Q ()
19 // save converged solutions , field maps , plots
20 saveResults ()
21 // computes and smooths stress (invariants , von -Mises)
22 calcDerivedQuantities ()
23 // initialize the field data structures
24 initFieldsEtc ()
25 // initilaize the PDE coefficient functions , e.g. permeability
26 initFunctors ()
27 // initialize degree of freedom object , prepares local global
vectors
28 initDofs ()
29 // velocity field initialization , called by initFieldsEtc ()
30 initUFields ()
31 // displacement field initialization , called by initFieldsEtc ()
32 initQFields ()
33 // pressure field initialization , called by initFieldsEtc ()
34 initPFields ()
35 // calls initBlocks () and timeLoop ()
36 solveProblem ()
37 // runs the time loop for simulation , calls setIC , saves time -
series or evolution points
38 timeLoop ()
39 // sets initial conditions (u, p and q fields at time zero)
40 setIC()
41 // initialize the block matrix/vector structure of Jacobian and
Residual , calls makeBlockSystemMx ()
42 initBlocks ()
43 // enforces essential BC on element matrix -vector , using
integration rule performs linear system assembly
44 makeBlockSystemMx ()
45 // solving the linear system at given time step , calls
makeAndSolveLinearSystem (), manipulates time step size
46 solveAtThisTimeStep ()
47 // prepares (assembles) the global Ax=b system to solve
48 makeAndSolveLinearSystem ()
49 // applies or integrates traction boundary conditions
APPENDIX C. RELEVANT DIFFPACK ROUTINES 148
50 integrands4sideMx ()
51 // computes total stress in a mixed finite element
52 calcTotalSigma ()
53 // computes strain in a mixed finite element
54 calcEps ()
55 // computes displacement boundary condition values from data
input file
56 displacementBC ()
57 // computes traction boundary condition values from data input
file
58 tractionBC ()
59 // reporting and outputing routine
60 resultReport ()
61
62
63
64 /* ***************** Member Variables ****************** */
65
66
67 // scalar fields e.g. pressure , permeability etc.
68 Handle(FieldFE)
69 // vector fields e.g. displacement , velocity , flux
70 Handle(FieldsFE)
71 // object pointer to degree of freedom structure
72 Handle(DegFreeFE)
73 // required for non -isoparametric mixed elements variables e.g.
pressure and velocity
74 Handle(BasisFuncGrid)
75 // finite element grid storing all dimensions and geometrical
informations
76 Handle(GridFE)
77 // linear system vector of unknwons e.g x in Ax=b
78 // complete Ax=b system with block definitions and preconditioner
readyHandle(LinEqVector)
79 Handle(LinEqSystemBlockPrec)
80 // Pointer to element matrix -vector object
81 Handle(ElmMatVecCalculator)
82 // enumerator for specifying plane_strain , plane_stress or
axisymmetric defromation
APPENDIX C. RELEVANT DIFFPACK ROUTINES 149
83 Elasticity_type {}
84 // declares an integrand object which links to all the integrand
blocks of the Jacobian
85 MatSimplest(Handle(MxIntegrandCalc))
Class declaration is used by the C++ source le (also called cpp le) which actually
denes the structure of the declared functions and initializes (binds) the member
variables or data structures. This certainly involves memory allocation for most of
these class members. Below in C.2, we look at a section of the source le from the
simulator program to crystallize the ideas presented here.
Program C.2: The Source File
1 PoissonBlocks :: scan (){
2
3 /*scan the menu for input parameters of system e.g. number of
space dimensions ,\break absolute permeability field ,
porosity , fluid density , fluid viscosity ,\break fluid
compressibility (modeled as field), grain density , number
of wells \break in field , well pressures , traction and
normal stress boundary conditions , \break displacement
boundary conditions , Young