37
CHAPTER 2 Finite Difference Equations, Continuous Approach Introduction Finite Difference Equation for the Diffusivity Equation (1-D) Types and Methods of Solution of F.D.E. Accuracy of Solutions Implicit vs. Explicit F.D.E.

chap2_603

Embed Size (px)

DESCRIPTION

Reservoir simulation Lecture 2

Citation preview

Page 1: chap2_603

CHAPTER 2

Finite Difference Equations,

Continuous Approach

Introduction

Finite Difference Equation for the Diffusivity Equation (1-D) Types and Methods of Solution of F.D.E.

Accuracy of Solutions

Implicit vs. Explicit F.D.E.

Stability of Convergence of Finite Difference Equation (Von Neumann Analysis)

Page 2: chap2_603

Finite Difference Equations, Continuous Approach

Introduction

It is not possible to develop analytical solutions for many problems. The most common reasons are the heterogeneity and irregular shapes of reservoirs. Another common reason, as in the case for gases, is the nonlinearity of the equations (properties changing with pressure). Reservoir simulation is a viable method for solving such problems and has become the standard method for solving reservoir flow problems in both field offices and in research environments.

Reservoir simulation has become a common tool in reservoir engineering. Reservoir simulation is used to solve research-type problems, such as analysis of enhanced oil recovery, horizontal wells, well stimulation techniques, etc. More common applications, however, are the simulation of actual wells and actual reservoirs. Since the late 1960's the technology and computer hardware have advanced enormously and the cost and speed of doing reservoir simulation have been improved dramatically.

The valuable aspect of reservoir simulation for field problems is the ability to make production forecasts. Usually a number of different simulated cases are compared for the purpose of making decisions. Drilling locations, production rates, injection plans, etc. are factors that may vary from case to case.

The simulator data is taken from available information such as well logs, core analysis, geological description, pressure data, and production data. In many cases, the well or wells have already produced. For these cases, the past production period is simulated for the purpose of "history matching". The input data usually must be adjusted in order to match the past performance. This calibration process provides a more accurate reservoir "model" to be used for forecasts.

In this chapter, we introduce the finite difference approach as an alternative to analytical solutions. This approach is usually called reservoir simulation. The theory and practice of reservoir simulation are covered in several publications.

F.D.E. - Continuous Approach

1

Page 3: chap2_603

Finite Difference Approach for The Diffusivity Equation (1-D)

We can start with the diffusivity equation in one dimension:

2

2

p

x =

c

0.00633k

p

t

(1)

This applies, of course, to the flow of a liquid with a small compressibility. We will discuss gas flow later.

In order to solve problems which involve this equation, the finite difference method can be used. This equation is "discretized" into the following finite difference form

i-1n+1

in+1

i+1n+1

2in+1

inp - 2 p + p

( x )=

c

0.00633 k

p - p

t

(2)

The n superscript indicates the "old" time level. All of the unknowns have already been solved at the n time level. The n+1 superscript indicates the "new" time level. We want to solve for these unknown values at the new time level.

Eq. 2 is called an implicit finite difference equation since it involves more than one unknown. Three unknowns, pi-1

n+1, pin+1, and pi+1

n+1 occur because we chose the n+1 time level to discretize the left-hand side of the equation. A template of this finite difference equation is shown in Fig. 1.

F.D.E. - Continuous Approach

2

Page 4: chap2_603

t

x

t

p p p

P(x+x)

x+xx

P(x)

x

P

Fig. 1 - Finite difference template, Fig. 2 - Illustration of Taylor showing pressures involved in the finite series analysis.difference equation.

We know the value of p at the n time level and we are trying to determine the values of p at the n+1 time level.

The solution procedure for the finite difference equations is as follows:

(1) specify values for all pi0 at t = 0. (this is the initial condition)

(2) solve for all pi

n+1 for timestep 1.

(3) repeat this procedure for a sequence of timesteps, using the values from the previous timestep as the "old" n values.

