Chapter 2_603

download Chapter 2_603

of 28

Transcript of Chapter 2_603

  • 8/7/2019 Chapter 2_603

    1/28

    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)

  • 8/7/2019 Chapter 2_603

    2/28

    F.D.E. - Continuous Approach

    1

    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 thesimulation 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 havealready 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.

  • 8/7/2019 Chapter 2_603

    3/28

    F.D.E. - Continuous Approach

    2

    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-1

    n+1

    i

    n+1

    i+1

    n+1

    2

    i

    n+1

    i

    np - 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-1n+1, pi

    n+1, and pi+1n+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.

  • 8/7/2019 Chapter 2_603

    4/28

    F.D.E. - Continuous Approach

    3

    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 ofp at the n time level and we are trying to determine the values ofp

    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 pin+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, pin+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 ofp(x) at the point x. Alsosuppose we know all the derivatives ofp(x) at the point x. If we want to approximate the value

    ofp(x+x) at the point x+x, we can do this with a Taylor series as follows,

  • 8/7/2019 Chapter 2_603

    5/28

    F.D.E. - Continuous Approach

    4

    p(x+ x) = p(x)+ xp (x)+x

    2!p (x)+

    x

    3!p (x)+ +

    x

    n!p (x)+

    2 3 nn

    (3)

    where pn is the n th derivative ofp. 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 continuousthroughout 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:

  • 8/7/2019 Chapter 2_603

    6/28

    F.D.E. - Continuous Approach

    5

    Forward difference (from Eq. 6):

    p

    x

    p - p

    x

    i+1 i

    (8)

    Backward difference (from Eq. 7):

    )( xx

    p-p

    x

    p 1-ii +

    (9)

    These expressions are both (x) (pronounced "first order correct") since the first term

    truncated has x in it. The terms with higher powers ofx 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):

    )( 2x)x(

    p+p2-p

    x

    p2

    1+ii1-i

    2

    2

    +

    (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 oftto find the finite difference expression for p/t.

    In this case, we will use a backward difference (in the negative tdirection 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

    ),( txt

    p-p

    k0.00633

    c=

    )x(

    p+p2-pn

    i

    1+n

    i

    2

    1+n

    1+i

    1+n

    i

    1+n

    1-i +

    (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, p

    n+1, simultaneously. Once these

    new pressures are solved, then they become the old pressures for the next timestep. In thismanner, 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.

  • 8/7/2019 Chapter 2_603

    7/28

    F.D.E. - Continuous Approach

    6

    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

    i

    0

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

    where IMAXis 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)

    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.

  • 8/7/2019 Chapter 2_603

    8/28

    F.D.E. - Continuous Approach

    7

    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

    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

    i

    n+1

    i+1

    n+1

    i

    n ( ) ( )

    2 2

    (17)

    The right boundary:

    IMAX 2p = C (18)

    Eqs. 16-18 comprise a system of simultaneous equations with IMAX unknowns and

    IMAXequations. 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

    A p = d (19)

    where A is a coefficient matrix, and p and dare column vectors. The matrix equation, Eq. 19, can

    be shown as

  • 8/7/2019 Chapter 2_603

    9/28

    F.D.E. - Continuous Approach

    8

    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 ofa, b, c,

    and d are stored as arrays and are computed as follows, for a problem with fixed boundary

    pressures:

    The left boundary:

    b1 = 1

    c1 = 0

    d1 = C1

    The interior points: i = 2, IMAX-1

    ai = -1

    bi = 2 + (c)/(0.00633k) ((x)2/t)

    ci = -1

    di = (c)/(0.00633k) ((x)2/t) pin

    The right boundary:

    aIMAX= 0

    bIMAX= 1

    dIMAX= C2

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

    Tri-diagonal solution - Thomas algorithm. The tri-diagonal matrix of Eq. 20 is a form whichcommonly 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:

  • 8/7/2019 Chapter 2_603

    10/28

    F.D.E. - Continuous Approach

    9

    Forward sweep:

    w1 = b1

    g1 = d1/w1

    wi = bi - ai ci-1 / wi-1gi = (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 md

    viscosity = 10 cpcompressibility = 20 x 10-6 psi-1

    length = 400 ft

    porosity = 0.20

    Initial condition:

    p(x,0) = 1,000 psi

    Boundary conditions:

    p(0,t) = 0 psi

    p(400,t) = 1,000 psi

  • 8/7/2019 Chapter 2_603

    11/28

    F.D.E. - Continuous Approach

    10

    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 01 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 = p2n

    d3 = p3n

    d4 = p4

    n

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

  • 8/7/2019 Chapter 2_603

    12/28

    F.D.E. - Continuous Approach

    11

    c===================================================== 1dsim

    c Program for solving diffusivity equation with fixed

    c 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 CONTINUE

    c ... interior gridblocks

    DO 20 i = 2, imax-1

    a(i) = -1.b(i) = 2. + alpha

    c(i) = -1.

    20 CONTINUE

    c ... 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 CONTINUE

    c

    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

  • 8/7/2019 Chapter 2_603

    13/28

    F.D.E. - Continuous Approach

    12

    c==================================================== thomas

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

    c this is a solution of tridiagonal system of equations

    c 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 vector

    c 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

  • 8/7/2019 Chapter 2_603

    14/28

    F.D.E. - Continuous Approach

    13

    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 da s. t = 0.625. t = 0.3125. t = 0.15625

    Fig. 3 - Pressure profiles Fig. 4 - Comparison of pressure

    for Example 1. profiles at t = 5 days for differenttimestep sizes.

  • 8/7/2019 Chapter 2_603

    15/28

    F.D.E. - Continuous Approach

    14

    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 sufficientlyaccurate 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 oftand 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 oftand observe the results. tis usually much easier to change

    than x. Fig. 4 shows such a comparison at t= 5 days. It can be seen that as tbecomes smaller,the solution converges.

    The value ofp 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 ofx on the solution with various

    values oft. It is seen that p(100,5) does not approach the correct solution as x approaches

    zero unless tis sufficiently small. For this particular problem, we can conclude the small tis

    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 ofp(x,5) using t= 5 days and x = 100 ft, compared with

    our improved values oft= 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 and2.6 that values oft= 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

  • 8/7/2019 Chapter 2_603

    16/28

    F.D.E. - Continuous Approach

    15

    about the highest in the x profile). This selection oft and x is a judgement, according to thepracticality for the problem being solved.

    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 ft=625.

    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

    0 100 200 300 400

    X (ft

    0

    200

    400

    600

    800

    1000p(x,5) (psi)

    x = 25 ft , t = 1.25 days

    x=100 ft , t =5 days

    Analytical Solution

    0 20 40 60 80Time (days)

    0

    200

    400

    600

    800

    1000p(100,t) (psi)

    x = 100 ft , t = 5 days

    x = 25 ft ,t = 1.25 days

    Analytical Solution

    Fig. 7 - Comparison of pressure Fig. 8 - Comparison of pressure

    profiles at t = 5 days vs. time at x = 100 feet

  • 8/7/2019 Chapter 2_603

    17/28

    F.D.E. - Continuous Approach

    16

    On large problems encountered in reservoir simulation, there is a cost involved in taking

    small values oftand 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.

    Although we have found practical values of t and x for this particular problem, weshould not expect these values to apply to other problems. The trial and error procedure for

    determining practical values ofx and tis 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 oft

    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

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

    Backward Difference

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

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

    Central Difference

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

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

    Higher Order Difference Expressions

  • 8/7/2019 Chapter 2_603

    18/28

    F.D.E. - Continuous Approach

    17

    Forward Difference

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

    (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

  • 8/7/2019 Chapter 2_603

    19/28

    F.D.E. - Continuous Approach

    18

    Implicit vs. Explicit F.D.E.

    2

    2

    p

    x=

    p

    t

    (21)

    )x(+)x(

    p+p2-p=

    x

    p 22

    1+ii1-i

    2

    2

    (22)

    where

    x)+x*xx-(xt)(x*,x

    p

    12

    )x(

    -=)x( 4

    422

    (23)

    t)(+t

    p-p=

    t

    pn

    i

    1+n

    i

    (24)

    where

    t)+tt(t)t(x,x

    p

    2

    t-=t)(

    2

    2

    ** (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

    n

    i

    n

    i+1

    n

    i

    n+1

    i

    n

    (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+1

    i

    n+1

    i+1

    n+1

    i

    n+1

    i

    n

    (27)

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

  • 8/7/2019 Chapter 2_603

    20/28

    F.D.E. - Continuous Approach

    19

    1

    2

    1

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

    1

    2

    1

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

    1

    t( p - p )

    2 i-1

    n

    i

    n

    i+1

    n

    2 i-1

    n+1

    i

    n+1

    i+1

    n+1

    i

    n+1

    i

    n

    (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

    n

    i

    n

    i+1

    n

    2 i-1

    n+1

    i

    n+1

    i+1

    n+1

    i

    n+1

    i

    n

    (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. Althoughthe 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.

  • 8/7/2019 Chapter 2_603

    21/28

    F.D.E. - Continuous Approach

    20

    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

    ==

    1)0,(

    m

    isxmeaxf

    (30)

    But we can look at an arbitrary element and analyze the stability of its behavior. We can ignore

    am and just represent the element as

    e=p(x,0)isx (31)

    At time t, we can represent the solution as

    (t)e=p(x,t)isx (32)

    Since the solution is separable (a function ofx times a function oft).

    Time period operator, E.

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

    (t)E=t)+(t (33)

    Analytical solution.

    A solution can be written in the form:

    ee=t)p(x,ts-isx

    2

    (34)

    which means that

    e=(t)ts-

    2

    (35)

  • 8/7/2019 Chapter 2_603

    22/28

    F.D.E. - Continuous Approach

    21

    Then the solution can be expanded as follows,

    ]...+3!

    t)s(-

    2!

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

    2 32 2

    2isx (36)

    but

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

    e = e e = E e (37)

    So

    e=Ets-

    2 (38)

    analytical2

    22 32

    E = 1 - s t +( s t)

    2!-

    ( s t)

    3!+ ...

    (39)

    Note that for any (positive) value oft, 0

  • 8/7/2019 Chapter 2_603

    23/28

    F.D.E. - Continuous Approach

    22

    So,

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

    t22

    cos (44)

    (t + t ) = (1 + 2t

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

    2

    cos (45)

    )2

    (sin21)cos( 2x

    sxs

    = (46)

    (t))])2

    x(s[

    )x(

    t4-(1=t)+(t 2

    2

    sin (47)

    Then, the value ofEis

    )]2

    x(s[

    )x(

    t4-1=E

    2

    2explicit

    sin (48)

    For small values ofx,

    22sin xsxs (49)

    )2

    x)(s

    2

    x(s=)

    2

    x(s 2

    0x

    sinlim (50)

    )2

    x(s)

    2

    x(s

    )x(

    t4-1=E 2explicit

    (51)

    So,

    ts-1=E2

    explicit (52)

  • 8/7/2019 Chapter 2_603

    24/28

    F.D.E. - Continuous Approach

    23

    Which does converge to Eanalyticalas tbecomes small.

    But since we can write the initial conditions as

    p0

    = eisx

    and after n timesteps

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

    n isx

    2

    2 np = e (1 - 4t

    ( x )[ (s

    x

    2)] )

    sin (53)

    The quantity, Emust be -1 E1, otherwise changes in p will grow instead of decayingand errors will grow instead of decaying. So, in order for the absolute value ofEto be less than

    1, the condition for stability is

    t

    ( x )