+ All Categories
Home > Documents > Finite Difference Approximation - Cairo...

Finite Difference Approximation - Cairo...

Date post: 31-Aug-2018
Category:
Upload: phamdang
View: 218 times
Download: 0 times
Share this document with a friend
33
Finite Difference Approximation 12/26/2017 1 Dr. Helmy Sayyouh Petroleum Engineering Cairo University
Transcript
Page 1: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

Finite Difference Approximation

12/26/2017 1

Dr. Helmy Sayyouh

Petroleum Engineering

Cairo University

Page 2: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

Introduction

• The most widely used numerical technique in reservoir simulation is the finite-difference approach.

• The governing equations, as well as the boundary conditions used for describing flow in porous media, have only first-order and second-order derivatives, and so we will limit our discussion to these.

12/26/2017 Dr. Helmy Sayyouh 2

2

P

x 2

1

P

t

Page 3: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

First-order derivative

• First-order derivatives appear in the governing equations on the right-hand side in the form of the time derivative (the accumulation term).

• In addition, first-order derivatives appear when the gradient is specified across a given boundary.

• To approximate the first-order derivatives, we use truncated Taylor series expansion.

12/26/2017 Dr. Helmy Sayyouh 3

Page 4: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

• The derivative is approximated at the point x (also designated as i) at which the value of pressure is Pi.

• The two neighboring points to the central point are x - Dx (also designated as i -1) and x + Dx (also designated as i - 1).

• Accordingly, at these two neighboring points, the pressure values are Pi - 1 and P i + 1, respectively.

12/26/2017 Dr. Helmy Sayyouh 4

Page 5: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

• In general, a Taylor series expansion for evaluating a function f (x) at x + Dx can be written

12/26/2017 Dr. Helmy Sayyouh 5

f x x f x xf

x

x f

x

x f

xx x x

2 2

2

3 3

32 3! !...

P P x

P

x

x P

x

x P

xi i

i i i

1

2 2

2

3 3

32 3

! !...

Using the notation of the previous Figure we can write the equation

Page 6: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

Forward-Difference Approximation:

• The forward-difference approximation to the first-order derivative at point uses the values of the function at points i and i +1.

12/26/2017 Dr. Helmy Sayyouh 6

P

x

P P

xO x

i

i

1

( )

The second term on the right-hand side of the Equation denotes the error in

the approximation and is read as “order of .” The magnitude of the error is

the same as the magnitude of . In practice, the error term is dropped in

writing the finite-difference analogues. Thus, we write:

P

x i

P

i 1 P

x

Page 7: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

12/26/2017 Dr. Helmy Sayyouh 7

The exact derivative of P at point is the slope of the tangent AB to the curve at

point O. Equation uses the slope of the secant OC to approximate this derivative.

As we can conclude from the figure, the accuracy of this approximation depends on

the shape of the curve, as well as the length of the interval between and in the limit

as point is moved progressively closer to the secant OC tends to obtain the same

shape as the tangent AB.

Page 8: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

• In reservoir simulation, we use the forward difference approximation.

• The two neighboring points in this case represent the old time level and the new time level .

• When this derivative is written at a point i in the spatial domain it represents the rate of change of pressure with time at point i. In other words,

12/26/2017 Dr. Helmy Sayyouh 8

P

t

i

P

i

n 1 P

i

n

t

Page 9: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

Backward-Difference Approximation:

• With the same strategy, but now using the neighboring point , we can obtain the backward-difference approximation to the first-order derivative from Equation using the (-) sign.

12/26/2017 Dr. Helmy Sayyouh 9

Page 10: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

Central-Difference Approximation:

The central-difference approximation to the first-order derivative at point i uses the two adjacent neighboring points.

12/26/2017 Dr. Helmy Sayyouh 10

P

x i

P

i 1 P

i 1

2 x

Note that the secant CE is almost parallel to the

desired tangent AB.

It is apparent from Figure that central-difference provides a more accurate

approximation to the first-order derivative than either the forward- or backward-

difference approximation does.

Page 11: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

Second-order derivative

• The left-hand-side of the flow equation is composed of second-order derivatives representing the flux terms. To approximate these second-order derivatives, we use central-difference approximation.

12/26/2017 Dr. Helmy Sayyouh 11

2 P

x 2

i

P

i 1 2 P

i P

i 1

( x ) 2

O x 2

2 P

x 2

i

P

i 1 2 P

i P

i 1

( x ) 2

OR

Page 12: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

Finite-difference schemes

• There are two principal groups of finite-difference schemes: explicit andimplicit.