(4) stop when the desired time has been simulated.

It would have been possible to discretize the left-hand side of Eq. 1 at the n time level. In that case, we would have only had one unknown, pi

n+1. This method would be called an explicit finite difference equation. This would be easier to solve, but is of no practical use because it is unstable (oscillates or blows up) for practical timestep sizes.

Theoretical basis, Taylor series.Our justification for approximating Eq.1 with Eq.2 is based on Taylor series analysis.

Consider the function p(x) in Fig. 2. Suppose we know the value of p(x) at the point x. Also suppose we know all the derivatives of p(x) at the point x. If we want to approximate the value of p(x+x) at the point x+x, we can do this with a Taylor series as follows,

F.D.E. - Continuous Approach

3

Page 5: chap2_603

p(x+ x) = p(x)+ xp (x)+ x2!

p (x)+ x3!

p (x)+ + xn!

p (x)+ 2 3 n

n

(3)

where pn is the n th derivative of p. This is an infinite series which is theoretically exact for an infinite number of terms. However, if we truncate the series after n terms, then we introduce a truncation error, et , (the remaining terms which are not included). This truncation error is

t

n+1 n

e = p(x ) x

(n + 1)!+

( )

1

(4)

and is equal to

t

n+1 n

e = p(x + ) x

(n + 1)! (0 x)

( )

1

(5)

It should be remembered that the function p(x) and all its derivatives must be continuous throughout the interval under consideration. (In fact, we often deal with discontinuities in both time and space. That limits the Taylor series analysis. Still we will continue our discussion about using Taylor series for developing our finite difference equations.)

We will now simplify our notation by using pi rather than p(x), pi+1 rather than p(x+x), and pi-1 rather than p(x-x). We can expand our Taylor series in either direction as follows:

i+1 i

2 2

2

3

3

4

4p = p + x

p

x +

x

2!

p

x +

x

3!

p

x +

x

4!

p

x +

( ) ( ) ( )3 4

(6)

i-1 i

2

2

3

3

4

4p = p - x

p

x +

x

2!

p

x -

x

3!

p

x +

x

4!

p

x -

( ) ( ) ( )2 3 4

(7)

Notice that the right-hand side now uses partial derivatives (evaluated at xi) since p is a function of both x and t, p(x,t).

We have a couple of choices of approximations to p/x:

Forward difference (from Eq. 6):

F.D.E. - Continuous Approach

4

Page 6: chap2_603

p

x

p - p

xi+1 i

(8)

Backward difference (from Eq. 7):

(9)

These expressions are both (x) (pronounced "first order correct") since the first term truncated has x in it. The terms with higher powers of x are called "higher order terms".

We can also develop an approximation for 2p/x2 by combining Eqs. 6 and 7. This gives us

Central difference (from Eqs. 6 and 7):

(10)

This expression is used for the left hand side of Eq.1. It is (x2) (second order correct) since the x terms cancel and the first term truncated contains x2.

We apply our Taylor series in terms of t to find the finite difference expression for p/t. In this case, we will use a backward difference (in the negative t direction from tn+1). We will simplify our notation to use superscripts to indicate the time level. Again, n is the "old" time level for which we have a complete solution and know all variables and properties. n+1 is the new time level for which the solution is unknown. With this notation, our finite difference approximations to the 1-D diffusivity equation is

(11)

Eq. 2 is the basic finite difference equation for the 1-D diffusivity equation. We say that it is (x2,t). It must be solved for all the new pressures, pn+1, simultaneously. Once these new pressures are solved, then they become the old pressures for the next timestep. In this manner, solutions to Eq. 2 are solved in a time sequence for as many timesteps as required.

Now we will turn our attention to the initial conditions and boundary conditions which complete the specification of the problem.

F.D.E. - Continuous Approach

5

Page 7: chap2_603

Initial conditions. Initial conditions are required to begin the timestep sequence. For the initial conditions, n=0, a value is specified for each pressure. The most common initial condition is to specify each pressure to be equal to a constant, such as

