Stanford 博士有藏模拟论文 | Central Processing Unit | Parallel Computing

DEVELOPMENT OF TECHNIQUES

FOR GENERAL PURPOSE
SIMULATORS
A DISSERTATION
SUBMITTED TO THE DEPARTMENT OF PETROLEUM ENGINEERING
AND THE COMMITTEE ON GRADUATE STUDIES
OF STANFORD UNIVERSITY
IN PARTIAL FULFILLMENT OF THE REQUIREMENTS
FOR THE DEGREE OF
DOCTOR OF PHILOSOPHY
Hui Cao
June 2002
ii
@ Copyright by Hui Cao 2002
All Rights Reserved
iii
I certify that I have read this dissertation and that, in my opinion, it
is fully adequate in scope and quality as a dissertation for the
degree of Doctor of Philosophy.
_______________________________________
Dr. Khalid Aziz
(Principle Advisor)
I certify that I have read this dissertation and that, in my opinion, it
is fully adequate in scope and quality as a dissertation for the
degree of Doctor of Philosophy.
_______________________________________
Dr. Louis Durlofsky
I certify that I have read this dissertation and that, in my opinion, it
is fully adequate in scope and quality as a dissertation for the
degree of Doctor of Philosophy.
_______________________________________
Dr. Margot Gerritsen
Approved for the University Committee on Graduate Studies:
_______________________________________
iv
v
Abstract
With the explosion of computational power and development of new and advanced
simulation techniques, reservoir simulation has evolved into a mature technology.
Today’s simulator is more robust, more complex and more useful than what was
available twenty years ago. Modern simulators incorporate a large variety of options and
they can be used to answer important questions about reservoir management. Under these
circumstances, a good design for the simulator is essential. So the first objective of this
research is to develop a new General Purpose Research Simulator (GPRS), which can be
used later by a large research group to preserve and enhance the work of several
investigators over a period of time.
Compositional simulation is the major focus of this research. It is more complex than
black-oil simulation due to the large number of components and various issues related to
flash calculations. Because of this complexity, a large number of compositional models
have been proposed. They use different equations, variables and implicit levels. The
second objective of this research is to evaluate the performance of different
compositional models. To do this in a consistent manner, a new General Formulation
Approach is developed to derive any kind of model, and this approach is used in GPRS to
implement various compositional models.
The IMPSAT (implicit pressure and saturations and explicit mole fractions) model
has been discussed in the literature. Here we investigated this method in detail, including
its characteristics, stability, construction and performance. The IMPSAT model is
actually one of the models that the General Formulation Approach can generate. Besides
this, a series of new IMPSAT based AIM (adaptive implicit) models are also proposed,
and their performance is compared with the performance of the traditional AIM model
which uses IMPES (implicit pressure and explicit saturations and mole fractions).
Various models and techniques of GPRS have been tested, including the black-oil
model, compositional model, unstructured grid handling and multi-point flux
approximation, and their results and performance are compared with existing simulators.
The performance of different compositional models has been evaluated using a wide
range of problems. We found that the natural variables (pressure, saturations and
component mole fractions) are good for the fully implicit (FIM) model, while the overall
vi
variables (pressure, overall component mole fractions) are good for the IMPES model.
We have also demonstrated that the IMPSAT model and the IMPSAT based AIM models
have very good performance for a wide range of problems, and they are more efficient
than the traditional models. The IMPSAT model is generally over 50% faster than the
IMPES model due to its improved stability. For problems that are not very hard, the
IMPSAT model is cheaper than the FIM model since it reduces the number of unknowns
that have to be solved implicitly. The IMPSAT based AIM models are more flexible,
more stable and less expensive than the traditional AIM model. With properly tuned
percentages of gridblocks for each formulation (IMPES, IMPSAT and FIM), the
IMPES+IMPSAT+FIM model will always outperform the traditional IMPES+FIM
model, and be the best model to use for all problems.
vii
Acknowledgements
I would like to thank my adviser Dr. Khalid Aziz for his support, encouragement and
guidance during this work. I would also like to thank Dr. Louis Durlofsky and Dr. Margot
Gerritsen for reading the dissertation and providing valuable comments. I also wish to
thank the rest of the Petroleum Engineering Department for their supports and
contributions to my academic achievements.
Special thanks are due to my wife, Jie Li, for her support and for giving me the joy of
life, our newborn son. I would also like to thank my mother in law for helping with the
care of our baby. My parents also deserve my gratitude for supporting and encouraging
my education from the very beginning.
I also wish to thank ExxonMobile, ChevronTexaco and Schlumberger for summer
jobs that provided valuable experience and motivation for my research. Finally, I like to
thank the companies supporting the Reservoir Simulation Industrial Affiliate Program
(SUPRI-B) at Stanford University for their financial contribution and interest in my
research.
This research was partially supported by the Unites State Department of Energy
through contract number DE-AC26-99BC15213. This support is greatly appreciated.
viii
ix
Contents
Abstract .............................................................................................................................. v
Acknowledgments............................................................................................................vii
Table of Contents .............................................................................................................ix
List of Tables ..................................................................................................................xiii
List of Figures.................................................................................................................. xv
1 Introduction................................................................................................................. 1
1.1 Development of Simulation Technology .......................................................... 1
1.1.1 Explosion in Computational Power....................................................... 2
1.1.2 Development of Simulation Techniques ............................................... 4
1.2 Compositional Simulation................................................................................. 9
1.2.1 Formulation and Solution Method ...................................................... 10
1.2.1.1 Mass Balance Type ................................................................. 10
1.2.1.2 Volume Balance Type............................................................. 17
1.2.2 Flash Calculation................................................................................. 20
1.2.2.1 Equilibrium Ratios Flash......................................................... 20
1.2.2.2 Equality of Fugacities Flash.................................................... 21
1.2.3 Treatment of Phase Disappearance and Reappearance....................... 22
1.2.4 Other Numerical Techniques .............................................................. 23
1.3 Outline of Research Steps ............................................................................... 25
x
2 Basic Aspects of GPRS.............................................................................................. 27
2.1 Gridding .......................................................................................................... 27
2.2 Control Volume Formulation and Structure of Jacobian Matrix .................... 31
2.3 Network Modeling .......................................................................................... 37
2.4 Multi-Point Flux Representation and Implementation.................................... 40
2.5 Well Treatment................................................................................................ 43
2.6 Flash Calculation and Treatment of Phase Disappearance and Reappearance
......................................................................................................................... 48
2.7 Linear Solver ................................................................................................... 51
2.8 Timestep Control and Reservoir Initialization................................................ 54
3 General Formulation Approach .............................................................................. 57
3.1 General Nonlinear Equation Set...................................................................... 59
3.2 General Formulation Approach Steps ............................................................. 62
3.2.1 Switch From the Natural Variables to Other Variables ...................... 63
3.2.2 Reduce Full Set to Primary Set ........................................................... 66
3.2.3 Reduce the Implicit Level of the Fully Implicit System..................... 72
3.3 Stability Analysis ............................................................................................ 80
3.4 Influence of Equation and Variable Selections ............................................... 84
3.4.1 Selection of Primary Equations........................................................... 84
3.4.2 Different Variable Selections .............................................................. 86
4 IMPSAT and IMPSAT Based AIM model ............................................................. 91
4.1 IMPSAT Model............................................................................................... 92
4.1.1 Why Does IMPSAT Model Work?..................................................... 92
4.1.2 IMPSAT Stability Criterion? .............................................................. 95
4.1.3 Cost of IMPSAT Model .................................................................... 100
4.1.4 How to Build IMPSAT Efficiently?.................................................. 102
4.2 IMPSAT Based AIM Model ......................................................................... 103
xi
5 Model Validation and Performance ...................................................................... 105
5.1 Validation of GPRS....................................................................................... 105
5.1.1 Black-Oil Model................................................................................ 106
5.1.2 Compositional Model........................................................................ 108
5.1.3 Unstructured Grid and Multi-Point Flux........................................... 111
5.1.4 General Formulation Approach......................................................... 112
5.1.5 Non-conventional Well ..................................................................... 115
5.2 Performance of Compositional Models in GPRS ......................................... 117
5.2.1 Fully Implicit Models........................................................................ 119
5.2.2 IMPES Models .................................................................................. 125
5.2.3 IMPSAT Model................................................................................. 132
5.2.4 AIM Models ...................................................................................... 139
6 Conclusions and Future Work............................................................................... 147
6.1 Conclusions ................................................................................................... 147
6.2 Future Work .................................................................................................. 150
Nomenclature................................................................................................................. 151
References ...................................................................................................................... 155
Appendix A: Overview of GPRS.................................................................................. 165
Appendix B: Black-Oil Simulation Using Compositional Formulation................... 179
Appendix C: Flash Calculation.................................................................................... 181
xii
xiii
List of Tables
5.1 Iteration and timing comparisons for FIM models and Case 1 problem............. 123
5.2 Iteration and timing comparisons for FIM models and Case 2 problem............. 124
5.3 Iteration and timing comparisons for FIM models and Case 3 problem............. 124
5.4 Iteration and timing comparisons for FIM models and Case 4 problem............. 124
5.5 Iteration and timing comparisons for FIM models and Case 5 problem............. 125
5.6 Iteration and timing comparisons for IMPES models and Case 1 problem........ 130
5.7 Iteration and timing comparisons for IMPES models and Case 2 problem........ 131
5.8 Iteration and timing comparisons for IMPES models and Case 3 problem........ 131
5.9 Iteration and timing comparisons for IMPES models and Case 4 problem........ 131
5.10 Iteration and timing comparisons for the IMPSAT model and Case 1 problem
............................................................................................................................. 138
5.11 Iteration and timing comparisons for the IMPSAT model and Case 2 problem
............................................................................................................................. 138
5.12 Iteration and timing comparisons for the IMPSAT model and Case 3 problem
............................................................................................................................. 138
5.13 Iteration and timing comparisons for the IMPSAT model and Case 4 problem
............................................................................................................................. 139
5.14 Iteration and timing comparisons for AIM models and Case 1 problem............ 144
5.15 Iteration and timing comparisons for AIM models and Case 2 problem............ 144
5.16 Iteration and timing comparisons for AIM models and Case 3 problem............ 144
5.17 Iteration and timing comparisons for AIM models and Case 4 problem............ 145
5.18 Iteration and timing comparisons for AIM models and Case 5 problem............ 145
xiv
xv
List of Figures
1.1 State of the art CPU performance ........................................................................... 2
1.2 Maximum practical model size ............................................................................... 3
2.1 Effect of gridblock ordering on structure of Jacobian matrix ............................... 30
2.2 An unstructured grid with faults and multilateral wells........................................ 30
2.3 A general polyhedron............................................................................................ 31
2.4 General structure of the Jacobian matrix............................................................... 34
2.5 A simple unstructured grid with wells .................................................................. 35
2.6 Jacobian structure for the system in Figure 2.5..................................................... 36
2.7 Gridblock connection array when the block-based approach is used ................... 37
2.8 Connection array when the connection-based approach is used........................... 38
2.9 Jacobian structure for two-point flux derivatives.................................................. 40
2.10 Jacobian structure for multi-point flux derivatives ............................................... 43
2.11 Wellbore flow........................................................................................................ 45
2.12 Performance comparison between GPRS solver and BlitzPak............................. 52
3.1 Reduction process from full set to implicit primary set ........................................ 58
3.2 Structure of the full set Jacobian matrix and RHS................................................ 60
3.3 Structure of the inverse of the transformation matrix for a Type B model ........... 66
3.4 Reduce full set to primary set by Gaussian elimination........................................ 68
3.5 Structure of the primary set Jacobian matrix and RHS......................................... 71
3.6 Fully implicit Jacobian matrix of one gridblock ................................................... 73
3.7 Jacobian matrix of one gridblock after explicit treatment of flux term ................ 73
3.8 Householder reflection decoupling ....................................................................... 75
3.9 Local inversion decoupling................................................................................... 76
3.10 Illustration for local inversion............................................................................... 77
4.1
g g
dS df / as a function of
g
S ................................................................................ 96
4.2 FS as a function of
g
S for difference
c
K values ................................................ 97
4.3 Oil saturation at the well block ............................................................................. 98
4.4 Maximum stable timestep size for the IMPES model........................................... 99
4.5 Maximum stable timestep size for the IMPSAT model ........................................ 99
5.1 Black-oil reservoir............................................................................................... 106
xvi
5.2 Oil production rate at the producer from GPRS and Eclipse 100 ....................... 107
5.3 Gas oil ratio at the producer from GPRS and Eclipse 100.................................. 107
5.4 Compositional reservoir ...................................................................................... 108
5.5 Well block and block (1,1,5) pressures from GPRS and Eclipse 300
with ∆t
max
=30 days .............................................................................................. 109
5.6 Well block and block (1,1,5) oil saturations from GPRS and Eclipse 300
with ∆t
max
=30 days .............................................................................................. 109
5.7 Well block and block (1,1,5) oil saturations from GPRS and Eclipse 300
with ∆t
max
=30 days for GPRS and ∆t
max
=10 days for Eclipse 300 ..................... 110
5.8 Unstructured grid................................................................................................. 111
5.9 Water cut results from GPRS and FLEX for unstructured grid .......................... 112
5.10 Well block pressure for the FIM model with Type A and Type B variables...... 113
5.11 Well block oil saturation for the FIM model with Type A and Type B variables
............................................................................................................................. 113
5.12 Well block pressure for models with different implicit levels............................ 114
5.13 Well block oil saturation for models with different implicit levels .................... 114
5.14 Black-oil reservoir with a dual-lateral producer ................................................. 115
5.15 Oil production rate at the producer from GPRS and Eclipse 100
for a dual-lateral well problem............................................................................ 116
5.16 Gas oil ratio at the producer from GPRS and Eclipse 100
for a dual-lateral well problem............................................................................ 116
5.17 Heterogeneous permeability field (lnk) for Case 3 ............................................. 119
5.18 Well block oil saturation comparisons for FIM models and Case 1 problem..... 120
5.19 Well block oil saturation comparisons for FIM models and Case 2 problem..... 121
5.20 Well block oil saturation comparisons for FIM models and Case 3 problem..... 121
5.21 Well block oil saturation comparisons for FIM models and Case 4 problem..... 122
5.22 Well block oil saturation comparisons for FIM models and Case 5 problem..... 122
5.23 Stable timestep size for the IMPES model and Case 1 problem......................... 126
5.24 Stable timestep size for the IMPES model and Case 2 problem......................... 126
5.25 Stable timestep size for the IMPES model and Case 3 problem......................... 127
5.26 Stable timestep size for the IMPES model and Case 4 problem......................... 127
xvii
5.27 Well block oil saturation comparisons for IMPES models and Case 1 problem
............................................................................................................................. 128
5.28 Well block oil saturation comparisons for IMPES models and Case 2 problem
............................................................................................................................. 128
5.29 Well block oil saturation comparisons for IMPES models and Case 3 problem
............................................................................................................................. 129
5.30 Well block oil saturation comparisons for IMPES models and Case 4 problem
............................................................................................................................. 129
5.31 Stable timestep size for the IMPSAT model and Case 1 problem...................... 133
5.32 Stable timestep size for the IMPSAT model and Case 2 problem...................... 133
5.33 Stable timestep size for the IMPSAT model and Case 3 problem...................... 134
5.34 Stable timestep size for the IMPSAT model and Case 4 problem...................... 134
5.35 Well block oil saturation comparisons for the IMPSAT model and Case 1 problem
............................................................................................................................. 135
5.36 Well block oil saturation comparisons for the IMPSAT model and Case 2 problem
............................................................................................................................. 135
5.37 Well block oil saturation comparisons for the IMPSAT model and Case 3 problem
............................................................................................................................. 136
5.38 Well block oil saturation comparisons for the IMPSAT model and Case 4 problem
............................................................................................................................. 136
5.39 Well block oil saturation comparisons for AIM models and Case 1 problem.... 140
5.40 Well block oil saturation comparisons for AIM models and Case 2 problem.... 141
5.41 Well block oil saturation comparisons for AIM models and Case 3 problem.... 141
5.42 Well block oil saturation comparisons for AIM models and Case 4 problem.... 142
5.43 Well block oil saturation comparisons for AIM models and Case 5 problem.... 142
A.1 Structure of an oil field........................................................................................ 166
A.2 Field level system model..................................................................................... 166
A.3 Domain level system model ................................................................................ 167
A.4 Reservoir level system model ............................................................................. 168
A.5 Well level system model ..................................................................................... 169
A.6 Formulation level system model ......................................................................... 170
xviii
1
Chapter 1
Introduction
Petroleum Reservoir Simulation has come a long way since its birth in the 1950s. It is
worthwhile to take a brief look at the development of simulation technology before
describing new developments resulting from the research reported here. Since
compositional simulation is the major interest of this research, different aspects of
compositional modeling are summarized, including formulation, phase behavior
calculations and various numerical techniques used in the simulator. Following this, an
overview of the current research project is given, including the design and
implementation of a new General Purpose Research Simulator (GPRS), the development
of a new flexible General Formulation Approach, the development of new compositional
models and evaluation of different compositional models.
1.1 Development of Simulation Technology
Reservoir simulation is the art and science of using numerical techniques to solve the
equations for heat and mass flow in porous media, considering the appropriate initial and
boundary conditions (Aziz and Settari, 1979). Since the availability of digital computers
to the petroleum industry in the 1950s, more and more of the reservoirs have been studied
with the aid of simulators (computer programs).
Reservoir simulation has evolved substantially since its birth. Today, reservoir
simulation is a mature technology, and it is widely used in reservoir management. Nearly
all major reservoir development decisions are based at least partially on simulation results
(Watts, 1997).
The revolution in reservoir simulation over the last 50 years has been fueled by two
major factors, the explosion in computational power and the development of new and
advanced simulation techniques.
2
1.1.1 Explosion in Computational Power
The earliest computers were little more than adding machines by today’s standards.
Without substantial progress in computing, progress in reservoir simulation would have
been impossible. Developments in computing power are concentrated in four areas, CPU
speed, memory, parallel computing and programming languages. Each of them has
contributed to the development of simulation in its own way.
0.1
1
10
100
1000
10000
1965 1970 1975 1980 1985 1990 1995 2000 2005
Year
M
f
l
o
p
/
s
Figure 1.1 State of the art CPU performance (Dongarra, 2002)
CPU speed Figure 1.1 gives the computing speed in millions of floating point
operations per second (Mflop/s) for the four fastest CPUs of their time. CPU speed
increased by nearly 2000 times from 1970 to 1996, just as predicted by Moore’s Law (the
number of transistors per square inch on integrated circuits doubles every 18 months). In
the last several years, the rate of increase of CPU speed appears to be slowing down.
Memory A steady increase of available memory enables us to run larger and more
complex programs. In the 1970s, the best computers available had only several Megabyte
3
of memory. Today, a good PC could have 2 Gigabyte (1Gigabyte = 1000Megabyte) of
memory, and a parallel supercomputer could have over 50 Gigabyte of memory (Dogru et
al., 2001).
Parallel computing Figure 1.1 shows single processor performance. Today, high-
performance computing is achieved by using multiple processors in parallel. The
resulting performance (parallel speedup) depends widely on problem type, size, and
number of processors. Generally 32 processors lead to a speedup of 15-25 times for large
(hundreds of thousands of gridblocks) reservoir models (Watts, 1997), and higher
speedup factors are expected for even larger models.
Programming languages From the early version of Fortran to today’s Fortran90 and
C++, programming languages have developed through several stages. Today’s object-
oriented languages (such as C++) facilitate the design and development of large and
complex computer programs. Modular approach and all kinds of source code control
software (such as SourceSafe from Microsoft) make group programming easy and
feasible, the cost of development is reduced, and programs developed using modern tools
are easier to maintain.
1.E+02
1.E+03
1.E+04
1.E+05
1.E+06
1960 1965 1970 1975 1980 1985 1990 1995 2000
Year
N
u
m
b
e
r
o
f
g
r
i
d
b
l
o
c
k
s
Figure 1.2 Maximum practical model size
4
A steady decrease in the price of computers has made simulation more and more
affordable. A direct consequence of increasing computing speed and memory is the
growth of model size. In 1960, the largest model size was around 200 gridblocks. By
1970, it had grown to about 2000 gridblocks. In 1997, it was roughly 500,000 gridblocks
for simulations on a single processor (Watts, 1997). Today with parallel computing, the
model sizes are becoming even larger. In a recent meeting Dogru (2001) reported
simulations with up to 16 million gridblocks for three-phase black-oil problems, and
routine simulation with one million gridblocks. Figure 1.2 summarizes these results, it
shows a constant rate of growth in model size from 1960 to 1997, which is roughly
proportional to the growth in computing speed. The fast growth in model size in the last
several years is primarily due to the use of parallel computers.
The growth in computational power enables engineers to simulate large and complex
compositional problems, and to develop and apply new simulation techniques. As a
result, it is becoming possible to more accurately account for reservoir heterogeneities
and process characteristics. At the same time, engineers and scientists are looking for
ways to reduce the cost of reservoir simulation by reducing the number of unknowns per
gridblock and by developing more robust linear solvers and preconditioners.
1.1.2 Development of Simulation Techniques
In recent years, new techniques have appeared in all areas of simulation, including
gridding, fluid modeling, numerical approximations, linear solvers, reservoir and
geological modeling, etc. All of these technical advances are making simulation more
accurate and realistic, and the simulator more robust, fast, stable, and user-friendly.
Gridding In the early stages of this technology, all reservoir simulations were
performed on rectangular Cartesian grid, radial grid was developed later to simulate near
well flow. Local grid refinement was developed to achieve better accuracy in high flow
regions (Ciment and Sweet, 1973; Nacul, 1991; Pedrosa and Aziz, 1985). Development
of corner-point geometry grid (Ponting, 1989; Ding and Lemonnier, 1995; Peaceman,
1996) made it possible to use non-rectangular gridblocks, providing the capability to
model faults and other complex geological features. Up to this point, all grids were
5
structured, where the neighbors of a gridblock could be easily identified from their i, j, k
indices. In the last decade, unstructured grids (Heinemann and Brand, 1989; Palagi and
Aziz, 1994; Gunasekera et al., 1997; Kocberber, 1997; Aavatsmark et al., 1997; Verma
and Aziz, 1996-1997) were introduced, which can easily force gridblocks to conform to
major geological features. In unstructured grids, the connections between gridblocks are
flexible, and a connection list is used to keep track of the connected gridblocks. Most
unstructured grids are non-orthogonal grids, which often require the use of multi-point
flux approximations. Today, users can define major reservoir units to which the
simulation grid must conform, within each unit, the grid can be generated automatically
with some guiding input from the user (Geoquest, 2000). Automatic gridding software
packages are becoming available from commercial vendors, such as, FloGrid from
Geoquest, GOCAD from the GOCAD group and GridPro from Program Development
Corporation (PDC).
In the last several years, flow based unstructured grids (Agut et al., 1998; Edwards et
al., 1998; Castellini et al., 2000) have been proposed, which are normally formed by
generating streamlines and iso-potential lines from a fine grid single-phase simulation.
Considerable smoothing is required to make the grid suitable for simulation. These grids
roughly follow major geological features, such as faults, and they are concentrated in
high flow rate areas, such as wells or high permeability regions. Edwards et al. (1998)
showed that, if the grids follow the streamlines exactly, the multi-point flux calculations
can be reduced to two-point flux calculations.
Beside developments in gridding techniques, Lim et al. (1994) proposed a new
approach to the representation of grid information. In the conventional approach or the
block-based approach, gridblocks and wells are tracked when computing flux terms.
While in the new connection based approach, the network of connections are considered.
A connection always links two nodes, each node can be a gridblock node, a well node or
a surface facility node. A cell (gridblock) list is used for the calculation of accumulation
terms, and a connection list is used for the calculation of flux terms. In Chapter 2, we will
discuss the construction of the Jacobian matrix and the residual using this approach. This
connection-based approach is extremely convenient for unstructured grids, since the
6
connection list itself has no structure at all. Besides this, it is also suitable for domain
decomposition, surface facility modeling (Lim et al., 1994) and multi-point flux
calculations.
Fluid modeling Initially, all simulations were based on the black-oil fluid model,
where the hydrocarbon system is represented by two pseudo-components, oil and gas,
according to their status at standard conditions. In the early 1980s, compositional
simulation, where the hydrocarbon system is represented by an arbitrary number of
components and pseudo-components (e.g. Aziz, 1996), became more mature and ready to
use. The development of compositional simulation makes it possible to simulate volatile
oil reservoirs, CO
2
flooding and other EOR processes. However, compositional
simulation is much more expensive than black-oil simulation, due to the larger number of
unknowns per gridblock and complex flash behavior.
Numerical approximations Conventional simulators use finite-difference methods
with two-point flux calculations. More recently, multi-point flux calculations (Verma and
Aziz, 1996; Gunasekera et al., 1998) are becoming more and more common due to the
use of full tensor permeability (Lee et al., 1994; Lee et al., 1997) and non-orthogonal
grids. At the same time, control volume methods (Aavatsmark et al., 1997; Verma and
Aziz, 1997) have become the method of choice for today’s simulator, because of their
easy handling of unstructured grids. Limited work has also been done on higher-order
schemes (Sammon, 1991; Chen et al., 1991) and finite element methods (Young, 1978;
Fung et al., 1991; Sukirman and Lewis, 1994) to achieve higher accuracy.
Linear Solver Solving the linear system is the single most costly part for a
simulation. So it is extremely important to have a good linear solver. Initially, direct
solvers were used, but as the problems have become larger and larger (more and more
gridblocks), iterative solvers have become more and more common. The performance of
iterative solvers depends on the quality of preconditioners. In the petroleum industry,
most of the effort in this area has been on building better preconditioners.
Any iterative solver can be used as a preconditioner for other iterative solvers, and
different preconditioners can be combined together to form multistage preconditioners.
Traditional preconditioners include, Incomplete LU decomposition (ILU) (e.g. Behie and
7
Forsyth, 1983), Gauss-Sediel (GS) (e.g. Aziz and Settari, 1979), Algebraic Multi-Grid
(AMG) (Stueben, 1983), etc. Their performance depends strongly on the nature of the
linear system. For near-elliptic system, AMG works well, for near-hyperbolic system,
both ILU and GS work well. In reservoir simulation, we have a near-elliptic pressure
equation and near-hyperbolic saturation equations. For this kind of mixed system, none of
the single stage preconditioners (ILU, GS, AMG, etc) work well, we need a smarter
preconditioner. Wallis et al. (1985) introduced the Constrained Pressure Residual (CPR)
preconditioner, which is specially designed for reservoir simulation equations. It uses a
two-stage approach to solve the pressure part and the saturation part of the reservoir
equations separately, which make it the most promising preconditioner for fully implicit
simulations. Unfortunately, a good preconditioner is still missing for the Adaptive
Implicit (AIM) Method (Forsyth and Sammon, 1986).
Most of the available commercial linear solvers have been designed for structured
grids, which result in Jacobian matrices with a banded structure. For unstructured grids,
the Jacobian matrix is a general sparse matrix, and for such systems the existing solvers
loose their efficiency. For problems with structured grids, the best iterative solvers can
solve a problem with n unknowns in O(n
1.1~1.2
) time (see timing results in Section 2.7).
However a lot of work needs to be done for unstructured grid solvers and AIM system
solvers. For unstructured grids, the ordering of gridblocks and connections are quite
important for the efficiency of the linear solver, and these issues will be discussed in
Section 2.7.
Reservoir and Geological Modeling Reservoir simulations have also expanded in
terms of options and features. Modern reservoir simulators can simultaneously handle
multiple reservoirs, surface facilities (Schiozer and Aziz, 1994; Byer, 2000) and rock
mechanics. Furthermore, there is more and more cooperation among reservoir engineer,
geologist and geophysicist to achieve more realistic modeling of reservoir geology for
simulation projects (e.g. Journel, 1990; Ballin et al., 1993).
With all of these developments in simulation technology and computers, the simulator
has also reached a new stage. Today’s simulator is more robust, more complex, and
easier to use than what was available 20 years ago. Because of all the features that are
8
required in a modern simulator, it takes more time to develop a simulator and more effort
to maintain it. In the future, simulators will be required to solve even more complex
problems than they can handle today. Under these circumstances, a good design for the
simulator is vital. Fortunately, today we have all kinds of design tools and suitable
computer languages to develop technology to meet the future needs of the industry.
Research students working in this area need a lot of time to program the basic
simulator before they can even start to explore research topics of interest to them. Also,
after a student leaves, most of his/her development becomes unusable within a short time,
due to lack of good design and documentation. Hence developing a good environment for
simulation research has become essential for a research group like the one at Stanford
University.
The first objective of this research is to develop a General Purpose Research
Simulator (GPRS) with a highly modular structure. This will enable each future
developer to work on extending modules of interest to him/her, without having an
intimate knowledge of every aspect of other modules. A new researcher will be required
to understand only the most basic structure of the simulator. Hopefully, this approach will
save time in developing new techniques, and help preserve the work of new students.
After the basic design and components have been put in place, the entire research group
will be able to contribute to the project. An overview of the GPRS program, including its
design, is included in Appendix A.
Inside this new General Purpose Research Simulator, we will incorporate many of the
available new simulation techniques that were developed in the last decade, a number of
which are unavailable in commercial simulators. Some of the features of particular
interest to our research group are,
• unstructured grid (structured grid is handled as a special case of unstructured grid),
• network modeling (connection based approach),
• both two-point flux and multi-point flux calculation for network modeling,
• advanced linear solver technology (need further development),
• fully coupled surface facilities model (future development), and
• fully coupled geo-mechanical model (future development).
9
Currently, the first four features have been included in GPRS, and the fourth feature
needs further development. We plan to add in the last two features in the near future.
GPRS is using a flexible compositional formulation, which is the major focus of this
research, so it is worthwhile to take a further look at various aspects of compositional
simulation.
1.2 Compositional Simulation
Petroleum reservoir fluids contain thousands of chemical components that affect their
physical properties and phase behavior during production (e.g. Aziz, 1996). It is not
practical to describe petroleum fluids in terms of individual components. Instead, pseudo-
components (groups of molecules) with average physical properties are used to describe
the reservoir fluid.
As mentioned earlier, we have two models for the fluid, black-oil and compositional.
This selection is usually based on the volatility of the oil (e.g. Aziz, 1996). An oil, with
gas solubility ratio (R
s
) less than 750scf/stb, oil formation volume factor (B
o
) less than
1.4bbl/stb and API gravity less than 30, is typically referred to as black-oil. In this case,
phase behavior is simply represented by B
o
and R
s
, which are only functions of pressure,
and flash calculations are not needed.
The black-oil model is just a special case of the compositional model, where the
phase equilibrium relations can be reduced to linear relations between component mole
fractions and pressure. Because of this, we can perform black-oil simulation using
compositional formulation (refer to Appendix B for details), this is the case in GPRS.
Whenever it is inappropriate to use a black-oil model, the oil and gas must be
described by more than two pseudo-components. In this case, phase behavior is
represented by an Equation of State (EOS) and phase equilibrium relations, and this
requires flash calculations. Sometimes, even when the reservoir fluid satisfies the black–
oil condition, we may still need to use a compositional model for simulating such
processes as CO
2
injection, N
2
injection, etc.
As we go from black-oil to compositional models, the number of equations and
components increases, and the choice of equations and variables gets more complex. The
10
performance of the simulator (convergence of Newton iterations and convergence of
linear solver iterations) can be strongly influenced by these factors. The choice of the
implicit level (number of implicit variables for each gridblock) is another important
factor here. Depending on the variable type, we may also need to switch variables when a
hydrocarbon phase disappears or reappears.
The essential aspects of compositional simulation are discussed in detail in the next
several subsections, including formulation, phase behavior and various numerical
techniques. Here, we only consider isothermal compositional models.
1.2.1 Formulation and Solution Method
We can separate different compositional models into two basic types, mass balance type
and volume balance type, according to the basic equations they solve. All of the
following equations are for three-phase systems, and water and hydrocarbon phases are
totally separated. In the following discussion,
c
n is the number of components,
h
n =
c
n -1
is the number of hydrocarbon components, and
p
n is the number of phases.
1.2.1.1 Mass Balance Type
Just as the name implies, equations for this type of model are the mass balance equation
for each hydrocarbon component (or pseudo-component) and for water (e.g. Coats, 1980;
Young and Stephen, 1983):
[ ]
0 ) (
)] ( [ ) (
, ,
= + +
∆Φ + ∆Φ − +


=


W
i
W
g c g
W
o c o
l
i l g c g g o c o o
i
c g g c o o i c
q y q x
y x T y S x S V
t
F
ρ ρ
ρ λ ρ λ ρ ρ φ
(1.1)
c = 1,…,
h
n
0 ) ( ) ( ) (
, ,
= + ∆Φ −


=
∑ ∑ i
W
w
W
w
l
i l w w w i w w i w
q T S V
t
F ρ ρ λ ρ φ (1.2)
where,
c
x and
c
y are the hydrocarbon component mole fractions in the oil and gas phases
respectively, and
W
o
q ,
W
g
q and
W
w
q are the phase volumetric flow rates of well W.
11
Transmissibility is calculated by
L
kA
T

= α (1.3)
Phase mobility is determined by
p
rp
p
k
µ
λ = (1.4)
Phase potential difference between gridblock i and j is defined as
) ( ) (
, , , , , , , , i j j i p
c
i p j p i p j p j i p
D D
g
g
p p − − − = Φ − Φ = ∆Φ ρ β (1.5)
where α and β are unit conversion constants (For field units, α =6.32654E-3 and
β =1.0/144).
Sometimes it is convenient to replace one of the hydrocarbon component mass
balance equations by a total hydrocarbon mass balance equation obtained by summing
Eqn. 1.1 for all hydrocarbon components.
[ ]
0 ) (
)] ( [ ) (
, ,
= + +
∆Φ + ∆Φ − +


=


W
i
W
g g
W
o o
l
i l g g g o o o
i
g g o o i h
q q
T S S V
t
F
ρ ρ
ρ λ ρ λ ρ ρ φ
(1.6)
In addition to mass balance equations, we need a phase equilibrium relation for each
hydrocarbon component. Since water and hydrocarbon components are totally separated,
we only need two-phase equilibrium relations between the oil and gas phases:
, 0
, ,
= − =
g c o c e
f f F c = 1,…,
h
n (1.7)
where
o c
f
,
and
g c
f
,
are the fugacities of hydrocarbon component c in the oil and gas
phases, respectively. Appendix C provides details of flash and fugacity calculations.
12
Finally some linear constraints have to be satisfied:
• Capillary pressure constraints:
0 ) (
,
= − − =
w o ow c pcow
p p p F (1.8a)
0 ) (
,
= − − =
o g go c pcgo
p p p F (1.8b)
• Saturation or volume constraint:

=
= − =
p
n
p
p S
S F
1
0 1 (1.8c)
or 0 = − =
T V
V V F
φ
(1.8d)
where
φ
V is the pore volume, and
T
V is the total fluid volume.
• Component mole fraction constraints:
0 1
1
= − =

=
h
n
c
c po
x F (1.8e)

=
= − =
h
n
c
c pg
y F
1
0 1 (1.8f)
For this system, the equations are:
Type Number
c
F
h
n -1
h
F 1
w
F 1
e
F
h
n
pcgo pcow
F F
,
2
S
F 1
pg po
F F
,
2
____________________________________________
Total 2
h
n +6
13
Same number of variables need to be selected, one possible choice is:
Type Number
p
p 3
p
S 3
c
x
h
n
c
y
h
n
____________________________________________
Total 2
h
n +6
There are a total of 2
h
n +6 equations and 2
h
n +6 variables. It is neither practical nor
necessary to solve all of these equations together. According to Gibbs phase rule, the
thermodynamic degrees of freedom for this system are
p c thermo
n n f − + = 2 . They fix the
intensive state of the system. Besides this, the volume fraction of each phase (
p
n -1
saturations) must also be determined to fix the extensive state. Assuming isothermal
conditions, we have one less degree of freedom. The final degrees of freedom (Aziz,
1997) for an isothermal compositional system are
c p p c
n n n n f = − − + − + = 1 ) 1 ( ) 2 (
So we only need to solve
c
n of the 2
h
n +6 total equations to fix both the intensive and
extensive state of the system. These
c
n equations are our primary equations. They are
also the equations solved simultaneously for fully implicit (FIM) models. There should
be the same number of primary variables (variables for the FIM model). After solving for
the primary variables, other variables (secondary variables) can be solved for from the
remaining equations (secondary equations).
We can treat all of the primary variables implicitly, like in the FIM model. In order to
further speedup the simulation process, we can also treat only some of the primary
variables implicitly, first solve for them, then solve for the remaining primary variables
by explicit or sequential implicit methods (Aziz and Settari, 1979; Watts, 1986).
Note, only the first 2
h
n +1 equations (
c
F ,
h
F ,
w
F ,
e
F ) are non-linear, and the total
number of independent mass balance equations (
c
F ,
h
F ,
w
F ) is equal to the number of
14
primary equations and variables. We can use the linear constraint equations to remove
two pressures, one saturation and two component mole fractions. Finally, only 2
h
n +1
number of non-linear equations and variables is left, which is the full set of equations and
variables. Out of this full set,
c
n primary equations and variables are selected. Since mass
balance equations represent flow in the reservoir, and their number always equals the
number of primary equations, they are the natural choice for primary equations. But the
selection of primary variables is widely varied among models. After the primary set is
selected, the equations and variables left over in the full set form the secondary equations
and variables.
There are a lot of models that belong to this class, and they are different in the way
that primary equations and variables are chosen. Some of the basic models are reviewed
next.
The Fussell and Fussell Model (1979) For this model the primary equations are the
h
n phase equilibrium relations and the saturation constraint equation. The primary
variables are p, l (hydrocarbon liquid mole fraction), and
c
y or
c
x , c=2,…,
h
n , depending
on whether the system in a gridblock is predominantly vapor or liquid. The
h
n phase
equilibrium relations are used to remove all of the primary variables except pressure from
the saturation constraint equation. The saturation constraint equation is the final IMPES
(Only pressure implicit formulation) pressure equation. This is the only model that uses
phase equilibrium relations as primary equations, and it is rarely used.
The Coats Model (1980) For this model the primary equations are the
c
n mass
balance equations for each hydrocarbon component and for water. The primary variables
are,
• p, S
o
, S
g
,
c
y , c=3,…,
h
n (when both the oil and gas phases are present),
• p, S
o
,
c
x , c=1,…,
h
n -1 (when no free gas is present), and
• p, S
g
,
c
y , c=1,…,
h
n -1 (when the oil phase disappears).
In general, adjacent gridblocks may have different sets of primary variables, and we need
to switch variables when a hydrocarbon phase disappears or reappears. The variable
selection (pressure, saturations and component mole fractions) in this model is normally
called the natural variable selection, since the mass balance equations can be directly
15
expressed in terms of these variables and calculation of derivatives of the Jacobian matrix
is very easy. This model was initially proposed as a FIM model, but it can also be
reduced to an IMPES model by variable elimination.
The Young and Stephenson Model (1983) For this model the primary equations are
the
c
n mass balance equations and the saturation constraint equation, and the last
hydrocarbon component mass balance equation is replaced by the total hydrocarbon mass
balance equation. The primary variables are p,
g g o o
S S F ρ ρ + = (total moles of
hydrocarbon in one unit volume of fluid),
w w
S W ρ = (total moles of water in one unit
volume of fluid) and
c
z (overall mole fraction of component c), c=1,…,
h
n -1. The
c
n
mass balance equations are used to eliminate all of the primary variables except pressure
from the saturation constraint equation. The saturation constraint equation is the final
IMPES pressure equation. This approach does not depend on the presence of individual
phases, since all of its primary variables are overall quantities. On the other hand,
saturation is not one of the primary variables, so we have to use the chain rule to evaluate
some of the derivatives of the flow term with respect to saturation, such as relative
permeability.
For this model, there are
c
n +1 primary equations and variables, one more than
necessary. Sometimes, this is done to facilitate the Jacobian matrix calculation, especially
when certain constraint equation is nonlinear with respect to the selected primary
variables (here, the saturation constraint equation is a nonlinear equation in terms of the
primary variables). Actually each small (
c
n +1)x(
c
n +1) block system can be reduced to a
c
n x
c
n block system. An alternative approach is to treat this extra nonlinear constraint
equation as a secondary equation, then there will be only
c
n primary equations.
The Chien, Lee, and Chen Model (1985) For this model the primary equations are
the
c
n mass balance equations for each hydrocarbon component and for water. The
primary variables are p, W and F z r
c c
= (total moles of component c in one unit volume
of fluid), c=1,…,
h
n c≠max. (r
max
is defined as the r
c
with respect to which the derivative
of the saturation constraint is largest.). This model also does not depend on the presence
of individual phases. Also, this model needs to use the chain rule to evaluate some of the
flow term derivatives. The equations of this model are normally solved fully implicitly.
16
Each of the models described above could be either fully implicit or only implicit in
pressure. In the original Young and Stephenson model (Young and Stephenson, 1983),
only pressure is treated implicitly, while in the original Coats model (Coats, 1980), all
primary variables are treated implicitly. There are a lot of other models, and each of them
is actually a variation of one of these basic models. The variations are obtained by
changing the level of implicitness, changing intensive and extensive variables, and so on.
In summary, all of these isothermal compositional models (except the Fussel and
Fussel model) select mass balance equations as the primary equations, and there are
basically two types of primary variables (Aziz, 1996).
Type A variables: one pressure
p
n -1 saturations
c
n -
p
n component mole fractions
Type B variables: one pressure
c
n -1 overall quantities, such as overall component mole fractions
The Coats model (Coats, 1980) belongs to Type A. The Young and Stephenson model
(Young and Stephenson, 1983) and the Chien, Lee and Chen model (Chien et al., 1985)
belong to Type B. Each type of variables has its own advantages and disadvantages. The
common points and differences between these two types of variables are given below.
Common Points:
• Mass balance equations are always the primary equations.
• Phase equilibrium relations are always used to eliminate the secondary variables from
the primary equations.
• After solving for the primary variables, the secondary variables are updated explicitly
via the phase equilibrium relations gridblock by gridblock
• Both types of models can be either fully implicit (FIM) or only implicit in pressure
(IMPES).
17
Differences:
• Type A variables are the natural variables, equations can be explicitly expressed in
them, and the Jacobian matrix is easy to calculate. For Type B variables, we have to
use the chain rule to calculate the derivatives for the Jacobian matrix. For example,
the chain rule is required to calculate derivatives of phase relative permeability with
respect to overall component mole fractions.
• In Type A, phase variables (saturation and component mole fractions in each phase)
are used, so they depend on the appearance and disappearance of hydrocarbon phases.
For each gridblock, if a hydrocarbon phase changes status, we need to switch the
primary variables (replacing the non-existing phase variables with the corresponding
variables for the existing phase). This generally leads to different primary variables in
different gridblocks. Additional work is required to track the variables used in each
gridblock, check the existence of individual hydrocarbon phases and perform the
switch. Type B uses overall compositions as the primary variables, and the same
primary variables can be used for all gridblocks.
1.2.1.2 Volume Balance Type
This type of models (Acs et al., 1982; Kendall et al., 1983; Watts, 1986; Aziz and Wong,
1988-1989) are based on the volume balance concept, and use the volume balance
equation as the pressure equation to form IMPES type formulations. Since the pore space
of porous medium must be fully filled with fluids present, the pore volume must be equal
to the total fluid volume at any time and place. This can be expressed as
g o w T
V V V V V + + = =
φ
(1.9)
The pore volume
φ
V is solely a function of pressure:
) (
1 1 n n
r
o n n
p p c V V V − + =
+ +
φ φ φ
(1.10)
where
r
c is the rock compressibility.
18
The total fluid volume
T
V is a function of both pressure and overall composition of each
component:
) (
) ( ) (
1
1
, , ,
1
,
1
,
1
n
c
n
c
n
c
c j M M p
n
c
T
n
w
n
w
M p
n
w
T n n
M M
n
T n
T
n
T
M M
M
V
M M
M
V
p p
p
V
V V
h
j w
c c w

|
|
.
|

\
|


+

|
|
.
|

\
|


+ −
|
|
.
|

\
|


+ =
+
=

+ + +

(1.11)
where,
c
M and
w
M are the overall mole amounts of hydrocarbon components and water.
n
c
n
c
M M −
+1
and
n
w
n
w
M M −
+1
are actually the accumulation terms in the mass balance
equations, which can be written as
1 ,
1
+
+
=


n n
c
n
c
n
c
U
t
M M
, c = 1,…,
h
n (1.12)
1 ,
1
+
+
=


n n
w
n
w
n
w
U
t
M M
(1.13)
where:
[ ]
1 , 1 1 , 1 1 , 1 ,
) ( ) (
+ + + + + +
+ ∆Φ + ∆Φ ∆ =
n W
c
n
g
n n
c g g
n
o
n n
c o o
n n
c
Q y T x T U ρ λ ρ λ (1.14)
[ ]
1 , 1 1 , 1 ,
) (
+ + + +
+ ∆Φ ∆ =
n W
w
n
w
n n
w w
n n
w
Q T U ρ λ (1.15)
Note that, for IMPES, the transmissibility terms (
o
λ ,
g
λ ,
w
λ ,
o
ρ ,
g
ρ ,
w
ρ ,
c
x ,
c
y ) are
fixed at the old time level. The time level for terms with superscript “n, n+1” depends on
the implicitness of the model.
The final pressure equation is obtained by substituting Eqn. 1.10, Eqn. 1.12 and Eqn.
1.13 into Eqn. 1.11. After rearranging, it can be written as
[ ]
(
(
(
¸
(

¸

|
|
.
|

\
|


+
|
|
.
|

\
|


∆ +
− = −
(
(
¸
(

¸

|
|
.
|

\
|



+
=
+

+

1 ,
,
1
1 ,
, , ,
1
,
) (
n n
w
M p
n
w
T
n
c
n n
c
c j M M p
n
c
T
n
T
n n
M M
n
T
r
o
U
M
V
U
M
V
t
V V p p
p
V
c V
c
h
j w
c w
φ φ
(1.16)
19
After solving for pressure from Eqn. 1.16, other variables are updated explicitly
gridblock by gridblock.
The key part of this method is to calculate the derivatives of individual phase volumes
with respect to both pressure and overall moles of each component (
p
V
p


,
c
p
M
V


,
w
p
M
V


).
In order to calculate these derivatives analytically, we need to make full use of the phase
equilibrium relations. Different authors have proposed different methods to calculate
these derivatives. Models of this type were proposed by Acs et al., 1982; Kendall et al.
1983; Watts, 1986; Aziz and Wong, 1988-1989.
Comparing the mass balance type models with the volume balance type models, the
volume balance type models are only implicit in pressure, basically it is an IMPES
approach. Coats (1999) has pointed out that the IMPES pressure equation is unique,
independent of the manner of derivation, choice and ordering of variables and equations.
So no matter which type of model we use, as long as it finally reduces to the IMPES
pressure equation, numerically they are equivalent to each other. They are only different
in two aspects:
• The number of operations to generate the final IMPES pressure system is different.
From this point of view, the Young and Stephenson model is more efficient than the
Coats model (Coats, 1999).
• The Jacobian matrix is scaled differently from gridblock to gridblock, which could
influence the convergence rate of iterative linear solvers (Coats, 1999).
In two papers, Aziz and Wong (1989) and Wong et al. (1990) showed the connection
between these two types of models, and how to derive the volume balance model starting
from the Jacobian matrix of a mass balance type model. In this research, we will just treat
the volume balance type model as a special IMPES case of the mass balance type model.
Models that treat only pressure implicitly are referred to in the literature by different
names: IMPES (implicit pressure and explicit saturations), IMPEM (implicit pressure and
explicit overall component mass/mole). As stated earlier, regardless of the variables
selected, the pressure equations are always equivalent to each other. In this work, we do
not distinguish between them, and refer to them as IMPES models.
20
1.2.2 Flash Calculation
Compared to black-oil models, compositional models are not only more complicated in
their formulations, they also require additional flash calculations. In black-oil models, the
phase equilibrium relations can be reduced to a series of linear relations between
component mole fractions and pressure, so there is no need for flash calculations. In
compositional models, we need to do flash calculation for each gridblock at each iteration
of each timestep. There are two types of flash calculations:
1.2.2.1 Equilibrium Ratios (K
c
) Flash
This is the simplest approach (Young and Stephenson, 1983) to flash calculations. The
equilibrium ratios are functions of both pressure and mole fractions, in this approach we
assume that these functions are known. We have the following equilibrium relations:
c c c
x K y = (1.17)
c c c
y l lx z ) 1 ( − + = (1.18)
where l is the hydrocarbon liquid (oil) mole fraction in hydrocarbon fluid. From Eqn.
1.17 and Eqn. 1.18, we can further express
c
x and
c
y in terms of l ,
c
z and
c
K :
c
c
c
K l l
z
x
) 1 ( − +
= (1.19)
c
c c
c
K l l
z K
y
) 1 ( − +
= (1.20)
From Eqn. 1.8e, Eqn. 1.8f, Eqn. 1.19 and Eqn. 1.20, we can derive the Rachford-Rice
equation (Rachford and Rice, 1952), which is solely a function of l for a given
c
z and
c
K :
∑ ∑ ∑ ∑
− +

= − = − = − =
c c c
c c
c c
c
c
c
c
K l l
z K
x y x y
) 1 (
) 1 (
) ( 1 1 0 (1.21)
The solution procedure reduces to the following two steps:
1. Solve for l from Eqn. 1.21
2. Solve for
c
x and
c
y from Eqn. 1.19 and Eqn. 1.20
21
1.2.2.2 Equality of Fugacities Flash
At equilibrium, 0
, ,
= − =
g c o c e
f f F , c = 1,…,
h
n , which are a series of nonlinear
equations. They can be solved by either the successive substitution method or the
Newton-Raphson method (Fussel and Yanosik, 1978). The solution procedure for the
successive substitution method is given below:
1. Solve for l from Eqn. 1.21
2. Solve for
c
x and
c
y from Eqn. 1.19 and Eqn. 1.20
3. Calculate the phase compressibility factor Z for each phase from an Equation of State
(EOS)
4. Calculate the fugacity for each component in each phase
5. Check convergence ( ε < − | 0 . 1 / |
, , g c o c
f f )
6. If not converged, update equilibrium ratios by ) / (
, , g c o c
old
c
new
c
f f K K ⋅ = , and repeat
step 1 to 6
Appendix C derives all of the analytical expressions of derivatives needed for the
Newton-Raphson method. The successive substitution method converges slowly, but
convergence is guaranteed, the Newton-Raphson method converges quickly, but it only
converges near the true solution. So, a typical approach is to use the successive
substitution method first, after the error is reduced to a certain level, the Newton-Raphson
method is used to finish it quickly (Nghiem et al., 1983).
For different Equation of State (EOS), we have different equations to calculate the
component fugacities. Cubic Equations of State are commonly used in the petroleum
industry, and among them the Peng-Robinson EOS (Peng and Robinson, 1976) is the
most popular one. A properly tuned Cubic EOS is generally adequate for compositional
simulation.
Besides phase equilibrium calculations, this procedure also yields phase properties.
The oil phase molecular weight is calculated as

=
⋅ =
h
n
c
c c o
x MW MW
1
(1.22)
and the gas phase molecular weight is calculated as

=
⋅ =
h
n
c
c c g
y MW MW
1
. (1.23)
22
The hydrocarbon phase densities are calculated as
ZRT
p
p
p
= ρ (1.24)
where compressibility factor Z is one of the three roots of the Cubic EOS, for the oil
phase the smallest real root is used and for the gas phase the largest real root is used.
In the early days, most simulators used the successive substitution method, today
most of them prefer the faster Newton-Raphson method or a combination of both
methods. Some simulators separate flash calculation from flow calculation, especially for
simulators using Type B variables.
1.2.3 Treatment of Phase Disappearance and Reappearance
In a gridblock, there may be up to two hydrocarbon phases (oil and gas). Whether both
hydrocarbon phases exist or not, depends on pressure, temperature and overall
composition. During simulation, we need to establish the existence of hydrocarbon
phases in all gridblocks. If only a single hydrocarbon phase exists, equations and
variables for some models may have to be changed.
Phase Disappearance When a gridblock has two hydrocarbon phases, we need to
monitor its condition to find when it will change to a single hydrocarbon phase.
Basically, there are three ways to do it:
• For each Newton iteration, we solve the flow equations, and get the saturation
solutions. If either S
o
or S
g
is negative, it is set to zero before initializing for the next
Newton iteration (Coats, 1980). In this case, the corresponding hydrocarbon phase
disappears.
• A flash calculation is performed. If the liquid mole fraction, l , <0, then the oil phase
does not exist anymore, else if l >1, then the gas phase disappears (Nghiem et al.,
1983). This kind of flash is called negative flash (Whitson and Michelson, 1986).
• A new set of pseudo-equilibrium ratios (PER’s) is used, and only one set of equations
and constraints are used at all times to simulate the process regardless of the phase
condition (Abou-Kassem and Aziz, 1985). This method is suitable for both
compositional and thermal models.
23
Phase Reappearance When a gridblock has only a single hydrocarbon phase, we
also need to monitor its condition. Because whenever it changes to two phases, we may
need to change equations and variables again. The following three approaches can be
used for this:
• For each Newton iteration, if either S
o
or S
g
is zero in a gridblock, then a saturation
pressure is calculated for the single hydrocarbon phase fluid present in the block. If
the calculated saturation pressure is less than the gridblock pressure, the gridblock
remains in single hydrocarbon phase mode, otherwise, both hydrocarbon phases exist
and the absent-phase saturation is set to 0.001 (Coats, 1980).
• A flash is performed, if l is between 0 and 1, then both hydrocarbon phases exist
(Nghiem et al., 1983). We can accelerate the convergence of flash calculations by
getting the initial values from the neighboring blocks (Young and Stephenson, 1983).
• The third treatment (Abou-Kassem and Aziz, 1985) of phase disappearance can be
applied without any change, since the same set of equations and constraints is used at
all times regardless of the phases present.
1.2.4 Other Numerical Techniques
Partial Jacobian Update (Young and Stephenson, 1983) If a gridblock satisfies the
convergence criteria, its old Jacobian values are retained. In other words, the Jacobian
terms are updated only for un-converged gridblocks. This technique can save some time
in Jacobian calculations, and it does not have a large influence on the convergence
behavior of Newton iterations. At convergence, correct results are guaranteed.
Relaxed Volume Balance Concept (Coats et al., 1998) This technique can be used in
both the FIM and the IMPES models, typically it is used in IMPES models. For the linear
constraint equations, such as , 0 1 = − + +
g o w
S S S we use
¹
´
¦
− − =
− − =
o w g
o w g
S S e S
S S S
δ δ δ
1
where
g o w
S S S e − − − =1
to directly substitute for
g g
S S δ , into the nonlinear equations in order to remove them.
When 0 = e , volume is conserved, when e is not zero, volume is not conserved, it is
called the relaxed volume balance approach because some volume balance error (phase
24
saturations do not exactly sum to 1.0) is accepted. However, exact mass balance at each
Newton iteration is achieved. In effect, this procedure amounts to iterating out volume
balance error while keeping exact mass balance.
This relaxed balance concept can be used for any linear constraint equation. If exact
balance is not achieved at the last timestep, then this balance error can be corrected in the
current timestep.
One Step Flash Calculation Theoretically, we should do exact flash calculation for
each Newton iteration. But at most times, it is worthwhile to do only a few flash
iterations without full convergence. This is appropriate because the result of each Newton
iteration is only an approximation to the final solution, and exact flash is not required. On
the other hand, If the flash results are far from convergence, it may worsen the
convergence rate of Newton iterations.
From the above discussion, we can see that compositional simulation is much more
complex than black-oil simulation. There are a variety of compositional models, and they
are quite different from each other. Some analysis and evaluation of the performance of
individual compositional models has been published (Coats, 1999), but it is far from
complete. There are two major reasons for the lack of appropriate comparisons:
• It is hard to implement different compositional models in one simulator. They just
have too many differences. There is a lot of work involved in programming, before
we can even start to evaluate different models.
• Compositional simulators are much harder to develop than black-oil simulators. This
kind of development is time consuming, requires one to deal with complex issues
associated with flash calculations and programming.
Since the fully implicit (FIM) models are too expensive for large problems and the
timestep limits on the IMPES model are too strict for hard problems, we need a new
model that is cheaper than the FIM model and much more stable than the IMPES model.
Another objective of this research, in addition to developing a General Purpose
Research Simulator (GPRS), is to evaluate the performance of different isothermal
compositional models, and where appropriate, develop new models. Before the work can
be started, we need to develop a General Formulation Approach which can be used to
25
derive any kind of model. Then, during programming, differences between different
models can be minimized, and we can quickly change from one model to another model.
This should lead to a consistent evaluation of the performance of different models.
1.3 Outline Of Research Steps
The major focus of this research is to develop a general-purpose simulation framework
with emphasis on simulator design and compositional simulation. This will be achieved
in four major steps:
Design and Implementation of GPRS As mentioned earlier, a well-designed
simulator can improve group productivity and help preserve work of different
investigators. A good design using a modular object-oriented approach is required. A lot
of advanced techniques will be implemented and tested in this simulator, including
unstructured grid handling, network modeling, multi-point flux calculation, linear
equation solution techniques, etc (Chapter 2).
General Formulation Approach and Its Implementation in GPRS A General
Formulation Approach will be developed, and this general approach should be capable of
yielding any kind of model. Both variables of Type A and Type B should be available
and the level of implicitness for each gridblock should be flexible (from 1 to number of
components). The details of this General Formulation Approach are in Chapter 3.
Development of New Compositional Models Another purpose of this research is to
develop new compositional models. A new model using implicit pressure, saturations and
explicit component mole fractions (IMPSAT) is discussed in Chapter 4.
Evaluation of Different Compositional Models The final step of this research is to
evaluate the performance of different compositional models under different conditions,
which include large number of components, large systems, highly heterogeneous
systems, etc. These aspects are discussed in Chapter 5. Our final goal is to find a way to
minimize the computational time without sacrificing accuracy.
26
27
Chapter 2
Basic Aspects of GPRS
One of the objectives of GPRS is to build a general framework for research simulators,
and allow a group of students to work with it and preserve the work of different
investigators. In order to make this process easier, it is worthwhile to discuss the basic
aspects of GPRS in detail, including gridding, formulation, flux calculation, well
treatment, flash calculation, linear solvers, timestep control and reservoir initialization.
Within GPRS, we intend to incorporate the most advanced simulation techniques
developed in the last decade. So far, we have included unstructured grid, control volume
formulation, network modeling, two-point and multi-point flux for unstructured grid,
negative flash calculation, compositional well control, and advanced linear solver
technology. In this chapter, we will discuss the basic aspects of GPRS, review the
advanced techniques used in each part, and explain how these techniques are
incorporated.
2.1 Gridding
Today, the trend in simulator development is to separate the gridding part from the flow
calculation (simulator) part, and use the output from the gridding part as input for the
simulator. The gridding part is normally done by a gridding software. Through this
approach, one simulator should be able to couple with different gridding software, and
each gridding software should be able to provide service for multiple simulators. Also,
this approach can lower the development cost and increase flexibility for both the
gridding part and the simulator part. However it is not very suitable for dynamic gridding,
where the grid changes with time. Fortunately, dynamic gridding is rarely used in today’s
reservoir simulators.
This separated approach is partially adopted in GPRS, and GPRS can get its grid
information in two ways:
28
• Internal generation GPRS has a Cartesian grid module, which can generate all of the
necessary information for a Cartesian grid. A similar model for Radial grid may be
added later.
• External read in For more advanced grids, such as unstructured grids, the grid
information is read from the output of a gridding software. Actually, this option is
suitable for all kinds of grids, including Cartesian grid.
Basically, GPRS is a reservoir simulator without much gridding capability, and
unstructured grid simulations are supported by interfacing with other gridding software.
In the petroleum industry, the available commercial gridding software includes
FloGrid from Geoquest, GOCAD from the GOCAD group and GridPro from Program
Development Corporation (PDC), etc. No matter which gridding software, they always
share the following common functions:
• Read information (location, size and physical properties) from a geological fine grid,
read major geological features, such as faults (location, length, direction) and read
well specification (trajectory, diameter and skin)
• Perform automatic gridding according to user input (grid type, dimension and other
options), and generate simulation grid
• Perform automatic upscaling from the geological fine grid to the simulation grid,
calculate the simulation grid properties, build connections between gridblocks and
calculate well indices (the connection between wellbore and well block). Note that
some gridding packages do not perform upscaling, such as GridPro.
• Output all of the simulation grid properties and well information in a specific format,
which can be read later by a simulator
Normally, each gridding software is specially designed to serve several simulators, for
example, FloGrid was initially designed to provide input for both ECLIPSE (Geoquest
simulator) and FIRST! (MOBIL simulator). In order to do that, gridding software
normally defines a specific output format for each served simulator. If the output file is a
text file, it is possible to write an external program to read in and reformat the
information and make it suitable for other simulators, such as GPRS.
29
In order to make the gridding software and the simulator work together, we have to
define which information should be passed on from the gridding software to the
simulator. The necessary information normally includes a list of cell properties, a list of
connection properties, and a list of well data. On the other hand, the simulator should be
able to handle the passed grid information, such as unstructured grid, multi-point flux.
GPRS is designed to handle the most general grid type and grid connection data, and it
should be able to interface with any gridding software. The gridding information that
GPRS needs includes the following:
• List of cell properties. For each cell, we need,
• dimensions (DX, DY, DZ) (not necessary),
• depth,
• porosity,
• permeability (not necessary, included in the transmissibility and WI data), and
• volume.
• List of connection properties. For each connection, we need,
• number of gridblocks for each connection (for two-point flux, it is always 2),
• gridblock index for each gridblock, and
• transmissibility constant for each gridblock.
• List of well data. For each well, we need,
• number of gridblocks that this well penetrates,
• index for each gridblock penetrated by this well (well block), and
• well index (WI) for each well block.
The ordering of the cell list and connection list is quite important to the efficiency of
a simulator, especially in the linear solver part. Considering a simple 4×1×1 case, Figure
2.1 shows two different cell orderings and the corresponding Jacobian matrix structures.
In Figure 2.1a, ordering is from left to right, and the Jacobian Matrix has a tridiagonal
structure. In Figure 2.1b, ordering is random, and the corresponding Jacobian matrix has
a random structure, which makes it much more difficult to solve than the tridiagonal
matrix. For structured grids, the best way to order is to order in the smallest dimension
30
first and order in the largest dimension last. But for unstructured grids, such as the one
shown in Figure 2.2, it is not so easy to decide which kind of ordering is the best. In
general, when we order the cell list of an unstructured grid, we wish to preserve as much
structure information as possible, and generate a Jacobian matrix with the smallest
possible bandwidth. The ordering of the connection list does not influence the structure of
the Jacobian matrix, but still, in order to make the best cache utilization in flux
calculations, it is best to roughly follow the ordering of the cell list.
a) left to right order b) random order
Figure 2.1 Effect of gridblock ordering on structure of Jacobian matrix
Figure 2.2 An unstructured grid with faults and multilateral wells (FloGrid, 2000)
1 2 3 4
X X X
X X
X X X
X X
4 1 3 2
X X
X X X
X X X
X X
31
2.2 Control Volume Formulation and Structure of Jacobian Matrix
There are different types of numerical methods for the discretization of reservoir flow
equations. Traditionally, finite difference methods have been used, in recent years, with
the development of unstructured grids, more and more use is being made of control
volume methods (Aavatsmark et al., 1997; Verma and Aziz, 1997), which make the
handling of irregular shapes much easier. In case of Cartesian grids, control volume
methods and finite difference methods produce the same discretized equations. Finite
element methods (Young, 1978; Fung et al., 1991; Sukirman and Lewis, 1994) are
another option, but they are not widely used in the petroleum industry. The control
volume formulation is used in GPRS.
Reservoir flow equations are a series of nonlinear equations, which are normally
solved by the Newton-Raphson method, where a Jacobian matrix and a right hand side
(RHS) are calculated at each Newton iteration. In this section we will first introduce the
control volume compositional formulation (since compositional simulation is one of the
major focuses of this research), then we will show the general structure of the Jacobian
matrix. In the following several sections, we will discuss the calculation of each
individual part of the Jacobian matrix.
The control volume method is based on mass balance over a control volume. The
mass accumulation in a control volume is equal to the flux (mass flowing in from its
boundary) minus the production (mass produced from a well that maybe in the block,
injection is negative). Control volume could be of any shape, for most unstructured grids,
it is a polyhedron, like the one shown in Figure 2.3.
Figure 2.3 A general polyhedron
32
The volume of this polyhedron is V, and it has ns surfaces. The rate of mass accumulation
of component c can be expressed as
t
X S X S
V ACC
p
n
cp p p
n
p
n
cp p p
n
c


=
∑ ∑
+ +
) ( ) (
1 1
ρ φ ρ φ
(2.1)
where,
cp
X is the mole fraction of component c in phase p.
The total flux is the sum of the fluxes across each of its ns surfaces, which can be written
as

=
=
ns
s
c s c
Flux Flux
1
,
(2.2)
Flux across surface s is calculated as

=
p
s cp p p c s
X v Flux ) (
,
ρ (2.3)
where,
s p
v
,
is the phase volumetric flow rate across surface s. According to Darcy’s law,
it is equal to
s p p s p
T v ) (
,
∆Φ = λ (2.4)
where,
s
T the transmissibility constant across surface s, and
s p,
∆Φ is the phase potential
difference across surface s. By substituting Eqn. 2.4 and Eqn. 2.3 into Eqn. 2.2, we get
the expression for the total flux:
∑ ∑
=
∆Φ =
ns
s p
s p cp p p s c
X T Flux
1
] ) ( [ ρ λ (2.5)
The component mass produced from a well can be expressed as

=
p
W
p cp p
W
c
q X Q ) (ρ (2.6)
where,
W
p
q is the phase volumetric production rate from the well, which can be written as
) (
W
p p
W W
p
p p WI q − ⋅ = λ (2.7)
33
where,
W
WI is the well index (Peaceman, 1978), a constant,
p
p is the phase pressure of
the well block and
W
p is the wellbore pressure for the well in the well block.
Substituting Eqn. 2.7 into Eqn. 2.6, we get

− ⋅ =
p
W
p cp p p
W W
c
p p X WI Q )] ( [ ρ λ (2.8)
Combining Eqn. 2.1, Eqn. 2.5 and Eqn. 2.8, we get the final control volume
compositional formulation:
∑ ∑ ∑
∑ ∑
+
=
+ +
− ⋅ + ∆Φ =


p
n n W
p cp p p
W
ns
s p
s p cp p p s
p
n
cp p p
n
p
n
cp p p
n
p p X WI X T
t
X S X S
V
1 ,
1
1 1
)]} ( [ ] ) ( [ {
) ( ) (
ρ λ ρ λ
ρ φ ρ φ
(2.9)
Note that each of the terms in the flux part and the well part can be evaluated at either
timestep n or timestep n+1, depending on the implicitness of the model. Normally there
is only one well passing through a control volume, if there are more, all of the well fluxes
are summed.
Using the Newton-Raphson method, the Jacobian matrix is generated by calculating
the derivatives of Eqn. 2.9 with respect to all of the unknowns (variables). In GPRS, the
Jacobian matrix is calculated and stored separately for the reservoir part (accumulation
and flux terms) and for the well part, and it is later pieced together only in the linear
solver module.
The structure of the reservoir part of the Jacobian is shown in Figure 2.4a. Basically it
consists of three arrays, Diag, OffD_A and OffD_B. Diag is the diagonal part, each of its
entries is for one gridblock, and the location of each entry follows the cell list. OffD_A
records the sparse structure of the upper triangular part, and OffD_B records the sparse
structure of the lower triangular part. Each of their entries is for one connection, and the
location of each entry follows the connection list. For example, for a connection between
gridblock A and B (A<B), OffD_A stores the derivative of equations of gridblock A with
respect to variables of gridblock B, and it is located at (A, B) of the Jacobian matrix.
Similarly OffD_B at (B, A) contains the derivatives of equations of gridblock B with
34
respect to variables of gridblock A. For multi-point flux, OffD_A and OffD_B will
include more entries, we will discuss this in Section 2.4. For Jacobian calculations of the
reservoir part, the accumulation part and the flux part are further separated. The
accumulation part loops through the cell list, and it only adds terms in the Diag array; the
flux part loops through the connection list, and it contributes to all three arrays. For
multi-component system, each of the entries in these arrays is a small dense matrix.
The general structure of the well part of the Jacobian for a single well is shown in
Figure 2.4b. Additional wells introduce additional rows and columns. Here besides the
reservoir variables, each well may introduce an extra well variable, which is normally the
well bottom hole pressure (BHP). From Figure 2.4b, we can see that the well part of the
Jacobian consists of four arrays, RRJ, RWJ, WRJ and WWJ. RRJ represents the
derivatives of well terms in Eqn. 2.9 with respect to the reservoir variables, which are
always located at the diagonal, and only have entries at the well blocks. RWJ represents
the derivatives of well terms in Eqn. 2.9 with respect to the well variable. This extra well
variable is only necessary for some types of wells, such as wells under constant rate
control, and in that case, an extra well equation is needed to complete the system. WRJ
and WWJ represent the derivatives of this extra well equation with respect to the reservoir
variables and the well variable respectively. Each entry in RRJ is normally a small dense
matrix, for RWJ, it is a column vector, for WRJ, it is a row vector and for WWJ, it is a
single value.
a) reservoir b) well
Figure 2.4 General structure of the Jacobian matrix
OffD_A
OffD_B
Diag
WWJ
RWJ
WRJ
RRJ
35
In order to make the structure of the Jacobian matrix clearer, a simple two-well example
is included here. The grid is shown in Figure 2.5. Well 1 is completed in gridblocks 1 and
2, and well 2 is completed in gridblocks 16, 13 and 10. The corresponding Jacobian
matrix for this system is shown in Figure 2.6, where “A” represents a term generated by
the accumulation part, “F” represents a term generated by the flux part, and “W”
represented a term generated by the well part. The color in Figure 2.6 represents the
storage, and same colored items are stored in the same array.
Figure 2.5 A simple unstructured grid with wells
1
2
3
4
16
17
15
14
13
12
11
10
6
5
7
8
9
36
Figure 2.6 Jacobian matrix structure for the system in Figure 2.5
AFW F F F W
F AFW F F F W
F AF F F
F AF F F
F F F AF F F F
F F F AF F F F
F F AF F
F F AF F F F
F F F AF F F F
F F F AFW F F W
F AF F F
F F F AF F F F
F F F AFW F F F W
F F AF F
F F AF F
F F F AFW F W
F F F AF
W W W
W W W W
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 W1 W2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
W1
W2
37
2.3 Network Modeling
In Chapter 1, we have mentioned that there are two kinds of methods for grid
representation, the block based approach and the connection based approach (Lim et al.,
1994), also called network modeling. Traditionally, the block based approach has been
used, where the connections (fluxes) are associated with blocks, but the number of
connections for a gridblock may vary depending on the geometry of the gridblock, as in
the case for unstructured grids. In addition, local grid refinement may increase the
number of connections. As a result, each gridblock may have different number of
neighbors. An array keeping track of the connected gridblocks has to be dynamically
dimensioned for each gridblock, (or dimensioned for the largest possible case). Figure 2.7
shows a simple example of the conventional gridblock tracking array. The number of
connections for each gridblock varies between two and four. From Figure 2.7, we can see
that the block based connection information is also redundant, each of the connections
actually appears two times. The number of connections is even higher if a nine-point
scheme is used (Yanosik and McCracken, 1979; Sammon, 1991). In general, the block-
based approach becomes very inconvenient for these cases.
Figure 2.7 Gridblock connection array when the block based approach is used
The computation of flux terms is only necessary when pairs of gridblocks are
connected. Furthermore, it is obvious that a positive flux into a given gridblock
automatically implies a negative flux for the other connected block. This means that the
flux is only a property of individual connections, not gridblocks. So the key idea in the
connection based approach is to focus on connections instead of gridblocks when
4
7 6
5
1 2
3
Block Connections
1 2, 3
2 1, 4, 5
3 1, 4, 6
4 2, 3, 5, 6
5 2, 4, 7
6 3, 4, 7
7 5, 6
38
computing flux terms. The first major task in the connection-based approach is to
establish an array map or data structure containing all possible pairs of connections. As
an example, the gridblock connections in Figure 2.7 can be rearranged into a list of
connection pairs, shown in Figure 2.8. The first gridblock index in a connection pair is
always smaller than the second gridblock index, in order to avoid redundancy. Once the
connection array has been established, the computation algorithm in the flux part is
exactly the same for any dimensional problems, since a connection is basically a line
connecting two points, which is always one-dimensional. This connection-based
approach is very convenient for unstructured grids, instead of tracking the number of
connections for each gridblock, we track the connections for the whole domain.
Figure 2.8 Connection array when the connection based approach is used
The connection-based approach is used in GPRS, and the following modifications are
made to make it more suitable for unstructured grid simulation and modeling of wells and
surface facilities:
• Add in cell list Traditionally, gridblocks (cells) are represented by three-dimensional
(i, j, k) indices, instead of that, a one-dimensional index (cell list) is used in GPRS,
which can be calculated as
x y
n n k j i ⋅ ⋅ + + ) ( for structured grids, where
x
n and
y
n
are number of gridblocks in x and y directions. Doing that, the computational
algorithm in the accumulation part is exactly the same for any dimensional problem,
and the whole simulator becomes independent of the grid type and dimensions. This
4
7 6
5
1 2
3
Connection No. Connected pairs
1 1, 2
2 1, 3
3 2, 4
4 2, 5
5 3, 4
6 3, 6
7 4, 5
8 4, 6
9 5, 7
10 6, 7
39
approach also saves some memory by reducing a three-dimensional indexing array to
a one-dimensional indexing array.
• Reservoir only connection list In Lim et al. (1994), the connections are between two
nodes, each node can be a reservoir node (gridblock), a well node (wellbore) or a
surface node (surface facility), which is the most general connection based approach.
But the reservoir, the well and the surface facilities, each have their own
characteristics. This leads to different kinds of calculations and different kinds of
structures in the Jacobian matrix for each part of the system. Hence the connection
list in GPRS is only for the reservoir part, the well part and the surface facility part
are treated separately. The advantage is that the structure of the Jacobian matrix is
preserved, and this structure can be used later by the linear solver to improve its
efficiency. This approach also makes the algorithm clearer and easier to understand.
The procedure for the reservoir part of the Jacobian matrix and residual calculation
using this modified connection based approach is as follows:
1. First, loop through the cell list, and evaluate the accumulation terms and their
derivatives for each gridblock. The accumulation terms are assigned to the residual,
and the derivatives are assigned to the diagonal of the Jacobian matrix at the
corresponding gridblocks.
2. Next, loop through the connection list, calculate the upstream direction for each phase
and evaluate the flux terms and their derivatives for each connection. The flux terms
are added to the residual of the connected blocks, one is positive and the other is
negative, the derivatives are added to the correct locations in the Jacobian matrix, as
shown in Figure 2.9 for a two-point flux calculation. Flux F
AB
is from gridblock A to
gridblock B, X
A
and X
B
are the variables at gridblock A and B, and F
A
and F
B
are the
equations at gridblock A and B.
A
AB
X
F


and -
B
AB
X
F


are stored in Diag, and
B
AB
X
F


is
stored in OffD_A, and -
A
AB
X
F


is stored in OffD_B.
40
Figure 2.9 Jacobian structure for two-point flux derivatives
2.4 Multi-Point Flux Representation and Implementation
In the last decade, with the development of unstructured grids and upscaling methods,
more and more simulations are using non-orthogonal grids and full tensor permeabilities.
For these kinds of simulations, multi-point flux approximations (Gunasekera et al., 1998;
Verma and Aziz, 1996) are necessary. At the same time, computers are becoming more
powerful, and new techniques (e.g. Edwards, 1998) are being developed to reduce the
cost of multi-point flux simulation, both of them make multi-point flux approximation
more practical.
The connection-based approach was originally proposed for two-point flux. We
generalize it to multi-point flux. In this section, first we will compare the differences
between two-point flux and multi-point flux calculations, then we will show the
algorithm used for multi point flux calculations. Two-point flux and multi-point flux are
different in three areas: representation, upstream direction calculation and Jacobian
matrix structure.
• Representation In two-point flux, a connection between two gridblocks only
depends on these two gridblocks, generally, each connection can be represented in
C++ by “int A, int B, double T”, which means that there is flow (connection) between
gridblocks A and B and the transmissibility constant for this connection is T. Two-
point flux can be calculated as
) ( ) ( 2 _
, , | , A p B p B A cp p p AB p c
X T P Flux Φ − Φ = ρ λ (2.10)
AB
F
AB
F −
RHS
A
AB
X
F


A
AB
X
F



B
AB
X
F


B
AB
X
F



X
A
X
B
F
A
F
B
Jacobian
A B
F
AB
41
But in multi-point flux, a connection between two gridblocks may depend on np
(>=2) gridblocks. For structured grids, np is fixed, such as np=6 for two-dimensional
Cartesian grid and np=18 for three-dimensional Cartesian grid (Verma, 1996). But for
unstructured grids, it is not fixed, and there is no upper limit to it. A multi-point
unstructured connection is represented by “int np, int *A, double *T” in GPRS, which
means that there is a connection between gridblocks A[0] and A[1], and its flux
depends on np gridblocks, which are A[0], A[1] … A[np-1], and the transmissibility
constant assigned to each gridblock is T[0], T[1] … T[np-1]. Multi-point flux can be
calculated as
) ] [ ( ) ( _
] [ ,
1
0
] 1 [ | ] 0 [ , l A p
np
l
A A cp p p p c
l T X MP Flux Φ ⋅ =


=
ρ λ (2.11)
There is no flow through a connection when phase potentials are equal, in order to
guarantee that, the transmissibility constants should satisfy
0 ] [
1
0
=


=
np
l
l T (2.12)
Using Eqn. 2.12 to remove T[0] from Eqn. 2.11, we can get
)) ( ] [ ( ) ( _
] 0 [ , ] [ ,
1
1
] 1 [ | ] 0 [ , A p l A p
np
l
A A cp p p p c
l T X MP Flux Φ − Φ ⋅ =


=
ρ λ (2.13)
Each individual term in the summation of Eqn. 2.13 is called a sub-connection.
Comparing Eqn. 2.13 with Eqn. 2.10, we notice that they are quite similar. If np=2,
and we define A[0] as A, A[1] as B, and T[1] as T, then Eqn. 2.13 reduces to Eqn.
2.10. This is because two-point flux is just a special case of multi-point flux, where
each connection only has one sub-connection.
• Upstream direction calculation In Eqn. 2.10 and Eqn. 2.13,
cp p p
X ρ λ should be
evaluated using conditions in the upstream block for each connection and for each
phase. In two-point flux, the phase upstream direction is solely determined by the
phase potential difference, and
cp p p
X ρ λ is evaluated as
42
¦
¹
¦
´
¦
≥ Φ − Φ
< Φ − Φ
=
0 , ) (
0 , ) (
) (
, ,
, ,
|
A p B p B cp p p
A p B p A cp p p
B A cp p p
if X
if X
X
ρ λ
ρ λ
ρ λ (2.14)
In multi-point flux, the phase upstream direction is determined by


=
Φ ⋅
1
0
] [ ,
) ] [ (
np
l
l A p
l T
or


=
Φ − Φ ⋅
1
1
] 0 [ , ] [ ,
)) ( ] [ (
np
l
A p l A p
l T , and
cp p p
X ρ λ is evaluated as
¦
¦
¹
¦
¦
´
¦
≥ Φ ⋅
< Φ ⋅
=



=

=
0 ) ] [ ( , ) (
0 ) ] [ ( , ) (
) (
1
0
] [ , ] 1 [
1
0
] [ , ] 0 [
] 1 [ | ] 0 [
np
l
l A p A cp p p
np
l
l A p A cp p p
A A cp p p
l T if X
l T if X
X
ρ λ
ρ λ
ρ λ (2.15)
Note,
cp p p
X ρ λ can only take the value at gridblock A[0] or A[1], not the other
gridblocks. Eqn. 2.15 can be reduced to Eqn. 2.14 if there are only two points (T[1] is
always positive for flux between A[1] and A[0]).
• Jacobian matrix structure If a multi-point flux approximation is used, we will have
many more off diagonal terms in the Jacobian matrix, and the computational cost will
be much higher. For structured grids, bands for the Jacobian matrix will increase from
5 to 9 in two dimension, and from 7 to 27 in three dimension. For unstructured grids,
the structure of the Jacobian matrix becomes more complicated with more non-zero
terms.
We have reviewed the differences between two-point flux and multi-point flux, next
we will show the reservoir part of the Jacobian matrix and residual calculation for the
multi-point flux approximation. This is done by looping through the connection list. For
each connection, we first calculate the phase upstream directions, then loop through its
sub-connections and evaluate the flux terms and their derivatives for each sub-
connection. The flux terms are added to the residual of the connected blocks (A[0] or
A[1]), one is positive and the other is negative, the derivatives are added to the correct
locations in the Jacobian matrix, as shown in Figure 2.10 for a multi-point flux
calculation. Flux F
AB
is from gridblock A to gridblock B, and one of its sub-connections
is related to gridblock C. X
A
, X
B
and X
C
are the variables at gridblock A, B and C. F
A
and
43
F
B
are the equations at gridblock A and B.
A
AB
X
F


and -
B
AB
X
F


are stored in Diag,
B
AB
X
F


and
C
AB
X
F


are stored in OffD_A, and -
A
AB
X
F


and -
C
AB
X
F


are stored in OffD_B. Note, in
the multi-point flux calculations, the number of entries in OffD_A and OffD_B equals the
total number of sub-connections, and OffD_A is no longer strictly upper triangular and
OffD_B is no longer strictly lower triangular.
Figure 2.10 Jacobian structure for multi-point flux derivatives
2.5 Well Treatment
We have discussed how the reservoir part of the Jacobian matrix and RHS are calculated
in GPRS, now we will discuss the well part. From Section 2.2, we know that the well part
of the Jacobian includes four arrays, RRJ, RWJ, WRJ and WWJ. RRJ and RWJ are the
derivatives of well terms in flow equations with respect to the reservoir variables and the
well variable respectively. WRJ and WWJ are the derivatives of the extra well equation
with respect to the reservoir variables and the well variable respectively. RRJ is always
needed, while the existence of RWJ, WRJ and WWJ depends on well control. In this
section, we will first discuss the calculation of RRJ, then we will discuss when an extra
well equation and a corresponding well variable are needed. Well equations used in
GPRS for the black-oil and the compositional models will be presented next.
RRJ always exists, and it is a block diagonal matrix with only non-zero terms at the
well blocks. After it is calculated, it can be directly added to the reservoir part of the
AB
F
AB
F −
RHS
X
A
X
B
F
A
F
B
X
C
A
AB
X
F


A
AB
X
F



B
AB
X
F


B
AB
X
F



C
AB
X
F


C
AB
X
F



Jacobian
C
A B
F
AB
44
Jacobian without introducing any extra non-zero terms. In Section 2.2, the well equation
was written as

− ⋅ =
p
W
p cp p p
W W
c
p p X WI Q )] ( [ ρ λ (2.8)
where,
W
WI is the well index,
p
p is the phase pressure of the well block and
W
p is the
wellbore pressure. If this well has multiple perforations, we need to relate
W
p to the
pressure at a reference depth. We assume variable gradient and no friction in GPRS, and
use the following relation to calculate the wellbore pressure at well block i:

=
− −
− − − − − − −
− − −
− + + =
=
− + + − + + =
− + + =
i
l
l l
W
l
W
l
W
i i
W
i
W
i i i
W
i
W
i
W
i
i i
W
i
W
i
W
i
W
i
D D g p
D D g D D g p
D D g p p
1
1 1 0
1 1 2 1 1 2 2
1 1 1
) )( (
) ( ) ( ) ( ) (
) ( ) (
ρ ρ
ρ ρ ρ ρ
ρ ρ
" "
(2.16)
Here the reference depth is defined at the first well block, and the wellbore pressure at
this depth (
W
p
0
) is normally called the well bottom hole pressure (BHP).
W
i
ρ is the total
fluid density within the wellbore at well block i, which can be calculated as (Nolen,
1990)


=
p
W
i p
p
i
W
p p
W
i
q
q
,
) (ρ
ρ (2.17)
W
i p
q
,
is the phase volumetric production rate of this well at well block i, which is
calculated from Eqn. 2.7. Combining Eqn. 2.8, Eqn. 2.16 and Eqn. 2.17, we can easily
see that, if the well bottom hole pressure
W
p
0
is fixed, well term will only depend on the
reservoir variables. If needed, the well bottom hole pressure will be the extra well
variable. RRJ is the derivatives of Eqn. 2.8 with respect to the reservoir variables for a
fixed well bottom hole pressure.
The existence of RWJ, WRJ and WWJ depends on whether we need an extra well
equation and well variable. For a BHP controlled well, where
W
p
0
is fixed, Eqn. 2.8 only
depends on the reservoir variables, RWJ is zero, and there is no need for WRJ and WWJ.
45
RRJ by itself is already complete. After we solved for the reservoir variables, the well
phase production rates can be explicitly calculated from Eqn. 2.7. For other types of well
controls, such as constant phase volumetric flow rate control (at well head or well
bottom), the BHP of a well is not fixed, we have the extra well variable, and we need an
extra well equation to complete the system. The well equation depends on both the
desired control at the well and the fluid model (black-oil or compositional). Here we only
review the well equations used in GPRS.
Currently, only two types of well controls are implemented in GPRS, BHP control
and constant phase volumetric flow rate (at standard conditions) control. An extra well
equation and variable are needed for constant phase flow rate controlled wells. The extra
well variable is always the well bottom hole pressure, the extra well equation is different
for black-oil and compositional models, and both of them are based on component mass
balance within the well bore. As shown in Figure 2.11, there is flow from the well bottom
to the well head, and the well could have multiple perforations.
Figure 2.11 Wellbore flow
Well head
Well bottom
46
Assuming steady state flow in the well, the component mass flow rate at the well bottom
(summation for all well blocks) should be equal to the component mass flow rate at the
well head, which can be expressed as
∑∑
= −
l p
WH
c
W
l l p l p c l p l p l
Q p p X WI ) (
, , , , ,
ρ λ (2.18)
where,
WH
c
Q is the mass flow rate of component c at the well head. Since the extra well
equation is different for black-oil model and compositional model, they are discussed
separately, using a constant oil phase flow rate controlled well as an example.
• Black-oil model Components in black-oil systems are defined as phases at standard
conditions (well head). In order to avoid confusion between components and phases,
we will use a superscript “-“ to indicate components whenever necessary. At the well
head, black-oil components and phases are equivalent to each other, and the
component mass flow rate should equal the phase mass flow rate, which can be
expressed as
WH
o SC o
WH
o
WH
o
WH
o
WH
o
q q Q Q ⋅ = = =
,
ρ ρ (2.19)
Substituting Eqn. 2.18 into Eqn. 2.19 and rearranging, we get
0
) (
,
, , , , ,
= −

∑∑
WH
o
SC o
l p
W
l l p l p o l p l p l
q
p p X WI
ρ
ρ λ
(2.20)
where,
WH
o
q is the fixed oil phase volumetric flow rate at the well head, and
SC o ,
ρ is
the oil component density at the standard condition, which is an input property. For
black-oil models, Eqn. 2.20 is the extra well equation used in GPRS.
• Compositional model Things become a bit more complicated for the compositional
model. Here, well head is actually a separator which operates at standard conditions.
The input to this separator is the total mass flow from the well (summation of
WH
c
Q
over all c), the output is the individual phase flow at standard conditions. For constant
oil phase flow rate, we have the following relation for the oil phase mass flow rate:
SP
o
SP
o
c
WH
c
SP
q Q l ⋅ = ⋅

ρ (2.21)
47
Substituting Eqn. 2.18 into Eqn. 2.21 and rearranging, we get
0 ) ( ) (
, , ,
= − ⋅ −
∑∑
SP
o SP
o
SP
l p
W
l l p l p l p l
q
l
p p WI
ρ
ρ λ (2.22)
where,
SP
o
q is the fixed oil phase volumetric flow rate (output of the separator), and
SP
o
ρ is the oil phase density at the separator, and
SP
l is the hydrocarbon liquid (oil)
mole fraction at the separator. To get
SP
o
ρ and
SP
l , the overall hydrocarbon
component mole fractions at the separator are first calculated as

=
=
h
n
i
WH
i
WH
c c
Q Q z
1
/ (2.23)
then a flash calculation is performed at standard condition and fixed
c
z . For
compositional models, Eqn. 2.22 is the extra well equation used in GPRS.
Water component is fully separated from the hydrocarbon components in GPRS. So, for
fixed water flow rate controlled wells, the extra well equation is always
0
) (
,
, , ,
= −


WH
W
SC w
l
W
l l p l w l w l
q
p p WI
ρ
ρ λ
(2.24)
For injectors, each phase mobility is replaced by the total mobility or the injected
phase volume fraction weighted phase mobility (Almehaideb and Aziz, 1989; Nolen,
1990; Coats et al., 1998). In GPRS, for multiphase injection the mobility of the injected
fluid is calculated as the volume fraction ( )
p
E of that fluid multiplying the total mobility
of fluid in the injector block (Almehaideb and Aziz, 1989), which can be written as

=
p
p p
inj
p
E λ λ (2.25)
The component mass balance within the wellbore is only for the injected components,
and the total mass flow rate is only the summation over the injected components,
correspondingly RRJ and RWJ are only calculated for the flow equations of the injected
components.
48
Sometimes, after the reservoir part of the Jacobian and the well part of the Jacobian
have been combined, RWJ can be eliminated without introducing any extra terms, such as
for single block wells with constant rate control. With this, we can solve for the reservoir
variables first and explicitly update the well variable later. The details of this operation
are shown in Section 3.2. For multi-block wells with constant rate control, RWJ can also
be eliminated, but it will introduce some extra non-zero terms in RRJ. For this reason, it
is preferable not to perform elimination on RWJ for this kind of wells.
2.6 Flash Calculation and Treatment of Phase Disappearance and Reappearance
Flash calculations are necessary in compositional simulation, and for this we need to
select an equation of state and phase equilibrium relations. In this section, first we will
discuss the equation of state and phase equilibrium relations used in GPRS, then we will
discuss the two different roles that flash calculations play in GPRS, finally we will show
the treatment of phase disappearance and reappearance in GPRS.
The Cubic equation of state used in GPRS can be written as (e.g., Nghiem et al.,
1983; Walas, 1985)
0
2 3
= + + + r qZ sZ Z (2.26)
where,
¦
¹
¦
´
¦
− − − =
− − + =
− − =
3 2
2
) (
1 ) 1 (
wB wB AB r
uB B u w A q
B u s
Parameters u and w depend on the cubic equation of state selected. For the Peng-
Robinson EOS (Peng and Robinson, 1976), u=2 and w=-1. Z is the phase compressibility
factor, which is one of the three roots of Eqn. 2.26. For the oil phase, the minimum real
root is used, and for the gas phase, the maximum real root is used.
At phase equilibrium, we have the following relation:
,
, , g c o c
f f = c = 1,…,
h
n (2.27)
where,
o c
f
,
and
g c
f
,
are the fugacities of component c in the oil and gas phases. For the
Cubic equation of state they are calculated as (Walas, 1985)
49
c
e pX f
p c p c
Φ
=
, ,
, p = o or g, (2.28)
]
) 4 ( 2
) 4 ( 2
ln[ )
1
(
4
) ln( ) 1 (
2
2
,
2
w u u B Z
w u u B Z
X
a
a b
b
w u B
A
B Z Z
b
b
p c
c
c
c
− − +
− + +





− − − = Φ
(2.29)
where,
¦
¦
¹
¦
¦
´
¦
=
− =

∑∑
=
= =
h
h h
n
c
c p c
n
j
n
i
j i j i p j p i
b X b
a a k X X a
1
,
1 1
, , ,
) 1 (
and
¦
¦
¹
¦
¦
´
¦
=
=
RT
bp
B
T R
ap
A
2 2
(2.30)
Appendix C defines all parameters and provides the formulas and derivatives used for
flash calculations.
Eqn. 2.27 is used in two ways in GPRS, as a constraint equation to relate the
secondary variables to the primary variables and as a separate flash routine to check the
state of hydrocarbon phase in a block. These two tasks are discussed next.
• As a constraint equation Flow equations are the primary equations, they depend on
both the primary variables and the secondary variables. To form a complete system,
we need some constraint equations to remove the secondary variables from the
primary equations. Phase equilibrium relations (Eqn. 2.27) are our secondary
equations, which also depend on both the primary variables and the secondary
variables. They can be used as the constraint equations to build relations between the
secondary variables and the primary variables. This role for flash calculations is only
necessary when both hydrocarbon phases exist in a gridblock. For gridblocks with
only one hydrocarbon phase, half of the phase variables disappear, and the primary
equations depend only on the primary variables. For example, for a gridblock with
only gas and water phases, the mass balance equations will only depend on p ,
g
S
and 1 , , 1 , − =
h c
n c y … . When this is the case, there is no need for constraint
equations.
• As a separate flash routine For gridblocks with only one hydrocarbon phase, the
primary equations depend only on the primary variables, and there are no need of
50
secondary equations. But sometimes, a single hydrocarbon phase can change back to
both hydrocarbon phases, and the secondary equations are needed again. So we need
to monitor the state of hydrocarbon phases when a gridblock has only one
hydrocarbon phase. This is done by a separate flash routine. A simple successive
substitution flash routine is used in GPRS, which is similar to the one shown in
Subsection 1.2.2. To speed up the convergence, the values of
c
K and l at the old
Newton iteration are used for the initial guess.
From the above discussion, we can see that flash calculations play different roles
under different situations. In order to distinguish these situations, we need to detect the
disappearance and reappearance of hydrocarbon phases. For models using the natural
variables (variable Type A), treatment of phase disappearance and reappearance is also
needed for choosing the correct phase variables. Phase disappearance and reappearance
are detected in GPRS and treated as described below:
• Phase disappearance When a gridblock has two hydrocarbon phases, for each
Newton iteration, we check the saturation solutions. If either S
o
or S
g
is negative, the
corresponding hydrocarbon phase has disappeared. In this case, before initialing the
next Newton iteration, we first set the negative saturation to zero, then assign the
overall hydrocarbon component mole fractions (
c
z ) to component mole fractions in
the oil or gas phases (
c
x and
c
y ), finally mark this gridblock as a single hydrocarbon
phase gridblock.
• Phase reappearance When a gridblock has only one hydrocarbon phase, at the end
of each Newton iteration, we do a negative flash (Whitson and Michelson, 1986),
pressure and overall hydrocarbon component mole fractions are the inputs. If l is
between 0 and 1, then both hydrocarbon phases exist, and before initializing the next
Newton iteration, we first assign the hydrocarbon phase saturations as
g
o
w
o
l
S
S
ρ
ρ
) 1
1
( 1
1
− +

= (2.31)
w o g
S S S − − = 1 (2.32)
51
then set component mole fractions in the oil and gas phases (
c
x and
c
y ) from the
results of flash calculation, finally mark this gridblock as a both hydrocarbon phase
gridblock.
In compositional simulations, flash calculation is a very important part, and it could
account for up to 30% of the total running time. The flash routine used in GPRS is quite
simple, and a more robust and efficient flash routine is needed.
2.7 Linear Solver
In GPRS, the Jacobian matrix is calculated and stored separately for the reservoir part
and for the well part, and it is later pieced together only in the linear solver part. This
approach basically separates the solving of the linear system from the building of the
linear system, and creates a separate linear solver module. All we need to do is to
transform the Jacobian structure of GPRS into the specific format that a linear solver
requires. In this way we can easily interface with available linear solvers, such as
BlitzPak (Landmark, 1998), we can also develop and use our own solvers.
Both direct and iterative solvers are used in GPRS. The direct solvers included are a
full matrix solver and a band matrix solver, both are quite slow and memory consuming,
and can only be used for small systems. For iterative solvers, we use a Generalized
Minimum Residual (GMRES) (Saad and Schultz, 1986) solver, which is suitable for any
sparse matrix system. For large problems, iterative solvers are memory efficient and
much faster than direct solvers. For iterative solvers, preconditioners are used to speed up
the convergence. The performance of iterative solvers depends on the robustness of the
preconditioners. The following preconditioners are included in GPRS, ordered according
to their robustness: a) diagonal scaling; b) block diagonal scaling; c) Incomplete LU
decomposition (ILU0) (e.g. Behie and Forsyth, 1983); d) Algebraic Multi-Grid (AMG)
(Stueben, 1983), which is only suitable for the pressure system; and e) Constrained
Pressure Residual (CPR) (Wallis et al., 1985), which is our best preconditioner. GPRS
also has an interface to BlitzPak, which is a commercial linear solver package from
Landmark Graphics Corporation. BlitzPak is only suitable for structured grids, where the
52
Jacobian matrix has up to 7 bands, while GMRES (Saad and Schultz, 1986) in GPRS is
suitable for any grid and any sparse matrix system. For GPRS, BlitzPak is the fastest for
structured grids, and CPR preconditioned GMRES is the best for unstructured grids.
For the preconditioners used in GPRS, only CPR is specially designed for reservoir
simulation equations, and it is also the best preconditioner in GPRS. CPR is a two stage
preconditioner. In the first stage we decouple the full system into a pressure part and a
saturation part using an IMPES-like decoupling process, and solve for pressure from the
pressure part (AMG preconditioned GMRES is used for the pressure solve), then we use
the pressure solutions to reduce the residual of the full system. In the second stage we
start from the reduced residual and work on the remaining decoupled system, and use a
local preconditioner, such as ILU0, to get the full solutions for the reduced residual. The
final solution is the first stage pressure solutions plus the second stage full solutions. CPR
performs very well for all kinds of problems, including problems that are hard for
IMPES. CPR is more suitable for fully implicit systems.
y = 8E-06x
1.1552
y = 3E-05x
1.0824
0.1
1
10
100
1.E+03 1.E+04 1.E+05 1.E+06
number of unknowns
t
i
m
e
(
s
e
c
)
GPRS
BlitzPak
Trend (BlitzPak)
Trend (GPRS)
Figure 2.12 Performance comparison between GPRS solver and BlitzPak
53
Here we compare the performance of CPR preconditioned GMRES (GPRS solver)
with the performance of BlitzPak on different size problems. The results are shown in
Figure 2.12. We use a Cartesian grid, 4 component compositional problem. The problem
is solved fully implicitly. In Figure 2.12, we provide the trendlines using power relations.
For the GPRS solver, the power is about 1.08, for BlitzPak, the power is about 1.15. The
costs of both solvers are roughly linear with the number of unknowns, which is the best
we can get for a linear solver. The constant for the GPRS solver (3E-5) is larger than that
for BlitzPak (8E-6). This difference is due to the following two reasons: first GMRES in
GPRS does not make use of the 7 band structure of the Jacobian matrix, second the
components of the GPRS solver are from public domain software, which may not be very
efficient. Anyway, for large models, GPRS solver only takes about 50% more time than
BlitzPak. Considering that the GPRS solver is suitable for any grid system and any sparse
matrix, we can conclude that the solver in GPRS is reasonably efficient and robust.
In the solver part of GPRS, most of the components are from different public domain
software, such as the direct solvers are from LAPACK (Anderson, 1999), GMRES is
from Iterative Math Library (IML) (Dongarra et al., 1996), ILU0 is from SparseLib++
(Pozo et al., 1996), a sparse matrix package, and AMG is from GMD software (Ritzdorf,
1991).
The solvers and preconditioners in GPRS are appropriate for fully implicit and
IMPES systems (CPR is used to precondition the fully implicit system, and AMG is used
to precondition the IMPES system). But, for an adaptive implicit system, such as AIM,
most of the gridblocks are IMPES, only a small number of gridblock are fully implicit,
CPR loses its efficiency (spends too much time on the pressure solve at the first stage,
while the whole system is only a little bit larger than the pressure system), and AMG is
only suitable for the pressure system. More works is needed to develop suitable solvers
for AIM method.
For unstructured grids, the ordering of the cell list is quite important for the efficiency
of linear solvers, as shown in Section 2.1. Currently, there is no reordering done to the
cell list in GPRS. Additional work is needed to develop good ordering methods for the
cell list.
54
2.8 Timestep Control and Reservoir Initialization
Fully implicit models are unconditionally stable, and we can have a timestep of any size.
But in practice, in order to control the number of Newton iterations for each timestep, a
reasonable timestep size is required. For models that are not fully implicit, such as
IMPES, their maximum timestep sizes are limited by their stability. Section 3.3 derives
all of the stability criteria used in GPRS.
In GPRS, a maximum timestep size
MAX
t ∆ and a minimum timestep size
MIN
t ∆ are
specified by the user, and the timestep sizes for all models must satisfy Eqn. 2.33 at all
times:
MAX MIN
t t t ∆ ≤ ∆ ≤ ∆ (2.33)
The increasing or decreasing of timestep size from timestep n to timestep n+1 is governed
by the following relation (Aziz and Settari, 1979):
i over
i i
i n n
t t
min
1
) 1 (
(
¸
(

¸

+
+
∆ = ∆
+
ωη δ
η ω
(2.34)
where i refers to the gridblock number,
i
η is the specified desired change,
i
δ is the
change over
n
t ∆ and ω is a tuning factor with a value between 0 and 1. Normally
i
η and
i
δ have different values for different variables, so a different
1 +

n
t is calculated for each
variable and the minimum of all
1 +

n
t is used for the next timestep. Typical values of η
used in GPRS are:
Psia
p
200 = η , for pressure
2 . 0 =
S
η , for saturations
02 . 0 =
X
η for component mole fractions
The timestep sizes of fully implicit models are decided solely by Eqn. 2.33 and Eqn. 2.34.
The timestep sizes of partially implicit models are governed not only by Eqn. 2.33 and
Eqn. 2.34, but also by their stability criteria.
At the start of simulation, we need to assign initial values to reservoir variables
(pressure, saturations and component mole fractions). For black-oil models, the
55
procedure mentioned in Aziz (1996) is used, and it guarantees initial equilibrium of
reservoir fluids. For compositional models, the following procedure is used:
1. Assign the same initial pressures (pressure at a reference depth) to all gridblocks.
2. Assign initial water saturations for all gridblocks. If a gridblock is below the water-oil
contact (WOC), assign 1, otherwise assign connate water saturation.
3. Assign initial overall compositions
c
z for all gridblocks. Initial overall compositions
are inputted as an overall composition vs. depth table, and a table look up is
performed for each gridblock to decide its initial overall compositions.
4. Assign initial component mole fractions in the oil and gas phases,
c
x and
c
y for all
gridblocks. A flash calculation is performed at constant pressure, temperature and
overall compositions
c
z for each gridblock. The resulting
c
x and
c
y are assigned to
each gridblock. At the same time, the oil and gas phase densities,
o
ρ and
g
ρ , and the
hydrocarbon liquid mole fraction l are calculated for each gridblock.
5. Assign initial oil and gas saturations for all gridblock as
g
o
w
o
l
S
S
ρ
ρ
) 1
1
( 1
1
− +

= (2.35)
w o g
S S S − − = 1 (2.36)
6. Reassign initial pressures for all gridblock according to depth:
) ( ) (
0 0
D D g S p p
i
p
i p p i
− + =

ρ (2.37)
where
0
p is the pressure at reference depth
0
D .
If necessary, step 4-6 are repeated to achieve better initial equilibrium. The effect of
capillary pressure is ignored in this procedure.
If the initial overall composition vs. depth table reflects real conditions in the
reservoir, the calculated initial equilibrium is good. Otherwise the initial condition will be
far from equilibrium, such as for the case when the same initial overall composition is
used for all depths.
56
57
Chapter 3
General Formulation Approach
One of the objectives of this research is to evaluate the performance of different
isothermal compositional models. In order to make the implementation of these models
easy and consistent, a new General Formulation Approach is developed, which can be
used to derive any kind of model (different equation and variable selections and different
implicit levels). With this approach, we can minimize differences among different
models, quickly change from one model to another model, and evaluate their
performance in a consistent manner. This General Formulation Approach also enables us
to develop and try out new models, and it is also suitable for other types of simulators,
such as thermal simulators. This new approach is designed to solve a general nonlinear
equation set. In this study, we have only explored its application to isothermal
compositional models.
To better understand the steps involved in this General Formulation Approach, it is
worthwhile to first review some of the important points about compositional simulation
discussed in Chapter 1:
• Reservoir simulation involves a large number of coupled nonlinear equations.
Complexity of the mathematical model increases dramatically from black-oil to
compositional models. For compositional models, direct solution of this large system
(full set of equations and variables) is almost impossible, due to the high
computational and memory requirements.
• There is no need to solve all of the coupled equations together. For each type of
simulation, there is a minimum number of independent variables and equations
(primary variables and equations) that determine the thermodynamic state (intensive
and extensive) of the system. For isothermal compositional system, this
thermodynamic state is determined by
c
n variables, or the number of components in
the system. By solving for this minimum number of variables first (fully implicit
58
models), we can save a large amount of computational time. Even so, this approach is
still too expensive for large problems.
• In fully implicit (FIM) models all of the primary variables are treated implicitly. To
further reduce the cost of simulation, we can treat some primary variables explicitly,
and reduce the number of implicit unknowns per gridblock. Normally, such models
are much faster than FIM models, especially for problems with large number of
components. However, explicit treatment of some primary variables will limit the
maximum timestep size, if the maximum allowable timestep size is too small, such as
less than one day, such models could be even slower than FIM models. Explicit
treatment of some primary variables may also cause some balance errors (mass or
volume). There are numerical techniques to reduce or switch the balance errors
(Coats et al., 1998), but we cannot totally remove them.
Figure 3.1 Reduction process from full set to implicit primary set
In general, we should start with the full set of equations and variables, first reduce them
to the primary set (minimum number), then reduce the implicit level of the primary set to
further speed up the simulation if necessary, as shown in Figure 3.1. This two step
reduction process is included in the General Formulation Approach.
The full set of equations and variables are the starting point for this approach. In
Chapter 1, we already pointed out that, the full set of equations are always the mass
balance equations and the phase equilibrium relations, but the selection of the full set of
variables is not unique. GPRS uses the natural variables as its basic full set of variables to
Full Set of
Variables and
Equations
Primary
Set
Secondary
Set
Implicit
Explicit
59
facilitate the calculation of derivatives. If other sets of variables are needed, such as Type
B variables, we first build explicit relations between the new variables and the natural
variables, then use the chain rule to switch from the natural variables to the new
variables. This is actually the first step of the General Formulation Approach.
In summary, this General Formulation Approach includes three steps. First, we define
a base model which uses the natural variables, and build other models from this base
model by variable switching. Then, we reduce the full set to the primary set, and build the
FIM model. Finally, if necessary we further reduce the implicit level of the primary set.
Through these three steps, we control the variables used, and the implicitness of each
variable. These three steps are performed gridblock by gridblock, so each gridblock can
have different variables and different implicit levels. This provides a natural way to form
adaptive implicit schemes, such as the AIM model (Forsyth and Sammon, 1986).
In this chapter, we will first take a look at the general nonlinear equation set that
forms the basis of this approach. Then we will explain the operations involved in each of
the above three steps. Next we will do some stability analysis for the explicit treatment of
some primary variables. Finally we will discuss the consequences of using different kinds
of equations and variables.
3.1 The General Nonlinear Equation Set
In order to make this approach suitable for any kinds of simulations, we base it on the
most general nonlinear equation set, which can be expressed as
0 ) ( = X F
G G
(3.1)
where F
G
is the full set of equations, and X
G
is the full set of variables. This full set of
equations and variables can be split into a primary part and a secondary part:
¦
¹
¦
´
¦
=
=
0 ) , (
0 ) , (
s p s
s p p
X X F
X X F
G G G
G G G
(3.2)
where, subscript p stands for primary, and subscript s stands for secondary.
60
0
p
F =
G
is the primary equation set, and we always select the mass balance equations
for it. Its Jacobian matrix structure (derivatives of the mass balance equations with
respect to the full set of variables) looks like the one shown in Figure 2.4 and Figure 2.6,
here we have a reservoir Jacobian and a well Jacobian. The reservoir Jacobian has both
diagonal terms and off-diagonal terms. The well Jacobian includes four arrays, RRJ,
RWJ, WRJ and WWJ, and normally RRJ is added to the diagonal part of the reservoir
Jacobian. 0
s
F =
G
is the secondary equation set, we select the phase equilibrium relations
(a series of nonlinear constraint equations) for it. Since it only depends on individual
gridblocks, its Jacobian matrix will be a block-diagonal matrix. Combining the Jacobian
matrix of
p
F
G
and
s
F
G
, we have the Jacobian matrix for the full set of equations and
variables, which is shown in Figure 3.2.
Figure 3.2 Structure of the full set of Jacobian matrix and RHS
Here we define the following matrices:
p
p
X
F
A G
G


= ,
s
p
X
F
B G
G


= ,
p
s
X
F
C G
G


= ,
s
s
X
F
D G
G


= , (3.3)
and vectors:
p
F M
G G
− = ,
s
F N
G G
− = . (3.4)
A1 B1
C1 D1
A12 B12
0 0
A21 B21
0 0
A2 B2
C2 D2
diagonal Jacobian
A
RW
0
A
WW
A
WR
B
WR
…...
…...
…... …...
RHS
M1
N1
M2
N2
M
WW
…...
61
where A, B and M are generated by the primary equations, and C, D and N are generated
by the secondary equations. Each matrix or vector has its own storage array, and the
storage for matrices A and B is further separated into three parts (Diag, OffD_A and
OffD_B) as shown in Section 2.2. In this General Formulation Approach, we perform
operations on this full set Jacobian matrix, eliminate terms to zero level by level, and
finally extract a minimum set for the linear solver. All of the operations are done locally,
no additional storage is required.
This General Formulation Approach is applied to isothermal compositional models in
GPRS. We assume that the hydrocarbon components and water are totally separated, then
0
p
F =
G
will be the mass balance equations for each hydrocarbon component and for
water:
[ ]
0 ) (
)] ( [ ) (
, ,
= + +
∆Φ + ∆Φ − +


=


W
i
W
g c g
W
o c o
l
i l g c g g o c o o
i
c g g c o o i c
q y q x
y x T y S x S V
t
F
ρ ρ
ρ λ ρ λ ρ ρ φ
(3.5)
c = 1,…,
h
n
0 ) ( ) ( ) (
, ,
= + ∆Φ −


=
∑ ∑ i
W
w
W
w
l
i l w w w i w w i w
q T S V
t
F ρ ρ λ ρ φ (3.6)
Optionally, we can replace one of the hydrocarbon component mass balance equations by
a total hydrocarbon mass balance equation:
[ ]
0 ) (
)] ( [ ) (
, ,
= + +
∆Φ + ∆Φ − +


=


W
i
W
g g
W
o o
l
i l g g g o o o
i
g g o o i h
q q
T S S V
t
F
ρ ρ
ρ λ ρ λ ρ ρ φ
(3.7)
0
s
F =
G
will be the phase equilibrium relations:
0
, ,
= − =
g c o c e
f f F , c = 1,…,
h
n (3.8)
This full set of equations is used for all of the isothermal compositional models.
62
The basic full set of variables,
base
X
G
, are chosen to be
g
p p = ,
g
S ,
o
S ,
c
y ,
c
x , c = 1, 2, …
h
n -1
which are actually the natural variables, or Type A variables. For other variables, a
switch from the natural variables to the new variables is required. Here we have a total of
2
h
n +1 variables in 2
h
n +1 nonlinear equations. Capillary pressure constraints are used to
remove water and oil pressures, the saturation constraint is used to remove water
saturation, and component mole fraction constraints are used to remove the mole
fractions of the last hydrocarbon component in the oil and gas phases.
Black-oil models are treated as special cases of the general compositional model,
where secondary equations and variables are no longer needed and component mole
fractions are either constants or only functions of pressure, refer to appendix B for detail.
For thermal models,
p
F
G
will include the energy balance equation, and
p
X
G
will include
temperature or internal energy.
So far, we have shown the base model (the full set of equations in terms of the base
variables), which is also the starting point for the General Formulation Approach. In the
following section, we will explain the three steps of this approach. For each step, the
operations for the reservoir part and for the well part are discussed separately. Note that
RRJ of the well Jacobian is already added to the diagonal part of the reservoir Jacobian,
so it will not appear in the following discussion.
3.2 General Formulation Approach Steps
The first step of the General Formulation Approach is to switch from the base variables
to the new variables, and this step is only necessary when variables other than the natural
variables are used.
63
3.2.1 Switching From the Natural Variables to Other Variables
In GPRS, the base model uses the natural variables, and it is straightforward to calculate
derivatives with respect to these variables, and they are
base
X
F
G
G


. If another model using a
new set of variables X
G
is desired, then we must compute derivatives with respect to the
new variables
X
F
G
G


. We can do this by the chain rule:
X
X
X
F
X
F
base
base
G
G
G
G
G
G




=


(3.9)
where
X
X
base
G
G


can be calculated from the relation between X
G
and
base
X
G
. The whole
switching process is summarized below:
1. Build explicit relation ) (
base
X X X
G G G
= between X
G
and
base
X
G
, and calculate the
transformation matrix
1
) (



=


=
base
base
X
X
X
X
TRAN G
G
G
G
for each gridblock.
2. Calculate the new derivatives by TRAN
X
F
X
F
base



=


G
G
G
G
. This is done for all terms in
the reservoir Jacobian and for WRJ in the well Jacobian, and the results are stored
back in
base
X
F
G
G


.
3. Reduce the full set system to the final implicit primary set system (step 2 and 3 of the
General Formulation Approach)
4. Solve the new linear system and update explicit variables, get X
G
δ and update the new
variables by X X X
G G G
δ
υ υ
+ =
+1
5. Update the base variables
base
X
G
by solving the explicit relation ) (
base
X X X
G G G
= , which
may be nonlinear in some cases.
Different models will have different transformation matrices due to different relations
between the new variables X
G
and the base variables
base
X
G
, but the above five steps will
be exactly the same. Next we will review examples of new variables, and express each of
64
them in terms of the base variables. Based on a review of existing compositional models,
the possible choices for X
G
(besides the base model variables) are identified as:
w
S , water saturation
h
n
x ,
h
n
y , mole fraction of the last hydrocarbon component in the oil and gas
phases
c
z , overall mole fraction of each hydrocarbon component
c
r , overall density of each hydrocarbon component
w
r , overall density of water component
F overall density of hydrocarbon components
l hydrocarbon liquid (oil) mole fraction
and their relations to the base variables are given below:
o g w
S S S − − =1 (3.10)


=
− =
1
1
1
h
h
n
c
c n
x x (3.11)


=
− =
1
1
1
h
h
n
c
c n
y y (3.12)
g g o o
c g g c o o
c
S S
y S x S
z
ρ ρ
ρ ρ
+
+
= (3.13)
c g g c o o c
y S x S r ρ ρ + = (3.14)
) 1 (
o g w w
S S r − − = ρ (3.15)
g g o o
S S F ρ ρ + = (3.16)
g g o o
o o
S S
S
l
ρ ρ
ρ
+
= (3.17)
where, ) ( p
w w
ρ ρ = , ) , , , (
1 1 −
=
h
n o o
x x p … ρ ρ and ) , , , (
1 1 −
=
h
n g g
y y p … ρ ρ
Note that this process is equivalent to the use of chain rule to get the derivatives in
Type B models. So it should not introduce any extra work. For Type A models, all of the
transformation matrices are identity matrices, and this step is not necessary.
Besides the base model, a Type B model is implemented in GPRS, where the full set
of variables is
65
p ,
c
r , c = 1, 2, …
h
n -1
w
r ,
g
S , and
c
y , c = 1, 2, …
h
n -1.
Within this set, p ,
c
r , c = 1, 2, …
h
n -1 and
w
r are the primary variables. The following
relations are used to calculate the transformation matrix:
¦
¦
¦
¹
¦
¦
¦
´
¦
=
=
− − =
+ =
=
c c
g g
o g w w
c g g c o o c
y y
S S
S S r
y S x S r
p p
) 1 ( ρ
ρ ρ
(3.18)
The derivative of the overall component densities with respect to the base variables are
calculated as
¦
¦
¦
¦
¹
¦
¦
¦
¦
´
¦


+ =




+ =


=


=




+


=




′ ′


c o
c
o
c c o o
c
c
c g
c
g
c c g g
c
c
c o
o
c
c g
g
c
c g
g
c o
o c
x S
x
S
x
r
y S
y
S
y
r
x
S
r
y
S
r
y S
p
x S
p p
r
ρ
δ ρ
ρ
δ ρ
ρ ρ
ρ
ρ
, ,
,
, , (3.19)
and
¦
¦
¦
¦
¹
¦
¦
¦
¦
´
¦
=


=


− =


=


− −


=


0
) 1 (
c
w
c
w
w
o
w
g
w
o g
w w
x
r
y
r
S
r
S
r
S S
p p
r
ρ
ρ
(3.20)
The final structure of the inverse of the transformation matrix (
1 −
TRAN ) is shown in
Figure 3.3. The transformation matrix is calculated as the inverse of
1 −
TRAN in GPRS,
66
regardless of its internal structure. But, for matrices with special structures, like the one
in Figure 3.3, there are more efficient ways to calculate its inverse.
Figure 3.3 Structure of the inverse of the transformation matrix for a Type B model
Now that we have the full set of equations and variables, and we also have different
choices of variables, the next step is to reduce the number of equations and variables to a
set that is solved together. First we reduce it to the minimum number (
c
n ) of equations
and variables required to establish the thermodynamic state (the FIM model), then we can
further reduce the implicit level.
3.2.2 Reduce Full Set 0 ) ( = X F
G G
to Primary Set 0 ) ( =
p p
X F
G G
In order to write an iterative process to solve 0 ) ( = X F
G G
, we could use the Newton-
Raphson method:
υ υ υ υ
δ δ X X X and X F X
X
F
G G G G G G
G
G
− = − =


+1
), ( ) ( (3.21)
or we can express ) ( X F
G G
in Taylor series:
X
X
F
X F X F X F
n
G
G
G
G G G G G G
δ
υ υ υ
) ( ) ( ) ( ) ( 0
1 1


+ = ≈ =
+ +
(3.22)
p
c
r
w
r
g
S
c
y
p
g
S
o
S
'
c
y
'
c
x
1 0 0 0 0
0 0 0 0 I
0 0 0 0 1
0 0
c g p c o p
y S x S
g
o




+
ρ ρ
w
ρ −
w
ρ −
) 1 (
o g p
S S
w
− −

∂ρ
c g y
c c
g g
y S S
c
g
'
'
,


+
ρ
δ ρ
c o x
c c
o o
x S S
c
o
'
'
,


+
ρ
δ ρ
c g
y ρ
c g
x ρ
67
Eqn. 3.21 and Eqn. 3.22 are equivalent. In the following analytical derivation, Taylor
series are used to derive the primary set. In addition, we will also show a matrix
manipulation method, which can achieve the same final goal as the analytical derivation
method. The matrix manipulation method is used in GPRS, and we will discuss it in more
detail later.
Analytical Derivation
In the last section, we have defined the following matrices:
p
p
X
F
A G
G


= ,
s
p
X
F
B G
G


= ,
p
s
X
F
C G
G


= ,
s
s
X
F
D G
G


=
and vectors:
p
F M
G G
− = ,
s
F N
G G
− =
where matrices A, B, C and D together form the full set Jacobian matrix for Eqn.3.2, and
M
G
, N
G
are the corresponding right hand sides (RHS) for the primary part and for the
secondary part, as shown in the first frame of Figure 3.4.
The first step is to relate the secondary variables to the primary variables. We start
with the secondary equation set 0 ) , ( =
s p s
X X F
G G G
. Use of Taylor series on this equation set
yields
s p
s
s
s
p
p
s
s p s s p s
X D X C N
X
X
F
X
X
F
X X F X X F
G G G
G
G
G
G
G
G
G G G G G G
δ δ
δ δ
υ υ υ
υ υ υ υ
+ + − =


+


+ = ≈
+
) ( ) ( ) , ( ) , ( 0
1
(3.23)
Rearranging Eqn. 3.23, we get
p s
X C D N D X
G G G
δ δ
υ υ
) ( ) (
1 1 − −
− = (3.24)
The second step is to write the primary equations in the primary variables. Use of Taylor
series on the primary equation set 0 ) , ( =
s p p
X X F
G G G
yields
68
s p
s
s
p
p
p
p
s p p s p p
X B X A M
X
X
F
X
X
F
X X F X X F
G G G
G
G
G
G
G
G
G G G G G G
δ δ
δ δ
υ υ υ
υ υ υ υ
+ + − =


+


+ = ≈
+
) ( ) ( ) , ( ) , ( 0
1
(3.25)
Substituting Eqn.3.24 into the above equation, we get
] ) ( ) [( 0
1 1
p p
X C D N D B X A M
G G G G
δ δ
υ υ υ υ υ − −
− + + − = (3.26)
Rearranging terms, we have
υ υ
δ ) ( ) (
1 1
N BD M X C BD A
p
G G G
− −
− = − (3.27)
This is the final primary system, which only includes the primary variables as unknowns.
After we solve for the primary variables, the secondary variables can be updated
explicitly from Eqn. 3.24 gridblock by gridblock. We can achieve the same goal by
performing matrix manipulation directly on the full set Jacobian matrix and RHS.
Matrix Manipulation (Gaussian Elimination)
Here we perform Gauss elimination on the blocks (A, B, C, D and M, N) of the full set
Jacobian matrix and RHS. The goal is to eliminate B to zero, then the primary equations
will depend only on the primary variables. This is illustrated in Figure 3.4.
Figure 3.4 Reduce full set to primary set by Gaussian elimination
A B
C D
M
N
A B
1 −
D C
I
M
1 −
D N
0
B
A-
B
1 −
D C
B
1 −
D C
M-
B
1 −
D N
B
1 −
D N
(3)
(1)
(2)
A B
B
1 −
D C B
M
B
1 −
D N
69
First, we multiply the secondary equation set by D
-1
, then we multiply it again by B, and
finally we subtract the secondary equation set from the primary equation set. The final
primary equation set can be extracted and written as
) ( ) (
1 1
N BD M X C BD A
p
G G G
− −
− = − δ (3.28)
which is the same equation as Eqn. 3.27. We can also extract a secondary equation set
from the second frame of Figure 3.4, after rearrange it, we have
p s
X C D N D X
G G G
δ δ
υ υ
) ( ) (
1 1 − −
− = (3.29)
which is the same equation as Eqn. 3.24.
The three operations in Figure 3.4 are performed for each gridblock and for each part
of the Jacobian matrix. From Figure 3.2, we know that matrices A and B exist on the
diagonal part, the off-diagonal part and the well part of the full set Jacobian. Matrices C
and D only exist on the diagonal part. We need to eliminate all parts of B. Note that
matrices A, B, C and D are always in the same column (they are the derivatives with
respect to the variables in the same gridblock), A, B and M are in the same row
(equations for the same gridblock), and C, D and N are in the same row. Different parts
of B are eliminated as discussed below:
• Diagonal part of B (Diag array) Loop through the cell list, select the diagonal A, B,
C and D for the same block and their corresponding RHS, M and N, and perform the
three step elimination process. In addition, D
-1
is calculated and stored back in D,
D
-1
C and D
-1
N are calculated and stored back in C and N to avoid repeating
calculations and using extra memory space.
• Off-diagonal part of B (OffD_A and OffD_B arrays) Loop through the connection
list, for each A and B in the off-diagonal part, select the C and D which are in the
same column as A and B. M is corresponding to A and B, and N is corresponding to
C and D. Only the last step of the elimination is needed here, since D
-1
C and D
-1
N
have already been calculated. This process needs to be done for both the OffD_A
array and for the OffD_B array.
70
• Well part of B If a well has the WRJ array, for each A
WR
and B
WR
in the WRJ, select
the C and D which are in the same column as A
WR
and B
WR
. M
WW
is corresponding to
A
WR
and B
WR
, and N is corresponding to C and D. Only the last step of the
elimination is needed here. If a well penetrates multiple gridblocks, there will be
several A
WR
and B
WR
, and the elimination process will be performed for each of
them.
To make the process clearer, for the system shown in Figure 3.2, the following
operations are performed to reduce B to 0:
• Diagonal part operations:
1
1 1

← D D
1
2 2

← D D
1 1 1
1
C D C ⋅ ←

2 2 2
1
C D C ⋅ ←

1 1 1
1
N D N ⋅ ←

2 2 2
1
N D N ⋅ ←

) 1 1 ( 1 1 1
1
C D B A A ⋅ ⋅ − ←

) 1 1 ( 1 1 1
1
N D B M M ⋅ ⋅ − ←

) 2 2 ( 2 2 2
1
C D B A A ⋅ ⋅ − ←

) 2 2 ( 2 2 2
1
N D B M M ⋅ ⋅ − ←

• Off-diagonal part operations:
) 2 2 ( 12 12 12
1
C D B A A ⋅ ⋅ − ←

) 2 2 ( 12 1 1
1
N D B M M ⋅ ⋅ − ←

) 1 1 ( 21 21 21
1
C D B A A ⋅ ⋅ − ←

) 1 1 ( 21 2 2
1
N D B M M ⋅ ⋅ − ←

• Well part operations:
) 1 1 (
1
C D B A A
WR WR WR
⋅ ⋅ − ←

) 1 1 (
1
N D B M M
WR WW WW
⋅ ⋅ − ←

where ) 1 1 ( 1 1 1
1
C D B A A ⋅ ⋅ − ←

means that ) 1 1 ( 1 1
1
C D B A ⋅ ⋅ −

is calculated and stored
back in 1 A . The updated A and M can later be extracted for fully implicit solve or for
further reductions. After the above operations, the A and M of the full set Jacobian and
RHS in Figure 3.2 are reduced to the primary set Jacobian and RHS (fully implicit). The
structure of the resulting Jacobian is shown in Figure 3.5.
71
Figure 3.5 Structure of the primary set Jacobian Matrix and RHS
After solving for the primary variables together, the secondary variables of each
gridblock are updated explicitly by
1 ,
1 1
1 ,
) 1 1 ( ) 1 1 (
p s
X C D N D X
G G
δ δ ⋅ ⋅ − ⋅ =
− −
1 ,
1 1
2 ,
) 2 2 ( ) 2 2 (
p s
X C D N D X
G G
δ δ ⋅ ⋅ − ⋅ =
− −
We have mentioned in Chapter 2 that, for single block wells with constant rate
control, we can decouple the reservoir Jacobian from the well Jacobian by eliminating
RWJ, then we can solve for the reservoir variables first and explicitly update the well
variable later. If the well in Figure 3.5 only has single block penetration and RWJ exists,
the following additional operations are performed in GPRS:
) ( 1 1
1
WR WW RW
A A A A A ⋅ ⋅ − ←

) ( 1 1
1
WW WW RW
M A A M M ⋅ ⋅ − ←

After the primary reservoir variables have been solved, the well variable is updated by
1 ,
1 1
) ( ) (
p WR WW WW WW W
X A A M A X
G G
δ δ ⋅ ⋅ − ⋅ =
− −
Here, Newton iterations are performed on both the primary equations and the
secondary equations. If the secondary equations are only used as constraint equations, as
mentioned in Chapter 2, then all of the N's in the above equations will be zero.
A1 A12
A21 A2
diagonal Jacobian
A
RW
A
WW
A
WR
...
...
... ...
RHS
M1
M2
M
WW
...
72
Some variations in the general operations are necessary as discussed below.
• If the transmissibility is treated explicitly, then there is no need to eliminate off-
diagonal parts of B, because flux terms only have derivatives to pressure, which is
always a primary variable, and all off-diagonal parts of B are zero.
• Matrix D is actually the Jacobian matrix for flash calculations. When we update the
secondary variables, it is equivalent to doing one step of flash calculations for each
Newton iteration. For exact flash calculations at each Newton step, we can use it as
the initial guess for flash.
• For the black-oil model, there are no secondary variables, and this step is not needed.
For compositional models, if a gridblock has only one hydrocarbon phase, then the
primary equations will only depend on the primary variables as shown in Section 2.6,
and this step is also not necessary.
So far, we have derived the fully implicit Jacobian matrix and RHS. For fully implicit
simulations we can just stop here. But in a lot of situations, we desire to reduce the
implicit level to speed up the calculations. The next subsection will show how this is
done.
3.2.3 Reduce the Implicit Level of the Fully Implicit System 0 ) ( =
p p
X F
G G
To reduce the implicit level of the fully implicit system, we first split the primary
variables into an implicit part and an explicit part, and set the derivatives of flux terms
with respect to the explicit variables to zero, then we decouple the implicit variables from
the explicit variables. The second step is basically a decoupling step. This process needs
to be done for each gridblock that is not fully implicit. After the implicit variables have
been solved for together, the explicit variables can be updated explicitly gridblock by
gridblock. In this part, we will discuss the various decoupling methods available, their
differences, and which one is used in GPRS.
For each gridblock, the fully implicit Jacobian matrix is shown in Figure 3.6, which is
one row of the matrix equation in Figure 3.5.
73
Figure 3.6 Fully implicit Jacobian matrix of one gridblock
Here the left part is the Jacobian matrix A, which includes a diagonal part, several off-
diagonal parts and several well parts (RWJ). The right part is the right hand side M. P is
the pressure or the implicit primary variables, V
1
, V
2
and V
3
are the explicit primary
variables.
We can reduce the implicit level of the fully implicit system in Figure 3.6 in two
steps:
1. First, set all flux term derivatives with respect to the explicit variables to zero, or
simply don’t calculate them. Since the off-diagonal parts of A are the flux term
derivatives, this treatment will leave parts (derivatives with respect to the explicit
variables) of the off-diagonal A to zero. Diagonal A will also have some change, but
it won’t be zero. This is illustrated in Figure 3.7.
Figure 3.7 Jacobian matrix of one gridblock after explicit treatment of flux terms
2. Next, decouple the implicit variables from the explicit variables. There are different
kinds of decoupling methods available, two popular choices are Householder
reflection (QR decomposition) and local inversion (Lacroix et al., 2000). Coats
X
X
X
X
RHS
X X X X
X X X X
X X X X
X X X X
X X X X
X X X X
X X X X
X X X X
…… ……
X
X
X
X
Off-diagonal
V
1
V
2
V
3
P
diagonal
V
1
V
2
V
3
P
RWJ
W
p
X
X
X
X
RHS
X X X X
X X X X
X X X X
X X X X
0 0 0 X
0 0 0 X
0 0 0 X
0 0 0 X
…… ……
X
X
X
X
Off-diagonal
V
1
V
2
V
3
P
diagonal
V
1
V
2
V
3
P
RWJ
W
p
74
(1999) has pointed out that the IMPES pressure equation is unique, independent of
the manner of derivation, choice and ordering of variables and equations. Based on it,
we can conclude that the choice of decoupling methods does not have too much
influence on the final implicit system.
Here we only review the two most popular decoupling methods, Householder
reflection and local inversion:
• Householder reflection The process of using Householder reflection (Lacroix et al.,
1999) is summarized in Figure 3.8. We start from the system in Figure 3.7, and move
each part (dark rectangles in Figure 3.8) into a matrix or column vector. Then we
perform a QR decomposition (A=QR, where Q is an orthogonal matrix, Q
-1
=Q
T
, and
R is an upper triangular matrix) on the diagonal matrix, and use the transpose of Q to
multiply all of the matrices and vectors. After that, the diagonal matrix becomes R,
which only has values in the upper triangular part, the last equation will be only in
terms of the implicit variables, and it is extracted and passed to the linear solver.
After it is solved, the explicit variables can be easily updated by making use of the
upper triangular structure of the diagonal matrix. The same results can be achieved by
performing Gaussian elimination on the system in Figure 3.7.
75
Figure 3.8 Householder reflection decoupling
X
X
X
X
RHS
X X X X
X X X X
X X X X
X X X X
0 0 0 X
0 0 0 X
0 0 0 X
0 0 0 X
…… ……
X
X
X
X
Off-diagonal
V
1
V
2
V
3
P
diagonal
V
1
V
2
V
3
P
RWJ
W
p
A
'
A
RW
A
M
QR A =
R
' 1
A Q
− RW
A Q
1 −
M Q
1 −
X
X
X
X
RHS
X X X X
0 X X X
0 0 X X
0 0 0 X
X
X
X
X
…… ……
X
X
X
X
Off-diagonal
P
diagonal
V
1
V
2
V
3
P
RWJ
W
p
76
• Local inversion The process of using local inversion (Lacroix et al., 2000) is
summarized in Figure 3.9. The notation used here follows the normal notation used
for black-oil IMPES models, subscript p stands for pressure or implicit variables, and
subscript s stands for saturation or explicit variables. Here we also start from the
system in Figure 3.7, but we do an additional splitting step to separate the implicit
part from the explicit part, and move each part (dark rectangles in Figure 3.9) into a
small matrix or column vector. Then we use the procedure in Figure 3.4 to reduce
ps
A to zero. Finally the second equation can be extracted and solved for implicit
variables. After that, the explicit variables are updated from the first equation. Note
that we operate on the matrices and vectors in the same row (belong to the same
gridblock). Like the procedure used in Figure 3.4, it is done separately for the
diagonal part, the off-diagonal part, and the well part (RWJ).
Figure 3.9 Local inversion decoupling
X
X
X
X
RHS
X X X X
X X X X
X X X X
X X X X
0 0 0 X
0 0 0 X
0 0 0 X
0 0 0 X
…… ……
X
X
X
X
Off-diagonal
V
1
V
2
V
3
P
diagonal
V
1
V
2
V
3
P
RWJ
W
p
pp
A
ss
A
sp
A
ps
A
'
pp
A
'
sp
A
p
M
s
M
RW
pp
A
RW
sp
A
ps
A
sp ss ps
A A A
1 −
sp ss ps
pp
A A A
A
1 −

0
' 1
sp ss ps
A A A

' 1
'
sp ss ps
pp
A A A
A


RW
sp ss ps
A A A
1 −
RW
sp ss ps
RW
pp
A A A
A
1 −

s ss ps
M A A
1 −
s ss ps
p
M A A
M
1 −

77
For the IMPES model, numerical experiments (Vassilevski, 2001) show that for most
cases, the pressure system from Householder reflection is more symmetric than the
pressure system from local inversion, which is better for the linear pressure solver. But in
GPRS, we use the local inversion method anyway, because this procedure is similar to
the procedure used in Figure 3.4, and no additional work is needed to implement it. The
method used for decoupling does not make much difference, since the final implicit
systems are always equivalent.
Figure 3.10 Illustration for local inversion
To make this step clearer, for the system shown in Figure 3.10, the following
operations are performed to reduce
ps
A to 0 in GPRS:
• Diagonal part operations:
1 −
⋅ ←
ss ps ps
A A A
sp ss ps pp pp
A A A A A ⋅ ⋅ − ←

) (
1
s ss ps p p
M A A M M ⋅ ⋅ − ←

) (
1
• Off-diagonal parts operations:
' 1 '
) (
sp ss ps pp pp
A A A A A ⋅ ⋅ − ←

• Well parts (RWJ) operations:
RW
sp ss ps pp
RW
pp
A A A A A ⋅ ⋅ − ←

) (
1
pp
A ,
'
pp
A ,
RW
pp
A and
p
M form the final implicit system, they are extracted and passed to
the linear solver. After getting the implicit variables, the explicit variables are updated
explicitly by
RHS
s
M
p
M
ss
A
sp
A
ps
A
pp
A
'
sp
A
'
pp
A
diagonal Jacobian
RW
sp
A
RW
pp
A
…...
78
) (
' ' 1
exp
W RW
sp imp sp imp sp s ss
X A X A X A M A X
G G G G
δ δ δ δ ⋅ − ⋅ − ⋅ − ⋅ =

Coats et al. (1995) proposed using IMPES reduction factor to generate the pressure
system. Basically it is the application of the procedure in Figure 3.9 for the case where
only the pressure is treated implicitly, such as in IMPES. In that approach, each equation
(one row) in Figure 3.7 is multiplied by a scalar, and the resulting
c
n equations are
added, and the IMPES reduction factor is a vector consisting of these scalars. The values
of these scalars are determined so that the addition removes all of the variables except
pressure. The IMPES reduction factor is actually the
1 −

ss ps
A A matrix in the General
Formulation Approach. For IMPES, it is a vector, since
ps
A is a row vector and
1 −
ss
A is a
matrix. Coats (1999) showed that IMPES reduction factor leads directly to the value of
total compressibility in multiphase gridblocks, and this in turn provides an error check for
black-oil PVT data, such as if the calculated total compressibility is negative, then there
must be some inconsistency in the black-oil PVT data.
Before any decoupling, parts of the transmissibility are treated explicitly. For each
explicit part, we can either fix it at the old time level or update it iteration by iteration.
The first approach has less numerical diffusion. The second approach is actually an
inexact Newton method, which upon convergence gives the same solution as the FIM
method. From Eqn. 2.5, we can see that transmissibility has three non-constant parts
(phase mobility, phase density and component mole fraction), and each part can be
treated differently. For each gridblock, we have the following four options for the
treatment of transmissibility in GPRS:
• Option 1 All three parts are fixed at the old time level, and only derivatives with
respect to the implicit variables are calculated. This option is used for the IMPES
model.
• Option 2 Component mole fractions are fixed at the old time level, phase mobility
and phase density are updated iteration by iteration, and only derivatives with respect
to the implicit variables are calculated. This option is used for the IMPSAT model,
where both pressure and saturation are treated implicitly, and component mole
fractions are treated explicitly.
79
• Option 3 All three parts are updated iteration by iteration, and only derivatives with
respect to the implicit variables are calculated. This option can be used for any
models, but it performs poorly for IMPES, which is actually the IMPES model
proposed for an adaptive implicit scheme by Thomas and Thurnau (1983). Russell
(1989) showed that in order to make this method stable, the CFL number must be less
than 0.05.
• Option 4 All three parts are updated iteration by iteration, and all derivatives are
calculated regardless of the implicit level. This option is used for the FIM model. For
the IMPES and IMPSAT models, this option can also be used, the reductions in
implicit level are performed for all non-zero terms, and finally some terms are
ignored to form the implicit system. The corresponding models are normally called
quasi IMPES and quasi IMPSAT models. Generally, quasi IMPES is not used as a
formulation, and it is only used as a way to generate a pressure system, which can be
used later for preconditioning purpose.
In summary, the proposed General Formulation Approach can be used to obtain any
desired formulation, regardless of the type of model, type of variables and level of
implicitness. All of the operations are performed on individual gridblocks, so the
extension to the use of different implicit levels for different gridblocks (Adaptive Implicit
Method, AIM) is straightforward. This approach also allows the use of different models
for different reservoirs (reservoirs are only connected through well groups and boundary
interfaces, and each reservoir is handled by a single processor in parallel computation).
This General Formulation Approach only defines the general steps and methods to
reach the final goal, and it is suitable for any model. But in order to make the simulator
more efficient, we need to consider the details of each specific model. For example:
• In many cases, matrices are banded or sparse, we should only perform operations on
the non-zero terms.
• For some models, such as variable Type B models, which use
c
z as the primary
variables, we know the analytical form of accumulation term derivatives with respect
80
to them, and we can just bypass the variable switching part, and directly calculate
them from the start.
• Water equation only has derivatives with respect to pressure and saturations, which
are both primary variables for the base model. This means that water equation is in
terms of the primary variables only from the start, and we need not do any reduction
for it, as long as both pressure and saturations are implicit.
• The matrix C is generated from the phase equilibrium relations, and it does not have
any derivative with respect to saturations, so some columns of C are always zero. We
can take advantage of this, and save some calculations.
These are some general considerations that reduce calculations, and they are far from
complete. Furthermore, each specific model has its own characteristics, and we should
use them to further simplify calculations. However, all of the operations of this approach
are of first order to the number of gridblocks, so the cost should be small compared to the
cost of linear solver, especially for large models. With proper tuning, the speed of this
General Formulation Approach should be comparable with that of commercial
simulators.
3.3 Stability Analysis
After the secondary variables are eliminated from the primary equations, we get the FIM
model, which is unconditionally stable. In practice, in order to control the number of
Newton iterations for each timestep, a reasonable timestep size is required, normally it is
between 30 days and 100 days. If we further reduce the implicit level of the primary set,
the explicit treatment of primary variables will make the model conditionally stable, and
the timestep size will have to satisfy some stability criteria. In real simulations, we desire
to use the maximum allowable (stable) timestep size, and stability analysis is needed to
correctly identify it. The natural variables are used in GPRS, within them, pressure is
always treated implicitly, and saturations and component mole fractions can be treated
either implicitly or explicitly. Next, we will derive the stability criteria due to the explicit
treatment of saturations and component mole fractions. Assuming one-dimensional two-
81
phase (gas/oil) flow, no source and sink, the hydrocarbon component mass balance
equations can be written as
) ( ) (
c g g c o o c g g c o o
y u x u
x
y S x S
t
ρ ρ φρ φρ +


= +


(3.30)
c = 1,…,
h
n
where
o
u and
g
u are the phase velocities for the oil and gas phases.
Summing Eqn. 3.30 over all components, we get the total hydrocarbon mass balance
equation:
) ( ) (
g g o o g g o o
u u
x
S S
t
ρ ρ φρ φρ +


= +


(3.31)
By assuming incompressible flow, no gravity and constant viscosity, the total flow
velocity
T
u becomes a constant, and Eqn. 3.31 can be simplified as
x
f
u
x
f
u u f u f
x t
S
t
S
g
T g
o
T o T g g T o o
g
g
o
o


+


= +


=


+


ρ ρ ρ ρ φρ φρ ) ( (3.32)
x
S
dS
df
u
x
f
u
t
S
g
g
g
o g T
g
o g T
g
o g


− =


− =


− ) ( ) ( ) ( ρ ρ ρ ρ ρ ρ φ (3.33)
where
o
f and
g
f are the fractional flows of the oil and gas phases, and they are only
functions of saturation. After rearranging Eqn. 3.33, we get
x
S
dS
df
u
t
S
g
g
g
T
g


=


) (
φ
(3.34)
Eqn. 3.34 is the Buckley-Leverett wave equation, its stability is determined by the CFL
number, which can be written as
1
,
≤ ⋅
⋅ ∆
∆ ⋅
=
g
g
T
x S
dS
df
x
t u
CFL
φ
(3.35)
For three-dimensional flow, the total CFL number is the summation of CFL numbers in
all three directions (Russell, 1989):
82
1
, , ,
, , ,
≤ ⋅

∆ ⋅
=

⋅ ∆
∆ ⋅
+ ⋅
⋅ ∆
∆ ⋅
+ ⋅
⋅ ∆
∆ ⋅
=
+ + =
g
g
T
g
g
z
z T
g
g
y
y T
g
g
x
x T
z S y S x S S
dS
df
V
t q
dS
df
z A
t q
dS
df
y A
t q
dS
df
x A
t q
CFL CFL CFL CFL
φ
φ φ φ
(3.36)
where
T
q is the total volumetric flow rate,
x T
q
, y T
q
,
and
z T
q
,
are the volumetric flow
rates along x, y and z directions, and
z T y T x T T
q q q q
, , ,
+ + = . V is the volume of a
gridblock, and z A y A x A V
z y x
∆ = ∆ = ∆ = . The physical meaning of Eqn. 3.36 is that a
phase front can not move more than one gridblock in a stable timestep.
Coats (2001) derived the same stability criteria for the general multi-dimensional
three-phase flow, including both gravity and capillary pressure. For two-phase (gas/oil)
flow without capillary pressure, it can be reduced to
1 ≤
+



=
g o
o
g
o
o
g
g
g
g
g
o
S
q
dS
d
q
dS
d
V
t
CFL
λ λ
λ
λ
λ λ
λ
λ
φ
(3.37)
By ignoring gravity, we have
¦
¦
¹
¦
¦
´
¦
+
= =
+
= =
T
o g
o
T o o
T
o g
g
T g g
q q f q
q q f q
λ λ
λ
λ λ
λ
(3.38)
Substituting Eqn. 3.38 into Eqn. 3.37 and rearranging, we get
1
/ ) (
) (
) ( ) (
) (
2
2
≤ ⋅

=
+


=
+
+ − +


=
+



=
g
g
T
g
g o
g
T
g o
g
g
g
o
g
g
g
g o
T
g o
g
o
g
g
g
o
T
S
dS
df
V
t q
dS d
V
t q
dS
d
dS
d
dS
d
V
t q
dS
d
dS
d
V
t q
CFL
φ
λ λ
λ
φ
λ λ
λ
λ
λ
λ
λ λ
φ
λ λ
λ
λ
λ
λ
φ
(3.39)
83
which is the same equation as Eqn. 3.36. Eqn. 3.37 is used as the stability criterion for the
explicit treatment of saturations in GPRS.
If any component mole fraction is treated explicitly, we can get its stability criterion
from Eqn. 3.30. Assuming incompressible flow and constant equilibrium ratio
c
K , we
have
x
S
dS
df
x y u
x
y
u K u
t
S
x y
t
y
S K S
g
g
g
c o c g T
c
g g c o o
g
c o c g
c
g g c o o


− +


+ =


− +


+
) ( ) / (
) ( ) / (
ρ ρ ρ ρ
ρ ρ φ φρ φρ
(3.40)
Substituting Eqn. 3.34 into Eqn. 3.40, we can eliminate the second terms on both sides,
and after rearranging, we get
x
y
y S x S
y u x u
t
y
c
c g g c o o
c g g c o o
c


+
+
=


φρ φρ
ρ ρ
(3.41)
Dividing by
c
K on both sides of Eqn. 3.41, we get
x
x
y S x S
y u x u
t
x
c
c g g c o o
c g g c o o
c


+
+
=


φρ φρ
ρ ρ
(3.42)
The stability criterion for both Eqn. 3.41 and Eqn. 3.42 is
1
,

+
+


=
c g g c o o
c g g c o o
x X
y S x S
y u x u
x
t
CFL
ρ ρ
ρ ρ
φ
(3.43)
Similarly, for three-dimensional flow, the stability criterion is
1 ≤
+
+

=
c g g c o o
c g g c o o
X
y S x S
y q x q
V
t
CFL
ρ ρ
ρ ρ
φ
(3.44)
Coats (1999) mentioned that the stability criterion due to the explicit treatment of
component mole fractions is 1
1




=
w
T
X
S
q
V
t
CFL
φ
, which is only a simplified version
of Eqn. 3.44 for
o
S =0 or
g
S =0. In Coats’ new paper (Coats, 2001), the same stability
criterion as developed here (Eqn. 3.44) was proposed, but he got it by first assuming
84
o
q =0 or
g
q =0, and getting the stability criterion for the case where only single
hydrocarbon phase can flow, then finally generalizing it to the case where both
hydrocarbon phases flow. Our derivation is more general.
The physical meaning of Eqn. 3.44 is, for a stable timestep, the amount of component
c flowing out of a gridblock can not exceed the amount of component c in place in that
gridblock. In other words, a component can not move more than one gridblock in a stable
timestep. Eqn. 3.44 is for each individual component, and it only needs to be satisfied
when either
c
y or
c
x is treated explicitly. Eqn. 3.44 is used as the stability criterion for
the explicit treatment of component mole fractions in GPRS. We will further analyze and
compare these two stability criteria (Eqn. 3.37 and Eqn. 3.44) in Chapter 4.
3.4 Influence of Equation and Variable Selections
Compositional models are different in both their implicit levels and their equation and
variable selections. In the last section we have discussed the stability criteria due to the
explicit treatment of variables. In this part, we consider the influence of equation and
variable selections on the efficiency of compositional simulations. First we discuss the
effect of selecting primary equations, then we compare the differences between different
variable selections. For each we will discuss their influence on Newton iterations and
linear solver iterations.
3.4.1 Selection of Primary Equations
In reservoir simulation, we can select different equations, but no matter what equations
we select, each equation is basically a linear combination (first assign a coefficient to
each equation, then sum them up) of all of the equations shown in Subsection 1.2.1. For
example, the total mass balance equation is the summation of all of the component mass
balance equations, in this case the vector of coefficients is (1, 1, 1,…1). If we consider
the ordering of equations, a new ordering can be viewed as a special linear combination
of the old ordering. Such as, coefficients (0, 0, 0, 1,…0) move the fourth equation to the
current location. Equation selection is done gridblock by gridblock, the Jacobian matrix
and the RHS for one gridblock can be written as
85
i i
B X A = ⋅ δ (3.45)
where
i
A is one row of the full Jacobian matrix A,
i
B is one row of the RHS B, and X δ
is all of the unknowns. Any combination of equations of gridblock i can be represented
by pre-multiplying Eqn. 3.45 by a matrix on both sides:
i i i i
B M X A M ⋅ = ⋅ ⋅ ) ( δ (3.46)
Eqn. 3.46 is only for one gridblock. Equations for individual blocks can be combined to
obtain the final full system:
B M X A M ⋅ = ⋅ ⋅ ) ( δ (3.47)
where,
(
(
(
(
¸
(

¸

=
n
M
M
M
M
" "
2
1
,
(
(
(
(
¸
(

¸

=
n
A
A
A
A
" "
2
1
, and
(
(
(
(
¸
(

¸

=
n
B
B
B
B
"
2
1
Eqn. 3.47 can be recast as
) ( ) ( B M X A M ⋅ = ⋅ ⋅ δ (3.48)
Here, the Jacobian matrix changes to MA, the RHS changes to MB , but the solution
vector is still X δ .
The solution vector is always X δ no matter what the M is, the same solution is
guaranteed as long as Eqn 3.48 is solved accurately. Same solutions for X lead to the
same residuals at each Newton iteration. Since the convergence of Newton iterations
depends on the reduction of residuals, the number of Newton iterations will stay the
same. In other words, equation selection will not influence Newton iterations.
On the other hand, the change of the Jacobian matrix will influence linear solver
iterations, because A and MA have different condition numbers. Alternatively, we can
view Eqn. 3.48 as a left preconditioning of the old linear system B X A = ⋅ δ , where M is
the preconditioning matrix. In this case M is a block diagonal matrix, so it is some kind
of block diagonal scaling left preconditioning. In this sense, the best equation selection is
86
the one that makes the block diagonals of MA as close to a diagonal matrix as possible,
just as the block diagonal scaling preconditioner does. In other words, we like to select
and align the equations in such a way that equation i is most influenced by variable i, then
the block diagonals of MA will be as near to diagonal as possible (diagonal dominance).
Based on these observations, we can conclude that, at the Jacobian level, different
equation selections are equivalent to performing different block diagonal left
preconditionings to the old system, which only influence linear solver iterations and has
no influence on Newton iterations. A good equation selection should roughly align the
equations in the way that variable i has the biggest influence on equation i (diagonal
dominance). Applying a block diagonal scaling left preconditioning to the Jacobian
matrix could achieve the same effect. Of course, different equation selections will
influence the amount of work in calculating the Jacobian matrix and the RHS.
3.4.2 Different Variable Selections
Different models can also use different variables. In this part, we will first consider the
influence of different variable selections on Newton iterations and linear solver iterations,
then we will discuss the differences between using intensive variables and extensive
variables, finally we will compare the performance of models with Type A and Type B
variables in terms of their mass and volume balance errors. In Subsection 3.2.1, we have
mentioned that we can change the variable selection by multiplying the equation by a
transformation matrix. This transformation matrix is for each gridblock, and this process
is done gridblock by gridblock. We can combine all of them together, then at the full
Jacobian level, this process looks like
B X M AM = ⋅

) ( ) (
1
δ (3.49)
where,
(
(
(
(
¸
(

¸

=
n
M
M
M
M
" "
2
1
.
87
Here, the Jacobian matrix changes to AM , the solution vector changes to X M Y δ δ
1 −
= ,
but the right hand side is still B .
The change of the Jacobian matrix will influence linear solver iterations, because A
and AM have different condition numbers. Alternatively we can view Eqn. 3.49 as a
right preconditioning of the old system B X A = ⋅ δ , where M is the preconditioning
matrix. In this case M is also a block diagonal matrix, so it is some kind of block diagonal
scaling right preconditioning. For the same reason as for the selection of equations, it is
best to align the variables in the way that makes variable i to have the biggest influence
on equation i (diagonally dominant).
By preconditioning, we solve for X by
υ υ υ υ υ
δ δ Y M X X X X + = + =
+1
and we get
the same solution as for the old system, B X A = ⋅ δ . But for the new variables, we must
first solve for Y by
υ υ υ
δY Y Y + =
+1
, then X of each gridblock can be updated
explicitly by the relation ) (
1
Y f X

= that was built between X and Y for the
calculation of transformation matrix. In this case, we will get a different solution X if
the relation ) (
1
Y f X

= is nonlinear. Such as for 0 2
2
= − = X F with initial guess
1
0
= X , after the first Newton iteration, we get 5 . 0
0
= X δ and 5 . 1
0 0 1
= + = X X X δ , if
we change X to
2
X Y = , then the equation becomes 0 2 = − = Y F with initial guess
1
0
= Y , after the first Newton iteration, we have 1
0
= Y δ , 2
0 0 1
= + = Y Y Y δ and
2
1 1
= = Y X , and these two solutions for
1
X are different. Different solutions for X
lead to different residuals at each Newton iteration. Since the convergence of Newton
iterations depends on the reduction of residuals, variable selection will influence Newton
iterations. If the equations are more linear with respect to the new variables, then the
number of Newton iterations will decrease (for linear system, only one Newton iteration
is needed to converge). Variable selection will also influence the amount of work in
calculating the Jacobian matrix and the RHS. The natural variables are the cheapest ones
for building a fully implicit system.
For the same type of variable, it is also possible to use an extensive variable, such as
the overall component molar density
c
r vs. the overall component moles
c
m . In order to
understand the difference between these two types of variables, we need to recall that, no
matter which kinds of variables are used, the number of independent variables is always
88
the same. Consider a compositional model using the natural variables, which are all
intensive variables, after the natural variables have been calculated and fixed, all of the
extensive variables of this system will also be fixed. For example the overall component
mole
c
m can be calculated as
) (
c g g c o o c
y S x S V m ρ ρ φ + = (3.50)
But sometimes, models using extensive variables use one more equation and one more
variable than necessary. Such as for a three-phase black-oil model, if we use pressure and
saturations as variables, one of the saturations can be easily removed by using the
saturation constraint equation, since it is a linear equation with respect to saturations. But
if we use pressure and overall component moles
c
m as variables, we can not easily
remove one of the overall component moles, since the relation between them is nonlinear.
For example in the case of black-oil models, we have
o
o
g o g o
g
g
g
w
w
w
m
B R B
m
B
m
B
V
ρ ρ ρ
φ
,

+ + = (3.51)
Eqn. 3.51 is actually the volume balance equation for black-oil models. For convenience
this volume balance equation is treated as part of the nonlinear equation set to complete
the system when calculating the Jacobian matrix and the RHS. This does not mean that
the degrees of freedom of this system is 4, in fact, it is only 3. The volume balance
equation is only a constraint equation (only has derivatives in the diagonal part of the
Jacobian matrix), and each of the 4 × 4 small matrices can be reduced to a smaller 3 × 3
matrix.
Is there any benefit in using extensive variables? Yes, sometimes, but not too much.
If the overall component moles
c
m are used, then the accumulation terms,
t m m
n
c
n
c
∆ −
+
/ ) (
1
will be linear with respect to these variables, and the mass balance is
exact at each Newton iteration (Farkas, 1997). If the overall component molar densities
c
r are used, then the accumulation term, t V r r
n
c
n
c
∆ ⋅ −
+
/ ] ) ( ) [(
1
φ φ is nearly linear with
respect to these variables if we consider that porosity changes are small with pressure,
and the mass balance will be nearly exact at each Newton iteration (Farkas, 1997). But if
the overall component mole fractions
c
z are used, then the accumulation term,
89
t V z z
n
c T
n
c T
∆ ⋅ −
+
/ ] ) ( ) [(
1
φρ φρ will be nonlinear, since the total fluid density
g g o o T
S S ρ ρ ρ + = changes a lot with both pressure and overall component mole
fractions, this will cause mass balance errors at each Newton iteration. In summary, if the
rock compressibility is much smaller than the fluid compressibility, such as for gas flow,
a model using the overall component molar densities
c
r should have similar performance
as a model using the overall component moles
c
m . If the rock is incompressible,
c c
r V m φ = and the only difference between
c
r and
c
m is a constant scalar ( φ V ), and both
models should have the same performance.
In Chapter 1, we mentioned that there are two types of variables, Type A and Type B.
Next we will compare the models using these two types of variables in terms of mass
balance and volume (saturation) balance errors.
• Type A models There is mass balance error at each Newton iteration, due to the
nonlinearity of the accumulation terms with respect to these variables. The volume
balance is exact at all times, since the saturation constraint equation is a linear
equation. Both balances will be exact when the model converges at the end of each
timestep (Farkas, 1997).
• Type B models If
c
r and
c
m are used, there is virtually no mass balance error at each
Newton iteration, but there is a volume balance error, now the saturation constraint
equation is a nonlinear equation with respect to these variables. Again, both balances
will be exact when the model converges at the end of each timestep (Farkas, 1997).
In reservoir simulation, mass balance is a much more desirable property than volume
balance. For Type A variables, Coats (1999) proposed a new approach to achieve exact
mass balance at each Newton iteration. In each iteration step, the Jacobian variables are
used to calculate well rate and inter-block fluxes, and the component mass changes are
calculated from the mass balance equations. As a result, there is no mass balance error.
But the mass balance errors are transformed into volume balance error in each iteration
step, and the relaxed volume balance method is used to control the volume balance error.
Is there a strong connection between mass balance and Newton iteration numbers?
No. Mass balance at each Newton iteration depends on the linearity of the accumulation
term. The Newton iteration number depends on the linearity of the flow equations, which
90
include three parts, the accumulation part, the flux part and the well part. For exact mass
balance, the accumulation part must be linear with respect to the selected variables, but
the degree of nonlinearity of the flux and well parts with respect to the selected variables
are still unknown. In compositional simulations, we are solving the mass balance
equations and the phase equilibrium relations together, and both of them are nonlinear.
The Newton iteration number depends on the nonlinearity of both sets of equations, the
nonlinearity of phase equilibrium relations with respect to different variables is even
more unpredictable. Due to these considerations, we conclude that for compositional
simulations, the Newton iteration number is not strongly influenced by the mass balance.
The results in Chapter 5 further validate this point.
Based on the above discussion, we can draw the following conclusions for different
equation and variable selections:
• Different equation and variable selections will change linear solver iterations, and a
good equation and variable selection should align the equations and variables in such
a way that variable i has the biggest influence on equation i (diagonal dominance).
The same effect can be achieved by applying block diagonal preconditioners for the
Jacobian matrix.
• Different equation selections will not change the behavior of Newton iterations, while
different variable selections can change the behavior of Newton iterations, which
depend on the nonlinearity of the equations with respect to different variables.
• No matter what types of variables are used, intensive or extensive, the degrees of
freedom of the system are always the same.
• Mass balance is a nice property to have, but it does not have a direct connection with
the convergence of the non-linear system (Newton iteration numbers).
Of course, when selecting equations and variables, the cost of calculating the Jacobian
matrix and the RHS should also be considered.
91
Chapter 4
IMPSAT Model and IMPSAT Based AIM Model
The General Formulation Approach has the advantage of allowing selection of any level
of implicitness. For isothermal compositional models, the implicit level (number of
implicit variables per gridblock) ranges from 1 in IMPES models to
c
n in fully implicit
(FIM) models. With the increase of implicit level, stability increases, and we can use
larger timestep size with fewer Newton iterations. However with the increase in number
of implicit variables, the computational cost per Newton iteration also increases
dramatically. In IMPES models, the cost of each linear solve is fixed relative to
c
n ,
because we always solve for one variable per gridblock, but in FIM models, the cost of
each linear solve increases as ) (
2 . 1 ~ 1 . 1
c
n O . The question here is how to balance these two
factors, and select a suitable implicit level that is fast enough and stable enough.
To make a simulation run fast, we need to reduce the number of unknowns per
gridblock from
c
n . This number is minimum for IMPES and maximum for FIM. We also
like a model to only solve for a fixed number (relative to
c
n ) of unknowns per gridblock
as is the case for the IMPES model. Under these constraints, implicit pressure and
implicit saturations appear to be desirable, because both variables are independent of the
number of components. Here we propose the IMPSAT model, where only pressure and
saturations are treated implicitly, and all of the component mole fractions are treated
explicitly. Since one of the saturations can be removed using the saturation constraint
equation, we only have
p
n unknowns per gridblock. In reservoir simulation, typically we
have two or three phases, so the number of unknowns per gridblock for the IMPSAT
model is three or less. Compared to
c
n unknowns per gridblock for the FIM model. Thus
the IMPSAT model has the potential to yield big savings in computational cost per linear
solve, especially for problems with large number of components.
In fact, the IMPSAT model is not new, Quandalle and Savary (1989) and Branco and
Rodriguez (1995) also proposed similar ideas. In Quandalle and Savary’s paper, it was
92
called IMPIMS (implicit pressure and implicit saturations) model, and they used it to
simulate a laboratory experiment. In Branco and Rodriguez’s paper, it was called semi-
implicit model, and several small test problems were used for validation. Neither paper
provided a detailed analysis of the model, no stability criteria were derived and no
comparisons with the IMPES and FIM models were provided. Furthermore all of the tests
were on small simple problems. In order to prove that IMPSAT works in practice, more
work was needed in all of these areas. As a matter of fact IMPSAT is an option in at least
one of the commercial simulators, but it does not work properly. In this study we will
show that when properly implemented, IMPSAT works very well for most cases.
Hopefully this will lead to greater use of this method.
In this chapter, we will first analyze various aspects of the IMPSAT model, then we
will introduce a new IMPSAT based AIM model, where IMPSAT formulation is added
into the traditional AIM model, IMPES+FIM (Forsyth and Sammon, 1986). We believe
that this new AIM model can replace the traditional AIM model, especially for large field
case studies.
4.1 IMPSAT Model
In this section, we will answer the following four questions about the IMPSAT model:
Why does it work, what is its stability criterion, what is its cost and how to build it most
efficiently? In answering each question, we will discuss advantages and disadvantages of
IMPSAT compared to the IMPES and FIM models.
4.1.1 Why Does IMPSAT Work?
In order to explain why IMPSAT works, we need to take a look at the variable coupling
between gridblocks. For the natural variable selection, we have three types of variables,
pressure, saturation and mole fractions. Each of them is coupled from gridblock to
gridblock due to the flux terms in the mass balance equations. For one-dimensional flow
without gravity and capillary pressure, each component flux within a phase can be
expressed as the product of a transmissibility term and a pressure difference between two
neighboring gridblocks:
93
p T Flux
cp p c
∆ ⋅ =
,
, and
cp p p p c
x C T ρ λ ⋅ =
,
(4.1)
The transmissibility term has four parts, a constant C, a phase mobility
p
λ which only
depends on pressure and saturations, a phase density
p
ρ which only depends on pressure
and component mole fractions, and a component mole fraction
cp
x . In reservoir
simulation, this transmissibility term is always evaluated at upstream conditions.
Depending on the flow directions, the flux term of gridblock i could depend on the
variables in gridblock i, i+1 and i-1:
) , , , , , , , , (
1 , , , , 1 , , 1 , , 1 , 1 1 , , , , + − + − + −
=
i p c i p c i p c i p i p i p i i i i p c i p c
x x x S S S p p p Flux Flux
(4.2)
Due to this, all of the variables are coupled from gridblock to gridblock, and we need to
solve for all of them together, as is the case for the FIM model.
The degree of coupling is different for each variable. The coupling between pressures
exists in both the transmissibility part and the pressure difference part. While the
coupling between saturations and between mole fractions only exists in the
transmissibility part. If we fix the transmissibility term, the flux term will become a linear
function of gridblock pressures:
) , , (
1 1 , , , , + −
=
i i i i p c i p c
p p p Flux Flux (4.3)
From Eqn. 4.3, we can see that, pressure is always strongly coupled from gridblock to
gridblock, while saturations and mole fractions are loosely coupled from gridblock to
gridblock. The IMPES model is based on this observation, it ignores the coupling of
saturations and mole fractions between gridblocks by treating the transmissibilities
explicitly. Once this is done, pressures are decoupled and can be computed implicitly
followed by explicit updating of saturations and mole fractions, gridblock by gridblock.
Here, we make a new claim: the coupling between mole fractions is even weaker than
the coupling between saturations. For saturations and mole fractions, the ratios of the flux
term derivatives to the accumulation term derivatives are compared, which are also the
ratio of the off-diagonal term to the diagonal term in the Jacobian matrix, and roughly
94
represent the degree of coupling between gridblocks for each variable. For saturations,
this ratio can be expressed as
) (
) (
) (
1
1
p
S
n
x
p x
nS
ACC
Flux
Ratio
p
n
p
cp p
cp
p
n
p
p
S
∆ ⋅ =

=


=


φµ φρ
µ
ρ
(4.4)
For mole fractions, this ratio can be expressed as
) (
) (
) (
1
p
S
S
p
S
ACC
Flux
Ratio
p
n
p
p p
p
n
p
p
X
∆ =

=


=

φµ φρ
µ
ρ
(4.5)
Here we assume a power relation ( 1 , ≥ = n S k
n
p rp
) for phase relative permeabilities and
ignore the dependency of phase densities on mole fractions. Comparing Eqn. 4.4 with
Eqn. 4.5, we can see that the coupling between saturations is approximately n times
stronger than the coupling between mole fractions. For three-dimensional problems, due
to the gravity effect, the large density and viscosity difference between the gas and the oil
phases will enhance the movement of phase front, and this coupling difference could be
even larger. The existence of capillary pressure will also increase this difference, since
capillary pressure is assumed to be only a function of saturations. Based on these
observations, we propose the IMPSAT model, where the phase density and the
component mole fraction in the transmissibility part are treated explicitly, and the flux
terms are only functions of pressures and saturations:
) , , , , , (
1 , , 1 , 1 1 , , , , + − + −
=
i p i p i p i i i i p c i p c
S S S p p p Flux Flux (4.6)
In the IMPSAT model, both pressure and saturations are simultaneously solved for first,
then component mole fractions are updated explicitly gridblock by gridblock. Since we
only ignore the coupling between mole fractions, which is generally weak, the IMPSAT
model should be more stable than the IMPES model. Hopefully this improved stability
will allow approximately the same size timesteps as in the FIM model.
Next we will derive the stability criterion for the IMPSAT model and compare it with
the stability criterion of the IMPES model.
95
4.1.2 IMPSAT Stability Criterion
In order to reduce the number of timesteps and Newton iterations, a more stable model
than IMPES is desirable. In the IMPSAT model, only the mole fractions are treated
explicitly, so its stability criterion only needs to satisfy Eqn. 3.44, which is
1 ≤
+
+

=
c g g c o o
c g g c o o
IMPSAT
y S x S
y q x q
V
t
CFL
ρ ρ
ρ ρ
φ
(4.7)
In the IMPES model, both the saturations and the component mole fractions are treated
explicitly, its stability criterion should satisfy both Eqn. 3.37 and Eqn. 3.44, which can be
written as
1 ) , ( ≤
+
+
+



=
c g g c o o
c g g c o o
g o
o
g
o
o
g
g
g
g
g
o
IMPES
y S x S
y q x q
q
dS
d
q
dS
d
MAX
V
t
CFL
ρ ρ
ρ ρ
λ λ
λ
λ
λ λ
λ
λ
φ
(4.8)
From these two equations, we can see that, the IMPSAT model is always more stable
than the IMPES model, but by how much? For a one-dimensional problem without
gravity, Eqn. 4.7 and Eqn. 4.8 can be simplified as
1 ≤ ⋅

=
c
T
IMPSAT
V
V
t q
CFL
φ
(4.9)
1 ) , ( ≤

=
c
g
g
T
IMPES
V
dS
df
MAX
V
t q
CFL
φ
(4.10)
where
¦
¹
¦
´
¦
∞ →
=

=
− +
− +
=
c g g
g o c
c o o
o c g g o
o c g g o
c
K when S f
K when
K when S f
K S
K f
V
, /
/ , 1
0 , /
) (
) (
ρ ρ
ρ ρ ρ
ρ ρ ρ
(4.11)
The difference between these two CFL numbers depends directly on the relative size of
g g
dS df / and
c
V . We can plot these two functions for a typical fractional flow curve
(
3
g rg
S k = ,
2
o ro
S k = , 10 / =
g o
µ µ and 10 / =
g o
ρ ρ ).
g g
dS df / is shown as a function of
g
S in Figure 4.1. Note that
g g
dS df / has a maximum value of 2.8.
c
V is shown as a
function of
g
S for different
c
K values in Figure 4.2, different
c
K values correspond to
96
different components, and lighter components have larger
c
K values since lighter
components are more likely to stay in the gas phase. The maximum value in Figure 4.2 is
around 1.4. For this example, we can say that the IMPSAT model is about two times
more stable than the IMPES model. From Figure 4.2, we notice that lighter components
have larger
c
K and
c
V values, so they cause more instability compared to the heavier
components. This is because lighter components are more likely to stay in the gas phase,
which has a much higher flow rate than the oil phase due to its small viscosity. If we
include two extra variables
l
x ,
l
y (component l is the lightest one) in the implicit
variables, this model (IMPSAT++) will become even more stable.
0
0.5
1
1.5
2
2.5
3
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Sg
d
F
g
_
d
S
g
Figure 4.1
g g
dS df / as a function of
g
S
97
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
S
g
V
c
Kc=40
Kc=20
Kc=10
Kc=5
Kc=0.05
Figure 4.2
c
V as a function of
g
S for difference
c
K values
For three-dimensional problems, where gravity is important, the large density and
viscosity difference between the gas and the oil phases will enhance the movement of
phase front, and the stability difference between the IMPSAT and the IMPES models will
be much larger than two times. Here we compare their stable timestep sizes for a three-
dimensional (5x5x5) four-component (C1, C2, C4 and C7) compositional simulation with
one corner producer completed only in the top layer (Cao, 2002). Figure 4.3 shows the oil
saturation at the well block. Initially the reservoir was not at equilibrium, since the same
initial overall composition was used for all depths. Up to 300 days gravity dominated the
process, causing phase segregation. After about 400 days gravity segregation is complete
and the oil phase starts to cone around the producer.
98
0
0.1
0.2
0.3
0.4
0.5
0.6
0 200 400 600 800 1000 1200
t (days)
S
o
Figure 4.3 Oil saturation at the well block
Figure 4.4 reports the maximum stable timestep size of the IMPES model, which was
calculated from Eqn. 4.8. Here the maximum stable timestep size was around 13 days,
and during the transition period between 300 and 400 days, it was smaller than 2 days.
Figure 4.5 reports the maximum stable timestep size of the IMPSAT model, which was
calculated from Eqn. 4.7. Here, the maximum stable timestep size ranged from 30 days to
over 90 days, also no problems were observed at the transition period. The ratio between
these two stable timestep sizes is from 2 to 7 times.
99
0
2
4
6
8
10
12
14
16
0 200 400 600 800 1000 1200
t (days)
d
t
(
d
a
y
s
)
Figure 4.4 Maximum stable timestep size for the IMPES model
0
10
20
30
40
50
60
70
80
90
100
0 200 400 600 800 1000 1200
t (days)
d
t
(
d
a
y
s
)
Figure 4.5 Maximum stable timestep size for the IMPSAT model
100
The results in Figure 4.4 and Figure 4.5 are for CFL=1. In practice, we can use a
larger CFL number, for IMPES models, normally CFL=2 is fine (Coats, 2001). For the
IMPSAT model, we have found that CFL=3 or 4 is generally a safe limit. This means that
in practice, the IMPSAT model has even greater advantage than that demonstrated by the
example. The comparison between the IMPES and the IMPSAT models for larger CFL
numbers are included in Chapter 5. In general, for most three-dimensional problems, the
stable timestep size of the IMPSAT model can be one order of magnitude larger than the
stable timestep size of the IMPES model. We have demonstrated that the IMPSAT model
is much more stable than the IMPES model, how about the cost of the IMPSAT model
compared to the costs of the FIM and IMPES models? In the next subsection, we will
analyze the cost of different compositional models.
4.1.3 Cost of IMPSAT Model
In order to compare the cost (CPU time) of the IMPSAT model with the costs of the FIM
and IMPES models, it is necessary to analyze the cost of simulation for models with
different implicit levels. In compositional simulations, the most time consuming parts for
each Newton iteration are the Jacobian construction, the flash calculation and the linear
solve. The cost of each part depends on implementation details of the individual
simulators, here we provide some rough estimates for each model.
The cost of the Jacobian construction depends on both the selection of primary
variables and the implicit level, and it changes significantly from model to model. For
FIM models, it can be expressed as
] [
2
,
2
, , c conn
FIM
conn Jac c block
FIM
block Jac Newton FIM Jac
N N C N N C N T + = (4.12)
where
block
N is the total number of gridblocks,
conn
N is the total number of connections
between gridblocks, and
FIM
block Jac
C
,
and
FIM
conn Jac
C
,
are the coefficients (constants). The first
term in Eqn. 4.12 is the cost of calculating each of the
c
N ×
c
N diagonal entries of the
Jacobian matrix, and the second term in Eqn. 4.12 is the cost of calculating each of the
c
N ×
c
N off-diagonal entries of the Jacobian matrix.
FIM
block Jac
C
,
and
FIM
conn Jac
C
,
are different
for different simulators and different variable selections, and generally
FIM
block Jac
C
,
and
101
FIM
conn Jac
C
,
of the FIM model with Type B variables are larger than those of the FIM model
with Type A variables, because we need to use the chain rule to calculate the derivatives
in the Type B FIM model. For the IMPES model with Type A variables, the cost of the
Jacobian construction is approximately given by
] ) 1 ( ) [(
3 _
,
2 _
, _ ,
− + + =
c block GFA c conn
A IMPES
conn Jac c block
A IMPES
block Jac Newton A IMPES Jac
N N C N N C N N C N T
(4.13)
where the first two terms are the costs of calculating the full Jacobian matrix, where all of
the off-diagonal entries are
c
N ×1 matrices, the last term is the cost of reducing the
implicit level from
c
N to 1 (inverting each small matrix D, whose size is (
c
N -1)×(
c
N -
1)), and
GFA
C is the corresponding coefficient. For the IMPES model with Type B
variables, since the accumulation term of the mass balance equations can be simply
expressed as t V r r
n
c
n
c
∆ ⋅ −
+
/ ] ) ( ) [(
1
φ φ , all diagonal entries of the full Jacobian will only
have non-zero terms at the diagonal and one column, and the cost of the Jacobian
construction is only
)] 1 ( ) [(
_
,
_
, _ ,
− + + =
c block GFA c conn
B IMPES
conn Jac c block
B IMPES
block Jac Newton B IMPES Jac
N N C N N C N N C N T
(4.14)
For the IMPSAT model (Type A variables), the cost of the Jacobian construction can be
expressed as
] ) ( ) [(
3
,
2
, , p c block GFA p c conn
IMPSAT
conn Jac c block
IMPESAT
block Jac Newton IMPSAT Jac
N N N C N N N C N N C N T − + + =
(4.15)
Similarly, the first two terms are the costs of calculating the full Jacobian matrix, where
all of the off-diagonal entries are
c
N ×
p
N matrices, the last term is the cost of reducing
the implicit level from
c
N to
p
N (inverting each small matrix D, whose size is (
c
N -
p
N )×(
c
N -
p
N )), and
GFA
C is the corresponding coefficient. For models with
i
N
(
c i
N N ≤ ) implicit variables, Eqn. 4.15 (cost of the Jacobian construction) can be
generalized as
] ) ( ) [(
3
,
2
, i c block GFA i c conn conn Jac c block block Jac Newton Jac
N N N C N N N C N N C N T − + + =
(4.16)
102
The cost of the flash calculation is independent of the implicit level, and it can be
expressed as
] [
2 flash
n
c block
flash
solve c block
flash
Jac Newton flash
N N C N N C N T + = (4.17)
where the first term is the cost of calculating the
c
N ×
c
N flash Jacobian matrix for each
gridblock and the second term is the cost of solving it, and
flash
solve
C and
flash
n depend on the
solver used.
The cost of each linear solve depends on the total number of implicit unknowns
(
i block
N N ), and it can be written as
] ) ( [
_
solver
n
i block solver Newton solve linear
N N C N T = (4.18)
where
solver
C and
solver
n depend on the linear solver used. Typically 2 . 1 ~ 1 . 1 =
solver
n for
good iterative linear solvers.
The total cost of simulation is the summation of the costs of these three parts.
solve linear flash Jac total
T T T T
_
+ + = (4.19)
From Eqn. 4.13 to Eqn. 4.19, we can see that if we know the total number of Newton
iterations, we can roughly compare the costs of different models. We have demonstrated
that the IMPSAT model is much more stable than the IMPES model in Subsection 4.1.2
and compared its cost with the costs of the FIM and IMPES models in Subsection 4.1.3.
Next we will introduce an efficient way to construct the IMPSAT model.
4.1.4 How to Build IMPSAT Efficiently?
There is a very simple way to build the IMPSAT model. In both the water mass balance
equation (Eqn. 1.2) and the total hydrocarbon mass balance equation (Eqn. 1.6), only
pressure and saturations appear explicitly. Since the water phase density depends only on
pressure, the water mass balance equation only includes pressure and saturation
dependent terms, and it can be directly used as an IMPSAT equation without any
reduction. For the total hydrocarbon mass balance equation, if we ignore the dependency
of hydrocarbon phase densities on component mole fractions, then it will only include
103
pressure and saturation dependent terms and can be directly used as another IMPSAT
equation without any reduction.
IMPSAT needs three equations for three-phase flow, and we already have two. So we
only need to use the reduction steps in Chapter 3 on the remaining 2 −
c
n hydrocarbon
component mass balance equations to get one more IMPSAT equation, and the cost of
this operation is about 3 times the cost of building an IMPES model. If we consider the
dependency of hydrocarbon phase densities on component mole fractions, the reduction
steps in Chapter 3 need to be performed on the remaining 1 −
c
n hydrocarbon component
mass balance equations to get two more IMPSAT equations, and the cost is doubled.
4.2 IMPSAT Based AIM Model
For large and difficult problems, IMPES timestep size is too small to be practical, and
even IMPSAT is not stable enough. While FIM is always stable, it is just too expensive,
especially for problems with a large number of components. In such cases, we propose
adding the IMPSAT model into the traditional AIM model (Forsyth and Sammon, 1986),
we call the new AIM model the IMPSAT based AIM model. Compared to the traditional
AIM (IMPES+FIM) model, it is more flexible, more stable and less expensive. There are
three variations of the new IMPSAT based AIM model:
• IMPES+IMPSAT Here we use the IMPSAT model to replace the FIM model, and
this model is the least expensive one in terms of cost per Newton iteration.
• IMPSAT+FIM Here we use the IMPSAT model to replace the IMPES model, and
this model is the most stable one.
• IMPES+IMPSAT+FIM Here we use the IMPSAT model as the third formulation in
the new AIM model, and this model is the most general one. Actually, the first two
AIM models and the traditional AIM model are all special cases of this general AIM
model.
All of these AIM models are very easy to build using the General Formulation Approach
proposed in Chapter 3, where all of the operations are done gridblock by gridblock, and
we can control the implicit level at each gridblock separately.
104
Depending on different types of flow problems, one of these new AIM models will
outperform the traditional AIM model. For easy problems, IMPES+IMPSAT is the best
to use, for hard problems, IMPSAT+FIM is a better choice. With properly tuned
percentages of IMPES, IMPSAT and FIM gridblocks, IMPES+IMPSAT+FIM should be
the most efficient model to use, especially for large field case studies.
105
Chapter 5
Model Validation and Performance
In this chapter, we will present two sets of results, the first set is used to validate
individual models and techniques implemented in GPRS. The results from this set are
compared with the results from existing simulators. The second set is used to evaluate the
performance of different compositional models. Here we compare the performance of
IMPSAT and IMPSAT based AIM models with the traditional models (IMPES, FIM and
AIM).
Before we start showing the results from GPRS and comparing them with the results
from other simulators, it is worthwhile to discuss the convergence controls used in GPRS.
In GPRS, the convergence of Newton iterations is governed by both the maximum
residual and the maximum variable change. At convergence, the following condition
should be satisfied:
• Scaled mass balance equation residuals are less than 0.1. Equations are scaled by the
accumulation terms (component mass dividing timestep size).
• Scaled phase equilibrium relation residuals are less than 0.02. These are scaled by the
component fugacities in the gas phase.
• The maximum scaled pressure change (absolute pressure change divided by the
average reservoir pressure) is less than 0.0001.
• The maximum absolute saturation change is less than 0.005.
• The maximum absolute component mole fraction change is less than 0.001.
The convergence of iterative linear solvers is governed by the normalized linear equation
residual (
2 2
/ B AX B − ). This limit is set to 10
-4
.
5.1 Validation of GPRS
Here we show validation results for the black-oil and the compositional models in GPRS
The black-oil model results are compared with the results from Eclipse 100 (Geoquest,
2000A), and the compositional model results are compared with the results from Eclipse
300 (Geoquest, 2000A). We have also tested the unstructured grid handling and multi-
106
point flux approximations in GPRS, and compared our results with the results from
FLEX (Verma, 1996). Besides that, we will also show validation results for the General
Formulation Approach (different variable selections and implicit levels). Finally, we
include a non-conventional well problem, whose results are compared with the results
from Eclipse 100.
5.1.1 Black-oil Model
This is the first SPE comparative project (Odeh, 1981), a three-phase black-oil simulation
of a quarter of a 5-spot. This grid is 10×10×3. Each layer has different properties. One
gas injector is located at (1, 1, 1), and one oil producer is located at (10, 10, 3), and both
wells are under constant rate control, shown in Figure 5.1. Initially, the reservoir is full of
undersaturated oil and connate water. The simulation was run to 10 years with a
maximum timestep size of 180 days, and the results from GPRS are compared with the
results from Eclipse 100. Compositional formulation was used to simulate this black-oil
problem in GPRS, and both simulators were run in fully implicit mode. The gas was not
allowed to re-dissolve.
Figure 5.1 Black-oil reservoir
Both simulators used the same number of timesteps (32) and Newton iterations (114).
Figure 5.2 and Figure 5.3 show the results from GPRS and Eclipse 100. GPRS results are
shown in dots, and Eclipse 100 results are shown in solid lines. Figure 5.2 shows the oil
production rate, plateau production up until around 1000 days, then the producer changes
to bottom hole pressure (BHP) control. Figure 5.3 shows the gas oil ratio (GOR) at the
WOC
gas
107
producer, initially, there is no free gas, GOR is constant, after around 660 days, free gas
appears, and GOR increases. Basically, the results from these two simulators are the
same, which means that we have excellent agreement between GPRS and Eclipse 100.
4000
6000
8000
10000
12000
14000
16000
18000
20000
0 500 1000 1500 2000 2500 3000 3500 4000
time (days)
o
i
l
p
r
o
d
u
c
t
i
o
n
r
a
t
e
(
S
T
B
/
d
a
y
)
Eclipse
GPRS
Figure 5.2 Oil production rate at the producer from GPRS and Eclipse 100
0
5
10
15
20
25
0 500 1000 1500 2000 2500 3000 3500 4000
time (days)
G
O
R
(
M
S
C
F
/
S
T
B
)
Eclipse
GPRS
Figure 5.3 Gas oil ratio at the producer from GPRS and Eclipse 100
108
5.1.2 Compositional Model
This is a four-component, two-phase (gas-oil) compositional simulation (Cao, 2002). The
grid is 5×5×5. One producer is located at (5, 5, 1), which is under bottom hole pressure
(BHP) control (shown in Figure 5.4). The Peng-Robinson Equation of State (Peng and
Robinson, 1976) was used for flash calculations. Initially the reservoir has both the oil
and gas phases. The simulations were run to 1000 days with a maximum timestep size of
30 days, and the results from GPRS are compared with the results from Eclipse 300
(Geoquest, 2000A).
Figure 5.4 Compositional reservoir
GPRS uses Type A variables, while Eclipse 300 uses Type B variables (pressure and
overall molar density of each component). Both simulators were run in fully implicit
mode. Both simulators quickly reached the maximum timestep size of 30 days, and used
roughly the same number of timesteps (GPRS used 39 timesteps, while Eclipse 300 used
38 timesteps). GPRS took an average of 2.5 Newton iterations per timestep, while Eclipse
300 took an average of 2.1 Newton iterations per timestep. The slight increase of Newton
iteration number in GPRS was caused by the difference in Newton iteration convergence
control in the two simulators. In Eclipse 300, only the maximum change of pressure and
effective saturations (the effective saturation change for a given molar density change)
are used for convergence control (Geoquest, 2000A). Also their limits are larger than the
limits used in GPRS, Eclipse 300 uses 0.1 atm for absolute pressure change and 0.01 for
effective saturation change, while GPRS uses 0.0001 for maximum scaled pressure
109
change and 0.005 for absolute saturation change. Figure 5.5 and Figure 5.6 compare the
results from GPRS with the results from Eclipse 300.
300
350
400
450
500
550
0 200 400 600 800 1000 1200
time (days)
p
r
e
s
s
u
r
e
(
p
s
i
a
)
(1,1,5)_ecl
(1,1,5)_gprs
prod_ecl
prod_gprs
Figure 5.5 Well block and block (1,1,5) pressures from GPRS and Eclipse 300
with ∆t
max
=30 days
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
(1,1,5)_ecl
(1,1,5)_gprs
prod_ecl
prod_gprs
Figure 5.6 Well block and block (1,1,5) oil saturations from GPRS and Eclipse 300
with ∆t
max
=30 days
110
Similar to the results in Figure 5.2 and Figure 5.3, GPRS results are shown in dots, and
Eclipse 300 results are shown in solid lines. The black lines are for producer (5,5,1), and
the blue lines are for block (1,1,5). Figure 5.5 shows the pressure at block (1,1,5) and at
the producer (5,5,1). Figure 5.6 shows the oil saturation at these two blocks. The oil
saturation at the producer block from the two simulators does not match very well, the
reason is that Eclipse 300’s convergence criteria (pressure and effective saturation
changes) are not as strict as those used in GPRS. Actually Eclipse 300 goes to the next
timestep without full convergence in the current timestep. From Figure 5.6 we can notice
a glitch (around 90 days) in Eclipse 300 results. By reducing the maximum timestep size
from 30 days to 10 days in Eclipse 300, the results improve as shown in Figure 5.7.
Eclipse 300 used a maximum timestep size of 10 days, and GPRS still used 30 days. Now
these two results are almost on top of each other. Hence we can conclude that the
compositional model in GPRS works well, and at times it performs even better than the
model in Eclipse 300. From Figure 5.7, we notice that, even for 10 days, there is still a
small glitch (around 330 days) in Eclipse 300 results, probably still due to the loose
convergence control.
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
(1,1,5)_ecl
(1,1,5)_gprs
prod_ecl
prod_gprs
Figure 5.7 Well block and block (1,1,5) oil saturations from GPRS and Eclipse 300
with ∆t
max
=30 days for GPRS and ∆t
max
=10 days for Eclipse 300
111
5.1.3 Unstructured Grid and Multi-Point Flux
A test problem pieced together from Verma (1996) was used to validate the
implementation of unstructured grids and multi-point flux in GPRS. This is a quarter of a
five spot simulation of a homogeneous black-oil (water-oil) reservoir (Cao, 2002), one
water injector is located at the lower-left corner and one producer is located at the upper-
right corner. Both wells are at constant rate control. The grid is a two-dimensional (x-y)
triangular grid with local grid refinements around the wells, Figure 5.8a shows the
triangular elements, and Figure 5.8b shows the control volumes (gridblocks). Most of the
multi-point fluxes are around the wells, where the gridblocks are irregular. This problem
has 301 gridblocks, 838 connections, and about 30% of the connections use multi-point
flux calculations.
a) triangular elements b) control volumes
Figure 5.8 Unstructured grid (Verma, 1996)
We ran this problem using GPRS and compared its results with the results from
FLEX (Prevost, 2002). Figure 5.9 shows the water cut at the producer. Considering the
differences in these two simulators, the results compare well. There is only a small
discrepancy at the water breakthrough time. We can conclude that the unstructured grid
handling and multi-point flux approximations in GPRS work well.
112
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 5000 10000 15000 20000
time (days)
W
C
T
FLEX
GPRS
Figure 5.9 Water cut results from GPRS and FLEX for unstructured grid
5.1.4 General Formulation Approach
This is the same homogeneous 5×5×5 four component (C1, C2, C4, C7) two hydrocarbon
phase problem that was used to validate the compositional modeling in Subsection 5.1.2.
Here we compare the results of models with different variable selections and implicit
levels. The maximum timestep size of 30 days was used for all runs. Figure 5.10 and
Figure 5.11 compare the results of the FIM model with Type A and Type B variables.
Type A results are shown in solid lines, and Type B results are shown in dots. Figure 5.10
shows the gridblock pressure at the producer and Figure 5.11 shows the oil saturation at
the producer. The results from both FIM models match exactly, this is because they are
solving the same equations and at convergence they should have the same solutions.
Figure 5.12 and Figure 5.13 compare the results of models of Type A variables with
different implicit levels, and they are the FIM model (all four primary variables are
implicit), the IMPSAT++ model (the first three primary variables are implicit), the
IMPSAT model (the first two primary variables are implicit) and the IMPES model (only
pressure are implicit). Figure 5.12 shows the gridblock pressure at the producer and
Figure 5.13 shows the oil saturation at the producer. From these results, we can see that
113
the IMPES results have less numerical diffusion, and the results from the other three
models are basically the same.
300
350
400
450
500
550
0 200 400 600 800 1000 1200
time (days)
p
r
e
s
s
u
r
e
a
t
t
h
e
p
r
o
d
u
c
e
r
(
p
s
i
a
)
Type A
Type B
Figure 5.10 Well block pressure for the FIM model with Type A and Type B variables
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
(
p
s
i
a
)
Type A
Type B
Figure 5.11 Well block oil saturation for the FIM model
with Type A and Type B variables
114
300
350
400
450
500
550
0 200 400 600 800 1000 1200
time (days)
p
r
e
s
s
u
r
e
a
t
t
h
e
p
r
o
d
u
c
e
r
(
p
s
i
a
)
FIM
IMPSAT++
IMPSAT
IMPES
Figure 5.12 Well block pressure for models with different implicit levels
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
(
p
s
i
a
)
FIM
IMPSAT++
IMPSAT
IMPES
Figure 5.13 Well block oil saturation for models with different implicit levels
115
5.1.5 Non-conventional Well
This is the same 10×10×3 three-phase black-oil problem that was used to validate the
black-oil modeling in Subsection 5.1.1. Here, the producer is replaced by a BHP
controlled dual-lateral well, which is located at (6-10, 10, 3) and (10, 6-10, 3), shown in
Figure 5.14. Initially, the reservoir is full of undersaturated oil and connate water. The
simulation was run to 10 years with a maximum timestep size of 180 days, and the results
from GPRS are compared with the results from Eclipse 100. Compositional formulation
was used to simulate this black-oil problem in GPRS, and both simulators were run in
fully implicit mode. The gas was not allowed to re-dissolve.
Figure 5.14 Black-oil reservoir with a dual-lateral producer
Figure 5.15 and Figure 5.16 show the results from GPRS and Eclipse 100. GPRS results
are shown in dots, and Eclipse 100 results are shown in solid lines. Figure 5.15 shows the
oil production rate and Figure 5.16 shows the gas oil ratio (GOR) at the producer. The
results from these two simulators are almost the same.
WOC
gas
116
0
50000
100000
150000
200000
250000
0 500 1000 1500 2000 2500 3000 3500 4000
time (days)
o
i
l
p
r
o
d
u
c
t
i
o
n
r
a
t
e
(
S
T
B
/
d
a
y
)
Eclipse
GPRS
Figure 5.15 Oil production rate at the producer from GPRS and Eclipse 100
for a dual-lateral well problem
0
5
10
15
20
25
30
0 500 1000 1500 2000 2500 3000 3500 4000
time (days)
G
O
R
(
M
S
C
F
/
S
T
B
)
Eclipse
GPRS
Figure 5.16 Gas oil ratio at the producer from GPRS and Eclipse 100
for a dual-lateral well problem
117
So far, we have shown that the basic modules of GPRS work well, we can now start
to evaluate the performance of different compositional models using various
compositional problems. The performance of individual compositional models is
independent of the grid type and the method of flux approximation, so in this part we will
use Cartesian grids and two-point flux approximations for all problems.
5.2 Performance of Compositional Models in GPRS
A series of compositional problems were used to evaluate the performance of different
compositional models. The size of these problems ranges from 125 gridblocks to 100,000
gridblocks, number of components ranges from 4 to 9, with both homogeneous and
highly heterogeneous domains. The compositional models evaluated here include fully
implicit (FIM) models with both types of variables (Type A and Type B), IMPES models
with both types of variables, the IMPSAT model with Type A variables and the
traditional and new AIM models. Besides the simulation results, we also report the
iteration counts (number of timesteps, number of total Newton iterations and number of
total linear solver iterations) and the timing results (solver time and total running time)
for each problem and each model. All of the simulations were performed on a SGI origin
200 workstation.
Here both Type A and Type B variables were used. For a four hydrocarbon
component and two hydrocarbon phase problem, the full set of equations (total 8) include
the mass balance equations and the phase equilibrium relations for each hydrocarbon
component, with the four mass balance equations as the primary equations. For Type A
variables, the full set of variables is
g
p ,
g
S ,
1
y ,
2
y ,
3
y ,
1
x ,
2
x ,
3
x , where
i
y and
i
x
are the component mole fractions in the gas and oil phases, and
g
p ,
g
S ,
1
y ,
2
y are the
primary variables. For Type B variables, the full set of variables is
g
p ,
1
r ,
2
r ,
3
r ,
g
S ,
1
y ,
2
y ,
3
y , where
i
r are the overall densities of hydrocarbon components, and
g
p ,
1
r ,
2
r ,
3
r
are the primary variables.
In this section, we will first introduce compositional problems used, then evaluate the
performance of individual compositional models. The performance of compositional
models is evaluated under different conditions. Each problem is designed for one specific
condition. These conditions include injection of components, heterogeneity, large number
118
of components and large systems. The five compositional problems used here are
discussed below (Cao, 2002):
• Case 1 This is the same homogeneous 5×5×5 four component (C1, C2, C4, C7) two
hydrocarbon phase problem that was used to validate the compositional modeling in
GPRS. One bottom hole pressure (BHP) controlled producer is located at (5, 5, 1).
This is a relatively easy problem, and both IMPES and IMPSAT should perform well.
• Case 2 This is the same problem as in Case 1, but here an injector is added to
increase the difficulty. The injector is located at (1, 1, 1). It is under bottom hole
pressure control and C1 is injected. This problem is difficult for the IMPSAT model,
because a component is injected when the component mole fractions are treated
explicitly.
• Case 3 This is a heterogeneous problem, with four components (C1, C2, C4, C7) and
two hydrocarbon phases. The grid is 24×1×25. One bottom hole pressure controlled
producer is located at (1, 1, 1-3), and it penetrates only the top three layers. The
permeability field is from the 9
th
SPE comparative project (Killough, 1995). Only the
top layer, shown in Figure 5.17, is used. The permeability changes over four orders of
magnitude and it is correlated along the x direction. The primary objective here is to
test the performance of different models on a difficult heterogeneous problem. Due to
high flow rates in the high permeability regions, this problem is hard for both IMPES
and IMPSAT.
• Case 4 This is a nine-component problem. The fluid description is from the 3
rd
SPE
comparative project (Kenyon and Behie, 1987), and the nine components are CO2,
N2, C1, C2, C3, C4-6, C7+
1
, C7+
2
and C7+
3
. The grid is 5×5×5 with homogeneous
permeability, and one bottom hole pressure controlled producer is located at (5, 5, 1).
Due to the large number of components, this problem is hard for both IMPES and
IMPSAT.
• Case 5 This is a large homogeneous problem with 100,000 gridblocks (100×100×10)
and four components (C1, C2, C4, C7). One bottom hole pressure controlled producer
is located at (100, 100, 1-2), and it penetrates only the top two layers. Compared to
other problems, this problem has much smaller gridblocks (100ft×100ft×10ft
compared to 1000ft×1000ft×10ft for other problems). This small gridblock size limits
the maximum stable timestep size of IMPSAT to around 0.5 days, and it is virtually
119
impossible to run the problem with this model. The stability restriction is even worse
for IMPES models. So for this problem, only the FIM and AIM models were used.
The stability of the IMPES+IMPSAT model is even worse than the stability of the
IMPSAT model, so it was also not used.
All of the simulations were run to 1000 days, and the Peng-Robinson EOS (Peng and
Robinson, 1976) was used for flash calculations. Now that we have introduced all of the
problems, next we will show the performance of GPRS for each type of compositional
model, starting from the FIM model.
Figure 5.17 Heterogeneous permeability field (lnk) for Case 3
5.2.1 Fully Implicit Models
The FIM model with both Type A and Type B variables was used. Model performance is
compared for different problems and different timestep sizes. The maximum timestep
sizes tested were 5, 30 and 100 days (For Case 5, only timestep sizes of 30 and 100 days
were used). Figure 5.18 to Figure 5.22 show the well block oil saturation for each
120
problem, and the legend in each figure marks the model used, such as B_30days stands
for Type B FIM model with a maximum timestep size of 30 days. Type A variable results
are drawn in lines, and Type B variable results are drawn in dots. From these results, we
can draw the following conclusions:
• For the same maximum timestep size, both FIM models match exactly, this is because
they are solving the same equations and at convergence they should have the same
solutions.
• With the increase of timestep size, there is more numerical diffusion for both FIM
models and the results are more smoothed out.
• Both FIM models are always stable.
These three observations are true for all compositional problems.
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
A_5days
B_5days
A_30days
B_30days
A_100days
B_100days
Figure 5.18 Well block oil saturation comparisons for FIM models and Case 1 problem
121
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
A_5days
B_5days
A_30days
B_30days
A_100days
B_100days
Figure 5.19 Well block oil saturation comparisons for FIM models and Case 2 problem
0.45
0.47
0.49
0.51
0.53
0.55
0.57
0.59
0.61
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
A_5days
B_5days
A_30days
B_30days
A_100days
B_100days
Figure 5.20 Well block oil saturation comparisons for FIM models and Case 3 problem
122
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
A_5days
B_5days
A_30days
B_30days
A_100days
B_100days
Figure 5.21 Well block oil saturation comparisons for FIM models and Case 4 problem
0.555
0.56
0.565
0.57
0.575
0.58
0.585
0.59
0.595
0.6
0.605
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
A_30days
B_30days
A_100days
B_100days
Figure 5.22 Well block oil saturation comparisons for FIM models and Case 5 problem
123
Iteration counts and timing results for problems discussed above are presented in
Table 5.1 to Table 5.5. For all of the fully implicit runs, the CPR preconditioned GMRES
method was used to solve the linear system. We can draw the following conclusions
based on our analysis:
• For both FIM models, with the increase of timestep size, more Newton iterations are
needed at each timestep and more linear solver iterations are needed to solve each
linear system. This is because the system becomes less diagonally dominant as the
timestep size increases.
• There is no significant difference in the number of Newton iterations between these
two FIM models.
• Type B FIM model generally takes more linear solver iterations than Type A FIM
model. As a result, Type B FIM model takes more time on the linear solver, and in
some cases, the increase in CPU time can be as much as 30%. We also tried other
solvers and preconditioners, such as ILU0 and BlitzPak, and we observe the same
trend for all of them.
• Type B FIM model is also more costly in building the Jacobian matrix, since it needs
to use the chain rule to calculate the derivatives. With the higher solver cost, the total
cost is also substantially higher.
In summary, Type A FIM model costs less than Type B FIM model, at least for the
problems tested here. The implementations of Type A models are more efficient than the
implementations of Type B models in GPRS because of the variable switching, so we can
only compare the relative cost of these two types of models. This is true for all of the
other comparisons between models using these two types of variables.
A_5days B_5days A_30days B_30days A_100days B_100days
timesteps
N 202 202 39 39 18 18
iters Newton
N
_
420 420 98 98 56 56
iters solver
N
_
728 1135 229 363 143 221
(sec)
solver
T 10.52 11.83 2.66 3.15 1.58 1.86
(sec)
total
T 23.56 31.44 5.83 7.88 3.38 4.57
Table 5.1 Iteration and timing comparisons for FIM models and Case 1 problem
124
A_5days B_5days A_30days B_30days A_100days B_100days
timesteps
N 202 202 39 39 18 18
iters Newton
N
_
428 429 109 107 63 63
iters solver
N
_
945 1538 300 493 187 298
(sec)
solver
T 11.66 14.2 3.73 4.84 2.4 3.36
(sec)
total
T 25.12 33.78 7.35 9.81 4.6 6.39
Table 5.2 Iteration and timing comparisons for FIM models and Case 2 problem
A_5days B_5days A_30days B_30days A_100days B_100days
timesteps
N 202 202 38 38 17 17
iters Newton
N
_
413 413 99 99 58 58
iters solver
N
_
826 1647 248 483 153 272
(sec)
solver
T 42.41 53.53 11.02 14.64 6.69 8.87
(sec)
total
T 98.26 138.65 24.76 35.27 14.96 21.39
Table 5.3 Iteration and timing comparisons for FIM models and Case 3 problem
A_5days B_5days A_30days B_30days A_100days B_100days
timesteps
N 202 22 41 41 21 21
iters Newton
N
_
417 417 110 110 64 65
iters solver
N
_
1012 1197 349 410 213 256
(sec)
solver
T 77.9 80.16 22.23 22.96 13.04 14.03
(sec)
total
T 128.44 174.81 36.26 48.65 21.76 29.64
Table 5.4 Iteration and timing comparisons for FIM models and Case 4 problem
125
A_5days B_5days A_30days B_30days A_100days B_100days
timesteps
N X X
39 39 19 19
iters Newton
N
_
X X
115 115 79 79
iters solver
N
_
X X
483 638 379 540
(sec)
solver
T X X
9050 18490 6782 13490
(sec)
total
T X X
12680 24321 9292 17192
Table 5.5 Iteration and timing comparisons for FIM models and Case 5 problem
5.2.2 IMPES models
IMPES models with both Type A and Type B variables were used. Model performance is
compared for different problems and different CFL numbers (larger CFL numbers lead to
larger timestep sizes). Both CFL=1 and CFL=2 were used, CFL=1 is always stable, but
CFL=2 may not be always stable. Figure 5.23 to Figure 5.26 show the stable timestep
size (CFL=1) for each problem. Figure 5.27 to Figure 5.30 show the well block oil
saturation for each problem, and the legend in each figure marks the model used, such as
B_CFL=2 stands for Type B IMPES model with a maximum CFL number of 2. Type A
variable results are drawn in lines, and Type B variable results are drawn in dots. The
fully implicit result (the dark solid line) for maximum timestep size of 30 days is
included for comparison. From these results, we can draw the following conclusions:
• For all compositional problems tested here, the stable time step sizes of the IMPES
model are small, ranging from 1.5 days to 16 days. This is because in compositional
simulations, gas phase is always present, and gas flow is hard to handle for the
IMPES model due to its high mobility.
• The stable timestep sizes of the IMPES model have sudden jumps. This is because the
CFL limit of IMPES depends on the fractional flow derivative with respect to the
saturation (saturation velocity), and at the saturation front, it is discontinuous, which
causes the sudden jump.
• For the same timestep size, both IMPES models match exactly, this is because they
are solving the same IMPES equations and at convergence they should have the same
solution.
• Compared to the FIM model, the IMPES model has less numerical diffusion (shaper
fronts), due to the explicit treatment of transmissibilities.
126
• For Case 1, 2 and 3, IMPES with CFL=2 is stable or nearly stable. But with the
increase of number of components, such as in Case 4, this limit is reduced, and
CFL=1 or 1.5 is a safe limit.
0
2
4
6
8
10
12
14
16
0 200 400 600 800 1000 1200
time (days)
m
a
x
i
m
u
m
s
t
a
b
l
e
t
i
m
e
s
t
e
p
s
i
z
e
Figure 5.23 Stable timestep size for the IMPES model and Case 1 problem
0
2
4
6
8
10
12
14
16
18
0 200 400 600 800 1000 1200
time (days)
m
a
x
i
m
u
m
s
t
a
b
l
e
t
i
m
e
s
t
e
p
s
i
z
e
Figure 5.24 Stable timestep size for the IMPES model and Case 2 problem
127
0
2
4
6
8
10
12
14
0 200 400 600 800 1000 1200
time (days)
m
a
x
i
m
u
m
s
t
a
b
l
e
t
i
m
e
s
t
e
p
s
i
z
e
Figure 5.25 Stable timestep size for the IMPES model and Case 3 problem
0
1
2
3
4
5
6
0 200 400 600 800 1000 1200
time (days)
m
a
x
i
m
u
m
s
t
a
b
l
e
t
i
m
e
s
t
e
p
s
i
z
e
Figure 5.26 Stable timestep size for the IMPES model and Case 4 problem
128
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
FIM
A_CFL=1
B_CFL=1
A_CFL=2
B_CFL=2
Figure 5.27 Well block oil saturation comparisons for IMPES models
and Case 1 problem
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
FIM
A_CFL=1
B_CFL=1
A_CFL=2
B_CFL=2
Figure 5.28 Well block oil saturation comparisons for IMPES models
and Case 2 problem
129
0.45
0.47
0.49
0.51
0.53
0.55
0.57
0.59
0.61
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
FIM
A_CFL=1
B_CFL=1
A_CFL=2
B_CFL=2
Figure 5.29 Well block oil saturation comparisons for IMPES models
and Case 3 problem
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
FIM
A_CFL=1
B_CFL=1
A_CFL=2
B_CFL=2
Figure 5.30 Well block oil saturation comparisons for IMPES models
and Case 4 problem
130
Iteration counts and timing results for problems discussed above are presented in
Table 5.6 to Table 5.9. For all of the IMPES runs, the AMG preconditioned GMRES
method was used to solve the linear system. We can draw the following conclusions
based on our analysis:
• For both IMPES models, with the increase of CFL number (timestep size), more
Newton iterations are needed at each timestep and more linear solver iterations are
needed to solve each linear system. This is because the pressure system becomes less
diagonally dominant as the timestep size increases.
• There is no significant difference in Newton iteration numbers between these two
IMPES models.
• Number of linear solver iterations is also about the same for these two IMPES
models. This is because both IMPES models generate the same pressure system, and
the scalar difference between them is not enough to make any difference in linear
solver performance.
• Type B models are built from Type A models by variable switching in GPRS. This
increases the cost for Jacobian calculations in Type B models, as shown in the tables.
But in practice, Type B IMPES model can be built directly from the mass balance
equations. In this case Type B model will require fewer operations than Type A
model to form the pressure system (Coats, 1999). Hence Type B IMPES model
should be more efficient from the point of view of Jacobian matrix construction.
In summary, while our results don't show this, Type B IMPES model uses less time
than Type A IMPES model, due to lower cost in Jacobian matrix construction.
A_CFL=1 B_CFL=1 A_CFL=2 B_CFL=2
timesteps
N 146 146 80 80
iters Newton
N
_
301 301 174 174
iters solver
N
_
597 598 343 344
(sec)
solver
T 0.89 0.89 0.83 0.83
(sec)
total
T 8.98 13.66 7.82 11.94
Table 5.6 Iteration and timing comparisons for IMPES models and Case 1 problem
131
A_CFL=1 B_CFL=1 A_CFL=2 B_CFL=2
timesteps
N 214 214 114 114
iters Newton
N
_
442 440 249 246
iters solver
N
_
2995 2974 2008 1989
(sec)
solver
T 0.95 0.95 0.78 0.77
(sec)
total
T 14.9 20.53 10.99 15.99
Table 5.7 Iteration and timing comparisons for IMPES models and Case 2 problem
A_CFL=1 B_CFL=1 A_CFL=2 B_CFL=2
timesteps
N 107 107 54 54
iters Newton
N
_
218 218 112 112
iters solver
N
_
436 436 224 224
(sec)
solver
T 3.21 3.2 1.6 1.6
(sec)
total
T 29.49 44.53 15.65 15.65
Table 5.8 Iteration and timing comparisons for IMPES models and Case 3 problem
A_CFL=1 B_CFL=1 A_CFL=2 B_CFL=2
timesteps
N
482 482 237 237
iters Newton
N
_
991 991 672 671
iters solver
N
_
1979 1980 1342 1341
(sec)
solver
T
3.62 3.82 2.17 2.55
(sec)
total
T
105.11 209.61 74.52 149.63
Table 5.9 Iteration and timing comparisons for IMPES models and Case 4 problem
132
5.2.3 IMPSAT model
The performance of the IMPSAT (implicit pressure and implicit saturations) model is
evaluated for different problems and different CFL numbers (larger CFL numbers lead to
larger timestep sizes). CFL=1, 2 and 4 were used, CFL=1 is always stable, but CFL=2
and CFL=4 may not be always stable. Figure 5.31 to Figure 5.34 show the stable timestep
size (CFL=1) for each problem, compared with the stable timestep size of the IMPES
model. Figure 5.35 to Figure 5.38 show the well block oil saturation for each problem,
and the legend in each figure marks the model used, such as CFL=2 stands for the
IMPSAT model with a maximum CFL number of 2. The fully implicit result (the dark
solid line) for maximum timestep size of 30 days is included for comparison. From these
results, we can draw the following conclusions:
• The stable timestep sizes for the IMPSAT model are quite good, ranging from 6 days
to 90 days, which is 2 to 7 times larger than that for the IMPES model. In the
IMPSAT model, saturation is treated implicitly, so the existence of gas flow does not
create any problem.
• The stable timestep sizes of IMPSAT always change smoothly, while for IMPES we
observed sudden jumps. The CFL limit of the IMPSAT model depends on the
component velocity.
• The results of the IMPSAT model agree well with the results of the FIM model, and
the slight differences between the two are mostly due to the differences in timestep
size. For some problems, such as Case 1 and 3, the timestep size of IMPSAT reached
100 days, while for FIM the maximum timestep size was limited to 30 days.
• In theory, the IMPSAT model should have less numerical diffusion than the FIM
model, however for the problems tested here, we observe the same level of numerical
diffusion for the IMPSAT and FIM models.
• For Case 1, 2 and 3, IMPSAT with CFL=4 is stable. But with the increase of number
of components, such as in Case 4, this limit is also reduced, and CFL=2 or 2.5 is a
safe limit.
133
0
10
20
30
40
50
60
70
80
90
100
0 200 400 600 800 1000 1200
time (days)
m
a
x
i
m
u
m
s
t
a
b
l
e
t
i
m
e
s
t
e
p
s
i
z
e
IMPSAT
IMPES
Figure 5.31 Stable timestep size for the IMPSAT model and Case 1 problem
0
5
10
15
20
25
30
35
0 200 400 600 800 1000 1200
time (days)
m
a
x
i
m
u
m
s
t
a
b
l
e
t
i
m
e
s
t
e
p
s
i
z
e
IMPSAT
IMPES
Figure 5.32 Stable timestep size for the IMPSAT model and Case 2 problem
134
0
5
10
15
20
25
30
0 200 400 600 800 1000 1200
time (days)
m
a
x
i
m
u
m
s
t
a
b
l
e
t
i
m
e
s
t
e
p
s
i
z
e
IMPSAT
IMPES
Figure 5.33 Stable timestep size for the IMPSAT model and Case 3 problem
0
5
10
15
20
25
30
0 200 400 600 800 1000 1200
time (days)
m
a
x
i
m
u
m
s
t
a
b
l
e
t
i
m
e
s
t
e
p
s
i
z
e
IMPSAT
IMPES
Figure 5.34 Stable timestep size for the IMPSAT model and Case 4 problem
135
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
FIM
CFL=1
CFL=2
CFL=4
Figure 5.35 Well block oil saturation comparisons for the IMPSAT model
and Case 1 problem
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
FIM
CFL=1
CFL=2
CFL=4
Figure 5.36 Well block oil saturation comparisons for the IMPSAT model
and Case 2 problem
136
0.45
0.47
0.49
0.51
0.53
0.55
0.57
0.59
0.61
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
FIM
CFL=1
CFL=2
CFL=4
Figure 5.37 Well block oil saturation comparisons for the IMPSAT model
and Case 3 problem
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
FIM
CFL=1
CFL=2
CFL=3
Figure 5.38 Well block oil saturation comparisons for the IMPSAT model
and Case 4 problem
137
Iteration counts and timing results for problems discussed above are presented in
Table 5.10 to Table 5.13. For all of the IMPSAT runs, the CPR preconditioned GMRES
method was used to solve the linear system. We can draw the following conclusions
based on our analysis:
• For the IMPSAT model, with the increase of CFL number (timestep size), more
Newton iterations are needed at each timestep and more linear solver iterations are
needed to solve each linear system. This is because the system becomes less
diagonally dominant as the timestep size increases.
• Compared to the IMPES model, the IMPSAT model needs fewer (over 50%) number
of timesteps and Newton iterations due to its improved stability. IMPSAT may cost
more in the linear solver part than IMPES, because of its increased number of
unknowns, but it can also save a lot in the Jacobian matrix construction and flash
calculations. Both of these costs are directly proportional to the number of Newton
iterations, and they are two of the most time consuming parts in compositional
simulation. Finally, the total cost of IMPSAT is generally much lower than the total
cost of IMPES, and most of time, IMPSAT can cut the running time by half
compared to IMPES.
• For most problems, the improved stability of the IMPSAT model enables it to use the
same number of timesteps and Newton iterations as the FIM model (with maximum
timestep size of 100 days). Because IMPSAT solves for fewer unknowns in the linear
solver part, it is a cheaper alternative to the FIM model. All comparisons here
between the IMPSAT model and the FIM model are based on that the FIM model
uses 100 days as the maximum timestep size, which is quite large for typical
compositional simulations (The default maximum timestep size used in Eclipse 300 is
only 50 days). Of course, the FIM model is unconditionally stable, and it can use any
timestep size.
In summary, the IMPSAT model is much better than the IMPES model due to its
improved stability, and it is also cheaper than the FIM. For most problems, the IMPSAT
model can outperform both the IMPES and FIM models. But if the problem is very hard,
such as high flow rate or small gridblock sizes, the stable timestep size of IMPSAT can
also be quite small (less than 1 day), since it is proportional to cell volume divided by the
138
flow rate, as shown in Eqn. 4.7. In such cases, FIM models and AIM models are
appropriate.
CFL=1 CFL=2 CFL=4
timesteps
N 27 18 15
iters Newton
N
_
76 56 50
iters solver
N
_
193 136 132
(sec)
solver
T 0.78 0.55 0.48
(sec)
total
T 3.04 2.25 2.05
Table 5.10 Iteration and timing comparisons for the IMPSAT model
and Case 1 problem
CFL=1 CFL=2 CFL=4
timesteps
N
44 26 18
iters Newton
N
_
123 91 64
iters solver
N
_
323 255 186
(sec)
solver
T
1.88 1.51 1.2
(sec)
total
T
6.17 4.61 3.41
Table 5.11 Iteration and timing comparisons for the IMPSAT model
and Case 2 problem
CFL=1 CFL=2 CFL=4
timesteps
N
50 28 17
iters Newton
N
_
129 81 58
iters solver
N
_
348 221 158
(sec)
solver
T
6.1 4.05 2.86
(sec)
total
T
22.53 14.4 10.5
Table 5.12 Iteration and timing comparisons for the IMPSAT model
and Case 3 problem
139
CFL=1 CFL=2 CFL=3
timesteps
N
93 50 37
iters Newton
N
_
230 165 151
iters solver
N
_
546 405 424
(sec)
solver
T
3.44 3 3.42
(sec)
total
T
37.13 25.68 24.92
Table 5.13 Iteration and timing comparisons for the IMPSAT model
and Case 4 problem
5.2.4 AIM models
The traditional AIM model and three new IMPSAT based AIM models were used here.
Model performance is compared for different problems. For AIM models, there are two
ways to decide the timestep size and assign implicit level for each gridblock, and they are
discussed bellow:
• Fix timestep size For a given timestep size, assign the implicit level for each
gridblock according to the stability criteria (CFL number at that gridblock). This
method is straightforward, and the percentage of gridblocks for each formulation
changes from timestep to timestep.
• Fix percentage For a fixed percentage of gridblocks for each formulation, first
decide the maximum stable timestep size which can satisfy the given percentage, then
assign the implicit level for each gridblock according to the stability criteria. This
method is not straightforward, in order to decide the maximum stable timestep size
for a given percentage, we need to order the gridblocks according their CFL number.
For AIM systems, the performance of linear solvers and preconditioners depends strongly
on the percentage of gridblocks for each formulation. For example, CPR is more efficient
for systems where most gridblocks are FIM, while AMG is more efficient for systems
where most gridblocks are IMPES. Based on these considerations, the method of fixed
percentage is used in GPRS. The percentage for each AIM model was assigned as
following:
• IMPES+FIM 90% IMPES gridblocks and 10% FIM gridblocks
• IMPES+IMPSAT 90% IMPES gridblocks and 10% IMPSAT gridblocks
140
• IMPSAT+FIM 90% IMPSAT gridblocks and 10% FIM gridblocks
• IMPES+IMPSAT+FIM 90% IMPES gridblocks, 9% IMPSAT gridblocks and 1%
FIM gridblocks
The well blocks were forced to be either FIM or IMPSAT. The maximum timestep size
was set to be 100 days. Figure 5.39 to Figure 5.43 show the well block oil saturation for
each problem, and the legend in each figure marks the model used. The fully implicit
result (the dark solid line) for maximum timestep size of 100 days is included for
comparison. From these results, we can draw the following conclusions:
• The results of all AIM models agree well with the results of the FIM model.
• The results of AIM models with an IMPES formulation are on top of each other,
while the results of the FIM and the IMPSAT+FIM models are on top of each other.
This is mostly due to the difference in timestep sizes, IMPES timestep size can not
reach 100 days, but without IMPES, it can reach 100 days. Due to this, we observe
obvious differences in the results of different AIM models for Case 3 and 5.
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
FIM
IMPES+FIM
IMPES+IMPSAT
IMPSAT+FIM
IMPES+IMPSAT+FIM
Figure 5.39 Well block oil saturation comparisons for AIM models and Case 1 problem
141
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
FIM
IMPES+FIM
IMPES+IMPSAT
IMPSAT+FIM
IMPES+IMPSAT+FIM
Figure 5.40 Well block oil saturation comparisons for AIM models and Case 2 problem
0.45
0.47
0.49
0.51
0.53
0.55
0.57
0.59
0.61
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
FIM
IMPES+FIM
IMPES+IMPSAT
IMPSAT+FIM
IMPES+IMPSAT+FIM
Figure 5.41 Well block oil saturation comparisons for AIM models and Case 3 problem
142
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
FIM
IMPES+FIM
IMPES+IMPSAT
IMPSAT+FIM
IMPES+IMPSAT+FIM
Figure 5.42 Well block oil saturation comparisons for AIM models and Case 4 problem
0.54
0.55
0.56
0.57
0.58
0.59
0.6
0.61
0 200 400 600 800 1000 1200
time (days)
o
i
l
s
a
t
u
r
a
t
i
o
n
a
t
t
h
e
p
r
o
d
u
c
e
r
FIM
IMPES+FIM
IMPSAT+FIM
IMPES+IMPSAT+FIM
Figure 5.43 Well block oil saturation comparisons for AIM models and Case 5 problem
143
Iteration counts and timing results for problems discussed above are presented in
Table 5.14 to Table 5.18. For all of the AIM runs, the ILU0 preconditioned GMRES
method was used to solve the linear system. We can draw the following conclusions
based on our analysis:
• For problems that are easy for IMPSAT, such as Case 1 and 3, the IMPES+IMPSAT
model is faster than the traditional AIM model, since IMPSAT solves for fewer
unknowns than FIM. On the other hand, the IMPES+IMPSAT model is less stable
than the IMPSAT model, so any problem that can not be handled by the IMPSAT
model, can also not be handled by the IMPES+IMPSAT model.
• For problems that are hard for IMPES, such as Case 1, 2, 4 and 5, the IMPSAT+FIM
model needs far fewer timesteps and Newton iterations than the traditional AIM
model, due to the improved stability of IMPSAT. Hence for hard problems, the
IMPSAT+FIM model is much faster than the traditional AIM model.
• The ILU0 preconditioner used here is quite weak compared to the preconditioners
(CPR, AMG) used for other models, so it won’t make any sense to use the timing
results here to compare the performance of AIM models with other models. But in
theory, with a good preconditioner, AIM models should be much faster than FIM
models, because they solve for fewer unknowns.
In summary, depending on the nature of the problem, one of the three new AIM
models will outperform the traditional AIM model. The IMPES+IMPSAT+FIM model is
the general AIM model, with proper tuning of the percentages according to the
difficulties for the IMPES and IMPSAT models, it will always outperform the other three
AIM models.
144
IMPES+FIM IMPES+IMPSAT IMPSAT+FIM IMPES+IMPSAT+FIM
timesteps
N 80 80 18 80
iters Newton
N
_
177 177 62 178
iters solver
N
_
1415 1392 701 1471
(sec)
solver
T 0.67 0.44 0.54 0.45
(sec)
total
T 5.53 5.27 2.45 5.32
Table 5.14 Iteration and timing comparisons for AIM models and Case 1 problem
IMPES+FIM IMPES+IMPSAT IMPSAT+FIM IMPES+IMPSAT+FIM
timesteps
N
50 50 19 51
iters Newton
N
_
136 148 69 139
iters solver
N
_
1374 1419 820 1330
(sec)
solver
T
0.64 0.52 0.7 0.53
(sec)
total
T
5.83 6.25 2.97 5.88
Table 5.15 Iteration and timing comparisons for AIM models and Case 2 problem
IMPES+FIM IMPES+IMPSAT IMPSAT+FIM IMPES+IMPSAT+FIM
timesteps
N
30 30 17 30
iters Newton
N
_
73 73 58 73
iters solver
N
_
770 813 657 775
(sec)
solver
T
1.3 0.83 2.27 1.1
(sec)
total
T
10.54 10 9.93 10.23
Table 5.16 Iteration and timing comparisons for AIM models and Case 3 problem
145
IMPES+FIM IMPES+IMPSAT IMPSAT+FIM IMPES+IMPSAT+FIM
timesteps
N
55 54 21 54
iters Newton
N
_
154 158 84 147
iters solver
N
_
2355 2048 1943 2219
(sec)
solver
T
2.66 0.64 3.99 1.39
(sec)
total
T
21.66 22.19 16.54 20.98
Table 5.17 Iteration and timing comparisons for AIM models and Case 4 problem
IMPES+FIM IMPES+IMPSAT IMPSAT+FIM IMPES+IMPSAT+FIM
timesteps
N
82 X 23 82
iters Newton
N
_
204 X 87 206
iters solver
N
_
25652 X 18612 25151
(sec)
solver
T
15744 X 19096 10563
(sec)
total
T
22026 X 20734 17135
Table 5.18 Iteration and timing comparisons for AIM models and Case 5 problem
146
147
Chapter 6
Conclusions and Future work
6.1 Conclusions
A new General Purpose Research Simulator (GPRS) has been developed. It incorporates
various simulation models and techniques so that their advantages and disadvantages can
be investigated in a consistent manner. The design of GPRS is such that it can be used by
multiple researchers. The overall design and basic implementations of GPRS have been
completed. Various models and techniques in GPRS have been tested, including a black-
oil model, several compositional models, unstructured grid handling and multi-point flux
approximation. It is now possible for other researchers to start working on extensions of
individual modules. A basic introduction to the structure of GPRS is included in
Appendix A.
A new General Formulation Approach has been developed and implemented in GPRS
to facilitate the implementation of different models. This approach can generate almost
any model, regardless of the selection of variables and the level of implicitness. All of the
operations are performed on individual gridblocks, so different variables and different
implicit levels can be used in different gridblocks. This is necessary for the building of
AIM models. The approach presented is suitable for all kinds of simulations. In GPRS, it
is only used to generate different compositional models.
An extensive study has been conducted for the new IMPSAT (implicit pressure,
implicit saturations and explicit mole fractions) model, which is actually a special case of
the General Formulation Approach. We have analyzed the characteristic of this IMPSAT
model, derived its stability criterion and suggested an efficient way for its construction.
We have also compared the performance of the IMPSAT model with the performance of
IMPES and FIM models using various compositional problems. In addition, we have
proposed three new IMPSAT based AIM models, and their performance has been
compared with the performance of the traditional AIM model.
Different compositional models, varying in their selection of variables and implicit
levels, have been evaluated using several compositional problems. These problems were
148
selected to be difficult in one specific area. From the results obtained, we can draw the
following conclusions for different variable selections, for different implicit levels and
for the new IMPSAT based AIM models:
Different Variable Selections
• The same models (FIM or IMPES) with Type A and Type B variables have the same
solutions, because they are solving the same equations.
• For the same models (FIM or IMPES) with Type A and Type B variables, there are
no major differences in the Newton iteration numbers.
• For FIM models, Type B variables need more linear solver iterations (and hence
computational cost) than Type A variables. Type B variables also increase the cost of
Jacobian matrix construction, because of the need to use the chain rule to calculate
derivatives. Hence Type A FIM model is more efficient than Type B FIM model.
• For IMPES models, there are no significant differences in linear solver iterations,
since the pressure system is always the same. However, Type B variables are more
efficient than Type A variables in Jacobian matrix calculation (Coats, 1999). Hence
the total cost of Type B IMPES model is lower than the total cost of Type A IMPES
model.
Different Implicit Levels
• FIM models are most stable, and they can use large timestep sizes, but the cost of
each Newton iteration is also high, especially for problems with large number of
components.
• IMPES models are least stable, because only pressure is treated implicitly, but their
cost is the lowest for each Newton iteration. For compositional problems, the stable
timestep sizes of the IMPES model are small, due to the high gas mobility. Also it has
sudden jumps because of the discontinuous phase velocities. For relatively easy
problems, the IMPES model is faster than the FIM model, because it solves for fewer
unknowns. However this advantage is lost for hard problems, where the timestep
restriction makes IMPES even slower than the FIM model. The IMPES model has
less numerical diffusion than the FIM model.
149
• The IMPSAT model is much more stable than the IMPES model, due to the implicit
treatment of saturations, and it can use timestep sizes of up to 10 times larger than
what is possible with IMPES. Also the stable timestep sizes of the IMPSAT model
change more smoothly than the stable timestep sizes of the IMPES model. The cost of
the IMPSAT model for each Newton iteration is fixed, independent of the number of
components, just as is the case for the IMPES model. Compared to the IMPES model,
the IMPSAT model needs far fewer timesteps and Newton iterations, and generally
can cut the running time by half. For problems that are not very hard, the improved
stability of the IMPSAT model enables it to use the same number of timesteps and
Newton iterations as the FIM model. Because the number of unknowns to be solved
is reduced, IMPSAT is a cheaper alternative to the FIM model. The IMPSAT model
has the same level of numerical diffusion as the FIM model.
Different AIM Models
• All AIM models are more efficient than the FIM model, since high flow rates are
generally restricted to a small portion of the reservoir and the FIM model is only
needed in the regions of high flow rates.
• For problems that are hard for IMPES, the IMPSAT+FIM model is much faster than
the traditional IMPES+FIM model due to the improved stability of the IMPSAT
model.
• For problems that are easy for IMPSAT, the IMPES+IMPSAT model is faster than
the traditional IMPES+FIM model, due to the reduction in the number of unknowns
that need to be solved implicitly.
• The IMPES+IMPSAT+FIM model is the most general AIM model, with properly
tuned percentages for each formulation, it will always outperform the other three
AIM models.
In summary, the key conclusions about the performance of compositional models are as
following:
• Type A FIM model is better than Type B FIM model, both in the condition of the
Jacobian matrix and the cost of building the Jacobian matrix.
150
• Type B IMPES model is more efficient than Type A IMPES model in the cost of
building the pressure implicit Jacobian matrix.
• The IMPSAT model is generally over 50% faster than the IMPES model due to its
improved stability.
• For problems that are not very hard for IMPSAT, the IMPSAT model is cheaper than
the FIM model since it reduces the number of unknowns that have to be solved
implicitly. This is especially true for problems with a large number of components.
• The IMPSAT based AIM models are more flexible, more stable and less expensive
than the traditional AIM model. With properly tuned percentages for each
formulation, the IMPES+IMPSAT+FIM model will always outperform the traditional
AIM (IMPES+FIM) model.
6.2 Future Work
GPRS is a general-purpose research simulator. It requires further testing, improvements
and enhancements. Work is especially needed in the following areas:
• Evaluation of IMPSAT++ models (including some mole fractions in the implicit set)
• Evaluation of quasi-IMPSAT model, where the mole fractions in the transmissibility
part are updated iteration by iteration
• Improvements in preconditions for AIM models
• Better solver for unstructured grid
• Improvements in flash calculations
• Implementation of techniques for parallel computing
• Surface facility modeling
• Complex well modeling
• Automatic selection of the level of implicitness in AIM models
• Thermal modeling
• Fractured reservoir simulation
• Enhancements in the treatment of water to include gas solubility in water and water
vapor in gas
• Other structured grid (cylindrical, curvilinear, corner-point)
• Coupled modeling of geomechanics
• Interface with other tools, and allow use of various units
151
Nomenclature
A Area of surface between two gridblocks, [ft
2
]
p
B Formation volume factor of phase p (black-oil), [bbl/STB: oil&wat; ft
3
/SCF: gas]
D Depth, [ft]
F Total moles of hydrocarbon in one unit volume of fluid, [mole/ft
3
]
p c
f
,
Fugacity of component c in phase p , [psia]
g Gravity force constant, [32.2 ft/sec
2
]
c
K Equilibrium ratio of component c
k Absolute permeability, [md]
rp
k Relative permeability of phase p
l Hydrocarbon liquid mole fraction in hydrocarbon fluid
c
M Total moles of hydrocarbon component c , [lb-mole]
w
M Total moles of water, [lb-mole]
c
MW Molecular weight of component c , [lbm/lb-mole]
p
MW Molecular weight of phase p , [lbm/lb-mole]
c
n Number of components
h
n Number of hydrocarbon components
p
n Number of phases
2 1
, , p p c
P Capillary pressure between phase
1
p and phase
2
p , [psia]
p Block pressure, [psia]
W
p Wellbore pressure of well W , [psia]
W
c
Q Mass flow rate of component c at well W , [lbm/day]
W
p
q Volumetric flow rate of phase p at well W , [ft
3
/day]
p c
R
,
Solubility of component c in phase p , [SCF/STB:
o g
R
,
]
c
r Total moles of hydrocarbon component c in one unit volume of fluid, [lb-mole/ft
3
]
p
S Saturation of phase p
T Transmissibility, [md⋅ft]
V Volume, [ft
3
]
φ
V Pore volume, [ft
3
]
p
V Volume of phase p , [ft
3
]
T
V Total fluid volume, [ft
3
]
152
p
v Volumetric flow rate of phase p , [ft
3
/day]
W Total moles of water in one unit volume of fluid, [lb-mole/ft
3
]
W
WI Well Index of well W , [md⋅ft]
p c
X
,
Mole fraction of component c in phase p
c
x Mole fraction of component c in the oil phase, same as
o c
X
,
c
y Mole fraction of component c in the gas phase, same as
g c
X
,
c
z Overall mole fraction of component c
Z Compressibility factor
Acronyms
AIM Adaptive implicit
AMG Algebraic multi-grid
BHP Bottom hole pressure
CPR Constrained pressure residual
EOS Equation of state
FIM Fully implicit
GMRES Generalized minimum residual
GPRS General Purpose Research Simulator
ILU Incomplete LU decomposition
IMPES Implicit pressure and explicit saturations
IMPSAT Implicit pressure and saturations
Type A Type A variables (pressure, saturations and component mole fractions)
Type B Type B variables (pressure, overall component densities)
Greek
∆ Capital Delta (change)
δ Delta (change)
β α, Unit conversion constants
p
λ Mobility of phase p , [1/cp]
p
ρ Density of phase p , [lbm/ft
3
]
c
ρ Density of component c at standard condition, [lbm/ft
3
]
p
µ Viscosity of phase p , [cp]
153
p
Φ Potential of phase p , [psia]
φ Porosity
Subscripts
p Phase
c Component
w Water
Superscripts
n Time level n
1 + n Time level 1 + n
υ Iteration level
W Well
154
155
References
1. Aavatsmark, I., Barkve, T. and Mannseth, T.: “Control Volume Discretization
Methods for 3D Quadrilateral Grids in Inhomogeneous, Anisotropic Reservoirs”,
paper SPE 38000, proceedings of the 14
th
SPE Symposium on Reservoir Simulation,
Dallas, TX, June 8-11, 1997
2. Abou-Kassem, J.H. and Aziz, K.: “Handling of Phase Change in Thermal
Simulators”, JPT, September 1985, pp1661-1663
3. Acs, G., Doleschall, S. and Farkas, E.: “General Purpose Compositional Model”,
SPEJ, August 1985, pp543-553
4. Agut, R., Edwards, G.E., Verma, S. and Aziz, K.: “Flexible Streamline-Potential
Grids With Discretization on Highly Distorted Cells”, proceedings of the 6
th
European Conference on the Mathematics of Oil Recovery, Peebles, Scotland,
September 8-11, 1998
5. Almehaideb, R.A., Aziz, K. and Pedrosa, D.A.: “A Reservoir Wellbore Model for
Multiphase Injection and Production”, paper SPE 17941, proceedings of the SPE
Middle East Oil Technical Conference and Exhibition, Manama, Bahrain, March 11-
14, 1989
6. Anderson, E., Bai, Z., Bischof, C., Blackford, S., Demmel, J., Dongarra, J., Du Croz,
J., Greenbaum, A., Hammarling, S., Mckenny, A. and Sorensen, D.: “LAPACK
Users’ Guide, Third Edition”, Society for Industrial and Applied Mathematics, 1999
7. Aziz, K.: “Fundamentals of Reservoir Simulation”, class notes for PE223 (Reservoir
Simulation) class, summer 1996
8. Aziz, K. and Settari, A.: “Petroleum Reservoir Simulation”, Applied Science
Publishers, London, England, 1979
9. Aziz, K. and Wong, T.W.: “Considerations in the Development of Multipurpose
Reservoir Simulation Models”, proceedings of the 1
st
and 2
nd
International Forum on
Reservoir Simulation, Alpbach, Austria, September 12-16, 1988 and September 4-8,
1989
156
10. Baker, L.E. and Luks, K.D.: “Critical Point and Saturation Pressure Calculation for
Multi-Component Systems”, SPEJ, February 1980, pp15-24
11. Ballin, P.R., Aziz, K., Journel, A.G. and Zuccolo, L.: “Quantifying the Impact of
Geological Uncertainty on Reservoir Forecasts”, paper SPE 25238, proceedings of
the 12
th
SPE Symposium on Reservoir Simulation, New Orleans, CA, February 28-
March 03, 1993
12. Behie, A. and Forsyth Jr., P.A.: “Practical Considerations for Incomplete
Factorization Methods in Reservoir Simulation”, paper SPE 12263, proceedings of
the 7
th
SPE Symposium on Reservoir Simulation, San Francisco, CA, November 15-
18, 1983
13. Branco, C.M. and Rodriguez, F.: “A Semi-Implicit Formulation for Compositional
Reservoir Simulation”, paper SPE 27053, SPE Advanced Technology Series, Vol. 4,
No. 1, 1995
14. Byer, T.J.: “Preconditioned Newton Methods for Reservoirs With Surface Facilities”,
Ph.D. Dissertation, Stanford University, June 2000
15. Cao, H.: “GPRS Package (code, data file and user’s manual) 2002”, 2002
16. Castellini, A., Edwards, M.G. and Durlofsky, L.J.: "Flow Based Modules for Grid
Generation in Two and Three Dimensions", proceedings of the 7
th
European
Conference on the Mathematics of Oil Recovery, Baveno, Italy, September 5-8, 2000
17. Chen, W.H., Durlofsky, L.J., Engquist, B. and Osher, S.: “Minimization of Grid
Orientation Effects Through Use of Higher-Order Finite Difference Methods,” paper
SPE 22887, proceedings of the 66
th
SPE Annual Technical Conference and
Exhibition, Dallas, TX, October 6-9, 1991
18. Chien, M.C.H., Lee, S.T. and Chen, W.H.: “A New Fully Implicit Compositional
Simulator”, paper SPE 13385, proceedings of the 8
th
SPE Symposium on Reservoir
Simulation, Dallas, TX, February 10-13, 1985
19. Coats, K.H.: “An Equation of State Compositional Model”, SPEJ, October 1980,
pp363-376
157
20. Coats, K.H.: “A Note on IMPES and Some IMPES Based Simulation Models”, paper
SPE 49774, proceedings of the 15
th
SPE Symposium on Reservoir Simulation,
Houston, TX, February 14-17, 1999
21. Coats, K.H.: “IMPES Stability: The Stable Step”, paper SPE 69225, proceedings of
the 16
th
SPE Symposium on Reservoir Simulation, Houston, TX, February 11-14,
2001
22. Coats, K.H., Thomas, L.K. and Pierson, R.G.: “Compositional and Black-Oil
Reservoir Simulation”, paper SPE 29111, proceedings of the 13
th
SPE Symposium on
Reservoir Simulation, San Antonio, TX, February 12-15, 1995
23. Coats, K.H., Thomas, L.K. and Pierson, R.G.: “Compositional and Black-Oil
Reservoir Simulation”, paper SPE 50990, SPE Reservoir Evaluation & Engineering,
August 1998, pp372-279
24. Ciment, M. and Sweet, R.A.: “Mesh Refinement for Parabolic Equations”, J. Comp.
Phys., December 1973, pp513-525
25. Deo, M.D., Nutakki, R. and Orr Jr., F.M.: “Schmidt-Wenzel and Peng-Robinson
Equation of State for CO
2
-Hydrocarbon Mixtures: Binary Interaction Parameters and
Volume Translation Factors”, paper SPE 18796, proceedings of the SPE California
Regional Meeting, Bakersfield, CA, April 5-7, 1989
26. Ding, Y. and Lemonnier, P.: “Use of Corner Point Geometry in Reservoir
Simulation”, paper SPE 29933, proceedings of the International Meeting on
Petroleum Engineering, Beijing, China, November 14-17, 1995
27. Dogru, A.H., Pita, J.A., Fung, L.S., Al-Zamel, N., Al-Shaalan, T. and Dreiman, W.T.:
“Megacell Reservoir Simulation: the Quest for High Resolution in Full-Field
Modeling”, proceedings of the 6
th
International Forum on Reservoir Simulation,
Salzburg, Austria, September 3-7, 2001
28. Dongarra, J.: “Performance of Various Computers Using Standard Linear Equations
Software”, March 19, 2002, http://www.netlib.org/benchmark/performance.ps
29. Dongarra, J., Lumsdaine, A., Pozo, R. and Remington, K.A.: “IML++ V.1.2, Iterative
Methods Library Reference Guide”, National Institute of Standards and Technology,
April 1996
158
30. Edwards, G.M.: “Split Elliptic Tensor Operators for Reservoir Simulation”,
proceedings of the ICFD Conference on Numerical Methods for Fluid Dynamics,
Oxford University, UK, March 31–April 03, 1998
31. Edwards, G.M., Agut, R. and Aziz, K.: “Quasi K-Orthogonal Streamline Grids:
Gridding and Discretization”, paper SPE 49072, proceedings of the 73
rd
SPE Annual
Technical Conference and Exhibition, New Orleans, Louisiana, September 27-30,
1998
32. Farkas, E.: “Comparison of Linearization Techniques of Nonlinear Partial
Differential Equations in Numerical Reservoir Simulation”, Ph.D. dissertation,
Reservoir Engineering Department of the Montanuniversitat Leoben, Austria, 1997
33. Forsyth, P.A. and Sammon, P.H.: “Practical Considerations for Adaptive Implicit
Methods in Reservoir Simulation”, J. Comp. Phys., Vol. 62, 1986, pp265-281
34. Fung, L.S., Hiebert, A.D. and Nghiem, L.X.: “Reservoir Simulation With a Control
Volume Finite Element Method”, paper SPE 21224, proceedings of the 11
th
SPE
Symposium on Reservoir Simulation, Anaheim, CA, February 17-20, 1991
35. Fussell, D.D. and Yanosik, J.L.: “An Iterative Sequence for Phase-Equilibria
Calculations Incorporating the Redlich-Kwong Equation of State” SPEJ, June 1978,
pp173-182
36. Fussell, L.T. and Fussell, D.D.: “An Iterative Technique for Compositional Reservoir
Models” SPEJ, August 1979, pp211-220
37. Geoquest, Schlumberger: “Eclipse 100 Technical Description 2000A”, 2000,
http://www.sis.slb.com/content/software/simulation/eclipse_blackoil.asp
38. Geoquest, Schlumberger: “Eclipse 300 Technical Description 2000A”, 2000,
http://www.sis.slb.com/content/software/simulation/eclipse_compositional.asp
39. Geoquest, Schlumberger: “FloGrid Reference Manual 2000A”, 2000,
http://www.sis.slb.com/content/software/simulation/eclipse_pre_post/flogrid.asp
40. Gunasekera, D., Childs, P., Herring, J. and Cox, J.: “A Multi-Point Flux
Discretization Scheme for General Polyhedral Grids”, paper SPE 48855, proceedings
of the 6
th
SPE International Oil&Gas Conference and Exhibition, Beijing, China,
November 2-6, 1998
159
41. Gunasekera, D., Cox, J. and Lindsey, P.: “The Generation and Application of K-
Orthogonal Grid Systems”, paper SPE 37998, proceedings of the 14
th
SPE
Symposium on Reservoir Simulation, Dallas, TX, June 8-11, 1997
42. Heinemann, Z.E. and Brand, C.W.: “Modeling Reservoir Geometry with Irregular
Grids” paper SPE 18412, proceedings of the 10
th
SPE Symposium on Reservoir
Simulation, Houston, TX, February 6-8, 1989
43. Journel, A.G.: “Geostatistics for Reservoir Characterization”, paper SPE 20750,
proceedings of the 65
th
SPE Annual Technical Conference and Exhibition, New
Orleans, CA, September 23-26, 1990
44. Kendall, R.P., Morrell, G.O., Peaceman, D.W., Silliman, W.J. and Watts, J.W.:
“Development of a Multiple Application Reservoir Simulator for Use on a Vector
Computer”, paper SPE 11483, proceedings of the SPE Middle East Oil Technical
Conference, Manama, Bahrain, March 14-17, 1983
45. Kenyon, D. and Behie, G.A.: “Third SPE Comparative Solution Project: Gas Cycling
of Retrograde Condensate Reservoirs”, paper SPE 12278, proceedings of the 7
th
SPE
Symposium on Reservoir Simulation, San Francisco, CA, November 15-18, 1983
46. Killough, J.E.: “Ninth SPE Comparative Solution Project: A Reexamination of Black-
Oil Simulation”, paper SPE 29110, proceedings of the 13
th
SPE Symposium on
Reservoir Simulation, San Antonio, TX, February 12-15, 1995
47. Killough, J.E. and Commander, D.: “Scalable Parallel Reservoir Simulation on a
Windows NT-Bases Workstation Cluster”, paper SPE 51883, proceedings of the 15
th
SPE Symposium on Reservoir Simulation, Houston, TX, February 14-17, 1999
48. Kocberber, S.: “An Automatic, Unstructured Control Volume Generation System for
Geologically Complex Reservoirs”, paper SPE 38001, proceedings of the 14
th
SPE
Symposium on Reservoir Simulation, Dallas, TX, June 8-11, 1997
49. Lacroix, S., Vassilevski, Y. and Wheeler, M.: “Iterative Solvers of the Implicit
Parallel Accurate Reservoir Simulator (IPARS), I: Single Processor Case”, TICAM
report 00-28, (2000), http://www.ticam.utexas.edu/reports/2000/index.html
50. Landmark Graphics Corporation: “BlitzPak User’s Guide”, 1998, http://www.lgc.com
160
51. Lee, J., Kasap, E. and Kelkar, M.G.: “Analytical Upscaling of Permeability for 3D
Gridblocks”, SPE paper 27875, proceedings of the SPE Western Regional Meeting,
Long Beach, CA, March 23-25, 1994
52. Lee, S.H., Durlofsky, L.J., Lough, M.F. and Chen, W.H. “Finite Difference
Simulation of Geologically Complex Reservoirs With Tensor Permeabilities”, paper
SPE 38002, proceedings of the 14
th
SPE Symposium on Reservoir Simulation, Dallas,
TX, June 8-11, 1997
53. Lim, K.T., Schiozer, D.J. and Aziz, K.: “A New Approach for Residual and Jacobian
Array Construction in Reservoir Simulators”, paper SPE 28248, proceedings of the
SPE Petroleum Computer Conference, Dallas, TX, July 31-August 03, 1994
54. Nacul, E.C.: “Use of Domain Decomposition and Local Grid Refinement in Reservoir
Simulation”, Ph.D. Dissertation, Stanford University, March 1991
55. Nghiem, L.X., Aziz, K. and Li, Y.K.: “A Robust Iterative Method for Flash
Calculations Using the Soave-Redlich-Kwong or the Peng-Robinson Equation of
State”, SPEJ, June 1983, pp521-530
56. Nolen, J.S.: “Treatment of Wells in Reservoir Simulation”, proceedings of the 3
rd
International Forum on Reservoir Simulation, Baden, Austria, July 23-27, 1990
57. Odeh, A.S.: “Comparison of Solutions to a Three-Dimensional Black-Oil Simulation
Problem”, paper SPE 9723, JPT, January 1981, pp13-25
58. Palagi, C.L. and Aziz, K.: “Use of Voronoi Grid in Reservoir Simulation”, SPE
Advanced Technology Series 2, April 1994, pp69-77
59. Peaceman, D.W.: “Calculation of Transmissibilities of Gridblocks Defined by
Arbitrary Corner Point Geometry”, paper SPE 37306, 1996 (unpublished, but
available from SPE e-library)
60. Peaceman, D.W.: “Interpretation of Well-Block Pressures in Numerical Reservoir
Simulation”, SPEJ, June 1978, pp183-194
61. Pedrosa, O.A. and Aziz, K.: “Use of Hybrid Grid in Reservoir Simulation”, paper
SPE 13507, proceedings of the 8
th
SPE Symposium on Reservoir Simulation, Dallas,
TX, February 10-13, 1985.
161
62. Peng, D.Y. and Robinson, D.B.: “A New Two-Constant Equation of State”, Ind. Eng.
Chem. Fundam., Vol. 15, 1976, pp59-64
63. Ponting, D.K.: “Corner Point Geometry in Reservoir Simulation”, proceedings of the
1
st
European Conference on Mathematics Of Oil Recovery, Cambridge, England,
1989, P.R.King(ed.), Clarendon Press, Oxford 1992, pp45-65
64. Pozo, R., Remington, K.A. and Lumsdaine, A.: “SparseLib++ v.1.5, Sparse Matrix
Class Library Reference Guide”, National Institute of Standards and Technology,
April 1996
65. Prevost, M., private communication, 2002
66. Program Development Corporation (PDC): “GridPro”, http://www.gridpro.com
67. Quandalle, P. and Savary, D.: “An Implicit in Pressure and Saturations Approach to
Fully Compositional Simulation”, paper SPE 18423, proceedings of the 10
th
SPE
Symposium on Reservoir Simulation, Houston, TX, February 6-8, 1989
68. Rachford, H. and Rice, J.: “Procedure for Use of Electronic Digital Computers in
Calculating Flash Vaporization Hydrocarbon Equilibrium”, JPT, 4, 1952, pp10-19
69. Ritzdorf, H.: “Readme to AMG Package”, GMD Software, 1991
70. Russell, T.F.: “Stability Analysis and Switching Criteria for Adaptive Implicit
Methods Based on the CFL Condition”, paper SPE 18416, proceedings of the 10
th
SPE Symposium on Reservoir Simulation, Houston, TX, February 6-8, 1989
71. Saad, Y. and Schultz, M.: “GMRES: A Generalized Minimum Residual Algorithm
for solving non-symmetric linear systems”, SIAM J. Sci. Statist. Comput., Vol. 7,
1986, pp856-869
72. Sammon, P.H.: “ A Nine-Point Differencing Scheme Based on High-Order Stream
Tube Modeling”, paper SPE 21223, proceedings of the 11
th
SPE Symposium on
Reservoir Simulation, Anaheim, CA, February 17-20, 1991
73. Schiozer, D.J. and Aziz, K.: “Use of Domain Decomposition for Simultaneous
Simulation of Reservoir and Surface Facilities”, paper SPE 27876, proceedings of the
SPE Western Regional Meeting, Long Beach, CA, March 23-25, 1994
74. Stueben, K.: “Algebraic Multigrid (AMG): Experiences and Comparisons”,
proceedings of the International Multigrid Conference, Copper Mountain, CO, April
6-8, 1983
162
75. Sukirman, Y.B. and Lewis, R.W.: “Three-Dimensional Fully Coupled Flow:
Consolidation Modeling Using Finite Element Method”, paper SPE 28755,
proceedings of the SPE Asia Pacific Oil & Gas Conference, Melbourne, Australia,
November 7-10, 1994
76. The GOCAD group: “GOCAD”, http://www.ensg.u-nancy.fr/GOCAD
77. Thomas, G.W. and Thurnau, D.H.: “Reservoir Simulation Using an Adaptive Implicit
Method”, SPEJ, October 1983, pp759-768
78. Tran, T. and Journel, A.: “Automatic Generation of Corner-Point-Geometry Flow
Simulation Grids from Detailed Geostatistical Descriptions”, Stanford Center for
Reservoir Forecasting , 1995
79. Vassilevski, Y.: “Two Marks on the Combinative Technique”, private
communication, 2001
80. Verma, S.: “Flexible Grids for Reservoir Simulation” Ph.D. Dissertation, Stanford
University, June 1996
81. Verma, S. and Aziz, K.: “A Control Volume Scheme for Flexible Grids in Reservoir
Simulation”, paper SPE 37999, proceedings of the 14
th
SPE Symposium on Reservoir
Simulation, Dallas, TX, June 8-11, 1997
82. Verma, S. and Aziz, K.: “Two- and Three-Dimensional Flexible Grids for Reservoir
Simulation”, proceedings of the 5
th
European Conference on Mathematics of Oil
Recovery, Leoben, Austria, September 3-6, 1996
83. Walas, S.M.: “Phase Equilibria in Chemical Engineering", Butterworth Publishers,
Boston, MA, 1985
84. Watts, J.W.: “A Compositional Formulation of the Pressure and Saturation
Equations” paper SPE 12244, SPE Reservoir Engineering, May 1986, pp243-252
85. Watts, J.W.: “Reservoir Simulation: Past, Present, and Future” paper SPE 38441,
proceedings of the 14
th
SPE Symposium on Reservoir Simulation, Dallas, TX, June 8-
11, 1997
86. Whitson, C.H. and Michelsen, M.L.: “The Negative Flash”, proceedings of the
International Conference on Fluid Properties and Phase Equilibria for Chemical
Process Design, Banff, Canada, April 30-May 05, 1986
163
87. Wong, T.W., Firoozabadi, A. and Aziz, K.: “Relationship of the Volume-Balance
Method of Compositional Simulation to the Newton-Raphson Method”, paper SPE
18424, SPE Reservoir Engineering, August 1990, pp415-422
88. Yanosik, J.L. and McCracken, T.A.: “A Nine-Point Finite-Difference Reservoir
Simulation for Realistic Prediction of Adverse Mobility Ratio Displacement”, SPEJ,
August 1979, pp253-262
89. Young, L.C.: “An Efficient Finite Element Method for Reservoir Simulation”, paper
SPE 7413, proceedings of the 53
rd
SPE Annual Technical Conference and Exhibition,
Houston, TX, October 1-3, 1978
90. Young, L.C. and Stephenson, R.E.: “A Generalized Compositional Approach for
Reservoir Simulation” SPEJ, October 1983, pp727-742
164
165
Appendix A Overview Of GPRS
Modular object–oriented design is used for GPRS. All of the code is written in standard
C++. While the design will help new users in getting started with GPRS, it will still
require some effort to become fully familiar with this code. GPRS is a big and complex
program, currently it includes about 120 files, which are separated into 11 sub-
directories. In order to facilitate the use of GPRS, good documentation is essential (Cao,
2002).
To fully understand GPRS, users should first learn the basic structure of GPRS,
which will be introduced in this part. After that, a good understanding of the basic
algorithms and techniques used in GPRS (refer to Chapter 2 for details) is necessary.
Finally GPRS has a lot of internal comments, which should be very helpful in
understanding individual classes and methods.
In this part, we will first explore the system models for GPRS level by level, from top
down, after that we will discuss its flow sequence. We will also list the directories, files
and libraries of GPRS, and explain their use. Finally, for end users, we will explain the
structure of input files.
A.1 The System Model
The system model shows the basic classes and their relations, and it is very helpful for
the understanding of the structure of GPRS. Since GPRS is a complex code, it will be
difficult to explain the system model using only one figure. To make it easier to
understand, we will show the system models level by level, and explain each level in
detail. Figure A.1 shows the physical structure of an oil field, which consists of several
reservoirs, lots of wells, and some surface facilities. From a computational point of view,
we can recast the system in Figure A.1 as the one shown in Figure A.2, which is actually
the top level (field level) system model for GPRS. Currently, surface facility modeling is
not included in GPRS, so it is left out in Figure A.2.
166
Figure A.1 Structure of an oil field
Figure A.2 Field level system model
Field
Reservoirs Wells Surface
Facilities
Res1 Res2 W1 W2 W4 W5 W3
Field
Domain 1 Domain 2
Res1 Wells
W1 W4
Res2 Wells
W2 W5 W3
Boundary Update
167
In Figure A.2, each oil field is split into several domains, and each domain includes
one reservoir and all of the wells that are in that reservoir. Multiple domains are best
handled by parallel computing methods. This can be done by first assigning each domain
to a different CPU, then solving each of them separately, after that, the boundaries
between domains need to be updated (passing data between different CPUs). This process
has to be repeated until the whole field has converged. If there are more domains than
CPUs, multiple domains can be assigned to the same CPU. Currently, GPRS is only used
for sequential simulation. In order to upgrade it for parallel computation, some work is
needed to implement the boundary update.
The domain level system model is shown in Figure A.3. As we know from Figure
A.2, each domain includes a reservoir and several wells. Besides that, each domain also
has an equation selector and a linear solver. Basically, in GPRS, the Jacobian matrices
are calculated separately for the reservoir part and for the well part, the equation selector
is used to recast the Jacobian with desired variables and implicit levels. After that the
Jacobian matrices are passed to the linear solver and pieced together there for the linear
solve. Finally, the solution goes back in the opposite direction.
Figure A.3 Domain level system model
Domain
EqnSelector
1) switch
variables
2) full set to
primary set
3) reduce
implicit level
Reservoir
1) calc props
2) calc Jac
and RHS
LinearSolver
1) solve AX=B
Wells
1) calc Jac
and RHS
168
As mentioned above, the Jacobian matrices are calculated separately for the reservoir
part and for the well part. Figure A.4 and Figure A.5 show the system model for each of
them. From Figure A.4, we can see that, each reservoir includes a grid and a formulation,
grid part generates the grid information and passes it to the formulation part. The
formulation part calculates the gridblock properties and builds the reservoir part of the
Jacobian matrix and the RHS. In GPRS, the grid information is either internally
generated (currently only for Cartesian grid), or read in from the output of a gridding
software. The system model for the well part has a similar structure (as shown in Figure
A.5). In this part, well information is generated from the well completion data and passed
to the well control module, which calculates the well part of the Jacobian matrix and the
RHS. Currently, four types of well controls are implemented, and they are BHP, oil flow
rate, gas flow rate and water flow rate control.
Figure A.4 Reservoir level system model
Reservoir
Grid Grid information Formulation
Cartesian
Input from
gridding
software
169
Figure A.5 Well level system model
Figure A.6 shows the last system model. The entire reservoir related calculations are
carried out here. The calculations are organized using five mathematical modules: one for
rock, one for fluid, one for rock/fluid, one for phase mobility and the last one for flow
equations. Most of the gridblock properties are calculated in the first four modules, and
the reservoir part of the Jacobian matrix and the RHS are calculated and assembled in the
last module. If necessary, each module can have multiple subclasses for different models.
For example the fluid part has a black-oil and a compositional module. If a module has
connections to the physical world, such as the rock module, it will have a pointer to the
corresponding physical object. All of the mathematical modules are organized in a multi-
level inheritance structure, they all share the same public interface (methods), and
dynamic binding is used to determine the actual objects and methods required during a
run.
Well
Well Completion Well Controls
BHP Oil
Rate
Gas
Rat
Water
Rate
Well
Information
170
Figure A.6 Formulation level system model
Formulation
Rock
Module
1) rock comp
Fluid
Module
1) flash
2) calculate
and assemble
secondary part
Jac. and RHS
RockFluid
Module
1) rela perm
Mobility
Module
1) assemble
phase mobility
Flow Eqn
Module
1) calculate and
assemble
primary part Jac.
and RHS
Roc BOFlui RockFluid CompFluid
BO
Fluid
Module
Comp
Fluid
Module
BO
Mobility
Module
Comp
Mobility
Module
BO
Flow Eqn
Module
Comp
Flow Eqn
Module
171
A.2 Flow Sequence
Having shown the system models and classes used in GPRS, we will now review the flow
sequence of GPRS. The essential steps in a simulator are given below (Aziz, 1996):
1. Read input data (problem definition)
2. Initialize (allocate data and set initial conditions)
3. Start time step calculations
• Initialize with old timestep data
• Start the Newton iteration
• Calculate gridblock properties
• Linearize (calculate and assemble Jacobian and RHS)
• Solve the linear system
• Perform Newton update
• Check convergence, do another Newton iteration if necessary
4. Print and plot results at appropriate times
5. Increment time and go to Step 3 if ending conditions are not reached
6. End when run is complete
The most important step is Step 3, which accounts for over 95% of the simulation time.
The implementation of Step 3 in GPRS is as following:
calcInitProps(); // record old timestep values
while(true) { // start Newton iterations
calcProps(); // calculate gridblock properties
linearize(); // calculate and assemble Jacobian and RHS
convF = convergeF(); // check residual convergence
mLinearSolver->solve() // solve the linear system
newtonUpdate(); // newton update
convY = convergeDY(); // check variable change convergence
if(convF && convY) break; // converged
} // end of Newton iterations
172
Within this step, four methods handle most of the calculations for the reservoir part. They
are: calcInitProp(), calcProp(), linearize() and newtonUpdate(). They have similar
structure as that of linearize():
void Reservoir::linearize()
{
// --- each mathematical module linearizes ---
list<mthModelBase*>::iterator iter1 = mMthModels.begin();
while (iter1 != mMthModels.end()) {
(*iter1)->linearize(dt);
iter1++;
}
// --- each well linearizes ---
vector<Well*>::iterator iter2 = mWells.begin();
while (iter2 != mWells.end()) {
if((*iter2)->wellOpen()) (*iter2)->linearize();
iter2++;
}
}
Basically, most of the reservoir calculations are performed by these mathematical
modules. Since all of these modules are inherited from the same base class, they share the
same public interface, we can just loop through them, and let each of them do its work in
turn. The only thing we need to take care of is to program the correct public methods
(above four methods) for each module. Using this approach, each Newton iteration
becomes simple and flexible. If at any time, a new module is needed, we only need to
create it, add it to the list of modules, and implement the above four public methods. If
any of the above four methods is not necessary for a module, then it will be empty for
that module.
A.3 Sub-directories and Files
Besides the main program (Main.cpp) which is located in the base directory, there are 11
sub-directories. Here we will introduce each of them and the files contained in them.
173
• field
Field.h/cpp: field class
• fluid Physical fluid
Fluid.h/cpp: fluid base class
Phase.h/cpp: phase base class
Comp.h/cpp: component class
BOFluid.h/cpp: black-oil fluid class, subclass of Fluid
CompFluid.h/cpp: compositional fluid class, subclass of Fluid
BOPhase.h/cpp: black-oil phase class, subclass of Phase
HCPhase.h/cpp: compositional hydrocarbon phase class, subclass of
Phase
WaterPhase.h/cpp: compositional water phase class, subclass of Phase
• grid
Grid.h/cpp: Cartesian grid class
• mth Formulation modules
mthModelBase.h/cpp: base class for all modules
mthRockCompModel.h/cpp: rock compressibility module, subclass of
mthModelBase
mthFluidModelBase.h/cpp: base fluid module, subclass of mthModelBase
mthBOFluidModel.h/cpp: black-oil fluid module, subclass of
mthFluidModelbase
mthCompFluidModel.h/cpp: compositional fluid module, subclass of
mthFluidModelbase
mthRockFluidModel.h/cpp: rock fluid module, subclass of mthModelBase
mthMobilityModel.h/cpp: phase mobility module, subclass of mthModelBase
mthCompMobilityModel.h/cpp: compositional phase mobility module, subclass of
mthMobilityModel
174
mthFlowEqnModel.h/cpp: base flow equation module, subclass of
mthModelbase
mthBOFlowEqnModel.h/cpp: black-oil flow equation module, subclass of
mthFlowEqnModel
mthCompFlowEqnModel.h/cpp: compositional flow equation module, subclass of
mthFlowEqnModel
• res Reservoir
Reservoir.h/cpp: reservoir class
EqnSelector.h/cpp: equation selector base class
EqnSelectorCoats.h/cpp: variable Type A (Coats’ model) equation selector
class, subclass of EqnSelector
EqnSelectorYoung.h/cpp: variable Type B (Young and Stepenson’s model)
equation selector class, subclass of EqnSelector
• rock Physical rock
Rock.h/cpp: physical rock class
• rockfluid Physical rock fluid (relative permeability)
RockFluid.h/cpp: physical rock fluid base class
RockFluid2P.h/cpp: physical two-phase rock fluid class, subclass of
RockFluid
RockFluid3P.h/cpp: physical three-phase rock fluid class, subclass of
RockFluid
• sim Simulation constant definition
Comlibs.h: define common included files
EnumDef.h: define structures, Enumerates and constants used in
GPRS
175
• solver Linear solvers
LinearSolverBase.h/cpp: linear solver base class
LapackFullSolver.h/cpp: full matrix solver from LAPACK, subclass of
LinearSolverBase
LapackBandSolver.h/cpp: band matrix solver from LAPACK, subclass of
LinearSolverBase
ImlGMRESSolver.h/cpp: GMRES solver from IML (Iterative Math Library),
subclass of LinearSolverBase
BlitzSolver.h/cpp: solver from BlitzPak, subclass of LinearSolverBase
PreconditionerBase.h/cpp: preconditioner base class
DiagPre.h/cpp: diagonal scaling preconditioner, subclass of
PreconditionerBase
BlockDiagPre.h/cpp: block diagonal scaling preconditioner, subclass of
PreconditionerBase
ILUPre.h/cpp: Incomplete LU decomposition (ILU0)
preconditioner from SparseLib++, subclass of
PreconditionerBase
AMGPre.h/cpp: Algebraic Multi-Grid (AMG) preconditioner from
GMD software, subclass of PreconditionerBase
TrueIMPESPre.h/cpp: Constraint Pressure Residual (CPR) preconditioner,
true IMPES is used to generate the pressure
equation, subclass of PreconditionerBase
QuasiIMPESPre.h/cpp: Constraint Pressure Residual (CPR) preconditioner,
quasi IMPES is used to generate the pressure
equation, subclass of PreconditionerBase
• utl Utilities
FileIO.h/cpp: file input and output class
Table.h/cpp: table read in and look up class
Strlib.h/cpp: string operation class
176
F2Cwrapper.h/cpp: Fortran to C++ wrapper class for Fortran
subroutines
MyMatrix.h/cpp: matrix operations class, suitable for small matrix
DataVector.h/cpp: vector of data base class
IntDataVector.h/cpp: vector of integer data class, base class of
DataVector
DFDataVector.h/cpp: vector of double data class, base class of
DataVector
ConnDataVector.h/cpp: vector of connection data class, base class of
DataVector
DataPool.h/cpp: data pool class, store and provide access to all
DataVector objects
• well
Well.h/cpp: well class
WellCompl.h.cpp: well completion class
WellCont.h/cpp: well control base class
WellBHPCont.h/cpp: well bottom hole pressure (BHP) control class,
subclass of WellCont
WellORateCont.h/cpp: well constant oil flow rate control class, subclass of
WellCont
WellGRateCont.h/cpp: well constant gas flow rate control class, subclass of
WellCont
WellWRateCont.h/cpp: well constant water flow rate control class, subclass
of WellCont
A.4 Libraries
GPRS uses several public domain libraries, and most of them are used in the linear solver
part. They are discussed below:
177
• STL (Standard Template Library) This library is a popular library that is treated by
many as a standard C++ library. In GPRS, we use the “List” and “Vector” template
classes from this library.
• LAPACK (Linear Algebra Package) (Anderson, 1999) This is a standard linear
algebra package, which can be freely downloaded from www.netlib.org. It has a Fortran
version and a C version. Currently we are using the Fortran version, and wrappers are
used to interface it with the main C++ code. For most SGI machines, LAPACK is
already installed. For PC’s, we use the MKL (Math Kernel Library) from INTEL,
which includes LAPACK. In GPRS, we use the direct solvers (dgesv and dgbsv) from
LAPACK.
• BlitzPak (Landmark, 1998) This is a commercial solver package from Landmark
Graphic Corporation. GPRS interfaces with it, and uses it as a structured grid solver.
• AMG This is an Algebraic Multi-Grid (AMG) solver from GMD software (Ritzdorf,
1991), which can be freely downloaded from http://www.mgnet.org/mgnet-codes-gmd.html.
It is only used as a preconditioner for the pressure system in GPRS.
• SparseLib++ (Pozo et al., 1996) This is a sparse matrices library (freely
downloadable from http://math.nist.gov/sparselib++/) which includes some basic
representations for sparse matrix, such as compressed row format, and some basic
preconditioners, such as ILU0 (Incomplete LU decomposition without fill-in). In
GPRS, we use it for sparse matrix representation and ILU0 preconditioner.
• IML (Iterative Math Library) (Dongarra et al., 1996) This is an iterative solver
package (freely downloadable from http://math.nist.gov/iml++/), which includes GMRES,
CG (Conjugate Gradient), etc. In GPRS, we only use its GMRES solver.
A.5 Input Files
The main input file for GPRS is normally called “gprs.in”. Within it, three files are
included (using “INCLUDE” keyword), one for the reservoir data, one for the wells data,
and one for the control data. Contents of each of these files are describes below:
178
• Reservoir input file
• grid data (grid geometry and properties)
• fluid data, black-oil or compositional (phase and component properties)
• phase component relation data (existence of each component in each phase)
• rock fluid data (relative permeability and capillary pressure)
• rock data (rock compressibility)
• initial equilibrium data (WOC, GOC, initial pressure and overall composition,
etc)
• Well input file
• well specification (well name, well group name, which reservoir it belongs to,
producer or injector)
• well completion data (well block indexes, and WI for each of them)
• well control data (all available well controls for this well)
• Control file
• Timestep control (initial, minimum and maximum timestep size, and total
simulation time)
• Newton iteration number control (minimum, maximum and fixed number of
Newton iterations for each timestep)
• Timestep increase control (desired variable changes and increasing factor)
• Newton iteration convergence control (convergence criteria for variable changes
and residuals)
• Formulation control (which type of variables to use, how many implicit levels,
and what are they)
• Linear solver control (which linear solver to use, which preconditioner to use,
convergence tolerance and maximum number of iterations)
For information about the keywords and data format used by the input files, refer to the
GPRS user’s manual, which is provided as part of the GPRS package (Cao, 2002).
179
Appendix B: Black-Oil Simulation Using Compositional Formulation
The black-oil model is a special case of the general compositional model, where flash
calculations are reduced to explicit relations, and the primary equations can be directly
expressed as functions of only primary variables. Hence a general compositional
simulator should be able to perform black-oil simulation given the correct input, such as
formation volume factors and gas solubility. Considering a three-phase (oil, gas and
water) black-oil system, assuming gas component can exist in both the gas and the oil
phases, and oil and water components can only exist in their own phases. The general
compositional formulation can be written as
∑ ∑ ∑ ∑ ∑
− − ∆Φ =


p
w
p cp p
p
rp
p l p W
l p cp p
p
rp
cp p p
p p x
k
WI x
k
T x S V
t
))] ( ( [ )] ( [ )] ( [ ρ
µ
ρ
µ
ρ φ
(B.1)
For the black-oil model, the phase properties and component mole fractions can be
calculated by the relations shown below (Aziz, 1996):
• ) ( p
p p
ρ ρ = , phase densities are only functions of pressure, and they are calculated
by
w
w
w
B
ρ
ρ = (B.2)
g
g
g
B
ρ
ρ = (B.3)
o
o g g o
o
B
R
,
ρ ρ
ρ
+
= (B.4)
where,
w
ρ ,
g
ρ and
o
ρ are the component densities (phases at standard conditions),
which are input constants.
w
B ,
g
B and
o
B are the phase formation volume factors,
which are functions of pressure and normally given as B vs. p tables.
0 , g
R is the gas
component solubility ratio in the oil phase, which is also a sole function of pressure
and given as a R vs. p table.
180
• ) ( p
p p
µ µ = , phase viscosities are also only functions of pressure, normally a
p
µ vs.
p table is given, and table lookup is used to get phase viscosities at specific pressure.
• ) ( p X X
cp cp
= , component mole fractions are not independent variables, they are
either constants or only functions of pressure, and can be calculated by the following
relations:
0
, , , , ,
= = = = =
g o g w w g o w w o
X X X X X (B.5)
1
, ,
= =
g g w w
X X (B.6)
o g g o
o g g
o g
R
R
X
,
,
,
ρ ρ
ρ
+
= (B.7)
o g g o
o
o o
R
X
,
,
ρ ρ
ρ
+
= (B.8)
An even simpler method is to directly calculate
p c p
X
,
ρ from (Aziz, 1996)
p
p c
c p c p
B
R
X
,
,
ρ ρ = (B.9)
181
Appendix C Flash Calculation (Walas, 1985)
As mentioned in Section 2.6, the Cubic equation of state can be written as
0
2 3
= + + + r qZ sZ Z (C.1)
where,
¦
¹
¦
´
¦
− − − =
− − + =
− − =
3 2
2
) (
1 ) 1 (
wB wB AB r
uB B u w A q
B u s
(C.2)
Different Cubic equations of state have different u, w values, and they also use different
relations to calculate parameters
i
a and
i
b of each component:
• Redlich-Kwong, u=1, w=0,
i C
i C
i
P
RT
b
,
,
08664 . 0
= ,
5 . 0
,
5 . 2
,
2
42748 . 0
T P
T R
a
i C
i C
i
=
• Soave-Redlich-Kwong,
u=1, w=0,
i C
i C
i
P
RT
b
,
,
08664 . 0
= ,
2 5 . 0
, ,
2
,
2
] ) ( 1 ( 1 [
42748 . 0
i C i C
i C
i
T
T
f
P
T R
a − + =
ω
where
2
176 . 0 574 . 1 48 . 0
i i w
f ω ω − + =
• Peng-Robinson, u=2, w=-1,
i C
i C
i
P
RT
b
,
,
07780 . 0
= ,
2 5 . 0
, ,
2
,
2
] ) ( 1 ( 1 [
45724 . 0
i C i C
i C
i
T
T
f
P
T R
a − + =
ω
where
2
26992 . 0 54226 . 1 37464 . 0
i i w
f ω ω − + =
where
i C
T
,
and
i C
P
,
are the critical temperature and critical pressure of each component,
T is the reservoir temperature, and
i
ω is the acentric factor of each component.
For the Cubic equation of state, the component fugacities and the phase properties can
be calculated from the following 5 steps (Walas, 1985):
1. Calculate phase parameters and their derivatives:
¦
¦
¹
¦
¦
´
¦
=
− =

∑∑
=
= =
h
h h
n
i
i i
n
j
n
i
j i j i j i
b X b
a a k X X a
1
1 1
,
) 1 (
, (C.3)
182
and
¦
¦
¹
¦
¦
´
¦
=


− =



=
i
i
n
j
j j i j i
i
b
X
b
a k X a
X
a
h
1
,
) 1 ( 2
(C.4)
where
ij
k is the binary interaction parameter.
¦
¦
¹
¦
¦
´
¦
=
=
RT
bp
B
T R
ap
A
2 2
(C.5)
and
¦
¦
¹
¦
¦
´
¦
=


=


p
B
p
B
p
A
p
A
,
¦
¦
¹
¦
¦
´
¦


=




=


i i
i i
X
b
b
B
X
B
X
a
a
A
X
A
(C.6)
2. Calculate compressibility factor Z and its derivatives:
0
3 3
= + + + r qZ sZ Z (C.7)
and
¦
¦
¦
¹
¦
¦
¦
´
¦
+ +


+


+


− =


+ +


+


+


− =


q sZ Z
X
r
Z
X
q
Z
X
s
X
Z
q sZ Z
p
r
Z
p
q
Z
p
s
p
Z
i i i
i
2 3
2 3
2
2
2
2
(C.8)
where
¦
¹
¦
´
¦
− − − =
− − + =
− − =
3 2
2
) (
1 ) 1 (
wB wB AB r
uB B u w A q
B u s
(C.9)
3. If necessary, perform volume translation (e.g. Deo et al., 1989):

=
− =
h
n
i
i i
c X
RT
p
Z Z
1
(C.10)
183
and
¦
¦
¹
¦
¦
´
¦



=





=



=
i
i i
n
i
i i
c
RT
p
X
Z
X
Z
c X
RT p
Z
p
Z
h
1
1
(C.11)
where
i i i
b S c =
4. Calculate phase properties (phase densities and their derivatives):
ZRT
p
= ρ (C.12)
and
¦
¦
¹
¦
¦
´
¦


− =




− =


i i
X
Z
Z X
p
Z
Z p p
ρ ρ
ρ ρ ρ
(C.13)
5. Calculate component fugacities and their derivatives:
i
e pX f
i i
Φ
= , (C.14)
]
) 4 ( 2
) 4 ( 2
ln[ )
1
(
4
) ln( ) 1 (
2
2
2
w u u B Z
w u u B Z
X
a
a b
b
w u B
A
B Z Z
b
b
i
i
i
i
− − +
− + +





− − − = Φ
(C.15)
p
f
p
f
p
f
i
i
i i

Φ ∂
+ =


(C.16)
)]
) 4 ( 2
) 4 ( 2
) 4 ( 2
) 4 ( 2
(
)
) 4 ( 2
) 4 ( 2
ln( )
1
[(
4
1
)
1
(
2
2
2
2
2
2
2
2
w u u B Z
w u u
p
B
p
Z
w u u B Z
w u u
p
B
p
Z
B
A
w u u B Z
w u u B Z
p
B
B
A
p
A
B
w u
X
a
a b
b
B Z
p
B
p
Z
p
Z
b
b
p
i
i
i i
− − +
− −


+



− + +
− +


+


+
− − +
− + +








− +









=

Φ ∂
(C.17)
184
j
i
i ij
i
i
j
i
X
f
X
f
X
f

Φ ∂
+ =


δ (C.18)
] ) 1 (
2
1
)[
) 4 ( 2
) 4 ( 2
ln(
4
)]
) 4 ( 2
) 4 ( 2
) 4 ( 2
) 4 ( 2
(
)
) 4 ( 2
) 4 ( 2
ln( )
1
[(
4
1
)
1
( ] ) 1 ( [
2 2
2
2
2
2
2
2
2
2
2
2
2
2
j i ij
j i j
i
j j j j
j j
i
i
j j
j
i
j
i
j
i
a a k
a
X
a
X
a
a X
b
b
b
w u u B Z
w u u B Z
w u B
A
w u u B Z
w u u
X
B
X
Z
w u u B Z
w u u
X
B
X
Z
B
A
w u u B Z
w u u B Z
X
B
B
A
X
A
B
w u
X
a
a b
b
B Z
X
B
X
Z
X
b
Z
b
b
X
Z
b
b
X
− −




+



− − +
− + +

+
− − +
− −


+



− + +
− +


+


+
− − +
− + +








− +









− −


=

Φ ∂
(C.19)

@ Copyright by Hui Cao 2002 All Rights Reserved

ii

I certify that I have read this dissertation and that, in my opinion, it is fully adequate in scope and quality as a dissertation for the degree of Doctor of Philosophy. _______________________________________ Dr. Khalid Aziz (Principle Advisor)

I certify that I have read this dissertation and that, in my opinion, it is fully adequate in scope and quality as a dissertation for the degree of Doctor of Philosophy. _______________________________________ Dr. Louis Durlofsky

I certify that I have read this dissertation and that, in my opinion, it is fully adequate in scope and quality as a dissertation for the degree of Doctor of Philosophy. _______________________________________ Dr. Margot Gerritsen

Approved for the University Committee on Graduate Studies: _______________________________________

iii

iv

construction and performance. To do this in a consistent manner. more complex and more useful than what was available twenty years ago. a good design for the simulator is essential. We found that the natural variables (pressure. It is more complex than black-oil simulation due to the large number of components and various issues related to flash calculations. The performance of different compositional models has been evaluated using a wide range of problems. including its characteristics. variables and implicit levels. while the overall v . and their performance is compared with the performance of the traditional AIM model which uses IMPES (implicit pressure and explicit saturations and mole fractions). Today’s simulator is more robust. which can be used later by a large research group to preserve and enhance the work of several investigators over a period of time. Here we investigated this method in detail. a series of new IMPSAT based AIM (adaptive implicit) models are also proposed. saturations and component mole fractions) are good for the fully implicit (FIM) model. stability.Abstract With the explosion of computational power and development of new and advanced simulation techniques. including the black-oil model. The second objective of this research is to evaluate the performance of different compositional models. compositional model. Various models and techniques of GPRS have been tested. Under these circumstances. unstructured grid handling and multi-point flux approximation. Modern simulators incorporate a large variety of options and they can be used to answer important questions about reservoir management. Because of this complexity. Besides this. and their results and performance are compared with existing simulators. and this approach is used in GPRS to implement various compositional models. Compositional simulation is the major focus of this research. a new General Formulation Approach is developed to derive any kind of model. So the first objective of this research is to develop a new General Purpose Research Simulator (GPRS). They use different equations. The IMPSAT (implicit pressure and saturations and explicit mole fractions) model has been discussed in the literature. reservoir simulation has evolved into a mature technology. a large number of compositional models have been proposed. The IMPSAT model is actually one of the models that the General Formulation Approach can generate.

IMPSAT and FIM). The IMPSAT based AIM models are more flexible. the IMPSAT model is cheaper than the FIM model since it reduces the number of unknowns that have to be solved implicitly. vi . overall component mole fractions) are good for the IMPES model. We have also demonstrated that the IMPSAT model and the IMPSAT based AIM models have very good performance for a wide range of problems. With properly tuned percentages of gridblocks for each formulation (IMPES. For problems that are not very hard. the IMPES+IMPSAT+FIM model will always outperform the traditional IMPES+FIM model. The IMPSAT model is generally over 50% faster than the IMPES model due to its improved stability. and they are more efficient than the traditional models. more stable and less expensive than the traditional AIM model.variables (pressure. and be the best model to use for all problems.

Acknowledgements I would like to thank my adviser Dr. Finally. Special thanks are due to my wife. for her support and for giving me the joy of life. encouragement and guidance during this work. My parents also deserve my gratitude for supporting and encouraging my education from the very beginning. I would also like to thank Dr. our newborn son. This support is greatly appreciated. I also wish to thank the rest of the Petroleum Engineering Department for their supports and contributions to my academic achievements. ChevronTexaco and Schlumberger for summer jobs that provided valuable experience and motivation for my research. This research was partially supported by the Unites State Department of Energy through contract number DE-AC26-99BC15213. Louis Durlofsky and Dr. Margot Gerritsen for reading the dissertation and providing valuable comments. Jie Li. I like to thank the companies supporting the Reservoir Simulation Industrial Affiliate Program (SUPRI-B) at Stanford University for their financial contribution and interest in my research. I also wish to thank ExxonMobile. I would also like to thank my mother in law for helping with the care of our baby. Khalid Aziz for his support. vii .

viii .

v Acknowledgments............... 20 1............................................ 2 1.....2..............................Contents Abstract . 23 1......................................................................................................................xiii List of Figures .........................................................................................................................2 Compositional Simulation...........1 Mass Balance Type ................................................................................................1......2....... 17 1........1................... 25 ix ...........2.........................1 Equilibrium Ratios Flash..........................................4 Other Numerical Techniques .... 9 1...... 4 1.....................................................ix List of Tables ............................3 Outline of Research Steps ................................. 10 1........................1 Formulation and Solution Method ......vii Table of Contents ............................................................................................. 1 1.....2 Flash Calculation...................................1 Explosion in Computational Power.2.............. 21 1...........xv 1 Introduction .......................... 22 1...................................................2 Volume Balance Type..... 20 1.......2.................... 1 1...........................1 Development of Simulation Technology ........................................................................ 10 1............................................................................................................................1.......................................1....................2 Equality of Fugacities Flash..............................2.................................2.................................2..............................2 Development of Simulation Techniques ...............2.................2.................................................3 Treatment of Phase Disappearance and Reappearance .................

.............................................4 How to Build IMPSAT Efficiently?.....................3 Cost of IMPSAT Model .......................................2.......................4 Multi-Point Flux Representation and Implementation............................. 48 2...............................................6 Flash Calculation and Treatment of Phase Disappearance and Reappearance .................... 31 2...2 Basic Aspects of GPRS................. 51 2...................................................................................................4.......................1 3.............................................. 102 4...................................... 103 x .....................2..........4........................2 Different Variable Selections ......... 37 2.....................2.................................................................. 80 Influence of Equation and Variable Selections .........................................................................1......... 63 3........................ 27 2......................................................... 62 3..............3 3..........................2 Reduce Full Set to Primary Set ........................................................................................................... 92 4............................................................................................3 Reduce the Implicit Level of the Fully Implicit System .............................................................. 92 4.1 IMPSAT Model....7 Linear Solver ............8 Timestep Control and Reservoir Initialization ........... 72 3..........2 IMPSAT Stability Criterion? .................................3 Network Modeling ...................... 86 4 IMPSAT and IMPSAT Based AIM model ......................... 43 2............................................................. 100 4.1 Why Does IMPSAT Model Work?........... 66 3...........1 Selection of Primary Equations..................... 84 3................................................................................. 59 General Formulation Approach Steps ...........................2 IMPSAT Based AIM Model .............................. 95 4...........................................5 Well Treatment..................4 Stability Analysis .. 57 3...........................................................................1 Switch From the Natural Variables to Other Variables ............................................... 54 3 General Formulation Approach ...............1... 84 3................................................ 40 2..............................................2 General Nonlinear Equation Set....1..1 Gridding . 91 4..........1.......... 27 2...................2 Control Volume Formulation and Structure of Jacobian Matrix .......

............................2....... 147 6.... 106 5.2......... 147 6...................................... 115 5.......................................4 General Formulation Approach.........................................................................................................5 Non-conventional Well ................................................................................................. 111 5........1................................................. 105 5................ 150 Nomenclature...................................................1 Black-Oil Model............... 155 Appendix A: Overview of GPRS... 165 Appendix B: Black-Oil Simulation Using Compositional Formulation........................... 181 xi ................................................................................................................................1............................ 151 References ............................ 132 5...........2 Performance of Compositional Models in GPRS ....................1.....1........................3 IMPSAT Model............................................... 125 5...........................................................4 AIM Models ......2 Compositional Model..............................................2 Future Work ............................................. 108 5...1 Fully Implicit Models..............................................1 Validation of GPRS.............................................2 IMPES Models ........ 117 5........................ 112 5.........................................................................................................2........................................................................................... 105 5...................................................................... 139 6 Conclusions and Future Work .............2.............................................. 119 5..............1................................. 179 Appendix C: Flash Calculation................1 Conclusions ............5 Model Validation and Performance .........................................................3 Unstructured Grid and Multi-Point Flux............................

xii .

.................... 138 Iteration and timing comparisons for the IMPSAT model and Case 4 problem ..... 145 xiii . 130 Iteration and timing comparisons for IMPES models and Case 2 problem ..... 131 Iteration and timing comparisons for IMPES models and Case 4 problem ....................16 5.....................................................................10 5......8 5. 144 Iteration and timing comparisons for AIM models and Case 3 problem ...............................................2 5.............13 5..6 5.4 5.....1 5.............14 5............... 138 Iteration and timing comparisons for the IMPSAT model and Case 2 problem .....12 5........9 5........................ 138 Iteration and timing comparisons for the IMPSAT model and Case 3 problem .........18 Iteration and timing comparisons for FIM models and Case 1 problem..... 124 Iteration and timing comparisons for FIM models and Case 4 problem........................ 131 Iteration and timing comparisons for the IMPSAT model and Case 1 problem .......15 5............................ 123 Iteration and timing comparisons for FIM models and Case 2 problem.................... 124 Iteration and timing comparisons for FIM models and Case 5 problem...................... 145 Iteration and timing comparisons for AIM models and Case 5 problem ............................... 124 Iteration and timing comparisons for FIM models and Case 3 problem.........17 5...................................................... 125 Iteration and timing comparisons for IMPES models and Case 1 problem ............5 5. 139 Iteration and timing comparisons for AIM models and Case 1 problem .11 5...............List of Tables 5.............................................................3 5....7 5............................................. 144 Iteration and timing comparisons for AIM models and Case 4 problem ................................ 144 Iteration and timing comparisons for AIM models and Case 2 problem .. 131 Iteration and timing comparisons for IMPES models and Case 3 problem ..................................

xiv .

................................................ 52 Reduction process from full set to implicit primary set .......1 4............. 71 Fully implicit Jacobian matrix of one gridblock ..................... 68 Structure of the primary set Jacobian matrix and RHS................5 2....................1 State of the art CPU performance ................ 34 A simple unstructured grid with wells .............2 2.............................................................................................. 36 Gridblock connection array when the block-based approach is used ........................................ 45 Performance comparison between GPRS solver and BlitzPak .............................1 3......... 31 General structure of the Jacobian matrix.......... 60 Structure of the inverse of the transformation matrix for a Type B model..................12 3..............................................2 2............. 97 Oil saturation at the well block ........................... 96 FS as a function of S g for difference K c values ...............11 2..................5 5..................4 3....1 1........ 106 xv ..............................6 3....3 2............. 35 Jacobian structure for the system in Figure 2....... 58 Structure of the full set Jacobian matrix and RHS ........5..................... 77 df g / dS g as a function of S g ............................6 2.2 4..............9 3..............................................9 2................... 98 Maximum stable timestep size for the IMPES model................. 37 Connection array when the connection-based approach is used ............................................................................................................................................ 99 Maximum stable timestep size for the IMPSAT model.......................7 3......................................................10 4.................................................3 4................... 40 Jacobian structure for multi-point flux derivatives .............................. 73 Householder reflection decoupling ..............................................................................................................................................2 3..... 99 Black-oil reservoir............ 73 Jacobian matrix of one gridblock after explicit treatment of flux term ................. 75 Local inversion decoupling ......1 2............... 30 A general polyhedron .... 30 An unstructured grid with faults and multilateral wells..............3 3.....10 2..................7 2............................................................................................. 43 Wellbore flow.................................................... 2 Maximum practical model size ..............................................................4 4........... 3 Effect of gridblock ordering on structure of Jacobian matrix .......................List of Figures 1...............8 3...............5 3............. 76 Illustration for local inversion ........................................... 38 Jacobian structure for two-point flux derivatives...............................................................4 2..... 66 Reduce full set to primary set by Gaussian elimination.......8 2....

...................15 5..... 121 Well block oil saturation comparisons for FIM models and Case 4 problem.........................1.................... 114 Well block oil saturation for models with different implicit levels ..10 5.............. 121 Well block oil saturation comparisons for FIM models and Case 3 problem...................7 5...............5 5.. 127 xvi ......... 122 Stable timestep size for the IMPES model and Case 1 problem..5) pressures from GPRS and Eclipse 300 with ∆tmax=30 days ........................5) oil saturations from GPRS and Eclipse 300 with ∆tmax=30 days for GPRS and ∆tmax=10 days for Eclipse 300 .........21 5..19 5....23 5........................................... 122 Well block oil saturation comparisons for FIM models and Case 5 problem.........................12 5..............................................................................................2 5..................... 107 Compositional reservoir .................1..... 113 Well block oil saturation for the FIM model with Type A and Type B variables ...................................... 126 Stable timestep size for the IMPES model and Case 2 problem.......... 116 Gas oil ratio at the producer from GPRS and Eclipse 100 for a dual-lateral well problem ...4 5................................ 127 Stable timestep size for the IMPES model and Case 4 problem.............................3 5. 109 Well block and block (1...................26 Oil production rate at the producer from GPRS and Eclipse 100 ..................................................................... 116 Heterogeneous permeability field (lnk) for Case 3 ............ 111 Water cut results from GPRS and FLEX for unstructured grid ................5............................11 5..................................... 109 Well block and block (1....13 5...8 5.14 5.......1...........17 5............ 114 Black-oil reservoir with a dual-lateral producer .... 115 Oil production rate at the producer from GPRS and Eclipse 100 for a dual-lateral well problem ................... 107 Gas oil ratio at the producer from GPRS and Eclipse 100.......9 5....... 112 Well block pressure for the FIM model with Type A and Type B variables...........6 5..................... 126 Stable timestep size for the IMPES model and Case 3 problem....................... 113 Well block pressure for models with different implicit levels ............................................. 108 Well block and block (1................5) oil saturations from GPRS and Eclipse 300 with ∆tmax=30 days ...........................20 5...................................25 5.......................................22 5............ 110 Unstructured grid..24 5................. 120 Well block oil saturation comparisons for FIM models and Case 2 problem......16 5..................... 119 Well block oil saturation comparisons for FIM models and Case 1 problem................18 5.....................

......................33 5...... 141 Well block oil saturation comparisons for AIM models and Case 3 problem .....................................................................38 5.......... 168 Well level system model ........................................................... 129 Stable timestep size for the IMPSAT model and Case 1 problem .............. 133 Stable timestep size for the IMPSAT model and Case 3 problem ................ 142 Well block oil saturation comparisons for AIM models and Case 5 problem .....................30 5..............36 5.................... 140 Well block oil saturation comparisons for AIM models and Case 2 problem ..........................................................5 A.................................6 Well block oil saturation comparisons for IMPES models and Case 1 problem ........... 141 Well block oil saturation comparisons for AIM models and Case 4 problem ............................................................... 169 Formulation level system model .................................40 5..................................... 134 Stable timestep size for the IMPSAT model and Case 4 problem ......41 5.43 A......................................................................................................................35 5.....................39 5......................................... 135 Well block oil saturation comparisons for the IMPSAT model and Case 2 problem ......... 136 Well block oil saturation comparisons for the IMPSAT model and Case 4 problem ....................................................34 5....................... 135 Well block oil saturation comparisons for the IMPSAT model and Case 3 problem .........................27 5.............................................................................................. 166 Field level system model....................................1 A.................. 133 Stable timestep size for the IMPSAT model and Case 2 problem ......................................... 128 Well block oil saturation comparisons for IMPES models and Case 3 problem ................28 5............32 5............................. 142 Structure of an oil field......................................................................................... 134 Well block oil saturation comparisons for the IMPSAT model and Case 1 problem ...... 170 xvii ...................37 5...............................................................................................................2 A..... 167 Reservoir level system model ............................................................ 128 Well block oil saturation comparisons for IMPES models and Case 2 problem .................42 5.............5.............31 5........................................... 136 Well block oil saturation comparisons for AIM models and Case 1 problem ...................3 A...................................................... 129 Well block oil saturation comparisons for IMPES models and Case 4 problem .29 5.. 166 Domain level system model .......................................4 A.....................................................................................................

xviii .

including formulation. including the design and implementation of a new General Purpose Research Simulator (GPRS).1 Development of Simulation Technology Reservoir simulation is the art and science of using numerical techniques to solve the equations for heat and mass flow in porous media. The revolution in reservoir simulation over the last 50 years has been fueled by two major factors. 1997). Nearly all major reservoir development decisions are based at least partially on simulation results (Watts. the explosion in computational power and the development of new and advanced simulation techniques. Following this. more and more of the reservoirs have been studied with the aid of simulators (computer programs). an overview of the current research project is given. 1. and it is widely used in reservoir management. different aspects of compositional modeling are summarized. considering the appropriate initial and boundary conditions (Aziz and Settari.Chapter 1 Introduction Petroleum Reservoir Simulation has come a long way since its birth in the 1950s. 1 . phase behavior calculations and various numerical techniques used in the simulator. Today. Reservoir simulation has evolved substantially since its birth. Since the availability of digital computers to the petroleum industry in the 1950s. the development of new compositional models and evaluation of different compositional models. reservoir simulation is a mature technology. It is worthwhile to take a brief look at the development of simulation technology before describing new developments resulting from the research reported here. 1979). Since compositional simulation is the major interest of this research. the development of a new flexible General Formulation Approach.

Memory A steady increase of available memory enables us to run larger and more complex programs. In the 1970s. Without substantial progress in computing. CPU speed. Each of them has contributed to the development of simulation in its own way.1.1 Explosion in Computational Power The earliest computers were little more than adding machines by today’s standards. 10000 1000 100 Mflop/s 10 1 0. parallel computing and programming languages.1 State of the art CPU performance (Dongarra. the best computers available had only several Megabyte 2 . just as predicted by Moore’s Law (the number of transistors per square inch on integrated circuits doubles every 18 months). 2002) CPU speed Figure 1. memory. In the last several years.1 gives the computing speed in millions of floating point operations per second (Mflop/s) for the four fastest CPUs of their time. progress in reservoir simulation would have been impossible. Developments in computing power are concentrated in four areas. CPU speed increased by nearly 2000 times from 1970 to 1996.1 1965 1970 1975 1980 1985 1990 1995 2000 2005 Year Figure 1.1. the rate of increase of CPU speed appears to be slowing down.

the cost of development is reduced. Today. Today. Today’s objectoriented languages (such as C++) facilitate the design and development of large and complex computer programs. 1997). and higher speedup factors are expected for even larger models.E+06 1.E+04 1.2 Maximum practical model size 3 .E+03 1. 2001). Parallel computing Figure 1.E+02 1960 1965 1970 1975 1980 1985 1990 1995 2000 Year Figure 1..1 shows single processor performance. and number of processors. Generally 32 processors lead to a speedup of 15-25 times for large (hundreds of thousands of gridblocks) reservoir models (Watts. The resulting performance (parallel speedup) depends widely on problem type. programming languages have developed through several stages. size. a good PC could have 2 Gigabyte (1Gigabyte = 1000Megabyte) of memory. 1.E+05 Number of gridblocks 1. highperformance computing is achieved by using multiple processors in parallel. Modular approach and all kinds of source code control software (such as SourceSafe from Microsoft) make group programming easy and feasible.of memory. and a parallel supercomputer could have over 50 Gigabyte of memory (Dogru et al. Programming languages From the early version of Fortran to today’s Fortran90 and C++. and programs developed using modern tools are easier to maintain.

Up to this point. In 1997. including gridding. all reservoir simulations were performed on rectangular Cartesian grid. radial grid was developed later to simulate near well flow. The fast growth in model size in the last several years is primarily due to the use of parallel computers.1. 1973. 1995. and to develop and apply new simulation techniques. As a result. Peaceman. and the simulator more robust.2 summarizes these results. 1985). Today with parallel computing. Ding and Lemonnier. 1. it was roughly 500. In 1960. 1989. which is roughly proportional to the growth in computing speed. By 1970. 1991. stable. All of these technical advances are making simulation more accurate and realistic. the model sizes are becoming even larger. new techniques have appeared in all areas of simulation.A steady decrease in the price of computers has made simulation more and more affordable. it is becoming possible to more accurately account for reservoir heterogeneities and process characteristics. numerical approximations. 1996) made it possible to use non-rectangular gridblocks. all grids were 4 . the largest model size was around 200 gridblocks. fluid modeling. Pedrosa and Aziz.2 Development of Simulation Techniques In recent years. At the same time. fast. and routine simulation with one million gridblocks. providing the capability to model faults and other complex geological features. Nacul. it had grown to about 2000 gridblocks. Figure 1. linear solvers. 1997). and user-friendly. it shows a constant rate of growth in model size from 1960 to 1997. A direct consequence of increasing computing speed and memory is the growth of model size. In a recent meeting Dogru (2001) reported simulations with up to 16 million gridblocks for three-phase black-oil problems. etc. engineers and scientists are looking for ways to reduce the cost of reservoir simulation by reducing the number of unknowns per gridblock and by developing more robust linear solvers and preconditioners. Gridding In the early stages of this technology. Development of corner-point geometry grid (Ponting.000 gridblocks for simulations on a single processor (Watts. reservoir and geological modeling. Local grid refinement was developed to achieve better accuracy in high flow regions (Ciment and Sweet. The growth in computational power enables engineers to simulate large and complex compositional problems.

GOCAD from the GOCAD group and GridPro from Program Development Corporation (PDC). While in the new connection based approach.. the network of connections are considered. each node can be a gridblock node. 1989.. j. FloGrid from Geoquest. flow based unstructured grids (Agut et al. the connections between gridblocks are flexible. Beside developments in gridding techniques. 2000) have been proposed. These grids roughly follow major geological features. such as. and they are concentrated in high flow rate areas.. Automatic gridding software packages are becoming available from commercial vendors.. Edwards et al. A cell (gridblock) list is used for the calculation of accumulation terms. In the conventional approach or the block-based approach. Gunasekera et al. Aavatsmark et al. In unstructured grids. 1994. 1997. In the last decade. Verma and Aziz. Most unstructured grids are non-orthogonal grids. k indices. which can easily force gridblocks to conform to major geological features. 1998. Palagi and Aziz. within each unit. such as faults. 2000). users can define major reservoir units to which the simulation grid must conform. a well node or a surface facility node. A connection always links two nodes. (1994) proposed a new approach to the representation of grid information. Lim et al. and a connection list is used to keep track of the connected gridblocks. where the neighbors of a gridblock could be easily identified from their i. gridblocks and wells are tracked when computing flux terms. Kocberber. In Chapter 2. This connection-based approach is extremely convenient for unstructured grids. the grid can be generated automatically with some guiding input from the user (Geoquest. Edwards et al. 1997. such as wells or high permeability regions. and a connection list is used for the calculation of flux terms. Castellini et al. 1996-1997) were introduced. (1998) showed that. which are normally formed by generating streamlines and iso-potential lines from a fine grid single-phase simulation. we will discuss the construction of the Jacobian matrix and the residual using this approach.structured. Today. since the 5 . Considerable smoothing is required to make the grid suitable for simulation.. unstructured grids (Heinemann and Brand. 1997. the multi-point flux calculations can be reduced to two-point flux calculations. which often require the use of multi-point flux approximations. In the last several years. if the grids follow the streamlines exactly. 1998.

In the petroleum industry. 1996. 1978. Gunasekera et al.connection list itself has no structure at all. 1991) and finite element methods (Young. Behie and 6 . because of their easy handling of unstructured grids. most of the effort in this area has been on building better preconditioners. The development of compositional simulation makes it possible to simulate volatile oil reservoirs. The performance of iterative solvers depends on the quality of preconditioners.. 1994) and multi-point flux calculations. control volume methods (Aavatsmark et al. 1991. it is also suitable for domain decomposition. compositional simulation is much more expensive than black-oil simulation. Besides this. due to the larger number of unknowns per gridblock and complex flash behavior. direct solvers were used. At the same time. Lee et al.g. compositional simulation. became more mature and ready to use. where the hydrocarbon system is represented by two pseudo-components. More recently.g. surface facility modeling (Lim et al. Traditional preconditioners include. 1997) have become the method of choice for today’s simulator. In the early 1980s. Initially... CO2 flooding and other EOR processes. Fung et al. 1994. Limited work has also been done on higher-order schemes (Sammon. Linear Solver Solving the linear system is the single most costly part for a simulation. Aziz. 1991. 1997) and non-orthogonal grids. 1996)... where the hydrocarbon system is represented by an arbitrary number of components and pseudo-components (e. Any iterative solver can be used as a preconditioner for other iterative solvers. Fluid modeling Initially. Incomplete LU decomposition (ILU) (e. Verma and Aziz. 1998) are becoming more and more common due to the use of full tensor permeability (Lee et al. oil and gas. 1994) to achieve higher accuracy. 1997. multi-point flux calculations (Verma and Aziz. according to their status at standard conditions.. So it is extremely important to have a good linear solver. and different preconditioners can be combined together to form multistage preconditioners.. Numerical approximations Conventional simulators use finite-difference methods with two-point flux calculations. Chen et al. iterative solvers have become more and more common. all simulations were based on the black-oil fluid model. but as the problems have become larger and larger (more and more gridblocks). Sukirman and Lewis. However.

the simulator has also reached a new stage. and for such systems the existing solvers loose their efficiency. and these issues will be discussed in Section 2. the ordering of gridblocks and connections are quite important for the efficiency of the linear solver. For near-elliptic system. 1983).g. However a lot of work needs to be done for unstructured grid solvers and AIM system solvers. For this kind of mixed system. For problems with structured grids. Today’s simulator is more robust. Their performance depends strongly on the nature of the linear system. etc) work well. which result in Jacobian matrices with a banded structure. surface facilities (Schiozer and Aziz. and easier to use than what was available 20 years ago. Gauss-Sediel (GS) (e. (1985) introduced the Constrained Pressure Residual (CPR) preconditioner. GS. AMG works well. there is more and more cooperation among reservoir engineer. Furthermore. Byer. Reservoir and Geological Modeling Reservoir simulations have also expanded in terms of options and features. AMG. 1993). the Jacobian matrix is a general sparse matrix. for near-hyperbolic system. In reservoir simulation. Because of all the features that are 7 . Modern reservoir simulators can simultaneously handle multiple reservoirs. the best iterative solvers can solve a problem with n unknowns in O(n1. Wallis et al. geologist and geophysicist to achieve more realistic modeling of reservoir geology for simulation projects (e. For unstructured grids.7). Unfortunately. which is specially designed for reservoir simulation equations.Forsyth. Journel. 1990. 1979). 2000) and rock mechanics. both ILU and GS work well. a good preconditioner is still missing for the Adaptive Implicit (AIM) Method (Forsyth and Sammon.2) time (see timing results in Section 2. It uses a two-stage approach to solve the pressure part and the saturation part of the reservoir equations separately.. Algebraic Multi-Grid (AMG) (Stueben. we need a smarter preconditioner. For unstructured grids. more complex.1~1. Ballin et al. 1983).g. Aziz and Settari. 1994. none of the single stage preconditioners (ILU. we have a near-elliptic pressure equation and near-hyperbolic saturation equations. Most of the available commercial linear solvers have been designed for structured grids. 1986). etc.7. With all of these developments in simulation technology and computers. which make it the most promising preconditioner for fully implicit simulations.

fully coupled surface facilities model (future development). Hopefully. Fortunately. after a student leaves. it takes more time to develop a simulator and more effort to maintain it. due to lack of good design and documentation. The first objective of this research is to develop a General Purpose Research Simulator (GPRS) with a highly modular structure. Some of the features of particular interest to our research group are. Under these circumstances. is included in Appendix A. today we have all kinds of design tools and suitable computer languages to develop technology to meet the future needs of the industry. This will enable each future developer to work on extending modules of interest to him/her. most of his/her development becomes unusable within a short time. 8 . we will incorporate many of the available new simulation techniques that were developed in the last decade. simulators will be required to solve even more complex problems than they can handle today. Research students working in this area need a lot of time to program the basic simulator before they can even start to explore research topics of interest to them. After the basic design and components have been put in place. both two-point flux and multi-point flux calculation for network modeling. a good design for the simulator is vital. this approach will save time in developing new techniques. a number of which are unavailable in commercial simulators. Hence developing a good environment for simulation research has become essential for a research group like the one at Stanford University. Also. and help preserve the work of new students. advanced linear solver technology (need further development).required in a modern simulator. A new researcher will be required to understand only the most basic structure of the simulator. An overview of the GPRS program. • • • • • • unstructured grid (structured grid is handled as a special case of unstructured grid). and fully coupled geo-mechanical model (future development). network modeling (connection based approach). without having an intimate knowledge of every aspect of other modules. the entire research group will be able to contribute to the project. including its design. In the future. Inside this new General Purpose Research Simulator.

the number of equations and components increases. which is the major focus of this research. we may still need to use a compositional model for simulating such processes as CO2 injection. and this requires flash calculations.4bbl/stb and API gravity less than 30. We plan to add in the last two features in the near future. and flash calculations are not needed. phase behavior is represented by an Equation of State (EOS) and phase equilibrium relations. N2 injection. The 9 . phase behavior is simply represented by Bo and Rs. Aziz. pseudocomponents (groups of molecules) with average physical properties are used to describe the reservoir fluid. 1. It is not practical to describe petroleum fluids in terms of individual components. the oil and gas must be described by more than two pseudo-components. and the fourth feature needs further development. and the choice of equations and variables gets more complex. 1996). 1996). Sometimes.Currently. Because of this. is typically referred to as black-oil. As mentioned earlier.g. Instead. etc. black-oil and compositional. with gas solubility ratio (Rs) less than 750scf/stb. where the phase equilibrium relations can be reduced to linear relations between component mole fractions and pressure. which are only functions of pressure.g. the first four features have been included in GPRS. GPRS is using a flexible compositional formulation. Whenever it is inappropriate to use a black-oil model. In this case. An oil. In this case.2 Compositional Simulation Petroleum reservoir fluids contain thousands of chemical components that affect their physical properties and phase behavior during production (e. so it is worthwhile to take a further look at various aspects of compositional simulation. oil formation volume factor (Bo) less than 1. this is the case in GPRS. we have two models for the fluid. The black-oil model is just a special case of the compositional model. Aziz. This selection is usually based on the volatility of the oil (e. we can perform black-oil simulation using compositional formulation (refer to Appendix B for details). even when the reservoir fluid satisfies the black– oil condition. As we go from black-oil to compositional models.

The choice of the implicit level (number of implicit variables for each gridblock) is another important factor here. including formulation.1. nc is the number of components. qW and qW are the phase volumetric flow rates of well W. equations for this type of model are the mass balance equation for each hydrocarbon component (or pseudo-component) and for water (e. 1. 1980. and n p is the number of phases. Coats. we may also need to switch variables when a hydrocarbon phase disappears or reappears.g. The essential aspects of compositional simulation are discussed in detail in the next several subsections. according to the basic equations they solve. Depending on the variable type. Here. 1.1 Mass Balance Type Just as the name implies. In the following discussion.2.i = [ φ ( So ρ o x c + S g ρ g y c )]i − ∑ [T ( λo ρ o xc ∆Φ o + λ g ρ g y c ∆Φ g )]l .1 Formulation and Solution Method We can separate different compositional models into two basic types. mass balance type and volume balance type. phase behavior and various numerical techniques.i = (1.1) c = 1. nh = nc -1 is the number of hydrocarbon components.i V ∂t l W + ∑ ( ρ o xc qo + ρ g y c qW ) i = 0 g W (1. nh ∂ (VφS w ρ w ) i − ∑ (Tλw ρ w ∆Φ w ) l .2.…. we only consider isothermal compositional models. Young and Stephen. and qo .2) where.i + ∑ ( ρ w qW ) i = 0 w ∂t l W Fw . All of the following equations are for three-phase systems. xc and y c are the hydrocarbon component mole fractions in the oil and gas phases W respectively. g w 10 . 1983): ∂ Fc .performance of the simulator (convergence of Newton iterations and convergence of linear solver iterations) can be strongly influenced by these factors. and water and hydrocarbon phases are totally separated.

6) In addition to mass balance equations.i ) − β ρ p . j − p p .3) µp (1. g = 0. 1. 11 . nh (1. j ( D j − Di ) gc (1. Since water and hydrocarbon components are totally separated.Transmissibility is calculated by kA T =α ∆L Phase mobility is determined by k λ p = rp (1. Sometimes it is convenient to replace one of the hydrocarbon component mass balance equations by a total hydrocarbon mass balance equation obtained by summing Eqn. c = 1.0/144).5) where α and β are unit conversion constants (For field units. g are the fugacities of hydrocarbon component c in the oil and gas phases.i = [Vφ ( So ρ o + S g ρ g )]i − ∑ [T ( λo ρ o ∆Φ o + λg ρ g ∆Φ g )]l . ∂ Fh .i ∂t l W + ∑ ( ρ o qo + ρ g qW ) i = 0 g W (1.32654E-3 and β =1. respectively.o − f c . we only need two-phase equilibrium relations between the oil and gas phases: Fe = f c . j − Φ p .1 for all hydrocarbon components.i . α =6.i .….o and f c . we need a phase equilibrium relation for each hydrocarbon component.4) Phase potential difference between gridblock i and j is defined as g ∆Φ p . Appendix C provides details of flash and fugacity calculations.i = ( p p . j = Φ p .7) where f c .

8b) • Saturation or volume constraint: FS = ∑ S p − 1 = 0 p =1 np (1. Fpg ____________________________________________ Total 2 nh +6 12 .8d) or FV = Vφ − VT = 0 where Vφ is the pore volume.8c) (1.8e) (1. and VT is the total fluid volume.8f) Fpg = ∑ y c − 1 = 0 c =1 For this system.ow − ( po − p w ) = 0 Fpcgo = pc . go − ( p g − po ) = 0 (1. • Component mole fraction constraints: Fpo = ∑ x c − 1 = 0 c =1 nh nh (1. the equations are: Type Fc Fh Fw Fe Fpcow .8a) (1. Fpcgo Number nh -1 1 1 nh 2 1 2 FS Fpo .Finally some linear constraints have to be satisfied: • Capillary pressure constraints: Fpcow = pc .

Assuming isothermal conditions. other variables (secondary variables) can be solved for from the remaining equations (secondary equations). and the total number of independent mass balance equations ( Fc . first solve for them. 1997) for an isothermal compositional system are f = (nc + 2 − n p ) + (n p − 1) − 1 = nc So we only need to solve nc of the 2 nh +6 total equations to fix both the intensive and extensive state of the system. After solving for the primary variables. Fh . only the first 2 nh +1 equations ( Fc . 1986). then solve for the remaining primary variables by explicit or sequential implicit methods (Aziz and Settari. like in the FIM model. 1979. the thermodynamic degrees of freedom for this system are f thermo = nc + 2 − n p . Fe ) are non-linear. the volume fraction of each phase ( n p -1 saturations) must also be determined to fix the extensive state. Fw ) is equal to the number of 13 . In order to further speedup the simulation process.Same number of variables need to be selected. According to Gibbs phase rule. We can treat all of the primary variables implicitly. one possible choice is: Type pp Sp Number 3 3 nh nh xc yc ____________________________________________ Total 2 nh +6 There are a total of 2 nh +6 equations and 2 nh +6 variables. It is neither practical nor necessary to solve all of these equations together. Watts. Besides this. These nc equations are our primary equations. Fh . There should be the same number of primary variables (variables for the FIM model). we have one less degree of freedom. Fw . we can also treat only some of the primary variables implicitly. They fix the intensive state of the system. They are also the equations solved simultaneously for fully implicit (FIM) models. Note. The final degrees of freedom (Aziz.

and they are different in the way that primary equations and variables are chosen. After the primary set is selected. Finally. depending on whether the system in a gridblock is predominantly vapor or liquid. nh (when both the oil and gas phases are present). l (hydrocarbon liquid mole fraction). and we need to switch variables when a hydrocarbon phase disappears or reappears. So. The Fussell and Fussell Model (1979) For this model the primary equations are the nh phase equilibrium relations and the saturation constraint equation. In general.….primary equations and variables. This is the only model that uses phase equilibrium relations as primary equations. Out of this full set. adjacent gridblocks may have different sets of primary variables.…. Sg. and it is rarely used. The saturation constraint equation is the final IMPES (Only pressure implicit formulation) pressure equation.…. and p. since the mass balance equations can be directly 14 . xc . nh . c=2. The variable selection (pressure. Sg. nc primary equations and variables are selected. and y c or xc . which is the full set of equations and variables. they are the natural choice for primary equations. Since mass balance equations represent flow in the reservoir. The Coats Model (1980) For this model the primary equations are the nc mass balance equations for each hydrocarbon component and for water. y c . So. only 2 nh +1 number of non-linear equations and variables is left. saturations and component mole fractions) in this model is normally called the natural variable selection. The primary variables are p. nh -1 (when no free gas is present). There are a lot of models that belong to this class. one saturation and two component mole fractions. The primary variables are. c=3. The nh phase equilibrium relations are used to remove all of the primary variables except pressure from the saturation constraint equation. • • • p. We can use the linear constraint equations to remove two pressures. p. c=1. and their number always equals the number of primary equations. nh -1 (when the oil phase disappears). the equations and variables left over in the full set form the secondary equations and variables. But the selection of primary variables is widely varied among models. y c . Some of the basic models are reviewed next.…. c=1.

Lee.). and Chen Model (1985) For this model the primary equations are the nc mass balance equations for each hydrocarbon component and for water. On the other hand.…. For this model. saturation is not one of the primary variables. W and rc = z c F (total moles of component c in one unit volume of fluid). but it can also be reduced to an IMPES model by variable elimination. c=1. This approach does not depend on the presence of individual phases. nh c≠max. Sometimes. 15 . This model was initially proposed as a FIM model. (rmax is defined as the rc with respect to which the derivative of the saturation constraint is largest. the saturation constraint equation is a nonlinear equation in terms of the primary variables). nh -1. so we have to use the chain rule to evaluate some of the derivatives of the flow term with respect to saturation. The Young and Stephenson Model (1983) For this model the primary equations are the nc mass balance equations and the saturation constraint equation. then there will be only nc primary equations. W = ρ w S w (total moles of water in one unit volume of fluid) and z c (overall mole fraction of component c). since all of its primary variables are overall quantities. This model also does not depend on the presence of individual phases. The primary variables are p. The nc mass balance equations are used to eliminate all of the primary variables except pressure from the saturation constraint equation. this is done to facilitate the Jacobian matrix calculation. especially when certain constraint equation is nonlinear with respect to the selected primary variables (here. such as relative permeability.expressed in terms of these variables and calculation of derivatives of the Jacobian matrix is very easy. The primary variables are p. The Chien. F = ρ o S o + ρ g S g (total moles of hydrocarbon in one unit volume of fluid). The equations of this model are normally solved fully implicitly. An alternative approach is to treat this extra nonlinear constraint equation as a secondary equation. c=1. there are nc +1 primary equations and variables. this model needs to use the chain rule to evaluate some of the flow term derivatives. The saturation constraint equation is the final IMPES pressure equation. Actually each small ( nc +1)x( nc +1) block system can be reduced to a nc x nc block system.…. one more than necessary. and the last hydrocarbon component mass balance equation is replaced by the total hydrocarbon mass balance equation. Also.

In summary. 1985) belong to Type B. while in the original Coats model (Coats. The variations are obtained by changing the level of implicitness. and each of them is actually a variation of one of these basic models.Each of the models described above could be either fully implicit or only implicit in pressure. all of these isothermal compositional models (except the Fussel and Fussel model) select mass balance equations as the primary equations. changing intensive and extensive variables. The Young and Stephenson model (Young and Stephenson. Common Points: • • • • Mass balance equations are always the primary equations.n p component mole fractions Type B variables: one pressure nc -1 overall quantities. Each type of variables has its own advantages and disadvantages. 1980). 1996). all primary variables are treated implicitly. 1980) belongs to Type A.. such as overall component mole fractions The Coats model (Coats. The common points and differences between these two types of variables are given below. and there are basically two types of primary variables (Aziz. 1983). only pressure is treated implicitly. and so on. the secondary variables are updated explicitly via the phase equilibrium relations gridblock by gridblock Both types of models can be either fully implicit (FIM) or only implicit in pressure (IMPES). There are a lot of other models. Lee and Chen model (Chien et al. In the original Young and Stephenson model (Young and Stephenson. Phase equilibrium relations are always used to eliminate the secondary variables from the primary equations. 1983) and the Chien. 16 . After solving for the primary variables. Type A variables: one pressure n p -1 saturations nc .

the chain rule is required to calculate derivatives of phase relative permeability with respect to overall component mole fractions.Differences: • Type A variables are the natural variables. and the Jacobian matrix is easy to calculate. This can be expressed as Vφ = VT = Vw + Vo + Vg (1. and use the volume balance equation as the pressure equation to form IMPES type formulations. check the existence of individual hydrocarbon phases and perform the switch. equations can be explicitly expressed in them. the pore volume must be equal to the total fluid volume at any time and place. • In Type A. and the same primary variables can be used for all gridblocks. Type B uses overall compositions as the primary variables. Aziz and Wong. if a hydrocarbon phase changes status.2 Volume Balance Type This type of models (Acs et al. Since the pore space of porous medium must be fully filled with fluids present. Kendall et al. This generally leads to different primary variables in different gridblocks.. so they depend on the appearance and disappearance of hydrocarbon phases. Additional work is required to track the variables used in each gridblock.10) where cr is the rock compressibility. 1986. we have to use the chain rule to calculate the derivatives for the Jacobian matrix. For each gridblock.1. phase variables (saturation and component mole fractions in each phase) are used. 1. 1982. For example. 1988-1989) are based on the volume balance concept.2.9) The pore volume Vφ is solely a function of pressure: Vφn +1 = Vφn + Vφo cr ( p n +1 − p n ) (1. For Type B variables.. 1983. 17 . Watts. we need to switch the primary variables (replacing the non-existing phase variables with the corresponding variables for the existing phase).

n+1 ∆t where: n U w.…. The time level for terms with superscript “n.15) Note that. Eqn.M w . j ≠c where.M j  ∂V  U cn .M w . ρ w .10.n +1 = ∆ T (λo ρ o xc ) n . 1.n +1 +  T   ∂M  w   .14) (1. ρ g .n +1 c = 1. M c and M w are the overall mole amounts of hydrocarbon components and water.12 and Eqn. 1. nh (1. it can be written as n   Vφo cr −  ∂VT  ( p n +1 − p n ) = [VT − Vφ ]n   ∂p      M .13) n W U cn.11. λ g . 1.M c   (1. λ w .M j . 1.M  w c   n  nh   ∂VT   + ∆t ∑   c =1  ∂M c      p .13 into Eqn. After rearranging.n +1 ∆Φ n +1 ] + Qw . the transmissibility terms ( λo .n +1  Uw  p . ∆t n +1 n Mw − Mw n = U w. for IMPES.16) 18 .n +1 ∆Φ n +1 + Qc .11) ( M cn+1 − M cn ) p .n +1 . n+1” depends on the implicitness of the model. which can be written as M cn +1 − M cn = U cn .M c  ∂V + ∑ T  c =1  ∂M c nh     n (1.n +1 ∆Φ o +1 + T (λ g ρ g y c ) n. n+1 w [ = ∆[T (λ ] (1. ρ o . y c ) are fixed at the old time level.n +1 g w W ρ w ) n . j≠c n  n . The final pressure equation is obtained by substituting Eqn.M c n +1  ∂V − p )+ T  ∂M w  n     n n n ( M w+1 − M w ) p . n n M cn +1 − M cn and M w+1 − M w are actually the accumulation terms in the mass balance equations.The total fluid volume VT is a function of both pressure and overall composition of each component: V n +1 T  ∂V =V + T  ∂p  n T     n (p M w .12) (1. xc .

regardless of the variables selected. IMPEM (implicit pressure and explicit overall component mass/mole).16. we do not distinguish between them. From this point of view. choice and ordering of variables and equations. as long as it finally reduces to the IMPES pressure equation. other variables are updated explicitly gridblock by gridblock.. ∂p ∂M c ∂M w In order to calculate these derivatives analytically. the pressure equations are always equivalent to each other. They are only different in two aspects: • The number of operations to generate the final IMPES pressure system is different. and how to derive the volume balance model starting from the Jacobian matrix of a mass balance type model. the volume balance type models are only implicit in pressure. So no matter which type of model we use. Comparing the mass balance type models with the volume balance type models. 1999). we will just treat the volume balance type model as a special IMPES case of the mass balance type model. In this research.After solving for pressure from Eqn. • The Jacobian matrix is scaled differently from gridblock to gridblock. and refer to them as IMPES models. Aziz and Wong. we need to make full use of the phase equilibrium relations. The key part of this method is to calculate the derivatives of individual phase volumes ∂V p ∂V p ∂V p with respect to both pressure and overall moles of each component ( . basically it is an IMPES approach. Coats (1999) has pointed out that the IMPES pressure equation is unique. 1983. Models of this type were proposed by Acs et al. Kendall et al. which could influence the convergence rate of iterative linear solvers (Coats. 1999). the Young and Stephenson model is more efficient than the Coats model (Coats. . In this work. independent of the manner of derivation. 1988-1989. Different authors have proposed different methods to calculate these derivatives. Watts. numerically they are equivalent to each other. 1. 1986. As stated earlier. 1982. 19 . (1990) showed the connection between these two types of models. ). In two papers. Aziz and Wong (1989) and Wong et al. Models that treat only pressure implicitly are referred to in the literature by different names: IMPES (implicit pressure and explicit saturations).

Eqn. they also require additional flash calculations.19) l + (1 − l ) K c K c zc yc = (1.20) l + (1 − l ) K c From Eqn. in this approach we assume that these functions are known. Eqn.8e.2 Flash Calculation Compared to black-oil models. From Eqn. The equilibrium ratios are functions of both pressure and mole fractions.18) where l is the hydrocarbon liquid (oil) mole fraction in hydrocarbon fluid.2. We have the following equilibrium relations: y c = K c xc z c = lxc + (1 − l ) y c (1. Solve for xc and y c from Eqn. 1952). z c and K c : zc xc = (1.8f. which is solely a function of l for a given z c and Kc : 0 = 1 − 1 = ∑ y c − ∑ xc = ∑ ( y c − xc ) = ∑ c c c c ( K c − 1) z c l + (1 − l ) K c (1. There are two types of flash calculations: 1. 1. In black-oil models. 1.20.1. 1. we can derive the Rachford-Rice equation (Rachford and Rice. 1983) to flash calculations. Solve for l from Eqn. 1.2. we can further express xc and y c in terms of l . 1. the phase equilibrium relations can be reduced to a series of linear relations between component mole fractions and pressure.21) The solution procedure reduces to the following two steps: 1.1 Equilibrium Ratios (Kc) Flash This is the simplest approach (Young and Stephenson.21 2. 1. 1. 1.19 and Eqn. In compositional models.17) (1.19 and Eqn. 1.17 and Eqn. compositional models are not only more complicated in their formulations. we need to do flash calculation for each gridblock at each iteration of each timestep. so there is no need for flash calculations.18.2.20 20 .

1. Besides phase equilibrium calculations. Solve for xc and y c from Eqn.19 and Eqn. g = 0 . update equilibrium ratios by K cnew = K cold ⋅ ( f c .o − f c .…. c =1 nh (1. after the error is reduced to a certain level. They can be solved by either the successive substitution method or the Newton-Raphson method (Fussel and Yanosik. So. nh . 1. Calculate the fugacity for each component in each phase 5. For different Equation of State (EOS). If not converged.23) 21 .2. 1976) is the most popular one. c = 1.22) and the gas phase molecular weight is calculated as MWg = ∑ MWc ⋅ y c . The solution procedure for the successive substitution method is given below: 1.20 3. Solve for l from Eqn. 1983). we have different equations to calculate the component fugacities. a typical approach is to use the successive substitution method first. which are a series of nonlinear equations. the Newton-Raphson method is used to finish it quickly (Nghiem et al.o / f c . g − 1. Check convergence ( | f c . Cubic Equations of State are commonly used in the petroleum industry. The oil phase molecular weight is calculated as MWo = ∑ MWc ⋅ x c c =1 nh (1. The successive substitution method converges slowly.2. 1978). g ) . but it only converges near the true solution. this procedure also yields phase properties.o / f c . Calculate the phase compressibility factor Z for each phase from an Equation of State (EOS) 4.1. but convergence is guaranteed.0 | < ε ) 6. A properly tuned Cubic EOS is generally adequate for compositional simulation. 1.. Fe = f c . and among them the Peng-Robinson EOS (Peng and Robinson. the Newton-Raphson method converges quickly.21 2. and repeat step 1 to 6 Appendix C derives all of the analytical expressions of derivatives needed for the Newton-Raphson method.2 Equality of Fugacities Flash At equilibrium.

1985). there may be up to two hydrocarbon phases (oil and gas). • A new set of pseudo-equilibrium ratios (PER’s) is used. Whether both hydrocarbon phases exist or not. and get the saturation solutions. 1. • A flash calculation is performed. This kind of flash is called negative flash (Whitson and Michelson. If only a single hydrocarbon phase exists. today most of them prefer the faster Newton-Raphson method or a combination of both methods. This method is suitable for both compositional and thermal models. If either So or Sg is negative.3 Treatment of Phase Disappearance and Reappearance In a gridblock. for the oil phase the smallest real root is used and for the gas phase the largest real root is used. there are three ways to do it: • For each Newton iteration. In this case. we need to monitor its condition to find when it will change to a single hydrocarbon phase. and only one set of equations and constraints are used at all times to simulate the process regardless of the phase condition (Abou-Kassem and Aziz. the corresponding hydrocarbon phase disappears. l . else if l >1. most simulators used the successive substitution method. temperature and overall composition.24) where compressibility factor Z is one of the three roots of the Cubic EOS. it is set to zero before initializing for the next Newton iteration (Coats. we need to establish the existence of hydrocarbon phases in all gridblocks. <0. then the oil phase does not exist anymore. In the early days.. Phase Disappearance When a gridblock has two hydrocarbon phases. equations and variables for some models may have to be changed. 1986). then the gas phase disappears (Nghiem et al.The hydrocarbon phase densities are calculated as pp ρp = ZRT (1. Basically. depends on pressure.2. Some simulators separate flash calculation from flow calculation. especially for simulators using Type B variables. 1980). If the liquid mole fraction. During simulation. 1983). 22 . we solve the flow equations.

4 Other Numerical Techniques Partial Jacobian Update (Young and Stephenson. Relaxed Volume Balance Concept (Coats et al. If the calculated saturation pressure is less than the gridblock pressure.Phase Reappearance When a gridblock has only a single hydrocarbon phase. we use S g = 1 − S w − So where e = 1 − S w − S o − S g  δS g = e − δS w − δS o  to directly substitute for S g . 1983). 1980). • A flash is performed. we may need to change equations and variables again. This technique can save some time in Jacobian calculations. since the same set of equations and constraints is used at all times regardless of the phases present. 1985) of phase disappearance can be applied without any change. we also need to monitor its condition. For the linear constraint equations. then a saturation pressure is calculated for the single hydrocarbon phase fluid present in the block. 1983).. 1998) This technique can be used in both the FIM and the IMPES models. • The third treatment (Abou-Kassem and Aziz.. In other words. When e = 0 . it is called the relaxed volume balance approach because some volume balance error (phase 23 . if either So or Sg is zero in a gridblock. At convergence. δS g into the nonlinear equations in order to remove them. the Jacobian terms are updated only for un-converged gridblocks. correct results are guaranteed. 1983) If a gridblock satisfies the convergence criteria. then both hydrocarbon phases exist (Nghiem et al. volume is not conserved. We can accelerate the convergence of flash calculations by getting the initial values from the neighboring blocks (Young and Stephenson. 1. when e is not zero.001 (Coats. volume is conserved. if l is between 0 and 1. its old Jacobian values are retained. such as S w + S o + S g − 1 = 0. Because whenever it changes to two phases. otherwise. the gridblock remains in single hydrocarbon phase mode. The following three approaches can be used for this: • For each Newton iteration. both hydrocarbon phases exist and the absent-phase saturation is set to 0.2. typically it is used in IMPES models. and it does not have a large influence on the convergence behavior of Newton iterations.

From the above discussion. it may worsen the convergence rate of Newton iterations. If exact balance is not achieved at the last timestep. Since the fully implicit (FIM) models are too expensive for large problems and the timestep limits on the IMPES model are too strict for hard problems. In effect. it is worthwhile to do only a few flash iterations without full convergence. Another objective of this research. then this balance error can be corrected in the current timestep.saturations do not exactly sum to 1. we should do exact flash calculation for each Newton iteration. But at most times. requires one to deal with complex issues associated with flash calculations and programming. However. They just have too many differences. This relaxed balance concept can be used for any linear constraint equation. in addition to developing a General Purpose Research Simulator (GPRS). and where appropriate. If the flash results are far from convergence. is to evaluate the performance of different isothermal compositional models. we need a new model that is cheaper than the FIM model and much more stable than the IMPES model. This is appropriate because the result of each Newton iteration is only an approximation to the final solution. we need to develop a General Formulation Approach which can be used to 24 . develop new models. before we can even start to evaluate different models. exact mass balance at each Newton iteration is achieved. There are two major reasons for the lack of appropriate comparisons: • It is hard to implement different compositional models in one simulator. Some analysis and evaluation of the performance of individual compositional models has been published (Coats.0) is accepted. 1999). but it is far from complete. On the other hand. • Compositional simulators are much harder to develop than black-oil simulators. There are a variety of compositional models. Before the work can be started. One Step Flash Calculation Theoretically. we can see that compositional simulation is much more complex than black-oil simulation. this procedure amounts to iterating out volume balance error while keeping exact mass balance. and they are quite different from each other. and exact flash is not required. This kind of development is time consuming. There is a lot of work involved in programming.

Then. etc (Chapter 2). Development of New Compositional Models Another purpose of this research is to develop new compositional models. including unstructured grid handling. linear equation solution techniques. large systems. The details of this General Formulation Approach are in Chapter 3. Our final goal is to find a way to minimize the computational time without sacrificing accuracy. These aspects are discussed in Chapter 5. differences between different models can be minimized. General Formulation Approach and Its Implementation in GPRS A General Formulation Approach will be developed. A new model using implicit pressure. A lot of advanced techniques will be implemented and tested in this simulator. Both variables of Type A and Type B should be available and the level of implicitness for each gridblock should be flexible (from 1 to number of components). A good design using a modular object-oriented approach is required. This will be achieved in four major steps: Design and Implementation of GPRS As mentioned earlier. and we can quickly change from one model to another model. Evaluation of Different Compositional Models The final step of this research is to evaluate the performance of different compositional models under different conditions. saturations and explicit component mole fractions (IMPSAT) is discussed in Chapter 4.3 Outline Of Research Steps The major focus of this research is to develop a general-purpose simulation framework with emphasis on simulator design and compositional simulation. multi-point flux calculation. This should lead to a consistent evaluation of the performance of different models. and this general approach should be capable of yielding any kind of model.derive any kind of model. highly heterogeneous systems. etc. during programming. network modeling. 25 . 1. a well-designed simulator can improve group productivity and help preserve work of different investigators. which include large number of components.

26 .

Chapter 2

Basic Aspects of GPRS
One of the objectives of GPRS is to build a general framework for research simulators, and allow a group of students to work with it and preserve the work of different investigators. In order to make this process easier, it is worthwhile to discuss the basic aspects of GPRS in detail, including gridding, formulation, flux calculation, well treatment, flash calculation, linear solvers, timestep control and reservoir initialization. Within GPRS, we intend to incorporate the most advanced simulation techniques developed in the last decade. So far, we have included unstructured grid, control volume formulation, network modeling, two-point and multi-point flux for unstructured grid, negative flash calculation, compositional well control, and advanced linear solver technology. In this chapter, we will discuss the basic aspects of GPRS, review the advanced techniques used in each part, and explain how these techniques are incorporated.

2.1 Gridding

Today, the trend in simulator development is to separate the gridding part from the flow calculation (simulator) part, and use the output from the gridding part as input for the simulator. The gridding part is normally done by a gridding software. Through this approach, one simulator should be able to couple with different gridding software, and each gridding software should be able to provide service for multiple simulators. Also, this approach can lower the development cost and increase flexibility for both the gridding part and the simulator part. However it is not very suitable for dynamic gridding, where the grid changes with time. Fortunately, dynamic gridding is rarely used in today’s reservoir simulators. This separated approach is partially adopted in GPRS, and GPRS can get its grid information in two ways:

27

Internal generation GPRS has a Cartesian grid module, which can generate all of the

necessary information for a Cartesian grid. A similar model for Radial grid may be added later. •
External read in For more advanced grids, such as unstructured grids, the grid

information is read from the output of a gridding software. Actually, this option is suitable for all kinds of grids, including Cartesian grid. Basically, GPRS is a reservoir simulator without much gridding capability, and unstructured grid simulations are supported by interfacing with other gridding software. In the petroleum industry, the available commercial gridding software includes FloGrid from Geoquest, GOCAD from the GOCAD group and GridPro from Program Development Corporation (PDC), etc. No matter which gridding software, they always share the following common functions: • Read information (location, size and physical properties) from a geological fine grid, read major geological features, such as faults (location, length, direction) and read well specification (trajectory, diameter and skin) • • Perform automatic gridding according to user input (grid type, dimension and other options), and generate simulation grid Perform automatic upscaling from the geological fine grid to the simulation grid, calculate the simulation grid properties, build connections between gridblocks and calculate well indices (the connection between wellbore and well block). Note that some gridding packages do not perform upscaling, such as GridPro. • Output all of the simulation grid properties and well information in a specific format, which can be read later by a simulator Normally, each gridding software is specially designed to serve several simulators, for example, FloGrid was initially designed to provide input for both ECLIPSE (Geoquest simulator) and FIRST! (MOBIL simulator). In order to do that, gridding software normally defines a specific output format for each served simulator. If the output file is a text file, it is possible to write an external program to read in and reformat the information and make it suitable for other simulators, such as GPRS.

28

In order to make the gridding software and the simulator work together, we have to define which information should be passed on from the gridding software to the simulator. The necessary information normally includes a list of cell properties, a list of connection properties, and a list of well data. On the other hand, the simulator should be able to handle the passed grid information, such as unstructured grid, multi-point flux. GPRS is designed to handle the most general grid type and grid connection data, and it should be able to interface with any gridding software. The gridding information that GPRS needs includes the following: • List of cell properties. For each cell, we need, • • • • • • • • • • • • • dimensions (DX, DY, DZ) (not necessary), depth, porosity, permeability (not necessary, included in the transmissibility and WI data), and volume.

List of connection properties. For each connection, we need, number of gridblocks for each connection (for two-point flux, it is always 2), gridblock index for each gridblock, and transmissibility constant for each gridblock.

List of well data. For each well, we need, number of gridblocks that this well penetrates, index for each gridblock penetrated by this well (well block), and well index (WI) for each well block.

The ordering of the cell list and connection list is quite important to the efficiency of a simulator, especially in the linear solver part. Considering a simple 4×1×1 case, Figure 2.1 shows two different cell orderings and the corresponding Jacobian matrix structures. In Figure 2.1a, ordering is from left to right, and the Jacobian Matrix has a tridiagonal structure. In Figure 2.1b, ordering is random, and the corresponding Jacobian matrix has a random structure, which makes it much more difficult to solve than the tridiagonal matrix. For structured grids, the best way to order is to order in the smallest dimension

29

first and order in the largest dimension last. But for unstructured grids, such as the one shown in Figure 2.2, it is not so easy to decide which kind of ordering is the best. In general, when we order the cell list of an unstructured grid, we wish to preserve as much structure information as possible, and generate a Jacobian matrix with the smallest possible bandwidth. The ordering of the connection list does not influence the structure of the Jacobian matrix, but still, in order to make the best cache utilization in flux calculations, it is best to roughly follow the ordering of the cell list.

1

2

3

4

4

1

3

2

X X

X X X X X X X X

X X X X X

X X X

X

X

a) left to right order
Figure 2.1

b) random order

Effect of gridblock ordering on structure of Jacobian matrix

Figure 2.2

An unstructured grid with faults and multilateral wells (FloGrid, 2000)

30

. Sukirman and Lewis.2. Control volume could be of any shape. control volume methods and finite difference methods produce the same discretized equations. finite difference methods have been used. like the one shown in Figure 2. Reservoir flow equations are a series of nonlinear equations. Finite element methods (Young. Traditionally. for most unstructured grids. injection is negative).3 A general polyhedron 31 . where a Jacobian matrix and a right hand side (RHS) are calculated at each Newton iteration. 1997). 1997.3. which are normally solved by the Newton-Raphson method. 1978. in recent years. with the development of unstructured grids. The mass accumulation in a control volume is equal to the flux (mass flowing in from its boundary) minus the production (mass produced from a well that maybe in the block. The control volume method is based on mass balance over a control volume. In the following several sections. it is a polyhedron. then we will show the general structure of the Jacobian matrix. more and more use is being made of control volume methods (Aavatsmark et al. Figure 2.. Fung et al. which make the handling of irregular shapes much easier. 1994) are another option. 1991. Verma and Aziz. The control volume formulation is used in GPRS.2 Control Volume Formulation and Structure of Jacobian Matrix There are different types of numerical methods for the discretization of reservoir flow equations. In case of Cartesian grids. we will discuss the calculation of each individual part of the Jacobian matrix. but they are not widely used in the petroleum industry. In this section we will first introduce the control volume compositional formulation (since compositional simulation is one of the major focuses of this research).

3) where. qW is the phase volumetric production rate from the well. 2. which can be written as Fluxc = ∑ Flux s . According to Darcy’s law. which can be written as p q W = WI W ⋅ λ p ( p p − p W ) p (2. we get the expression for the total flux: Fluxc = ∑ [Ts ∑ (λ p ρ p X cp ∆Φ p ) s ] s =1 p ns (2. 2. v p . By substituting Eqn. The rate of mass accumulation of component c can be expressed as φ n +1 ∑ ( S p ρ p X cp ) n +1 − φ n ∑ ( S p ρ p X cp ) n p p ACCc = V ∆t where.3 into Eqn.c s =1 ns (2.2. it is equal to v p .1) (2.6) where. 2.s is the phase volumetric flow rate across surface s. and ∆Φ p.2) Flux across surface s is calculated as Flux s . Ts the transmissibility constant across surface s. X cp is the mole fraction of component c in phase p.s = (Tλ p ∆Φ p ) s (2.7) 32 .4) where.c = ∑ ( v p ρ p X cp ) s p (2.4 and Eqn. and it has ns surfaces.5) The component mass produced from a well can be expressed as W Qc = ∑ ( ρ p X cp qW ) p p (2. s is the phase potential difference across surface s.The volume of this polyhedron is V. The total flux is the sum of the fluxes across each of its ns surfaces.

OffD_A and OffD_B. if there are more.1. the Jacobian matrix is calculated and stored separately for the reservoir part (accumulation and flux terms) and for the well part. a constant. depending on the implicitness of the model. Substituting Eqn. The structure of the reservoir part of the Jacobian is shown in Figure 2.n +1 s =1 p p ns (2. Using the Newton-Raphson method. 2. Normally there is only one well passing through a control volume.8. 2. OffD_A stores the derivative of equations of gridblock A with respect to variables of gridblock B. p p is the phase pressure of the well block and p W is the wellbore pressure for the well in the well block. and OffD_B records the sparse structure of the lower triangular part.6. 2. Diag. and it is later pieced together only in the linear solver module. the Jacobian matrix is generated by calculating the derivatives of Eqn. we get the final control volume compositional formulation: φ n +1 ∑ ( S p ρ p X cp ) n +1 − φ n ∑ ( S p ρ p X cp ) n p p V ∆t = {∑ [Ts ∑ (λ p ρ p X cp ∆Φ p ) s ] + WI W ⋅ ∑ [λ p ρ p X cp ( p p − p W )]}n . OffD_A records the sparse structure of the upper triangular part. 1978).9) Note that each of the terms in the flux part and the well part can be evaluated at either timestep n or timestep n+1. B) of the Jacobian matrix. we get W Qc = WI W ⋅ ∑ [λ p ρ p X cp ( p p − p W )] p (2.7 into Eqn. Diag is the diagonal part. For example. and the location of each entry follows the cell list.5 and Eqn. Eqn. and it is located at (A.8) Combining Eqn. each of its entries is for one gridblock. WI W is the well index (Peaceman. 2. all of the well fluxes are summed. Similarly OffD_B at (B. A) contains the derivatives of equations of gridblock B with 33 . In GPRS. Each of their entries is for one connection.4a. for a connection between gridblock A and B (A<B).9 with respect to all of the unknowns (variables). and the location of each entry follows the connection list. 2. Basically it consists of three arrays.where. 2.

we will discuss this in Section 2. RRJ. OffD_A and OffD_B will include more entries. for WRJ. for RWJ. RWJ. RWJ represents the derivatives of well terms in Eqn. it is a single value. Here besides the reservoir variables. and it only adds terms in the Diag array. Each entry in RRJ is normally a small dense matrix. RRJ represents the derivatives of well terms in Eqn. OffD_A Diag OffD_B RRJ RWJ WRJ a) reservoir Figure 2. each well may introduce an extra well variable.4b. which is normally the well bottom hole pressure (BHP). we can see that the well part of the Jacobian consists of four arrays. For multi-component system. and only have entries at the well blocks. an extra well equation is needed to complete the system. which are always located at the diagonal. and in that case. the accumulation part and the flux part are further separated. it is a column vector. it is a row vector and for WWJ. WRJ and WWJ represent the derivatives of this extra well equation with respect to the reservoir variables and the well variable respectively. and it contributes to all three arrays. such as wells under constant rate control. Additional wells introduce additional rows and columns. The general structure of the well part of the Jacobian for a single well is shown in Figure 2.9 with respect to the reservoir variables. 2. For Jacobian calculations of the reservoir part. 2. For multi-point flux. WRJ and WWJ. each of the entries in these arrays is a small dense matrix. the flux part loops through the connection list.9 with respect to the well variable.4b.4. The accumulation part loops through the cell list.respect to variables of gridblock A. This extra well variable is only necessary for some types of wells. From Figure 2.4 WWJ b) well General structure of the Jacobian matrix 34 .

and well 2 is completed in gridblocks 16.5 A simple unstructured grid with wells 35 .5. and same colored items are stored in the same array. 13 and 10.6 represents the storage. The grid is shown in Figure 2. where “A” represents a term generated by the accumulation part. The corresponding Jacobian matrix for this system is shown in Figure 2.In order to make the structure of the Jacobian matrix clearer.6. 1 4 5 8 11 12 15 2 6 9 10 3 7 13 16 17 14 Figure 2. a simple two-well example is included here. and “W” represented a term generated by the well part. “F” represents a term generated by the flux part. The color in Figure 2. Well 1 is completed in gridblocks 1 and 2.

5 36 .1 2 3 4 5 F F 6 F F 7 8 9 10 11 12 13 14 15 16 17 W1 W2 W W AFW F F 1 F AFW F 2 F AF 3 F AF 4 F F F 5 F F 6 F 7 F 8 9 10 11 12 13 14 15 16 17 W1 W W W2 F F F AF F F F F AF F F F F AF F F AF F F F F F AF F F F F AFW F AF F F F F F F F F F F F F AF F F F F AFW F F F F F AF F AF F F F F AFW F F F F AF W W W F F W W W W W Figure 2.6 Jacobian matrix structure for the system in Figure 2.

not gridblocks. This means that the flux is only a property of individual connections. 3 1. Furthermore.7. 4. local grid refinement may increase the number of connections. where the connections (fluxes) are associated with blocks.2. it is obvious that a positive flux into a given gridblock automatically implies a negative flux for the other connected block. also called network modeling. 4. 1991). 6 2. we have mentioned that there are two kinds of methods for grid representation. As a result. each gridblock may have different number of neighbors. each of the connections actually appears two times. but the number of connections for a gridblock may vary depending on the geometry of the gridblock. Sammon. In addition. In general. 4. 7 3.. we can see that the block based connection information is also redundant. 5. 6 Gridblock connection array when the block based approach is used The computation of flux terms is only necessary when pairs of gridblocks are connected. 1994).3 Network Modeling In Chapter 1. The number of connections is even higher if a nine-point scheme is used (Yanosik and McCracken.7 2 5 7 3 Block 1 2 3 4 5 6 7 Connections 2. the blockbased approach becomes very inconvenient for these cases.7 shows a simple example of the conventional gridblock tracking array. the block based approach and the connection based approach (Lim et al. The number of connections for each gridblock varies between two and four. So the key idea in the connection based approach is to focus on connections instead of gridblocks when 37 . 4. From Figure 2. Traditionally. 1979. An array keeping track of the connected gridblocks has to be dynamically dimensioned for each gridblock. Figure 2. 6 2. 7 5. 3. the block based approach has been used. (or dimensioned for the largest possible case). 1 4 6 Figure 2. as in the case for unstructured grids. 5 1.

This connection-based approach is very convenient for unstructured grids. in order to avoid redundancy. 6 9 5. 2 2 1. which can be calculated as i + ( j + k ⋅ n y ) ⋅ n x for structured grids.8 Connection array when the connection based approach is used The connection-based approach is used in GPRS. which is always one-dimensional. Once the connection array has been established. Connected pairs 1 1. a one-dimensional index (cell list) is used in GPRS.7 can be rearranged into a list of connection pairs. 7 1 4 6 2 5 7 3 Figure 2. since a connection is basically a line connecting two points. 7 10 6. where n x and n y are number of gridblocks in x and y directions. the computational algorithm in the accumulation part is exactly the same for any dimensional problem. the computation algorithm in the flux part is exactly the same for any dimensional problems. 5 8 4. gridblocks (cells) are represented by three-dimensional (i. the gridblock connections in Figure 2. we track the connections for the whole domain. The first gridblock index in a connection pair is always smaller than the second gridblock index. and the whole simulator becomes independent of the grid type and dimensions. instead of tracking the number of connections for each gridblock. k) indices. and the following modifications are made to make it more suitable for unstructured grid simulation and modeling of wells and surface facilities: • Add in cell list Traditionally.8. Connection No. 4 6 3. instead of that.computing flux terms. 4 4 2. Doing that. This 38 . shown in Figure 2. The first major task in the connection-based approach is to establish an array map or data structure containing all possible pairs of connections. As an example. 5 5 3. 3 3 2. 6 7 4. j.

The flux terms are added to the residual of the connected blocks. each have their own characteristics. But the reservoir. Hence the connection list in GPRS is only for the reservoir part. the connections are between two nodes. Flux FAB is from gridblock A to gridblock B. ∂X A 39 . the derivatives are added to the correct locations in the Jacobian matrix. This approach also makes the algorithm clearer and easier to understand. which is the most general connection based approach. • Reservoir only connection list In Lim et al.approach also saves some memory by reducing a three-dimensional indexing array to a one-dimensional indexing array. calculate the upstream direction for each phase and evaluate the flux terms and their derivatives for each connection. and the derivatives are assigned to the diagonal of the Jacobian matrix at the corresponding gridblocks. 2. and FA and FB are the ∂FAB ∂F ∂FAB equations at gridblock A and B. the well part and the surface facility part are treated separately. and is ∂X A ∂X B ∂X B ∂F stored in OffD_A. a well node (wellbore) or a surface node (surface facility).AB are stored in Diag.9 for a two-point flux calculation. each node can be a reservoir node (gridblock). and this structure can be used later by the linear solver to improve its efficiency. (1994). and evaluate the accumulation terms and their derivatives for each gridblock. This leads to different kinds of calculations and different kinds of structures in the Jacobian matrix for each part of the system. The accumulation terms are assigned to the residual. and .AB is stored in OffD_B. The procedure for the reservoir part of the Jacobian matrix and residual calculation using this modified connection based approach is as follows: 1. as shown in Figure 2. loop through the connection list. loop through the cell list. Next. First. the well and the surface facilities. The advantage is that the structure of the Jacobian matrix is preserved. XA and XB are the variables at gridblock A and B. and . one is positive and the other is negative.

computers are becoming more powerful. and new techniques (e.g. then we will show the algorithm used for multi point flux calculations.. Edwards. more and more simulations are using non-orthogonal grids and full tensor permeabilities. 1996) are necessary. At the same time. a connection between two gridblocks only depends on these two gridblocks. upstream direction calculation and Jacobian matrix structure.9 Jacobian structure for two-point flux derivatives 2. which means that there is flow (connection) between gridblocks A and B and the transmissibility constant for this connection is T. p = T AB (λ p ρ p X cp ) A|B (Φ p . Twopoint flux can be calculated as Flux _ 2 Pc . The connection-based approach was originally proposed for two-point flux. multi-point flux approximations (Gunasekera et al. int B. Two-point flux and multi-point flux are different in three areas: representation. Verma and Aziz. each connection can be represented in C++ by “int A.4 Multi-Point Flux Representation and Implementation In the last decade.Jacobian XA A FAB FB − ∂FAB ∂X A − RHS XB B FA ∂FAB ∂X A ∂FAB ∂X B ∂FAB ∂X B − FAB FAB Figure 2. We generalize it to multi-point flux. with the development of unstructured grids and upscaling methods. first we will compare the differences between two-point flux and multi-point flux calculations. In this section. 1998) are being developed to reduce the cost of multi-point flux simulation. both of them make multi-point flux approximation more practical. A ) (2.10) 40 . double T”. generally. 1998. For these kinds of simulations. B − Φ p . • Representation In two-point flux.

and λ p ρ p X cp is evaluated as 41 . the transmissibility constants should satisfy np −1 l =0 ∑ T [l ] = 0 (2. and the transmissibility constant assigned to each gridblock is T[0]. 2. we notice that they are quite similar. A[1] … A[np-1]. np is fixed. a connection between two gridblocks may depend on np (>=2) gridblocks. then Eqn.13) Each individual term in the summation of Eqn. 2. and there is no upper limit to it.But in multi-point flux. This is because two-point flux is just a special case of multi-point flux.10 and Eqn. 2. and T[1] as T.10. • Upstream direction calculation In Eqn.12) Using Eqn.10. 1996).13 reduces to Eqn. A[l ] ) l =0 np −1 (2. p = (λ p ρ p X cp ) A[ 0 ]| A[1] ∑ (T [l ] ⋅ (Φ p . But for unstructured grids. the phase upstream direction is solely determined by the phase potential difference. T[1] … T[np-1]. double *T” in GPRS. A[ l ] − Φ p . in order to guarantee that. such as np=6 for two-dimensional Cartesian grid and np=18 for three-dimensional Cartesian grid (Verma. 2. which are A[0].13 is called a sub-connection. and we define A[0] as A. A[ 0] )) l =1 np −1 (2.11. 2. it is not fixed. 2. 2. which means that there is a connection between gridblocks A[0] and A[1]. A multi-point unstructured connection is represented by “int np. A[1] as B. Multi-point flux can be calculated as Flux _ MPc . and its flux depends on np gridblocks.13 with Eqn. where each connection only has one sub-connection. p = (λ p ρ p X cp ) A[ 0]| A[1] ∑ (T [l ] ⋅Φ p . λ p ρ p X cp should be evaluated using conditions in the upstream block for each connection and for each phase. int *A. For structured grids. In two-point flux. 2.13. Comparing Eqn. If np=2.12 to remove T[0] from Eqn. 2. we can get Flux _ MPc .11) There is no flow through a connection when phase potentials are equal.

For each connection. 2.15) )≥0 np −1 ∑ (T [l ] ⋅ Φ p . Flux FAB is from gridblock A to gridblock B. B and C. This is done by looping through the connection list. and λ p ρ p X cp is evaluated as  (λ p ρ p X cp ) A[ 0] . The flux terms are added to the residual of the connected blocks (A[0] or A[1]). next we will show the reservoir part of the Jacobian matrix and residual calculation for the multi-point flux approximation.  (λ p ρ p X cp ) A| B =  (λ p ρ p X cp ) B .B − Φ p. then loop through its sub-connections and evaluate the flux terms and their derivatives for each subconnection.B − Φ p. A < 0 Φ p. one is positive and the other is negative. we first calculate the phase upstream directions.10 for a multi-point flux calculation. A[ 0] )) .  if if Φ p.14 if there are only two points (T[1] is always positive for flux between A[1] and A[0]). 2. the structure of the Jacobian matrix becomes more complicated with more non-zero terms. λ p ρ p X cp can only take the value at gridblock A[0] or A[1]. as shown in Figure 2. and one of its sub-connections is related to gridblock C.  p p cp A[1]  np −1 if if (λ p ρ p X cp ) A[ 0 ]| A[1] ∑ (T [l ] ⋅ Φ l =0 l =0 p . XA. For structured grids. and from 7 to 27 in three dimension. the derivatives are added to the correct locations in the Jacobian matrix.14) In multi-point flux. • Jacobian matrix structure If a multi-point flux approximation is used. not the other gridblocks. and the computational cost will be much higher. For unstructured grids. A[ l ] Note. A[ l ] )<0 (2. bands for the Jacobian matrix will increase from 5 to 9 in two dimension. We have reviewed the differences between two-point flux and multi-point flux. XB and XC are the variables at gridblock A. Eqn. A ≥ 0 np −1 l =0 (2. the phase upstream direction is determined by np −1 ∑ (T [l ] ⋅ Φ p . A[ l ] ) or ∑ (T [l ] ⋅ (Φ l =1 p . FA and 42 .(λ p ρ p X cp ) A .15 can be reduced to Eqn. A[ l ] − Φ p . we will have many more off diagonal terms in the Jacobian matrix.  = (λ ρ X ) .

AB are stored in Diag. and . WRJ and WWJ are the derivatives of the extra well equation with respect to the reservoir variables and the well variable respectively. From Section 2. Note. we know that the well part of the Jacobian includes four arrays.FB are the equations at gridblock A and B. Well equations used in GPRS for the black-oil and the compositional models will be presented next. it can be directly added to the reservoir part of the 43 . Jacobian XA C FA A FAB B FB − ∂FAB ∂X A − ∂FAB ∂X A RHS XC ∂FAB ∂X C XB ∂FAB ∂X B ∂FAB ∂X B − FAB − ∂FAB ∂X C FAB Figure 2.AB and . RRJ and RWJ are the derivatives of well terms in flow equations with respect to the reservoir variables and the well variable respectively.2. RRJ always exists.10 Jacobian structure for multi-point flux derivatives 2.5 Well Treatment We have discussed how the reservoir part of the Jacobian matrix and RHS are calculated in GPRS. in ∂X A ∂X C the multi-point flux calculations. and ∂FAB ∂X C ∂FAB ∂F ∂FAB and . WRJ and WWJ depends on well control. then we will discuss when an extra well equation and a corresponding well variable are needed. RWJ. while the existence of RWJ. After it is calculated. In this section. now we will discuss the well part.AB are stored in OffD_B. WRJ and WWJ. ∂X A ∂X B ∂X B ∂F ∂F are stored in OffD_A. RRJ is always needed. and it is a block diagonal matrix with only non-zero terms at the well blocks. and OffD_A is no longer strictly upper triangular and OffD_B is no longer strictly lower triangular. the number of entries in OffD_A and OffD_B equals the total number of sub-connections. RRJ. we will first discuss the calculation of RRJ.

1990) ρ W i ∑(ρ q = ∑q p p p W p )i (2. WI W is the well index. The existence of RWJ.16) Here the reference depth is defined at the first well block.7.8) where.17) W p .i qW. the well equation was written as W Qc = WI W ⋅ ∑ [λ p ρ p X cp ( p p − p W )] p (2. we can easily W see that. well term will only depend on the reservoir variables. Combining Eqn. 2. which can be calculated as (Nolen. WRJ and WWJ depends on whether we need an extra well W equation and well variable. 2. 44 . Eqn. which is p calculated from Eqn. Eqn. and use the following relation to calculate the wellbore pressure at well block i: piW = piW1 + ( ρ iW1 + ρ iW ) g ( Di − Di −1 ) − − = piW 2 + ( ρ iW2 + ρ iW1 ) g ( Di −1 − Di −2 ) + ( ρ iW1 + ρ iW ) g ( Di − Di −1 ) − − − − = W = p0 + g ∑ ( ρ lW1 + ρ lW )( Dl − Dl −1 ) − l =1 i (2. We assume variable gradient and no friction in GPRS. In Section 2. and there is no need for WRJ and WWJ. and the wellbore pressure at W this depth ( p0 ) is normally called the well bottom hole pressure (BHP). For a BHP controlled well.8 only depends on the reservoir variables. the well bottom hole pressure will be the extra well variable.17. If needed. p p is the phase pressure of the well block and pW is the wellbore pressure.8 with respect to the reservoir variables for a fixed well bottom hole pressure. 2.i is the phase volumetric production rate of this well at well block i.16 and Eqn. 2. If this well has multiple perforations. we need to relate pW to the pressure at a reference depth. ρ iW is the total fluid density within the wellbore at well block i.Jacobian without introducing any extra non-zero terms. if the well bottom hole pressure p0 is fixed. where p0 is fixed. RWJ is zero.2. 2. RRJ is the derivatives of Eqn.8. 2.

and the well could have multiple perforations.11. BHP control and constant phase volumetric flow rate (at standard conditions) control. An extra well equation and variable are needed for constant phase flow rate controlled wells. such as constant phase volumetric flow rate control (at well head or well bottom).RRJ by itself is already complete. we have the extra well variable. 2. and we need an extra well equation to complete the system. the extra well equation is different for black-oil and compositional models. Currently. only two types of well controls are implemented in GPRS. and both of them are based on component mass balance within the well bore. The well equation depends on both the desired control at the well and the fluid model (black-oil or compositional). Well head Well bottom Figure 2. Here we only review the well equations used in GPRS. For other types of well controls. As shown in Figure 2. there is flow from the well bottom to the well head. The extra well variable is always the well bottom hole pressure.7. the well phase production rates can be explicitly calculated from Eqn. the BHP of a well is not fixed. After we solved for the reservoir variables.11 Wellbore flow 45 .

For black-oil models.20) WH where.l X c.l ρ p.18) WH where. 2. the component mass flow rate at the well bottom (summation for all well blocks) should be equal to the component mass flow rate at the well head. which can be expressed as WH WH WH WH WH Qo = Qo = ρ o qo = ρ o . Qc is the mass flow rate of component c at the well head. we get ∑∑WI l λ p . using a constant oil phase flow rate controlled well as an example.19) Substituting Eqn.Assuming steady state flow in the well. Here.19 and rearranging. and ρ o . and the component mass flow rate should equal the phase mass flow rate. which is an input property. Since the extra well equation is different for black-oil model and compositional model. • Black-oil model Components in black-oil systems are defined as phases at standard conditions (well head). p . For constant oil phase flow rate. Eqn. we will use a superscript “-“ to indicate components whenever necessary. At the well head. which can be expressed as ∑∑WI l λ p. we have the following relation for the oil phase mass flow rate: WH SP l SP ⋅ ∑ Qc = ρ oSP ⋅ qo (2. well head is actually a separator which operates at standard conditions.21) c 46 . 2.20 is the extra well equation used in GPRS. qo is the fixed oil phase volumetric flow rate at the well head.18 into Eqn. • Compositional model Things become a bit more complicated for the compositional model.l ( p p. black-oil components and phases are equivalent to each other.SC ⋅ qo (2.l X o . WH The input to this separator is the total mass flow from the well (summation of Qc over all c). 2. the output is the individual phase flow at standard conditions.l ρ p. p.l − plW ) = QcWH l p (2. In order to avoid confusion between components and phases. they are discussed separately.l − plW ) l p WH − qo = 0 ρ o .l ( p p.SC is the oil component density at the standard condition.SC (2.

Substituting Eqn. 2.18 into Eqn. 2.21 and rearranging, we get l SP SP WI l λ p ,l ρ p ,l ( p p ,l − plW ) ⋅ ( SP ) − qo = 0 ∑∑
l p

ρo

(2.22)

SP where, qo is the fixed oil phase volumetric flow rate (output of the separator), and

ρ oSP is the oil phase density at the separator, and l SP is the hydrocarbon liquid (oil)
mole fraction at the separator. To get ρ oSP and l SP , the overall hydrocarbon component mole fractions at the separator are first calculated as
WH z c = Qc / ∑ QiWH i =1 nh

(2.23)

then a flash calculation is performed at standard condition and fixed z c . For compositional models, Eqn. 2.22 is the extra well equation used in GPRS.

Water component is fully separated from the hydrocarbon components in GPRS. So, for fixed water flow rate controlled wells, the extra well equation is always ∑WI l λ w,l ρ w,l ( p p,l − plW ) WH l − qW = 0

ρ w, SC

(2.24)

For injectors, each phase mobility is replaced by the total mobility or the injected phase volume fraction weighted phase mobility (Almehaideb and Aziz, 1989; Nolen, 1990; Coats et al., 1998). In GPRS, for multiphase injection the mobility of the injected fluid is calculated as the volume fraction ( E p ) of that fluid multiplying the total mobility of fluid in the injector block (Almehaideb and Aziz, 1989), which can be written as λinj = E p ∑ λ p (2.25) p
p

The component mass balance within the wellbore is only for the injected components, and the total mass flow rate is only the summation over the injected components, correspondingly RRJ and RWJ are only calculated for the flow equations of the injected components.

47

Sometimes, after the reservoir part of the Jacobian and the well part of the Jacobian have been combined, RWJ can be eliminated without introducing any extra terms, such as for single block wells with constant rate control. With this, we can solve for the reservoir variables first and explicitly update the well variable later. The details of this operation are shown in Section 3.2. For multi-block wells with constant rate control, RWJ can also be eliminated, but it will introduce some extra non-zero terms in RRJ. For this reason, it is preferable not to perform elimination on RWJ for this kind of wells.

2.6 Flash Calculation and Treatment of Phase Disappearance and Reappearance

Flash calculations are necessary in compositional simulation, and for this we need to select an equation of state and phase equilibrium relations. In this section, first we will discuss the equation of state and phase equilibrium relations used in GPRS, then we will discuss the two different roles that flash calculations play in GPRS, finally we will show the treatment of phase disappearance and reappearance in GPRS. The Cubic equation of state used in GPRS can be written as (e.g., Nghiem et al., 1983; Walas, 1985) Z 3 + sZ 2 + qZ + r = 0
s = (u − 1) B − 1  where, q = A + ( w − u ) B 2 − uB r = − AB − wB 2 − wB 3 

(2.26)

Parameters u and w depend on the cubic equation of state selected. For the PengRobinson EOS (Peng and Robinson, 1976), u=2 and w=-1. Z is the phase compressibility factor, which is one of the three roots of Eqn. 2.26. For the oil phase, the minimum real root is used, and for the gas phase, the maximum real root is used.

At phase equilibrium, we have the following relation:
f c ,o = f c , g ,

c = 1,…, nh

(2.27)

where, f c ,o and f c , g are the fugacities of component c in the oil and gas phases. For the Cubic equation of state they are calculated as (Walas, 1985)

48

f c , p = pX c , p e Φ c , bc ( Z − 1) − ln( Z − B ) b

p = o or g,

(2.28)

Φc =

b 1 ∂a 2 Z + B (u + u 2 − 4 w ) − ( c − ) ln[ ] 2 Z + B (u − u 2 − 4 w ) B u 2 − 4 w b a ∂X c , p A
nh nh  a = ∑∑ X i , p X j , p (1 − k i , j ) ai a j   j =1 i =1 where,  nh b = ∑ X c, p bc   c =1

(2.29)

and

 A =   B =  

ap R 2T 2 bp RT

(2.30)

Appendix C defines all parameters and provides the formulas and derivatives used for flash calculations. Eqn. 2.27 is used in two ways in GPRS, as a constraint equation to relate the secondary variables to the primary variables and as a separate flash routine to check the state of hydrocarbon phase in a block. These two tasks are discussed next. •
As a constraint equation Flow equations are the primary equations, they depend on

both the primary variables and the secondary variables. To form a complete system, we need some constraint equations to remove the secondary variables from the primary equations. Phase equilibrium relations (Eqn. 2.27) are our secondary equations, which also depend on both the primary variables and the secondary variables. They can be used as the constraint equations to build relations between the secondary variables and the primary variables. This role for flash calculations is only necessary when both hydrocarbon phases exist in a gridblock. For gridblocks with only one hydrocarbon phase, half of the phase variables disappear, and the primary equations depend only on the primary variables. For example, for a gridblock with only gas and water phases, the mass balance equations will only depend on p , S g and y c , c = 1, …, nh − 1 . When this is the case, there is no need for constraint equations. •
As a separate flash routine For gridblocks with only one hydrocarbon phase, the

primary equations depend only on the primary variables, and there are no need of

49

secondary equations. But sometimes, a single hydrocarbon phase can change back to both hydrocarbon phases, and the secondary equations are needed again. So we need to monitor the state of hydrocarbon phases when a gridblock has only one hydrocarbon phase. This is done by a separate flash routine. A simple successive substitution flash routine is used in GPRS, which is similar to the one shown in Subsection 1.2.2. To speed up the convergence, the values of K c and l at the old Newton iteration are used for the initial guess.

From the above discussion, we can see that flash calculations play different roles under different situations. In order to distinguish these situations, we need to detect the disappearance and reappearance of hydrocarbon phases. For models using the natural variables (variable Type A), treatment of phase disappearance and reappearance is also needed for choosing the correct phase variables. Phase disappearance and reappearance are detected in GPRS and treated as described below: •
Phase disappearance When a gridblock has two hydrocarbon phases, for each

Newton iteration, we check the saturation solutions. If either So or Sg is negative, the corresponding hydrocarbon phase has disappeared. In this case, before initialing the next Newton iteration, we first set the negative saturation to zero, then assign the overall hydrocarbon component mole fractions ( z c ) to component mole fractions in the oil or gas phases ( xc and y c ), finally mark this gridblock as a single hydrocarbon phase gridblock. •
Phase reappearance When a gridblock has only one hydrocarbon phase, at the end

of each Newton iteration, we do a negative flash (Whitson and Michelson, 1986), pressure and overall hydrocarbon component mole fractions are the inputs. If l is between 0 and 1, then both hydrocarbon phases exist, and before initializing the next Newton iteration, we first assign the hydrocarbon phase saturations as 1 − Sw So = ρ 1 1 + ( − 1) o l ρg
S g = 1 − So − S w

(2.31)

(2.32)

50

1983). we can also develop and use our own solvers. both are quite slow and memory consuming. 1985). and it could account for up to 30% of the total running time. The following preconditioners are included in GPRS. and a more robust and efficient flash routine is needed. For iterative solvers.g. 1998). and creates a separate linear solver module. which is a commercial linear solver package from Landmark Graphics Corporation. The direct solvers included are a full matrix solver and a band matrix solver. c) Incomplete LU decomposition (ILU0) (e. d) Algebraic Multi-Grid (AMG) (Stueben. 2. such as BlitzPak (Landmark. The performance of iterative solvers depends on the robustness of the preconditioners. which is our best preconditioner. For large problems.. preconditioners are used to speed up the convergence. and e) Constrained Pressure Residual (CPR) (Wallis et al. The flash routine used in GPRS is quite simple. and can only be used for small systems. 1983). the Jacobian matrix is calculated and stored separately for the reservoir part and for the well part. BlitzPak is only suitable for structured grids. which is suitable for any sparse matrix system. and it is later pieced together only in the linear solver part. which is only suitable for the pressure system. 1986) solver. we use a Generalized Minimum Residual (GMRES) (Saad and Schultz. where the 51 .then set component mole fractions in the oil and gas phases ( xc and y c ) from the results of flash calculation. For iterative solvers. Behie and Forsyth. Both direct and iterative solvers are used in GPRS. ordered according to their robustness: a) diagonal scaling. flash calculation is a very important part. In compositional simulations. This approach basically separates the solving of the linear system from the building of the linear system. In this way we can easily interface with available linear solvers. b) block diagonal scaling. GPRS also has an interface to BlitzPak.7 Linear Solver In GPRS. finally mark this gridblock as a both hydrocarbon phase gridblock. All we need to do is to transform the Jacobian structure of GPRS into the specific format that a linear solver requires. iterative solvers are memory efficient and much faster than direct solvers.

to get the full solutions for the reduced residual.Jacobian matrix has up to 7 bands. CPR is a two stage preconditioner.12 Performance comparison between GPRS solver and BlitzPak 52 . and CPR preconditioned GMRES is the best for unstructured grids.0824 time (sec) 1 0.E+05 1. For GPRS.E+04 1. 100 GPRS BlitzPak Trend (BlitzPak) 10 Trend (GPRS) y = 8E-06x1.E+06 number of unknowns Figure 2. CPR performs very well for all kinds of problems. while GMRES (Saad and Schultz. The final solution is the first stage pressure solutions plus the second stage full solutions. BlitzPak is the fastest for structured grids. and use a local preconditioner. and solve for pressure from the pressure part (AMG preconditioned GMRES is used for the pressure solve). such as ILU0. and it is also the best preconditioner in GPRS. including problems that are hard for IMPES. 1986) in GPRS is suitable for any grid and any sparse matrix system. CPR is more suitable for fully implicit systems. In the first stage we decouple the full system into a pressure part and a saturation part using an IMPES-like decoupling process. In the second stage we start from the reduced residual and work on the remaining decoupled system. only CPR is specially designed for reservoir simulation equations.1 1. then we use the pressure solutions to reduce the residual of the full system.1552 y = 3E-05x1. For the preconditioners used in GPRS.E+03 1.

the power is about 1.15. In the solver part of GPRS. for large models. which is the best we can get for a linear solver. But. most of the gridblocks are IMPES. for BlitzPak. only a small number of gridblock are fully implicit. Anyway. a sparse matrix package. and AMG is from GMD software (Ritzdorf. Currently. The results are shown in Figure 2. most of the components are from different public domain software. we provide the trendlines using power relations. GMRES is from Iterative Math Library (IML) (Dongarra et al. 1999). Considering that the GPRS solver is suitable for any grid system and any sparse matrix. 1996).Here we compare the performance of CPR preconditioned GMRES (GPRS solver) with the performance of BlitzPak on different size problems. such as AIM. 4 component compositional problem. This difference is due to the following two reasons: first GMRES in GPRS does not make use of the 7 band structure of the Jacobian matrix. In Figure 2. while the whole system is only a little bit larger than the pressure system). for an adaptive implicit system. For unstructured grids.12. and AMG is only suitable for the pressure system. More works is needed to develop suitable solvers for AIM method. For the GPRS solver. such as the direct solvers are from LAPACK (Anderson. The problem is solved fully implicitly. The solvers and preconditioners in GPRS are appropriate for fully implicit and IMPES systems (CPR is used to precondition the fully implicit system.. we can conclude that the solver in GPRS is reasonably efficient and robust. The constant for the GPRS solver (3E-5) is larger than that for BlitzPak (8E-6). there is no reordering done to the cell list in GPRS.. and AMG is used to precondition the IMPES system). GPRS solver only takes about 50% more time than BlitzPak. as shown in Section 2. the ordering of the cell list is quite important for the efficiency of linear solvers. 1996).08.12. CPR loses its efficiency (spends too much time on the pressure solve at the first stage. second the components of the GPRS solver are from public domain software. 53 . which may not be very efficient.1. ILU0 is from SparseLib++ (Pozo et al. We use a Cartesian grid. the power is about 1. Additional work is needed to develop good ordering methods for the cell list. The costs of both solvers are roughly linear with the number of unknowns. 1991).

Section 3. In GPRS. Typical values of η used in GPRS are: η p = 200 Psia .33 and Eqn. But in practice.8 Timestep Control and Reservoir Initialization Fully implicit models are unconditionally stable. 1979):  (1 + ω )ηi  ∆t n +1 = ∆t n    δ i + ωη i  min over i (2.02 for component mole fractions The timestep sizes of fully implicit models are decided solely by Eqn. in order to control the number of Newton iterations for each timestep.34.33) The increasing or decreasing of timestep size from timestep n to timestep n+1 is governed by the following relation (Aziz and Settari. saturations and component mole fractions). 2. For models that are not fully implicit. The timestep sizes of partially implicit models are governed not only by Eqn. 2. Normally ηi and δ i have different values for different variables. the 54 . and the timestep sizes for all models must satisfy Eqn. η X = 0.2 . so a different ∆t n +1 is calculated for each variable and the minimum of all ∆t n +1 is used for the next timestep. their maximum timestep sizes are limited by their stability.33 and Eqn.2. a maximum timestep size ∆t MAX and a minimum timestep size ∆t MIN are specified by the user. At the start of simulation. for pressure for saturations η S = 0. 2.34. δ i is the change over ∆t n and ω is a tuning factor with a value between 0 and 1.3 derives all of the stability criteria used in GPRS. and we can have a timestep of any size.34) where i refers to the gridblock number. a reasonable timestep size is required. such as IMPES. ηi is the specified desired change. 2. but also by their stability criteria. 2. we need to assign initial values to reservoir variables (pressure.33 at all times: ∆t MIN ≤ ∆t ≤ ∆t MAX (2. For black-oil models.

the following procedure is used: 1. Assign the same initial pressures (pressure at a reference depth) to all gridblocks. Assign initial overall compositions z c for all gridblocks. xc and y c for all gridblocks.35) (2. step 4-6 are repeated to achieve better initial equilibrium. and the hydrocarbon liquid mole fraction l are calculated for each gridblock. temperature and overall compositions z c for each gridblock. assign 1. Reassign initial pressures for all gridblock according to depth: pi = p 0 + ∑ ( ρ p S p ) i g ( Di − D 0 ) p (2. The resulting xc and y c are assigned to each gridblock. 3. 4. 5. depth table. Otherwise the initial condition will be far from equilibrium. Initial overall compositions are inputted as an overall composition vs. If a gridblock is below the water-oil contact (WOC). 55 . and a table look up is performed for each gridblock to decide its initial overall compositions. the calculated initial equilibrium is good. Assign initial water saturations for all gridblocks. and it guarantees initial equilibrium of reservoir fluids.37) where p 0 is the pressure at reference depth D 0 . 2. Assign initial component mole fractions in the oil and gas phases.procedure mentioned in Aziz (1996) is used. such as for the case when the same initial overall composition is used for all depths. otherwise assign connate water saturation. If the initial overall composition vs. ρ o and ρ g . Assign initial oil and gas saturations for all gridblock as 1 − Sw So = ρ 1 1 + ( − 1) o l ρg S g = 1 − So − S w (2.36) 6. A flash calculation is performed at constant pressure. the oil and gas phase densities. If necessary. depth table reflects real conditions in the reservoir. For compositional models. The effect of capillary pressure is ignored in this procedure. At the same time.

56 .

we have only explored its application to isothermal compositional models. this thermodynamic state is determined by nc variables. which can be used to derive any kind of model (different equation and variable selections and different implicit levels). • There is no need to solve all of the coupled equations together. direct solution of this large system (full set of equations and variables) is almost impossible. This General Formulation Approach also enables us to develop and try out new models. For compositional models. it is worthwhile to first review some of the important points about compositional simulation discussed in Chapter 1: • Reservoir simulation involves a large number of coupled nonlinear equations. a new General Formulation Approach is developed. quickly change from one model to another model. such as thermal simulators. and evaluate their performance in a consistent manner. and it is also suitable for other types of simulators. we can minimize differences among different models. In this study. Complexity of the mathematical model increases dramatically from black-oil to compositional models.Chapter 3 General Formulation Approach One of the objectives of this research is to evaluate the performance of different isothermal compositional models. This new approach is designed to solve a general nonlinear equation set. For isothermal compositional system. or the number of components in the system. due to the high computational and memory requirements. In order to make the implementation of these models easy and consistent. By solving for this minimum number of variables first (fully implicit 57 . there is a minimum number of independent variables and equations (primary variables and equations) that determine the thermodynamic state (intensive and extensive) of the system. For each type of simulation. With this approach. To better understand the steps involved in this General Formulation Approach.

then reduce the implicit level of the primary set to further speed up the simulation if necessary. such models are much faster than FIM models. GPRS uses the natural variables as its basic full set of variables to 58 . as shown in Figure 3.1. In Chapter 1. Even so. first reduce them to the primary set (minimum number). and reduce the number of implicit unknowns per gridblock. To further reduce the cost of simulation.1 Reduction process from full set to implicit primary set In general. There are numerical techniques to reduce or switch the balance errors (Coats et al. However. we should start with the full set of equations and variables. • In fully implicit (FIM) models all of the primary variables are treated implicitly.. we can save a large amount of computational time. the full set of equations are always the mass balance equations and the phase equilibrium relations. such as less than one day. if the maximum allowable timestep size is too small. Implicit Primary Set Explicit Full Set of Variables and Equations Secondary Set Figure 3. especially for problems with large number of components. This two step reduction process is included in the General Formulation Approach. 1998). we already pointed out that. but we cannot totally remove them. The full set of equations and variables are the starting point for this approach. explicit treatment of some primary variables will limit the maximum timestep size.models). Normally. Explicit treatment of some primary variables may also cause some balance errors (mass or volume). this approach is still too expensive for large problems. but the selection of the full set of variables is not unique. such models could be even slower than FIM models. we can treat some primary variables explicitly.

which can be expressed as F(X ) = 0 (3. First. This is actually the first step of the General Formulation Approach. such as the AIM model (Forsyth and Sammon. If other sets of variables are needed. subscript p stands for primary.facilitate the calculation of derivatives. These three steps are performed gridblock by gridblock. X s ) = 0  (3. we reduce the full set to the primary set. This full set of equations and variables can be split into a primary part and a secondary part:  Fp ( X p . 1986). and X is the full set of variables. Finally. then use the chain rule to switch from the natural variables to the new variables. we control the variables used. and subscript s stands for secondary. Next we will do some stability analysis for the explicit treatment of some primary variables. Finally we will discuss the consequences of using different kinds of equations and variables. This provides a natural way to form adaptive implicit schemes.2) where. we base it on the most general nonlinear equation set. X s ) = 0    Fs ( X p . In summary. we define a base model which uses the natural variables.1) where F is the full set of equations. if necessary we further reduce the implicit level of the primary set. Through these three steps. and the implicitness of each variable. we will first take a look at the general nonlinear equation set that forms the basis of this approach. Then. In this chapter. 59 . Then we will explain the operations involved in each of the above three steps. and build other models from this base model by variable switching. this General Formulation Approach includes three steps. 3. such as Type B variables.1 The General Nonlinear Equation Set In order to make this approach suitable for any kinds of simulations. we first build explicit relations between the new variables and the natural variables. and build the FIM model. so each gridblock can have different variables and different implicit levels.

2 Structure of the full set of Jacobian matrix and RHS Here we define the following matrices: A= ∂Fp ∂X p . B1 D1 Jacobian …. D= s . Combining the Jacobian matrix of Fp and Fs .3) and vectors: M = − Fp . RRJ.. here we have a reservoir Jacobian and a well Jacobian. diagonal A1 C1 ….C= ∂F ∂Fs ..6. we select the phase equilibrium relations (a series of nonlinear constraint equations) for it.4 and Figure 2.2... and normally RRJ is added to the diagonal part of the reservoir Jacobian.. The well Jacobian includes four arrays. A2 C2 B2 D2 AWW M2 N2 MWW Figure 3.... B= ∂Fp ∂X s . N = − Fs .. we have the Jacobian matrix for the full set of equations and variables. The reservoir Jacobian has both diagonal terms and off-diagonal terms.Fp = 0 is the primary equation set. WRJ and WWJ. and we always select the mass balance equations for it. Its Jacobian matrix structure (derivatives of the mass balance equations with respect to the full set of variables) looks like the one shown in Figure 2. which is shown in Figure 3. its Jacobian matrix will be a block-diagonal matrix. A12 0 …. B12 0 ARW 0 RHS M1 N1 …. RWJ.. A21 0 AWR B21 0 BWR …. Since it only depends on individual gridblocks. ∂X p ∂X s (3. (3. Fs = 0 is the secondary equation set.4) 60 .

2.8) This full set of equations is used for all of the isothermal compositional models. we can replace one of the hydrocarbon component mass balance equations by a total hydrocarbon mass balance equation: ∂ Fh . D and N are generated by the secondary equations. nh Fw . 61 . we perform operations on this full set Jacobian matrix.where A. Each matrix or vector has its own storage array. and the storage for matrices A and B is further separated into three parts (Diag.i ∂t l (3.o − f c .i = W + ∑ ( ρ o xc qo + ρ g y c qW ) i = 0 g W ∂ [Vφ ( So ρ o xc + S g ρ g yc )]i − ∑ [T (λo ρ o xc ∆Φ o + λg ρ g yc ∆Φ g )]l . then Fp = 0 will be the mass balance equations for each hydrocarbon component and for water: Fc . and C. c = 1. In this General Formulation Approach. This General Formulation Approach is applied to isothermal compositional models in GPRS.i = ∂ (VφS w ρ w ) i − ∑ (Tλw ρ w ∆Φ w ) l .i ∂t l W + ∑ ( ρ o qo + ρ g qW ) i = 0 g W (3. All of the operations are done locally.7) Fs = 0 will be the phase equilibrium relations: Fe = f c .6) Optionally. eliminate terms to zero level by level.….5) c = 1. g = 0 .i = [Vφ ( So ρ o + S g ρ g )]i − ∑ [T ( λo ρ o ∆Φ o + λg ρ g ∆Φ g )]l . We assume that the hydrocarbon components and water are totally separated. B and M are generated by the primary equations. nh (3. no additional storage is required. and finally extract a minimum set for the linear solver. OffD_A and OffD_B) as shown in Section 2.….i + ∑ ( ρ w qW ) i = 0 w ∂t l W (3.

Note that RRJ of the well Jacobian is already added to the diagonal part of the reservoir Jacobian. So far. For thermal models. are chosen to be p = pg .The basic full set of variables. 3. xc . and X p will include temperature or internal energy. which is also the starting point for the General Formulation Approach. 2. a switch from the natural variables to the new variables is required. Fp will include the energy balance equation. so it will not appear in the following discussion. Here we have a total of 2 nh +1 variables in 2 nh +1 nonlinear equations. and component mole fraction constraints are used to remove the mole fractions of the last hydrocarbon component in the oil and gas phases. … nh -1 which are actually the natural variables. So . or Type A variables. y c . we will explain the three steps of this approach. we have shown the base model (the full set of equations in terms of the base variables).2 General Formulation Approach Steps The first step of the General Formulation Approach is to switch from the base variables to the new variables. the saturation constraint is used to remove water saturation. c = 1. Black-oil models are treated as special cases of the general compositional model. X base . For other variables. In the following section. where secondary equations and variables are no longer needed and component mole fractions are either constants or only functions of pressure. For each step. the operations for the reservoir part and for the well part are discussed separately. S g . Capillary pressure constraints are used to remove water and oil pressures. and this step is only necessary when variables other than the natural variables are used. refer to appendix B for detail. 62 .

the base model uses the natural variables.2. Next we will review examples of new variables. and it is straightforward to calculate ∂F derivatives with respect to these variables. We can do this by the chain rule: ∂X ∂F ∂F ∂X base = (3. and they are . and the results are stored ∂F . but the above five steps will be exactly the same. and express each of 63 . Update the base variables X base by solving the explicit relation X = X ( X base ) . Different models will have different transformation matrices due to different relations between the new variables X and the base variables X base .9) ∂X ∂X base ∂X where ∂X base ∂X can be calculated from the relation between X and X base . back in ∂X base 3. The whole switching process is summarized below: 1. and calculate the transformation matrix TRAN = ∂X base ∂X =( ∂X −1 ) for each gridblock. which may be nonlinear in some cases. If another model using a ∂X base new set of variables X is desired.3. This is done for all terms in ∂X ∂X base the reservoir Jacobian and for WRJ in the well Jacobian. Solve the new linear system and update explicit variables. then we must compute derivatives with respect to the ∂F new variables . ∂X base 2. Calculate the new derivatives by ∂F ∂F = ⋅ TRAN . Build explicit relation X = X ( X base ) between X and X base . get δX and update the new variables by X υ +1 = X υ + δX 5.1 Switching From the Natural Variables to Other Variables In GPRS. Reduce the full set system to the final implicit primary set system (step 2 and 3 of the General Formulation Approach) 4.

y nh . y1 . x1 .16) (3. the possible choices for X (besides the base model variables) are identified as: Sw .17) x nh = 1 − ∑ x c y nh = 1 − ∑ y c zc = c =1 nh −1 c =1 nh −1 ρ o S o xc + ρ g S g yc ρo So + ρ g S g rc = ρ o S o xc + ρ g S g y c rw = ρ w (1 − S g − S o ) F = ρo So + ρ g S g l= ρo So ρo So + ρ g S g where. Besides the base model.14) (3. Based on a review of existing compositional models. ρ w = ρ w ( p) . and this step is not necessary. all of the transformation matrices are identity matrices.12) (3. x nh . y nh −1 ) Note that this process is equivalent to the use of chain rule to get the derivatives in Type B models.13) (3.11) (3. ρ o = ρ o ( p. rc .10) (3. rw . water saturation mole fraction of the last hydrocarbon component in the oil and gas phases zc .15) (3. … . F l overall mole fraction of each hydrocarbon component overall density of each hydrocarbon component overall density of water component overall density of hydrocarbon components hydrocarbon liquid (oil) mole fraction and their relations to the base variables are given below: S w = 1 − S g − So (3. For Type A models. x nh −1 ) and ρ g = ρ g ( p. … . a Type B model is implemented in GPRS.them in terms of the base variables. So it should not introduce any extra work. where the full set of variables is 64 .

18) The derivative of the overall component densities with respect to the base variables are calculated as  ∂r ∂ρ g ∂ρ  c = o S o xc + S g yc ∂p ∂p  ∂p  ∂r ∂rc  c = ρ g yc . = ρ o S o δ c . 2. c = 1.c ′ + g S g y c .20) The final structure of the inverse of the transformation matrix ( TRAN −1 ) is shown in Figure 3. … nh -1. S g . = ρ o xc . The following relations are used to calculate the transformation matrix: p = p  rc = ρ o S o xc + ρ g S g y c  rw = ρ w (1 − S g − S o )  S g = S g  yc = yc  (3.p. 2. 65 .  ∂S o  ∂S g  ∂r ∂ρ ∂rc ∂ρ  c = ρ g S g δ c . c = 1. The transformation matrix is calculated as the inverse of TRAN −1 in GPRS. Within this set. c = 1. … nh -1 rw .c′ + o S o x c  ∂y c′ ∂y c′ ∂xc′ ∂x c′   ∂rw ∂ρ w = (1 − S g − S o )  ∂p ∂p   ∂r ∂r  w = w = −ρw   ∂S g ∂S o  ∂r ∂r  w = w =0  ∂y c ∂xc  (3. … nh -1 and rw are the primary variables.3. 2. rc . rc . and y c .19) and (3. p .

c' + ∂yc' Sg yc ρoSoδc.3 Structure of the inverse of the transformation matrix for a Type B model Now that we have the full set of equations and variables.regardless of its internal structure. and δX = X υ +1 − X υ ∂X or we can express F ( X ) in Taylor series: 0 = F n +1 ( X ) ≈ F υ +1 ( X ) = F υ ( X ) + ( ∂F υ ) δX ∂X (3. there are more efficient ways to calculate its inverse. But. p p 1 ∂ρo ∂p ∂ρw ∂p Sg 0 So 0 yc ' 0 ∂ρ xc ' 0 ∂ρ rc rw Sg yc g o ∂ρ So xc + ∂pg Sg yc ρ g yc ρ g xc ρg Sgδc.22) (3. and we also have different choices of variables. like the one in Figure 3. First we reduce it to the minimum number ( nc ) of equations and variables required to establish the thermodynamic state (the FIM model). then we can further reduce the implicit level. the next step is to reduce the number of equations and variables to a set that is solved together.21) 66 . for matrices with special structures.c' + ∂xc' So xc (1− Sg − So ) 0 − ρ w − ρw 1 0 0 0 0 0 0 0 0 I 0 Figure 3.2.3. Reduce Full Set F ( X ) = 0 to Primary Set Fp ( X p ) = 0 3. we could use the NewtonRaphson method: ∂F ( )υ δX = − F υ ( X ).2 In order to write an iterative process to solve F ( X ) = 0 .

X s ) = Fsυ ( X p . In addition. we will also show a matrix manipulation method.23) Rearranging Eqn. 3. Taylor series are used to derive the primary set. as shown in the first frame of Figure 3. The first step is to relate the secondary variables to the primary variables. In the following analytical derivation.23. we get δX s = ( D −1 N )υ − ( D −1C )υ δX p (3. D= s ∂X p ∂X s and vectors: M = − Fp . X s ) = 0 yields 67 . Analytical Derivation In the last section. which can achieve the same final goal as the analytical derivation method.Eqn. X s ) + ( = − N υ + C υ δX p + D υ δX s ∂Fs υ ∂F ) δX p + ( s )υ δX s ∂X p ∂X s (3. we have defined the following matrices: A= ∂Fp ∂X p . and we will discuss it in more detail later. 3.C= ∂F ∂Fs . Use of Taylor series on the primary equation set Fp ( X p .21 and Eqn. The matrix manipulation method is used in GPRS. We start with the secondary equation set Fs ( X p .2.4. C and D together form the full set Jacobian matrix for Eqn. 3. and M . N = − Fs where matrices A.24) The second step is to write the primary equations in the primary variables. Use of Taylor series on this equation set yields 0 ≈ Fsυ +1 ( X p . N are the corresponding right hand sides (RHS) for the primary part and for the secondary part. B. B= ∂Fp ∂X s . X s ) = 0 .22 are equivalent.3.

X s ) = Fp ( X p . After we solve for the primary variables. The goal is to eliminate B to zero. D and M. we have ( A − BD −1C )υ δX p = ( M − BD −1 N )υ (3.4. B. which only includes the primary variables as unknowns.25) = − M + A δX p + B δX s υ υ υ Substituting Eqn. X s ) + ( ∂Fp ∂X p )υ δX p + ( ∂Fp ∂X s )υ δX s (3. then the primary equations will depend only on the primary variables.26) Rearranging terms. We can achieve the same goal by performing matrix manipulation directly on the full set Jacobian matrix and RHS. the secondary variables can be updated explicitly from Eqn.27) This is the final primary system.24 gridblock by gridblock. A B M (1) C D N D −1 C I D −1 N A B M A (2) BD C −1 B M (3) −1 AB D −1 C B D −1 C 0 MB D −1 N B D −1 N B BD N B Figure 3.υ υ 0 ≈ Fp +1 ( X p . C.3. N) of the full set Jacobian matrix and RHS.4 Reduce full set to primary set by Gaussian elimination 68 .24 into the above equation. 3. we get 0 = − M υ + Aυ δX p + Bυ [( D −1 N )υ − ( D −1C )υ δX p ] (3. This is illustrated in Figure 3. Matrix Manipulation (Gaussian Elimination) Here we perform Gauss elimination on the blocks (A.

select the diagonal A. A. we multiply the secondary equation set by D-1. • Off-diagonal part of B (OffD_A and OffD_B arrays) Loop through the connection list. B and M are in the same row (equations for the same gridblock). after rearrange it. We need to eliminate all parts of B. B.29) which is the same equation as Eqn. 3. We can also extract a secondary equation set from the second frame of Figure 3. The three operations in Figure 3.4. The final primary equation set can be extracted and written as ( A − BD −1C )δX p = ( M − BD −1 N ) (3. 3.24. Different parts of B are eliminated as discussed below: • Diagonal part of B (Diag array) Loop through the cell list.4 are performed for each gridblock and for each part of the Jacobian matrix. and perform the three step elimination process. C and D are always in the same column (they are the derivatives with respect to the variables in the same gridblock). select the C and D which are in the same column as A and B. since D-1C and D-1N have already been calculated. In addition. C and D for the same block and their corresponding RHS. D-1 is calculated and stored back in D. the off-diagonal part and the well part of the full set Jacobian. Note that matrices A. This process needs to be done for both the OffD_A array and for the OffD_B array. B. we know that matrices A and B exist on the diagonal part. and N is corresponding to C and D. then we multiply it again by B. and C.28) which is the same equation as Eqn. 69 . D and N are in the same row. Only the last step of the elimination is needed here. D-1C and D-1N are calculated and stored back in C and N to avoid repeating calculations and using extra memory space.27. Matrices C and D only exist on the diagonal part. we have δX s = ( D −1 N )υ − ( D −1C )υ δX p (3. for each A and B in the off-diagonal part. and finally we subtract the secondary equation set from the primary equation set.First. M and N. From Figure 3.2. M is corresponding to A and B.

for each AWR and BWR in the WRJ.5. 70 . The updated A and M can later be extracted for fully implicit solve or for further reductions. select the C and D which are in the same column as AWR and BWR. The structure of the resulting Jacobian is shown in Figure 3. the A and M of the full set Jacobian and RHS in Figure 3. Only the last step of the elimination is needed here. After the above operations. MWW is corresponding to AWR and BWR. and the elimination process will be performed for each of them. and N is corresponding to C and D.2 are reduced to the primary set Jacobian and RHS (fully implicit). for the system shown in Figure 3.2.• Well part of B If a well has the WRJ array. If a well penetrates multiple gridblocks. the following operations are performed to reduce B to 0: • Diagonal part operations: D1 ← D1−1 C1 ← D1−1 ⋅ C1 N 1 ← D1−1 ⋅ N 1 D 2 ← D 2 −1 C 2 ← D 2 −1 ⋅ C 2 N 2 ← D 2 −1 ⋅ N 2 A1 ← A1 − B1 ⋅ ( D1−1 ⋅ C1) A2 ← A2 − B 2 ⋅ ( D 2 −1 ⋅ C 2) • M 1 ← M 1 − B1 ⋅ ( D1−1 ⋅ N 1) M 2 ← M 2 − B 2 ⋅ ( D 2 −1 ⋅ N 2) Off-diagonal part operations: A12 ← A12 − B12 ⋅ ( D 2 −1 ⋅ C 2) A21 ← A21 − B 21 ⋅ ( D1−1 ⋅ C1) M 1 ← M 1 − B12 ⋅ ( D 2 −1 ⋅ N 2) M 2 ← M 2 − B 21 ⋅ ( D1−1 ⋅ N 1) • Well part operations: AWR ← AWR − BWR ⋅ ( D1−1 ⋅ C1) M WW ← M WW − BWR ⋅ ( D1−1 ⋅ N 1) where A1 ← A1 − B1 ⋅ ( D1−1 ⋅ C1) means that A1 − B1 ⋅ ( D1−1 ⋅ C1) is calculated and stored back in A1 . there will be several AWR and BWR. To make the process clearer.

If the secondary equations are only used as constraint equations. the following additional operations are performed in GPRS: A1 ← A1 − ARW ⋅ ( AWW ⋅ AWR ) −1 M 1 ← M 1 − ARW ⋅ ( AWW ⋅ M WW ) −1 After the primary reservoir variables have been solved.diagonal A1 . .. we can decouple the reservoir Jacobian from the well Jacobian by eliminating RWJ.1 = ( D1−1 ⋅ N 1) − ( D1−1 ⋅ C1) ⋅ δX p .. then we can solve for the reservoir variables first and explicitly update the well variable later...1 Here. the secondary variables of each gridblock are updated explicitly by δX s . the well variable is updated by δX W = ( AWW −1 ⋅ M WW ) − ( AWW −1 ⋅ AWR ) ⋅ δX p . 71 . A12 . Newton iterations are performed on both the primary equations and the secondary equations.1 We have mentioned in Chapter 2 that. A21 AWR Figure 3...... If the well in Figure 3.5 Jacobian .5 only has single block penetration and RWJ exists.. 2 = ( D 2 −1 ⋅ N 2) − ( D 2 −1 ⋅ C 2) ⋅ δX p . A2 AWW ARW RHS M1 . then all of the N's in the above equations will be zero. M2 MWW Structure of the primary set Jacobian Matrix and RHS After solving for the primary variables together. for single block wells with constant rate control.1 δX s . as mentioned in Chapter 2.

which is always a primary variable. • If the transmissibility is treated explicitly. and this step is also not necessary. But in a lot of situations. we first split the primary variables into an implicit part and an explicit part. we can use it as the initial guess for flash.2. there are no secondary variables.6. if a gridblock has only one hydrocarbon phase. For each gridblock.Some variations in the general operations are necessary as discussed below. When we update the secondary variables.5. it is equivalent to doing one step of flash calculations for each Newton iteration. This process needs to be done for each gridblock that is not fully implicit. • For the black-oil model. we will discuss the various decoupling methods available. then the primary equations will only depend on the primary variables as shown in Section 2. For compositional models. we desire to reduce the implicit level to speed up the calculations. The second step is basically a decoupling step. because flux terms only have derivatives to pressure. For fully implicit simulations we can just stop here. then there is no need to eliminate offdiagonal parts of B. So far.6. • Matrix D is actually the Jacobian matrix for flash calculations. The next subsection will show how this is done. then we decouple the implicit variables from the explicit variables. 72 . and this step is not needed. In this part. the fully implicit Jacobian matrix is shown in Figure 3.3 Reduce the Implicit Level of the Fully Implicit System Fp ( X p ) = 0 To reduce the implicit level of the fully implicit system. For exact flash calculations at each Newton step. their differences. which is one row of the matrix equation in Figure 3. the explicit variables can be updated explicitly gridblock by gridblock. 3. After the implicit variables have been solved for together. we have derived the fully implicit Jacobian matrix and RHS. and all off-diagonal parts of B are zero. and which one is used in GPRS. and set the derivatives of flux terms with respect to the explicit variables to zero.

two popular choices are Householder reflection (QR decomposition) and local inversion (Lacroix et al. Coats 73 . which includes a diagonal part. V1. diagonal V1 V2 V3 P Off-diagonal V1 V2 V3 P RWJ pW X X X X RHS X X X X …… X X X X X X X X X X X X X X X X …… 0 0 0 0 0 0 0 0 0 0 0 0 X X X X Figure 3.diagonal V1 V2 V3 P Off-diagonal V1 V2 V3 P RWJ pW X X X X RHS X X X X …… X X X X X X X X X X X X X X X X …… X X X X X X X X X X X X X X X X Figure 3. We can reduce the implicit level of the fully implicit system in Figure 3. This is illustrated in Figure 3. set all flux term derivatives with respect to the explicit variables to zero.. Since the off-diagonal parts of A are the flux term derivatives. decouple the implicit variables from the explicit variables.7 Jacobian matrix of one gridblock after explicit treatment of flux terms 2. V2 and V3 are the explicit primary variables. There are different kinds of decoupling methods available. Next. 2000).7. several offdiagonal parts and several well parts (RWJ).6 in two steps: 1. this treatment will leave parts (derivatives with respect to the explicit variables) of the off-diagonal A to zero. The right part is the right hand side M.6 Fully implicit Jacobian matrix of one gridblock Here the left part is the Jacobian matrix A. First. P is the pressure or the implicit primary variables. Diagonal A will also have some change. but it won’t be zero. or simply don’t calculate them.

Based on it. The same results can be achieved by performing Gaussian elimination on the system in Figure 3. the last equation will be only in terms of the implicit variables.7. After it is solved. After that. the explicit variables can be easily updated by making use of the upper triangular structure of the diagonal matrix.8. choice and ordering of variables and equations. 1999) is summarized in Figure 3. Here we only review the two most popular decoupling methods. Q-1=QT. where Q is an orthogonal matrix.. which only has values in the upper triangular part.8) into a matrix or column vector. and it is extracted and passed to the linear solver. and use the transpose of Q to multiply all of the matrices and vectors. we can conclude that the choice of decoupling methods does not have too much influence on the final implicit system.7. and R is an upper triangular matrix) on the diagonal matrix. and move each part (dark rectangles in Figure 3. the diagonal matrix becomes R. independent of the manner of derivation. Householder reflection and local inversion: • Householder reflection The process of using Householder reflection (Lacroix et al. We start from the system in Figure 3. Then we perform a QR decomposition (A=QR. 74 .(1999) has pointed out that the IMPES pressure equation is unique.

8 Householder reflection decoupling 75 .diagonal V1 V2 V3 P Off-diagonal V1 V2 V3 P RWJ pW X X X X RHS X X X X …… X X X X X X X X X X X X X X X X …… 0 0 0 0 0 0 0 0 0 0 0 0 X X X X A A' A RW M A = QR R Q −1 A ' Q −1 A RW Q −1 M diagonal V1 V2 V3 P Off-diagonal P RWJ pW X X X X RHS X X X X …… X 0 0 0 X X 0 0 X X X 0 X X X X …… X X X X Figure 3.

. After that. Then we use the procedure in Figure 3. it is done separately for the diagonal part.4. subscript p stands for pressure or implicit variables. and subscript s stands for saturation or explicit variables. The notation used here follows the normal notation used for black-oil IMPES models. Finally the second equation can be extracted and solved for implicit variables. diagonal V1 V2 V3 P Off-diagonal V1 V2 V3 P RWJ pW X X X X RHS X X X X …… X X X X X X X X X X X X X X X X …… 0 0 0 0 0 0 0 0 0 0 0 0 X X X X Ass A ps Asp A pp ' Asp RW Asp RW A pp Ms Mp A 'pp A ps − A ps Ass1 Asp − ' A ps Ass1 Asp − RW A ps Ass1 Asp RW A pp − − RW A ps Ass1 Asp − A ps Ass1 M s 0 A pp − − A ps Ass1 Asp A 'pp − − ' A ps Ass1 Asp Mp − − A ps Ass1 M s Figure 3. Here we also start from the system in Figure 3. the explicit variables are updated from the first equation.4 to reduce A ps to zero.9) into a small matrix or column vector.• Local inversion The process of using local inversion (Lacroix et al. Like the procedure used in Figure 3.7.9 Local inversion decoupling 76 .9. and move each part (dark rectangles in Figure 3. Note that we operate on the matrices and vectors in the same row (belong to the same gridblock). 2000) is summarized in Figure 3. the off-diagonal part. but we do an additional splitting step to separate the implicit part from the explicit part. and the well part (RWJ).

the explicit variables are updated explicitly by 77 .10.. diagonal Ass A ps Jacobian Asp RHS A ' sp A ….4. The method used for decoupling does not make much difference.. 2001) show that for most cases. numerical experiments (Vassilevski. After getting the implicit variables. A pp and M p form the final implicit system. A 'pp . A pp RW sp Ms Mp A 'pp RW A pp Figure 3. we use the local inversion method anyway. since the final implicit systems are always equivalent. But in GPRS. the pressure system from Householder reflection is more symmetric than the pressure system from local inversion.For the IMPES model. the following operations are performed to reduce A ps to 0 in GPRS: • Diagonal part operations: − A ps ← A ps ⋅ Ass1 − A pp ← A pp − ( A ps ⋅ Ass1 ) ⋅ Asp − M p ← M p − ( A ps ⋅ Ass1 ) ⋅ M s • Off-diagonal parts operations: − ' A 'pp ← A pp − ( A ps ⋅ Ass1 ) ⋅ Asp • Well parts (RWJ) operations: RW − RW A pp ← A pp − ( A ps ⋅ Ass1 ) ⋅ Asp RW A pp . and no additional work is needed to implement it. because this procedure is similar to the procedure used in Figure 3. which is better for the linear pressure solver. for the system shown in Figure 3. they are extracted and passed to the linear solver.10 Illustration for local inversion To make this step clearer.

and only derivatives with respect to the implicit variables are calculated. which upon convergence gives the same solution as the FIM method. The first approach has less numerical diffusion. phase density and component mole fraction). This option is used for the IMPES model. (1995) proposed using IMPES reduction factor to generate the pressure system. we can either fix it at the old time level or update it iteration by iteration. where both pressure and saturation are treated implicitly. The second approach is actually an inexact Newton method. such as if the calculated total compressibility is negative. and each part can be treated differently. 78 .9 for the case where only the pressure is treated implicitly. Coats (1999) showed that IMPES reduction factor leads directly to the value of total compressibility in multiphase gridblocks. and component mole fractions are treated explicitly. and the IMPES reduction factor is a vector consisting of these scalars. For each gridblock. phase mobility and phase density are updated iteration by iteration. such as in IMPES. it is a vector. Before any decoupling. In that approach. For IMPES. we can see that transmissibility has three non-constant parts (phase mobility. • Option 2 Component mole fractions are fixed at the old time level. parts of the transmissibility are treated explicitly. we have the following four options for the treatment of transmissibility in GPRS: • Option 1 All three parts are fixed at the old time level. For each explicit part. 2.− ' ' RW δX exp = Ass1 ⋅ ( M s − Asp ⋅ δX imp − Asp ⋅ δX imp − Asp ⋅ δX W ) Coats et al. From Eqn. Basically it is the application of the procedure in Figure 3. since A ps is a row vector and Ass1 is a matrix. This option is used for the IMPSAT model. each equation (one row) in Figure 3.5.7 is multiplied by a scalar. The IMPES reduction factor is actually the − A ps Ass1 matrix in the General − Formulation Approach. and only derivatives with respect to the implicit variables are calculated. and this in turn provides an error check for black-oil PVT data. The values of these scalars are determined so that the addition removes all of the variables except − pressure. and the resulting nc equations are added. then there must be some inconsistency in the black-oil PVT data.

This General Formulation Approach only defines the general steps and methods to reach the final goal. For some models. This option can be used for any models. quasi IMPES is not used as a formulation. which is actually the IMPES model proposed for an adaptive implicit scheme by Thomas and Thurnau (1983). • Option 4 All three parts are updated iteration by iteration. so the extension to the use of different implicit levels for different gridblocks (Adaptive Implicit Method. All of the operations are performed on individual gridblocks.• Option 3 All three parts are updated iteration by iteration. and each reservoir is handled by a single processor in parallel computation). In summary. and it is suitable for any model. which use z c as the primary variables. we know the analytical form of accumulation term derivatives with respect 79 . matrices are banded or sparse. This option is used for the FIM model. and only derivatives with respect to the implicit variables are calculated. but it performs poorly for IMPES. and it is only used as a way to generate a pressure system. we should only perform operations on the non-zero terms. Russell (1989) showed that in order to make this method stable. type of variables and level of implicitness. we need to consider the details of each specific model. Generally. AIM) is straightforward. regardless of the type of model. The corresponding models are normally called quasi IMPES and quasi IMPSAT models. and all derivatives are calculated regardless of the implicit level. the reductions in implicit level are performed for all non-zero terms.05. This approach also allows the use of different models for different reservoirs (reservoirs are only connected through well groups and boundary interfaces. which can be used later for preconditioning purpose. the proposed General Formulation Approach can be used to obtain any desired formulation. For example: • • In many cases. the CFL number must be less than 0. such as variable Type B models. and finally some terms are ignored to form the implicit system. But in order to make the simulator more efficient. For the IMPES and IMPSAT models. this option can also be used.

we will derive the stability criteria due to the explicit treatment of saturations and component mole fractions. These are some general considerations that reduce calculations. However. within them. which are both primary variables for the base model. • The matrix C is generated from the phase equilibrium relations. in order to control the number of Newton iterations for each timestep. and we should use them to further simplify calculations. and we can just bypass the variable switching part. and stability analysis is needed to correctly identify it. Next. In practice. the speed of this General Formulation Approach should be comparable with that of commercial simulators. Furthermore.to them. all of the operations of this approach are of first order to the number of gridblocks. we desire to use the maximum allowable (stable) timestep size. • Water equation only has derivatives with respect to pressure and saturations. 3. each specific model has its own characteristics. In real simulations. so the cost should be small compared to the cost of linear solver. as long as both pressure and saturations are implicit. a reasonable timestep size is required.3 Stability Analysis After the secondary variables are eliminated from the primary equations. the explicit treatment of primary variables will make the model conditionally stable. and directly calculate them from the start. we get the FIM model. especially for large models. If we further reduce the implicit level of the primary set. pressure is always treated implicitly. Assuming one-dimensional two- 80 . so some columns of C are always zero. and they are far from complete. which is unconditionally stable. This means that water equation is in terms of the primary variables only from the start. and the timestep size will have to satisfy some stability criteria. and save some calculations. The natural variables are used in GPRS. With proper tuning. normally it is between 30 days and 100 days. We can take advantage of this. and we need not do any reduction for it. and it does not have any derivative with respect to saturations. and saturations and component mole fractions can be treated either implicitly or explicitly.

we get ∂S g u df g ∂S g ) =( T φ dS g ∂x ∂t (3. we get the total hydrocarbon mass balance equation: ∂ ∂ (φρ o S o + φρ g S g ) = ( ρ o u o + ρ g u g ) ∂t ∂x (3. its stability is determined by the CFL number. 3. which can be written as u ⋅ ∆t df g ⋅ ≤1 CFLS .31) By assuming incompressible flow. 3.32) (3. Summing Eqn.30 over all components.phase (gas/oil) flow. and Eqn.30) (3. 3.33. the hydrocarbon component mass balance equations can be written as ∂ ∂ (φρ o S o xc + φρ g S g y c ) = ( ρ o u o xc + ρ g u g y c ) ∂t ∂x c = 1. and they are only functions of saturation. x = T ∆x ⋅ φ dS g (3. 1989): 81 . no gravity and constant viscosity. the total CFL number is the summation of CFL numbers in all three directions (Russell.….34 is the Buckley-Leverett wave equation. 3.31 can be simplified as ∂S g ∂f g ∂S ∂f ∂ = ( ρ o f o u T + ρ g f g uT ) = ρ o u T o + ρ g u T φρ o o + φρ g ∂t ∂t ∂x ∂x ∂x df g ∂S g ∂f g ∂S g φ (ρ g − ρo ) = uT ( ρ g − ρ o ) = uT ( ρ g − ρ o ) dS g ∂x ∂x ∂t (3. the total flow velocity uT becomes a constant. After rearranging Eqn.34) Eqn. nh where u o and u g are the phase velocities for the oil and gas phases. no source and sink.33) where f o and f g are the fractional flows of the oil and gas phases.35) For three-dimensional flow.

3. Coats (2001) derived the same stability criteria for the general multi-dimensional three-phase flow. y + qT .z ⋅ ∆t A z ∆ z ⋅ φ dS g ⋅ df g (3.38) Substituting Eqn.37) By ignoring gravity.36) q T ⋅ ∆ t df g ⋅ ≤1 V ⋅ φ dS g where qT is the total volumetric flow rate. qT . V is the volume of a gridblock. and qT = qT . z . 3. y + CFL S .37 and rearranging. and V = Ax ∆x = Ay ∆y = Az ∆z . For two-phase (gas/oil) flow without capillary pressure.x ⋅ ∆t A x ∆ x ⋅ φ dS g ⋅ df g + qT . y and qT . x + qT . z are the volumetric flow rates along x.39) (λ o + λ g ) λg qT ∆t ) / dS g ⋅d( λo + λ g Vφ q T ∆ t df g ⋅ ≤1 V φ dS g 82 . The physical meaning of Eqn. we have λg  qT q g = f g q T = λ g + λo   q = f q = λ o q T o T  o λ g + λo  (3. including both gravity and capillary pressure.CFL S = CFL S . z = = qT . y and z directions. x qT . it can be reduced to λ g dλo λo dλ g qg − qo λo dS g ∆t λ g dS g ⋅ ≤1 CFLS = λo + λ g Vφ (3. x + CFL S .36 is that a phase front can not move more than one gridblock in a stable timestep.38 into Eqn. 3. we get dλ g dλ o λo − λg CFL S = qT ∆t ⋅ Vφ dS g dS g (λ o + λ g ) (λ o + λ g ) 2 dλ g dS g = = = qT ∆t ⋅ Vφ − λg ( dλ o dλ g ) + dS g dS g 2 (3. y ⋅ ∆t A y ∆ y ⋅ φ dS g ⋅ df g + qT .

44 for So =0 or S g =0. we can eliminate the second terms on both sides. we get ρ o u o xc + ρ g u g y c ∂y c ∂y c = φρ o S o xc + φρ g S g y c ∂x ∂t (3. the same stability criterion as developed here (Eqn. and after rearranging. If any component mole fraction is treated explicitly. In Coats’ new paper (Coats. 3. the stability criterion is ∆t ρ o q o xc + ρ g q g y c ≤1 CFL X = Vφ ρ o S o xc + ρ g S g y c (3. 3. 3. x = ∆xφ ρ o S o xc + ρ g S g y c (3. for three-dimensional flow.41) Dividing by K c on both sides of Eqn.30.44) was proposed.44) Coats (1999) mentioned that the stability criterion due to the explicit treatment of ∆t q ⋅ T ≤ 1 . we get ρ o u o xc + ρ g u g y c ∂xc ∂xc = ∂t φρ o S o xc + φρ g S g y c ∂x (3.41 and Eqn. 3.42 is ∆t ρ o u o xc + ρ g u g y c ≤1 CFL X .36. 3.40) Substituting Eqn. Eqn. 2001).which is the same equation as Eqn. but he got it by first assuming 83 .37 is used as the stability criterion for the explicit treatment of saturations in GPRS.43) Similarly.41.34 into Eqn. 3. 3. 3. which is only a simplified version component mole fractions is CFLX = Vφ 1 − S w of Eqn. we can get its stability criterion from Eqn. we have (φρ o S o / K c + φρ g S g ) ∂S g ∂y c + φ ( ρ g yc − ρ o xc ) ∂t ∂t df g ∂S g ∂y = ( ρ o u o / K c + ρ g u g ) c + uT ( ρ g y c − ρ o x c ) ∂x dS g ∂x (3. Assuming incompressible flow and constant equilibrium ratio K c . 3.42) The stability criterion for both Eqn.40. 3.

…0) move the fourth equation to the current location. Eqn. The physical meaning of Eqn. 0. but no matter what equations we select. the amount of component c flowing out of a gridblock can not exceed the amount of component c in place in that gridblock.4 Influence of Equation and Variable Selections Compositional models are different in both their implicit levels and their equation and variable selections. and it only needs to be satisfied when either y c or xc is treated explicitly. the total mass balance equation is the summation of all of the component mass balance equations. for a stable timestep.44 is. 3. 3. the Jacobian matrix and the RHS for one gridblock can be written as 84 .44 is used as the stability criterion for the explicit treatment of component mole fractions in GPRS. coefficients (0.1. In other words.44) in Chapter 4. We will further analyze and compare these two stability criteria (Eqn. 3. Such as. In the last section we have discussed the stability criteria due to the explicit treatment of variables.qo =0 or q g =0. 3. Equation selection is done gridblock by gridblock. then sum them up) of all of the equations shown in Subsection 1. First we discuss the effect of selecting primary equations. Eqn.37 and Eqn. a component can not move more than one gridblock in a stable timestep. we can select different equations.1 Selection of Primary Equations In reservoir simulation. then finally generalizing it to the case where both hydrocarbon phases flow.2. For example. 3.…1). in this case the vector of coefficients is (1. If we consider the ordering of equations. In this part. each equation is basically a linear combination (first assign a coefficient to each equation. and getting the stability criterion for the case where only single hydrocarbon phase can flow. then we compare the differences between different variable selections.44 is for each individual component. 1. 1.4. 1. 3. we consider the influence of equation and variable selections on the efficiency of compositional simulations. 0. For each we will discuss their influence on Newton iterations and linear solver iterations. 3. Our derivation is more general. a new ordering can be viewed as a special linear combination of the old ordering.

the best equation selection is 85 .47) A1 A2 An   B1    . the change of the Jacobian matrix will influence linear solver iterations.47 can be recast as ( M ⋅ A) ⋅ δX = ( M ⋅ B) (3. equation selection will not influence Newton iterations. we can view Eqn. because A and MA have different condition numbers. Bi is one row of the RHS B.45 by a matrix on both sides: M i ⋅ ( Ai ⋅ δX ) = M i ⋅ Bi (3. and δX is all of the unknowns. In other words. Alternatively. where M is the preconditioning matrix. 3.46 is only for one gridblock.45) where Ai is one row of the full Jacobian matrix A.48) Here. so it is some kind of block diagonal scaling left preconditioning. Equations for individual blocks can be combined to obtain the final full system: M ⋅ ( A ⋅ δX ) = M ⋅ B (3. 3. and B =  B2       Bn       M 1  M2 where. On the other hand. A =      Mn  Eqn. In this sense. the same solution is guaranteed as long as Eqn 3. the number of Newton iterations will stay the same.48 is solved accurately. but the solution vector is still δX .48 as a left preconditioning of the old linear system A ⋅ δX = B . M =         .46) Eqn.Ai ⋅ δX = Bi (3. 3. the RHS changes to MB . The solution vector is always δX no matter what the M is. In this case M is a block diagonal matrix. Since the convergence of Newton iterations depends on the reduction of residuals. Any combination of equations of gridblock i can be represented by pre-multiplying Eqn. 3. Same solutions for X lead to the same residuals at each Newton iteration. the Jacobian matrix changes to MA .

which only influence linear solver iterations and has no influence on Newton iterations. M =       . We can combine all of them together. Applying a block diagonal scaling left preconditioning to the Jacobian matrix could achieve the same effect.4.the one that makes the block diagonals of MA as close to a diagonal matrix as possible. at the Jacobian level. then we will discuss the differences between using intensive variables and extensive variables. A good equation selection should roughly align the equations in the way that variable i has the biggest influence on equation i (diagonal dominance). then the block diagonals of MA will be as near to diagonal as possible (diagonal dominance). and this process is done gridblock by gridblock. different equation selections are equivalent to performing different block diagonal left preconditionings to the old system. we have mentioned that we can change the variable selection by multiplying the equation by a transformation matrix. then at the full Jacobian level. In Subsection 3. this process looks like ( AM ) ⋅ ( M −1δX ) = B M 1  M2 where.1. we can conclude that. just as the block diagonal scaling preconditioner does.   Mn (3. In this part. we like to select and align the equations in such a way that equation i is most influenced by variable i. finally we will compare the performance of models with Type A and Type B variables in terms of their mass and volume balance errors. This transformation matrix is for each gridblock. In other words. we will first consider the influence of different variable selections on Newton iterations and linear solver iterations. 3. different equation selections will influence the amount of work in calculating the Jacobian matrix and the RHS. Of course.2 Different Variable Selections Different models can also use different variables. Based on these observations.49) 86 .2.

Different solutions for X lead to different residuals at each Newton iteration.49 as a right preconditioning of the old system A ⋅ δX = B . Variable selection will also influence the amount of work in calculating the Jacobian matrix and the RHS. In this case M is also a block diagonal matrix.5 . Such as for F = X 2 − 2 = 0 with initial guess X 0 = 1 . Y 1 = Y 0 + δY 0 = 2 and X 1 = Y 1 = 2 . For the same type of variable. If the equations are more linear with respect to the new variables. such as the overall component molar density rc vs. after the first Newton iteration. Since the convergence of Newton iterations depends on the reduction of residuals. we get δX 0 = 0. we must first solve for Y by Y υ +1 = Y υ + δY υ . it is also possible to use an extensive variable. In this case. then the equation becomes F = Y − 2 = 0 with initial guess Y 0 = 1 . we solve for X by X υ +1 = X υ + δX υ = X υ + MδY υ and we get the same solution as for the old system. Alternatively we can view Eqn. then X of each gridblock can be updated explicitly by the relation X = f −1 (Y ) that was built between X and Y for the calculation of transformation matrix. variable selection will influence Newton iterations. The change of the Jacobian matrix will influence linear solver iterations. 3. where M is the preconditioning matrix. after the first Newton iteration. then the number of Newton iterations will decrease (for linear system. if we change X to Y = X 2 . so it is some kind of block diagonal scaling right preconditioning. no matter which kinds of variables are used. we have δY 0 = 1 . we will get a different solution X if the relation X = f −1 (Y ) is nonlinear. the number of independent variables is always 87 .5 and X 1 = X 0 + δX 0 = 1. the overall component moles mc . But for the new variables. we need to recall that. it is best to align the variables in the way that makes variable i to have the biggest influence on equation i (diagonally dominant). because A and AM have different condition numbers. the Jacobian matrix changes to AM . and these two solutions for X 1 are different. A ⋅ δX = B . In order to understand the difference between these two types of variables.Here. By preconditioning. only one Newton iteration is needed to converge). the solution vector changes to δY = M −1δX . For the same reason as for the selection of equations. but the right hand side is still B . The natural variables are the cheapest ones for building a fully implicit system.

51) Eqn. If the overall component moles mc are used. and the mass balance is exact at each Newton iteration (Farkas. This does not mean that the degrees of freedom of this system is 4. 1997).50) But sometimes. which are all intensive variables. since the relation between them is nonlinear. but not too much. we can not easily remove one of the overall component moles.o Bg B Vφ = w mw + mg + mo ρw ρg ρo (3. 88 . since it is a linear equation with respect to saturations. [(φrc ) n +1 − (φrc ) n ] ⋅ V / ∆t is nearly linear with respect to these variables if we consider that porosity changes are small with pressure. If the overall component molar densities rc are used. models using extensive variables use one more equation and one more variable than necessary. then the accumulation term. we have Bg Bo − Rg .the same. The volume balance equation is only a constraint equation (only has derivatives in the diagonal part of the Jacobian matrix). 1997).51 is actually the volume balance equation for black-oil models. ( mcn +1 − mcn ) / ∆t will be linear with respect to these variables. Such as for a three-phase black-oil model. For example in the case of black-oil models. Is there any benefit in using extensive variables? Yes. it is only 3. all of the extensive variables of this system will also be fixed. after the natural variables have been calculated and fixed. But if we use pressure and overall component moles mc as variables. then the accumulation term. But if the overall component mole fractions z c are used. sometimes. then the accumulation terms. For convenience this volume balance equation is treated as part of the nonlinear equation set to complete the system when calculating the Jacobian matrix and the RHS. 3. and the mass balance will be nearly exact at each Newton iteration (Farkas. Consider a compositional model using the natural variables. if we use pressure and saturations as variables. in fact. one of the saturations can be easily removed by using the saturation constraint equation. and each of the 4 × 4 small matrices can be reduced to a smaller 3 × 3 matrix. For example the overall component mole mc can be calculated as mc = Vφ ( ρ o S o x c + ρ g S g y c ) (3.

Next we will compare the models using these two types of variables in terms of mass balance and volume (saturation) balance errors. Both balances will be exact when the model converges at the end of each timestep (Farkas. Again. In Chapter 1. In summary. mass balance is a much more desirable property than volume balance. this will cause mass balance errors at each Newton iteration. and both models should have the same performance. a model using the overall component molar densities rc should have similar performance as a model using the overall component moles mc . there is virtually no mass balance error at each Newton iteration. Coats (1999) proposed a new approach to achieve exact mass balance at each Newton iteration. The Newton iteration number depends on the linearity of the flow equations. Mass balance at each Newton iteration depends on the linearity of the accumulation term. Is there a strong connection between mass balance and Newton iteration numbers? No. now the saturation constraint equation is a nonlinear equation with respect to these variables. As a result. since the saturation constraint equation is a linear equation. both balances will be exact when the model converges at the end of each timestep (Farkas. In reservoir simulation. and the relaxed volume balance method is used to control the volume balance error. 1997). due to the nonlinearity of the accumulation terms with respect to these variables. since the total fluid density ρ T = ρ o S o + ρ g S g changes a lot with both pressure and overall component mole fractions.[(φρ T z c ) n +1 − (φρ T z c ) n ] ⋅ V / ∆t will be nonlinear. if the rock compressibility is much smaller than the fluid compressibility. which 89 . If the rock is incompressible. but there is a volume balance error. Type A and Type B. 1997). For Type A variables. and the component mass changes are calculated from the mass balance equations. But the mass balance errors are transformed into volume balance error in each iteration step. mc = Vφrc and the only difference between rc and mc is a constant scalar ( Vφ ). such as for gas flow. The volume balance is exact at all times. the Jacobian variables are used to calculate well rate and inter-block fluxes. • Type B models If rc and mc are used. In each iteration step. • Type A models There is mass balance error at each Newton iteration. there is no mass balance error. we mentioned that there are two types of variables.

the degrees of freedom of the system are always the same. For exact mass balance. 90 . we can draw the following conclusions for different equation and variable selections: • Different equation and variable selections will change linear solver iterations. the flux part and the well part. intensive or extensive. when selecting equations and variables. we are solving the mass balance equations and the phase equilibrium relations together. Due to these considerations. The Newton iteration number depends on the nonlinearity of both sets of equations. The same effect can be achieved by applying block diagonal preconditioners for the Jacobian matrix. but the degree of nonlinearity of the flux and well parts with respect to the selected variables are still unknown. Mass balance is a nice property to have. the Newton iteration number is not strongly influenced by the mass balance. the cost of calculating the Jacobian matrix and the RHS should also be considered. the accumulation part. while different variable selections can change the behavior of Newton iterations. the nonlinearity of phase equilibrium relations with respect to different variables is even more unpredictable. The results in Chapter 5 further validate this point.include three parts. Based on the above discussion. In compositional simulations. we conclude that for compositional simulations. • Different equation selections will not change the behavior of Newton iterations. which depend on the nonlinearity of the equations with respect to different variables. and both of them are nonlinear. • • No matter what types of variables are used. the accumulation part must be linear with respect to the selected variables. and a good equation and variable selection should align the equations and variables in such a way that variable i has the biggest influence on equation i (diagonal dominance). Of course. but it does not have a direct connection with the convergence of the non-linear system (Newton iteration numbers).

where only pressure and saturations are treated implicitly. stability increases. To make a simulation run fast. but in FIM models. Compared to nc unknowns per gridblock for the FIM model. This number is minimum for IMPES and maximum for FIM. we need to reduce the number of unknowns per gridblock from nc . However with the increase in number of implicit variables. In Quandalle and Savary’s paper. and all of the component mole fractions are treated explicitly. In IMPES models. Under these constraints. and we can use larger timestep size with fewer Newton iterations. the cost of each linear solve is fixed relative to nc . the cost of 1 each linear solve increases as O(nc . we only have n p unknowns per gridblock. the IMPSAT model is not new. and select a suitable implicit level that is fast enough and stable enough. Quandalle and Savary (1989) and Branco and Rodriguez (1995) also proposed similar ideas. typically we have two or three phases. because we always solve for one variable per gridblock. so the number of unknowns per gridblock for the IMPSAT model is three or less. We also like a model to only solve for a fixed number (relative to nc ) of unknowns per gridblock as is the case for the IMPES model. In reservoir simulation. the implicit level (number of implicit variables per gridblock) ranges from 1 in IMPES models to nc in fully implicit (FIM) models. The question here is how to balance these two factors.2 ) . implicit pressure and implicit saturations appear to be desirable. it was 91 . In fact.Chapter 4 IMPSAT Model and IMPSAT Based AIM Model The General Formulation Approach has the advantage of allowing selection of any level of implicitness. Here we propose the IMPSAT model.1~1. especially for problems with large number of components. For isothermal compositional models. because both variables are independent of the number of components. With the increase of implicit level. Thus the IMPSAT model has the potential to yield big savings in computational cost per linear solve. Since one of the saturations can be removed using the saturation constraint equation. the computational cost per Newton iteration also increases dramatically.

and they used it to simulate a laboratory experiment. In this chapter. Furthermore all of the tests were on small simple problems. we need to take a look at the variable coupling between gridblocks. 4.called IMPIMS (implicit pressure and implicit saturations) model.1 IMPSAT Model In this section. In order to prove that IMPSAT works in practice. each component flux within a phase can be expressed as the product of a transmissibility term and a pressure difference between two neighboring gridblocks: 92 . IMPSAT works very well for most cases. more work was needed in all of these areas. pressure. Hopefully this will lead to greater use of this method. As a matter of fact IMPSAT is an option in at least one of the commercial simulators. we will answer the following four questions about the IMPSAT model: Why does it work. it was called semiimplicit model. Each of them is coupled from gridblock to gridblock due to the flux terms in the mass balance equations. 4. no stability criteria were derived and no comparisons with the IMPES and FIM models were provided. IMPES+FIM (Forsyth and Sammon. 1986). saturation and mole fractions. For one-dimensional flow without gravity and capillary pressure. In this study we will show that when properly implemented. For the natural variable selection. what is its stability criterion. Neither paper provided a detailed analysis of the model. In Branco and Rodriguez’s paper. and several small test problems were used for validation.1 Why Does IMPSAT Work? In order to explain why IMPSAT works. then we will introduce a new IMPSAT based AIM model. what is its cost and how to build it most efficiently? In answering each question.1. especially for large field case studies. we have three types of variables. we will discuss advantages and disadvantages of IMPSAT compared to the IMPES and FIM models. we will first analyze various aspects of the IMPSAT model. where IMPSAT formulation is added into the traditional AIM model. but it does not work properly. We believe that this new AIM model can replace the traditional AIM model.

xc . which are also the ratio of the off-diagonal term to the diagonal term in the Jacobian matrix. the flux term will become a linear function of gridblock pressures: Fluxc . p .1) The transmissibility term has four parts. While the coupling between saturations and between mole fractions only exists in the transmissibility part. xc . Depending on the flow directions. The degree of coupling is different for each variable.2) Due to this. In reservoir simulation. x c .i = Fluxc . p . p = C ⋅ λ p ρ p xcp (4. and we need to solve for all of them together. a constant C. and a component mole fraction xcp . while saturations and mole fractions are loosely coupled from gridblock to gridblock. this transmissibility term is always evaluated at upstream conditions.3) From Eqn. gridblock by gridblock. Here.3. p . p i +1 ) (4.i −1 . The coupling between pressures exists in both the transmissibility part and the pressure difference part. p . the ratios of the flux term derivatives to the accumulation term derivatives are compared. S p .i = Fluxc . pressure is always strongly coupled from gridblock to gridblock. The IMPES model is based on this observation. p i +1 . as is the case for the FIM model. the flux term of gridblock i could depend on the variables in gridblock i. S p .i ( pi −1 .i +1 . we can see that. a phase mobility λ p which only depends on pressure and saturations.i −1 . and roughly 93 . If we fix the transmissibility term.i +1 ) (4.Fluxc . i+1 and i-1: Fluxc . For saturations and mole fractions. pi .i . Once this is done. and Tc . it ignores the coupling of saturations and mole fractions between gridblocks by treating the transmissibilities explicitly. p . S p . p . p . a phase density ρ p which only depends on pressure and component mole fractions. we make a new claim: the coupling between mole fractions is even weaker than the coupling between saturations. pressures are decoupled and can be computed implicitly followed by explicit updating of saturations and mole fractions. p i . p = Tcp ⋅ ∆p . 4. all of the variables are coupled from gridblock to gridblock.i .i ( pi −1 .

i . then component mole fractions are updated explicitly gridblock by gridblock. the large density and viscosity difference between the gas and the oil phases will enhance the movement of phase front. both pressure and saturations are simultaneously solved for first. p i . this ratio can be expressed as ∆( Flux) Ratio S = = ∆( ACC ) n nS p −1 ρp µp φρ p xcp x cp ∆p = n⋅( n S p −1 φµ p ∆p) (4.i +1 ) (4. p . 4.5) n Here we assume a power relation ( k rp = S p . p i +1 . and this coupling difference could be even larger. where the phase density and the component mole fraction in the transmissibility part are treated explicitly. the IMPSAT model should be more stable than the IMPES model. Based on these observations. p . Hopefully this improved stability will allow approximately the same size timesteps as in the FIM model. For three-dimensional problems.represent the degree of coupling between gridblocks for each variable. and the flux terms are only functions of pressures and saturations: Fluxc . we can see that the coupling between saturations is approximately n times stronger than the coupling between mole fractions. S p . S p .i ( pi −1 .4 with Eqn.i −1 . we propose the IMPSAT model.4) For mole fractions.5. 94 . 4. For saturations. this ratio can be expressed as n Sp ρp ∆p n µp S p −1 ∆ ( Flux) Ratio X = = =( ∆p) φρ p S p φµ p ∆( ACC ) (4. due to the gravity effect. The existence of capillary pressure will also increase this difference. which is generally weak.6) In the IMPSAT model.i = Fluxc . Comparing Eqn. Since we only ignore the coupling between mole fractions. since capillary pressure is assumed to be only a function of saturations. n ≥ 1 ) for phase relative permeabilities and ignore the dependency of phase densities on mole fractions. S p . Next we will derive the stability criterion for the IMPSAT model and compare it with the stability criterion of the IMPES model.

df g / dS g is shown as a function of S g in Figure 4.2 IMPSAT Stability Criterion In order to reduce the number of timesteps and Newton iterations. both the saturations and the component mole fractions are treated explicitly. which is ∆t ρ o q o xc + ρ g q g y c ≤1 CFLIMPSAT = Vφ ρ o S o xc + ρ g S g y c (4.7) In the IMPES model. but by how much? For a one-dimensional problem without gravity. we can see that. where Vc = ρo + S g ( ρ g Kc − ρo )   f / S o . k ro = S o2 .1.2.8. We can plot these two functions for a typical fractional flow curve 3 ( k rg = S g .1. when K c → 0 when K c = ρ o / ρ g (4.37 and Eqn. 4. µ o / µ g = 10 and ρ o / ρ g = 10 ). Note that df g / dS g has a maximum value of 2.44.44.8 can be simplified as q ∆t CFLIMPSAT = T ⋅ Vc ≤ 1 Vφ df g q ∆t . In the IMPSAT model. so its stability criterion only needs to satisfy Eqn. 3. 3.8) From these two equations. Vc is shown as a function of S g for different K c values in Figure 4.10) ρo + f g ( ρ g Kc − ρo )  o = 1.11)  f g / S g . when K c → ∞ The difference between these two CFL numbers depends directly on the relative size of df g / dS g and Vc . a more stable model than IMPES is desirable. Vφ λo + λ g ρ o qo xc + ρ g q g y c ) ≤1 ρ o S o xc + ρ g S g y c (4. 3. its stability criterion should satisfy both Eqn. Vc ) ≤ 1 CFLIMPES = T MAX ( Vφ dS g (4. only the mole fractions are treated explicitly. the IMPSAT model is always more stable than the IMPES model. which can be written as CFLIMPES λ g dλo λo dλ g qg − qo λo dS g λ g dS g ∆t = ⋅ MAX ( . Eqn.9) (4. 4.4.7 and Eqn. different K c values correspond to 95 .

5 0 0 0.5 1 0.1 0. If we include two extra variables xl .8 0.2 is around 1. we can say that the IMPSAT model is about two times more stable than the IMPES model.5 0.2. This is because lighter components are more likely to stay in the gas phase.2 0. this model (IMPSAT++) will become even more stable. we notice that lighter components have larger K c and Vc values. From Figure 4.6 0. so they cause more instability compared to the heavier components.different components. The maximum value in Figure 4.7 0. and lighter components have larger K c values since lighter components are more likely to stay in the gas phase.3 0. y l (component l is the lightest one) in the implicit variables. For this example.9 1 Sg Figure 4.5 2 dFg_dSg 1.1 df g / dS g as a function of S g 96 . which has a much higher flow rate than the oil phase due to its small viscosity. 3 2.4 0.4.

5 0. the large density and viscosity difference between the gas and the oil phases will enhance the movement of phase front. causing phase segregation.7 0.6 1.4 0. 97 .1. since the same initial overall composition was used for all depths.2 Kc=0.8 0.05 0 0 0. Up to 300 days gravity dominated the process. C2. Figure 4. Initially the reservoir was not at equilibrium.2 0. 2002).1 0. where gravity is important. After about 400 days gravity segregation is complete and the oil phase starts to cone around the producer.4 0.4 Kc=40 1.3 0. C4 and C7) compositional simulation with one corner producer completed only in the top layer (Cao. and the stability difference between the IMPSAT and the IMPES models will be much larger than two times.2 Vc as a function of S g for difference K c values For three-dimensional problems.9 1 Sg Figure 4.8 Kc=5 0.2 Kc=20 1 Kc=10 Vc 0. Here we compare their stable timestep sizes for a threedimensional (5x5x5) four-component (C1.3 shows the oil saturation at the well block.6 0.6 0.

the maximum stable timestep size ranged from 30 days to over 90 days. it was smaller than 2 days. and during the transition period between 300 and 400 days. also no problems were observed at the transition period.0.4 reports the maximum stable timestep size of the IMPES model. Figure 4. 4.8. which was calculated from Eqn.4 So 0. Here the maximum stable timestep size was around 13 days.3 Oil saturation at the well block Figure 4. Here. The ratio between these two stable timestep sizes is from 2 to 7 times. 4. which was calculated from Eqn.3 0.2 0.1 0 0 200 400 600 800 1000 1200 t (days) Figure 4.7. 98 .5 reports the maximum stable timestep size of the IMPSAT model.6 0.5 0.

16 14 12 10 dt (days) 8 6 4 2 0 0 200 400 600 800 1000 1200 t (days) Figure 4.4 Maximum stable timestep size for the IMPES model 100 90 80 70 dt (days) 60 50 40 30 20 10 0 0 200 400 600 800 1000 1200 t (days) Figure 4.5 Maximum stable timestep size for the IMPSAT model 99 .

For the IMPSAT model. The comparison between the IMPES and the IMPSAT models for larger CFL numbers are included in Chapter 5. it is necessary to analyze the cost of simulation for models with different implicit levels. We have demonstrated that the IMPSAT model is much more stable than the IMPES model. C Jac . N conn is the total number of connections FIM FIM between gridblocks.12 is the cost of calculating each of the FIM FIM N c × N c off-diagonal entries of the Jacobian matrix. how about the cost of the IMPSAT model compared to the costs of the FIM and IMPES models? In the next subsection.5 are for CFL=1. the IMPSAT model has even greater advantage than that demonstrated by the example.conn N conn N c2 ] (4. the stable timestep size of the IMPSAT model can be one order of magnitude larger than the stable timestep size of the IMPES model. For FIM models.12 is the cost of calculating each of the N c × N c diagonal entries of the Jacobian matrix.block and C Jac . 4. This means that in practice.1.The results in Figure 4. and it changes significantly from model to model. it can be expressed as FIM FIM TJac .block and 100 . we will analyze the cost of different compositional models. 4. FIM = N Newton [C Jac . and the second term in Eqn. In practice. The cost of the Jacobian construction depends on both the selection of primary variables and the implicit level. we can use a larger CFL number.4 and Figure 4. In compositional simulations. In general. the most time consuming parts for each Newton iteration are the Jacobian construction. for IMPES models.3 Cost of IMPSAT Model In order to compare the cost (CPU time) of the IMPSAT model with the costs of the FIM and IMPES models. and generally C Jac . here we provide some rough estimates for each model. The first term in Eqn. normally CFL=2 is fine (Coats.conn are the coefficients (constants). 2001). The cost of each part depends on implementation details of the individual simulators. the flash calculation and the linear solve.block and C Jac .conn are different FIM for different simulators and different variable selections. 4.block N block N c2 + C Jac .12) where N block is the total number of gridblocks. we have found that CFL=3 or 4 is generally a safe limit. for most three-dimensional problems. and C Jac .

the first two terms are the costs of calculating the full Jacobian matrix. the cost of the Jacobian construction can be expressed as IMPESAT IMPSAT TJac. whose size is ( N c N p )×( N c . For the IMPES model with Type A variables. 4.conn B N conn N c ) + CGFA N block ( N c − 1)] (4.13) where the first two terms are the costs of calculating the full Jacobian matrix. Eqn. whose size is ( N c -1)×( N c 1)).conn N conn N c N i ) + CGFA N block ( N c − N i ) 3 ] (4.block A N block N c2 + C Jac . the last term is the cost of reducing the implicit level from N c to 1 (inverting each small matrix D.blockB N block N c + CJac. For the IMPES model with Type B variables. For models with N i ( N i ≤ N c ) implicit variables.16) 101 .FIM C Jac .15) Similarly. where all of the off-diagonal entries are N c ×1 matrices.block N block N c2 + C Jac . IMPES _ A = N Newton [(C Jac . since the accumulation term of the mass balance equations can be simply expressed as [(φrc ) n +1 − (φrc ) n ] ⋅ V / ∆t .conn N conn N c N p ) + CGFA N block ( N c − N p ) 3 ] (4.15 (cost of the Jacobian construction) can be generalized as TJac = N Newton [(C Jac .IMPSAT = N Newton[(C Jac. because we need to use the chain rule to calculate the derivatives in the Type B FIM model.conn of the FIM model with Type B variables are larger than those of the FIM model with Type A variables. and the cost of the Jacobian construction is only IMPES _ IMPES _ TJac. and C GFA is the corresponding coefficient. the last term is the cost of reducing the implicit level from N c to N p (inverting each small matrix D.conn A N conn N c ) + CGFA N block ( N c − 1) 3 ] (4.block N block N c2 + CJac.N p )). all diagonal entries of the full Jacobian will only have non-zero terms at the diagonal and one column. where all of the off-diagonal entries are N c × N p matrices.14) For the IMPSAT model (Type A variables). the cost of the Jacobian construction is approximately given by IMPES _ IMPES _ TJac . and C GFA is the corresponding coefficient.IMPES _ B = N Newton[(CJac.

Ttotal = TJac + T flash + Tlinear _ solve (4.6).3. 4.1 ~ 1.1. In both the water mass balance equation (Eqn. the water mass balance equation only includes pressure and saturation dependent terms.2) and the total hydrocarbon mass balance equation (Eqn. we can see that if we know the total number of Newton iterations. we can roughly compare the costs of different models. The cost of each linear solve depends on the total number of implicit unknowns ( N block N i ). We have demonstrated that the IMPSAT model is much more stable than the IMPES model in Subsection 4.4 How to Build IMPSAT Efficiently? There is a very simple way to build the IMPSAT model.2 and compared its cost with the costs of the FIM and IMPES models in Subsection 4. Next we will introduce an efficient way to construct the IMPSAT model. only pressure and saturations appear explicitly.18) where C solver and n solver depend on the linear solver used. For the total hydrocarbon mass balance equation. 4.19) From Eqn. then it will only include 102 .19. and it can be written as Tlinear _ solve = N Newton [C solver ( N block N i ) nsolver ] (4. Typically n solver = 1.1. and C solve and n flash depend on the solver used.2 for good iterative linear solvers. The total cost of simulation is the summation of the costs of these three parts. 1. if we ignore the dependency of hydrocarbon phase densities on component mole fractions. 1.The cost of the flash calculation is independent of the implicit level. 4.1.17) where the first term is the cost of calculating the N c × N c flash Jacobian matrix for each flash gridblock and the second term is the cost of solving it. Since the water phase density depends only on pressure.13 to Eqn. and it can be expressed as flash flash T flash = N Newton [C Jac N block N c2 + C solve N block N c flash ] n (4. and it can be directly used as an IMPSAT equation without any reduction.

and this model is the most stable one.pressure and saturation dependent terms and can be directly used as another IMPSAT equation without any reduction. where all of the operations are done gridblock by gridblock. we call the new AIM model the IMPSAT based AIM model. There are three variations of the new IMPSAT based AIM model: • IMPES+IMPSAT Here we use the IMPSAT model to replace the FIM model. While FIM is always stable. • IMPSAT+FIM Here we use the IMPSAT model to replace the IMPES model. and the cost of this operation is about 3 times the cost of building an IMPES model. and even IMPSAT is not stable enough. it is just too expensive. and the cost is doubled. Actually. 1986). more stable and less expensive. especially for problems with a large number of components. 103 . All of these AIM models are very easy to build using the General Formulation Approach proposed in Chapter 3. the reduction steps in Chapter 3 need to be performed on the remaining nc − 1 hydrocarbon component mass balance equations to get two more IMPSAT equations. IMPES timestep size is too small to be practical. it is more flexible. the first two AIM models and the traditional AIM model are all special cases of this general AIM model. 4.2 IMPSAT Based AIM Model For large and difficult problems. So we only need to use the reduction steps in Chapter 3 on the remaining nc − 2 hydrocarbon component mass balance equations to get one more IMPSAT equation. If we consider the dependency of hydrocarbon phase densities on component mole fractions. and this model is the most general one. IMPSAT needs three equations for three-phase flow. In such cases. and this model is the least expensive one in terms of cost per Newton iteration. Compared to the traditional AIM (IMPES+FIM) model. and we already have two. • IMPES+IMPSAT+FIM Here we use the IMPSAT model as the third formulation in the new AIM model. and we can control the implicit level at each gridblock separately. we propose adding the IMPSAT model into the traditional AIM model (Forsyth and Sammon.

IMPSAT and FIM gridblocks. For easy problems.Depending on different types of flow problems. IMPES+IMPSAT+FIM should be the most efficient model to use. one of these new AIM models will outperform the traditional AIM model. With properly tuned percentages of IMPES. IMPSAT+FIM is a better choice. 104 . IMPES+IMPSAT is the best to use. especially for large field case studies. for hard problems.

the following condition should be satisfied: • • • • • Scaled mass balance equation residuals are less than 0. The second set is used to evaluate the performance of different compositional models. it is worthwhile to discuss the convergence controls used in GPRS. FIM and AIM). The maximum absolute component mole fraction change is less than 0. These are scaled by the component fugacities in the gas phase.Chapter 5 Model Validation and Performance In this chapter. This limit is set to 10-4.1 2 / B 2 ). Validation of GPRS Here we show validation results for the black-oil and the compositional models in GPRS The black-oil model results are compared with the results from Eclipse 100 (Geoquest. The results from this set are compared with the results from existing simulators. Equations are scaled by the accumulation terms (component mass dividing timestep size). Scaled phase equilibrium relation residuals are less than 0. we will present two sets of results. and the compositional model results are compared with the results from Eclipse 300 (Geoquest. We have also tested the unstructured grid handling and multi- 105 . the convergence of Newton iterations is governed by both the maximum residual and the maximum variable change. The maximum absolute saturation change is less than 0.02.001.005. Here we compare the performance of IMPSAT and IMPSAT based AIM models with the traditional models (IMPES. The convergence of iterative linear solvers is governed by the normalized linear equation residual ( B − AX 5. The maximum scaled pressure change (absolute pressure change divided by the average reservoir pressure) is less than 0.0001. Before we start showing the results from GPRS and comparing them with the results from other simulators. In GPRS.1. 2000A). At convergence. 2000A). the first set is used to validate individual models and techniques implemented in GPRS.

a three-phase black-oil simulation of a quarter of a 5-spot. Figure 5. Figure 5.point flux approximations in GPRS.1. 1). 1. This grid is 10×10×3. The gas was not allowed to re-dissolve. Initially. and Eclipse 100 results are shown in solid lines. 1996). 5. The simulation was run to 10 years with a maximum timestep size of 180 days. 1981). and the results from GPRS are compared with the results from Eclipse 100.2 shows the oil production rate.3 show the results from GPRS and Eclipse 100. plateau production up until around 1000 days.1 Black-oil reservoir Both simulators used the same number of timesteps (32) and Newton iterations (114). and both simulators were run in fully implicit mode. Compositional formulation was used to simulate this black-oil problem in GPRS. shown in Figure 5. GPRS results are shown in dots. Besides that. and compared our results with the results from FLEX (Verma. we will also show validation results for the General Formulation Approach (different variable selections and implicit levels).1 Black-oil Model This is the first SPE comparative project (Odeh. Finally.3 shows the gas oil ratio (GOR) at the 106 . gas WOC Figure 5. One gas injector is located at (1. Figure 5. whose results are compared with the results from Eclipse 100. and both wells are under constant rate control. 3). 10.2 and Figure 5. the reservoir is full of undersaturated oil and connate water. Each layer has different properties.1. and one oil producer is located at (10. we include a non-conventional well problem. then the producer changes to bottom hole pressure (BHP) control.

3 Gas oil ratio at the producer from GPRS and Eclipse 100 107 .producer. GOR is constant. there is no free gas. which means that we have excellent agreement between GPRS and Eclipse 100. after around 660 days. 20000 18000 oil production rate (STB/day) 16000 Eclipse 14000 G PR S 12000 10000 8000 6000 4000 0 500 1000 1500 2000 2500 3000 3500 4000 tim e (days) Figure 5. and GOR increases. Basically. free gas appears. initially.2 25 Oil production rate at the producer from GPRS and Eclipse 100 20 Eclipse GOR (MSCF/STB) GPRS 15 10 5 0 0 500 1000 1500 2000 2500 3000 3500 4000 time (days) Figure 5. the results from these two simulators are the same.

two-phase (gas-oil) compositional simulation (Cao.1.5 Newton iterations per timestep. and the results from GPRS are compared with the results from Eclipse 300 (Geoquest.1 Newton iterations per timestep. GPRS took an average of 2. Both simulators were run in fully implicit mode. In Eclipse 300. 5. which is under bottom hole pressure (BHP) control (shown in Figure 5. Figure 5.4). The simulations were run to 1000 days with a maximum timestep size of 30 days.1 atm for absolute pressure change and 0. while Eclipse 300 used 38 timesteps). Initially the reservoir has both the oil and gas phases. Also their limits are larger than the limits used in GPRS. One producer is located at (5. Both simulators quickly reached the maximum timestep size of 30 days. The grid is 5×5×5. while Eclipse 300 uses Type B variables (pressure and overall molar density of each component). The Peng-Robinson Equation of State (Peng and Robinson. 1). and used roughly the same number of timesteps (GPRS used 39 timesteps. while Eclipse 300 took an average of 2. 2000A). The slight increase of Newton iteration number in GPRS was caused by the difference in Newton iteration convergence control in the two simulators.2 Compositional Model This is a four-component. while GPRS uses 0. 1976) was used for flash calculations.0001 for maximum scaled pressure 108 .01 for effective saturation change.5. only the maximum change of pressure and effective saturations (the effective saturation change for a given molar density change) are used for convergence control (Geoquest. 2002).4 Compositional reservoir GPRS uses Type A variables. 2000A). Eclipse 300 uses 0.

1.5)_gprs prod_ecl prod_gprs oil saturation 0.5)_ecl (1.change and 0. Figure 5.3 0.005 for absolute saturation change.8 0.7 (1 .1.5)_gprs 500 pro d_ecl pro d_gprs 450 pressure (psia) 400 350 300 0 200 4 00 600 800 1000 1200 tim e (days) Figure 5.5) pressures from GPRS and Eclipse 300 with ∆tmax=30 days 1 0.6 Well block and block (1.5 0.5)_ec l (1 .5 Well block and block (1.1.4 0.1 0 0 200 400 600 800 1000 1200 tim e (days) Figure 5.5 and Figure 5.5) oil saturations from GPRS and Eclipse 300 with ∆tmax=30 days 109 .9 0.1. 550 (1.6 0.6 compare the results from GPRS with the results from Eclipse 300.1.1.2 0.

5 shows the pressure at block (1.1). 1 0.5 0. By reducing the maximum timestep size from 30 days to 10 days in Eclipse 300.6 shows the oil saturation at these two blocks. the results improve as shown in Figure 5.1.1. and the blue lines are for block (1. probably still due to the loose convergence control. GPRS results are shown in dots.2 and Figure 5.7 (1.5). Eclipse 300 used a maximum timestep size of 10 days.5) and at the producer (5. and at times it performs even better than the model in Eclipse 300.9 0. The black lines are for producer (5. there is still a small glitch (around 330 days) in Eclipse 300 results.5)_ecl (1. Hence we can conclude that the compositional model in GPRS works well. Actually Eclipse 300 goes to the next timestep without full convergence in the current timestep. we notice that.7 Well block and block (1. even for 10 days.1). From Figure 5.6 0. Now these two results are almost on top of each other.2 0.5) oil saturations from GPRS and Eclipse 300 with ∆tmax=30 days for GPRS and ∆tmax=10 days for Eclipse 300 110 . Figure 5.3.1 0 0 200 400 600 800 1000 1200 time (days) Figure 5.4 0.5.8 0.6 we can notice a glitch (around 90 days) in Eclipse 300 results. and GPRS still used 30 days. Figure 5. and Eclipse 300 results are shown in solid lines.5)_gprs prod_ecl prod_gprs oil saturation 0. From Figure 5.7.1.Similar to the results in Figure 5.7.1.5. The oil saturation at the producer block from the two simulators does not match very well.1.3 0. the reason is that Eclipse 300’s convergence criteria (pressure and effective saturation changes) are not as strict as those used in GPRS.

5. a) triangular elements Figure 5. and about 30% of the connections use multi-point flux calculations. 2002). 1996) We ran this problem using GPRS and compared its results with the results from FLEX (Prevost.8 b) control volumes Unstructured grid (Verma. We can conclude that the unstructured grid handling and multi-point flux approximations in GPRS work well.9 shows the water cut at the producer. Considering the differences in these two simulators. the results compare well. Figure 5. Both wells are at constant rate control. one water injector is located at the lower-left corner and one producer is located at the upperright corner.8b shows the control volumes (gridblocks). This is a quarter of a five spot simulation of a homogeneous black-oil (water-oil) reservoir (Cao. This problem has 301 gridblocks. 2002). Most of the multi-point fluxes are around the wells.1. Figure 5. There is only a small discrepancy at the water breakthrough time. 838 connections.3 Unstructured Grid and Multi-Point Flux A test problem pieced together from Verma (1996) was used to validate the implementation of unstructured grids and multi-point flux in GPRS. and Figure 5. 111 .8a shows the triangular elements. where the gridblocks are irregular. The grid is a two-dimensional (x-y) triangular grid with local grid refinements around the wells.

11 compare the results of the FIM model with Type A and Type B variables.1 0.5 0.9 5.6 WCT 0.4 0.10 shows the gridblock pressure at the producer and Figure 5.1. Figure 5.12 and Figure 5.9 0. the IMPSAT model (the first two primary variables are implicit) and the IMPES model (only pressure are implicit).11 shows the oil saturation at the producer. Type A results are shown in solid lines. Here we compare the results of models with different variable selections and implicit levels. From these results. and Type B results are shown in dots.10 and Figure 5. Figure 5. The results from both FIM models match exactly.12 shows the gridblock pressure at the producer and Figure 5. the IMPSAT++ model (the first three primary variables are implicit). this is because they are solving the same equations and at convergence they should have the same solutions. Figure 5.13 compare the results of models of Type A variables with different implicit levels. Figure 5.1 0 0 5000 10000 15000 20000 FLEX GPRS time (days) Figure 5.2. C4. C2.3 0. C7) two hydrocarbon phase problem that was used to validate the compositional modeling in Subsection 5. we can see that 112 .2 0. and they are the FIM model (all four primary variables are implicit).4 Water cut results from GPRS and FLEX for unstructured grid General Formulation Approach This is the same homogeneous 5×5×5 four component (C1.1.8 0.7 0.13 shows the oil saturation at the producer. The maximum timestep size of 30 days was used for all runs.

1 0 0 200 400 600 800 1000 1200 tim e (days) Figure 5. 550 pressure at the producer (psia) 500 Type A Type B 450 400 350 300 0 200 400 600 800 1000 1200 time (days) Figure 5. and the results from the other three models are basically the same.11 Well block oil saturation for the FIM model with Type A and Type B variables 113 .4 0.3 0.6 0.10 Well block pressure for the FIM model with Type A and Type B variables 0.5 Type A Type B 0.2 0.7 oil saturation at the producer (psia) 0.the IMPES results have less numerical diffusion.

4 IMPES 0.12 0.13 Well block oil saturation for models with different implicit levels 114 .7 Well block pressure for models with different implicit levels oil saturation at the producer (psia) 0.2 0.5 0.6 FIM IMPSAT++ IMPSAT 0.3 0.1 0 0 200 400 600 800 1000 1200 time (days) Figure 5.550 pressure at the producer (psia) 500 FIM IMPSAT++ 450 IMPSAT IMPES 400 350 300 0 200 400 600 800 1000 1200 time (days) Figure 5.

shown in Figure 5.5 Non-conventional Well This is the same 10×10×3 three-phase black-oil problem that was used to validate the black-oil modeling in Subsection 5. GPRS results are shown in dots.16 shows the gas oil ratio (GOR) at the producer. Compositional formulation was used to simulate this black-oil problem in GPRS.1. and both simulators were run in fully implicit mode.14 Black-oil reservoir with a dual-lateral producer Figure 5. the producer is replaced by a BHP controlled dual-lateral well. 3) and (10.15 and Figure 5. the reservoir is full of undersaturated oil and connate water. 3). 115 . which is located at (6-10. 6-10. 10. gas WOC Figure 5.1. Initially. and the results from GPRS are compared with the results from Eclipse 100.16 show the results from GPRS and Eclipse 100.14. Figure 5. Here.15 shows the oil production rate and Figure 5. The results from these two simulators are almost the same. The gas was not allowed to re-dissolve.5.1. The simulation was run to 10 years with a maximum timestep size of 180 days. and Eclipse 100 results are shown in solid lines.

15 Oil production rate at the producer from GPRS and Eclipse 100 for a dual-lateral well problem 30 25 GOR (MSCF/STB) 20 15 10 Eclipse GPRS 5 0 0 500 1000 1500 2000 2500 3000 3500 4000 time (days) Figure 5.16 Gas oil ratio at the producer from GPRS and Eclipse 100 for a dual-lateral well problem 116 .250000 oil production rate (STB/day) 200000 Eclipse 150000 GPRS 100000 50000 0 0 500 1000 1500 2000 2500 3000 3500 4000 time (days) Figure 5.

y1 . we will first introduce compositional problems used. In this section. For Type B variables. y1 . we also report the iteration counts (number of timesteps. then evaluate the performance of individual compositional models. S g . and p g . with the four mass balance equations as the primary equations. x2 .So far. the IMPSAT model with Type A variables and the traditional and new AIM models.2 Performance of Compositional Models in GPRS A series of compositional problems were used to evaluate the performance of different compositional models. y 2 . and p g . S g . The size of these problems ranges from 125 gridblocks to 100. These conditions include injection of components. The compositional models evaluated here include fully implicit (FIM) models with both types of variables (Type A and Type B). r2 . y 3 . For a four hydrocarbon component and two hydrocarbon phase problem. y 2 . y 2 are the primary variables. the full set of variables is p g . The performance of compositional models is evaluated under different conditions. we have shown that the basic modules of GPRS work well. where yi and xi are the component mole fractions in the gas and oil phases. All of the simulations were performed on a SGI origin 200 workstation. x1 . x3 . S g . IMPES models with both types of variables. The performance of individual compositional models is independent of the grid type and the method of flux approximation. heterogeneity. r1 . where ri are the overall densities of hydrocarbon components. large number 117 . number of total Newton iterations and number of total linear solver iterations) and the timing results (solver time and total running time) for each problem and each model. r2 .000 gridblocks. For Type A variables. the full set of variables is p g . y1 . the full set of equations (total 8) include the mass balance equations and the phase equilibrium relations for each hydrocarbon component. r3 . number of components ranges from 4 to 9. Each problem is designed for one specific condition. so in this part we will use Cartesian grids and two-point flux approximations for all problems. we can now start to evaluate the performance of different compositional models using various compositional problems. Here both Type A and Type B variables were used. y 3 . 5. r1 . with both homogeneous and highly heterogeneous domains. Besides the simulation results. r3 are the primary variables.

with four components (C1. The primary objective here is to test the performance of different models on a difficult heterogeneous problem. and it is virtually 118 . this problem is hard for both IMPES and IMPSAT. shown in Figure 5.17. but here an injector is added to increase the difficulty.of components and large systems.000 gridblocks (100×100×10) and four components (C1. The grid is 24×1×25. this problem is hard for both IMPES and IMPSAT. C3. C2. and one bottom hole pressure controlled producer is located at (5. this problem has much smaller gridblocks (100ft×100ft×10ft compared to 1000ft×1000ft×10ft for other problems). • Case 3 This is a heterogeneous problem. One bottom hole pressure controlled producer is located at (1. The grid is 5×5×5 with homogeneous permeability. C4. 1. 1-3). C7+1. and both IMPES and IMPSAT should perform well. This problem is difficult for the IMPSAT model. Compared to other problems. The five compositional problems used here are discussed below (Cao. and it penetrates only the top three layers. The fluid description is from the 3rd SPE comparative project (Kenyon and Behie. 1). • Case 2 This is the same problem as in Case 1. Due to the large number of components. C4. C7) two hydrocarbon phase problem that was used to validate the compositional modeling in GPRS. and it penetrates only the top two layers.5 days. N2. C7+2 and C7+3. C2. One bottom hole pressure controlled producer is located at (100. 5. 100. C2. One bottom hole pressure (BHP) controlled producer is located at (5. It is under bottom hole pressure control and C1 is injected. C4. 1). C7) and two hydrocarbon phases. C4-6. The permeability field is from the 9th SPE comparative project (Killough. 1-2). Only the top layer. C2. is used. Due to high flow rates in the high permeability regions. 5. 1995). 1987). and the nine components are CO2. This is a relatively easy problem. 2002): • Case 1 This is the same homogeneous 5×5×5 four component (C1. 1). • Case 4 This is a nine-component problem. because a component is injected when the component mole fractions are treated explicitly. This small gridblock size limits the maximum stable timestep size of IMPSAT to around 0. 1. C7). C1. The injector is located at (1. • Case 5 This is a large homogeneous problem with 100. The permeability changes over four orders of magnitude and it is correlated along the x direction.

next we will show the performance of GPRS for each type of compositional model. The stability of the IMPES+IMPSAT model is even worse than the stability of the IMPSAT model. starting from the FIM model. so it was also not used. 1976) was used for flash calculations.impossible to run the problem with this model. Figure 5.17 Heterogeneous permeability field (lnk) for Case 3 5. Figure 5. 30 and 100 days (For Case 5.1 Fully Implicit Models The FIM model with both Type A and Type B variables was used.22 show the well block oil saturation for each 119 . All of the simulations were run to 1000 days. only timestep sizes of 30 and 100 days were used). Model performance is compared for different problems and different timestep sizes. and the Peng-Robinson EOS (Peng and Robinson. The maximum timestep sizes tested were 5.18 to Figure 5. only the FIM and AIM models were used. Now that we have introduced all of the problems. So for this problem. The stability restriction is even worse for IMPES models.2.

3 0. Type A variable results are drawn in lines. • • With the increase of timestep size. 0.7 A_5days 0.6 B_5days A_30days 0. we can draw the following conclusions: • For the same maximum timestep size.2 0.1 0 0 200 400 600 800 1000 1200 time (days) Figure 5. These three observations are true for all compositional problems. there is more numerical diffusion for both FIM models and the results are more smoothed out. From these results.problem. Both FIM models are always stable.4 B_100days oil saturation at the producer 0. and the legend in each figure marks the model used. and Type B variable results are drawn in dots.18 Well block oil saturation comparisons for FIM models and Case 1 problem 120 .5 B_30days A_100days 0. such as B_30days stands for Type B FIM model with a maximum timestep size of 30 days. both FIM models match exactly. this is because they are solving the same equations and at convergence they should have the same solutions.

2 A_30days B_30days 0.20 Well block oil saturation comparisons for FIM models and Case 3 problem 121 .3 A_5days B_5days 0.7 0.53 0.4 0.6 oil saturation at the producer 0.55 0.51 0.61 0.49 0.0.19 Well block oil saturation comparisons for FIM models and Case 2 problem 0.5 0.1 A_100days B_100days 0 0 200 400 600 800 1000 1200 time (days) Figure 5.45 0 200 400 600 800 A_30days B_30days A_100days B_100days 1000 1200 time (days) Figure 5.47 0.59 A_5days B_5days oil saturation at the producer 0.57 0.

2 0.05 0 0 200 400 600 800 A_30days B_30days A_100days B_100days 1000 1200 time (days) Figure 5.58 0.22 Well block oil saturation comparisons for FIM models and Case 5 problem 122 .35 A_5days B_5days oil saturation at the producer 0.4 0.0.595 0.585 0.21 Well block oil saturation comparisons for FIM models and Case 4 problem 0.6 oil saturation at the producer 0.3 0.57 0.56 0.555 0 200 400 600 800 1000 1200 A_30days B_30days A_100days B_100days time (days) Figure 5.1 0.25 0.605 0.15 0.575 0.565 0.59 0.

5.58 3. This is true for all of the other comparisons between models using these two types of variables. such as ILU0 and BlitzPak. This is because the system becomes less diagonally dominant as the timestep size increases.1 Iteration and timing comparisons for FIM models and Case 1 problem 123 .86 4. In summary. and we observe the same trend for all of them. A_5days N timesteps NNewton iters _ Nsolver_ iters B_5days 202 420 1135 11. the increase in CPU time can be as much as 30%. and in some cases.Iteration counts and timing results for problems discussed above are presented in Table 5. Type A FIM model costs less than Type B FIM model.1 to Table 5. the CPR preconditioned GMRES method was used to solve the linear system. since it needs to use the chain rule to calculate the derivatives. • Type B FIM model is also more costly in building the Jacobian matrix. For all of the fully implicit runs. with the increase of timestep size. more Newton iterations are needed at each timestep and more linear solver iterations are needed to solve each linear system.44 A_30days 39 98 229 2.52 23. so we can only compare the relative cost of these two types of models. Type B FIM model takes more time on the linear solver.38 B_100days 18 56 221 1.83 B_30days 39 98 363 3. at least for the problems tested here. • • There is no significant difference in the number of Newton iterations between these two FIM models.15 7.66 5. the total cost is also substantially higher. We also tried other solvers and preconditioners.56 Tsolver(sec) Ttotal (sec) Table 5.57 202 420 728 10. With the higher solver cost. Type B FIM model generally takes more linear solver iterations than Type A FIM model.88 A_100days 18 56 143 1. The implementations of Type A models are more efficient than the implementations of Type B models in GPRS because of the variable switching.83 31. As a result. We can draw the following conclusions based on our analysis: • For both FIM models.

76 B_100days 21 65 256 14.03 29.96 48.69 14.12 Tsolver(sec) Ttotal (sec) Table 5.23 36.44 Tsolver(sec) Ttotal (sec) Table 5.2 Iteration and timing comparisons for FIM models and Case 2 problem A_5days N timesteps NNewton iters _ Nsolver_ iters B_5days 202 413 1647 53.81 A_100days 18 63 187 2.76 B_30days 38 99 483 14.84 9.3 Iteration and timing comparisons for FIM models and Case 3 problem A_5days N timesteps NNewton iters _ Nsolver_ iters B_5days 22 417 1197 80.39 202 428 945 11.65 A_30days 38 99 248 11.96 B_100days 17 58 272 8.65 A_100days 21 64 213 13.A_5days N timesteps NNewton iters _ Nsolver_ iters B_5days 202 429 1538 14.02 24.35 B_30days 39 107 493 4.87 21.27 A_100days 17 58 153 6.81 A_30days 41 110 349 22.41 98.4 Iteration and timing comparisons for FIM models and Case 4 problem 124 .6 B_100days 18 63 298 3.2 33.64 202 417 1012 77.36 6.73 7.66 25.04 21.4 4.26 Tsolver(sec) Ttotal (sec) Table 5.53 138.16 174.39 202 413 826 42.64 35.26 B_30days 41 110 410 22.9 128.78 A_30days 39 109 300 3.

both IMPES models match exactly. From these results. the stable time step sizes of the IMPES model are small. • For the same timestep size.5 days to 16 days. and the legend in each figure marks the model used. and Type B variable results are drawn in dots. This is because the CFL limit of IMPES depends on the fractional flow derivative with respect to the saturation (saturation velocity). CFL=1 is always stable. we can draw the following conclusions: • For all compositional problems tested here. • Compared to the FIM model. but CFL=2 may not be always stable. Figure 5. • The stable timestep sizes of the IMPES model have sudden jumps. the IMPES model has less numerical diffusion (shaper fronts). Figure 5. 125 . The fully implicit result (the dark solid line) for maximum timestep size of 30 days is included for comparison.A_5days N timesteps NNewton iters _ Nsolver_ iters B_5days X X X X X A_30days 39 115 483 9050 12680 B_30days 39 115 638 18490 24321 A_100days 19 79 379 6782 9292 B_100days 19 79 540 13490 17192 X X X X X Tsolver(sec) Ttotal (sec) Table 5.27 to Figure 5. such as B_CFL=2 stands for Type B IMPES model with a maximum CFL number of 2. Model performance is compared for different problems and different CFL numbers (larger CFL numbers lead to larger timestep sizes).23 to Figure 5.30 show the well block oil saturation for each problem. Type A variable results are drawn in lines. and gas flow is hard to handle for the IMPES model due to its high mobility.5 Iteration and timing comparisons for FIM models and Case 5 problem 5. This is because in compositional simulations. Both CFL=1 and CFL=2 were used. it is discontinuous.26 show the stable timestep size (CFL=1) for each problem. gas phase is always present. ranging from 1. this is because they are solving the same IMPES equations and at convergence they should have the same solution. due to the explicit treatment of transmissibilities. which causes the sudden jump.2 IMPES models IMPES models with both Type A and Type B variables were used.2. and at the saturation front.

and CFL=1 or 1.5 is a safe limit. But with the increase of number of components. 16 14 maximum stable timestep size 12 10 8 6 4 2 0 0 200 400 600 800 1000 1200 time (days) Figure 5.• For Case 1. IMPES with CFL=2 is stable or nearly stable. such as in Case 4. this limit is reduced.24 Stable timestep size for the IMPES model and Case 2 problem 126 .23 Stable timestep size for the IMPES model and Case 1 problem 18 16 maximum stable timestep size 14 12 10 8 6 4 2 0 0 200 400 600 800 1000 1200 time (days) Figure 5. 2 and 3.

26 Stable timestep size for the IMPES model and Case 4 problem 127 .25 Stable timestep size for the IMPES model and Case 3 problem 6 5 maximum stable timestep size 4 3 2 1 0 0 200 400 600 800 1000 1200 time (days) Figure 5.14 12 maximum stable timestep size 10 8 6 4 2 0 0 200 400 600 800 1000 1200 time (days) Figure 5.

6 oil saturation at the producer 0.28 Well block oil saturation comparisons for IMPES models and Case 2 problem 128 .27 Well block oil saturation comparisons for IMPES models and Case 1 problem 0.3 0 0 200 400 600 800 1000 1200 tim e (days) Figure 5.4 FIM A_CFL=1 0.1 0 0 200 400 600 800 1000 1200 tim e (days) Figure 5.2 B_CFL=1 A_CFL=2 0.7 FIM 0.6 oil saturation at the producer A_CFL=1 0.1 B_CFL=2 0.4 B_CFL=2 0.5 0.5 B_CFL=1 A_CFL=2 0.2 0.3 0.7 0.0.

49 0.47 0.55 0.30 Well block oil saturation comparisons for IMPES models and Case 4 problem 129 .45 0 200 400 600 800 B_CFL=1 A_CFL=2 B_CFL=2 1000 1200 tim e (days) Figure 5.0.35 FIM A_CFL=1 0.15 0.61 0.1 0.2 0.25 0.05 0 0 200 400 600 800 1000 1200 B_CFL=1 A_CFL=2 B_CFL=2 oil saturation at the producer tim e (days) Figure 5.29 Well block oil saturation comparisons for IMPES models and Case 3 problem 0.59 FIM A_CFL=1 oil saturation at the producer 0.51 0.57 0.53 0.4 0.3 0.

A_CFL=1 N timesteps N Newton _ iters N solver _ iters B_CFL=1 146 301 598 0. But in practice. This is because both IMPES models generate the same pressure system. We can draw the following conclusions based on our analysis: • For both IMPES models.66 A_CFL=2 80 174 343 0.6 Iteration and timing comparisons for IMPES models and Case 1 problem 130 .89 8.9.98 Tsolver (sec) Ttotal (sec) Table 5.Iteration counts and timing results for problems discussed above are presented in Table 5. as shown in the tables. and the scalar difference between them is not enough to make any difference in linear solver performance.82 B_CFL=2 80 174 344 0. due to lower cost in Jacobian matrix construction.94 146 301 597 0. with the increase of CFL number (timestep size).6 to Table 5.83 7. Type B IMPES model uses less time than Type A IMPES model. Hence Type B IMPES model should be more efficient from the point of view of Jacobian matrix construction. • • There is no significant difference in Newton iteration numbers between these two IMPES models. Number of linear solver iterations is also about the same for these two IMPES models. Type B IMPES model can be built directly from the mass balance equations.89 13. more Newton iterations are needed at each timestep and more linear solver iterations are needed to solve each linear system. 1999). For all of the IMPES runs.83 11. This increases the cost for Jacobian calculations in Type B models. In this case Type B model will require fewer operations than Type A model to form the pressure system (Coats. the AMG preconditioned GMRES method was used to solve the linear system. while our results don't show this. In summary. This is because the pressure system becomes less diagonally dominant as the timestep size increases. • Type B models are built from Type A models by variable switching in GPRS.

61 A_CFL=2 237 672 1342 2.17 74.2 44.95 14.11 Tsolver (sec) Ttotal (sec) Table 5.63 482 991 1979 3.A_CFL=1 N timesteps N Newton _ iters N solver _ iters B_CFL=1 214 440 2974 0.6 15.77 15.65 B_CFL=2 54 112 224 1.65 107 218 436 3.6 15.82 209.62 105.52 B_CFL=2 237 671 1341 2.9 Iteration and timing comparisons for IMPES models and Case 4 problem 131 .78 10.53 A_CFL=2 54 112 224 1.95 20.7 Iteration and timing comparisons for IMPES models and Case 2 problem A_CFL=1 N timesteps N Newton _ iters N solver _ iters B_CFL=1 107 218 436 3.49 Tsolver (sec) Ttotal (sec) Table 5.99 214 442 2995 0.9 Tsolver (sec) Ttotal (sec) Table 5.55 149.99 B_CFL=2 114 246 1989 0.21 29.8 Iteration and timing comparisons for IMPES models and Case 3 problem A_CFL=1 N timesteps N Newton _ iters N solver _ iters B_CFL=1 482 991 1980 3.53 A_CFL=2 114 249 2008 0.

and the slight differences between the two are mostly due to the differences in timestep size. • The results of the IMPSAT model agree well with the results of the FIM model. compared with the stable timestep size of the IMPES model. the timestep size of IMPSAT reached 100 days. But with the increase of number of components. • For Case 1. Figure 5. • The stable timestep sizes of IMPSAT always change smoothly.3 IMPSAT model The performance of the IMPSAT (implicit pressure and implicit saturations) model is evaluated for different problems and different CFL numbers (larger CFL numbers lead to larger timestep sizes). while for IMPES we observed sudden jumps. the IMPSAT model should have less numerical diffusion than the FIM model. CFL=1. Figure 5. and CFL=2 or 2. The CFL limit of the IMPSAT model depends on the component velocity. For some problems. 2 and 3. In the IMPSAT model.5 is a safe limit.35 to Figure 5. The fully implicit result (the dark solid line) for maximum timestep size of 30 days is included for comparison. ranging from 6 days to 90 days. we observe the same level of numerical diffusion for the IMPSAT and FIM models. 132 .34 show the stable timestep size (CFL=1) for each problem. such as CFL=2 stands for the IMPSAT model with a maximum CFL number of 2. saturation is treated implicitly. but CFL=2 and CFL=4 may not be always stable. however for the problems tested here. we can draw the following conclusions: • The stable timestep sizes for the IMPSAT model are quite good. • In theory.2. 2 and 4 were used. while for FIM the maximum timestep size was limited to 30 days.31 to Figure 5. such as Case 1 and 3. IMPSAT with CFL=4 is stable. and the legend in each figure marks the model used. which is 2 to 7 times larger than that for the IMPES model. this limit is also reduced. From these results. CFL=1 is always stable. so the existence of gas flow does not create any problem.5. such as in Case 4.38 show the well block oil saturation for each problem.

31 Stable timestep size for the IMPSAT model and Case 1 problem 35 30 maximum stable timestep size 25 20 15 10 IMPSAT 5 IMPES 0 0 200 400 600 800 1000 1200 time (days) Figure 5.100 90 maximum stable timestep size 80 70 60 50 40 30 20 10 0 0 200 400 600 800 1000 1200 IMPSAT IMPES time (days) Figure 5.32 Stable timestep size for the IMPSAT model and Case 2 problem 133 .

30

25

maximum stable timestep size

20

IMPSAT

15

IMPES

10

5

0 0 200 400 600 800 1000 1200

time (days)

Figure 5.33

Stable timestep size for the IMPSAT model and Case 3 problem

30

25

maximum stable timestep size

20

15 IMPSAT 10 IMPES 5

0 0 200 400 600 800 1000 1200

time (days)

Figure 5.34

Stable timestep size for the IMPSAT model and Case 4 problem

134

0.7 FIM 0.6 CFL=1

oil saturation at the producer

0.5

CFL=2 CFL=4

0.4

0.3

0.2

0.1

0 0 200 400 600 800 1000 1200

tim e (days)

Figure 5.35

Well block oil saturation comparisons for the IMPSAT model and Case 1 problem

0.7 FIM 0.6 CFL=1 CFL=2 0.5 CFL=4 0.4

oil saturation at the producer

0.3

0.2

0.1

0 0 200 400 600 800 1000 1200

tim e (days)

Figure 5.36

Well block oil saturation comparisons for the IMPSAT model and Case 2 problem

135

0.61 0.59 FIM CFL=1 0.57 CFL=2 0.55 0.53 0.51 0.49 0.47 0.45 0 200 400 600 800 1000 1200 CFL=4

oil saturation at the producer

tim e (days)

Figure 5.37

Well block oil saturation comparisons for the IMPSAT model and Case 3 problem

0.4 0.35 FIM CFL=1 0.3 CFL=2 0.25 0.2 0.15 0.1 0.05 0 0 200 400 600 800 1000 1200 CFL=3

oil saturation at the producer

tim e (days)

Figure 5.38

Well block oil saturation comparisons for the IMPSAT model and Case 4 problem

136

Iteration counts and timing results for problems discussed above are presented in Table 5.10 to Table 5.13. For all of the IMPSAT runs, the CPR preconditioned GMRES method was used to solve the linear system. We can draw the following conclusions based on our analysis: • For the IMPSAT model, with the increase of CFL number (timestep size), more Newton iterations are needed at each timestep and more linear solver iterations are needed to solve each linear system. This is because the system becomes less diagonally dominant as the timestep size increases. • Compared to the IMPES model, the IMPSAT model needs fewer (over 50%) number of timesteps and Newton iterations due to its improved stability. IMPSAT may cost more in the linear solver part than IMPES, because of its increased number of unknowns, but it can also save a lot in the Jacobian matrix construction and flash calculations. Both of these costs are directly proportional to the number of Newton iterations, and they are two of the most time consuming parts in compositional simulation. Finally, the total cost of IMPSAT is generally much lower than the total cost of IMPES, and most of time, IMPSAT can cut the running time by half compared to IMPES. • For most problems, the improved stability of the IMPSAT model enables it to use the same number of timesteps and Newton iterations as the FIM model (with maximum timestep size of 100 days). Because IMPSAT solves for fewer unknowns in the linear solver part, it is a cheaper alternative to the FIM model. All comparisons here between the IMPSAT model and the FIM model are based on that the FIM model uses 100 days as the maximum timestep size, which is quite large for typical compositional simulations (The default maximum timestep size used in Eclipse 300 is only 50 days). Of course, the FIM model is unconditionally stable, and it can use any timestep size. In summary, the IMPSAT model is much better than the IMPES model due to its improved stability, and it is also cheaper than the FIM. For most problems, the IMPSAT model can outperform both the IMPES and FIM models. But if the problem is very hard, such as high flow rate or small gridblock sizes, the stable timestep size of IMPSAT can also be quite small (less than 1 day), since it is proportional to cell volume divided by the

137

flow rate, as shown in Eqn. 4.7. In such cases, FIM models and AIM models are appropriate. CFL=1
N timesteps N Newton _ iters N solver _ iters

CFL=2 18 56 136 0.55 2.25 and Case 1 problem

CFL=4 15 50 132 0.48 2.05

27 76 193 0.78 3.04

Tsolver (sec) Ttotal (sec)
Table 5.10

Iteration and timing comparisons for the IMPSAT model

CFL=1
N timesteps N Newton _ iters N solver _ iters

CFL=2 26 91 255 1.51 4.61

CFL=4 18 64 186 1.2 3.41

44 123 323 1.88 6.17

Tsolver (sec) Ttotal (sec)
Table 5.11

Iteration and timing comparisons for the IMPSAT model and Case 2 problem

CFL=1
N timesteps N Newton _ iters N solver _ iters

CFL=2 28 81 221 4.05 14.4

CFL=4 17 58 158 2.86 10.5

50 129 348 6.1 22.53

Tsolver (sec) Ttotal (sec)
Table 5.12

Iteration and timing comparisons for the IMPSAT model and Case 3 problem

138

CFL=1
N timesteps N Newton _ iters N solver _ iters

CFL=2 50 165 405 3 25.68

CFL=3 37 151 424 3.42 24.92

93 230 546 3.44 37.13

Tsolver (sec) Ttotal (sec)
Table 5.13

Iteration and timing comparisons for the IMPSAT model and Case 4 problem

5.2.4 AIM models

The traditional AIM model and three new IMPSAT based AIM models were used here. Model performance is compared for different problems. For AIM models, there are two ways to decide the timestep size and assign implicit level for each gridblock, and they are discussed bellow: •
Fix timestep size For a given timestep size, assign the implicit level for each

gridblock according to the stability criteria (CFL number at that gridblock). This method is straightforward, and the percentage of gridblocks for each formulation changes from timestep to timestep. •
Fix percentage For a fixed percentage of gridblocks for each formulation, first

decide the maximum stable timestep size which can satisfy the given percentage, then assign the implicit level for each gridblock according to the stability criteria. This method is not straightforward, in order to decide the maximum stable timestep size for a given percentage, we need to order the gridblocks according their CFL number. For AIM systems, the performance of linear solvers and preconditioners depends strongly on the percentage of gridblocks for each formulation. For example, CPR is more efficient for systems where most gridblocks are FIM, while AMG is more efficient for systems where most gridblocks are IMPES. Based on these considerations, the method of fixed percentage is used in GPRS. The percentage for each AIM model was assigned as following: • •
IMPES+FIM 90% IMPES gridblocks and 10% FIM gridblocks IMPES+IMPSAT 90% IMPES gridblocks and 10% IMPSAT gridblocks

139

• •

IMPSAT+FIM 90% IMPSAT gridblocks and 10% FIM gridblocks IMPES+IMPSAT+FIM 90% IMPES gridblocks, 9% IMPSAT gridblocks and 1%

FIM gridblocks The well blocks were forced to be either FIM or IMPSAT. The maximum timestep size was set to be 100 days. Figure 5.39 to Figure 5.43 show the well block oil saturation for each problem, and the legend in each figure marks the model used. The fully implicit result (the dark solid line) for maximum timestep size of 100 days is included for comparison. From these results, we can draw the following conclusions: • • The results of all AIM models agree well with the results of the FIM model. The results of AIM models with an IMPES formulation are on top of each other, while the results of the FIM and the IMPSAT+FIM models are on top of each other. This is mostly due to the difference in timestep sizes, IMPES timestep size can not reach 100 days, but without IMPES, it can reach 100 days. Due to this, we observe obvious differences in the results of different AIM models for Case 3 and 5.

0.7 FIM IMPES+FIM 0.5 IMPES+IMPSAT IMPSAT+FIM 0.4 IMPES+IMPSAT+FIM 0.3

0.6

oil saturation at the producer

0.2

0.1

0 0 200 400 600 800 1000 1200

time (days)

Figure 5.39

Well block oil saturation comparisons for AIM models and Case 1 problem

140

0.7

0.6

oil saturation at the producer

0.5

0.4

0.3

FIM IMPES+FIM

0.2

IMPES+IMPSAT IMPSAT+FIM IMPES+IMPSAT+FIM

0.1

0 0 200 400 600 800 1000 1200

time (days)

Figure 5.40
0.61 0.59

Well block oil saturation comparisons for AIM models and Case 2 problem

FIM IMPES+FIM

oil saturation at the producer

0.57 IMPES+IMPSAT 0.55 0.53 0.51 0.49 0.47 0.45 0 200 400 600 800 1000 1200 IMPSAT+FIM IMPES+IMPSAT+FIM

time (days)

Figure 5.41

Well block oil saturation comparisons for AIM models and Case 3 problem

141

42 0.1 0.58 FIM IMPES+FIM 0.05 0 0 200 400 600 IMPES+IMPSAT IMPSAT+FIM IMPES+IMPSAT+FIM 800 1000 1200 time (days) Figure 5.0.2 0.56 IMPSAT+FIM 0.61 Well block oil saturation comparisons for AIM models and Case 4 problem 0.54 0 200 400 600 800 1000 1200 0.4 FIM 0.25 0.59 0.35 IMPES+FIM oil saturation at the producer 0.6 oil saturation at the producer 0.43 Well block oil saturation comparisons for AIM models and Case 5 problem 142 .3 0.57 time (days) Figure 5.55 IMPES+IMPSAT+FIM 0.15 0.

since IMPSAT solves for fewer unknowns than FIM. AMG) used for other models. one of the three new AIM models will outperform the traditional AIM model. Hence for hard problems. AIM models should be much faster than FIM models. the IMPES+IMPSAT model is less stable than the IMPSAT model. with proper tuning of the percentages according to the difficulties for the IMPES and IMPSAT models. the ILU0 preconditioned GMRES method was used to solve the linear system.Iteration counts and timing results for problems discussed above are presented in Table 5.18. 4 and 5. it will always outperform the other three AIM models. such as Case 1. But in theory. For all of the AIM runs. In summary. the IMPSAT+FIM model is much faster than the traditional AIM model. depending on the nature of the problem. the IMPES+IMPSAT model is faster than the traditional AIM model. • For problems that are hard for IMPES. can also not be handled by the IMPES+IMPSAT model. 2.14 to Table 5. We can draw the following conclusions based on our analysis: • For problems that are easy for IMPSAT. 143 . the IMPSAT+FIM model needs far fewer timesteps and Newton iterations than the traditional AIM model. so it won’t make any sense to use the timing results here to compare the performance of AIM models with other models. • The ILU0 preconditioner used here is quite weak compared to the preconditioners (CPR. On the other hand. because they solve for fewer unknowns. so any problem that can not be handled by the IMPSAT model. such as Case 1 and 3. due to the improved stability of IMPSAT. The IMPES+IMPSAT+FIM model is the general AIM model. with a good preconditioner.

25 IMPSAT+FIM 19 69 820 0.64 5.53 Tsolver(sec) Ttotal (sec) Table 5.IMPES+FIM N timesteps NNewton_iters N solver_ iters IMPES+IMPSAT 80 177 1392 0.45 IMPES+IMPSAT+FIM 80 178 1471 0.14 Iteration and timing comparisons for AIM models and Case 1 problem IMPES+FIM N timesteps NNewton iters _ Nsolver_ iters IMPES+IMPSAT 50 148 1419 0.3 10.27 IMPSAT+FIM 18 62 701 0.97 IMPES+IMPSAT+FIM 51 139 1330 0.52 6.45 5.1 10.7 2.88 50 136 1374 0.93 IMPES+IMPSAT+FIM 30 73 775 1.54 Tsolver(sec) Ttotal (sec) Table 5.32 80 177 1415 0.27 9.54 2.83 10 IMPSAT+FIM 17 58 657 2.53 5.15 Iteration and timing comparisons for AIM models and Case 2 problem IMPES+FIM N timesteps NNewton iters _ Nsolver_ iters IMPES+IMPSAT 30 73 813 0.16 Iteration and timing comparisons for AIM models and Case 3 problem 144 .83 Tsolver(sec) Ttotal (sec) Table 5.67 5.44 5.23 30 73 770 1.

98 55 154 2355 2.66 Tsolver(sec) Ttotal (sec) Table 5.39 20.19 IMPSAT+FIM 21 84 1943 3.99 16.17 Iteration and timing comparisons for AIM models and Case 4 problem IMPES+FIM N timesteps NNewton iters _ Nsolver_ iters IMPES+IMPSAT X X X X X IMPSAT+FIM 23 87 18612 19096 20734 IMPES+IMPSAT+FIM 82 206 25151 10563 17135 82 204 25652 15744 22026 Tsolver(sec) Ttotal (sec) Table 5.66 21.IMPES+FIM N timesteps NNewton iters _ Nsolver_ iters IMPES+IMPSAT 54 158 2048 0.64 22.54 IMPES+IMPSAT+FIM 54 147 2219 1.18 Iteration and timing comparisons for AIM models and Case 5 problem 145 .

146 .

This approach can generate almost any model. This is necessary for the building of AIM models. which is actually a special case of the General Formulation Approach. All of the operations are performed on individual gridblocks. In addition. regardless of the selection of variables and the level of implicitness. An extensive study has been conducted for the new IMPSAT (implicit pressure. We have also compared the performance of the IMPSAT model with the performance of IMPES and FIM models using various compositional problems. The design of GPRS is such that it can be used by multiple researchers. It incorporates various simulation models and techniques so that their advantages and disadvantages can be investigated in a consistent manner. implicit saturations and explicit mole fractions) model. derived its stability criterion and suggested an efficient way for its construction. These problems were 147 . We have analyzed the characteristic of this IMPSAT model. The approach presented is suitable for all kinds of simulations. so different variables and different implicit levels can be used in different gridblocks. Different compositional models. we have proposed three new IMPSAT based AIM models. including a blackoil model. A basic introduction to the structure of GPRS is included in Appendix A. It is now possible for other researchers to start working on extensions of individual modules. A new General Formulation Approach has been developed and implemented in GPRS to facilitate the implementation of different models.1 Conclusions A new General Purpose Research Simulator (GPRS) has been developed.Chapter 6 Conclusions and Future work 6. have been evaluated using several compositional problems. unstructured grid handling and multi-point flux approximation. Various models and techniques in GPRS have been tested. several compositional models. and their performance has been compared with the performance of the traditional AIM model. varying in their selection of variables and implicit levels. In GPRS. it is only used to generate different compositional models. The overall design and basic implementations of GPRS have been completed.

However this advantage is lost for hard problems. because of the need to use the chain rule to calculate derivatives. For compositional problems. Type B variables are more efficient than Type A variables in Jacobian matrix calculation (Coats. However. for different implicit levels and for the new IMPSAT based AIM models: Different Variable Selections • • • The same models (FIM or IMPES) with Type A and Type B variables have the same solutions. Type B variables need more linear solver iterations (and hence computational cost) than Type A variables. the IMPES model is faster than the FIM model. 1999). For the same models (FIM or IMPES) with Type A and Type B variables. Hence Type A FIM model is more efficient than Type B FIM model. Different Implicit Levels • FIM models are most stable. • IMPES models are least stable. because only pressure is treated implicitly.selected to be difficult in one specific area. the stable timestep sizes of the IMPES model are small. Hence the total cost of Type B IMPES model is lower than the total cost of Type A IMPES model. For relatively easy problems. there are no major differences in the Newton iteration numbers. • For IMPES models. From the results obtained. Type B variables also increase the cost of Jacobian matrix construction. we can draw the following conclusions for different variable selections. there are no significant differences in linear solver iterations. The IMPES model has less numerical diffusion than the FIM model. because they are solving the same equations. 148 . but the cost of each Newton iteration is also high. where the timestep restriction makes IMPES even slower than the FIM model. Also it has sudden jumps because of the discontinuous phase velocities. and they can use large timestep sizes. since the pressure system is always the same. For FIM models. because it solves for fewer unknowns. but their cost is the lowest for each Newton iteration. especially for problems with large number of components. due to the high gas mobility.

Different AIM Models • All AIM models are more efficient than the FIM model.• The IMPSAT model is much more stable than the IMPES model. the key conclusions about the performance of compositional models are as following: • Type A FIM model is better than Type B FIM model. it will always outperform the other three AIM models. with properly tuned percentages for each formulation. Because the number of unknowns to be solved is reduced. • For problems that are easy for IMPSAT. • The IMPES+IMPSAT+FIM model is the most general AIM model. the improved stability of the IMPSAT model enables it to use the same number of timesteps and Newton iterations as the FIM model. the IMPSAT+FIM model is much faster than the traditional IMPES+FIM model due to the improved stability of the IMPSAT model. just as is the case for the IMPES model. and it can use timestep sizes of up to 10 times larger than what is possible with IMPES. and generally can cut the running time by half. independent of the number of components. Compared to the IMPES model. both in the condition of the Jacobian matrix and the cost of building the Jacobian matrix. The cost of the IMPSAT model for each Newton iteration is fixed. the IMPES+IMPSAT model is faster than the traditional IMPES+FIM model. For problems that are not very hard. • For problems that are hard for IMPES. The IMPSAT model has the same level of numerical diffusion as the FIM model. due to the implicit treatment of saturations. Also the stable timestep sizes of the IMPSAT model change more smoothly than the stable timestep sizes of the IMPES model. IMPSAT is a cheaper alternative to the FIM model. the IMPSAT model needs far fewer timesteps and Newton iterations. 149 . since high flow rates are generally restricted to a small portion of the reservoir and the FIM model is only needed in the regions of high flow rates. due to the reduction in the number of unknowns that need to be solved implicitly. In summary.

2 Future Work GPRS is a general-purpose research simulator. With properly tuned percentages for each formulation. where the mole fractions in the transmissibility part are updated iteration by iteration Improvements in preconditions for AIM models Better solver for unstructured grid Improvements in flash calculations Implementation of techniques for parallel computing Surface facility modeling Complex well modeling Automatic selection of the level of implicitness in AIM models Thermal modeling Fractured reservoir simulation Enhancements in the treatment of water to include gas solubility in water and water vapor in gas Other structured grid (cylindrical. 6. corner-point) Coupled modeling of geomechanics Interface with other tools.• • • Type B IMPES model is more efficient than Type A IMPES model in the cost of building the pressure implicit Jacobian matrix. the IMPES+IMPSAT+FIM model will always outperform the traditional AIM (IMPES+FIM) model. the IMPSAT model is cheaper than the FIM model since it reduces the number of unknowns that have to be solved implicitly. and allow use of various units 150 . curvilinear. more stable and less expensive than the traditional AIM model. The IMPSAT model is generally over 50% faster than the IMPES model due to its improved stability. Work is especially needed in the following areas: • • • • • • • • • • • • • • • Evaluation of IMPSAT++ models (including some mole fractions in the implicit set) Evaluation of quasi-IMPSAT model. It requires further testing. For problems that are not very hard for IMPSAT. This is especially true for problems with a large number of components. improvements and enhancements. • The IMPSAT based AIM models are more flexible.

[lb-mole] D F f c. [ft3/day] Solubility of component c in phase p . [32. [lbm/day] Volumetric flow rate of phase p at well W . p rc Sp T V Vφ Vp VT 151 . [md] Relative permeability of phase p Hydrocarbon liquid mole fraction in hydrocarbon fluid Total moles of hydrocarbon component c . [md⋅ft] Volume. [ft3] Pore volume. [lbm/lb-mole] nc nh np p Number of components Number of hydrocarbon components Number of phases Block pressure. p2 Capillary pressure between phase p1 and phase p2 . [lb-mole] Total moles of water. [bbl/STB: oil&wat. [ft] Total moles of hydrocarbon in one unit volume of fluid. [ft3] Total fluid volume. [mole/ft3] Fugacity of component c in phase p . [ft3] Volume of phase p . [ft3] Pc . p g Kc k k rp l Mc Mw MWc Molecular weight of component c .2 ft/sec2] Equilibrium ratio of component c Absolute permeability. [ft2] Formation volume factor of phase p (black-oil). [lb-mole/ft3] Saturation of phase p Transmissibility. p1 . ft3/SCF: gas] Depth. [psia] Mass flow rate of component c at well W . [psia] Gravity force constant. [psia] pW W Qc qW p Rc . [SCF/STB: R g . [psia] Wellbore pressure of well W . [lbm/lb-mole] MW p Molecular weight of phase p .o ] Total moles of hydrocarbon component c in one unit volume of fluid.Nomenclature A Bp Area of surface between two gridblocks.

g Overall mole fraction of component c Compressibility factor xc yc zc Z Acronyms AIM AMG BHP CPR EOS FIM GMRES GPRS ILU IMPES IMPSAT Type A Type B Greek ∆ Adaptive implicit Algebraic multi-grid Bottom hole pressure Constrained pressure residual Equation of state Fully implicit Generalized minimum residual General Purpose Research Simulator Incomplete LU decomposition Implicit pressure and explicit saturations Implicit pressure and saturations Type A variables (pressure. overall component densities) Capital Delta (change) Delta (change) Unit conversion constants Mobility of phase p . [lbm/ft3] Density of component c at standard condition. [1/cp] Density of phase p . [md⋅ft] Mole fraction of component c in phase p Mole fraction of component c in the oil phase.vp W WI W X c. [ft3/day] Total moles of water in one unit volume of fluid.o Mole fraction of component c in the gas phase. saturations and component mole fractions) Type B variables (pressure. p Volumetric flow rate of phase p . same as X c . [lbm/ft3] Viscosity of phase p . β λp ρp ρc µp 152 . [cp] δ α. same as X c . [lb-mole/ft3] Well Index of well W .

Φp Potential of phase p . [psia] Porosity φ Subscripts p Phase Component Water c w Superscripts n Time level n Iteration level Well n + 1 Time level n + 1 υ W 153 .

154 .

. E. Society for Industrial and Applied Mathematics. T. S.: “A Reservoir Wellbore Model for Multiphase Injection and Production”. and Aziz.. Aziz. and Wong. and Sorensen. J. Edwards. pp1661-1663 3. pp543-553 4. Third Edition”. Austria. K. Hammarling. class notes for PE223 (Reservoir Simulation) class. and Aziz. 1999 7. Anderson. September 12-16. 1989 6. R. Anisotropic Reservoirs”. G. paper SPE 38000. proceedings of the 1st and 2nd International Forum on Reservoir Simulation.: “Petroleum Reservoir Simulation”. JPT. Greenbaum. K..References 1. J. Bahrain.. Bischof. summer 1996 8. Peebles. 1998 5. Doleschall. J. September 1985..: “Flexible Streamline-Potential Grids With Discretization on Highly Distorted Cells”. Mckenny. S.: “General Purpose Compositional Model”. March 1114. Verma.. K.: “Control Volume Discretization Methods for 3D Quadrilateral Grids in Inhomogeneous. Barkve. Abou-Kassem.. England. Alpbach..: “Considerations in the Development of Multipurpose Reservoir Simulation Models”. 1997 2.A.H.. Dallas. Du Croz.W. T.. 1979 9.. and Mannseth. and Farkas. Aavatsmark. September 8-11. 1988 and September 4-8. R. K. A. and Settari. Aziz. G. S.. T. I. Acs. A.A. paper SPE 17941.. J. and Pedrosa. Almehaideb. SPEJ.: “Fundamentals of Reservoir Simulation”. E. London. S. proceedings of the 6th European Conference on the Mathematics of Oil Recovery. A. TX. Bai. Aziz. proceedings of the SPE Middle East Oil Technical Conference and Exhibition. D. Z.. August 1985. Manama. Scotland. Agut. 1989 155 . Dongarra. June 8-11.: “Handling of Phase Change in Thermal Simulators”. K. D. Aziz. C. K.: “LAPACK Users’ Guide. Blackford. proceedings of the 14th SPE Symposium on Reservoir Simulation. Applied Science Publishers. Demmel.E.

pp15-24 11. No. 2000 17. Chen. New Orleans. Chien. September 5-8. and Osher. 1985 19. Dallas. Cao.: “Critical Point and Saturation Pressure Calculation for Multi-Component Systems”. P.R. Baveno.10. CA. F. February 1980.J. TX. proceedings of the 66th SPE Annual Technical Conference and Exhibition.: “A New Fully Implicit Compositional Simulator”.: “Quantifying the Impact of Geological Uncertainty on Reservoir Forecasts”. 4.: “An Equation of State Compositional Model”. 1983 13. Durlofsky. H. Ballin. L.” paper SPE 22887. Branco. Edwards..D.. Aziz. pp363-376 156 . SPEJ. and Luks. October 1980. L. and Rodriguez.. paper SPE 25238. CA.J.H.. P. February 10-13. Dallas.H. Lee. June 2000 15. Behie. Coats. data file and user’s manual) 2002”. February 28March 03. L. T. Engquist. A. K.. K.M. San Francisco.. K. proceedings of the 8th SPE Symposium on Reservoir Simulation. Baker. and Durlofsky.H.: “Practical Considerations for Incomplete Factorization Methods in Reservoir Simulation”. TX. proceedings of the 7th SPE Symposium on Reservoir Simulation.J. A. and Chen. 1993 12.A. and Forsyth Jr. W. S. proceedings of the 7th European Conference on the Mathematics of Oil Recovery. 1991 18.: “Minimization of Grid Orientation Effects Through Use of Higher-Order Finite Difference Methods.D. 16. paper SPE 27053. Journel. and Zuccolo. 1995 14. S. 1.: “Preconditioned Newton Methods for Reservoirs With Surface Facilities”. Stanford University. C. B. Ph. Byer.H.: "Flow Based Modules for Grid Generation in Two and Three Dimensions".G. October 6-9.: “GPRS Package (code. M. Vol. M. November 1518.C. 2002 Castellini. proceedings of the 12th SPE Symposium on Reservoir Simulation. Italy.G. Dissertation.: “A Semi-Implicit Formulation for Compositional Reservoir Simulation”. SPE Advanced Technology Series. L.. paper SPE 12263. paper SPE 13385. A.E. SPEJ. W.T.

Fung.: “Use of Corner Point Geometry in Reservoir Simulation”. Phys. and Remington. 2002.. April 1996 157 . Dongarra. Houston.: “Mesh Refinement for Parabolic Equations”. Beijing. T. M. 1995 23. TX. Ciment.A. Ding.2. W.M. 1995 27. R. http://www. February 11-14..: “Compositional and Black-Oil Reservoir Simulation”. P.A. February 14-17. and Lemonnier. 2001 22. CA. Al-Zamel. February 12-15. L. Y. K. Dongarra. proceedings of the International Meeting on Petroleum Engineering. Salzburg. Coats. August 1998.K. R.H. Pozo..G. TX. A. R.H...K. paper SPE 29111. Thomas. March 19. M.: “Schmidt-Wenzel and Peng-Robinson Equation of State for CO2-Hydrocarbon Mixtures: Binary Interaction Parameters and Volume Translation Factors”.: “Compositional and Black-Oil Reservoir Simulation”. J. Coats. and Pierson. Pita. Bakersfield. Coats. Deo.T. and Pierson. Lumsdaine. proceedings of the 6th International Forum on Reservoir Simulation.org/benchmark/performance. Houston. pp513-525 25. proceedings of the 15th SPE Symposium on Reservoir Simulation. Iterative Methods Library Reference Guide”. proceedings of the SPE California Regional Meeting. A.1. Comp. Dogru.H.ps 29. and Dreiman.H. K.H. paper SPE 29933.: “IML++ V. Nutakki. paper SPE 69225. China. paper SPE 18796. J. paper SPE 49774.. September 3-7. R.G. Thomas.netlib. J.. November 14-17. 1999 21. National Institute of Standards and Technology. and Orr Jr. F. 1989 26. April 5-7. Al-Shaalan.D. Austria.: “A Note on IMPES and Some IMPES Based Simulation Models”. San Antonio. December 1973.A. R. K. K. K. paper SPE 50990.S.: “Megacell Reservoir Simulation: the Quest for High Resolution in Full-Field Modeling”. SPE Reservoir Evaluation & Engineering.20.. proceedings of the 16th SPE Symposium on Reservoir Simulation.. Coats.: “Performance of Various Computers Using Standard Linear Equations Software”. 2001 28. and Sweet. pp372-279 24.. N.. TX. L. J.: “IMPES Stability: The Stable Step”. L. proceedings of the 13th SPE Symposium on Reservoir Simulation.

dissertation. Geoquest.30. November 2-6. and Sammon. Ph. 62.M. http://www. proceedings of the 73rd SPE Annual Technical Conference and Exhibition. Edwards. September 27-30. Hiebert.S.slb. New Orleans. L.L.M. Geoquest. 1998 31. L.. pp211-220 37. Beijing.slb.. 1998 158 .com/content/software/simulation/eclipse_blackoil.asp 40.D. P. pp265-281 34. and Nghiem..: “Reservoir Simulation With a Control Volume Finite Element Method”. proceedings of the 11th SPE Symposium on Reservoir Simulation.X. Edwards. June 1978. March 31–April 03. Fussell. J. P.D. pp173-182 36. D. Oxford University. Farkas. 2000.H.com/content/software/simulation/eclipse_pre_post/flogrid. UK. J.slb.: “Comparison of Linearization Techniques of Nonlinear Partial Differential Equations in Numerical Reservoir Simulation”. August 1979. E. China. Schlumberger: “FloGrid Reference Manual 2000A”. proceedings of the 6th SPE International Oil&Gas Conference and Exhibition. J. Reservoir Engineering Department of the Montanuniversitat Leoben. and Yanosik.D. 1986.D. http://www. Fung. Forsyth..: “Split Elliptic Tensor Operators for Reservoir Simulation”. Anaheim.A. G. K.sis. and Fussell.asp 39. Geoquest. paper SPE 21224. D. Louisiana. and Cox.sis. paper SPE 49072. 1998 32. A.T. D. Phys.: “A Multi-Point Flux Discretization Scheme for General Polyhedral Grids”. 1991 35. 1997 33.: “Quasi K-Orthogonal Streamline Grids: Gridding and Discretization”. Vol. R. Comp. paper SPE 48855. Herring. P. Schlumberger: “Eclipse 300 Technical Description 2000A”. proceedings of the ICFD Conference on Numerical Methods for Fluid Dynamics.: “Practical Considerations for Adaptive Implicit Methods in Reservoir Simulation”.sis. Childs. L. J.com/content/software/simulation/eclipse_compositional. Agut.: “An Iterative Sequence for Phase-Equilibria Calculations Incorporating the Redlich-Kwong Equation of State” SPEJ. 2000. and Aziz.. G. 2000.asp 38. Fussell. February 17-20. Schlumberger: “Eclipse 100 Technical Description 2000A”. http://www. CA. Gunasekera.: “An Iterative Technique for Compositional Reservoir Models” SPEJ. Austria.

D. 1995 47. A. M.E.: “Iterative Solvers of the Implicit Parallel Accurate Reservoir Simulator (IPARS)..: “Scalable Parallel Reservoir Simulation on a Windows NT-Bases Workstation Cluster”. D.com 159 . J. and Brand. 1983 46.: “Third SPE Comparative Solution Project: Gas Cycling of Retrograde Condensate Reservoirs”. Dallas. March 14-17. TX. 1997 49. P. proceedings of the SPE Middle East Oil Technical Conference. Z. paper SPE 51883. TX. 1989 43. Killough.: “The Generation and Application of KOrthogonal Grid Systems”.J. proceedings of the 10th SPE Symposium on Reservoir Simulation. Peaceman. CA.E. Dallas. G. S.W.W. Landmark Graphics Corporation: “BlitzPak User’s Guide”. C. D.. Bahrain.ticam. paper SPE 20750. S.html 50. San Francisco.: “Development of a Multiple Application Reservoir Simulator for Use on a Vector Computer”. Kocberber. paper SPE 38001.: “Modeling Reservoir Geometry with Irregular Grids” paper SPE 18412. Unstructured Control Volume Generation System for Geologically Complex Reservoirs”. Y. February 12-15. Heinemann.E. I: Single Processor Case”. http://www. TICAM report 00-28. paper SPE 29110. paper SPE 12278. and Lindsey. proceedings of the 7th SPE Symposium on Reservoir Simulation. W. Kenyon.edu/reports/2000/index. Vassilevski. proceedings of the 65th SPE Annual Technical Conference and Exhibition. June 8-11. R. http://www. D. 1997 42.A. San Antonio. Lacroix. Silliman. and Wheeler.: “Geostatistics for Reservoir Characterization”. November 15-18. proceedings of the 15th SPE Symposium on Reservoir Simulation. G.G.lgc. Houston.. (2000). proceedings of the 13th SPE Symposium on Reservoir Simulation. TX. paper SPE 37998. Killough. Manama. 1998. J. 1983 45. Morrell. February 14-17. proceedings of the 14th SPE Symposium on Reservoir Simulation.utexas. February 6-8.: “Ninth SPE Comparative Solution Project: A Reexamination of BlackOil Simulation”. CA.O.W. September 23-26.. Journel.: “An Automatic. and Commander. Kendall. J. June 8-11. Gunasekera. TX. paper SPE 11483. TX. 1999 48. New Orleans. Cox.P.41. proceedings of the 14th SPE Symposium on Reservoir Simulation.. and Behie. J. Houston. and Watts. 1990 44.

1994 52.T.G. Baden.H. proceedings of the SPE Petroleum Computer Conference. Stanford University.F. April 1994. Kasap. proceedings of the 8th SPE Symposium on Reservoir Simulation. SPEJ.X. January 1981. Lough.W.. K. K. C. W.: “Calculation of Transmissibilities of Gridblocks Defined by Arbitrary Corner Point Geometry”. TX. 1985. D.S. but available from SPE e-library) 60. JPT. Dallas. SPE Advanced Technology Series 2.A. and Chen. Pedrosa. CA.51. pp69-77 59. D. Dallas.W. E. and Aziz.J.J.L. March 1991 55. Odeh.: “Treatment of Wells in Reservoir Simulation”. Ph.: “Use of Hybrid Grid in Reservoir Simulation”. 1997 53.. S. L. Long Beach. SPE paper 27875.. D. paper SPE 28248. SPEJ. M. paper SPE 38002. Lee. E. June 8-11..C. pp13-25 58.H.: “Interpretation of Well-Block Pressures in Numerical Reservoir Simulation”. 160 . A. March 23-25.D. Nghiem. “Finite Difference Simulation of Geologically Complex Reservoirs With Tensor Permeabilities”. Palagi.: “A New Approach for Residual and Jacobian Array Construction in Reservoir Simulators”. Peaceman. J.: “A Robust Iterative Method for Flash Calculations Using the Soave-Redlich-Kwong or the Peng-Robinson Equation of State”. 57. pp183-194 61.. L.: “Use of Voronoi Grid in Reservoir Simulation”.K. proceedings of the SPE Western Regional Meeting. J. Austria. Aziz. February 10-13. O. pp521-530 Nolen. TX. K. 1996 (unpublished.: “Analytical Upscaling of Permeability for 3D Gridblocks”. M. Nacul. June 1978. paper SPE 9723. proceedings of the 3rd International Forum on Reservoir Simulation.S. July 31-August 03. paper SPE 13507. Dallas. proceedings of the 14th SPE Symposium on Reservoir Simulation. and Aziz. Dissertation. and Aziz. 1990 56. Schiozer. paper SPE 37306. June 1983.: “Comparison of Solutions to a Three-Dimensional Black-Oil Simulation Problem”. Lim. and Li. Lee. Y. July 23-27. K. K. TX. Durlofsky. 1994 54. Peaceman. and Kelkar.: “Use of Domain Decomposition and Local Grid Refinement in Reservoir Simulation”.

1. http://www. R. 66. pp856-869 72. Sci. pp59-64 63. Rachford. 1952. and Savary. proceedings of the 10th SPE Symposium on Reservoir Simulation.. Sparse Matrix Class Library Reference Guide”. paper SPE 18416. Houston.. proceedings of the SPE Western Regional Meeting.: “Stability Analysis and Switching Criteria for Adaptive Implicit Methods Based on the CFL Condition”. 1991 73. A.F.B. 1991 Russell. 1994 Stueben.62. April 1996 65. March 23-25. M.. and Robinson. pp10-19 69. and Rice. TX.: “An Implicit in Pressure and Saturations Approach to Fully Compositional Simulation”. Cambridge.King(ed. Copper Mountain. 1983 74. D.Y. D. proceedings of the 11th SPE Symposium on Reservoir Simulation. Sammon. Ritzdorf. 70. K. Saad.: “Procedure for Use of Electronic Digital Computers in Calculating Flash Vaporization Hydrocarbon Equilibrium”.H.: “Algebraic Multigrid (AMG): Experiences and Comparisons”. D. February 17-20. proceedings of the International Multigrid Conference. April 6-8.gridpro. CA. Ind. CA. P. Remington. Houston. SIAM J. 1976.: “SparseLib++ v.5.J. Eng. CO.A. Chem. Fundam. Prevost. K.: “ A Nine-Point Differencing Scheme Based on High-Order Stream Tube Modeling”. paper SPE 18423. 2002 Program Development Corporation (PDC): “GridPro”. D. TX.K. Oxford 1992. and Lumsdaine. P. proceedings of the 10th SPE Symposium on Reservoir Simulation. Schiozer. Long Beach. and Schultz. 1989 71. February 6-8. paper SPE 27876.: “Use of Domain Decomposition for Simultaneous Simulation of Reservoir and Surface Facilities”. 67. Vol. 4. Clarendon Press. 7. JPT. 161 . H. D. Comput. P. Statist. H.: “Readme to AMG Package”.).: “Corner Point Geometry in Reservoir Simulation”. Peng. 1986. K. National Institute of Standards and Technology. proceedings of the 1st European Conference on Mathematics Of Oil Recovery.. 1989 68. GMD Software. 15. and Aziz. 1989. Pozo. Ponting. J. Vol. private communication. paper SPE 21223. Anaheim.com Quandalle. Y. M. pp45-65 64. T. England.: “GMRES: A Generalized Minimum Residual Algorithm for solving non-symmetric linear systems”.R. February 6-8.: “A New Two-Constant Equation of State”.

2001 80. pp759-768 78. and Future” paper SPE 38441. M. Dallas.: “Two Marks on the Combinative Technique”. and Lewis. paper SPE 28755.: “A Compositional Formulation of the Pressure and Saturation Equations” paper SPE 12244. SPEJ. Dissertation.D. 1986 162 .: “Phase Equilibria in Chemical Engineering". pp243-252 85.: “A Control Volume Scheme for Flexible Grids in Reservoir Simulation”. Banff.fr/GOCAD Thomas. proceedings of the 14th SPE Symposium on Reservoir Simulation. Melbourne. Present. A.: “Two.: “Automatic Generation of Corner-Point-Geometry Flow Simulation Grids from Detailed Geostatistical Descriptions”.: “The Negative Flash”. J.M. Watts. Vassilevski. Butterworth Publishers. S.: “Reservoir Simulation: Past. 1995 79. April 30-May 05. Walas.: “Flexible Grids for Reservoir Simulation” Ph. and Aziz. Stanford University. The GOCAD group: “GOCAD”. C. 1996 83. Austria. private communication.B. Stanford Center for Reservoir Forecasting . S. R. T. Canada. SPE Reservoir Engineering.: “Reservoir Simulation Using an Adaptive Implicit Method”. November 7-10.W. 77. proceedings of the 5th European Conference on Mathematics of Oil Recovery.W. 1997 82. and Michelsen.and Three-Dimensional Flexible Grids for Reservoir Simulation”. September 3-6. K.L. G. 1985 84.W. MA. Watts. Sukirman. TX.W. S. Boston. proceedings of the SPE Asia Pacific Oil & Gas Conference. S. Dallas. Y. and Thurnau. proceedings of the International Conference on Fluid Properties and Phase Equilibria for Chemical Process Design. Tran. Australia. proceedings of the 14th SPE Symposium on Reservoir Simulation. Verma. TX. 1994 76.H. J. http://www. Verma.ensg. June 8-11. K.: “Three-Dimensional Fully Coupled Flow: Consolidation Modeling Using Finite Element Method”. 1997 86. June 1996 81. Verma. Y.u-nancy. and Aziz. June 811.H. Leoben. October 1983. Whitson. paper SPE 37999. May 1986. and Journel. D.75.

pp727-742 163 . October 1983. SPEJ. and Aziz..L. L. R.C.W. J.C. T. T.A. October 1-3. pp253-262 89.: “A Generalized Compositional Approach for Reservoir Simulation” SPEJ. Houston. paper SPE 18424.: “An Efficient Finite Element Method for Reservoir Simulation”. Wong. Young. and Stephenson. K. 1978 90. Young.: “A Nine-Point Finite-Difference Reservoir Simulation for Realistic Prediction of Adverse Mobility Ratio Displacement”. Yanosik. pp415-422 88. A. proceedings of the 53rd SPE Annual Technical Conference and Exhibition. Firoozabadi. L.87.: “Relationship of the Volume-Balance Method of Compositional Simulation to the Newton-Raphson Method”. SPE Reservoir Engineering. and McCracken. August 1979. paper SPE 7413.E. August 1990. TX.

164 .

for end users. we can recast the system in Figure A. To make it easier to understand. and explain each level in detail. it will still require some effort to become fully familiar with this code. users should first learn the basic structure of GPRS. so it is left out in Figure A. which will be introduced in this part. In this part.2. Figure A. Finally GPRS has a lot of internal comments. it will be difficult to explain the system model using only one figure. Currently. and it is very helpful for the understanding of the structure of GPRS. files and libraries of GPRS. after that we will discuss its flow sequence. we will first explore the system models for GPRS level by level.1 as the one shown in Figure A. a good understanding of the basic algorithms and techniques used in GPRS (refer to Chapter 2 for details) is necessary. which are separated into 11 subdirectories. which consists of several reservoirs. currently it includes about 120 files. We will also list the directories. we will show the system models level by level. All of the code is written in standard C++. A. and some surface facilities. GPRS is a big and complex program. From a computational point of view. from top down.1 The System Model The system model shows the basic classes and their relations. which is actually the top level (field level) system model for GPRS. 2002). Since GPRS is a complex code.2. To fully understand GPRS.1 shows the physical structure of an oil field. 165 . and explain their use. While the design will help new users in getting started with GPRS. Finally. we will explain the structure of input files. which should be very helpful in understanding individual classes and methods. lots of wells.Appendix A Overview Of GPRS Modular object–oriented design is used for GPRS. good documentation is essential (Cao. surface facility modeling is not included in GPRS. In order to facilitate the use of GPRS. After that.

1 Structure of an oil field Field Boundary Update Domain 1 Domain 2 Res1 Wells Res2 Wells W1 W2 W4 W3 W5 Figure A.Field Reservoirs Wells Surface Facilities Res1 Res2 W1 W2 W3 W4 W5 Figure A.2 Field level system model 166 .

GPRS is only used for sequential simulation.3.2. the Jacobian matrices are calculated separately for the reservoir part and for the well part. the solution goes back in the opposite direction. in GPRS.In Figure A. If there are more domains than CPUs. Currently. after that.2. Domain EqnSelector 1) switch variables 2) full set to primary set 3) reduce implicit level LinearSolver 1) solve AX=B Reservoir 1) calc props 2) calc Jac and RHS Wells 1) calc Jac and RHS Figure A. each domain includes a reservoir and several wells. This can be done by first assigning each domain to a different CPU. then solving each of them separately. In order to upgrade it for parallel computation. the boundaries between domains need to be updated (passing data between different CPUs). and each domain includes one reservoir and all of the wells that are in that reservoir.3 Domain level system model 167 . As we know from Figure A. Besides that. the equation selector is used to recast the Jacobian with desired variables and implicit levels. multiple domains can be assigned to the same CPU. This process has to be repeated until the whole field has converged. After that the Jacobian matrices are passed to the linear solver and pieced together there for the linear solve. each domain also has an equation selector and a linear solver. The domain level system model is shown in Figure A. Multiple domains are best handled by parallel computing methods. Basically. Finally. some work is needed to implement the boundary update. each oil field is split into several domains.

From Figure A. we can see that. In GPRS. four types of well controls are implemented. or read in from the output of a gridding software. each reservoir includes a grid and a formulation. the grid information is either internally generated (currently only for Cartesian grid). The system model for the well part has a similar structure (as shown in Figure A.As mentioned above. and they are BHP.5 show the system model for each of them. the Jacobian matrices are calculated separately for the reservoir part and for the well part. Currently.4 Reservoir level system model 168 .4.4 and Figure A. Reservoir Grid Grid information Formulation Cartesian Input from gridding software Figure A. which calculates the well part of the Jacobian matrix and the RHS. gas flow rate and water flow rate control. oil flow rate.5). Figure A. grid part generates the grid information and passes it to the formulation part. In this part. The formulation part calculates the gridblock properties and builds the reservoir part of the Jacobian matrix and the RHS. well information is generated from the well completion data and passed to the well control module.

If a module has connections to the physical world. The calculations are organized using five mathematical modules: one for rock. one for rock/fluid.Well Well Completion Well Information Well Controls BHP Oil Rate Gas Rat Water Rate Figure A. Most of the gridblock properties are calculated in the first four modules. and the reservoir part of the Jacobian matrix and the RHS are calculated and assembled in the last module. each module can have multiple subclasses for different models. The entire reservoir related calculations are carried out here.5 Well level system model Figure A. one for phase mobility and the last one for flow equations. If necessary.6 shows the last system model. 169 . it will have a pointer to the corresponding physical object. All of the mathematical modules are organized in a multilevel inheritance structure. one for fluid. such as the rock module. and dynamic binding is used to determine the actual objects and methods required during a run. they all share the same public interface (methods). For example the fluid part has a black-oil and a compositional module.

and RHS BO Fluid Module Comp Fluid Module BO Mobility Module Comp Mobility Module BO Comp Flow Eqn Flow Eqn Module Module Roc BOFlui CompFluid RockFluid Figure A. and RHS RockFluid Module 1) rela perm Mobility Module 1) assemble phase mobility Flow Eqn Module 1) calculate and assemble primary part Jac.6 Formulation level system model 170 .Formulation Rock Module 1) rock comp Fluid Module 1) flash 2) calculate and assemble secondary part Jac.

Print and plot results at appropriate times 5. linearize(). Read input data (problem definition) 2. // record old timestep values // start Newton iterations // calculate gridblock properties // calculate and assemble Jacobian and RHS } convF = convergeF(). The essential steps in a simulator are given below (Aziz. Initialize (allocate data and set initial conditions) 3. 1996): 1. End when run is complete The most important step is Step 3. Increment time and go to Step 3 if ending conditions are not reached 6. // check residual convergence mLinearSolver->solve() // solve the linear system newtonUpdate(). which accounts for over 95% of the simulation time. do another Newton iteration if necessary 4. we will now review the flow sequence of GPRS. while(true) { calcProps(). The implementation of Step 3 in GPRS is as following: calcInitProps().A. // converged // end of Newton iterations 171 . // check variable change convergence if(convF && convY) break. Start time step calculations • • • • • • • Initialize with old timestep data Start the Newton iteration Calculate gridblock properties Linearize (calculate and assemble Jacobian and RHS) Solve the linear system Perform Newton update Check convergence. // newton update convY = convergeDY().2 Flow Sequence Having shown the system models and classes used in GPRS.

iter2++. they share the same public interface. 172 . a new module is needed. there are 11 sub-directories. and let each of them do its work in turn.begin(). we only need to create it. A. Using this approach. They have similar structure as that of linearize(): void Reservoir::linearize() { // --. each Newton iteration becomes simple and flexible.cpp) which is located in the base directory.3 Sub-directories and Files Besides the main program (Main. while (iter1 != mMthModels. iter1++.Within this step.end()) { if((*iter2)->wellOpen()) (*iter2)->linearize(). calcProp(). Since all of these modules are inherited from the same base class. } } Basically. If any of the above four methods is not necessary for a module.each well linearizes --vector<Well*>::iterator iter2 = mWells. Here we will introduce each of them and the files contained in them. } // --.begin().each mathematical module linearizes --list<mthModelBase*>::iterator iter1 = mMthModels. They are: calcInitProp(). The only thing we need to take care of is to program the correct public methods (above four methods) for each module. linearize() and newtonUpdate(). we can just loop through them. four methods handle most of the calculations for the reservoir part. most of the reservoir calculations are performed by these mathematical modules.end()) { (*iter1)->linearize(dt). and implement the above four public methods. add it to the list of modules. while (iter2 != mWells. then it will be empty for that module. If at any time.

subclass of mthModelBase phase mobility module.h/cpp: BOPhase.h/cpp: compositional phase mobility module. subclass of mthFluidModelbase mthCompFluidModel. subclass of Phase WaterPhase.h/cpp: mthMobilityModel.h/cpp: • Cartesian grid class mth Formulation modules mthModelBase. subclass of Phase grid Grid.h/cpp: HCPhase.h/cpp: • compositional water phase class.• field Field.h/cpp: mthBOFluidModel. subclass of mthModelBase black-oil fluid module.h/cpp: CompFluid.h/cpp: compositional fluid module.h/cpp: base class for all modules rock compressibility module.h/cpp: mthRockCompModel.h/cpp: Comp.h/cpp: base fluid module. subclass of mthMobilityModel 173 . subclass of mthFluidModelbase mthRockFluidModel.h/cpp: BOFluid.h/cpp: • field class fluid Physical fluid Fluid. subclass of mthModelBase mthFluidModelBase. subclass of Fluid black-oil phase class. subclass of Fluid compositional fluid class. subclass of Phase compositional hydrocarbon phase class.h/cpp: Phase. subclass of mthModelBase mthCompMobilityModel.h/cpp: fluid base class phase base class component class black-oil fluid class.h/cpp: rock fluid module.

h/cpp: RockFluid2P. subclass of mthFlowEqnModel mthCompFlowEqnModel.h/cpp: physical rock fluid base class physical two-phase rock fluid class.h/cpp: • physical rock class rockfluid Physical rock fluid (relative permeability) RockFluid. subclass of mthModelbase mthBOFlowEqnModel.h/cpp: EqnSelector.h: EnumDef.h/cpp: reservoir class equation selector base class variable Type A (Coats’ model) equation selector class. subclass of EqnSelector • rock Physical rock Rock.h/cpp: physical three-phase rock fluid class. subclass of EqnSelector EqnSelectorYoung.h/cpp: variable Type B (Young and Stepenson’s model) equation selector class. subclass of RockFluid RockFluid3P. Enumerates and constants used in GPRS 174 . subclass of RockFluid • sim Simulation constant definition Comlibs.h: define common included files define structures.h/cpp: black-oil flow equation module. subclass of mthFlowEqnModel • res Reservoir Reservoir.h/cpp: base flow equation module.mthFlowEqnModel.h/cpp: compositional flow equation module.h/cpp: EqnSelectorCoats.

subclass of PreconditionerBase • utl Utilities FileIO.• solver Linear solvers LinearSolverBase.h/cpp: Table.h/cpp: LapackFullSolver.h/cpp: PreconditionerBase. true IMPES is used to generate the pressure equation. subclass of LinearSolverBase ImlGMRESSolver.h/cpp: block diagonal scaling preconditioner. subclass of PreconditionerBase BlockDiagPre.h/cpp: Strlib.h/cpp: Constraint Pressure Residual (CPR) preconditioner. subclass of PreconditionerBase AMGPre. subclass of PreconditionerBase ILUPre.h/cpp: Algebraic Multi-Grid (AMG) preconditioner from GMD software. subclass of PreconditionerBase QuasiIMPESPre.h/cpp: linear solver base class full matrix solver from LAPACK.h/cpp: Incomplete LU decomposition (ILU0) preconditioner from SparseLib++. subclass of LinearSolverBase BlitzSolver. subclass of PreconditionerBase TrueIMPESPre.h/cpp: file input and output class table read in and look up class string operation class 175 .h/cpp: solver from BlitzPak. subclass of LinearSolverBase LapackBandSolver.h/cpp: GMRES solver from IML (Iterative Math Library).h/cpp: band matrix solver from LAPACK.h/cpp: DiagPre. subclass of LinearSolverBase preconditioner base class diagonal scaling preconditioner. quasi IMPES is used to generate the pressure equation.h/cpp: Constraint Pressure Residual (CPR) preconditioner.

base class of DataVector ConnDataVector.h/cpp: well constant gas flow rate control class. subclass of WellCont WellWRateCont.F2Cwrapper. They are discussed below: 176 .h.4 Libraries GPRS uses several public domain libraries.h/cpp: Fortran to C++ wrapper class for Fortran subroutines MyMatrix. and most of them are used in the linear solver part. base class of DataVector DataPool.cpp: WellCont.h/cpp: IntDataVector.h/cpp: vector of double data class. base class of DataVector DFDataVector.h/cpp: vector of connection data class. suitable for small matrix vector of data base class vector of integer data class.h/cpp: well constant oil flow rate control class. subclass of WellCont WellGRateCont.h/cpp: WellCompl.h/cpp: well class well completion class well control base class well bottom hole pressure (BHP) control class.h/cpp: data pool class.h/cpp: DataVector. subclass of WellCont A.h/cpp: WellBHPCont.h/cpp: matrix operations class.h/cpp: well constant water flow rate control class. store and provide access to all DataVector objects • well Well. subclass of WellCont WellORateCont.

In GPRS. such as ILU0 (Incomplete LU decomposition without fill-in). • IML (Iterative Math Library) (Dongarra et al. In GPRS. It has a Fortran version and a C version. one for the wells data. which includes GMRES. • • BlitzPak (Landmark. we use the direct solvers (dgesv and dgbsv) from LAPACK.. 1999) This is a standard linear algebra package.org. • LAPACK (Linear Algebra Package) (Anderson.netlib. Contents of each of these files are describes below: 177 . GPRS interfaces with it. which includes LAPACK. three files are included (using “INCLUDE” keyword). AMG This is an Algebraic Multi-Grid (AMG) solver from GMD software (Ritzdorf. It is only used as a preconditioner for the pressure system in GPRS. In GPRS. For PC’s. which can be freely downloaded from http://www. and uses it as a structured grid solver.• STL (Standard Template Library) This library is a popular library that is treated by many as a standard C++ library.in”. LAPACK is already installed.5 Input Files The main input file for GPRS is normally called “gprs. Currently we are using the Fortran version.. For most SGI machines. which can be freely downloaded from www. one for the reservoir data. we only use its GMRES solver.mgnet. we use the MKL (Math Kernel Library) from INTEL. 1996) This is an iterative solver package (freely downloadable from http://math. 1996) This is a sparse matrices library (freely downloadable from http://math. and one for the control data. 1991).gov/iml++/).nist. etc. we use it for sparse matrix representation and ILU0 preconditioner.gov/sparselib++/) which includes some basic representations for sparse matrix. • SparseLib++ (Pozo et al. such as compressed row format. 1998) This is a commercial solver package from Landmark Graphic Corporation. A. and wrappers are used to interface it with the main C++ code. In GPRS. we use the “List” and “Vector” template classes from this library.nist. Within it.html.org/mgnet-codes-gmd. and some basic preconditioners. CG (Conjugate Gradient).

producer or injector) well completion data (well block indexes. and WI for each of them) well control data (all available well controls for this well) • Control file • • • • • • Timestep control (initial. and what are they) Linear solver control (which linear solver to use. 2002). maximum and fixed number of Newton iterations for each timestep) Timestep increase control (desired variable changes and increasing factor) Newton iteration convergence control (convergence criteria for variable changes and residuals) Formulation control (which type of variables to use. GOC. well group name. which reservoir it belongs to. black-oil or compositional (phase and component properties) phase component relation data (existence of each component in each phase) rock fluid data (relative permeability and capillary pressure) rock data (rock compressibility) initial equilibrium data (WOC. 178 . how many implicit levels. refer to the GPRS user’s manual. and total simulation time) Newton iteration number control (minimum. which preconditioner to use. which is provided as part of the GPRS package (Cao. minimum and maximum timestep size. initial pressure and overall composition. convergence tolerance and maximum number of iterations) For information about the keywords and data format used by the input files.• Reservoir input file • • • • • • grid data (grid geometry and properties) fluid data. etc) • Well input file • • • well specification (well name.

The general compositional formulation can be written as k rp k ∂ [Vφ ∑ ( S p ρ p xcp )] = ∑ [T ∑ ( ρ p xcp ∆Φ p )]l − ∑ [WI ∑ ( rp ρ p xcp ( p p − p w ))] ∂t µp µp p p l p W (B. Bg and Bo are the phase formation volume factors. p tables. ρ g and ρ o are the component densities (phases at standard conditions). where flash calculations are reduced to explicit relations. phase densities are only functions of pressure. gas and water) black-oil system. Considering a three-phase (oil. and the primary equations can be directly expressed as functions of only primary variables.Appendix B: Black-Oil Simulation Using Compositional Formulation The black-oil model is a special case of the general compositional model.4) ρg Bg ρo = ρ o + ρ g Rg . ρ w . which are functions of pressure and normally given as B vs. Bw .0 is the gas component solubility ratio in the oil phase. p table. and oil and water components can only exist in their own phases. which is also a sole function of pressure and given as a R vs.2) (B. and they are calculated by ρw = ρg = ρw Bw (B. 1996): • ρ p = ρ p ( p ) . the phase properties and component mole fractions can be calculated by the relations shown below (Aziz.o Bo where. assuming gas component can exist in both the gas and the oil phases. Rg .1) For the black-oil model.3) (B. Hence a general compositional simulator should be able to perform black-oil simulation given the correct input. 179 . which are input constants. such as formation volume factors and gas solubility.

6) (B.9) 180 . and can be calculated by the following relations: X o .5) (B. g = 1 X g .7) (B.o = (B. X cp = X cp ( p ) . and table lookup is used to get phase viscosities at specific pressure.8) X o .o = X g . p table is given.w = X w . component mole fractions are not independent variables.o ρ g Rg .o ρo = ρ o + ρ g Rg .o ρ o + ρ g Rg .o An even simpler method is to directly calculate ρ p X c . p Bp (B.• • µ p = µ p ( p ) . g = 0 X w . 1996) ρ p X c. phase viscosities are also only functions of pressure.w = X w . they are either constants or only functions of pressure. normally a µ p vs.w = X g . p = ρ c Rc . p from (Aziz. g = X o .

.i C where f w = 0.2) Different Cubic equations of state have different u. 1985): 1. bi = [1 + fω (1 − ( )0.i 0.1) (C. and they also use different relations to calculate parameters ai and bi of each component: • • 0. and ω i is the acentric factor of each component. the Cubic equation of state can be written as Z 3 + sZ 2 + qZ + r = 0 s = (u − 1) B − 1  where. w=0.3) 181 .42748 2TC2.i5 .176ω i2 • Peng-Robinson.37464 + 1. w values. j ) ai a j  j =1 i =1 .6. Calculate phase parameters and their derivatives: nh nh  a = ∑∑ X i X j (1 − k i . u=1.i T .i TC.i where f w = 0.i PC .i R 0. u=1.i PC.42748R 2TC2.08664 RTC . w=-1.i PC . q = A + ( w − u ) B 2 − uB r = − AB − wB 2 − wB 3  (C. bi = PC .i T . T is the reservoir temperature.  nh b = ∑ X i bi  i =1  (C.Appendix C Flash Calculation (Walas.5 Soave-Redlich-Kwong.i 0.i TC .26992ω i2 where TC .48 + 1. 1985) As mentioned in Section 2.i are the critical temperature and critical pressure of each component. ai = u=2. ai = Redlich-Kwong. the component fugacities and the phase properties can be calculated from the following 5 steps (Walas.08664 RTC .i T 0. bi = RT 0. ai = [1 + fω (1 − ( )0.07780 C.i and PC .5 ]2 P . w=0. 0.5 ]2 PC .45724R 2TC2. For the Cubic equation of state.574ω i − 0.54226ω i − 0.

1989): p nh Z=Z− ∑ X i ci RT i =1 (C.9) 3. Calculate compressibility factor Z and its derivatives: Z 3 + sZ 3 + qZ + r = 0 ∂s 2 ∂q ∂r  Z + Z+  ∂Z ∂p ∂p ∂p  =− 2 3Z + 2 sZ + q  ∂p  ∂s 2 ∂q ∂r  Z + Z+  ∂Z ∂X i ∂X i ∂X i =−  2 3Z + 2 sZ + q  ∂X i (C.7) and (C.nh  ∂a = 2 ai ∑ X j (1 − k i . (C.8) s = (u − 1) B − 1  where q = A + ( w − u ) B 2 − uB  2 3 r = − AB − wB − wB (C. j ) a j   ∂X i j =1 and   ∂b = b i  ∂X i  where k ij is the binary interaction parameter. perform volume translation (e. If necessary.g. Deo et al.5) A ∂a  ∂A  ∂X = a ∂X  i i   ∂B = B ∂b  ∂X i b ∂X i  (C.   ∂B = B  ∂p p  (C..6) 2.4) and ap   A = R 2T 2    B = bp   RT  ∂A A  ∂p = p  .10) 182 .

17) 183 . Calculate phase properties (phase densities and their derivatives): p ρ= ZRT ∂ρ ρ ρ ∂Z   ∂p = p − Z ∂p  and   ∂ρ = − ρ ∂Z  ∂X i Z ∂X i  5. Calculate component fugacities and their derivatives: f i = pX i e Φ i .13) (C.15) ∂f i f ∂Φ i = i + fi ∂p p ∂p ∂Z ∂B − ∂Φ i bi ∂Z ∂p ∂p = − ∂p b ∂p Z−B (C.and  ∂Z ∂Z 1 nh = − ∑ X i ci   ∂p ∂p RT i =1   ∂Z = ∂Z − p c  ∂X i ∂X i RT i  (C. (C.14) Φi = bi ( Z − 1) − ln( Z − B) b bi 1 ∂a 2Z + B(u + u 2 − 4w ) ( − ) ln[ ] − 2Z + B(u − u 2 − 4w ) B u 2 − 4w b a ∂X i A (C.11) where ci = S i bi 4.12) (C.16) bi 1 ∂a 1 1 ∂A A ∂B 2Z + B(u + u 2 − 4 w ) +( − − ) [( ) ln( ) b a ∂X i u 2 − 4w B ∂p B 2 ∂p 2Z + B(u − u 2 − 4w ) ∂Z ∂B ∂Z ∂B + 2 (u + u 2 − 4w ) 2 (u − u 2 − 4w ) + ∂p ∂p A ∂p ∂p + ( − )] B 2Z + B(u + u 2 − 4w ) 2Z + B(u − u 2 − 4w ) (C.

18) A ∂B 1 ∂A 2 Z + B(u + u 2 − 4 w ) − 2 ) ln( ) B ∂X j B ∂X j 2 Z + B (u − u 2 − 4 w ) ∂Z ∂B ∂Z ∂B + + 2 (u + u 2 − 4 w ) 2 (u − u 2 − 4 w ) ∂X j ∂X j ∂X j ∂X j A + ( − )] B 2 Z + B(u + u 2 − 4w ) 2 Z + B (u − u 2 − 4 w ) A B u 2 − 4w ln( 2 Z + B(u + u 2 − 4 w ) 2 Z + B (u − u 2 − 4 w ) )[ − − bi ∂b 1 ∂a ∂a + 2 2 b ∂X j a ∂X i ∂X j 2 (1 − k ij ) ai a j ] a + (C.f ∂f i ∂Φ i = i δ ij + f i ∂X j X i ∂X j ∂Φ i b ∂Z bi ∂b =[ i − 2 ( Z − 1) ]− ∂X j ∂X j b ∂X j b [( ∂Z ∂B − ∂X j ∂X j Z−B +( bi 1 ∂a 1 − ) 2 b a ∂X i u − 4 w (C.19) 184 .

Sign up to vote on this title
UsefulNot useful