• We can illustrate the governing concepts for these schemes using the classical diffusivity equation as it is written in one dimension:

12/26/2017 Dr. Helmy Sayyouh 12

2

P

x 2

1

P

t

Page 13: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

The explicit finite-difference analogue to the diffusivity Equation

is

12/26/2017 Dr. Helmy Sayyouh 13

P i 1

n 2 P

i

n P

i 1

n

( x ) 2

1

P i

n 1 P

i

n

t

Since pressures at the old time level are known at all locations, the only

unknown in Equation is the pressure at the new time level

P i

n 1

t

( x ) 2

P i 1

n 2

( x ) 2

t

P

i

n P

i 1

n

Page 14: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

The implicit finite difference analogue is:

collecting all the unknown terms on one side, we obtain the characteristic form of the implicit finite-difference scheme

12/26/2017 Dr. Helmy Sayyouh 14

P i 1

n 1 2 P

i

n 1 P

i 1

n 1

( x ) 2

1

P i

n 1 P

i

n

t

t

( x ) 2

P i 1

n 1 1

2 t

( x ) 2

P

i

n 1

t

( x ) 2

P i 1

n 1 P

i

n

Page 15: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

Flow equations in the finite-difference form

12/26/2017 Dr. Helmy Sayyouh 15

A x

k x

x B x

i , j , k

P i 1 , j , k

n 1 P

i , j , k

n 1

A x k

x

B x i , j , k

n

P i , j , k

n 1 P

i 1 , j , k

n 1

A y

k y

y

B y

i , j , k

P i , j 1 , k

n 1 P

i , j , k

n 1

A y

k y

B y i , j , k

n

P i , j , k

n 1 P

i , j 1 , k

n 1

A

z k

z

z B z

i , j , k

P i , j , k 1

n 1 P

i , j , k

n 1

A z k

z

B z i , j , k

n

P i , j , k

n 1 P

i , j , k 1

n 1

q

i , j , k

V

b c

5 . 615 t

i , j , k

P i , j , k

n 1 P

i , j , k

n

Page 16: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

The term Axkx/Dx is the constant part of the transmissibility group,

while the term μB could depend on the pressure. To calculate these

two terms at the interface, we must use averaging procedures. For

the constant part of the transmissibility, if we consider the two blocks

as being connected in series, it becomes necessary to use harmonic

averaging, such as

12/26/2017 Dr. Helmy Sayyouh 16

A x k

x

x i

1

2 , j , k

2 A x

A x

k x

k x

A x

k x

x i 1 , j , k A x

k x

x i , j , k

Page 17: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

• The second term (μB) is considered a weak function of pressure; that is, it exhibits weak non-linearity. We calculate this term at the arithmetic average of pressures at the two neighboring blocks:

12/26/2017 Dr. Helmy Sayyouh 17

Page 18: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

• Note that under multiphase flow conditions, a typical transmissibility term will include relative permeability to the fluid for which the flow equation is being written. In that case, the transmissibility group between the blocks i, j, k and i+1, j, k is

12/26/2017 Dr. Helmy Sayyouh 18

A x k

x k

rf

f B

f x

i 1 / 2 , j , k

Page 19: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

• This procedure is known as single-point upstream weighting,and can be summarized as

12/26/2017 Dr. Helmy Sayyouh 19

k r f

k r f

S f

if P i + 1, j, k

P i, j, k

k r f

S f

if P

i + 1, j, k P

i, j, k

Page 20: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

• A more accurate representation of the relative permeability at the interface is known as two-point upstream weighting,and is expressed as

12/26/2017 Dr. Helmy Sayyouh 20

k rf

1

2 3 k

rfS

f

- k

rfS

f

if P i + 1, j , k

P i, j , k

1

2 3 k

rfS

f

- k

rfS

f

if P i + 1, j , k

P i, j , k

Page 21: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

• Although we have illustrated the transmissibility groups only for the i+1/2, j, k interface, similar analyses apply to the other interfaces.

• In summary, it is imperative to note that the transmissibility group consists of three components, and that each is calculated differently.

• The constant component is calculated using harmonic averaging

• The weakly non-linear component is estimated using arithmetic averaging

• The strongly non-linear component is obtained using upstream averaging

12/26/2017 Dr. Helmy Sayyouh 21

Page 22: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

Incorporation of boundary conditions

• To obtain a particular numerical solution to a flow problem, we must impose specific boundary conditions.

• Figure shows a pure Dirichlet-type boundary condition with a mesh-centered grid system.