i0

initialp = p i = 1,.., IMAX (11)

where IMAX is the total number of points in the x direction. This typifies a well or reservoir at initial conditions of no fluid flow.

Boundary conditions. For a 1-D problem, we need to specify equations other than Eq. 2 at the left boundary and the right boundary. Usually, either a fixed pressure (mathematically called the Dirichlet condition) or a fixed first derivative (the Neumann condition) are specified, as follows:

Fixed pressure:

p1n+1 = C1 (12)

or,

pIMAXn+1 = C2 (13)

Fixed first derivative:

2 13

p - p

x = C

(14)

or,

IMAX IMAX -14

p - p

x = C

(15)

F.D.E. - Continuous Approach

6

Page 8: chap2_603

where C1, C2, C3, and C4 are values specified by the problem. Although these values may change with time, they are held constant during the timestep.

We now will discuss how the solution is obtained for a timestep.

F.D.E. - Continuous Approach

7

Page 9: chap2_603

Types and Methods of Solution of F.D.E.

The pressure solution - a matrix problem. We can now state all of the equations that are to be solved simultaneously for a particular timestep. Let us take a case where the boundary conditions are fixed pressure. For the following equations, the unknown pressures are on the left hand side and the right hand side has known values.

The left boundary:

1 1p = C

(16)

The interior points, i = 2,...,IMAX-1:

- p + 2+ c

0.00633k

x

t p - p =

c

0.00633k

x

t pi-1

n+1 t

in+1

i+1n+1

in ( ) ( )

2 2

(17)

The right boundary:

IMAX 2p = C (18)

Eqs. 16-18 comprise a system of simultaneous equations with IMAX unknowns and IMAX equations. All of these equations are linear with respect to the unknown pressures. That is, there are no pressure squared, etc. All of the pressure terms have coefficients which do not depend on pressure.

As an example, let us consider a problem where IMAX = 5. For this problem, we have five unknown pressures and five equations. Three of these equations are for interior points, represented by the finite difference equation, Eq. 2. The first and last equations are for the boundary conditions.

This set of equations can be represented by a matrix equation which can simply be written as

F.D.E. - Continuous Approach

8

Page 10: chap2_603

A p = d (19)

where A is a coefficient matrix, and p and d are column vectors. The matrix equation, Eq. 19, can be shown as

b c

a b c

a b c

a b c

a b

p

p

p

p

p

d

d

d

d

d

1 1

2 2 2

3 3 3

4 4 4

5 5

1

2

3

4

5

1

2

3

4

5

(20)

The rows of the matrix represent equations and the columns represent unknowns. Only the non-zero elements of the matrix are shown in Eq. 20. Notice that the non-zero elements follow a diagonal trend, lying in three adjacent diagonals. This is called a tri-diagonal matrix and is characteristic of the matrix form of Eq. 2. Since matrix A is mostly zeros for large problems, it is not necessary to store all of its elements in the computer. The values of a, b, c, and d are stored as arrays and are computed as follows, for a problem with fixed boundary pressures:

The left boundary:

b1 = 1c1 = 0d1 = C1

The interior points: i = 2, IMAX-1

ai = -1bi = 2 + (c)/(0.00633k) ((x)2/t)ci = -1di = (c)/(0.00633k) ((x)2/t) pi

n

The right boundary:

aIMAX = 0bIMAX = 1dIMAX = C2

Notice that a1 and cIMAX are not used because they fall outside the matrix.

F.D.E. - Continuous Approach

9

Page 11: chap2_603

Tri-diagonal solution - Thomas algorithm. The tri-diagonal matrix of Eq. 20 is a form which commonly occurs in engineering problems and has a very efficient solution procedure called the Thomas Algorithm. This algorithm is similar to Gaussian elimination in that it has a forward sweep and a backward sweep. The algorithm can be summarized as follows:

Forward sweep:

w1 = b1

g1 = d1/w1 wi = bi - ai ci-1 / wi-1 gi = (di - ai gi-1) / wi

