Download as pdf or txt
Download as pdf or txt
You are on page 1of 70

Numerical Methods in Reservoir Simulation S I X

Set the iteration counter ν = 0

Calculate the α iν−1, j , α iν+1, j , α iν, j , α iν, j −1 , α iν, j +1 and β iν, j at

( )
n ν
values of pressure = Pi , j

[(
α iν, j = α i , j Pin, j+1 )]
ν
where ν = current iteration number.

Solve the set of linear equations:


ν = ν +1
α iν−1, j .Pin−+11, j + α iν+1, j .Pin++11, j + α iν, j .Pin, j+1 + α iν, j −1 .Pin, j+−11 + α iν, j +1 .Pin, j++11 = β iν, j

( )
ν +1
to obtain Pin, j+1 = Pin, j+1

Calculate

Σ (P ) n +1 ν +1
( )
ν
Err = i, j − Pi ,nj+1
all i , j

No - continue iterations
Err < Tol ?

Yes (the method has converged)

Stop

Reservoir Simulation Petroleum Engineering


05/12/2016
Numerical Methods in Reservoir Simulation S I X

CONTENTS

1. INTRODUCTION 6. DIRECT SOLUTION OF THE NON-LINEAR


EQUATIONS OF MULTI-PHASE FLOW
2. REVIEW OF FINITE DIFFERENCES 6.1. Introduction to Sets of Non-linear
Equations
3. APPLICATION OF FINITE DIFFERENCES 6.2. Newton’s Method for Solving Sets of Non-
TO PARTIAL DIFFERENTIAL EQUATIONS linear Equations
(PDEs) 6.3. Newton’s Method Applied to the Non-
3.1. Explicit Finite Difference Approximation linear Equations of Two-Phase Flow
of the Linear Pressure Equation
3.2. Implicit Finite Difference Approximation 7. NUMERICAL DISPERSION - A
of the Linear Pressure Equation MATHEMATICAL APPROACH
3.3. Implicit Finite Difference Approximation 7.1. Introduction to the Problem
of the 2D Pressure Equation 7.2. Mathematical Derivation of Numerical
3.3.1 Discretisation of the 2D Pressure Equation Dispersion
3.3.2 Numbering Schemes in Solving the 2D
Pressure Equation 8. CLOSING REMARKS
3.4. Implicit Finite Difference Approximation
of Non-linear Pressure Equations APPENDIX A: Some Useful Matrix Theorems.

4. APPLICATION OF FINITE DIFFERENCES


TO TWO-PHASE FLOW
4.1 Discretisation of the Two-Phase Pressure
and Saturation Equations
4.2 IMPES Strategy for Solving the Two-Phase
Pressure and Saturation Equations

5. THE NUMERICAL SOLUTION OF LINEAR


EQUATIONS
5.1. Introduction to Linear Equations
5.2. General Methods for Solving Linear
Equations
5.3. Direct Methods for Solving Linear
Equations
5.4. Iterative Methods for Solving Linear
Equations
5.5. A Comparison of Iterative and Direct
Methods for Solving Linear Equations

Reservoir Simulation Petroleum Engineering


Petroleum Engineering Reservoir Simulation

LEARNING OBJECTIVES:

Having worked through this chapter the student should be able to:

