+ All Categories
Home > Documents > Unit9 PDEs

Unit9 PDEs

Date post: 01-Jun-2018
Category:
Upload: smile
View: 244 times
Download: 0 times
Share this document with a friend

of 34

Transcript
  • 8/9/2019 Unit9 PDEs

    1/34

    Ho Chi Minh City University of Technology

    Faculty of Geology & Petroleum Engineering

    Modeling & Simulation Division

    Presenter: D r . D o Q u a n g K h a n h

    Email: [email protected]

    Website: www.hcmut.edu.vn

    PARTIAL DIFFERENTIAL EQUATIONS(PDEs)

  • 8/9/2019 Unit9 PDEs

    2/34

    HCMUT

    Partial Differential Equations (PDEs)

    Physical meaning of PDEInitial and boundary conditions

    Classification

    parabolic vs. hyperbolic linear vs. nonlinear

    Solution Methods

    Analytical, numerical, transformation methods

    Dr. Do Quang Khanh2

  • 8/9/2019 Unit9 PDEs

    3/34

    HCMUT

    Classification

    Laplace steady-state Elliptic

    Diffusitivity

    (heat cond) transient Parabolic

    Wave transient Hyperbolic

    2

    2

    2

    2 0T

    x

    T

    y+ =

    2

    2

    p

    x

    p

    t=

    2

    2

    22

    2 1

    t

    y

    cx

    y

    =

    Dr. Do Quang Khanh3

  • 8/9/2019 Unit9 PDEs

    4/34

    HCMUT

    Example: Diffusivity Equation

    t

    p

    k

    cp t

    =

    2

    Expresses conservation of mass

    Slightly compressible fluid

    Porous media

    Single phase flow

    Dr. Do Quang Khanh4

  • 8/9/2019 Unit9 PDEs

    5/34

    HCMUT

    Linearity

    If does not depend on p theequation is linear.

    If does depend on p the

    equation is nonlinear.

    k

    ct

    k

    ct

    Dr. Do Quang Khanh5

  • 8/9/2019 Unit9 PDEs

    6/34

    HCMUT

    Coordinate Systems

    Cartesian

    Radial

    t

    p

    k

    c

    y

    p

    x

    p t

    =

    +

    2

    2

    2

    2

    t

    p

    k

    c

    r

    p

    rr

    p t

    =

    +

    1

    2

    2

    These equations are for 2D problems. To go to 3D

    add .2

    2

    z

    p

    Dr. Do Quang Khanh6

  • 8/9/2019 Unit9 PDEs

    7/34

    HCMUT

    Transient versus Steady-State

    Neeeds initial

    and boundary conditionsNeeeds only

    boundary conditions

    Late-time solution

    at least with const pressures

    at the ends

    2

    2

    p

    x

    p

    t=

    2

    2 0p

    x=

    Dr. Do Quang Khanh7

  • 8/9/2019 Unit9 PDEs

    8/34

    HCMUT

    Derivatives

    The diffusivity equation includesderivatives of pressure in space and intime.

    To solve the diffusivity equationnumerically we must find ways torepresent these derivatives.

    Dr. Do Quang Khanh8

  • 8/9/2019 Unit9 PDEs

    9/34

    HCMUT

    Taylor Series

    p(x)

    p(x+ x)

    xx

    x+ x

    p

    ( ) ( ) ( )

    ( )

    ( )( )

    ( ) +

    +

    +

    ++=+

    xp!n

    x

    xp!2

    x

    xpxxpxxp

    nn

    2

    Dr. Do Quang Khanh9

  • 8/9/2019 Unit9 PDEs

    10/34

    HCMUT

    First Derivative (Forward)

    ( ) ( ) ( )

    ( )

    x

    ppp

    xx

    xpxxpxp

    i1ii

    +

    +=

    +

    writtenusuallyisThis

    rearrangeandtermsecondafterseriesTruncate

    O

    Dr. Do Quang Khanh10

  • 8/9/2019 Unit9 PDEs

    11/34

    HCMUT

    First Derivative (Backward)

    ( ) ( ) ( )

    ( )

    x

    ppp

    x

    x

    xxpxpxp

    1iii

    +

    =

    writtenusuallyiswhich

    Similarly,

    O

    Dr. Do Quang Khanh11

  • 8/9/2019 Unit9 PDEs

    12/34

    HCMUT

    First Derivative (Central)

    ( ) ( ) ( )

    ( )

    x2ppp

    xx2

    xxpxxpxp

    1i1ii

    2

    +

    +=

    +

    writtenusuallyiswhich

    seriesbackwardandforwardtheSubtract

    O

    Dr. Do Quang Khanh12

  • 8/9/2019 Unit9 PDEs

    13/34

    HCMUT

    Second Derivative (Central)

    ( ) ( ) ( ) ( )

    ( )

    ( )

    ( )21ii1i"

    i

    2

    2

    xpp2pp

    x

    x

    xxpxp2xxpxp

    +

    +

    ++=

    +

    writtenusuallyiswhich

    seriesbackwardandforwardtheAdd

    O

    Dr. Do Quang Khanh13

  • 8/9/2019 Unit9 PDEs

    14/34

    HCMUT

    Accuracy

    Getting the derivatives approximatedcorrectly is an important part of getting anaccurate numerical solution.

    How accurate are these Taylor seriesforms?

    Dr. Do Quang Khanh14

  • 8/9/2019 Unit9 PDEs

    15/34

    HCMUT

    Experiment with the spreadsheet tolearn for yourself how xand t

    affect the accuracy of the derivative.

    How accurate is a second derivativeterm (space) ?

    How accurate is a first derivativeterm (time)?

    Accuracy

    Dr. Do Quang Khanh15

  • 8/9/2019 Unit9 PDEs

    16/34

    HCMUT

    You can study the accuracy of thederivatives (as a function of x) byplotting the absolute error between thetrue f(x) and the calculated f(x). [Also

    f(x)]

    You may want to consider using

    logarithmic axes on these plots.

    Accuracy

    Dr. Do Quang Khanh16

  • 8/9/2019 Unit9 PDEs

    17/34

    HCMUT

    Accuracy

    You should have found that the spacederivative is O(x2) and the timederivative is O(t).

    Knowing this if you wanted to improve theaccuracy of your solution and could halveeither x or t which would you choose?

    Dr. Do Quang Khanh17

  • 8/9/2019 Unit9 PDEs

    18/34

    HCMUT

    Linear Reservoir

    Constant Pressure Boundaries

    0 L

    p const

    (left)p const

    (right)

    x

    ft

    daypsi

    1/psi

    md

    cp

    2

    20 00633

    p

    x

    c

    k

    p

    t

    t=.

    Dr. Do Quang Khanh18

  • 8/9/2019 Unit9 PDEs

    19/34

    HCMUT

    Uni_Names

    (ft^3/day)*cp/(md*ft*psi) 158.00836

    (md*ft*psi)/(cp*ft^3/day) 0.00633

    Dr. Do Quang Khanh19

  • 8/9/2019 Unit9 PDEs

    20/34

    HCMUT

    Diffusivity: Numerical Solution

    First discretize the region oninterest over both space and time.

    xi Xi+1 Xi+2Xi-1Xi-2

    k

    cwhere

    t

    p

    x

    p t

    00633.02

    2 =

    =

    ...,t,t,tt 321=

    Dr. Do Quang Khanh20

  • 8/9/2019 Unit9 PDEs

    21/34

    HCMUT

    Diffusivity: Numerical Solution

    Replace the analytical derivatives by numericalapproximations.

    Central difference in space

    Backward difference in time

    Right now we are not stating what timestep (n orn+1) the terms on the left are being evaluated.

    ( ) tpp

    x

    ppp n

    i

    n

    iiii

    =

    + +

    +

    1

    2

    11 2

    Dr. Do Quang Khanh21

  • 8/9/2019 Unit9 PDEs

    22/34

    HCMUT

    Implicit SolutionTemplate

    t

    t

    t

    t

    xxxx

    i-1 i i+1

    1

    n

    n+1

    Dr. Do Quang Khanh22

  • 8/9/2019 Unit9 PDEs

    23/34

    HCMUT

    Implicit - Time Level of Terms

    An implicit solution scheme means thatthe pressures at the nodes will beevaluated at the new timestep (n+1) insecond derivative (space) term.

    ( ) tpp

    x

    ppp n

    i

    n

    i

    n

    i

    n

    i

    n

    i

    =

    + ++

    ++

    +

    1

    2

    1

    1

    11

    1 2

    ( ) ( )

    t

    x

    k

    c

    t

    x t

    =

    =

    22

    00633.0

    n

    i

    n

    i

    n

    i

    n

    i

    n

    i ppppp =+ ++

    ++

    +

    11

    1

    11

    1 2

    n

    i

    n

    i

    n

    i

    n

    i pppp =++ +

    ++

    +

    1

    1

    11

    1 )2(Dr. Do Quang Khanh23

  • 8/9/2019 Unit9 PDEs

    24/34

    HCMUT

    Boundary Conditions

    We must specify the conditions of the left and rightboundaries

    constant pressure pi= const (I = 1 or n)

    constant rate

    constxppor

    constxppexamplefor

    boundaryflownoaisx

    p

    constx

    prateSpecity

    NN =

    =

    =

    =

    1

    12

    ,

    ,

    ""0

    :

    Dr. Do Quang Khanh 24

  • 8/9/2019 Unit9 PDEs

    25/34

    HCMUT

    ( ) ni

    n

    i

    n

    i

    n

    i pppp =++ +

    +++

    1

    1

    11

    1 2

    valueleftgivenpn 11 =+

    valuerightgivenpnnx 1

    =+

    =

    5

    4

    3

    2

    1

    5

    4

    3

    2

    1

    55

    444

    333

    222

    11

    d

    d

    d

    d

    d

    x

    x

    x

    x

    x

    ba

    cba

    cba

    cba

    cb

    Thomas algorithm

    System of Equations

    Dr. Do Quang Khanh25

  • 8/9/2019 Unit9 PDEs

    26/34

    HCMUT

    Thomas Algorithm

    =

    5

    4

    3

    2

    1

    5

    4

    3

    2

    1

    55

    444

    333

    222

    11

    d

    d

    d

    d

    d

    x

    x

    x

    x

    x

    ba

    cba

    cba

    cba

    cb

    The problem Ax=b can be solved very efficientlywhen A is a tridiagonal matrix. The matrix itself is not

    stored. Only three vectors a,b and c are stored.

    These hold the values on the matrix diagonals.

    Dr. Do Quang Khanh26

  • 8/9/2019 Unit9 PDEs

    27/34

    HCMUT

    Sub Thomas(a() As Double, b() As Double, c() As Double, _d() As Double, x() As Double)

    'Tridiagonal system of equationsDim n As Integer, i As Integern = UBound(b)ReDim w(n) As Double, g(n) As Doublew(1) = b(1)g(1) = d(1) / w(1)For i = 2 To n

    w(i) = b(i) - a(i) * c(i - 1) / w(i - 1)g(i) = (d(i) - a(i) * g(i - 1)) / w(i)Next ix(n) = g(n)For i = n - 1 To 1 Step -1x(i) = g(i) - c(i) * x(i + 1) / w(i)

    Next i

    End Sub

    n : int, inp

    a(n) : real, inp b(n) : real, inp c(n) : real, inp d(n) : real, inp

    x(n) : real, out

    Dr. Do Quang Khanh27

  • 8/9/2019 Unit9 PDEs

    28/34

    HCMUT

    Sub VBA111()' Linear reservoir: constant pressures at the two end pointsDim nx As Integer, nt As Integer, ipr As Integer

    'Input

    ReDim a(nx) As Double, b(nx) As Double, c(nx) As DoubleReDim d(nx) As Double, p(nx) As Double'

    dx = xlen / (nx - 1)dt = tend / ntalpha = phi * mu * ct / (0.00633 * k) * dx ^ 2 / dt

    'Initializationt = 0

    'Time stepsFor it = 1 To nt

    'make a, b, c, d,Call Thomas(a, b, c, d, p)Next it

    End With

    End Sub

    ProgramS

    tructure

    Dr. Do Quang Khanh28

  • 8/9/2019 Unit9 PDEs

    29/34

    HCMUT

    Explicit Solution Scheme

    Discretize the region of interest

    Discretize the diffusivity equation

    Central difference in space Forward difference in time

    ( ) ( )

    k

    cwhere

    ppt

    xppp

    t

    ninininini

    00633.0

    2 1

    2

    11

    =

    =+ +

    +

    Dr. Do Quang Khanh29

  • 8/9/2019 Unit9 PDEs

    30/34

    HCMUT

    Finite Difference Template

    t

    t

    t

    t

    xxx x

    i-1 i i+1

    1

    n

    n+1

    Dr. Do Quang Khanh30

  • 8/9/2019 Unit9 PDEs

    31/34

    HCMUT

    Explicit Solution

    Explicit equations

    Left boundary (i = 1)

    Interior points (i = 2,,nx-1)

    Right boundary (i = nx)

    valueleftgivenp1

    =(or no flow)

    ( ) 111 2 ++

    + ni

    n

    i

    n

    i

    n

    i pppp

    valuerightgivenp 1nnx =+ (or no flow)

    Dr. Do Quang Khanh31

  • 8/9/2019 Unit9 PDEs

    32/34

    HCMUT

    Stability

    Implicit: stableExplicit: at less than 2 it is unstable!

    Ex: What is the maximum timestep thatwe can take with the explicit FDEfor thefollowing data:

    Dr. Do Quang Khanh32

  • 8/9/2019 Unit9 PDEs

    33/34

  • 8/9/2019 Unit9 PDEs

    34/34

    HCMUT

    Linear Reservoir with Const. Press. Boundaries:

    Suppose we have a sand packed core container 20ftlong. We pressure it with air at 100 psia. Then we openvalve on both ends to the atmospheric pressure, 14.7psia. Consider the finite difference equation for this

    flow problem in the following form:

    Suppose we are using 5 grid points with a grid point oneach end. Fill in the table of the matrix coefficients and

    right hand side for the first timestep. Include theproper boundary conditions. Use exact values whereyou can, but use the math symbols elsewhere.

    Dr Do Quang Khanh34

    ASSIGNMENTS, TEST PROBLEMS

    )(2 11111

    1

    n

    i

    n

    i

    n

    i

    n

    i

    n

    i ppppp =+ ++

    ++

    +


Recommended