carried out with i increasing, and

Backward sweep:

pIMAX = gIMAX

pi = gi - ci pi+1 / wi

carried out with i decreasing.

After this computation is completed, we have now solved for the new pressures and are ready to go to the next timestep.

Example 2.1 – 1-D Simulation

Problem. Solve the following initial/boundary value problem with the method just discussed:

permeability = 10 mdviscosity = 10 cpcompressibility = 20 x 10-6 psi-1

length = 400 ftporosity = 0.20

Initial condition:

p(x,0) = 1,000 psi

Boundary conditions:

p(0,t) = 0 psi

F.D.E. - Continuous Approach

10

Page 12: chap2_603

p(400,t) = 1,000 psi

Model parameters:

x = 100 ft (IMAX = 5)t = 5 days

Solution.

This problem is solved by writing a FORTRAN program. The following program is specifically written to solve this problem and output the pressure results each timestep.

Boundary Conditions Example.

p1 = 0

p5 = 1,000

1 0

1 1

1 1

1 1

0 1

0

1000

2

3

4

1

2

3

4

5

2

3

4

b

b

b

p

p

p

p

p

d

d

d

b2 = b3 = b4 = 2 + d2 = p2

n d3 = p3

n d4 = p4

n

where: = (c)/(0.00633k) ((x)2/t)

F.D.E. - Continuous Approach

11

Page 13: chap2_603

c===================================================== 1dsimc Program for solving diffusivity equation with fixedc boundary pressures

DIMENSION a(40),b(40),c(40),d(40),p(40),pn(40) WRITE(*,*) 'imax, delt' READ (*,*) imax, delt pinit = 1000. xlength = 400. c1 = 0. c2 = 1000. delx = xlength / (imax-1) phi = 0.20 perm = 10. visc = 10. comp = 20.E-6 time = 80. alpha = (phi * visc * comp) / (0.00633 * perm) * (delx**2 / delt)

c ... initial conditions DO 10 i = 1, imax p(i) = pinit pn(i) = pinit

10 CONTINUEc ... interior gridblocks

DO 20 i = 2, imax-1 a(i) = -1. b(i) = 2. + alpha c(i) = -1.

20 CONTINUEc ... boundary conditions

b(1) = 1. c(1) = 0. d(1) = c1 a(imax) = 0. b(imax) = 1. d(imax) = c2

c ... taking timesteps t = 0

30 CONTINUE t = t + delt DO 40 i = 2, imax-1 d(i) = alpha * pn(i)

40 CONTINUEc

CALL thomas(a,b,c,d,p,imax) WRITE(*,800) t, (p(i),i = 1,imax) DO 50 i = 1, imax pn(i) = p(i)

50 CONTINUE IF ( t .LT. time ) GO TO 30

800 FORMAT( 200F8.1) END

F.D.E. - Continuous Approach

12

Page 14: chap2_603

c==================================================== thomas SUBROUTINE thomas(a,b,c,d,p,n)

c this is a solution of tridiagonal system of equationsc a,b,c,d : coefficients of the equation,c a(i) * x(i-1) + b(i) * x(i) + c(i) * x(i+1) = d(i)c p = solution vectorc n = number of unknowns

DIMENSION a(*),b(*),c(*),d(*),p(*),w(101),g(101) w(1) = b(1) g(1) = d(1) / w(1) DO 1 i = 2,n w(i) = b(i) - a(i) * c(i-1) / w(i-1) g(i) = (d(i) - a(i) * g(i-1)) / w(i)

1 CONTINUE p(n) = g(n) DO 2 i = n-1,1,-1 p(i) = g(i) - c(i) * p(i+1) / w(i)

2 CONTINUE RETURN END

F.D.E. - Continuous Approach

13

Page 15: chap2_603

The numerical results are shown in Fig. 3 Although results are only computed at discrete points, it is customary to draw straight lines between points. The straight lines, rather than a smoothed curve, emphasize the discrete nature of the solution and clearly shows where the discrete points are. The solutions in Fig. 3 show that the early solution is transient but approaches steady state at 80 days.