12/26/2017 Dr. Helmy Sayyouh 22

Page 23: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

The boundary conditions imposed on the system translate to the following equations:

12/26/2017 Dr. Helmy Sayyouh 23

P i , NY

P A

P i , 1

P C

for i = 1, ...NX

P i , j

P D

P NX , j

P B

for j = 1, ...NY

Page 24: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

• Figure shows a body-centered grid with Neumann-type boundary conditions. In this case, finite-difference representation of the boundary conditions is as follows:

12/26/2017 Dr. Helmy Sayyouh 24

P NX 1 , j

P NX, j

x C

1

P i , j

P 0 , j

x C

4

f or j = 1, ..., NY

P i , 1

P i , 0

y C

2

P 1 , NY 1

P i , NY

y C

3

for i = 1, ..., NX

Page 25: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

12/26/2017 Dr. Helmy Sayyouh 25

Figure shows a similar treatment for the mesh-centered grid system.

The important difference is the node being reflected. The implementation of

the finite-difference approximation in this case will be as follows:

P NX 1 , j

P NX 1 , j

2 x C

1

P 2 , j

P i , 0

2 x C

4

f or j = 1, ..., NY

P i , 2

P i , 0

2 y C

2

P 2 , NY 1

P i , NY

2 y C

3

for i = 1, ..., NX

Page 26: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

Shorthand notation for the finite-difference equations

• Strongly-Implicit-Procedure, or SIP (Stone, 1968). For example, we can write the SIP form as follows:

12/26/2017 Dr. Helmy Sayyouh 26

Z P B P D P E P F P

H P S P Q

i j k

n

i j k

n

i j k

n

i j k

n

i j k

n

i j k

n

i j k

n

i j k

n

i j k

n

i j k

n

i j k

n

i j k

n

i j k

n

i j k

n

i j k

, , , , , , , , , , , , , , , , ,

, , , , , , , , ,

1

1

1,

1

1,

1 1

1,

1

1,

1

1

1

Z, B, D, F, H and S are the transmissibility terms representing the

interaction of block i, j, k with the neighboring blocks.

Page 27: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

Figure graphically shows the interaction of block i, j, k with the surrounding blocks

12/26/2017 Dr. Helmy Sayyouh 27

Page 28: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

• The principal advantage of the SIP notation is its inherent flexibility.

• For instance, having written it for three-dimensional flow, for one- and two-dimensional flows some of the SIP coefficients simply drop out.

12/26/2017 Dr. Helmy Sayyouh 28

Table summarizes the possible combinations and their corresponding SIP coefficients.

Page 29: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

Special considerations

• In writing finite-difference analogues for partial differential equations, we must always consider a number of important points, which principally pertain to the accuracy of the resulting solution.

• The specific points of consideration include solution stability, consistency and truncation error.

• Rarely does the user of a reservoir simulator need to worry about these problems, but one should be aware of them.

12/26/2017 Dr. Helmy Sayyouh 29

Page 30: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

• Stability analysis is meant to ensure that the round-off error (which arises over time due to the computer’s finite word length as time evolves) does not magnify in such a way as to obscure the solution.

• Stability analyses focus on defining the stability criterion for a given finite-difference scheme.

• These types of analyses provide results such as conditional stability and unconditional stability or instability

12/26/2017 Dr. Helmy Sayyouh 30

Page 31: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

• When we encounter a conditional stability, the criterion will bring in certain limitations on the block dimensions and time step sizes.

• Although an unconditional stability implies no restriction on the block and time step sizes, we should keep in mind that the physical meaning of the solution can be lost if we assign unrealistically large block and time step sizes.

12/26/2017 Dr. Helmy Sayyouh 31

Page 32: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

• The next important question to answer is whether the proposed scheme is consistent (i.e., compatible) with the original partial differential equation.

• In other words, does the proposed finite-difference analogue collapse to the original partial differential equation in the limit as the block dimensions and time step size approach zero?

12/26/2017 Dr. Helmy Sayyouh 32

Page 33: Finite Difference Approximation - Cairo Universityscholar.cu.edu.eg/sayyouh/files/7-finite_difference_approximation.pdf · Backward-Difference Approximation: •With the same strategy,

• The truncation error is the difference between the original partial differential equation and its finite-difference analogue.

• For a compatible scheme, we should expect that the truncation error will disappear as the block dimensions and the time step size become infinitesimally small.

• If this does not happen, we have a consistency problem. In other words, the proposed scheme produces a solution to a different problem (partial differential equation).

12/26/2017 Dr. Helmy Sayyouh 33


Recommended