‡ VWDWHWKHVLPSOHÀQLWHGLIIHUHQFHH[SUHVVLRQVIRUÀUVWRUGHUGHULYDWLYHV
,P/,x and ,P/,W H[SODLQLQJ \RXU VSDWLDO VSDFH  DQG WHPSRUDO WLPH 
notation ( Pin , Pin +1 , Pin++11 , Pin−+11 etc. ).

‡ H[SODLQWKHPHDQLQJRIWKHIRUZDUGGLIIHUHQFHWKHEDFNZDUGGLIIHUHQFH
DQGWKHFHQWUDOGLIIHUHQFHDQGWKHRUGHURIWKHHUURUDVVRFLDWHGZLWKHDFK
O(6x) or O(6x2).

• derive the approximation to the second order spatial derivative of


Pressure (d2P/dx2 EDVHGRQÀUVWRUGHUGHULYDWLYHV

‡ DSSO\ ÀQLWH GLIIHUHQFH DSSUR[LPDWLRQV WR D VLPSOH SDUWLDO GLIIHUHQWLDO


equation (PDE) such as the diffusion equation and explain what is meant
by an explicit and an implicit numerical scheme.

• apply the explicit numerical scheme for a simple PDE for given boundary
DQGLQLWLDOFRQGLWLRQVDQGEHDEOHWRGHVFULEHWKHHIIHFWRIWLPHVWHSVL]H
6t.

‡ VKRZKRZWKHLPSOLFLWÀQLWHGLIIHUHQFHVFKHPHDSSOLHGWRDVLPSOHOLQHDU
PDE leads to a set of linear equations which are tridiagonal in 1D and
pentadiagonal in 2D.

‡ ZULWHGRZQWKHH[SDQGHGH[SUHVVLRQVIRUDVHWRIOLQHDUHTXDWLRQVZKLFK
in compact form are written A.x = b ZKHUH WKH PDWUL[ A is an nxn
PDWUL[RI NQRZQ FRHIÀFLHQWV DijL URZVM FROXPQV b is a vector
RIQ NQRZQ YDOXHVDQGxLVWKHYHFWRURIQXQNQRZQVZKLFKZHDUH
solving for.

• explain clearly the main differences between a direct and an iterative


VROXWLRQPHWKRGIRUWKHVHWRIOLQHDUHTXDWLRQVA.x = b.

• write down the algorithm for a very simple iterative scheme for solving
A.x = b DQG EH DEOH WR GHVFULEH WKH VLJQLÀFDQFH RI WKH LQLWLDO JXHVV
x(0)  ZKDW LV PHDQW E\ LWHUDWLRQ DQG LWHUDWLRQ FRXQWHU i  WKH LGHD RI
convergence of x(i) as i A' and be able to comment on the number of
LWHUDWLRQVUHTXLUHGIRUFRQYHUJHQFH1iter.

• explain how to apply (without derivation) the Newton-Raphson method


IRU VROYLQJ D VLQJOH QRQOLQHDU DOJHEUDLF HTXDWLRQ f ( x)  0; Newton-
f (x( ν) )
Raphson scheme => x ( ν +1) = x ( ν ) −
f ′( x ( ν ) )

05/12/2016
2
Numerical Methods in Reservoir Simulation S I X

NUMERICAL METHODS IN RESERVOIR SIMULATION

$VQRWHGLQ&KDSWHUWKHPXOWLSKDVHÁRZHTXDWLRQVIRUUHDOV\VWHPVDUHVRFRPSOH[
that it is not remotely possible to solve them analytically. In practice these equations
can only be solved numerically. The most commonly applied numerical methods are
EDVHGRQÀQLWHGLIIHUHQFHDSSUR[LPDWLRQVRIWKHÁRZHTXDWLRQVDQGWKLVDSSURDFK
will be followed in this chapter.

$IWHUDEULHIUHYLHZRIÀQLWHGLIIHUHQFHVZHJRRQWRDSSO\WKHPWRYHU\VLPSOH
V\VWHPVVXFKDVIRUWKHVLPSOLÀHG'SUHVVXUHHTXDWLRQ GHULYHGLQ&KDSWHU 7KLV
equation does not need to be solved numerically but it demonstrates how explicit
DQGLPSOLFLWÀQLWHGLIIHUHQFHVROXWLRQFDQEHGHYHORSHG:HWKHQVKRZKRZVHWVRI
linear equations arise in solving implicit equations and we consider solution of the
linear equations in an elementary manner. We then consider how the 2D pressure
equation is solved.

,QWKHQXPHULFDOVROXWLRQRIWKHPXOWLSKDVHÁRZHTXDWLRQVZHQHHGWRVROYHIRU
SUHVVXUHDQGÁRZ$QRXWOLQHRIKRZWKLVLVGRQHLVSUHVHQWHGEXWZHGRQRWJRLQWR
great detail.

1. INTRODUCTION

$WWKHYHU\VWDUWRIWKLVFRXUVHZHFRQVLGHUHGDYHU\VLPSOH´VLPXODWLRQPRGHOµ
IRU D JURZLQJ FRORQ\ RI EDFWHULD  7KH QXPEHU RI EDFWHULD 1 JUHZ ZLWK D UDWH
proportional to N itself i.e. (dN/dt) = _1ZKHUH_ is a constant. We saw that this
α.t
VLPSOHHTXDWLRQKDGDZHOONQRZQDQDO\WLFDOVROXWLRQ N( t ) = N o .e ZKHUH1o
LVWKHQXPEHURIEDFWHULDDWWLPHW 7KLVH[SRQHQWLDOJURZWKODZSURYLGHVWKH
VROXWLRQWRRXUPRGHO+RZHYHUZHDOVRLQWURGXFHGWKHLGHDRIDQXPHULFDOPRGHO
ZKHUHHYHQDOWKRXJKZHFRXOGVROYHWKHSUREOHPDQDO\WLFDOO\ZHIRUPXODWHGLWWKLV
ZD\LQDQ\FDVH7KHQXPHULFDOYHUVLRQRIWKHPRGHOFDPHXSZLWKWKHDOJRULWKP
(or recipe) N n +1 = (1 + α.Δt ).N n ,QWKHH[HUFLVHLQ&KDSWHU\RXVKRXOGKDYH
FRPSDUHGWKHUHVXOWVRIWKHDQDO\WLFDODQGQXPHULFDOPRGHOVDQGIRXQGRXWWKDWWKH\
JHWFORVHUDVZHWDNHVXFFHVVLYHO\VPDOOHUWLPHVWHSV6W,QWKLVFDVHZHVD\WKDWWKH
QXPHULFDOPRGHOFRQYHUJHVWRWKHDQDO\WLFDOPRGHO,QIDFWLQPDQ\DUHDVRIVFLHQFH
DQGHQJLQHHULQJZHRIWHQDSSO\DQXPHULFDOWHFKQLTXHWRDSUREOHPZHFDQDOUHDG\
VROYHDQDO\WLFDOO\LHZKHUHZH´NQRZWKHDQVZHUµ:K\ZRXOGZHGRWKLV"7KH
answer is that we might be testing the numerical method to see how closely it gives
WKHULJKWDQVZHU0RUHFRPPRQO\ZHPLJKWWHVWVHYHUDOPD\EHRUQXPHULFDO
WHFKQLTXHVWRGHWHUPLQHZKLFKRQHZRUNVEHVW7KHSKUDVH´ZRUNVEHVWµLQWKHFRQWH[W
of a numerical method usually means gives the most accurate numerical agreement
ZLWKWKHDQDO\WLFDODQVZHUIRUWKHOHDVWDPRXQWRIFRPSXWDWLRQDOZRUN1RWHWKH
LPSRUWDQFH RI WKLV EDODQFH EHWZHHQ DFFXUDF\ DQG ZRUN IRU D QXPHULFDO PHWKRG
7KHUHPD\EHQRSRLQWLQKDYLQJDQXPHULFDOPHWKRGWKDWLV´WZLFHµDVDFFXUDWH LQ
VRPHVHQVH IRUWHQWLPHVWKHDPRXQWRIFRPSXWDWLRQDOZRUN

,Q&KDSWHUZHDOUHDG\PHWWKHHTXDWLRQVIRUVLQJOHSKDVHDQGWZRSKDVHÁRZRI
FRPSUHVVLEOHÁXLGVWKURXJKSRURXVPHGLD7KHVHWXUQHGRXWWREHnon-linear partial
differential equations (PDEs). Recall that a non-linear PDE is one where certain
FRHIÀFLHQWVLQWKHHTXDWLRQGHSHQGRQWKHDQVZHUZHDUHWU\LQJWRÀQGHJ6w [W 

Institute of Petroleum Engineering, Heriot-Watt University 3


Petroleum Engineering Reservoir Simulation

3 [\]W  HWF  )RU H[DPSOH IRU VLQJOH SKDVH FRPSUHVVLEOH ÁRZ WKH HTXDWLRQ IRU
SUHVVXUH3 [W LQ'LVJLYHQE\

⎛ ∂P ⎞ ∂ ⎡ k.ρ ⎛ ∂P ⎞ ⎤
c( P )⎜ ⎟ = ⎜ ⎟
⎝ ∂t ⎠ ∂x ⎢⎣ μ ⎝ ∂x ⎠ ⎥⎦
(1)

,QWKLVHTXDWLRQERWKWKHJHQHUDOLVHGFRPSUHVVLELOLW\WHUPF 3  RIERWKWKHURFNDQG
WKHÁXLG DQGWKHGHQVLW\l 3 WHUPVGHSHQGRQWKHXQNQRZQSUHVVXUH3ZKLFK
ZHDUHWU\LQJWRÀQG$VQRWHGSUHYLRXVO\VXFKQRQOLQHDU3'(VDUHYHU\GLIÀFXOW
to solve analytically and we must usually resort to numerical methods. The main
WRSLFRIWKLVPRGXOHLVRQKRZZHVROYHWKHUHVHUYRLUÁRZHTXDWLRQVQXPHULFDOO\
This process involves the following steps:

L  )LUVWO\ZHPXVWWDNHWKH3'(GHVFULELQJWKHÁRZSURFHVVDQG´FKRS
 LW XSµ LQWR JULG EORFNV LQ VSDFH  7KLV LV NQRZQ DV spatial
discretisation DQG LQ WKLV FRXUVH ZH ZLOO H[FOXVLYHO\ XVH ÀQLWH
difference methods for this purpose.

LL  :KHQ ZH DSSO\ ÀQLWH GLIIHUHQFHV ZH XVXDOO\ HQG XS ZLWK VHWV RI
 QRQOLQHDUDOJHEUDLFHTXDWLRQVZKLFKDUHVWLOOTXLWHGLIÀFXOWWRVROYH
 ,Q VRPH FDVHV ZH GR VROYH WKHVH QRQOLQHDU HTXDWLRQV  +RZHYHU
we usually linearise these equations in order to obtain a set of linear
equations.

(iii) We then solve the resulting sets of linear equations. Many numerical
options are available for solving sets of linear equations and these will
be discussed below. This is often done iteratively by repeatedly
solving them until the numerical solution converges.

This module will deal successively with each of the parts of the numerical solution
SURFHVV L  LLL DERYH

2. REVIEW OF FINITE DIFFERENCES

'HÀQLWLRQ $ÀQLWHGLIIHUHQFHVFKHPHLVVLPSO\DZD\RIDSSUR[LPDWLQJ

⎛ dP ⎞ , ⎛ ∂P ⎞ , ⎛ ∂2 P ⎞
derivatives of a function (e.g. ⎜ ⎟ ⎜ 2 ⎟ etc.)
⎝ dx ⎠ ⎝ ∂t ⎠ ⎝ ∂x ⎠
    QXPHULFDOO\IURPHLWKHUSRLQWRUEORFNYDOXHVRIWKHIXQFWLRQ

7KHPDLQFRQFHSWRIÀQLWHGLIIHUHQFHDSSUR[LPDWLRQLVEHVWLOOXVWUDWHGE\WKHIROORZLQJ
VLPSOHH[DPSOHZKHUHZHUHIHUWR)LJXUH6WXG\WKH1RWDWLRQLQWKLVÀJXUHVLQFHLW
LVWKHEDVLVRIWKDWXVHGWKURXJKRXWWKLVFKDSWHU7KHPDLQWDVNRIWKHÀQLWHGLIIHUHQFH
DSSURDFKLVWRUHSUHVHQWWKHGHULYDWLYHVRIWKHIXQFWLRQ3 [ LQDQDSSUR[LPDWHPDQQHU

05/12/2016
4
Numerical Methods in Reservoir Simulation S I X

⎛ dP ⎞ , ⎛ ∂P ⎞ , ⎛ ∂ P ⎞ etc.
2
i.e. ⎜ ⎟ ⎜ 2⎟
⎝ dx ⎠ ⎝ ∂t ⎠ ⎝ ∂x ⎠

First consider how we might approximate (dP/dx) at xi using the quantities in Figure
,QIDFWLWLVHDVLO\VHHQWKDWWKHUHDUHWKUHHZD\VZHPD\GRWKLVDVIROORZV

$SSUR[LPDWLRQ)RUZDUG'LIIHUHQFHV IG ZHPD\WDNHWKHVORSHEHWZHHQ3i and


Pi+1 as being approximately ⎛
dP ⎞
at xi to obtain:
⎝ dx ⎠ i

⎛ dP ⎞ = Pi +1 − Pi (2)
⎝ dx ⎠ i fd ∆x

$SSUR[LPDWLRQ%DFNZDUG'LIIHUHQFHV EG ZHPD\WDNHWKHVORSHEHWZHHQ3i-1
and Pi as being approximately ⎛
dP ⎞
at xi to obtain:
⎝ dx ⎠ i

⎛ dP ⎞ = Pi − Pi −1 (3)
⎝ dx ⎠ i bd ∆x

$SSUR[LPDWLRQ&HQWUDO'LIIHUHQFHV FG WKLUGO\ZHFRXOGWDNHWKHDYHUDJHRI
WKHIRUZDUGGLIIHUHQFH IG DQGEDFNZDUGGLIIHUHQFH EG DSSUR[LPDWLRQVWRJLYHXV
⎛ dP ⎞ at x 7KLVLVNQRZQDVFHQWUDOGLIIHUHQFHV FG DQGLVJLYHQE\
⎝ dx ⎠ i i

⎛ dP ⎞ = 1 ⎡⎛ dP ⎞ + ⎛ dP ⎞ ⎤ = 1 ⎡ Pi +1 − Pi + Pi − Pi −1 ⎤ (4)
⎝ dx ⎠ i cd 2 ⎢⎣⎝ dx ⎠ i fd ⎝ dx ⎠ i bd ⎥⎦ 2 ⎣⎢ ∆x ∆x ⎦⎥
⎛ dP ⎞ P − Pi −1 ⎤
= ⎡⎢ i +1
⎝ dx ⎠ i cd ⎣ 2.∆x ⎥⎦

Institute of Petroleum Engineering, Heriot-Watt University 5


Petroleum Engineering Reservoir Simulation

Pi+1

P(x)
Pi

Pi-1

∆x = constant
∆x ∆x
xi-1 xi xi-1
x
Notation:
∆x = the x- grid spacing or distance between grid points
(i - 1), i, (i + 1) = the x - label (subscript) for the grid point or block numbers
Pi-1, Pi, Pi+1 = the corresponding function values at grid point i-1, i, i+1 etc.

Figure 1 1RWDWLRQIRUWKHDSSOLFDWLRQRIÀQLWHGLIIHUHQFHPHWKRGVIRUDSSUR[LPDWLQJGHULYDWLYHV

Each of the above approximations to


⎛ dP ⎞ is shown graphically in Figure 2.
⎝ dx ⎠ i
You may wonder why we bother with three different numerical approximations to

⎛ dP ⎞
DQGDVNZKLFKLV´EHVWµ"7KHUHLVQRWDQXQTXDOLÀHGDQVZHUWRWKLVTXHVWLRQ
⎝ dx ⎠ i
MXVW \HW EXW OHW XV WDNH D VLPSOH QXPHULFDO H[DPSOH P( x) = e 3x ZKHUH ZH NQRZ
WKHULJKWDQVZHUDQGH[DPLQHHDFKRIWKHIRUZDUGEDFNZDUGDQGFHQWUDOGLIIHUHQFH
approximations. The values given in Figure 3 will illustrate how the methods perform.
)LUVWO\VLPSO\FDOFXODWHWKHYDOXHVJLYHQE\HDFKPHWKRGVIRUWKHGDWDLQ)LJXUH

⎛ dP ⎞ ⎡ 3.0042 − 2.7183 ⎤
⎜⎝ ⎟⎠ ≈ ⎢ ⎥⎦ = 2.859 [ err ≈ +0.14 ]
dx i fd ⎣ 0.1

⎛ dP ⎞ ⎡ 2.7183 − 2.4596 ⎤
⎜⎝ ⎟⎠ ≈ ⎢ ⎥⎦ = 2.587 [ err ≈ −0.13]
dx i bd ⎣ 0..1

⎛ dP ⎞ ⎡ 3.0042 − 2.4596 ⎤
⎜⎝ ⎟⎠ ≈ ⎢ ⎥⎦ = 2.723 [ err ≈ −0.005 ] (5)
dx i cd ⎣ 2 x 0.1

7KHTXDQWLW\LQVTXDUHEUDFNHWVDIWHUHDFKRIWKHÀQLWHGLIIHUHQFHDSSUR[LPDWLRQV
above is the error i.e. the difference between that method and the right answer which
LV$VH[SHFWHGIURPWKHÀJXUHIRUWKLVFDVHWKHIRUZDUGGLIIHUHQFHDQVZHU
is a little too high (by 5 DQGWKHEDFNZDUGGLIIHUHQFHDQVZHULVDOLWWOHWRR
low (by 5 -0.13). The central difference approximation is rather better than either

05/12/2016
6
Numerical Methods in Reservoir Simulation S I X

RIWKHSUHYLRXVRQHV,QIDFWZHQRWHWKDWWKHIGDQGEGPHWKRGVJLYHDQHUURURI
order 6[WKHJULGVSDFLQJ ZKHUHDVHQJLQHHUVZHDUHVD\LQJ5 0.1 !). The
FGDSSUR[LPDWLRQRQWKHRWKHUKDQGKDVDQHUURURIRUGHU6x2 (where again we are
VD\LQJ [  0RUHIRUPDOO\ZHVD\WKDWWKHHUURULQWKHIGDQGEG
approximations are "of order 6[ZKLFKZHGHQRWH2 6[ DQGWKHFGDSSUR[LPDWLRQ
has an error "of order 6x2ZKLFKZHGHQRWH2 6x2).
⎛ ∂2 P ⎞
1RZFRQVLGHUWKHÀQLWHGLIIHUHQFHDSSUR[LPDWLRQRIWKHVHFRQGGHULYDWLYH ⎜ ⎟
⎛ ∂P ⎞ ⎝ ∂x 2 ⎠
*RLQJEDFNWR)LJXUHWKHGHÀQLWLRQRIVHFRQGGHULYDWLYHDW⎜ ⎟ x is the rate of
⎝ ∂x ⎠ i
change of slope (dP/dx) at xi7KHUHIRUHZHFDQHYDOXDWHWKLVGHULYDWLYHEHWZHHQ
xi-1 and xi (i.e. the bd approximation) and then do the same between xi and xi+1 (i.e.
WKHIGDSSUR[LPDWLRQ DQGVLPSO\WDNHWKHUDWHRIFKDQJHRIWKHVHWZRTXDQWLWLHVZLWK
UHVSHFWWR[DVIROORZV

⎛ dP ⎞ − ⎛ dP ⎞
⎛ ∂ P⎞
2
⎝ dx ⎠ i fd ⎝ dx ⎠ i bd
⎜ 2⎟ ≈
⎝ ∂x ⎠ ∆x

⎛ Pi +1 − Pi ⎞ − ⎛ Pi − Pi −1 ⎞
⎝ ∆x ⎠ i fd ⎝ ∆x ⎠ i bd

∆x

⎛ ∂2 P ⎞ (Pi +1 + Pi −1 − 2 Pi )
⎜ 2⎟ ≈ (6)
⎝ ∂x ⎠ ∆x 2

⎛ ∂2 P ⎞
Calculating the numerical value of ⎜ ⎟ for the example in Figure 3 (where again
⎝ ∂x 2 ⎠
⎛ ∂2 P ⎞
⎜ 2 ⎟  VLQFHWKHH[DPSOHLVWKHH[SRQHQWLDOIXQFWLRQ JLYHV
⎝ ∂x ⎠

⎛ ∂ 2 P ⎞ 3.0042 + 2.4596 − 2 x 2.7183


⎜ 2⎟ ≈ = 2.7200 [err ≈ 0.0017] (7)
⎝ ∂x ⎠ 0.12

7KXVZHFDQVHHWKDWWKHHUURULQWKLVFDVH HUU5 0.0017 5 0.12) is actually O(6x2).

,QWKHLQWURGXFWRU\VHFWLRQRI&KDSWHUZHDOUHDG\DSSOLHGWKHLGHDRIÀQLWHGLIIHUHQFHV
(although we didn’t call it that at the time) to the simple ordinary differential equation

(ODE); ⎛
dN ⎞
= α.N
⎝ dt ⎠
+HUH1 QXPEHURIEDFWHULDLQWKHFRORQ\ DVDIXQFWLRQRIWLPH1 W LVWKHXQNQRZQ
ZHZDQWWRÀQG'HQRWLQJ1n and Nn+1 as the size of the colony at times t (labelled
n) and t+6W ODEHOOHGQ ZHDSSOLHGÀQLWHGLIIHUHQFHVWRREWDLQ

Institute of Petroleum Engineering, Heriot-Watt University 7


Petroleum Engineering Reservoir Simulation

n +1
⎛ dN ⎞ ≈ N − N ≈ α.N n
n
(8)
⎝ dt ⎠ ∆t

N n +1 ≈ (1 + α.∆t )N n
This gave us our very simple algorithm to explicitly calculate Nn+1:HWKHQWRRN
this as the current value of N and applied the algorithm repeatedly.

dP Pi+1 - Pi-1
=
dx i cd 2.∆x
Pi+1

P(x)
dP Pi+1 - Pi
=
Pi dx i fd ∆x

Pi-1
dP Pi - Pi-1
=
dx i bd ∆x
∆x ∆x
xi-1 xi xi+1
x ∆x = constant

Figure 2 *UDSKLFDOLOOXVWUDWLRQRIWKHÀQLWHGLIIHUHQFHGHULYDWLYHVFDOFXODWHGE\EDFNZDUG
GLIIHUHQFHV EG IRUZDUGGLIIHUHQFHV FG DQGFHQWUDOGLIIHUHQFHV

2
dP = 2.7183 d P = 2.7183
2
dx x=1.0 dx x=1.0

Pi+1 3.0042

P(x)

Pi 2.7183

Pi-1 2.4596

0.1 0.1

0.9 1.0 1.1


x

Figure 3 $QXPHULFDOH[DPSOHZKHUHWKHIXQFWLRQYDOXHVDQGGHULYDWLYHYDOXHVDUHNQRZQ
(P(x) = ex)

05/12/2016
8
Numerical Methods in Reservoir Simulation S I X

EXERCISE 1.

$SSO\ÀQLWHGLIIHUHQFHVWRWKHVROXWLRQRIWKHHTXDWLRQ

⎛ dy ⎞ = 2.y 2 + 4
⎝ dt ⎠

ZKHUHDWW \ W   7DNHWLPHVWHSVRI6t = 0.001 (arbitrary time units) and


step the solution forward to t = 0.25. Use the notation yn+1IRUWKH XQNQRZQ \DW
n+1 time level and ynIRUWKH NQRZQ \YDOXHDWWKHFXUUHQWQWLPHOHYHO

Plot the numerically calculated y as a function of t between t = 0 and t = 0.25 and


SORWLWDJDLQVWWKHDQDO\WLFDOYDOXH GRWKHLQWHJUDOWRÀQGWKLV 

$QVZHULVJLYHQEHORZZKHUHWKHZRUNLQJLVVKRZQLQVSUHDGVKHHWCHAP6Ex1.
xls.7KLVJLYHVWKHÀQLWHGLIIHUHQFHIRUPXODDVSUHDGVKHHWLPSOHPHQWLQJLWDQGWKH
analytical solution for comparison.

3. APPLICATION OF FINITE DIFFERENCES TO PARTIAL


DIFFERENTIAL EQUATIONS (PDEs)

3.1 Explicit Finite Difference Approximation of the Linear Pressure


Equation
:HKDYHVHHQLQ&KDSWHUWKDWWKHÁRZHTXDWLRQVDUHDFWXDOO\SDUWLDOGLIIHUHQWLDO
HTXDWLRQV 3'(V VLQFHWKHXQNQRZQV3 [W DQG6w [W VD\GHSHQGRQERWKVSDFHDQG
WLPH$VDQH[DPSOHRIDOLQHDU3'(ZHZLOOWDNHWKHVLPSOLÀHGSUHVVXUHHTXDWLRQ
(equation 26; Chapter 5) as follows:

⎛ ∂P ⎞ k ⎛ ∂2 P ⎞
⎜ ⎟ =
⎝ ∂t ⎠ cφμ ⎜⎝ ∂x 2 ⎟⎠
(9)

k
where the constant is the hydraulic diffusivity, which we denoted previously
cφμ
by Dh$VZHQRWHGLQ&KDSWHUWKLV3'(LVlinearZKLFKKDVNQRZQDQDO\WLFDO
VROXWLRQVIRUYDULRXVERXQGDU\FRQGLWLRQV+RZHYHUZHZLOODJDLQQHJOHFWWKHVHDQG
DSSO\QXPHULFDOPHWKRGVDVDQH[DPSOHRIKRZWRXVHÀQLWHGLIIHUHQFHVWRVROYH3'(V
QXPHULFDOO\7RPDNHWKLQJVHYHQVLPSOHUZHZLOOWDNH'h JLYLQJWKHHTXDWLRQ

⎛ ∂P ⎞ ⎛ ∂ P ⎞
2
⎜ ⎟ =⎜ 2⎟ (10)
⎝ ∂t ⎠ ⎝ ∂x ⎠

This is the pressure equation for a 1D system where 0 w x w /ZKHUH/LVWKHOHQJWK


RIWKHV\VWHP:HFDQYLVXDOLVHWKLVSK\VLFDOO\PXFKDVZHGLGLQ&KDSWHU6HFWLRQ
2.1 - using Figure 4. After the system is held constant at P = PoWKHLQOHWSUHVVXUH
is raised (at x = 0) instantly to P = Pin while the outlet pressure is held at Pout = Po.

Institute of Petroleum Engineering, Heriot-Watt University 9


Petroleum Engineering Reservoir Simulation

Pin

t = t1 t = t2
P

Po Pout = Po
t=0
0 x L

Figure 4 Physical picture of pressure propagation in a 1D (compressible) system

⎛ ∂P ⎞ ⎛ ∂ P ⎞
2
described by.⎜ ⎟ =⎜ 2⎟
⎝ ∂t ⎠ ⎝ ∂x ⎠

7KHVHSUHVVXUHV3in and PoutUHSUHVHQWWKHFRQVWDQWSUHVVXUHERXQGDU\FRQGLWLRQV


(Mathematically these are sometimes called Dirichlet boundary conditions). In other
ZRUGVWKHVHDUHVHWDVLIE\H[SHULPHQWDQGWKHV\VWHPEHWZHHQ[/PXVW´VRUW
LWVHOIRXWµRUUHVSRQGE\VLPSO\REH\LQJHTXDWLRQDERYH:HQRZDSSURDFK
WKLVSUREOHPXVLQJÀQLWHGLIIHUHQFHVDVIROORZV

• Discretise the x-direction by dividing it into a numerical grid of size 6x;


 ‡ &KRRVHDWLPHVWHS6t;
• Use the following notation

Pin AWLPHOHYHOQ 


A[JULGEORFNODEHOL 1; DW[ /

PinFXUUHQW NQRZQ 3DWWLPHOHYHO


Pin +1QHZ XQNQRZQ 3DWWLPHOHYHO

 ‡ )L[ WKH ERXQGDU\ FRQGLWLRQV ZKLFK LQ WKLV FDVH DUH DV IROORZV
(see Figure 4):

P1 = P in and PNX = Pout = PoZKLFKDUHÀ[HGIRUDOOW

 ‡ $SSO\ÀQLWHGLIIHUHQFHVWRHTXDWLRQXVLQJWKHDERYHQRWDWLRQWR
obtain:

⎛ ∂P ⎞ P n +1 − Pin
⎜ ⎟ ≈ i (11)
⎝ ∂t ⎠ i ∆t

and

⎛ ∂2 P ⎞ Pi??+1 + Pi??−1 − 2 Pi??


⎜ 2⎟ ≈ (12)
⎝ ∂x ⎠ i ∆x 2

05/12/2016
10
Numerical Methods in Reservoir Simulation S I X

+RZHYHUDQLVVXHDULVHVLQHTXDWLRQDERYHDVVKRZQE\WKHTXHVWLRQPDUNVRQ
WKHVSDWLDOGHULYDWLYHWLPHOHYHOV,WLVVLPSO\ZKLFKWLPHOHYHOVKRXOGZHWDNHIRU
WKHVSDWLDOGHULYDWLYHWHUPVLQHTXDWLRQ"7KLVLVLPSRUWDQWDQGZHZLOOUHWXUQWR
WKLVPDWWHUVRRQ+RZHYHUIRUWKHPRPHQWOHWXVWDNHWKHVHVSDWLDOGHULYDWLYHVDW
WLPHOHYHOQ WKH´NQRZQµOHYHO VLQFHWKLVZLOOWXUQRXWWREHWKHVLPSOHVWWKLQJZH
FDQGR7KXVZHREWDLQ

⎛ ∂2 P ⎞ Pin+1 + Pin−1 − 2 Pin


⎜ 2⎟ ≈ (13)
⎝ ∂x ⎠ i ∆x 2

(TXDWLQJ WKH QXPHULFDO ÀQLWH GLIIHUHQFH DSSUR[LPDWLRQV RI HDFK RI WKH DERYH
GHULYDWLYHVDVUHTXLUHGE\WKHRULJLQDO3'(HTXDWLRQ LHHTXDWLQJWKHH[SUHVVLRQV
in equations 11 and 13) gives:

Pi n +1 − Pi n Pi +n1 + Pi n−1 − 2 Pi n
≈ (14)
Δt Δ x2

ZKLFKHDVLO\UHDUUDQJHVWRREWDLQDQH[SOLFLWH[SUHVVLRQIRU Pin 1 WKHRQO\XQNQRZQ


in the above equation:

∆t n
2 ( i +1
Pin +1 = Pin + P + Pin−1 − 2 Pin ) (15)
∆x
,QZRUGVZHFDQLQWHUSUHWWKLVDERYHDOJRULWKPDVVD\LQJ

New (n+1 level) value of Pi = Old (n level) value of Pi + a “correction term”

Equation 15 gives the algorithm for propagating the solution of the PDE forward in
time from the given set of initial conditions.

We now consider how to set the initial conditions. The initial conditions are the values
of all the Pi L 1; DWW )URP)LJXUHWKHVHDUHFOHDUO\

P10 = Pin for all time (boundary condition)

Pi0  DWWLPHW IRUL1;


0
PNX = Po for all time (boundary condition)

/HWXVQRZDSSO\WKHDERYHDOJRULWKPWRWKHVROXWLRQRIHTXDWLRQ)RUWKLVSUREOHP
VXSSRVHZHWDNHWKHIROORZLQJGDWD

0 < x < 1.0

6[  !LPSOLHVJULGSRLQWV313233311 (NX = 11).

6t = 0.001

 3LQ 3R 

Institute of Petroleum Engineering, Heriot-Watt University 11


Petroleum Engineering Reservoir Simulation

7KHSUREOHPLVWKHQWRFDOFXODWHWKHVROXWLRQ3 [W WKDWLV Pin 1 for all i (at all grid


SRLQWV DQGDOOIXWXUHWLPHVXSWRVRPHÀQDOWLPH SRVVLEO\ZKHQWKHHTXDWLRQFRPHV
WRDVWHDG\VWDWHDVZLOOKDSSHQLQWKLVH[DPSOH 7KLVFDQEHGRQHE\ÀOOLQJLQWKH
´VROXWLRQFKDUWµ7DEOHVHH([HUFLVHEHORZ

Grid Blocks

Time
x= 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
t n (BC↓) (BC↓)
i= 1 2 3 4 5 6 7 8 9 10 11
0 0 P0
i
→ 1 0 0 0 0 0 0 0 0 0 0
(IC)
0.1 100 P100
i 1 0

0.2 200 P200


i
1 0

0.3 300 P300


i
1 0

0.4 400 P400


i
1 0

0.5 500 P500


i
1 0

0.6 600 P600 1 0


i

0.7 700 P700


i
1 0

0.8 800 P800


i
1 0

0.9 900 P900


i
1 0

1 1000 P1000
i
1 0
Note: BC = Boundary Conditions - these points are fixed;
IC = Initial Conditions, i.e. values of P(x, t = 0) for all i at t= 0

Table 1 Solution chart for the solution of the simple pressure equation

05/12/2016
12
Numerical Methods in Reservoir Simulation S I X

EXERCISE 2.

Fill in the above table using the algorithm (where (6t/6x2)=0.1):

∆t n
Pin +1 = Pin +
∆x 2
(Pi +1 + Pin−1 − 2Pin )

+LQWPDNHXSDVSUHDGVKHHWDVDERYHDQGVHWWKHÀUVWXQNQRZQEORFN VKRZQJUH\
shaded in table above) with the above formula. Copy this and paste it into all of the
FHOOVLQWKHHQWLUHXQNQRZQDUHD VXUURXQGHGE\EROGERUGHUDERYH 

$QVZHU,I\RXJHWVWXFNORRNDWVSUHDGVKHHWCHAP6Ex2.xlsRQWKHGLVN

7KHDVVXPSWLRQZHPDGHLQHTXDWLRQZDVWKDWWKHVSDWLDOGHULYDWLYHZDVWDNHQDW
WKHQ NQRZQ WLPHOHYHO7KLVDOORZHGXVWRGHYHORSDQexplicit formula for Pin 1
IRUDOOL 7KLVPHWKRGLVWKHUHIRUHNQRZQDVDQH[SOLFLWÀQLWHGLIIHUHQFHPHWKRG
We can learn about some interesting and useful features of the explicit method
which is encapsulated in equation 15 by simply experimenting with the spreadsheet
CHAP6Ex2.xls 7KUHH IHDWXUHV RI WKLV PHWKRG FDQ EH LOOXVWUDWHG E\ ´QXPHULFDO
H[SHULPHQWµDVIROORZV

L   7KHHIIHFWRIWLPHVWHSVL]H6t;

LL  7KHHIIHFWRIUHÀQLQJWKHVSDWLDOJULGVL]H6[ RUQXPEHURIJULGFHOOV1; 

(iii) The effect of running the calculation to steady-state as t A ' (in


SUDFWLFHXQWLOWKHQXPHULFDOO\FRPSXWHGVROXWLRQVWRSVFKDQJLQJ 

It is best if you do these yourself by modifying the spreadsheet (CHAP6Ex2.xls).

EXERCISE 3.

Experiment with the spreadsheet in CHAP6Ex2.xls to examine the effects of the


three quantities above - 6W6x (or NX) and the solution as t A'.

HINTS for Exercise 6.3:


• Sensitivity to 6W:KHQ\RXPDNH6t too big, the predicted numerical solution
of the PDE goes badly wrong - indeed negative pressures can occur which
LVSK\VLFDOO\LPSRVVLEOH,QIDFWWKHVROXWLRQKDVEHFRPHunstable for the
larger time steps. This means that this explicit numerical method does have
some time step limitations which we must be careful of.

Institute of Petroleum Engineering, Heriot-Watt University 13


Petroleum Engineering Reservoir Simulation

• Sensitivity to 6[  WKH HIIHFWV RI JULG UHÀQHPHQW DUH WKDW DV WKH JULG
EORFNVJHWVPDOOHU LH6x A 0 or NX A'). The answer should get
PRUHDFFXUDWHDOWKRXJKWRPDNHWKLVKDSSHQ\RXQHHGWRUHGXFHWKH
time step as well.

• Behaviour as t A')LQDOO\FRQVLGHULQJWKHORQJWLPHEHKDYLRURIWKH
VROXWLRQRIWKH3'(\RXVKRXOGÀQGWKDW3 [WA') tends to a straight
OLQH6RPHRWKHULQWHUPHGLDWHSUHVVXUHSURÀOHVFDQDOVREHSORWWHGXVLQJ
&+$3([[OV,QIDFWDOLWWOHELWRIDQDO\VLVVKRZVXVWKDWWKLVLVTXLWH
expected. As t A'WKHQLIVWHDG\VWDWHLVUHDFKHGWKHQ

⎛ ∂P ⎞ ⎛ ∂2 P ⎞
⎜ ⎟ = 0, which implies => ⎜ 2 ⎟ = 0
⎝ ∂t ⎠ ⎝ ∂x ⎠

%XWWKH´FXUYHµZLWKD]HURVHFRQGGHULYDWLYH LHDÀUVWGHULYDWLYHZKLFKLVFRQVWDQW 
LVDVWUDLJKWOLQH7KHUHIRUHWKLVUHVXOWLVSK\VLFDOO\UHDVRQDEOHDQGRXUQXPHULFDO
model appears to be behaving correctly.

$QRWKHUZD\WRUHSUHVHQWWKLVH[SOLFLWÀQLWHGLIIHUHQFHVROXWLRQWRWKH3'(LVVKRZQ
LQ)LJXUHZKHUHZHLQGLFDWHWKHWLPHOHYHOVIRUWKHVROXWLRQRIWKHHTXDWLRQVDQG
ZHDOVRVKRZWKHGHSHQGHQF\RIWKHXQNQRZQSUHVVXUH Pin +1).

n n n
Time P i-1 Pi P i+1
Δx Δx
Time level n
i-1 i i+1
Δt

Time level n + 1
n+1 n+1 n+1
P i-1 Pi P i+1

Figure 5 6FKHPDWLFRIWKHH[SOLFLWÀQLWHGLIIHUHQFHDOJRULWKPIRUVROYLQJWKHVLPSOH
pressure equation (a PDE).

3.2 Implicit Finite Difference Approximation of the Linear Pressure Equation


:HQRZUHWXUQWRWKHRULJLQDOÀQLWHGLIIHUHQFHHTXDWLRQZKHUHZHKDGWRPDNH
⎛ ∂2 P ⎞
D FKRLFH RI WLPH OHYHO IRU WKH VSDWLDO GHULYDWLYH ⎜ ⎟ . We now examine the
⎝ ∂x 2 ⎠
FRQVHTXHQFHVRIWDNLQJWKLVGHULYDWLYHDWWKH Q WLPHOHYHOWKLVLVWKH´XQNQRZQµ
WLPH OHYHO  7KH ÀQLWH GLIIHUHQFH HTXDWLRQ IRU WKLV FDVH LV DV IROORZV  7KH WLPH
GHULYDWLYHLVWKHVDPHLH

⎛ ∂P ⎞ P n +1 − Pin
⎜ ⎟ ≈ i (16)
⎝ ∂t ⎠ i ∆t

05/12/2016
14
Numerical Methods in Reservoir Simulation S I X

but the spatial derivative now becomes:

⎛ ∂2 P ⎞ Pin++11 + Pin−+11 − 2 Pin +1


⎜ 2⎟ ≈ (17)
⎝ ∂x ⎠ i ∆x 2

$VEHIRUHZHQRZHTXDWHWKHQXPHULFDOÀQLWHGLIIHUHQFHDSSUR[LPDWLRQVRIHDFK
RIWKHDERYHGHULYDWLYHV DVUHTXLUHGE\WKHRULJLQDO3'(HTXDWLRQ WRREWDLQ

Pin +1 − Pin Pin++11 + Pin−+11 − 2 Pin +1


≈ (18)
∆t ∆x 2

7KLVHTXDWLRQVKRXOGEHFRPSDUHGZLWKHTXDWLRQ,QWKHSUHYLRXVFDVHWKLVFRXOG
easily be rearranged into an explicit equation for Pin 1  HTXDWLRQ    +RZHYHU
equation 18 above cannot be rearranged to give a simple expression for the pressure
DWWKHQHZWLPHVWHS Q  Pin 1 ,QGHHGWKHUHQRZDSSHDUWREHthreeXQNQRZQVDW
WLPHOHYHO Q YL] Pin−+11 , Pin +1 and Pin++11 . This appears to be a bit of a paradox: how
GRZHÀQGWKUHHXQNQRZQVIURPDVLQJOHHTXDWLRQ HTXDWLRQDERYH "7KHDQVZHU
LVQRWUHDOO\WRRGLIÀFXOW%DVLFDOO\ZHKDYHDQHTXDWLRQOLNHHTXDWLRQat every
grid point. We will show below that this leads to a set of linear equations where we
KDYHH[DFWO\WKHVDPHQXPEHURIXQNQRZQVDVZHKDYHOLQHDUHTXDWLRQV7KHUHIRUH
LIWKHVHHTXDWLRQVDUHDOOOLQHDUO\LQGHSHQGHQWWKHQZHFDQVROYHWKHPQXPHULFDOO\
7KLVLVDELWPRUHWURXEOHWKDQRXUHDUOLHUVLPSOHH[SOLFLWÀQLWHGLIIHUHQFHPHWKRG
%HFDXVHZHGRQRWJHWDQH[SOLFLWH[SUHVVLRQIRURXUXQNQRZQVLQVWHDGZHJHWDQ
implicitVHWRIHTXDWLRQVWKLVPHWKRGLVNQRZQDVDQLPSOLFLWÀQLWHGLIIHUHQFHPHWKRG

7RVHHZKHUHWKHVHOLQHDUHTXDWLRQVFRPHIURPUHDUUDQJHHTXDWLRQDERYHWRREWDLQ

⎛ ∆x 2 ⎞ n +1 ⎛ ∆x 2 ⎞ n
Pin−+11 − ⎜ 2 + n +1
⎟ Pi + Pi +1 = −⎜ ⎟P (19)
⎝ ∆t ⎠ ⎝ ∆t ⎠ i

ZKHUHDOOWKHXQNQRZQV Pin−+11 , Pin +1 and Pin++11 ) are on the LHS of the equation and
WKHWHUPRQWKH5+6LV´NQRZQµVLQFHLWLVDWWKHROGWLPHOHYHOQ:HFDQZULWH
this equation as follows:

a i −1Pin−+11 + a i Pin +1 + a i +1Pin++11 = b i (20)

⎛ ∆x 2 ⎞ ⎛ ∆x 2 ⎞ n
and where a i −1 = 1; a i = −⎜ 2 + ⎟ i +1
; a = 1 and b = − ⎜ ⎟P
⎝ ∆t ⎠
i
⎝ ∆t ⎠ i

are all constants. The ai do not change throughout the calculation but the quantity bi
is updated at each time step as the newly calculated Pn+1 is set to the Pn for the next
WLPHVWHS:HFDQVHHKRZWKLVZRUNVIRUWKHJULGEORFNV\VWHPLQ)LJXUHEHORZ

Institute of Petroleum Engineering, Heriot-Watt University 15


Petroleum Engineering Reservoir Simulation

1 2 3 4 5
n n n n n
P1 P2 P3 P4 P5
Time level n ∆x

∆t
Time level n+1

P n+1
1
P n+1
2
P n+1
3
P n+1
4
P n+1
5

Boundary Boundary
condition condition
(fixed) (fixed)

Figure 6 6LPSOHH[DPSOHRIDJULGEORFNV\VWHPVKRZLQJKRZWKHLPSOLFLWÀQLWH
difference scheme is applied

$W HDFK JULG SRLQW WKHQ  D  ZH NQRZ WKH YDOXH IURP WKH ERXQGDU\ FRQGLWLRQ L
DQGL   E LWXVHVDERXQGDU\FRQGLWLRQ L DQGL  RU F LWLVVSHFLÀHG
FRPSOHWHO\E\HTXDWLRQ RQO\L LQWKLVFDVHEXWLWZRXOGEHPRVWSRLQWVIRU
a large number of grid points).

Consider each grid point in turn as follows:

i = 1 a boundary; therefore P1LVÀ[HGVD\DVP1

⎛ ∆x 2 ⎞ n
P1 + a 2 P2n +1 + P3n +1 = b2 = −⎜ ⎟P
⎝ ∆t ⎠ 2
i=2
⎛ ∆x 2 ⎞ n
=> a 2 P2n +1 + P3n +1 = −⎜ ⎟ P − P1
⎝ ∆t ⎠ 2

⎛ ∆x 2 ⎞ n
i=3 P2n +1 + a 3P3n +1 + P4n +1 = b3 = −⎜ ⎟P
⎝ ∆t ⎠ 3

⎛ ∆x 2 ⎞ n
P3n +1 + a 4 P4n +1 + P5 = b4 = −⎜ ⎟P
⎝ ∆t ⎠ 4
i=4
⎛ ∆x 2 ⎞ n
=> P3n +1 + a 4 P4n +1 = −⎜ ⎟ P4 − P5
⎝ ∆t ⎠

i = 5 a boundary; therefore P5LVÀ[HGVD\DVP5

7KHUHIRUH WKHUH DUH RQO\ WKUHH XQNQRZQV LQ WKH DERYH VHW RI OLQHDU HTXDWLRQV
( P2n 1 , P3n 1 and P4n 1 ) which can be summarised as follows:

05/12/2016
16
Numerical Methods in Reservoir Simulation S I X

⎛ ∆x 2 ⎞ n
i = 2: a 2 P2n +1 + P3n +1 = −⎜ ⎟P − P1
⎝ ∆t ⎠ 2

⎛ ∆x 2 ⎞ n
i = 3: P2n +1 + a 3 P3n +1 + P4n +1 = −⎜ ⎟P
⎝ ∆t ⎠ 3

⎛ ∆x 2 ⎞ n
i = 4: P3n +1 + a 4 P4n +1 = −⎜ ⎟P − P5
⎝ ∆t ⎠ 4
(21)

Note that the set of linear equations above can be represented as a simple matrix
equation as follows:

⎡ ⎛ ∆x 2 ⎞ n ⎤
⎢−⎜⎝ ⎟ P2 − P1 ⎥
⎡P2n +1 ⎤ ⎢ ∆t ⎠ ⎥
⎡ a2 1 0⎤
⎢ ⎛ ∆x 2 ⎞ ⎥
⎢ ⎥ ⎢ n +1 ⎥
⎢P3 ⎥ = ⎢−⎜ n
⎟ P3 ⎥
⎢1 a3 1⎥
⎢ ⎝ ∆t ⎠ ⎥
⎢⎣ 0 1 a 4 ⎥⎦ ⎢ n +1 ⎥
⎣P4 ⎦ ⎢ ⎥
⎢ − ⎛ ∆x ⎞ P n −
2

⎜ P5 ⎥
⎢⎣ ⎝ ∆t ⎟⎠ 4 ⎥⎦
(22)

The structure of this matrix equation is clearer when there are more equations involved.
)RUH[DPSOHLWLVTXLWHHDV\WRVKRZWKDWLIZHWDNHJULGSRLQWVLQVWHDGRIWKH
DERYHZHREWDLQHTXDWLRQV XVLQJWKHWZRÀ[HGERXQGDU\FRQGLWLRQVP1 and P12 )
IRUWKHTXDQWLWLHVP2n +1 , P3n +1 , P4n +1 ....P11n +1RIWKHIRUP

⎡−( ∆x 2 ∆t )P2n − P1 ⎤
⎡P n +1
⎤ ⎢ ⎥
⎡ a2 1 0 0 0 0 0 0 0 0 ⎤ 2
⎢ n +1 ⎥ ⎢−( ∆x 2 ∆t )P3n ⎥
⎢1 0 ⎥ ⎢P3 ⎥ ⎢ ⎥

a3 1 0 0 0 0 0 0
⎥ ⎢ n +1 ⎥ ⎢−( ∆x 2 ∆t )P4n ⎥
⎢0 1 a4 0 0 0 0 0 0 0 ⎥ ⎢P4 ⎥ ⎢ ⎥
⎢ ⎥ ⎢ P n +1 ⎥ ⎢−( ∆x 2 ∆t )P5n ⎥
⎢0 0 1 a5 1 0 0 0 0 0 ⎥
⎢ 5 ⎥ ⎢ ⎥
⎢0 0 0 1 a6 1 0 0 0 0 ⎥ ⎢P6n +1 ⎥ ⎢−( ∆x 2 ∆t )P6n ⎥
⎢ ⎥ ⎢ n +1 ⎥ = ⎢ ⎥
⎢0 0 0 0 1 a7 1 0 0 0 ⎥ ⎢P7 ⎥ ⎢−( ∆x 2 ∆t )P7n ⎥
⎢0 ⎢ ⎥
0 ⎥ ⎢ n +1 ⎥
⎢−( ∆x 2 ∆t )P8n
0 0 0 0 1 a8 1 0 ⎥
⎢ ⎥ ⎢P8 ⎥
⎢0 0 0 0 0 0 1 a9 1 0 ⎥ ⎢ P n +1 ⎥ ⎢ ⎥
⎢ ⎥ ⎢ 9 ⎥ ⎢−( ∆x 2 ∆t )P9n ⎥
⎢0 0 0 0 0 0 0 1 a10 1 ⎥ ⎢P10n +1 ⎥ ⎢ ⎥
⎢0 0 0 0 0 0 0 0 1 a11 ⎥⎦ ⎢ n +1 ⎥ ⎢−( ∆x 2 ∆t )P10
n ⎥
⎣ ⎢ ⎥
⎢⎣P11 ⎥⎦
⎢−( ∆x 2 ∆t )P11 − P12 ⎥⎦
n

(23)

And 20 grid points in 1D would lead to the following set of 18 equations:

Institute of Petroleum Engineering, Heriot-Watt University 17


Petroleum Engineering Reservoir Simulation

⎡ − ( ∆x 2 ∆t )P2n − P1 ⎤
⎢ ⎥
⎡P2n +1 ⎤ ⎢ − ( ∆x 2 ∆t )P3n ⎥
⎢ n +1 ⎥ ⎢ ⎥
⎡a 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ⎤
⎢P3 ⎥ ⎢ − ( ∆x 2 ∆t )P4n

⎢1 a3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ⎥ ⎢ n +1 ⎥ ⎢ ⎥
⎢ ⎥ ⎢P4 ⎥ ⎢ − ( ∆x 2 ∆t )P5n

⎢0 1 a4 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ⎥ ⎢ P n +1 ⎥ ⎢ ⎥
⎢ ⎥ ⎢ 5 ⎥ ⎢ − ( ∆x 2 ∆t )P6n ⎥
⎢0 0 1 a5 1 0 0 0 0 0 0 0 0 0 0 0 0 0 ⎥
⎢P6n +1 ⎥ ⎢ ⎥
⎢0 0 0 1 a6 1 0 0 0 0 0 0 0 0 0 0 0 0 ⎥ ⎢ n +1 ⎥ ⎢ − ( ∆x 2 ∆t )P7n ⎥
⎢ ⎥ ⎢P7 ⎥ ⎢ ⎥
⎢0 0 0 0 1 a7 1 0 0 0 0 0 0 0 0 0 0 0 ⎥
⎢ n +1 ⎥ ⎢ − ( ∆x 2 ∆t )P8n ⎥
⎢0 0 0 0 0 1 a8 1 0 0 0 0 0 0 0 0 0 0 ⎥ ⎢P8 ⎥ ⎢ ⎥
⎢ ⎥ ⎢ P n +1 ⎥ ⎢ − ( ∆x 2 ∆t )P9n ⎥
⎢0 0 0 0 0 0 1 a9 1 0 0 0 0 0 0 0 0 0 ⎥ ⎢ 9 ⎥ ⎢ ⎥
⎢ ⎥ ⎢P10n +1 ⎥ ⎢ − ( ∆x 2 ∆t )P10n ⎥
⎢0 0 0 0 0 0 0 1 a10 1 0 0 0 0 0 0 0 0 ⎥
⎢ n +1 ⎥ = ⎢ ⎥
⎢0 0 0 0 0 0 0 0 1 a11 1 0 0 0 0 0 0 0 ⎥ ⎢P11 ⎥ ⎢ − ( ∆x 2 ∆t )P11n ⎥
⎢ ⎥ ⎢ n +1 ⎥ ⎢ ⎥
⎢0 0 0 0 0 0 0 0 0 1 a12 1 0 0 0 0 0 0 ⎥ ⎢ − ( ∆x 2
⎢0
⎢P12 ⎥ ∆t )P12n ⎥
0 0 0 0 0 0 0 0 0 1 a13 1 0 0 0 0 0 ⎥ ⎢ P n +1 ⎥ ⎢ ⎥
⎢ ⎥ ⎢ − ( ∆x 2
⎢0 0 0 0 0 0 0 0 0 0 0 1 a14 1 0 0 0 0 ⎥
⎢ 13 ⎥ ∆t )P13n ⎥
⎢ P n +1 ⎥ ⎢ ⎥
⎢ ⎥ ⎢ − ( ∆x 2
⎢0 0 0 0 0 0 0 0 0 0 0 0 1 a15 1 0 0 0 ⎥ ⎢ 14 ⎥ ∆t )P14n ⎥
⎢P15n +1 ⎥ ⎢ ⎥
⎢0 0 0 0 0 0 0 0 0 0 0 0 0 1 a16 1 0 0 ⎥ ⎢ − ( ∆x 2
⎢ ⎥
⎢ n +1 ⎥ ∆t )P15n ⎥
⎢P16 ⎥ ⎢ ⎥
⎢0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 a17 1 0 ⎥ ⎢ − ( ∆x 2
⎢0
⎢ n +1 ⎥ ∆t )P16n ⎥
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 a18 1 ⎥ ⎢P17 ⎥ ⎢ ⎥
⎢ ⎥ ⎢ − ( ∆x 2
⎢⎣0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 a19 ⎥⎦
⎢ P n +1 ⎥ ∆t )P17n ⎥
⎢ 18 ⎥ ⎢ ⎥
⎢⎣P19n +1 ⎥⎦ ⎢ − ( ∆x 2 ∆t )P18n ⎥
⎢ ⎥
⎣ ( ∆t )P19 − P20 ⎥⎦
⎢ − ∆x 2 n

(24)

)RUWKLVVLPSOH'3'(LWLVFOHDUWKDWWKHPDWUL[DULVLQJIURPRXULPSOLFLWÀQLWH
difference method has the following properties:

(i) It is tridiagonalWKDWLVLWKDVDPD[LPXPRIWKUHHQRQ]HURHOHPHQWVLQ
any row and these are symmetric around the central diagonal;

(ii) It is very sparseWKDWLVPRVWRIWKHHOHPHQWVDUH]HUR,QDQ0[0


PDWUL[WKHUHDUHRQO\0QRQ]HURWHUPVEXW02 actual elements. If M
WKHQWKHPDWUL[LVRQO\ 2 [ ÀOOHGZLWKQRQ
zero terms.

$VLWKDSSHQVDYHU\VLPSOHFRPSXWDWLRQDOSURFHGXUHFDOOHGWKHThomas algorithm
FDQEHXVHGWRVROYHWULGLDJRQDOV\VWHPVYHU\TXLFNO\7KH)2575$1FRGHIRUWKLV
is shown for interest in Figure 7. Note that it is very compact and quite simple in
VWUXFWXUH<RXDUHQRWH[SHFWHGWRNQRZWKLVRUWRQHFHVVDULO\XQGHUVWDQGKRZWKLV
DOJRULWKPZRUNV

THE THOMAS ALGORITHM

subroutine thomas
c Thomas algorithm for tridiagonal systems
+ (N ! matrix size
DGLDJRQDO

05/12/2016
18
Numerical Methods in Reservoir Simulation S I X

EVXSHUGLDJRQDO
FVXEGLDJRQDO
VUKV
[VROXWLRQ
+ )
c----------------------------------------
F7KLVSURJUDPDFFRPSDQLHVWKHERRN
F&3R]ULNLGLV1XPHULFDO&RPSXWDWLRQLQ6FLHQFHDQG(QJLQHHULQJ
F2[IRUG8QLYHUVLW\3UHVV
c------------------------------------------------
F&RHIÀFLHQWPDWUL[
c | a1 b1 0 0 ... 0 0 0 |
c | c2 a2 b2 0 ... 0 0 0 |
c | 0 c3 a3 b3 ... 0 0 0 |
c | .............................. |
c | 0 0 0 0 ... cn-1 an-1 bn-1 |
c | 0 0 0 0 ... 0 cn an |
c------------------------------------------
,PSOLFLW'RXEOH3UHFLVLRQ DKR]
'LPHQVLRQD  E  F  V  [ 
'LPHQVLRQG  \ 
Parameter (tol=0.000000001) this is a measure of how close to coverage we are
c prepare
Na = N-1
c reduction to upper bidiagonal
d(1) = b(1)/a(1)
y(1) = s(1)/a(1)
'2L 1D
i1 = i+1
Den = a(i1)-c(i1)*d(i)
d(i1) = b(i1)/Den
y(i1) =(s(i1)-c(i1)*y(i))/Den
End DO
F%DFNVXEVWLWXWLRQ
x(N) = y(N)
'2L 1D
x(i)= y(i)-d(i)*x(i+1)
End DO
F9HULÀFDWLRQDQGDODUP
Res = s(1)-a(1)*x(1)-b(1)*x(2)
,I DEV 5HV JWWRO ZULWH  ´WKRPDVDODUPµ
'2L 1D
Res = s(i)-c(i)*x(i-1)-a(i)*x(i)-b(i)*x(i+1)
,I DEV 5HV JWWRO ZULWH  ´WKRPDVDODUPµ
End DO
Res = s(N)-c(N)*x(N-1)-a(N)*x(N)
,I DEV 5HV JWWRO ZULWH  ´WKRPDVDODUPµ
c Done
)RUPDW [I
Return
End

Figure 7 The Thomas algorithm for the solution of tridiagonal matrix systems.

Institute of Petroleum Engineering, Heriot-Watt University 19


Petroleum Engineering Reservoir Simulation

)LQDOO\ZHQRWHWKDWWKHLPSOLFLWÀQLWHGLIIHUHQFHPHWKRGFDQEHYLHZHGDVVKRZQ
in Figure 8 below. The choice of the (n+1) time level for the spatial discretisation
OHDGVWRDVHWRIOLQHDUHTXDWLRQVZKLFKDUHVRPHZKDWPRUHGLIÀFXOWWRVROYHWKDQWKH
VLPSOHDOJHEUDLFHTXDWLRQWKDWDULVHVLQWKHH[SOLFLWPHWKRG HTXDWLRQ +RZHYHU
WKHUHDUHH[DFWO\WKHVDPHQXPEHURIOLQHDUHTXDWLRQVDVWKHUHDUHXQNQRZQVDQGVR
it is possible to solve these.

n n n
Time P i-1 Pi P i+1
Δx Δx
Time level n
i-1 i i+1
Δt
Time level n + 1
n+1 n+1 n+1
P i-1 Pi P i+1

Figure 8 6FKHPDWLFRIWKHLPSOLFLWÀQLWHGLIIHUHQFHDOJRULWKPIRUVROYLQJWKHVLPSOH
pressure PDE

3.3 Implicit Finite Difference Approximation of the 2D Pressure Equation


Before we go on to discuss how to solve the sets of linear equations that arise in
WKHÀQLWHGLIIHUHQFHDSSUR[LPDWLRQRI3'(VDULVLQJLQUHVHUYRLUVLPXODWLRQZHZLOO
ÀUVWFRQVLGHUWKHGLVFUHWLVDWLRQRIWKH'VLQJOHSKDVHSUHVVXUHHTXDWLRQ7KLVUDLVHV
some additional important issues which occur when we try to solve more complicated
V\VWHPVDVIROORZV

L  7KHFRPSOLFDWLRQRIWKHPRUH´FRQQHFWHGµJULGEORFNV\VWHPLQD'
domain;

LL  7KHSRVVLELOLW\RIKHWHURJHQHLW\LQWKHSHUPHDELOLW\ÀHOGZKLFKOHDGV
 XVWRWKHPDWWHURIKRZWRWDNHDYHUDJHSURSHUWLHVLQJULGWRJULGÁRZV
 EHWZHHQEORFNVRIGLIIHUHQWSHUPHDELOLW\ GHDOWZLWKLQ&KDSWHU 

(iii) The issue of non-linearity for a compressible system e.g. c(P) is clearly
 DIXQFWLRQRI3 [W ZKLFKLVWKH´XQNQRZQµ

3.3.1 Discretisation of the 2D Pressure Equation


:HWDNHDVWKHEDVLFSUHVVXUHHTXDWLRQIRUVLQJOHSKDVHVOLJKWO\FRPSUHVVLEOHÁRZ
the following (see the solution for exercise 2 at the end of Chapter 5):

cμφ ⎛ ∂P ⎞ ∂ ⎡ ˜ ⎛ ∂P ⎞ ⎤ ∂ ⎡ ⎛ ∂P ⎞ ⎤
⎜ ⎟= kx ⎜ ⎟ + ⎢ k̃ y ⎜ ⎟ ⎥
k ⎝ ∂t ⎠ ∂x ⎢⎣ ⎝ ∂x ⎠ ⎥⎦ ∂y ⎣ ⎝ ∂y ⎠ ⎦ (25)

D VLPSOLÀHG IRUP RI HTXDWLRQ  &KDSWHU   ZKHUH WKH WHUP


⎛ cφμ ⎞ is a
⎝ k ⎠

05/12/2016
20
Numerical Methods in Reservoir Simulation S I X

constant which we will denote as ` EHORZ k is an average permeability of the


- -
entire reservoir and k x and k y are the local permeabilities normalised by k; i.e.

k x = k x / k and k y = k y / k. Note that we have avoided the non-linearities for


WKHPRPHQW WKHTXDQWLWLHVF 3 + and lXVXDOO\GHSHQGRQSUHVVXUH +RZHYHUWKH
V\VWHPPD\EHDQLVRWURSLF Nx &Ny) and heterogeneous (the permeability may vary
IURPJULGEORFNWRJULGEORFN 

Equation 25 above can be discretised in a similar way to that applied to the 1D


OLQHDU SUHVVXUH 3'( GLVFXVVHG DERYH  +RZHYHU ZH ZLOO QHHG WR EH TXLWH FOHDU
DERXWRXUQRWDWLRQLQ'DQGIRUWKLVSXUSRVHZHUHIHUWR)LJXUH7KLVVKRZVWKH
discretisation grid for the above PDE - note that this is essentially the opposite of
ZKDWZHGLGZKHQZHGHULYHGWKHHTXDWLRQLQWKHÀUVWSODFH,Q&KDSWHUZHXVHG
DFRQWUROYROXPH RUJULGEORFN WRH[SUHVVWKHPDVVFRQVHUYDWLRQDQGWKHQLQVHUWHG
'DUF\·VODZIRUWKHEORFNWREORFNÁRZVZHWKHQWRRNOLPLWVDV6[6y and 6t A0.
+HUHZHDUHVWDUWLQJZLWKWKH3'(DQGJRLQJEDFNWRWKHORFDOFRQVHUYDWLRQRIÁRZV
DQGLQWURGXFLQJÀQLWHVL]H6x and 6y.

i, j + 1

(j + 1/2)

∆y
i - 1, j i, j i + 1, j

(j - 1/2)

i, j - 1
y (j)
∆x
1
(i - /2) (i + 1/2)
x (i)

Figure 9 Discretisation and notation for the 2D pressure equation.

Discretising the following equation using the above notation

⎛ ∂P ⎞ ∂ ⎡  ⎛ ∂P ⎞ ⎤ ∂ ⎡  ⎛ ∂P ⎞ ⎤
β⎜ ⎟ = +
⎝ ∂t ⎠ ∂x ⎢⎣ x ⎜⎝ ∂x ⎟⎠ ⎥⎦ ∂y ⎢⎣ y ⎜⎝ ∂y ⎟⎠ ⎥⎦
k k (26)

we obtain:
⎡  ⎛ ∂P ⎞ ⎤ ⎡ ⎛ ∂P ⎞ ⎤ ⎡ ⎛ ∂P ⎞ ⎤ ⎡ ⎛ ∂P ⎞ ⎤
⎢ k x ⎜⎝ ⎟⎠ ⎥ − ⎢ k x ⎜ ⎟ ⎥ ⎢ k y ⎜ ⎟ ⎥ − ⎢ k y ⎜ ⎟ ⎥
⎛ P n +1 − P n ⎞ ⎣ ∂x ⎦i +1/ 2 ⎣ ⎝ ∂x ⎠ ⎦i −1/ 2 ⎣ ⎝ ∂y ⎠ ⎦ j +1/ 2 ⎣ ⎝ ∂y ⎠ ⎦ j −1/ 2
β⎜ ⎟ ≈ +
⎝ Δt ⎠ Δx Δy
(27)

Institute of Petroleum Engineering, Heriot-Watt University 21


Petroleum Engineering Reservoir Simulation

where the (i ( 1/2) and (j ( 1/2) subscripts refer to quantities at the boundaries as
VKRZQLQ)LJXUH:HFDQQRZH[SDQGWKHVHERXQGDU\ÁRZVDVIROORZV

⎛ P n +1 − Pin, j ⎞ ⎡ ~ ⎛ Pin++11, j − Pin, j+1 ⎞ ⎤ ⎡ ~ ⎛ Pin, j+1 − Pin−+11, j ⎞ ⎤


β⎜ i , j
⎝ ∆t ⎟ = ⎢ kx
⎠ ⎢⎣
( ) ⎜
i +1 / 2 ⎝ ∆x 2 ⎟ ⎥ − ⎢ kx
⎠ ⎥⎦ ⎢⎣
( ) ⎜
i −1 / 2 ⎝ ∆x 2 ⎟⎥
⎠ ⎥⎦

⎡ ⎛ Pin, j++11 − Pin, j+1 ⎞ ⎤ ⎡ ~ ⎛ Pin, j+1 − Pin, j+−11 ⎞ ⎤


⎢⎣
( )
+ ⎢ k~y ⎜
j +1 / 2 ⎝ ∆y 2 ⎟ ⎥ − ⎢ ky
⎠ ⎥⎦ ⎢⎣
( ) ⎜
j −1 / 2 ⎝ ∆y 2 ⎟⎥
⎠ ⎥⎦

(28)

(~ ) (~ ) (~ )
where the quantities k x i +1/ 2 , k x i −1/ 2 , k y j +1/ 2 and k y j −1/ 2 are some type of (~ )
DYHUDJHSHUPHDELOLWLHVEHWZHHQWKHWZRQHLJKERXULQJJULGEORFNVDVGLVFXVVHGLQ
Chapter 4. Note also we have chosen the spatial discretisation terms at the new (n+1)
WLPHOHYHOPDNLQJWKHWKLVDQLPSOLFLWÀQLWHGLIIHUHQFHVFKHPH

:HFDQUHDUUDQJHHTXDWLRQDERYHE\WDNLQJDOOWKHXQNQRZQWHUPV DWQ WRWKH


/+6DQGWKHNQRZQWHUPV DWWLPHOHYHOQ WRWKH5+67KLVJLYHVWKHIROORZLQJ

− ⎜
( )
⎛ k~x
i −1 / 2

⎟ n +1
Pi −1, j −
⎛ k~x

( )
i +1 / 2

⎟ n +1
Pi +1, j +
⎛ ~

( )
k x i −1 / 2
+
~
( )
k x i +1 / 2
+
~
k y j −1 / 2
+
( )
k y j +1 / 2 β ⎞ n +1
~
+ ⎟ Pi, j
( )
⎜ ∆x 2 ⎟ ⎜ ∆x 2 ⎟ ⎜ ∆x
2
∆x 2 ∆y 2 ∆y 2 ∆t ⎟
⎝ ⎠ ⎝ ⎠ ⎝ ⎠

− ⎜
( )
⎛ k~x
j −1 / 2

⎟ n +1
Pi , j −1 − ⎜
( )
⎛ k~y
j +1 / 2

β
⎟ Pin, j++11 = Pin, j
⎜ ∆ y 2
⎟ ⎜ ∆ y 2
⎟ ∆ t
⎝ ⎠ ⎝ ⎠
(29)

6LQFHWKHFRHIÀFLHQWVLQHTXDWLRQDERYHDUHFRQVWDQWVWKHQWKLVGHÀQHVDVHWRI
linearHTXDWLRQVVLPLODUWRWKRVHIRXQGLQ'+RZHYHUKHUHZHKDYHXSWRÀYH
QRQ]HURWHUPVSHUJULGEORFNWRGHDOZLWKUDWKHUWKDQWKHWKUHHZHIRXQGIRUWKH
'V\VWHP7KHPDWUL[ZKLFKDULVHVLQWKLV'FDVHLVNQRZQDVa pentadiagonal
matrix. This set of linear equations can be written as follows:

a i −1, j .Pin−+11, j + a i +1, j .Pin++11, j + a i , j .Pin, j+1 + a i , j −1 .Pin, j+−11 + a i , j +1 .Pin, j++11 = b i , j (30)

ZKHUHWKHFRQVWDQWFRHIÀFLHQWVa i −1, j , a i +1, j , a i , j , a i , j −1 and a i , j +1DUHJLYHQE\WKH


FRHIÀFLHQWVLQHTXDWLRQELMLVDOVRD NQRZ FRQVWDQW

3.3.2 Numbering Schemes in Solving the 2D Pressure Equation


It is quite convenient to label the pressures as PL M ZKHQ ZH DUH ZRUNLQJ RXW WKH
GLVFUHWLVDWLRQ RI WKH HTXDWLRQV EXW WKLV LV QRW KHOSIXO ZKHQ ZH DUH DUUDQJLQJ WKH
OLQHDUHTXDWLRQV+HUHLWLVXVHIXOÀUVWWRFRQVLGHUthe numbering scheme for the
'V\VWHPWKDWDOORZVXVWRGLVSHQVHZLWKWKH LM VXEVFULSWLQJLQHTXDWLRQVRU
DERYH7KHVWUXFWXUHRIWKH$PDWUL[LQHTXDWLRQFDQEHPDGHFOHDUHUE\ZRUNLQJ
RXWDVSHFLÀF'H[DPSOHDVVKRZQLQ)LJXUH

05/12/2016
22
Numerical Methods in Reservoir Simulation S I X

j=5 m = 17 m = 18 m = 19 m = 20
j=4 m = 13 m = 14 m = 15 m = 16
j=3 m=9 m = 10 m = 11 m = 12
j=2 m=5 m=6 m=7 m=8
j=1 m=1 m=2 m=3 m=4
i=1 i=2 i=3 i=4
Notation:
NX = maximum number of grid blocks in x - direction, i = NX;
NY = maximum number of grid blocks in y - direction, j = NY
m = grid block number in the natural ordering scheme shown
m = (j - 1).NX + i
e.g. for i = 3, j = 4 and NX = 4, m = (4 - 1).4 + 3 = 15 (as above)

Figure 10 1XPEHULQJV\VWHPIRU'JULGFRQYHUVLRQIURP LM A m counter.

,QWKHPQRWDWLRQVKRZQLQ)LJXUH P  M 1;L WKHUHRUGHUHGHTXDWLRQV


become the following:

a˜ m −1 .Pmn +−11 + a˜ m +1 .Pmn ++11 + a˜ m .Pmn +1 + a˜ m − NX .Pmn +−1NX + a˜ m + NX .Pmn ++1NX = b m (31)

where the ã mDUHWKHUHRUGHUHGFRHIÀFLHQWVZKHUHWKHVXEVFULSWLVFDOFXODWHGIURP


the m-formula in Figure 10. For example:

a i , j −1 → a˜ ( j−1−1) NX+i=( j−1) NX+i − NX → a˜ m − NX (32)

a i , j +1 → a˜ ( j+1−1) NX+i = ( j−1) NX+i+ NX → a˜ m + NX (33)

1RWHWKDWZKHQZHDSSO\WKHDERYHHTXDWLRQQXPEHULQJVFKHPHWRWKHH[DPSOHLQ
)LJXUH 1; 1< DQGWKHUHIRUH < m < FHUWDLQ´QHLJKERXUVµDUH
´PLVVLQJµVLQFHDEORFNLVDWWKHERXQGDU\ RULQDFRUQHUZKHUHWZRQHLJKERXUVDUH
PLVVLQJ )RUH[DPSOHIRUEORFN L M  WKDWLVEORFNP WKH´LEORFNµLV
QRWWKHUH7KHUHIRUHWKHFRHIÀFLHQW$m-1 =0 in this case. This is best seen by writing
out the structure of the 20 x 20 A-matrix by referring to Figure 10; the A-matrix
structure is shown in Figure 11.

1RWHWKDWWKH$PDWUL[VWUXFWXUHLQ)LJXUHLVVSDUVHDQGKDVDPD[LPXPRIÀYH
QRQ]HURFRHIÀFLHQWVLQDJLYHQURZLWLVDSHQWDGLDJRQDOPDWUL[

All implicit methods for discretising the pressure equation lead to sets of linear
equations. These have the general matrix form:

A.x = b (34)

where ALVDPDWUL[OLNHWKHH[DPSOHVVKRZQDERYHxLVWKHFROXPQYHFWRURIXQNQRZQV
OLNHWKHSUHVVXUHV DQGbLVDFROXPQYHFWRURIWKH5+6V7KLVLVMXVWOLNHHTXDWLRQ
31 but it is in shorthand form. We will discuss methods for solving these equations
ODWHULQWKLVFKDSWHU)RUWKHPHDQWLPHZHZLOOMXVWDVVXPHWKDWLWFDQEHVROYHG
We next consider when the PDEs describing a phenomenon are non-linear PDEs.

Institute of Petroleum Engineering, Heriot-Watt University 23


Petroleum Engineering Reservoir Simulation

m 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1 x x x
2 x x x x
3 x x x x
4 x x x
5 x x x x
6 x x x x x
7 x x x x x
8 x x x x
9 x x x x
10 x x x x x
11 x x x x x
12 x x x x
13 x x x x
14 x x x x x
15 x x x x x
16 x x x x
17 x x x
18 x x x x
19 x x x x
20 x x x

m - ordering scheme used in figure 10 - shown here for reference.

j=5 m = 17 m = 18 m = 19 m = 20
j=4 m = 13 m = 14 m = 15 m = 16
j=3 m=9 m = 10 m = 11 m = 12
j=2 m=5 m=6 m=7 m=8
j=1 m=1 m=2 m=3 m=4
i=1 i=2 i=3 i=4

Figure 11 Structure of the A-matrix for the m-ordering scheme in the table shown below
for reference.

3.4 Implicit Finite Difference Approximation of Non-linear Pressure


Equations
We have noted previously that using numerical methods are usually the only way
which we can solve non-linear PDEs of the type that arise in reservoir simulation.
:HZLOOXVHWKHVLQJOHSKDVH'HTXDWLRQIRUWKHÁRZRIFRPSUHVVLEOHÁXLGV DQG
URFNV DVWKHH[DPSOHIRUGLVFXVVLQJWKHQXPHULFDOVROXWLRQRInon-linear PDEs.
Equation 35 below was derived in Chapter 5 and has the form:

⎛ ∂P ⎞ ∂ ⎡ k xρ ⎛ ∂P ⎞ ⎤ ∂ ⎡ k yρ ⎛ ∂P ⎞ ⎤
c( P )⎜ ⎟ = ⎜ ⎟ +
⎝ ∂t ⎠ ∂x ⎢⎣ μ ⎝ ∂x ⎠ ⎥⎦ ∂y ⎢⎣ μ ⎜⎝ ∂y ⎟⎠ ⎥⎦
(35)

where the non-linearities arise in this equation due to the dependence of the generalised
FRPSUHVVLELOLW\F 3 WKHGHQVLW\l 3 DQGWKHYLVFRVLW\+ 3 RQSUHVVXUH3 [W 
,W LV WKH SUHVVXUH WKDW LV WKH PDLQ XQNQRZQ LQ WKLV HTXDWLRQ DQG KHQFH LI WKHVH
TXDQWLWLHVGHSHQGRQLWWKHQWKH\LQWURGXFHGLIÀFXOWLHVLQWRWKHHTXDWLRQV,QIDFW
we will see shortly that the equations that arise are not linear equations - they are
05/12/2016
24
Numerical Methods in Reservoir Simulation S I X

non-linear algebraic equations.

3URFHHGLQJDVEHIRUHZHFDQGLVFUHWLVHWKHDERYHHTXDWLRQDVIROORZV

⎡ k xρ ⎛ ∂P ⎞ ⎤ ⎡ k ρ ⎛ ∂P ⎞ ⎤ ⎡ k yρ ⎛ ∂P ⎞ ⎤ ⎡ k ρ ⎛ ∂P ⎞ ⎤
⎢ μ ⎜⎝ ∂x ⎟⎠ ⎥ − ⎢ x ⎜ ⎟⎥ ⎢ ⎜ ⎟⎥ − ⎢ y ⎜ ⎟⎥
⎦ i +1/ 2 ⎣ μ ⎝ ∂x ⎠ ⎦ i −1/ 2 ⎣ μ ⎝ ∂y ⎠ ⎦ j +1/ 2 ⎣ μ ⎝ ∂y ⎠ ⎦ j −1/ 2
n +1
⎛P −P ⎞ ⎣ n
c( P )⎜ ⎟= +
⎝ ∆t ⎠ ∆x ∆y
(36)

where we have not yet decided on the time level of the non-linearities (i.e. the time
OHYHORIWKHSUHVVXUH3n or Pn+1DWZKLFKZHHYDOXDWHFl and + 7KHPRVWGLIÀFXOW
FDVHZRXOGEHLIWKHVHZHUHVHWDWWKH´XQNQRZQµWLPHOHYHO3n+1 and this is what we
will do as follows:

⎡⎛ k ρ ⎞ n +1 ⎛ ∂P ⎞ ⎤ ⎡⎛ k ρ ⎞ n +1 ⎛ ∂P ⎞ ⎤
⎢⎜ x ⎟ ⎜ ⎟ ⎥ − ⎢⎜ x ⎟ ⎜ ⎟ ⎥
n +1
⎛P −P ⎞ ⎣ ⎢⎝ μ ⎠ ⎝ ∂x ⎠ ⎥ ⎢⎣⎝ μ ⎠ ⎝ ∂x ⎠ ⎥⎦ i −1/ 2
⎦ i +1 / 2
n
c( P n +1 )⎜ ⎟=
⎝ ∆t ⎠ ∆x
⎡⎛ k yρ ⎞ n +1 ⎛ ∂P ⎞ ⎤ ⎡⎛ k yρ ⎞ n +1 ⎛ ∂P ⎞ ⎤
⎢⎜ ⎟ ⎜ ⎟⎥ − ⎢⎜ ⎟ ⎜ ⎟⎥
⎢⎣⎝ μ ⎠ ⎝ ∂y ⎠ ⎥⎦ j +1/ 2 ⎢⎣⎝ μ ⎠ ⎝ ∂y ⎠ ⎥⎦ j −1/ 2
+
∆y
(37)

⎛ ∂P ⎞ ⎛ ∂P ⎞
Now expanding up the ⎜ ⎟ and ⎜ ⎟ terms gives:
⎝ ∂x ⎠ ⎝ ∂y ⎠

⎡⎛ k ρ ⎞ n +1 ⎛ Pin++11, j − Pin, j+1 ⎞ ⎤ ⎡⎛ k ρ ⎞ n +1 ⎛ Pin, j+1 − Pin−+11, j ⎞ ⎤


⎢⎜ x ⎟ ⎟ ⎥ − ⎢⎜⎝ μ ⎟⎠ ⎟⎥
x
⎝ μ ⎠ ⎜ ∆ ⎜ ∆x
n +1
⎛ P n +1
− P n
⎞ ⎢
⎣ i +1 / 2 ⎝ x ⎠ ⎥
⎦ ⎢
⎣ i −1 / 2 ⎝ ⎠ ⎥⎦
c( P )⎜ i, j i, j
⎟ =
⎝ ∆t ⎠ ∆x
⎡⎛ k yρ ⎞ n +1 ⎛ Pin, j++11 − Pin, j+1 ⎞ ⎤ ⎡⎛ k yρ ⎞ n +1 ⎛ Pin,1+1 − Pin, j+−11 ⎞ ⎤
⎢⎜ ⎟ ⎜ ∆y ⎟ ⎥ − ⎢⎜⎝ μ ⎟⎠ ⎜ ∆y ⎟⎥
⎢⎣⎝ μ ⎠ j +1/ 2 ⎝ ⎠ ⎥⎦ ⎢⎣ j −1 / 2 ⎝ ⎠ ⎥⎦
+
∆y
(38)
ZKLFKFDQEHVLPSOLÀHGWRWKHIROORZLQJ
n +1 n +1
⎛ P n +1 − Pin, j ⎞ ⎛ k xρ ⎞ ⎛ kρ ⎞
c( P n +1 )⎜ i , j
⎝ ∆t ⎟ =⎜ 2⎟
⎠ ⎝ μ.∆x ⎠ i +1/ 2
( )
Pin++11, j − Pin, j+1 − ⎜ x 2 ⎟
⎝ μ.∆x ⎠ i −1/ 2
(
Pin, j+1 − Pin−+11, j )

n +1 n +1
⎛ kρ ⎞ ⎛ kρ ⎞
+⎜ y 2⎟
⎝ μ.∆y ⎠ j +1/ 2
(
Pin, j++11 − Pin, j+1 ) − ⎜ y 2⎟
⎝ μ.∆y ⎠ j −1/ 2
(
Pin, j+1 − Pin, j+−11 )

(39)
Institute of Petroleum Engineering, Heriot-Watt University 25
Petroleum Engineering Reservoir Simulation

7KLVFDQEHWUHDWHGDVEHIRUHWRJDWKHUWRJHWKHUVLPLODUXQNQRZQ3WHUPVDVIROORZV
n +1 n +1
⎛ kρ ⎞ ⎛ kρ ⎞
− ⎜ x 2⎟ .Pin−+11, j − ⎜ y 2 ⎟ .Pin, j+−11
⎝ μ.∆x ⎠ i −1/ 2 ⎝ μ.∆y ⎠ j −1/ 2
⎡⎛ c( P n +1 ) ⎞ ⎛ k ρ ⎞ n +1 ⎛ k ρ ⎞ n +1 ⎛ k yρ ⎞ n +1 ⎛ k yρ ⎞ n +1 ⎤ n +1
+ ⎢⎜ ⎟ +⎜
x
2⎟
+⎜ x 2⎟ +⎜ 2⎟
+⎜ 2⎟ ⎥.Pi , j
⎢⎣⎝ ∆t ⎠ ⎝ μ.∆x ⎠ i +1/ 2 ⎝ μ.∆x ⎠ i −1/ 2 ⎝ μ.∆y ⎠ j +1/ 2 ⎝ μ.∆y ⎠ j −1/ 2 ⎥⎦
n +1 n +1
⎛ kρ ⎞ ⎛ kρ ⎞ ⎛ c( P n +1 ).Pin, j ⎞
−⎜ x 2⎟ .Pin++11, j − ⎜ y 2 ⎟ .Pin, j++11 = ⎜ ⎟
⎝ μ.∆x ⎠ i +1/ 2 ⎝ μ.∆y ⎠ j +1/ 2 ⎝ ∆t ⎠

(40)

$VEHIRUHZHFDQZULWHWKLVLQDFRPSDFWIRUPDVIROORZV

α in−+11, j .Pin−+11, j + α in++11, j .Pin++11, j + α in, +j 1 .Pin, j+1 + α in,+j −11 .Pin, j+−11 + α in,+j +11 .Pin, j++11 = β in,+j 1
(41)
n +1 n +1 n +1 n +1 n +1
where the elements of theA-matrix (now denoted α i −1, j , α i , j −1 , α i , j , α i +1, j and α i , j +1 )
are notFRQVWDQWVVLQFHWKH\GHSHQGRQWKH XQNQRZQ YDOXHRI3n+1.

How do we go about solving the non-linear set of algebraic equations in 39 or 40


DERYH",WWXUQVRXWWKDWZHKDYHWZRFKRLFHVLQWDFNOLQJWKLVPRUHGLIÀFXOWSUREOHP
as follows:

L  :H FDQ DFWXDOO\ XVH D QXPHULFDO HTXDWLRQ VROYHU ZKLFK LV VSHFLÀFDOO\
GHVLJQHGWRVROYHPRUHGLIÀFXOWQRQOLQHDUSUREOHPV$QH[DPSOHRIWKLV
type of approach is in using the Newton-Raphson method. We will return
to this method later (once we have seen how to solve linear equations).

(i) We can choose to apply a more pragmatic algorithm such as the following:
(a) Although our _WHUPVLQHTXDWLRQDUHVWULFWO\DWWLPHOHYHO Q 
VLPSO\WDNHWKHPDWWLPHOHYHOQDVDÀUVWJXHVV6RZHDSSUR[LPDWH
HTXDWLRQE\WKHIROORZLQJÀUVWJXHVV

α in−1, j .Pin−+11, j + α in+1, j .Pin++11, j + α in, j .Pin, j+1 + α in, j −1 .Pin, j+−11 + α in, j +1 .Pin, j++11 = β in, j
(42)

where the quantities α in−1, j , α in+1, j , α in, j , α in, j −1 , α in, j +1 and β in, j are evaluated
DWWKH NQRZQ WLPHOHYHOQLHDWYDOXHVRISUHVVXUH Pin,j .

E 6ROYHWKHQRZOLQHDUHTXDWLRQVDERYHWRREWDLQDÀUVWHVWLPDWHRUD
ÀUVWLWHUDWLRQRIWKHPin,j+1 at each grid point. We will use the following
notation ‰α iν, j where i is the iteration counter and α iν, j is the value of the
( )
ν
_FRHIÀFLHQWDWWKH Pin,j+1 value after i iterations; that is:

05/12/2016
26
Numerical Methods in Reservoir Simulation S I X

[(
α iν, j = α i , j Pin, j+1 )]
ν
(43)

(c) Use the latest iterated values of the α iν, j to solve the (now linear)
( ) ( )
ν ν +1
equations to go from Pin, j+1 to Pin, j+1 .

(d) Keep iterating the above scheme until it converges; i.e. the difference
between the sum of two successive iterated values of the pressure (Err.)
LVVXIÀFLHQWO\VPDOO 7ROZKLFKLVDQDFFHSWDEO\VPDOOYDOXH

∑ (P ) n +1 ν +1
( )
ν
Err = i, j − Pin, j+1 (44)
all i , j

 6WRSLI(UU7RO2WKHUZLVHFRQWLQXHWKURXJKVWHSVDERYH

The algorithm outlined in (ii) above for solving the non-linear pressure equation is
represented in Figure 12.

Set the iteration counter ν = 0

Calculate the α iν−1, j , α iν+1, j , α iν, j , α iν, j −1 , α iν, j +1 and β iν, j at

( )
n ν
values of pressure = Pi , j

[(
α iν, j = α i , j Pin, j+1 )]
ν
where ν = current iteration number.

Solve the set of linear equations:


ν = ν +1
α iν−1, j .Pin−+11, j + α iν+1, j .Pin++11, j + α iν, j .Pin, j+1 + α iν, j −1 .Pin, j+−11 + α iν, j +1 .Pin, j++11 = β iν, j

( )
ν +1
to obtain Pin, j+1 = Pin, j+1

Calculate

Σ (P ) n +1 ν +1
( )
ν
Err = i, j − Pi,nj+1
all i , j

No - continue iterations
Err < Tol ?

Yes (the method has converged)

Stop

Figure 12 Algorithm for the numerical solution of the non-linear 2D pressure equations:

Institute of Petroleum Engineering, Heriot-Watt University 27


Petroleum Engineering Reservoir Simulation

4 APPLICATION OF FINITE DIFFERENCES TO TWO-PHASE


FLOW

4.1 Discretisation of the Two-Phase Pressure and Saturation Equations


:HQRZFRQVLGHUKRZÀQLWHGLIIHUHQFHPHWKRGVDUHDSSOLHGWRWKHWZRSKDVHÁRZ
HTXDWLRQV:HKDYHVHHQKRZWKHVHHTXDWLRQVZHUHGHULYHGLQ&KDSWHU5HFDOOWKDW
LQWZRSKDVHÁRZZHKDYHWZRFRXSOHGHTXDWLRQVWRVROYHDSUHVVXUHHTXDWLRQDQG
DVDWXUDWLRQHTXDWLRQ)RUH[DPSOHZHPD\VROYHIRUWKHRLOSUHVVXUH3o [W DQGWKH
RLOVDWXUDWLRQ6o [W ZHZRXOGWKHQÀQGWKHZDWHUVDWXUDWLRQDQGZDWHUSUHVVXUHE\
XVLQJWKHFRQVWUDLQWHTXDWLRQV6o+Sw DQGWKHFDSLOODU\SUHVVXUHUHODWLRQ3c(Sw)
= Po - PwUHVSHFWLYHO\

)URP&KDSWHUZHXVHWKHKLJKO\VLPSOLÀHGIRUPRIWKH'SUHVVXUHDQGVDWXUDWLRQ
HTXDWLRQVZKHUHZHFKRRVHWRVROYHIRU‰3 [W DQG6o [W DVVKRZQLQ&KDSWHU
HTXDWLRQVDQG1RWHWKDWZHKDYHWDNHQ]HURFDSLOODU\SUHVVXUH WKHUHIRUH
P = Po = Pw) and zero gravity which gives:

∂ ⎡ ⎛ ∂P ⎞ ⎤
PRESSURE EQUATION ⎢ λ T (So )⎜ ⎟ ⎥ = 0 (45)
∂x ⎣ ⎝ ∂x ⎠ ⎦

⎛ ∂S ⎞ ∂ ⎡ ⎛ ∂P ⎞ ⎤
φ⎜ o ⎟ = λ (S )⎜ ⎟
SATURATION EQUATION
⎝ ∂t ⎠ ∂x ⎢⎣ o o ⎝ ∂x ⎠ ⎥⎦ (46)

(TXDWLRQVDQGDUHWKHVDPHDVHTXDWLRQVDQGIURP&KDSWHUUHVSHFWLYHO\ 

The quantity λ (So ) is the total mobility and is the sum of the oil and water mobilities;
T

λ T (So ) = λ o (So ) + λ w (So ). The above two equations are clearly coupled together
VLQFHWKHRLOVDWXUDWLRQDSSHDUVLQWKHQRQOLQHDUFRHIÀFLHQWRIWKHSUHVVXUHHTXDWLRQ
/LNHZLVHWKHSUHVVXUHDSSHDUVLQWKHÁRZWHUPRQWKH5+6RIWKHVDWXUDWLRQHTXDWLRQ

:HFDQQRZDSSO\ÀQLWHGLIIHUHQFHVWRHDFKRIWKHVHHTXDWLRQVLQWKHVDPHZD\DV
GLVFXVVHGDERYHWRREWDLQIRUWKHSUHVVXUHHTXDWLRQ VHHQRWDWLRQLQ)LJXUH 

⎡ ⎛ ∂P ⎞ ⎤ ⎡ ⎛ ∂P ⎞ ⎤
⎢λ T (So )⎜⎝ ∂x ⎟⎠ ⎥ − ⎢λ T (So )⎜ ⎟ ⎥
⎝ ∂x ⎠ ⎦ i −1/ 2
⎣ ⎦ i +1 / 2 ⎣ (47)
=0
∆x

which can be expanded further to give:

⎡ ⎛ Pin++11 − Pin +1 ⎞ ⎤ ⎡ ⎛ P n +1 − Pin−+11 ⎞ ⎤


⎢λ T (So )⎜ ⎟⎥ − ⎢λ T (So )⎜ i ⎟⎥
⎣ ⎝ ∆x ⎠ ⎦ i +1 / 2 ⎣ ⎝ ∆x ⎠ ⎦ i −1 / 2
=0
∆x
(48)

05/12/2016
28
Numerical Methods in Reservoir Simulation S I X

,QHTXDWLRQDERYHZHPXVWQRZVSHFLI\WKHWLPHOHYHORIWKHQRQOLQHDUPRELOLW\
(
WHUPV λ (So )
T )
and λ (So ) (
ZHPXVWFKRRVHZKHWKHUZHWDNHWKHVHWHUPV
i +1 / 2 T ) i −1 / 2

DWWLPHQRUDWWLPHOHYHO Q "$JDLQZHJRVWUDLJKWWRWKHPRVWGLIÀFXOWFDVHE\


GHÀQLQJWKHVHWHUPVDWWKHODWHUWLPHOHYHOLHDWSon +17KHVHWHUPVDUHGHQRWHGDV
( ( ))
λ Son +1
T
and λ Son +1
i +1 / 2
( ( ))
LQHTXDWLRQDERYHWRREWDLQ
T i −1 / 2

(
⎡ λ (Son +1 ) ) (
⎤ ⎡ λ (Son +1 ) ) ⎤
⎢ T
⎢ ∆x 2
i +1 / 2
(P n +1
i +1 −P i
n +1
)⎥⎥ − ⎢⎢ T ∆x2 i −1 / 2
(P i
n +1
−P n +1
i −1 )⎥⎥ = 0
⎣ ⎦ ⎣ ⎦
(49)

The above equation can now be arranged into the usual order as follows:

(λ (S ))
T
n +1
o
i −1 / 2
P n +1 T (
⎡ λ (Son +1 )
−⎢
) i −1 / 2
+
(λ (S ))
T
n +1
o
i +1 / 2
⎤ (
λ (S n + 1 )
⎥ P n +1 + T o
) i +1 / 2
Pin++11 = 0
i −1
∆x 2
⎢ ∆x 2 ∆x 2
⎥ i ∆x 2
⎣ ⎦
(50)

This is a non-linear VHW RI DOJHEUDLF HTXDWLRQV IRU WKH XQNQRZQ SUHVVXUHV
Pin−+11 , Pin +1 and Pin++11 EXWWKHFRHIÀFLHQWVGHSHQGRQWKHDOVRXQNQRZQVDWXUDWLRQV
Son 1 . Note that equation 50 represents one of a set of equations since there is one
at each grid point (and at the ends of the 1D system the values may be set by the
boundary conditions).

We now consider the discretisation of the saturation equation 46. Finite differences
may be applied to this equation as follows:

⎡ ⎛ ∂P ⎞ ⎤ ⎡ ⎛ ∂P ⎞ ⎤
⎢λ o (So )⎜⎝ ∂x ⎟⎠ ⎥
n +1
− ⎢λ o (So )⎜ ⎟ ⎥
⎝ ∂x ⎠ ⎦ i −1/ 2
⎛S −S ⎞ ⎣ n
⎦ i +1 / 2 ⎣
φ⎜ ⎟=
oi oi
(51)
⎝ ∆t ⎠ ∆x

$JDLQZHFDQH[SDQGWKHGHULYDWLYHWHUPVDWWKH L DQG L ERXQGDULHV )LJXUH 


DQGZHFDQWDNHWKHPRELOLW\WHUPVDWWKH Q WLPHOHYHOWRREWDLQ

⎛ Soin+1 − Soin ⎞ ⎢ λ o (So )


⎡ n +1
( ) (
⎤ ⎡ λ (Son +1 ) ) ⎤
φ⎜
⎝ ∆t ⎠ ⎢
⎟=
∆x 2
i +1 / 2
(P n +1
i +1 −P i
n +1
)⎥⎥ − ⎢⎢ o ∆x2 i −1 / 2
(P
i
n +1
−P ) ⎥

n +1
i −1

⎣ ⎦ ⎣ ⎦
(52)

The above non-linear algebraic set of equations can be written in various ways. Two
particularly useful ways to write the above equations are as follows:

Institute of Petroleum Engineering, Heriot-Watt University 29


Petroleum Engineering Reservoir Simulation

)RUP$

∆t ⎪ ⎢ λ o ( S o )
⎧⎡ n +1
( ) (
⎤ ⎡ λ (Son +1 ) ) ⎤⎫

S n +1
oi =S + ⎨
φ ⎪⎢
n
oi
∆x 2
i +1 / 2
(P n +1
i +1 −P i
n +1
)⎥⎥ − ⎢⎢ o ∆x2 i −1 / 2
(P i
n +1
− P )⎥ ⎬ n +1
i −1
⎥⎪
⎩⎣ ⎦ ⎣ ⎦⎭
(53)
RU)RUP%

∆t ⎪⎢ λ o ( So )
⎧⎡ n +1
( ) (
⎤ ⎡ λ ( Son +1 ) ) ⎤⎫
n +1 ⎥ ⎪
Sn +1
oi −S − ⎨
n

φ ⎪⎢
oi
∆x 2
i +1 / 2
(P n +1
i +1 − Pi n +1
)⎥⎥ − ⎢⎢ o ∆x 2 i −1 / 2
(i
P n +1
− Pi −1 ) ⎬ = 0
⎥⎪
⎩⎣ ⎦ ⎣ ⎦⎭
(54)

The reason for writing the above two forms of the saturation equation is that each is
XVHIXOGHSHQGLQJRQKRZZHLQWHQGWRDSSURDFKWKHVROXWLRQRIWKHFRXSOHGSUHVVXUH
(equation 45) and saturation (equation 46) equations.

As with the case of the solution of the non-linear single phase pressure equation for
DFRPSUHVVLEOHV\VWHPZHKDYHWZRVWUDWHJLHVZKLFKZHFDQXVHWRVROYHWKHWZR
SKDVHHTXDWLRQVDERYHDVIROORZV

L :HFDQDFWXDOO\XVHDQXPHULFDOHTXDWLRQVROYHUZKLFKLVVSHFLÀFDOO\GHVLJQHG
WRVROYHPRUHGLIÀFXOWQRQOLQHDUSUREOHPVHJWKH1HZWRQ5DSKVRQPHWKRG
We will return to this method later (once we have seen how to solve linear
equations).

(i) We can again choose to apply a more pragmatic algorithm and this is the subject
of section 4.2 below.

4.2 IMPES Strategy for Solving the Two-Phase Pressure and


Saturation Equations
7KHIRUPRIWKHGLVFUHWLVHGSUHVVXUHDQGVDWXUDWLRQHTXDWLRQVZKLFKZHZLOOWDNHDUH
as follows (equations 50 and 53):

3UHVVXUH

(λ (S ))
T
n +1
o
i −1 / 2
P n +1
−⎢
(
⎡ λ (Son +1 )
T ) i −1 / 2
+
(λ (S ))
T
n +1
o
i +1 / 2

⎥P +
n + 1
(
λ T (Son +1 ) ) i +1 / 2
Pin++11 = 0
i −1
∆x 2
⎢ ∆x 2 ∆x 2
⎥ i ∆x 2
⎣ ⎦
(50)
6DWXUDWLRQ

∆t ⎪ ⎢ λ o ( So )
⎧⎡ n +1
( ) (
⎤ ⎡ λ (Son +1 ) ) ⎤⎫

S n +1
oi =S + ⎨
n

φ ⎪⎢
oi
∆x 2
i +1 / 2
(P n +1
i +1 −P i
n +1
)⎥⎥ − ⎢⎢ o ∆x2 i −1 / 2
(P i
n +1
− Pin−+11 )⎥ ⎬
⎥⎪
⎩⎣ ⎦ ⎣ ⎦⎭

(53)

05/12/2016
30
Numerical Methods in Reservoir Simulation S I X

3UHVVXUH HTXDWLRQ  ZRXOG EH D VHW RI OLQHDU HTXDWLRQV LI  WKH FRHIÀFLHQWV ZHUH
NQRZQDWWKHFXUUHQWWLPHVWHS Q UDWKHUWKDQEHLQJVSHFLÀHGDWWKH Q LHWKH
XQNQRZQWLPHOHYHO+RZHYHUZHFRXOGVROYHHTXDWLRQDERYHas if it were
a linear system of equations E\ WLPHODJJLQJ WKH FRHIÀFLHQWV DV EHIRUH VHH WKH
DOJRULWKPLQ)LJXUH 7KLVZRXOGJLYHXVD´ÀUVWJXHVVµ RUÀUVWLWHUDWLRQ WRÀQG
n +1 n +1 n +1
WKHXQNQRZQVLHWKHTXDQWLWLHV Pi −1 , Pi and Pi +1 . The same problem exists for
WKHVDWXUDWLRQHTXDWLRQLIZHKDGWKHÀUVWJXHVVDWWKH Pin 1 (by the procedure
MXVWPHQWLRQHG WKHQZHFRXOGXVHWKHVHODWHVWYDOXHVRISUHVVXUHDQGVWLOOWLPHODJ
WKHFRHIÀFLHQWV WKHRLOPRELOLW\WHUPV DQGXVHWKHVDWXUDWLRQHTXDWLRQDVLILW
were an explicit expression. This would give us an updated value of Son 1 which
FRXOGWKHQEHXVHGEDFNLQWKHSUHVVXUHHTXDWLRQDQGWKHZKROHSURFHVVFRXOGEH
LWHUDWHGXQWLOFRQYHUJHQFHDVGLVFXVVHGSUHYLRXVO\$ÁRZFKDUWRIWKLVSURFHGXUH
has already been outlined in Chapter 5 (Figure 9) but is elaborated here in Figure
1RWHWKDWE\WDNLQJWLPHODJJHGYDOXHVRIWKHVDWXUDWLRQVWKHSUHVVXUHHTXDWLRQ
is linearlised and can then be solved implicitlyIRUWKHSUHVVXUHIRUWKDWLWHUDWLRQi
( ) ( )and ( Pin++11 ) . The saturations can then be obtained explicitly
ν ν ν
‰ Pin−+11 , Pin +1
using the latest pressures (i.e. the ( Pi −1 ) , ( Pi ) and ( Pi +1 ) . ) and the most recent
n +1 ν n +1 ν n +1 ν

iteration of the saturation (i.e. the (Sin +1 ) , (Sin++11 ) etc. 7KHUHIRUHWKLVDSSURDFKLV


ν ν

NQRZQDVWKHIMPESDSSUR[LPDWLRQZKLFKVWDQGVIRUIMplicit in PUHVVXUHExplicit
in Saturation. This can be iterated until it converges although there are limitations in
WKHVL]HRIWLPHVWHS6WZKLFKFDQEHWDNHQ,I6WLVWRRODUJHWKH,03(6PHWKRGPD\
EHFRPHXQVWDEOHDQGJLYHXQSK\VLFDOUHVXOWVOLNHWKHH[DPSOHLQ([HUFLVHDERYH

Institute of Petroleum Engineering, Heriot-Watt University 31


Petroleum Engineering Reservoir Simulation

Figure 13 IMPES Algorithm for the numerical solution of the two-phase pressure and
saturation equations (IMPES ‰,0SOLFLWLQ3UHVVXUH([SOLFLWLQ6DWXUDWLRQ

05/12/2016
32
Numerical Methods in Reservoir Simulation S I X

5 THE NUMERICAL SOLUTION OF LINEAR EQUATIONS

5.1 Introduction to Linear Equations


,QDOOLPSOLFLWÀQLWHGLIIHUHQFHPHWKRGVZHHQGXSZLWKDVHWRIOLQHDUHTXDWLRQVWR
VROYH,QIDFWZHKDYHVKRZQDERYHWKDWWKHHTXDWLRQVLQYROYHGHJWKHGLVFUHWLVHG
pressure equation - may be a set of non-linearDOJHEUDLFHTXDWLRQV+RZHYHUWKHVH
FDQXVXDOO\EHOLQHDULVHG VD\E\WLPHODJJLQJWKHFRHIÀFLHQWVDVGLVFXVVHGDERYH 
in order to obtain a set of linear equations. The solution to the original non-linear
equations may then be found by repeating or iterating through the cycle of solving
WKHOLQHDUHTXDWLRQV,QWKHIROORZLQJVHFWLRQZHZLOODGGUHVVWKHLVVXHRIVROYLQJWKH
QRQOLQHDUHTXDWLRQVZKLFKDULVHLQWKHGLVFUHWLVHGWZRSKDVHÁRZHTXDWLRQVGLUHFWO\

A generalised set of linear equations may be written in full as follows:

a11 .x1 + a12 .x 2 + a13 .x 3 + a14 .x 4 + a15 .x 5 ... + a1n .x n = b1

a 21 .x1 + a 22 .x 2 + a 23 .x 3 + a 24 .x 4 + a 25 .x 5 ... + a 2 n .x n = b 2

a 31 .x1 + a 32 .x 2 + a 33 .x 3 + a 34 .x 4 + a 35 .x 5 ... + a 3 n .x n = b 3
..... ...
..... ...
..... ...
a n1 .x1 + a n 2 .x 2 + a n 3 .x 3 + a n 4 .x 4 + a n 5 .x 5 ... + a nn .x n = b n (55)

where the aij and biDUHNQRZQFRQVWDQWVDQGWKHxi L n DUHWKHXQNQRZQ


TXDQWLWLHVZKLFKZHDUHWU\LQJWRÀQG7KHxiLQRXUSUHVVXUHHTXDWLRQIRUH[DPSOH
ZRXOGEHWKHXQNQRZQSUHVVXUHVDWWKHQH[WWLPHVWHS

The set of linear equations can be written in matrix form as follows:

⎡a11 a12 a13 a14 a15 ... a1n ⎤ ⎡x1 ⎤ ⎡b1 ⎤


⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢a 21 a 22 a 23 a 24 a 25 ... a 2 n ⎥ ⎢x 2 ⎥ ⎢b 2 ⎥
⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢a 31 a 32 a 33 a 34 a 35 ... a 3 n ⎥ ⎢x 3 ⎥ = ⎢b 3 ⎥
⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢..... ... ⎥ ⎢. ⎥ ⎢. ⎥
⎢..... ... ⎥ ⎢. ⎥ ⎢. ⎥
⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢..... ... ⎥ ⎢. ⎥ ⎢. ⎥
⎢ ⎥
⎣a n1 a n2 a n3 an4 a n 5 ... a nn ⎦ ⎢⎣x n ⎥⎦ ⎢⎣b n ⎥⎦ (56)

We can write the matrix A and the column vectors x and b as follows:

Institute of Petroleum Engineering, Heriot-Watt University 33


Petroleum Engineering Reservoir Simulation

⎡a11 a12 a13 a14 a15 ... a1n ⎤ ⎡x1 ⎤ ⎡b1 ⎤


⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎢a 21 a 22 a 23 a 24 a 25 ... a 2 n ⎥ ⎢x 2 ⎥ ⎢b 2 ⎥
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
A = ⎢a 31

a 32 a 33 a 34 a 35 ... a 3n ⎥ ;

x = ⎢⎢x3 ⎥⎥; and b = ⎢b 3 ⎥
⎢ ⎥
⎢..... ... ⎥ ⎢. ⎥ ⎢. ⎥
⎢..... ... ⎥ ⎢. ⎥ ⎢. ⎥
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎢..... ... ⎥ ⎢. ⎥ ⎢. ⎥
⎢ ⎥ ⎢x ⎥ ⎢b ⎥
⎣a n1 a n2 a n3 an4 a n 5 ... a nn ⎦ ⎣ n⎦ ⎣ n⎦

(57)

and the set of linear equations can be written in very compact form as follows:

A.x = b (58)

where A in an n x n square matrix and x and b are n x 1 column vectors.

A very simple example of a set of linear equations is given below:

4.x1 + 2.x 2 + 1.x 3 = 13

1.x1 + 3.x 2 + 3.x 3 = 14

2.x1 + 1.x 2 + 2.x 3 = 11 (59)

+RZGRZHVROYHWKHVH",QWKHDERYHFDVH\RXFDQGRDVLPSOHWULDODQGHUURUVROXWLRQ
WRÀQGWKDWx1 x2 = 1 and x3 DOWKRXJKWKLVZRXOGEHYLUWXDOO\LPSRVVLEOHLI
WKHUHZHUHKXQGUHGVRIHTXDWLRQV5HPHPEHUWKHUHLVRQHHTXDWLRQIRUHYHU\JULG
EORFNLQDOLQHDULVHGSUHVVXUHHTXDWLRQLQUHVHUYRLUVLPXODWLRQ DOWKRXJKWKHUHDUH
lots of zeros in the A matrix). This implies that we need a clear numerical algorithm
WKDWDFRPSXWHUFDQZRUNWKURXJKDQGVROYHWKHOLQHDUHTXDWLRQV7KHRYHUYLHZRI
approaches to solving these equations is discussed in the next section.

5.2 General Methods for Solving Linear Equations


)LUVWO\OHWXVQRWHWKDWWKHUHLVDYDVWOLWHUDWXUHRQVROYLQJVHWVRIOLQHDUHTXDWLRQV
DQGPDQ\ERRNVRQWKHXQGHUO\LQJWKHRU\DQGRQWKHQXPHULFDOWHFKQLTXHVKDYH
DSSHDUHG  ,QGHHG SHWUROHXP UHVHUYRLU VLPXODWLRQ KDV OHG WR WKH GHYHORSPHQW RI
some of these numerical techniques. We will not cover much of this huge subject
but we will cover enough that the student can appreciate - rather than understand in
detail - how the linear equation are solved in a simulator.

%DVLFDOO\WKHUHDUHWZRPDLQDSSURDFKHVIRUVROYLQJVHWVRIOLQHDUHTXDWLRQVLQYROYLQJ
direct methods and iterative methods as follows:

05/12/2016
34
Numerical Methods in Reservoir Simulation S I X

(i) 'LUHFW0HWKRGVWKLVJURXSRIPHWKRGVLQYROYHVIROORZLQJDVSHFLÀF
DOJRULWKPDQGWDNLQJDÀ[HGQXPEHURIVWHSVWRJHWWRWKHDQVZHU LH
the numerical values of x1 [2 .. xn   8VXDOO\ WKLV LQYROYHV D VHW RI
forward elimination steps in order to get the equations into a particularly
VXLWDEOHIRUPIRUVROXWLRQ VHHEHORZ IROORZHGE\DEDFNVXEVWLWXWLRQ
set of steps which give us the answer. An example of such a direct
method is Gaussian Elimination.

(ii) ,WHUDWLYH0HWKRGVLQWKLVW\SHRIPHWKRGZHXVXDOO\VWDUWRIIZLWKD
ÀUVWJXHVV RUHVWLPDWH WRWKHVROXWLRQYHFWRUVD\x(o):KHUHZHWDNH
WKLVDVLWHUDWLRQ]HURv = 0. We then have a procedure - an algorithm
IRUVXFFHVVLYHO\LPSURYLQJWKLVJXHVVE\LWHUDWLRQWRREWDLQx(1) A
x(2) A x(3) .... A x(i)HWF,ILWLVVXFFHVVIXOWKHQWKLVLWHUDWLYHPHWKRG
should converge to the correct x as i increases. The solution should get
FORVHUDQGFORVHUWRWKH´FRUUHFWµDQVZHUEXWLQPDQ\FDVHVZHFDQQRW
VD\H[DFWO\KRZTXLFNO\LWZLOOJHWWKHUH7KHUHIRUHLWHUDWLYHPHWKRGV
GR QRW KDYH D À[HG QXPEHU RI VWHSV LQ WKHP DV GR GLUHFW PHWKRGV
([DPSOHVRILWHUDWLYHPHWKRGVDUHWKH-DFRELLWHUDWLRQWKH/625 /LQH
6XFFHVVLYH2YHU5HOD[DWLRQ PHWKRGHWF

The following two sections will discuss each of these approaches for solving sets of
linear equations in turn.

5.3 Direct Methods for Solving Linear Equations


,Q IDFW ZH ZLOO QRW SUHVHQW WKH GHWDLOV RI  DQ\ GLUHFW PHWKRG IRU VROYLQJ OLQHDU
HTXDWLRQV,QVWHDGZHZLOOGLVFXVVDJHQHUDORXWOLQHRIKRZWKHVHPHWKRGVZRUN
Starting with the basic linear equation in matrix form:

A.x = b (60)

where A in an n x n square matrix and x and b are n x 1 column vectors. We can


write the n x (n+1) augmented matrix of A and bFRHIÀFLHQWVDVIROORZV

⎡a11 a12 a13 a14 a15 ... a1n b1 ⎤


⎢ ⎥
⎢ ⎥
⎢a 21 a 22 a 23 a 24 a 25 ... a 2 n b 2 ⎥
⎢ ⎥
⎢ ⎥
⎢a 31 a 32 a 33 a 34 a 35 ... a 3 n b 3 ⎥
⎢ ⎥
⎢..... ... ... ⎥
⎢..... ... ... ⎥
⎢ ⎥
⎢..... ... ... ⎥
⎢ ⎥
⎣a n1 a n2 a n3 an4 a n 5 ... a nn b n ⎦ (61)

Institute of Petroleum Engineering, Heriot-Watt University 35


Petroleum Engineering Reservoir Simulation

Remember that any mathematical operation we perform on one of the linear equations
(e.g. multiplying through by x2) must be performed on both sides of the equation i.e.
on the aij and the bi7KHUHIRUHVXSSRVHZHFDQWUDQVIRUPWKHDERYHDXJPHQWHGPDWUL[
LQWRWKHIROORZLQJIRUP ZHGRQRWVD\KRZWKLVLVGRQHMXVWWKDWLWcan be done):

⎡c11 c12 c13 c14 c15 ... c1n e1 ⎤


⎢ ⎥
⎢ ⎥
⎢0 c 22 c 23 c 24 c 25 ... c 2 n e 2 ⎥
⎢ ⎥
⎢ ⎥
⎢0 0 c33 c34 c35 ... c3 n e 3 ⎥
⎢ ⎥
⎢..... ... ...⎥
⎢..... ... ...⎥
⎢ ⎥
⎢..... ... ...⎥
⎢0 0 0 0 ... 0 c nn e n ⎥⎦
⎣ (62)

The C-matrix above is in upper triangular form i.e. only the diagonals and above
are non-zero (cij &LIM* i) and all elements below the diagonal are zero (cij 
LIL!M DVVKRZQDERYH1RZFRQVLGHUZK\WKLVSDUWLFXODUIRUPLVRILQWHUHVWLQ
VROYLQJWKHRULJLQDOHTXDWLRQV7KHUHDVRQLVWKDWLIZHKDYHIRUPHGWKHDXJPHQWHG
matrix correctly (i.e. doing the same operations to the A and bFRHIÀFLHQWV WKHQWKH
following matrix equation is equivalent to the original matrix equation:

i.e. A.x = b <=> C.x = e (63)

7KHUHIRUH

⎡c11 c12 c13 c14 c15 ... c1n ⎤ ⎡x1 ⎤ ⎡e1 ⎤


⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢0 c 22 c 23 c 24 c 25 ... c 2 n ⎥ ⎢x 2 ⎥ ⎢e 2 ⎥
⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢0 0 c33 c34 c35 ... c3 n ⎥ ⎢x 3 ⎥ = ⎢e 3 ⎥
⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢..... .. ⎥ ⎢. ⎥ ⎢. ⎥
⎢..... .. ⎥ ⎢. ⎥ ⎢. ⎥
⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢..... .. ⎥ ⎢. ⎥ ⎢. ⎥
⎢0 0 0 0 ... 0 c nn ⎦⎥ ⎢⎣x n ⎥⎦ ⎢⎣e n ⎥⎦ (64)

7KLVPDWUL[HTXDWLRQLVYHU\HDV\WRVROYHDVFDQEHVHHQE\ZULWLQJLWRXWLQIXOODV
follows:

05/12/2016
36
Numerical Methods in Reservoir Simulation S I X

c11.x1 + c12 .x 2 + c13 .x 3 + c14 .x 4 + c15 .x 5 ... + c1n .x n = e1

c 22 .x 2 + c 23 .x 3 + c 24 .x 4 + c 25 .x 5 ... + c 2 n .x n = e 2

c33 .x 3 + c 34 .x 4 + c35 .x 5 ... + c3 n .x n = e 3

c 44 .x 4 + c 45 .x 5 ... + c 4 n .x n = e 4
...... ...
...... ...

c n −1, n −1 .x n −1 + c n −1, n .x n = e n −1
c nn .x n = e n

(65)

:HFDQHDVLO\VROYHWKLVHTXDWLRQE\EDFNVXEVWLWXWLRQVWDUWLQJIURPWKHHTXDWLRQQ
ZKLFKRQO\KDVRQHWHUPWRÀQGxnWKLVxn is then used in the (n-1) equation (which
KDVWHUPV WRÀQGxn-1 etc. as follows:

c nn .x n = e n => x n = e n / c nn now use x n in ..

⎛ e − c n −1, n .x n ⎞
c n −1, n −1 .x n −1 + c n −1, n .x n = e n −1 => x n −1 = ⎜ n −1 ⎟ use x n −1 , x n in ..
⎝ c n −1, n −1 ⎠

c n − 2, n − 2 .x n − 2 + c n − 2, n −1 .x n −1 + c n − 2, n .x n = e n − 2
⎛e - c n − 2, n −1.x n −1 − c n − 2, n .x n ⎞
=> x n − 2 = ⎜ n − 2 ⎟ etc.
⎝ c n − 2, n − 2 ⎠

(66)

+HQFHE\ZRUNLQJEDFNWKURXJKWKHVHHTXDWLRQVLQXSSHUWULDQJXODUIRUPZHFDQ
calculate xnxn-1xn-2EDFNWRx1.

Institute of Petroleum Engineering, Heriot-Watt University 37


Petroleum Engineering Reservoir Simulation

EXERCISE 4.

Solve the following simple example of an upper triangular matrix:

4 x1 - 1x 2 − 2 x 3 + 1x 4 + 1x 5 = 5
2 x 2 − 2 x 3 + 1x 4 + 2 x 5 = 12
3x 3 + 4 x 4 + 1x 5 = 30
2 x 4 − 1x 5 = 3
3x 5 = 15

Answer
x1 = ..........; x 2 = ..........; x 3 = ..........; x 4 = ..........; x 5 = ..........

5.4 Iterative Methods for Solving Linear Equations


$VQRWHGDERYHWKHLGHDLQDQLWHUDWLYHPHWKRGIRUVROYLQJDVHWRIOLQHDUHTXDWLRQVLV
WRPDNHDÀUVWJXHVVDWWKHVROXWLRQDQGWKHQWRUHÀQHLWLQDVWHSZLVHPDQQHUXVLQJD
suitable algorithm. This procedure should gradually converge to the correct answer.
We illustrate the idea of such a method using a very simple iterative scheme. Note
that this simple point iterativeVFKHPHZLOOZRUNIRUVRPHRIWKHH[DPSOHVZHWU\
KHUHEXWLWLVQRWRQHWKDWLVUHFRPPHQGHGIRUXVHLQUHVHUYRLUVLPXODWLRQ+RZHYHU
LWDGHTXDWHO\LOOXVWUDWHVWKHPDLQLGHDVZKLFK\RXQHHGWRNQRZIRUWKHSXUSRVHVRI
this part of the course.

2XUVLPSOHVFKHPHVWDUWVZLWKWKHORQJKDQGYHUVLRQRIDVHWRIOLQHDUHTXDWLRQVDQG
IRURXUSXUSRVHVZHZLOOMXVWWDNHDVHWRIIRXUOLQHDUHTXDWLRQVDVIROORZV

a11 .x1 + a12 .x 2 + a13 .x 3 + a14 .x 4 = b1

a 21 .x1 + a 22 .x 2 + a 23 .x 3 + a 24 .x 4 = b 2

a 31.x1 + a 32 .x 2 + a 33 .x 3 + a 34 .x 4 = b 3

a 41.x1 + a 42 .x 2 + a 43 .x 3 + a 44 .x 4 = b 4 (67)

We can rearrange the above set of equations as follows:

05/12/2016
38
Numerical Methods in Reservoir Simulation S I X

x1 =
1
a11
[
b1 − (a12 x 2 + a13x 3 + a14 x 4 ) ]

x2 =
1
a 22
[b 2 − (a 21x1 + a 23x 3 + a 24 x 4 ) ]

x3 =
1
a 33
[ ]
b 3 − (a 31x1 + a 32 x 2 + a 34 x 4 )

x4 =
1
a 44
[b 4 − (a 41x1 + a 42 x 2 + a 43x 3 ) ]
(68)

7KH UHVXOWLQJ HTXDWLRQV DUH SUHFLVHO\ HTXLYDOHQW WR WKH RULJLQDO VHW DOWKRXJK LI
DQ\WKLQJWKH\ORRNDELWPRUHFRPSOLFDWHG:K\ZRXOGZHGHOLEHUDWHO\FRPSOLFDWH
WKHVLWXDWLRQ",QIDFWWKHDERYHUHRUJDQLVHGHTXDWLRQVIRUPVWKHEDVLVIRUDQLWHUDWLYH
VFKHPHZKLFKZHFDQXVHWRVROYHWKHHTXDWLRQVQXPHULFDOO\)LUVWO\ZHQHHGWR
introduce some notation as follows:

Notation:
xi(v) - the solution for xi at iteration i; where i is the iteration
counter.

x( 0 ) , x( ν)  WKHÀUVWJXHVVDQGithLWHUDWLRQRIWKHVROXWLRQYHFWRUx.

Err. - an estimate of the error in the iteration scheme from the i


to the (i+1) iteration

7RO  VRPH´VPDOOµTXDQWLW\ZKLFKGHWHUPLQHVWKHDFFHSWDEOH
   HUURULQWKHLWHUDWLRQVFKHPHLI(UU7ROWKHQWKH  
scheme has converged.

8VLQJWKHDERYHQRWDWLRQLQHTXDWLRQVDERYHJLYHVWKHIROORZLQJVLPSOHLWHUDWLRQ
scheme:

Institute of Petroleum Engineering, Heriot-Watt University 39


Petroleum Engineering Reservoir Simulation

x1( ν +1) =
1
a11
[
b1 − (a12 .x (2ν ) + a13 .x (3ν ) + a14 .x (4ν ) ) ]

x (2ν +1) =
1
a 22
[
b 2 − (a 21 .x1( ν ) + a 23 .x (3ν ) + a 24 .x (4ν ) ) ]

x (3ν +1) =
1
a 33
[ ]
b 3 − (a 31 .x1( ν ) + a 32 .x (2ν ) + a 34 .x (4ν ) )

x (4ν +1) =
1
a 44
[
b 3 − (a 41 .x1( ν ) + a 42 .x (2ν ) + a 43 .x (3ν ) ) ] (69)

This iteration scheme may now be applied as follows:

L 0DNHDQLQLWLDOJXHVVDWWKHVROXWLRQLWHUDWLRQ
i = 0: x ( 0 ) = x1( 0 ) , x (20 ) , x (30 ) , x (40 )

(ii) Update the solution to the next iteration i+1 using equations 69

(iii) Estimate an Error term (Err.) by comparing the latest with the
SUHYLRXV LWHUDWLRQRIWKHXQNQRZQVHJ
4
Err. = ∑ x iν +1 − x iν
i =1

LY  ,V(UU7RO

,I\HVWKHVFKHPHKDVFRQYHUJHGLIQRJREDFNWRVWHS LL DQGFRQWLQXHWKHLWHUDWLRQV

This scheme is now illustrated with a practical example.

([DPSOHSolve the following set of equations using the iterative scheme above.

3.1x1 - 0.32 x 2 + 0.5x 3 + 0.1x 4 = 13.92

0.2 x1 + 2.1x 2 + 0.33x 3 + 0.21x 4 = 5.63

0.23x1 - 0.32 x 2 + 4.0 x 3 + 0.3x 4 = 15.19

0.42 x1 + 0.22 x 2 + 0.5x 3 + 5.2 x 4 = 16.76

7DNHWKHÀUVWJXHVV x1( 0 ) = 2, x (20 ) = 2, x (30 ) = 2, x (40 ) = 2

05/12/2016
40
Numerical Methods in Reservoir Simulation S I X

+LQW reorganise the above equations as follows:

(
x1( ν +1) = (1 / 3.1) * 13.92 - (- 0.32 x (2ν ) + 0.5x (3ν ) + 0.1x (4ν ) ) )

(
x (2ν +1) = (1 / 2.1) * 5.63 - (0.20x ( ν)
1 + 0.33x (3ν ) + 0.21x (4ν ) ))

(
x (3ν +1) = (1 / 4.0) * 15.19 - (0.23x ( ν)
1 - 0.32 x (2ν ) + 0.30 x (4ν ) ))

(
x (4ν +1) = (1 / 5.2) * 16.76 - ( 0.42x ( ν)
1 + 0.22 x (2ν ) + 0.5x (3ν ) ))

EXERCISE 5.

Fill in the table below for 10 iterations using a calculator or a spreadsheet:

POINT ITERATIVE SOLUTION OF LINEAR EQUATIONS

Iteration
counter x at iter. k
k x1 x2 x3 x4
First guess = 0 2.0 2.0 2.0 2.0
1
2
3
4
5
6
7
8
9
10

,QVRPHFDVHVLWPD\EHSRVVLEOHWRGHYHORSLPSURYHGLWHUDWLRQVFKHPHVE\XVLQJ
the latestLQIRUPDWLRQWKDWLVDYDLODEOH)RUH[DPSOHLQWKHDERYHLWHUDWLRQVFKHPH
we could use the very latest value of x1(i+1) when we are calculating x2(i+1) since we
DOUHDG\KDYHWKLVTXDQWLW\/LNHZLVHZHFDQXVHERWKx1(i+1) and x2(i+1) when we
calculate x3(i+1) etc as shown below:

Institute of Petroleum Engineering, Heriot-Watt University 41


Petroleum Engineering Reservoir Simulation

(
x1( ν +1) = (1 / 3.1) * 13.92 - (- 0.32 x (2ν ) + 0.5x (3ν ) + 0.1x (4ν ) ))

(
x (2ν +1) = (1 / 2.1) * 5.63 - (0.20x ( ν +1)
1 + 0.33x (3ν ) + 0.21x (4ν ) ))

(
x (3ν +1) = (1 / 4.0) * 15.19 - (0.23x ( ν + 1)
1 - 0.32 x (2ν +1) + 0.30 x (4ν ) ))

(
x (4ν +1) = (1 / 5.2) * 16.76 - ( 0.42x ( ν +1)
1 + 0.22 x (2ν +1) + 0.5x (3ν +1) ))
x1( ν +1) , x (2ν +1) , x (3ν +1) !XQGHUOLQHGWHUPVLPSO\WKH\DUHDWWKHODWHVWWLPHDYDLODEOH 

:KHQWKLVLVGRQHZHÀQGWKHIROORZLQJUHVXOWV
IMPROVED POINT ITERATIVE SOLUTION OF LINEAR EQUATIONS (Using
latest information)

- see spreadsheet CHAP6Ex5.xls - Sheet 2

Iteration
counter x at iter. ν
ν x1 x2 x3 x4
First guess = 0 2 2 2 2
1 4.309677 1.756221 3.540191 2.460283
2 4.021247 1.495632 3.501408 2.498333
3 3.999376 1.500005 3.500161 2.500035
4 3.999973 1.499974 3.499997 2.500004
5 3.999998 1.5 3.5 2.5
Converged ⇒ 6 4 1.5 3.5 2.5
7 4 1.5 3.5 2.5
8 4 1.5 3.5 2.5
9 4 1.5 3.5 2.5
10 4 1.5 3.5 2.5

Note - converges fully at ν = 6 iterations.

&OHDUO\FRPSDULQJWKLVWDEOHZLWKWKHSUHYLRXVRQHXVLQJWKHVLPSOHSRLQWLWHUDWLYH
PHWKRGZHVHHWKDWWKLVPHWKRGGRHVLQGHHGFRQYHUJHTXLFNHU$OWKRXJKWKLVLV
MXVWRQHH[DPSOHLWLVJHQHUDOO\WUXHWKDWXVLQJWKHODWHVWLQIRUPDWLRQLQDQLWHUDWLYH
scheme improves convergence.

1RWHVRQLWHUDWLYHVFKHPHVWKHUHDUHVHYHUDOSRLQWVWRQRWHDERXWLWHUDWLYHVFKHPHV
ZKLFKZHKDYHQRWUHDOO\GHPRQVWUDWHGRUH[SODLQHGKHUH+RZHYHU\RXFDQFRQÀUP
some of these points by using the supplied spreadsheets. These points are:

(i) Iterative solution schemes for linear equations are often relatively simple
to apply - and to program on a computer (usually in FORTRAN). If you
study the supplied spreadsheets (CHAP6Ex5.xls \RXFDQVHHWKDWWKH\
are quite simple in structure for this set of equations.

05/12/2016
42
Numerical Methods in Reservoir Simulation S I X

(ii) The convergence rate of an iterative scheme may depend on how good
the initial guess (x(0) LV,I\RXZDQWWRGHPRQVWUDWHWKLVIRU\RXUVHOI
run the spreadsheet (CHAP6Ex5.xls) with a more remote initial guess.
Here is the same example as that presented above with a completely
absurd initial guess:

POINT ITERATIVE SOLUTION OF LINEAR EQUATIONS - Bad First Guess


(you can use CHAP6Ex5.xlsWRFRQÀUPWKHVHUHVXOWV

Iteration
counter x at iter. ν
ν x1 x2 x3 x4
First guess = 0 900 -2000 456 23000
1 -1017.45 -2454.69 -1932.95 -28.7
2 63.79526 406.2002 -131.922 375.1144
3 55.59796 -20.1756 4.491703 -6.43019
4 1.890636 -2.67691 -0.53117 0.84584
5 4.326953 2.668945 3.538073 3.234699
6 4.090824 1.389409 3.519613 2.420476
7 3.987986 1.49622 3.491895 2.495457
8 4.001064 1.502872 3.500729 2.50191
9 4.000117 1.499593 3.500025 2.499722
10 3.999963 1.500013 3.499982 2.500005
11 4.000004 1.500006 3.500003 2.500004
12 4 1.499999 3.5 2.499999
Converged ⇒ 13 4 1.5 3.5 2.5
14 4 1.5 3.5 2.5
15 4 1.5 3.5 2.5

(iii)We cannot tell in advance how many iterations may be required in order
WRFRQYHUJHDJLYHQLWHUDWLYHVFKHPH&OHDUO\IURPWKHUHVXOWVDERYH
D JRRG LQLWLDO JXHVV KHOSV  ,Q UHVHUYRLU VLPXODWLRQ ZKHQ ZH VROYH
WKHSUHVVXUHHTXDWLRQDJRRGHQRXJKJXHVVRIWKHQHZSUHVVXUHLVWKH
values of the old pressures at the last time step. If nothing radical has
FKDQJHGLQWKHUHVHUYRLUWKHQWKLVPD\EHÀQH+RZHYHULIQHZZHOOV
have started up in the model or existing wells have changed rate very
VLJQLÀFDQWO\WKHQWKH´SUHVVXUHDWODVWWLPHVWHSµJXHVVPD\QRWEHYHU\
JRRG  +RZHYHU ZLWK D YHU\ UREXVW QXPHULFDO PHWKRG FRQYHUJHQFH
should still be achieved.

(iv) It helps in an iterative method to use the latest information available. This
was demonstrated in the iterative schemes in spreadsheet CHAP6Ex5.xls.

5.5 A Comparison of Iterative and Direct Methods for Solving Linear


Equations
,QWKLV&KDSWHUZHKDYHGHVFULEHGWZRJHQHUDOPHWKRGVGLUHFWDQGLWHUDWLYHIRU
VROYLQJWKHOLQHDUHTXDWLRQVZKLFKDULVHZKHQZHGLVFUHWLVHWKHÁRZHTXDWLRQVRI
UHVHUYRLUVLPXODWLRQ:HKDYHQRWLQGLFDWHGZKLFKRIWKHVHPHWKRGVLVXVXDOO\´EHVWµ
IRUUHVHUYRLUVLPXODWLRQSUREOHPV7KLVLVEHFDXVHLWGHSHQGVRQWKHSUREOHP7KH
ÀQDOQXPHULFDOSUREOHPZKLFKLVVROYHGLQDUHVHUYRLUVLPXODWRUFRXOGEHTXLWHVPDOO

Institute of Petroleum Engineering, Heriot-Watt University 43


Petroleum Engineering Reservoir Simulation

DQGVLPSOHRULWFRXOGEHYHU\ODUJHDQGKDYHVRPHLQWULQVLFDOO\GLIÀFXOWQXPHULFDO
problems within it.

,QDQ\QXPHULFDOFRPSXWDWLRQDOPHWKRGVXFKDVWKRVHIRUVROYLQJDVHWRIOLQHDU
HTXDWLRQVZHQHHGWRKDYHVRPHZD\RIFDOFXODWLQJWKHDPRXQWRI´ZRUNµLQYROYHG
To some extent this depends on the computer architecture since new generation
parallel processing machines are becoming available as discussed in Chapter 1.
+RZHYHUZHZLOOWDNHTXLWHDVLPSOHYLHZEDVHGRQDFRQYHQWLRQDOVHULDOSURFHVVLQJ
PDFKLQHDQGZLOOGHÀQHFRPSXWDWLRQDOZRUNDVVLPSO\WKHQXPEHURIPXOWLSOLFDWLRQV
DQGGLYLVLRQV DGGLWLRQDQGVXEWUDFWLRQLVFKHDS ,QWKLVZD\ZHFDQGHÀQHWKH
DPRXQWRIZRUNUHTXLUHGIRUDQ\JLYHQGLUHFWDQGLWHUDWLYHVFKHPHIRUVROYLQJOLQHDU
equations. We present results without any proof for two such schemes called the
BAND (a direct method) and LSOR (Line Successive Over-Relaxation; an iterative
PHWKRG VFKHPHV)RUD'SUREOHPZLWK1;DQG1<JULGEORFNVLQWKH[DQG\
GLUHFWLRQVUHVSHFWLYHO\ ZKHUHZHFKRRVH1<1;

%$1' GLUHFW  :RUN:% 5 NX.NY3 (70)

/625 LWHUDWLYH  :RUN:LSOR 5 NX.NY. Niter (71)

where Niter is the number of iterations until convergence is reached. It is already


TXLWHFOHDUWKDWWKHDPRXQWRIZRUNIRUWKHGLUHFWPHWKRGZKLFKRQO\KDVWREHGRQH
RQFHLVODUJHUWKDQWKDWIRUDVLQJOHLWHUDWLRQRIWKHLWHUDWLYHPHWKRG+RZHYHUZH
GRQRWNQRZLQDGYDQFHWKHQXPEHURILWHUDWLRQV1iter. We illustrate some typical
results for these two methods with a simple exercise below.

EXERCISE 6.

:KLFKLVEHVWPHWKRG LHWKDWUHTXLULQJWKHORZHVWDPRXQWRIFRPSXWDWLRQDOZRUN 
%$1'RU/625IRUWKHIROORZLQJSUREOHPV"

L 1; 1< 1iter = 50 (a small problem)

LL 1; 1< 1iter = 50

LLL 1; 1< 1iter = 70

LY 1; 1< 1iter = 150

NX NY Niter BAND LSOR, Comment


WB WLSOR
5 3 50
20 5 50
100 20 70
400 100 150

05/12/2016
44
Numerical Methods in Reservoir Simulation S I X

We can summarise our comparison between direct and iterative methods for solving
the sets of linear equations that arise in reservoir simulation as follows:

(i) A direct method for solving a set of linear equations has an algorithm
WKDWLQYROYHVDÀ[HGQXPEHURIVWHSVIRUDJLYHQVL]HRISUREOHP*LYHQ
that the equations are properly behaved (i.e. the problem has a stable
VROXWLRQ WKHGLUHFWPHWKRGLVJXDUDQWHHGWRJHWWRWKHVROXWLRQLQWKLV
À[HGQXPEHURIVWHSV1RÀUVWJXHVVLVUHTXLUHGIRUDGLUHFWPHWKRG

LL  $QLWHUDWLYHPHWKRGRQWKHRWKHUKDQGVWDUWVIURPDÀUVWJXHVVDWWKH
solution (x(o)) and then applied a (usually simpler) algorithm to get better
and better approximations to the true solution of the linear equations. If
VXFFHVVIXOWKHPHWKRGZLOOFRQYHUJHLQDFHUWDLQQXPEHURILWHUDWLRQV
NiterZKLFKZHKRSHZLOOEHDVVPDOODVSRVVLEOH+RZHYHUZHFDQQRW
XVXDOO\WHOOZKDWWKLVQXPEHUZLOOEHLQDGYDQFH$OVRLQVRPHFDVHV
WKHLWHUDWLYHPHWKRGPD\QRWFRQYHUJHIRUFHUWDLQW\SHVRI´GLIÀFXOWµ
SUREOHP:HPD\QHHGWRKDYHJRRGÀUVWJXHVVWRPDNHRXULWHUDWLYH
PHWKRGIDVW$OVRLWRIWHQKHOSVWRXVHWKHODWHVWFRPSXWHGLQIRUPDWLRQ
that is available (see example above).

LLL  8VXDOO\WKHDPRXQWRI´ZRUNµUHTXLUHGIRUDGLUHFWPHWKRGLVVPDOOHU
for smaller problems but iterative methods usually win out for larger
SUREOHPV)RUDQLWHUDWLYHPHWKRGWKHDPRXQWRIZRUNper iteration is
usually relatively small but the number of iterations (Niter) required to
UHDFKFRQYHUJHQFHPD\EHODUJHDQGLVXVXDOO\XQNQRZQLQDGYDQFH

Institute of Petroleum Engineering, Heriot-Watt University 45


Petroleum Engineering Reservoir Simulation

EXERCISE 7.

The linear equations which arise in reservoir simulation may be solved by a direct
solution method or an iterative solution method. Fill in the table below:

Direct solution method Iterative solution method

Give a very
brief description
of each method

Main advantages 1. 1.

2. 2.

Main 1. 1.
disadvantages

2. 2.

05/12/2016
46
Numerical Methods in Reservoir Simulation S I X

6. DIRECT SOLUTION OF THE NON-LINEAR EQUATIONS OF


MULTI-PHASE FLOW

6.1 Introduction to Sets of Non-linear Equations


We noted in Section 4 above that the equations which we obtain when we discretise
WKHWZRSKDVHÁRZHTXDWLRQVDUHDFWXDOO\non-linearLQQDWXUH+RZHYHUWKHVWUDWHJ\
ZHGLVFXVVHGDERYH WKH,03(6PHWKRG LQYROYHGWDFNOLQJWKHSUREOHPDOPRVWDV
LILWZHUHDOLQHDUVHWRIHTXDWLRQVVLQFHZHWLPHODJJHGWKHFRHIÀFLHQWVWRUHGXFH
the problem to a linear set of equations. Then we repeated this process - we applied
UHSHDWHGLWHUDWLRQVXQWLOLW KRSHIXOO\ FRQYHUJHG7KHUHIRUHZHWRRNDQRQOLQHDU
problem and solved it as if it were a series of linear problems.

,QWKLVVHFWLRQZHZLOOLQWURGXFHWKHJHQHUDOLGHDRIVROYLQJVHWVRIQRQOLQHDUHTXDWLRQV
QXPHULFDOO\DQGLQGLFDWHKRZWKLVFDQEHDSSOLHGWRWKHWZRSKDVHÁRZHTXDWLRQV
:HZLOOGRWKLVLQDVLPSOLÀHGPDQQHUWKDWVKRZVWKHEDVLFSULQFLSOHVZLWKRXWJRLQJ
LQWRWRRPXFKGHWDLO)LUVWO\FRPSDUHWKHGLIIHUHQFHEHWZHHQVROYLQJWKHIROORZLQJ
WZRVHWVRIWZRHTXDWLRQVDVHWRIOLQHDUHTXDWLRQV

2 x1 + x 2 = 10
3x1 − x 2 = 5 (72)

and a set of 2 non-linear equations:

x1 − 2 x 2 .e − x1 = 2
x 2 .(x1 )2 − x1 .(x 2 ) = −5
2
(73)

,WLVLPPHGLDWHO\REYLRXVWKDWWKHVHFRQGVHWRIQRQOLQHDUHTXDWLRQVLVPRUHGLIÀFXOW
7KHÀUVWVHWRIOLQHDUHTXDWLRQVFDQEHUHDUUDQJHGHDVLO\WRVKRZWKDWx1 = 3 and x2 =
+RZHYHULWLVQRWDVVWUDLJKWIRUZDUGWRGRWKHVDPHWKLQJIRUWKHQRQOLQHDUVHW
RIHTXDWLRQV$VDÀUVWDWWHPSWWRVROYHWKHVHZHPLJKWWU\WRGHYHORSDQLWHUDWLYH
scheme by rearranging the equations as follows
( ν)
x1( ν +1) = 2 + 2 x (2ν ) .e − x1
x (2ν ) .(x1( ν ) )2 +5
x (2ν +1) = (74)
x1( ν )

ZKHUHDVEHIRUHi denotes the iteration counter.

7KHDFWXDOVROXWLRQLQWKLVFDVHLVx1 x2 = 3.144089. Applying the above


LWHUDWLYHVFKHPHZLWKDÀUVWJXHVVx1(0) = x2(0) JLYHVWKHUHVXOWVVKRZQLQ7DEOH
2 below (where we have removed some of the intermediate iterations).

7DEOH Non-linear scheme applied to solution of equations 73 using the point iterative
VFKHPHRIHTXDWLRQ VSUHDGVKHHWCHAP6Ex5.xls - Sheet 3)

Institute of Petroleum Engineering, Heriot-Watt University 47


Petroleum Engineering Reservoir Simulation

Iteration
counter x at iter. ν
ν x1 x2
First guess = 0 1 1
1 2.735759 2.44949
2 2.317673 2.920421
3 2.575338 2.987627
4 2.454885 3.104133
.... .... ....
9 2.513337 3.141814
10 2.508958 3.144173
.... .... ....
25 2.510682 3.144089
26 2.510681 3.144089

<RXFDQFKHFNWKHUHVXOWVLQ7DEOHRUH[SHULPHQWZLWKRWKHUÀUVWJXHVVHVXVLQJ6KHHW
3 of spreadsheet CHAP6Ex5.xls. We note that the convergence rate in Table 2 is
QRWYHU\IDVWEXWLQWKLVFDVHLWGRHVUHDFKDVROXWLRQ,QJHQHUDOLWLVXVXDOO\YHU\
GLIÀFXOWWRHVWDEOLVKIRUFHUWDLQZKHWKHUDJLYHQVFKHPHZLOOFRQYHUJHIRUQRQOLQHDU
equations although there is a large body of mathematics associated with the solution
of such systems (which is beyond the scope of this course).

6.2 Newton’s Method for Solving Sets of Non-linear Equations


:HWDNHDVWHSEDFNWRWKHVROXWLRQRIDVLQJOHQRQOLQHDUHTXDWLRQVXFKDV

x 2 .e − x = 0.30 (75)

which has the solution x = 0.829069 (you can verify this by calculating x 2 .e − x
DQGPDNLQJVXUHLWLVWRDQDFFXUDF\RIa[-8). This equation can be
represented as:

f ( x) = 0 where f ( x) = x 2 .e − x − 0.30 (76)

and the solution we require is the value of x for which the function f(x) is zero.
Expand f(x) as a Taylor series as follows:

δx 2
f ( x) ≈ f ( x o ) + δx.f ′( x 0 ) + .f ′′( x 0 ) + ... (77)
2

7KLQNLQJLQWHUPVRIDQLWHUDWLRQVFKHPH x(i) A x(i+1)) as a basis for calculating better


and better guesses of the solution of f(x  ZHFDQUHZULWHWKH7D\ORUVHULHVDERYHDV

f ( x) ≈ f ( x ( ν ) ) + ( x ( ν +1) − x ( ν ) ).f ′( x ( ν ) ) (78)

where we have neglected all the second order and higher terms. Since we require
the solution for f(x  WKHQZHREWDLQ

f ( x ( ν ) ) + ( x ( ν +1) − x ( ν ) ).f ′( x ( ν ) ) = 0 (79)

ZKLFKFDQEHUHDUUDQJHGWRWKHIROORZLQJDOJRULWKPWRHVWLPDWHRXUXSGDWHGJXHVV
x(i+1) as follows:

05/12/2016
48
Numerical Methods in Reservoir Simulation S I X

f (x( ν) )
x ( ν + 1) = x ( ν ) − (80)
f ' (x( ν) )

This equation is the basis of the Newton-Raphson algorithm for obtaining better and
EHWWHUHVWLPDWHVRIWKHVROXWLRQRIWKHHTXDWLRQf(x) = 0. Note that we need both a
ÀUVWJXHVVx(0)DQGDOVRDQH[SUHVVLRQIRUWKHGHULYDWLYHf ' (x(i)) at iteration i. In the
VLPSOHH[DPSOHLQHTXDWLRQZHFDQREWDLQWKHGHULYDWLYHDQDO\WLFDOO\DVIROORZV

df ( x)
= f ′ ( x) = 2 x.e − x − x 2 .e − x (81)
dx

Therefore the Newton-Raphson algorithm for solving equation 75 above is as follows:

⎡ (x ( ν ) )2 .e − x ( ν ) − 0.30 ⎤
( ν +1) ( ν)
x =x - ⎢ ( ν) − x ( ν ) ⎥ (82)
− ( x ( ν ) ) .e − x ⎥⎦
2 ( ν)
⎢⎣ 2 x .e

The point iterative method of the previous section and the Newton-Raphson method
of equation 82 have both been applied to the solution of equation 75 (see Sheet 4
of spreadsheet CHAP6Ex5.xls for details). The results are shown in Table 3 for a
ÀUVWJXHVVRI[(0) = 1.

7DEOH Comparison of the point iterative and Newton-Raphson methods for solving
non-linear equation 75; (see spreadsheet CHAP6Ex5.xls - Sheet 4 for details)

Iteration Value of x at iteration ν


Number

ν Point Newton-
Iteration Raphson
method method
x(ν) x(ν)

0 1 1
1 0.903042 0.815485
2 0.860307 0.825272
3 0.84212 0.82806
4 0.834497 0.828805
5 0.831322 0.829
6 0.830003 0.829051
7 0.829456 0.829064
8 0.82923 0.829068
9 0.829136 0.829069
10 0.829097 0.829069
11 0.82908 0.829069
12 0.829074 0.829069
13 0.829071 0.829069
14 0.82907 0.829069
15 0.829069 0.829069
16 0.829069 0.829069

Institute of Petroleum Engineering, Heriot-Watt University 49


Petroleum Engineering Reservoir Simulation

The correct solution to equation 75 is x = 0.829069. The results in Table 3 show


that the Newton-Raphson method converges to this solution (to an accuracy better
than 10-6 LQLWHUDWLRQVZKHUHDVLWWDNHVLWHUDWLRQIRUWKHSRLQWLWHUDWLYHPHWKRG
to converge at the same level accuracy. This performance can vary quite a bit from
problem to problem but the Newton-Raphson method is generally better if the derivative
WHUPf '(x(i) LVQRWWRRFORVHWR]HUR:KHQWKLVGHULYDWLYHJHWVWRRVPDOOLWFDQEH
VHHQWKDWWKHVHFRQGWHUPLQHTXDWLRQZRXOGVWDUWWRJHWYHU\ODUJHRU´EORZXSµ
as it is sometimes described. We will not go into details about the convergence
SURSHUWLHVRIWKH1HZWRQ5DSKVRQEXWLWLVPHDQWWREH´TXDGUDWLFµPHDQLQJWKDWWKH
error should decrease quite rapidly.

We now go on to see how the Newton-Raphson method can be applied to sets of


non-linear equations. Returning to the set of two non-linear equations in the previous
VHFWLRQZHQRWHWKDWDQRWKHUZD\RIZULWLQJWKLVVHWRIHTXDWLRQVLQDJHQHUDOZD\
is as follows:

F1 (x1 , x 2 ) = 0

F2 (x1 , x 2 ) = 0 (83)

ZKHUHLQWKHFDVHRIHTXDWLRQDERYHWKHVHIXQFWLRQVZRXOGEHJLYHQE\

F1 (x1 , x 2 ) = x1 + 2 x 2 .e − x1 − 2

F2 (x1 , x 2 ) = x 2 .(x1 )2 − x1 .(x 2 ) + 5


2
(84)

7KHSUREOHPLVWKHQWRÀQGWKHYDOXHVRIx1 and x2WKDWPDNH)1 = F2 = 0. In this


VHFWLRQZHSUHVHQWNewton’s method for the solution of sets of non-linear equations.
%DVLFDOO\ZHZLOOVLPSO\VWDWHWKH1HZWRQ5DSKVRQDOJRULWKPZLWKRXWSURRI DOWKRXJK
it will resemble the simple form of the Newton-Raphson method above) for sets of
non-linear equations. We will then illustrate what this means for the example of the
set of two non-linear equations above (equation 73).

'HÀQLWLRQV

$VEHIRUH

x ( ν ) and x ( ν +1) = the solution vectors at iteration levels i and (i+1)

New terms are:

N = the number of non-linear equations (and hence


   XQNQRZQV[1[2[N)
F( x ( ν ) )  WKHYHFWRURIIXQFWLRQYDOXHV)1)2 .. FN at x(i)

F( x ) = 0 for the "true" solution of the set of non - linear equations

05/12/2016
50
Numerical Methods in Reservoir Simulation S I X

That is:
⎡F1 ( x1ν , x 2ν , x 3ν ,....., x Nν ) ⎤
⎢ ⎥
⎢F2 ( x1ν , x 2ν , x 3ν ,....., x Nν ) ⎥
⎢ ⎥
F( x ( ν ) ) = ⎢ 3 ( 1 2 3 N)
⎢ F x ν
, x ν
, x ν
,....., x ν


⎢ ..... ⎥
⎢ ..... ⎥
⎢ ⎥
⎢F ( x ν , x ν , x ν ,....., x ν )⎥ (85)
⎣ N 1 2 3 N ⎦

J( x ( ν ) )
 WKH1[1-DFRELDQPDWUL[GHÀQHGDVIROORZV

⎡ ∂F1 (x ( ν ) ) ∂F1 (x ( ν ) ) ∂F1 (x ( ν ) ) ∂F1 (x ( ν ) ) ⎤


⎢ ...... ⎥
⎢ ∂x1 ∂x 2 ∂x 3 ∂x N ⎥
⎢ ⎥
⎢ ⎥
⎢ ∂F2 (x ( ν ) ) ∂F2 (x ( ν ) ) ∂F2 (x ( ν ) ) ∂F2 (x ( ν ) ) ⎥
⎢ ...... ⎥
⎢ ∂x1 ∂x 2 ∂x 3 ∂x N ⎥
⎢ ⎥
J( x ( ν ) ) = ⎢ ⎥
⎢ ∂F3 (x ( ν ) ) ∂F3 (x ( ν ) ) ∂F3 (x ( ν ) ) ∂F3 (x ( ν ) ) ⎥
⎢ ...... ⎥
⎢ ∂ x1 ∂x 2 ∂ x 3 ∂x N ⎥
⎢ ..... ⎥
⎢ ⎥
⎢ ..... ⎥
⎢ ( ν) ⎥
⎢ ∂FN (x ) ∂FN (x ) ∂FN (x ) ...... ∂FN (x ) ⎥
( ν) ( ν) ( ν)

⎢⎣ ∂x1 (86)
∂x 2 ∂x 3 ∂x N ⎥⎦

[J(x )]
−1
( ν)
= the inverse of the Jacobian matrix. (Recall that the inverse of a matrix

A is denoted by A-1DQGE\GHÀQLWLRQA-1 .A = IZKHUHI is the identity matrix - all


diagonals 1 and all other elements zero - see below). The above matrix is also an
NxN matrix with the property:

[J(x )] .[J(x )] = I, the identity matrix


−1
( ν) ( ν)

⎡1 0 0 0 0 ...... 0 ⎤
⎢0 1 0 0 0 ...... 0 ⎥
⎢ ⎥
⎢0 0 1 0 0 ...... 0 ⎥
⎢0 0 0 1 0 ...... 0 ⎥⎥
[ ( )] .[J(x )]
−1
That is A J x ( ν ) ( ν)
=I=⎢ (87)
⎢0 0 0 0 1 ...... 0 ⎥
⎢ ⎥
⎢....... ⎥
⎢....... ⎥
⎢ ⎥
⎣0 0 0 0 0 ...... 1 ⎦
Institute of Petroleum Engineering, Heriot-Watt University 51
Petroleum Engineering Reservoir Simulation

8VLQJDOORIWKHDERYHGHÀQLWLRQVWKH1HZWRQ5DSKVRQDOJRULWKPIRUDVHWRIQRQ
OLQHDUHTXDWLRQVF( x) = 0LVJLYHQE\WKHIROORZLQJH[SUHVVLRQ

[ ]
x (ν+1) = x (ν) − J ( x (ν) ) .F( x (ν) )
−1
(88)

:HÀUVWGHPRQVWUDWHKRZWKLVLVDSSOLHGWRDVLPSOHH[DPSOH HTXDWLRQV EHIRUH


going on to show how it is applied to the more complicated non-linear sets of equations
which arise in the fully implicit discretisation of the reservoir simulation equations.

([DPSOH5HWXUQLQJWRWKHVLPSOHH[DPSOHZKHUH1  UHDUUDQJHGHTXDWLRQV 

F1 (x1 , x 2 ) = x1 − 2 x 2 .e − x1 − 2

F2 (x1 , x 2 ) = x 2 .(x1 )2 − x1 .(x 2 ) + 5


2
(89)

,QWKHQRWDWLRQGHYHORSHGDERYHWKHVHHTXDWLRQVEHFRPH

⎡F1 (x1 , x 2 ) ⎤ ⎡x1 − 2 x 2 .e − x1 − 2 ⎤


F( x ) = ⎢ ⎥ = ⎢ ⎥ (90)
⎢⎣F2 (x1 , x 2 )⎥⎦ ⎢⎣x 2 .(x1 )2 − x1 .(x 2 ) + 5⎥⎦
2

We note that the 2x2 Jacobian matrix is given by:

⎡ ∂F1 (x ( ν ) ) ∂F1 (x ( ν ) ) ⎤
⎢ ⎥
⎢ ∂x1 ∂x 2 ⎥
J( x ) = ⎢
( ν) ⎥
⎢ ⎥
⎢ ∂F2 (x ( ν ) ) ∂F2 (x ( ν ) ) ⎥
⎢ ⎥ (91)
⎣ ∂x1 ∂x 2 ⎦

where each of the elements can be evaluated analytically to obtain:

⎢ (
⎡ 1 + x ( ν ) .e − x1( ν )
2 ) ( ν)
− 2.e − x1 ⎤

J( x ) =
( ν) ⎢ ⎥
⎢ ⎥
(
⎢ 2 x ( ν ) .x ( ν ) − x ( ν ) 2
⎢⎣ 2 1 (2) ) ((x ) − 2x
( ν) 2
1
( ν)
1 .x (2ν ) ) ⎥
⎥⎦
(92)

+HQFHWKH1HZWRQ5DSKVRQPHWKRGIRUWKLVVLPSOHV\VWHPEHFRPHV

05/12/2016
52
Numerical Methods in Reservoir Simulation S I X

( )
−1
⎡ 1 + 2 x ( ν ) .e − x1( ν ) ( ν)
-2. e− x1 ⎤ ⎡x ( ν ) − 2 x ( ν ) .e − x1( ν ) − 2 ⎤
⎢ 2
⎥ ⎢ 1 2 ⎥
x ( ν + 1) = x ( ν ) − ⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎢ ⎥
(
⎢ 2 x ( ν ) .x ( ν ) − x ( ν ) 2
⎢⎣ 2 1 (2) ) ((x ) − 2x
( ν) 2
1
( ν)
1 .x (2ν ) ) ⎥
⎥⎦
⎢⎣x 2 .( x1 ) − x1 .(x 2 ) + 5⎥⎦
( ν) ( ν) 2 ( ν) ( ν) 2

(93)

[ ( )]
−1
ZKLFKZHFRXOGVROYHLIZHNQHZKRZWRLQYHUWWKH-DFRELDQPDWUL[WRÀQG J x ( ν )

7KLVLVDGHWDLOZKLFKZHGRQ·WQHHGWRNQRZIRUWKLVFRXUVHEXWLWFDQEHGRQH
,QGHHGIRUD[PDWUL[VXFKDVLQWKHDERYHFDVHLWLVTXLWHHDV\WRZRUNRXWWKH
inverse. The inverse of a simple 2 x 2 matrix A given by:

⎛ a b⎞
A=⎜ ⎟
⎝ c d⎠

LVZHOONQRZQWREH

1 ⎛ d − b⎞
A-1 = ⎜ ⎟
(ad − bc) ⎝ − c a ⎠

This can easily be proven by multiplying out there matrices and showing that A-1
.A = I7KHIDFWRU DGEF LVNQRZQDVWKHGHWHUPLQDQWRIWKHPDWUL[DQGLWPXVWEH
non-zero for A-1 to exist. Rather than using equation above to write out the analytical
[ ]
form of the J( x ( ν ) ) PDWUL[ZHÀUVWVLPSO\QXPHULFDOO\HYDOXDWHWKHPDWUL[ J at a
[]
−1
given iteration and apply equation above to get J . This is done in the spreadsheet
Chap6Ex5.xls where results are shown.

[J(x )]
−1
(k)
(94)

which allows us to apply the Newton-Raphson method directly to our simple example.
The results are shown in Table 4.

Institute of Petroleum Engineering, Heriot-Watt University 53


54
05/12/2016
Iteration
counter
ν x1(n) x2(n) F1(x(n)) F2(x(n)) ∂F1(x(n))/∂x1 ∂F1(x(n))/∂x2 ∂F2(x(n))/∂x1 ∂F2(x(n))/∂x2 Determinant
First Guess 0 1 1 -1.735758882 5 1.735758882 -0.735758882 1 -1 -1
1 6.414553294 11.41455329 4.377169462 -361.0963022 1.037383832 -0.003275102 16.14649396 -105.2920269 -0.009159576
Petroleum Engineering

2 2.182246194 7.336056224 -1.472590594 -77.50776106 2.654836787 -0.225575805 -21.79955938 -27.25596309 -0.012940363


3 2.475384221 4.257902625 -0.241056089 -13.7876459 1.71644031 -0.168261319 2.950155178 -14.9523629 -0.039732297
4 2.526417601 3.345866876 -0.0085524 -1.926851401 1.534970002 -0.159889805 5.711288783 -10.52332804 -0.06561759
5 2.512107443 3.15499752 0.00038482 -0.095349223 1.511722623 -0.162194303 5.897376155 -9.5407017 -0.074259041
6 2.510686381 3.144125179 1.99079E-06 -0.000310299 1.51068439 -0.162424955 5.902301392 -9.484278431 -0.074799517
7 2.510681199 3.144089237 2.33961E-11 -3.39494E-09 1.510681199 -0.162425797 5.902314339 -9.484091387 -0.074801307
8 2.510681199 3.144089236 0 0 1.510681199 -0.162425797 5.902314339 -9.484091384 -0.074801307
9 2.510681199 3.144089236 0 0 1.510681199 -0.162425797 5.902314339 -9.484091384 -0.074801307
Reservoir Simulation
Numerical Methods in Reservoir Simulation S I X

6.3 Newton’s Method Applied to the Non-linear Equations of Two-


Phase Flow
:HQRZUHWXUQWRWKHGLVFUHWLVHGHTXDWLRQVRIWZRSKDVHÁRZZKLFKZHQRWHGDWWKH
WLPHIRUPHGDVHWRIQRQOLQHDUHTXDWLRQV7KHVLPSOLÀHGIRUPRIWKHVHHTXDWLRQV
is as follows (see Section 4.1):

Pressure (equation 50):

(λ (S ))
T
n +1
o
i −1 / 2
P n +1
(
⎡ λ (Son +1 )
−⎢
T ) i −1 / 2
+
(λ (S )) T
n +1
o
i +1 / 2
⎤ (
λ (S n + 1 )
⎥ P n +1 + T o
) i +1 / 2
Pin++11 = 0
i −1
∆x 2
⎢ ∆x 2 ∆x 2
⎥ i ∆x 2
⎣ ⎦

Saturation (Form B - equation 54):

∆t ⎪⎢ λ o ( So )
⎧⎡ n +1
( ) (
⎤ ⎡ λ ( Son +1 ) ) ⎤⎫

Sn +1
oi −S − ⎨
n

φ ⎪⎢
oi
∆x 2
i +1 / 2
(P n +1
i +1 − Pi n +1
)⎥⎥ − ⎢⎢ o ∆x 2 i −1 / 2
(P
i
n +1
− Pi n−1+1 )⎥ ⎬ = 0
⎥⎪
⎩⎣ ⎦ ⎣ ⎦⎭

n +1
*LYHQWKDWWKHXQNQRZQVWKDWZHDUHWU\LQJWRÀQGDUH Pi , Sin +1 i = 1,2, NX. 
then we can write the above equations in general form as:

FP , i (Sn +1 , P n +1 ) = 0
FS, i (Sn +1 , P n +1 ) = 0 (95)

(
ZKHUHWKHWZRQRQOLQHDUHTXDWLRQVFP , i Sn +1 , P n +1 and FS, i Sn +1 , P n +1 DULVHIURP ) ( )
WKH SUHVVXUH 3  DQG VDWXUDWLRQ 6  HTXDWLRQV UHVSHFWLYHO\ DV JLYHQ DERYH  7KH
YHFWRUVRIXQNQRZQVSn +1 and P n +1 DUHJLYHQE\

⎡S1n +1 ⎤ ⎡P1n +1 ⎤
⎢ n +1 ⎥ ⎢ n +1 ⎥
⎢S2 ⎥ ⎢P2 ⎥
⎢ n +1 ⎥ ⎢ n +1 ⎥
⎢S3 ⎥ ⎢P3 ⎥
⎢... ⎥ ⎢... ⎥
⎢ ⎥ ⎢ ⎥
⎢... ⎥ ⎢... ⎥
⎢Sn +1 ⎥ ⎢ P n +1 ⎥
Sn +1 = ⎢ i −1 ⎥ and P n +1 = ⎢ i −1 ⎥ (96)
⎢Sin +1 ⎥ ⎢Pin +1 ⎥
⎢ n +1 ⎥ ⎢ n +1 ⎥
⎢Si +1 ⎥ ⎢Pi +1 ⎥
⎢ ⎥ ⎢ ⎥
⎢... ⎥ ⎢... ⎥
⎢... ⎥ ⎢... ⎥
⎢ ⎥ ⎢ ⎥
⎢... ⎥ ⎢... ⎥
⎢Sn +1 ⎥ ⎢ P n +1 ⎥
⎣ NX ⎦ ⎣ NX ⎦

Institute of Petroleum Engineering, Heriot-Watt University 55


Petroleum Engineering Reservoir Simulation

( ) ( )
+RZHYHUWKHJLYHQFP , i Sn +1 , P n +1 and FS, i Sn +1 , P n +1 DWJULGEORFNLRQO\GHSHQG

on the quantities Sin−+11 , Sin +1 , Sin++11 and Pin−+11 , Pin +1 , Pin++11 rather than on all of the

RWKHUVDWXUDWLRQVDQGSUHVVXUHVLQWKHV\VWHPVLQFHWKHVHDUHWKHQHDUHVWQHLJKERXUV
coupled together in the equations above.

:HPD\DOVRZULWHRQHWRWDOXQNQRZVYHFWRUXn+1 using a combination of the saturation


and pressure vectors as follows:

⎛ S1 n +1 ⎞
⎜ n +1 ⎟
⎜ P1 ⎟
⎜ S n +1 ⎟
⎜ 2 ⎟
⎜ P2 n +1 ⎟
⎜ ⎟
X n +1 = ⎜ ⎟
⎜ S n +1 ⎟
⎜ i ⎟
⎜ Pi n +1 ⎟
⎜ ⎟
⎜ ⎟
⎜ S n +1 ⎟
⎜ NX ⎟
⎜ n +1 ⎟
⎝ PNX ⎠

and the equation to be solved is then F(Xn+1)=0

The saturations and pressures are coupled together to their nearest neighbours through
the discretisation equations (50 and 54 above). The general form of the solution using
WKH1HZWRQLWHUDWLRQLVWKHQWRWDNHDVWDUWLQJJXHVV LWHUDWLRQi=0) Xn+1(0) and then
apply the formulation as above to obtain:

[ ]
−1
X n +1 ( ν +1) = X n +1( ν ) + J( X )( ν ) .F( X ( ν ) )

It is rather more complex to construct the Jacobian matrix J ( X ) of derivatives but


[]
−1
it can be done. We also need to invert this matrice to obtain J in order to apply
WKH DERYH DOJRULWKP +RZHYHU LQ SUDFWLFH WKHUH DUH YDULRXV PHWKRGV WKDW WU\ WR
[]
−1
construct the J PDWUL[PRUHGLUHFWO\RIWHQLQDQDSSUR[LPDWHPDQQHU1RWHWKDW
the Jacobian matrix is very sparse since there are just nearest neighbour interaction
DVZDVWKHFDVHIRUWKHPDWULFHVDVVRFLDWHGZLWKVLQJOHSKDVHÁRZGLVFXVVHGHDUOLHU
in this Chapter). A consequence of this is that the inverse matrix is also quite sparse
and there are many numerical techniques available to solve such problems.

,QWKLVFRXUVHZHZLOOQRWJLYHDQ\PRUHGHWDLORQWKHVROXWLRQRIWKHQRQOLQHDU
equations which arise in reservoir simulation.

05/12/2016
56
Numerical Methods in Reservoir Simulation S I X

7 NUMERICAL DISPERSION - A MATHEMATICAL APPROACH

7.1 Introduction to the Problem


,Q&KDSWHUZHGLVFXVVHGWKHSK\VLFDOLGHDRInumerical dispersionZKLFKLVDOVR
sometimes referred to as numerical diffusion. Numerical dispersion is essentially
WKH DUWLÀFLDO VSUHDGLQJ RU ´GLIIXVLRQµ RI D IURQW  HJ D ZDWHUIURQW LQ D ZDWHURLO
displacement - due to the coarse grid used in the simulation. It is a numerical effect
DQGLWFDQEHUHGXFHGE\WDNLQJDÀQHUJULG:HQRWHWKDWLQUHDOUHVHUYRLUVWKHUHDUH
some real dispersive physical mechanisms which result in the spreading of fronts.
These arise due to the effects of capillary pressure and also from the interaction of
WKHÁXLGÁRZZLWKVPDOOVFDOH FPP SHUPHDELOLW\KHWHURJHQHLW\RIWKHUHVHUYRLU
URFN,QGHHGWKHUHDUHDOVRVRPHTXLWHFRPSOH[LQWHUDFWLRQVEHWZHHQWKHFDSLOODU\
forces and the small scale heterogeneity that also lead to types of physical spreading
LQWKHUHVHUYRLU,QDQLGHDOFDOFXODWLRQZHZRXOGWDNHDVXIÀFLHQWO\ÀQHJULGWKDW
the level of physical (i.e. real) spreading or diffusion was correctly represented by
our grid; i.e. the numerical diffusion would be less that the physical diffusion. This
LVDOPRVWQHYHUSRVVLEOHLQDÀHOGVFDOHVLPXODWLRQDOWKRXJKLWFDQEHDFKLHYHGLQ
PRGHOOLQJ ODERUDWRU\ VFDOH H[SHULPHQWV RQ ÁRZV WKURXJK VPDOO URFN VDPSOHV RU
EHDGSDFNV)RUVXFKDÀQHVFDOHVLPXODWLRQWKHOHYHORIQXPHULFDOGLIIXVLRQFDQ
realistically be made much less than that from physical sources.

,QWKLVVHFWLRQZHUHWXUQWRWKHLVVXHRIQXPHULFDOGLVSHUVLRQDWHUPZKLFKZHZLOO
QRZXVHLQWHUFKDQJHDEO\ZLWK´QXPHULFDOGLIIXVLRQµ,QGHHG´GLIIXVLRQµLVRIWHQ
UHIHUUHGWRDVTXLWHDVSHFLÀFSK\VLFDOHIIHFWZKLFKLVGHVFULEHGE\FHUWDLQZHOONQRZQ
HTXDWLRQVZKLFKDUHQRWVXUSULVLQJO\NQRZQDVGLIIXVLRQHTXDWLRQV)RUH[DPSOH
WKHVLPSOLÀHGSUHVVXUHHTXDWLRQGHULYHGLQ&KDSWHUHTXDWLRQLVDQH[DPSOHRI
a diffusion equation. This equation has the form:

⎛ ∂P ⎞ ⎛ ∂2 P ⎞
⎜ ⎟ = Dh ⎜ 2 ⎟ (97)
⎝ ∂t ⎠ ⎝ ∂x ⎠

where Dh is the hydraulic diffusivity (Dh N Ff .q +)) and this is a standard form
of the classical diffusion equation. We now consider how the effects of a grid can
OHDGWR´GLIIXVLRQOLNHµWHUPVZKHQZHWU\WRVROYHWKHÁRZHTXDWLRQVQXPHULFDOO\
⎛ ∂2 P ⎞
,QWKHDERYHHTXDWLRQVLWLVVSHFLÀFDOO\WKH⎜ 2 ⎟ WHUPWKDWLVWKH´GLVSHUVLYHµRU
´GLIIXVLYHµSDUW ⎝ ∂x ⎠

7.2 Mathematical Derivation of Numerical Dispersion


,QRUGHUWRVKRZPDWKHPDWLFDOO\KRZD´GLIIXVLYHµWHUPDULVHVZKHQZHVROYHFHUWDLQ
WUDQVSRUWHTXDWLRQVQXPHULFDOO\ZHXVHDVLPSOHIRUPRIWKHWZRSKDVHVDWXUDWLRQ
HTXDWLRQ,Q'WKHWUDQVSRUWHTXDWLRQIRUDVLPSOHZDWHUIURQW ZLWK3F DQG
]HURJUDYLW\ LVWKHZHOONQRZQIUDFWLRQDOÁRZHTXDWLRQ VHH&KDSWHU DVIROORZV

⎛ ∂S ⎞ ⎛ ∂f ⎞
φ ⎜ w ⎟ = − v⎜ w ⎟ (98)
⎝ ∂t ⎠ ⎝ ∂x ⎠

Institute of Petroleum Engineering, Heriot-Watt University 57


Petroleum Engineering Reservoir Simulation

where Sw is the water saturation and fw (Sw  LV WKH IUDFWLRQDO ÁRZ RI ZDWHU
⎛ ⎛ qw ⎞⎞
⎜ fw (Sw ) = ⎜⎝ q + q ⎟⎠ ⎟ ZKLFKLVDIXQFWLRQRQO\RIZDWHUVDWXUDWLRQ6w. We can
⎝ w o ⎠

differentiate fw (Sw) by the chain rule to obtain:

⎛ ∂S ⎞ ⎛ ∂f ⎞ ⎛ ∂f ⎞ ⎛ ∂S ⎞
φ ⎜ w ⎟ = − v⎜ w ⎟ = − v⎜ w ⎟ ⎜ w ⎟ (99)
⎝ ∂t ⎠ ⎝ ∂x ⎠ ⎝ ∂Sw ⎠ ⎝ ∂x ⎠

⎛ ∂fw ⎞
where the term − v⎜ ⎟ LVDQRQOLQHDUWHUPJLYLQJWKHZDWHUYHORFLW\Yw (Sw 
⎝ ∂Sw ⎠
which is also a function of water saturation: that is:

⎛ ∂f ⎞
v w (S w ) = − v⎜ w ⎟ (100)
⎝ ∂Sw ⎠

7RVLPSOLI\WKHSUREOHPHYHQIXUWKHUIRURXUSXUSRVHVKHUHZHWDNHDVWUDLJKWOLQH
⎛ ∂fw ⎞
IUDFWLRQDOÁRZIw (Sw ZKLFKPHDQVWKDW⎜ ⎟ LVDFRQVWDQWDQGKHQFHVRLV
⎝ ∂Sw ⎠
WKHZDWHUYHORFLW\9w+HQFHWKHVLPSOH'WUDQVSRUWHTXDWLRQIRUDFRQYHFWHG
waterfront is:

⎛ ∂Sw ⎞ ⎛ ∂S ⎞
⎜ ⎟ = − vw ⎜ w ⎟ (101)
⎝ ∂t ⎠ ⎝ ∂x ⎠

ZKHUHDVQRWHGDERYHYw is now constant. This equation describes the physical


situation illustrated schematically in Figure 14.

t1 t2 Governing equation
1 ,Sw ,Sw
= - Vw
,t ,x
Sw Vw = constant
Water Vw Oil
0 x2 - x1
x1 x2 Vw =
x t2 - t1

Figure 14 The advance of a sharp saturation front governed by the transport equation with
a constant velocity vw.

6WDUWLQJIURPWKHWUDQVSRUWHTXDWLRQDERYHZHFDQHDVLO\DSSO\ÀQLWHGLIIHUHQFHV
using our familiar notation (Chapter 5) to obtain:

⎛ Sn +1 − Swi
n
⎞ ⎛ Swi − Swi −1 ⎞
φ⎜ wi ⎟ = − vw ⎜ ⎟ + Error terms (102)
⎝ ∆t ⎠ ⎝ ∆x ⎠

05/12/2016
58
Numerical Methods in Reservoir Simulation S I X

ZKHUHZHKDYHXVHGWKHEDFNZDUGGLIIHUHQFH VRPHWLPHVUHIHUUHGWRDVWKHXSVWUHDP
∂Sw ⎞
GLIIHUHQFH WRGLVFUHWLVHWKHVSDWLDOWHUP⎛⎜ ⎟ 1RWHWKDWZHKDYHQRW\HWVSHFLÀHG
⎝ ∂x ⎠
WKHWLPHOHYHORIWKHVSDWLDOWHUPV,IZHWDNHWKHVHDWWKHQWLPHOHYHO NQRZQ WKHQ
LWZRXOGEHDQH[SOLFLWVFKHPHDQGLIZHWDNHWKHPDWWKHQWLPHOHYHO XQNQRZQ 
LWZRXOGEHDQLPSOLFLWVFKHPH,WGRHVQRWPDWWHUIRURXUFXUUHQWSXUSRVHVKHUHVLQFH
ZHDUHSULQFLSDOO\LQWHUHVWHGLQWKH´(UURUWHUPVµZKLFKDUHLQGLFDWHGLQHTXDWLRQ
7RGHWHUPLQHZKDWWKHVHWHUPVORRNOLNHZHQHHGWRJREDFNWRWKHRULJLQDOÀQLWH
GLIIHUHQFHVEDVHGRQ7D\ORUH[SDQVLRQRIWKHXQGHUO\LQJIXQFWLRQ6w [W LQWKLVFDVH

We can expand Sw [W HLWKHULQVSDFH [ RULQWLPH W DVIROORZV

⎛ ∂S ⎞ δx 2 ⎛ ∂ 2S ⎞
SPACE Sw ( x, t ) = Sw ( x 0 ) + δx.⎜ w ⎟ + ⎜ 2 ⎟ + higher order terms
w

WÀ[HG  ⎝ ∂x ⎠ 2 ⎝ ∂x ⎠ 

⎛ ∂S ⎞ δt 2 ⎛ ∂ 2S ⎞
TIME Sw ( x, t ) = Sw ( t 0 ) + δt.⎜ w ⎟ + ⎜ 2 ⎟ + higher order terms
w

[À[HG 
⎝ ∂t ⎠ 2 ⎝ ∂t ⎠ 

:H FDQ UHDUUDQJH HDFK RI WKH DERYH HTXDWLRQV  DQG  WR REWDLQ WKH ÀQLWH
∂S ⎞ ⎛ ∂S ⎞
difference approximations for the ⎛⎜ ⎟ and ⎜ ⎟ terms with the leading error
⎝ ∂x ⎠ ⎝ ∂t ⎠
terms as follows (now ignoring the higher order terms):

⎛ ∂S ⎞ ⎛ S(x, t ) − S( x 0 ) ⎞ δx ⎛ ∂ S ⎞
2
SPACE ⎜ ⎟ ≈⎜ −
⎟ 2 ⎜⎝ ∂ 2 ⎟⎠ (105)
⎝ ∂x ⎠ ⎝ δx ⎠ x

⎛ ∂S ⎞ ⎛ S(x, t ) − S( t 0 ) ⎞ δt ⎛ ∂ S ⎞
2
TIME ⎜ ⎟ ≈⎜ − ⎜
⎟ 2 ⎝ ∂ 2 ⎟⎠ (106)
⎝ ∂t ⎠ ⎝ δt ⎠ t

7RUHWXUQWRRXUXVXDOQRWDWLRQZHPDNHWKHLGHQWLWLHV

S( x, t ) ⇔ Sin +1
S( x 0 ) ⇔ Si −1
S( t 0 ) ⇔ Sin
δx ⇔ ∆x
δt ⇔ ∆t (107)

Equation 105 now becomes:

⎛ ∂S ⎞ ⎛ Si − Si −1 ⎞ ∆x ⎛ ∂ S ⎞
2
⎜ ⎟ ≈⎜ −
⎝ ∂x ⎠ ⎝ ∆x ⎟⎠ 2 ⎜⎝ ∂x 2 ⎟⎠
(108)

Institute of Petroleum Engineering, Heriot-Watt University 59


Petroleum Engineering Reservoir Simulation

and equation 106 becomes:


n +1
⎛ ∂S ⎞ ⎛ Si − Si ⎞ ∆t ⎛ ∂ S ⎞
n 2
⎜ ⎟ ⎜ ≈ −
⎝ ∂t ⎠ ⎝ ∆t ⎟⎠ 2 ⎜⎝ ∂t 2 ⎟⎠
(109)

:H QRZ VXEVWLWXWH WKH DERYH ÀQLWH GLIIHUHQFH DSSUR[LPDWLRQV LQWR WKH JRYHUQLQJ
equation 102 with their leading error terms as follows:

⎛ Sn +1 − Sin ⎞ ∆t ⎛ ∂ 2S ⎞ ⎛ S i − S i − 1 ⎞ v w . ∆x ⎛ ∂ 2 S ⎞
φ⎜ i ⎟ − ⎜ ⎟ ≈ − v w⎜ ⎟+ ⎜ ⎟ (110)
⎝ ∆t ⎠ 2 ⎝ ∂t 2 ⎠ ⎝ ∆x ⎠ 2 ⎝ ∂x 2 ⎠

Collecting the error terms together on the RHS gives:

⎛ Sn +1 − Sin ⎞ ⎛ Si − Si −1 ⎞ v w .∆x ⎛ ∂ 2S ⎞ ∆t ⎛ ∂ 2S ⎞
φ⎜ i ⎟ ≈ − v w⎜ ⎟+ ⎜ ⎟+ ⎜ ⎟ (111)
⎝ ∆t ⎠ ⎝ ∆x ⎠ 2 ⎝ ∂x 2 ⎠ 2 ⎝ ∂t 2 ⎠
Error term
7KHHUURUWHUPLQWKHÀQLWHGLIIHUHQFHVFKHPHLVQRZFOHDUDQGLVVKRZQLQHTXDWLRQ
+RZHYHULWVWLOOQHHGVVRPHVLPSOLI\LQJVLQFHLWLVDVWUDQJHPL[HGWHUPZLWK
⎛ ∂ 2S ⎞ ⎛ ∂ 2S ⎞ ⎛ ∂ 2S ⎞
both ⎜ ⎟ and ⎜ 2⎟ terms in it. We now want to eliminate the ⎜ 2 ⎟ term
⎝ ∂x 2 ⎠ ⎝ ∂t ⎠ ⎝ ∂t ⎠
and this is done by using the original governing equation.

⎛ ∂ 2S ⎞ ⎛ ∂S ⎞ ⎛ ∂S ⎞
To obtain ⎜ 2 ⎟
ÀUVWQRWHIURPWKHRULJLQDOHTXDWLRQWKDW⎜ w ⎟ = − v w ⎜ w ⎟
⎝ ∂t ⎠ ⎝ ∂t ⎠ ⎝ ∂x ⎠
⎛ ∂S ⎞
and we can then differentiate ⎜ w ⎟ with respect to t as follows:
⎝ ∂t ⎠

∂ ⎛ ∂Sw ⎞ ⎛ ∂ 2Sw ⎞ ∂ ⎛ ∂S ⎞
⎜ ⎟ = ⎜ 2 ⎟ = − vw ⎜ w ⎟ (112)
∂t ⎝ ∂t ⎠ ⎝ ∂t ⎠ ∂t ⎝ ∂x ⎠

7KXVZHFDQUHDUUDQJHWKH5+6RIHTXDWLRQDVIROORZV

∂ ⎛ ∂Sw ⎞ ∂ ⎛ ∂S ⎞
− vw ⎜ ⎟ = − vw ⎜ w ⎟ (113)

∂t ∂x ⎠ ∂x ⎝ ∂t ⎠

We now return again to the governing equation (equation 101) and use it for ⎜ w ⎟
⎛ ∂S ⎞
in equation 113 to obtain: ⎝ ∂t ⎠

∂ ⎛ ∂Sw ⎞ ∂ ⎛ ∂S ⎞ 2 ⎛∂ S ⎞
2
− vw ⎜ ⎟ = − v w ⎜ − v w w ⎟ = v w ⎜ 2w ⎟ (114)
∂x ⎝ ∂t ⎠ ∂x ⎝ ∂x ⎠ ⎝ ∂x ⎠
and hence:

⎛ ∂ 2 Sw ⎞ 2 ⎛ ∂ Sw ⎞
2

⎜ 2 ⎟ = v w⎜ ⎟ (115)
⎝ ∂t ⎠ ⎝ ∂x 2 ⎠

05/12/2016
60
Numerical Methods in Reservoir Simulation S I X

We now substitute this expression into the error term in equation 111 above to obtain
the following:

v w .∆x ⎛ ∂ 2S ⎞ ∆t ⎛ ∂ 2S ⎞ v w .∆x ⎛ ∂ 2S ⎞ v 2w ∆t ⎛ ∂ 2S ⎞
⎜ ⎟+ ⎜ ⎟= ⎜ ⎟+ ⎜ ⎟
2 ⎝ ∂x 2 ⎠ 2 ⎝ ∂t 2 ⎠ 2 ⎝ ∂x 2 ⎠ 2 ⎝ ∂x 2 ⎠

⎛ v .∆x v 2w ∆t ⎞ ⎛ ∂ 2S ⎞
=⎜ w + ⎟⎜ ⎟ (116)
⎝ 2 2 ⎠ ⎝ ∂x 2 ⎠

7KHÀQLWHGLIIHUHQFHHTXDWLRQZLWKLWVHUURUWHUPLQHTXDWLRQQRZEHFRPHV

⎛ Sin +1 − Sin ⎞ ⎛ Si − Si −1 ⎞ ⎛ v w .∆x v 2w ∆t ⎞ ⎛ ∂ 2S ⎞


⎜ ⎟ ≈ − v w⎜ ⎟ +⎜ + ⎟⎜ ⎟ (117)
⎝ ∆t ⎠ ⎝ ∆x ⎠ ⎝ 2 2 ⎠ ⎝ ∂x 2 ⎠

,QWKLVHTXDWLRQZHQRZVHHWKDWWKHIRUPRIWKHHUURUWHUPLVH[DFWO\OLNHD´GLIIXVLYHµ
term i.e. it multiplies a (,2Sw/,x2) term. Hence we identify the level of numerical
GLVSHUVLRQRUGLIIXVLRQ'numDULVLQJIURPRXUVLPSOHÀQLWHGLIIHUHQFHVFKHPHDV

⎛ v .∆x v 2w ∆t ⎞ ⎛ ∆x v w ∆t ⎞
D num = ⎜ w + ⎟ = v w .⎜ + ⎟ (118)
⎝ 2 2 ⎠ ⎝ 2 2 ⎠

⎛ ∆x v w ∆t ⎞
If D num = v w .⎜ + ⎟ ZHFDQWDNHVXFKDVPDOOWLPHVWHSWKDW v w Δt << Δx
For this case: ⎝ 2 2 ⎠

v w .∆x
D num ≈ (119)
2
We can now solve two problems as follows

L )LUVWO\ZHPD\DSSO\DQH[SOLFLWÀQLWHGLIIHUHQFHPHWKRGWRREWDLQDQ
accurate solution of the following convection-dispersion equation.

⎛ ∂Sw ⎞ ⎛ ∂S ⎞ ⎛ ∂ 2S ⎞
⎜ ⎟ = − v w ⎜ w ⎟ + D.⎜ 2w ⎟ (120)
⎝ ∂t ⎠ ⎝ ∂x ⎠ ⎝ ∂x ⎠

7KDWLVZKHUHWKHQXPHULFDOGLVSHUVLRQLVPXFKOHVVWKDQWKHSK\VLFDOGLVSHUVLRQGXH
WRWKHH[SOLFLW'WHUP,IWKLVVROXWLRQLVFRQYHUJHG LHGRHVQRWFKDQJHRQUHÀQLQJ
6x and 6W WKHQZHFDQSORWWKLVDWDVXLWDEOHWLPHW1DVVKRZQLQ)LJXUH

Institute of Petroleum Engineering, Heriot-Watt University 61


Petroleum Engineering Reservoir Simulation

Governing equation:
2
1 ,Sw ,Sw , Sw
= - Vw +D
,t ,x ,x2
Sw Vw = constant

0
x

Figure 15 'LVSHUVHGIURQWDOGLVSODFHPHQWZLWKDNQRZQDQGFRQYHUJHGOHYHORIGLVSHUVLRQ

LL  1RZ WDNH RQO\ WKH H[SOLFLW ÀQLWH GLIIHUHQFH DSSUR[LPDWLRQ WR WKH
FRQYHFWLRQHTXDWLRQRQO\WKDWLV

⎛ Sn +1 − Swi
n
⎞ ⎛ Swi
n
− Swi
n
−1 ⎞ which gives ‰ Sn +1 = Sn −
⎛ v w .∆t ⎞ n
φ⎜ wi ⎟ = − vw ⎜ ⎟ (Swi − Swi −1 )
n
⎟ ⎜
⎝ ∆x.φ ⎠
wi wi
⎝ ∆t ⎠ ⎝ ∆x ⎠
6ROYHWKLVZLWKDUHODWLYHO\FRDUVHUJULG6[EXWZLWKDÀQHWLPHVWHSWKXVSUHGLFWLQJ
Dnum to be ⎛ w
v .∆x ⎞ . Choose this level of dispersion to deliberately match that in
⎝ 2 ⎠
part (i) above i.e. choose 6x such that Dnum '3ORWRXWDVDWXUDWLRQSURÀOHOLNH
that in Figure 15 at the same time t1 and compare these.

8 CLOSING REMARKS

,QWKLV&KDSWHUZHKDYHLQWURGXFHGWKHVWXGHQWWRÀQLWHGLIIHUHQFHDSSUR[LPDWLRQVRI
WKHSDUWLDOGLIIHUHQWLDOHTXDWLRQV 3'(V WKDWGHVFULEHERWKVLQJOHDQGWZRSKDVHÁRZ
through porous media. These discretised equations have led to systems of either linear
or non-linear equations which are then solved numerically. Methods for solving these
equations have been discussed in principle and some idea has been given of how these
DUHDSSOLHGLQSUDFWLFDOUHVHUYRLUVLPXODWLRQ$WWKHHQGRIWKHXQLWVRPHGLVFXVVLRQZDV
SUHVHQWHGRQJULGWRJULGÁRZVDQGKRZWKHVHLQWHUJULGEORFNSURSHUWLHVDUHDYHUDJHG
A more mathematical description of numerical dispersion was also given.

APPENDIX A: Some useful Matrix Theorems

This lists (without proof) some useful theorems from matrix algebra which underpin
PXFKRIWKHSUDFWLFDODSSOLFDWLRQZRUNZKLFKZHKDYHGHVFULEHGLQWKLVVHFWLRQ

The central problem which we are interested in is:

A.x = b where A is an NxN square matrix

1. If A.x  b DFWXDOO\KDVDVROXWLRQWKHQA is said to be non-singular or


LQYHUWLEOH DQG WKH IROORZLQJ ÀYH FRQGLWLRQV DSSO\ DQG DUH HTXLYDOHQW
LHLIRQHRIWKHPKROGWKH\DOOKROG 

05/12/2016
62
Numerical Methods in Reservoir Simulation S I X

(i) A −1 exists where A −1 .A = I ; I is the identity matrix which has 1s


on the diagonal and zeros elsewhere. I LV OLNH WKH QXPEHU ´µ LQ WKDW
I.A = A.I = A .

(ii) det( A ) ≠ 0; the determinant of the matrix is non-zero. This is a number


IRXQGE\´PXOWLSO\LQJRXWµWKHPDWUL[LQDVSHFLÀFZD\

LLL  7KHUH LV QR QRQ]HUR YHFWRU [ VXFK WKDW A.x = 0 ,Q RWKHU ZRUGV LI
A.x = 0WKHQWKHYHFWRUx must be zero - have 0s for all its elements.

(iv) The rows of A are linearly independent. And ..

(v) the columns of A are linearly independent. Where (iv) and (v) say that
ZHFDQQRWJHWRQHRIWKHURZVRUFROXPQVE\PDNLQJVRPHFRPELQDWLRQ
of the existing ones.

2. A matrix A which is square and symmetric


(A = A T , where A T is the transpose of A; i.e. a ij = a ji ) is said to be positive
GHÀQLWHLIx T .A.x > 0

3. If the matrix ALVSRVLWLYHGHÀQLWHWKHQLWFDQEHGHFRPSRVHGLQH[DFWO\


one way into a product: A = G.G T

such that matrix G is lower triangular and has positive entries on the main diagonal.
7KLVLVNQRZQDV&KROHVN\GHFRPSRVLWLRQ

SOLUTIONS TO EXERCISES

EXERCISE 1.

$SSO\ÀQLWHGLIIHUHQFHVWRWKHVROXWLRQRIWKHHTXDWLRQ

⎛ dy ⎞ = 2.y 2 + 4
⎝ dt ⎠

ZKHUHDWW \ W   7DNHWLPHVWHSVRI6t = 0.001 (arbitrary time units) and


step the solution forward to t = 0.25. Use the notation yn+1IRUWKH XQNQRZQ \DW
n+1 time level and ynIRUWKH NQRZQ \YDOXHDWWKHFXUUHQWQWLPHOHYHO

Plot the numerically calculated y as a function of t between t = 0 and t = 0.25 and


SORWLWDJDLQVWWKHDQDO\WLFDOYDOXH GRWKHLQWHJUDOWRÀQGWKLV 

$QVZHULVJLYHQEHORZZKHUHWKHZRUNLQJLVVKRZQLQVSUHDGVKHHW&+$3([
[OV7KLVJLYHVWKHÀQLWHGLIIHUHQFHIRUPXODDVSUHDGVKHHWLPSOHPHQWLQJLWDQGWKH
analytical solution for comparison.

Institute of Petroleum Engineering, Heriot-Watt University 63


Petroleum Engineering Reservoir Simulation

SOLUTION 1.

Discretise the equation using the suggested notation as follows:

⎛ y n +1 − y n ⎞
⎟ = 2.( y ) + 4
n 2

⎝ ∆t ⎠

which is rearranged to the explicit formula:

y n +1 = y n + ∆t(2.( y n )2 + 4)

which can be set up quite easily on a spreadsheet.

7RÀQGWKHDQDO\WLFDODQVZHU\RXPLJKWQHHGWKHVWDQGDUGIRUPRIWKHIROORZLQJ
integral:

= tan −1 ⎛ ⎞
du 1 u
∫u 2
+α 2
α ⎝ α⎠

Using this standard form gives:

1 dy 1 ⎛ y ⎞

2 y + ( 2)
2 2
=
2 2
tan −1
⎝ 2⎠ ∫
= dt = t + C

where C is the constant of integration and we identify α = 2 DERYH7KHUHIRUH


this becomes:

1 ⎛ y ⎞
tan −1 = t +C
2 2 ⎝ 2⎠

which easily rearranges to:

[
y( t ) = 2 tan 2 2 ( t + C) ]
:HQRZÀQG&IURPWKHLQLWLDOFRQGLWLRQVVLQFH\ W   LWLVHDV\WRVHHWKDW

05/12/2016
64
Numerical Methods in Reservoir Simulation S I X

1 ⎡ 1 ⎤
C= tan −1 ⎢ ⎥ = 0.2176049
2 2 ⎣ 2⎦

which is then used in the analytic solution for y(t) above.

This is implemented in the spreadsheet CHAP6Ex1.xls1RWHWKDWDWW!ERWK


the analytical and numerical solutions go a bit strange (very large and they start to
disagree) since the tan function has a singularity y(t) A '.

EXERCISE 2.

Fill in the above table using the algorithm:

∆t n
2 ( i +1
Pin +1 = Pin + P + Pin−1 − 2 Pin )
∆x

+LQWPDNHXSDVSUHDGVKHHWDVDERYHDQGVHWWKHÀUVWXQNQRZQEORFN VKRZQJUH\
shaded in table above) with the above formula. Copy this and paste it into all of the
FHOOVLQWKHHQWLUHXQNQRZQDUHD VXUURXQGHGE\UHGERUGHUDERYH 

SOLUTION 2.

,I\RXJHWVWXFNORRNDWVSUHDGVKHHWCHAP6Ex2.xlsRQWKHGLVN

EXERCISE 3.

Experiment with the spreadsheet in CHAP6Ex2.xls to examine the effects of the


three quantities above - 6W6x (or NX) and the solution as t A'.

EXERCISE 4.

Solve the following simple example of an upper triangular matrix:

4 x1 - 1x 2 − 2 x 3 + 1x 4 + 1x 5 = 5
2 x 2 − 2 x 3 + 1x 4 + 2 x 5 = 12
3x 3 + 4 x 4 + 1x 5 = 30
2 x 4 − 1x 5 = 3
3x 5 = 15

SOLUTION 4.

x1 = ..........; x 2 = ..........; x 3 = ..........; x 4 = ..........; x 5 = ..........

Institute of Petroleum Engineering, Heriot-Watt University 65


Petroleum Engineering Reservoir Simulation

EXERCISE 5.

ÀOOLQWKHWDEOHEHORZIRULWHUDWLRQVXVLQJDFDOFXODWRURUDVSUHDGVKHHW

POINT ITERATIVE SOLUTION OF LINEAR EQUATIONS

Iteration
counter x at iter. k
k x1 x2 x3 x4
First guess = 0 2.0 2.0 2.0 2.0
1
2
3
4
5
6
7
8
9
10

SOLUTION 5.

Answer - Exercise 5: see spreadsheet CHAP6Ex5.xls - Sheet 1

POINT ITERATIVE SOLUTION OF LINEAR EQUATIONS

Iteration
counter x at iter. ν
ν x1 x2 x3 x4
First guess = 0 2.0 2.0 2.0 2.0
1 4.309677 1.97619 3.6925 2.784615
2 4.008926 1.411795 3.498943 2.436331
3 3.993119 1.505683 3.497206 2.503112
4 4.000937 1.500783 3.500617 2.500584
5 3.999963 1.499755 3.499965 2.499832
6 3.999986 1.500026 3.499995 2.500017
7 4.000003 1.5 3.500002 2.500001
8 4 1.499999 3.5 2.5
Converged ⇒ 9 4 1.5 3.5 2.5
10 4 1.5 3.5 2.5

Note - converges fully at k = 9 iterations.

05/12/2016
66
Numerical Methods in Reservoir Simulation S I X

EXERCISE 6.

:KLFKLVEHVWPHWKRG LHWKDWUHTXLULQJWKHORZHVWDPRXQWRIFRPSXWDWLRQDOZRUN 
%$1'RU/625IRUWKHIROORZLQJSUREOHPV"

L 1; 1< 1iter = 50 (a small problem)

LL 1; 1< 1iter = 50

LLL 1; 1< 1iter = 70

LY 1; 1< 1iter = 150

NX NY Niter BAND LSOR, Comment


WB WLSOR
5 3 50
20 5 50
100 20 70
400 100 150

SOLUTION 6.

NX NY Niter BAND LSOR, Comment


WB WLSOR
5 3 50 135 750 For a very small problem like this, a
direct method is usually better,
although both would take very little
time even on a PC.
20 5 50 2500 5000 Again a direct method is somewhat
better for a small problem.
100 20 70 8x105 1.4x105 As the problemgrows in size,
iterative methods start to overtake
direct method.
400 100 150 4x108 6x106 For very large problems, iterative
methods virtually always win over
direct methods by more than an
order of magnitude.

Institute of Petroleum Engineering, Heriot-Watt University 67


Petroleum Engineering Reservoir Simulation

EXERCISE 7.

The linear equations which arise in reservoir simulation may be solved by a direct
solution method or an iterative solution method. Fill in the table below:

Direct solution method Iterative solution method

Give a very
brief description
of each method

Main advantages 1. 1.

2. 2.

Main 1. 1.
disadvantages

2. 2.

05/12/2016
68

You might also like