0 100 200 300 400

X (ft)

0

200

400

600

800

1000p(x,t) (psi)

t = 5 days10

2030

80

0 100 200 300 400

X (ft)

0

200

400

600

800

1000p(x,5) (psi)

. t = 5 days

. t = 2.5 days t = 1.25 days

. t = 0.625days. t = 0.3125days. t = 0.15625days

Fig. 3 - Pressure profiles Fig. 4 - Comparison of pressurefor Example 1. profiles at t = 5 days for different

timestep sizes.

F.D.E. - Continuous Approach

14

Page 16: chap2_603

Accuracy of solutions

Now the question occurs: "how accurate are the finite difference solutions". We can compare with an exact analytical solution, if it is available. However, we do not have an exact analytical solution for many problems. We need to develop a methodology for analyzing the accuracy of finite difference solutions - at least to have confidence that they are sufficiently accurate for the purposes of our objectives.

The accuracy of the solutions is related to the truncation error in our Taylor series analysis. We could do a complicated analysis of the Taylor series approximations, but we would be analyzing the accuracy of the finite difference equation (it's approximation to the partial differential equation), not the accuracy of the solution.

A more practical approach is to vary the values of t and x and analyze the comparative behavior of our solutions. Let us use Example 1 to illustrate this numerical experimentation. First, we will vary the value of t and observe the results. t is usually much easier to change than x. Fig. 4 shows such a comparison at t = 5 days. It can be seen that as t becomes smaller, the solution converges.

The value of p at x = 100 ft and t = 5 days, p(100,5), is then plotted in Fig. 5 to see more detail. As t approaches zero, p(100,5) seems to approach the correct analytical solution of 573.34 psi. Fig. 5 also shows other values for x and they all approach the exact solution as t approaches zero. On the other hand, Fig. 6 shows the effect of x on the solution with various values of t. It is seen that p(100,5) does not approach the correct solution as x approaches zero unless t is sufficiently small. For this particular problem, we can conclude the small t is much more important than small x. In general, however, we should realize that complete numerical experiments may have to be carried out to have confidence in our results.

Fig. 7 shows our first solution of p(x,5) using t = 5 days and x = 100 ft, compared with our improved values of t = 1.25 days and X = 25 ft. It is easy to see the improved accuracy and smoothness of the solution. However, this solution is still higher than the analytical solution at x = 100 ft (the analytical solution is 573.34 psi).

Fig. 8 shows a comparison of the two numerical solutions on a time plot. The same general behavior is true as on the x profile plot - the smaller values of x and t give more accurate results.

For this problem, we may not require great accuracy. We may decide from Figs. 5 and 2.6 that values of t = 1.25 days and x = 25 ft are sufficiently small to give good results for practical purposes. This gives an error of about 35 psi for p(100,5) which seems high. However, if we look at Fig. 7, it looks like these values give an acceptable result. (The error at x = 100 is about the highest in the x profile). This selection of t and x is a judgement, according to the practicality for the problem being solved.

F.D.E. - Continuous Approach

15

Page 17: chap2_603

0 1 2 3 4 5

. t (days)

550

575

600

625

650

675

700p(100,5) (psi)

x = 12.5 ft

0 20 40 60 80 100

. x (ft)

550

575

600

625

650

675

700p(100,5) (psi)

t = 5 days

t = 1.25 days

t = 0.15625 days

t = 0.01 days

x ft625.x = 12.5 ft

x = 100 ft

x = 50 ft

Fig. 5 - Effect of timestep size on Fig. 6 - Effect of grid spacing on pressures at x = 100 feet and t = 5 days pressures at x = 100 feet and t = 5 days

Fig. 7 - Comparison of pressure Fig. 8 - Comparison of pressure profiles at t = 5 days vs. time at x = 100 feet

On large problems encountered in reservoir simulation, there is a cost involved in taking small values of t and space grids (x, y, and z). It is also recognized that much of the field data is somewhat inaccurate and uncertain. Therefore, something less then complete accuracy may be acceptable in order to reduce cost and simplify data preparation.

F.D.E. - Continuous Approach

16

Page 18: chap2_603

Although we have found practical values of t and x for this particular problem, we should not expect these values to apply to other problems. The trial and error procedure for determining practical values of x and t is called a sensitivity analysis and is commonly done for practical problems when the question of accuracy arises. Most of the time the correct analytical solution is not known, so converging results are taken to be converging on the correct solution.

It should also be pointed out that the best solution may not always be achieved by t approaching zero. For certain other problems, such as water displacing oil (the Buckley-Leverett problem), it is known that the best value of t depends on the value of x and the physical properties of the problem6. Therefore, we should be cautious in accepting that small values of t always give the best results.

Other Taylor Series Approximations.The following is a table that shows forward, backward, and central difference expressions for first and second derivatives.

pi = p(x) pi+1 = p(x+x)

pi+2 = p(x+2x)

Difference Expressionpi-3 pi-2 pi-1 pi pi+1 pi+2 pi+3

Forward Difference x p ' (x) -1 1 + O (x) (x)2 p ''(x) 1 -2 1 Backward Difference

x p ' (x) -1 1 + O (x) (x)2 p "(x) 1 -2 1

(x)2 p ''(x) 1 -2 1

Central Difference 2 x p ' (x) -1 0 1 + (x)2

(x)2 p ''(x) 1 -2 1

Higher Order Difference Expressions

Forward Difference 2x p ' (x) -3 4 -1 + (x)2

F.D.E. - Continuous Approach

17

Page 19: chap2_603

(x)2 p ''(x) 2 -5 4 -1 Backward Difference 2x p ' (x) 1 -4 3 + (x)2

(x)2 p ''(x) -1 4 -5 2 Central Difference 12x p ' (x) 1 -8 0 8 -1 + (x)4

12 (x)2 p ''(x) -1 16 -30 16 -1

F.D.E. - Continuous Approach

18

Page 20: chap2_603

Implicit vs. Explicit F.D.E.

2

2

p

x =

p

t

(21)

(22)

where

(23)

(24)

where

(25)

Explicit FDE. The solution is only stable when (t) < (x)2/2.

1

( x )( p - 2 p + p ) =

1

t( p - p )2 i-1

nin

i+1n

in+1

in

(26)

Implicit FDE. The solution is unconditionally stable for any t.

1

( x )( p - 2 p + p ) =

1

t( p - p )2 i-1

n+1in+1

i+1n+1

in+1

in

(27)

Crank-Nicolson Method (C-N). This is a half explicit/half implicit method

F.D.E. - Continuous Approach

19

Page 21: chap2_603

1

2

1

( x )( p - 2 p + p ) +

1

2

1

( x )( p - 2 p + p ) =

1

t( p - p )2 i-1

nin

i+1n

2 i-1n+1

in+1

i+1n+1

in+1

in

(28)

Truncation Error : ( (x)2 , (t)2 )

General Implicit Methods. This is also a mixed explicit/implicit method, but is more flexible than the C-N method.

(1- )1

( x )( p - 2 p + p ) +

1

( x )( p - 2 p + p ) =

1

t( p - p )2 i-1

nin

i+1n

2 i-1n+1

in+1

i+1n+1

in+1

in

(29)

Weighting factor : ( 0 1 )

= 1 ( Implicit)

= 0 ( Explicit)

= 1/2 ( C-N)

Truncation Error: ( (x)2 , (t) ) (generally)

Only the implicit method is unconditionally stable (for any timestep size). The explicit method is stable only for sufficiently small timesteps, which are generally impractical. Although the Crank-Nicholson method has higher order accuracy, it is on the borderline of instability and is conditionally stable for practical purposes. Therefore, the implicit method is the standard in reservoir simulation. If more accuracy is required, smaller timesteps are used.

F.D.E. - Continuous Approach

20

Page 22: chap2_603

Stability and Convergence of Finite Difference Equations (Von Neumann Analysis )

Consider the equation

2

2

p

x =

p

t

(21)

The initial conditions can be represented by a Fourier series

f x a emimx

m( , )0

1

(30)

But we can look at an arbitrary element m = s, and show that

p(x,0) = eisx (31)

is representative of general behavior. At time t, we can represent the solution as

p(x,t) = e (t)isx (32)Since the solution is separable.

Time period operator, E.

We will represent one time period as an operator acting on the previous time period:

(33)Analytical solution.

A solution can be written in the form:

(34)

which means that

(35)

and can be expanded as,

F.D.E. - Continuous Approach

21

Page 23: chap2_603

p(x,t) = e [ 1 - s t + ( s t)

2! -

( s t)3!

+ ... ]isx 222 32

(36)

but

-s -s t -s t -s t2 (t+ t) 2 2 2

e = e e = E e (37)

So

(38)

analytical2

22 32

E = 1 - s t + ( s t)

2! -

( s t)3!

+ ... (39)

Note that for any (positive) value of t, 0<E<1.

Explicit Difference Equation.

Now we will analyze the F.D.E.

t

( x )[ p - 2 p + p ] = p - p2 i+ 1

nin

i-1n

in+1

in

(40)

Substituting our Fourier element eisx(t) for p gives

t

( x )[ e (t) - 2e (t) + e (t)] = e [ (t + t ) - (t)]2

is(x + x ) isx is(x - x ) isx (41)

Cancelling eisx gives

t

( x )[ e - 2 + e ] (t) = (t + t ) - (t)2

is x - is x (42)

But,

is x - is xe + e = 2 (s x ) cos (43)

So,

2t

( x )[ (s x ) - 1] (t) = (t + t ) - (t)2

cos (44)

(t + t ) = (1 + 2t

( x )[ (s x ) - 1] ) (t)2

cos (45)

F.D.E. - Continuous Approach

22

Page 24: chap2_603

cos( ) sin ( )s x sx

1 22

2 (46)

(t + t) = (1 - 4t

( x )[ (s

x

2)]) (t)2

2

sin (47)

Then, the value of E is

explicit 22E = 1 - 4

t

( x )[ (s

x

2)]

sin (48)

For small values of x,

sin sx

sx

2 2

(49)

x 0

2 (sx

2) = (s

x

2)(s

x

2)

lim sin (50)

explicit 2E = 1 - 4t

( x )(s

x

2)(s

x

2)

(51)

So,

explicit2E = 1 - s t (52)

Which does converge to Eanalytical as t becomes small.

But since we can write the initial conditions as

p0 = eis

and after n timesteps

p(x,t) = En p(x,0)

n isx2

2 np = e (1 - 4t

( x )[ (s

x

2)] )

sin (53)

The quantity, E must be -1 E 1, otherwise changes in p will grow instead of decaying and errors will grow instead of decaying. So, in order for the absolute value of E to be less than 1, the condition for stability is

F.D.E. - Continuous Approach

23

Page 25: chap2_603

t

( x ) <

1

22

We call this conditional stability. It is not practical for reservoir simulation. If we violate this condition, the solution will oscillate with respect to x and t and may blow up.

Implicit Difference Equation. Following the same approach, we arrive at the following:

2t

( x )[ (s x ) - 1] (t + t ) = (t + t ) - (t)2

cos (54)

- 4t

( x )[ (s

x

2)] (t + t ) = (t + t) - (t)2

2

sin (55)

(t + t) = 1

1 + 4t

( x )[ (s

x2

)](t)

22

sin

(56)

So,

implicit

22

E = 1

1 + 4t

( x )[ (s

x2

)]

sin

(57)

which indicates that the implicit difference equation is stable for any value of t, ( 0 < E < 1 ). We call this unconditional stability. The implicit method will not oscillate or blow up.

For small values of x,

E = 1

1 + 4t

( x )(s

x2

)(sx

2)

= 1

1 + s t2

2

(58)

which is equivalent to

E = 1 - s t + ( s t ) - ( s t ) + ...2 2 2 2 3 (59)

and converges to

F.D.E. - Continuous Approach

24

Page 26: chap2_603

1 - s t = E2analytical (60)

for small x, t. So the implicit method becomes accurate for small values of x and t

F.D.E. - Continuous Approach

25

Page 27: chap2_603

EXERCISES

PROBLEM NO.1

(a) Derive an O(x)2 F. D. representation for dp/dx at xN (right hand boundary) using values at xN , xN-1 , and xN-2 .

(b) Use Taylor’s series and show the first truncated term.

PROBLEM NO.2

Our F. D. E. can be shown in dimensionless form as follows:

2D

Dt Dp =

1

t p - 1

Show all the steps in deriving this form, starting with the F. D. E.

a p = V c

t p + qBn+1 p t

t

Hint, use the following relationships:

x = y

Dinitial ip =

0.00633 kh( p - p )

qB

Dt

t = 0.00633 k t

c x y

PROBLEM NO. 3For each of the following, use Taylor series to derive the indicated expression. Show the

first truncated term and state the order of the approximation(i.e. O(x)).

(a) a central difference equation for p/x which involves the points i-1 and i+1.

(b) a forward difference equation for p/x which involves the points i, i+1, i+2.

(c) a forward difference equation for p/x2 which involves the points i, i+1, i+2.

F.D.E. - Continuous Approach

26

Page 28: chap2_603

PROBLEM NO 4

Derive Eq. 2 using Taylor’s series. The Taylor’s series expansions are taken from the reference point pi

n+1, so the space derivative will be centered and the time derivative will be backward. Save the first truncated terms for both x and y.

PROBLEM NO 5

Analyze the accuracy of a 1-D simulator by the following:

(a) Run the 1-D program in Example 2.1, using various values of t and x. For each value of x, find the limit of p(100,5) as the timestep approaches zero by extrapolating your results. Then plot these limit values versus x. Note the significance of the timestep size.

(b) Run the 1-D program in Example 2.1, using various values of t and x. For each value of t, find the limit of p(100,5) as t approaches zero by extrapolating your results. Then plot these limit values versus t. Note the significance of the timestep size.

(c) Compare the sensitivity of results in parts a and b. Comment on these differences (Hint: look at problem 4. Use this result to analyze the sensitivity.)

PROBLEM NO 6

Modify the 1-D simulator in Example 2.1 to calculate the flow rate (ft3/dft2) on the left boundary. Make each run to steady state. Plot this flow rate vs. time for IMAX = 5,10, and 20. Note what timestep you use.

PROBLEM NO 7

Modify the 1-D simulator in Example 2.1 to have a closed right boundary (q = 0) instead of a fixed pressure boundary. Calculate the flow rate (ft3/ft2) on the left boundary. Make each run to 30 days. Plot the flow rate vs. time for IMAX = 5, 10, and 20. Note what timestep you use.

PROBLEM NO 8

Modify the 1-D simulator in Example 2.1 to specify a slope of 1 on the left boundary and a slope of 0 on the right boundary. Make each run until p1 becomes negative. Note what timestep you use.

PROBLEM No. 9

F.D.E. - Continuous Approach

27

Page 29: chap2_603

Consider the following boundary value problem:

2

2

u

x=

u

t

I.C.: u(0<x<1, 0) = x u(1<x<2, 0) = 2-x

B.C.: u(0, t) = 0u(2, t) = 0

We want to solve this problem with an implicit F.D.E. but only use three grid points, at x = 0, 1, and 2. We will use a timestep so that t = 0.5 . Of course, x = 1 .

(a) Show the tri-diagonal matrix for this problem.(b) Solve for u(1, 0.5) and u(1, 1)

F.D.E. - Continuous Approach

28