CAAM452Lecture8(1)

Embed Size (px)

Citation preview

  • 7/28/2019 CAAM452Lecture8(1)

    1/43

    Numerical Methods for Partial

    Differential Equations

    CAAM 452

    Spring 2005

    Lecture 8

    Instructor: Tim Warburton

  • 7/28/2019 CAAM452Lecture8(1)

    2/43

    CAAM 452 Spring 2005

    Recall: Convergence Conditions for

    LMM Time-stepping Methods

    i. Establish that a unique solution to the ODE exists via Picardstheorem (http://mathworld.wolfram.com/PicardsExistenceTheorem.html)

    ii. For time stepping Dahlquists Equivalence Theorem tells us that

    a linear multistep time-stepping formula is convergent if and

    only if it is consistent and stable

    iii. We can easily verify consistency by using Taylor expansions for

    the local truncation error.

    iv. We check stability conditions by finding roots of the stability

    polynomial.

    v. A global error analysis tells us that if the right hand side functionis sufficiently smooth (p times continuously differentiable), and

    the LMM is stable with local truncation error then the

    error at a fixed time converges as

    pO dt

    1pO dt

    http://mathworld.wolfram.com/PicardsExistenceTheorem.htmlhttp://mathworld.wolfram.com/PicardsExistenceTheorem.html
  • 7/28/2019 CAAM452Lecture8(1)

    3/43

    CAAM 452 Spring 2005

    Consistency of Finite Difference Operator

    Definition:

    A finite difference operatoris consistent if it converges

    towards the continuous operator of the PDE as bothdt0 and dx0

  • 7/28/2019 CAAM452Lecture8(1)

    4/43

    CAAM 452 Spring 2005

    Example:

    Euler-Forward + Right Difference

    The finite difference method is:

    We define the local truncation error as the operator which

    maps the actual solution of the PDE to the correction

    required to make it satisfy the scheme at each time step:

    1n n

    nm mmu u c u

    dt

    1

    2 2*

    2

    2 2*

    2

    , ,,

    1

    , ,2!

    , ,2!

    n m n m n

    m m n

    m n m n

    m n m n

    u x t u x t T u c u x t

    dt

    u dt u

    dt x t x t dt t t

    c u dx udx x t x t

    dx x x

    O dt O dx

  • 7/28/2019 CAAM452Lecture8(1)

    5/43

    CAAM 452 Spring 2005

    Quick Note

    Notice that in the definition of the LTE for the finitedifference scheme we have not multiplied through

    by dt (since that would bias the LTE with respect to

    dt)

    In this example the scheme is said to be first ordermethod accurate in both time and space.

    1, , ,n m n m nm m nu x t u x t T u c u x t dt

    O dt O dx

  • 7/28/2019 CAAM452Lecture8(1)

    6/43

    CAAM 452 Spring 2005

    Second Example(Leap Frog in Time and 4th Order Central in Space)

    Here we use the fourth order central differencing inspace and Leap Frog in time:

    The truncation error in this case is:

    Thus we declare the method accuracy to be 2nd

    order in time and 4th order in space.

    1 1 2

    4 0 12 6

    n nn nm mm m

    u u dxc u c u

    dt

    1 1

    4

    2 3 4 5*

    5

    2

    *

    3

    4

    , ,,

    2

    48, ,6 5!

    n m n m n

    m m n

    m n m n

    O

    u x t u x t T u c u x t

    dt

    dt u dx ux t c x tt

    O dt d

    x

    x

  • 7/28/2019 CAAM452Lecture8(1)

    7/43CAAM 452 Spring 2005

    cont

    In this case there is a discrepancy between themagnitude of the time stepping error and the spatial

    error.

    Using this scheme may require a smaller time step

    than dx to ensure that the truncation errors for each

    part are of similar size.

  • 7/28/2019 CAAM452Lecture8(1)

    8/43CAAM 452 Spring 2005

    Definition: Method Order Accuracy

    If the local truncation error satisfies:

    Then the method s order accurate in time and rthorder accurate in space.

    Again if there is a discrepancy between r and sthen it may be wise to consider reducing dt (if s

  • 7/28/2019 CAAM452Lecture8(1)

    9/43CAAM 452 Spring 2005

    Scheme Notation

    For brevity we will denote the linear finite differenceschemes:

    where the coefficients may depend on dt,dx as:

    then the scheme reads:

    1

    0

    j p j qn j n j

    j m j m

    j j r

    u c u

    1

    ,

    0

    j p j qn n j n j

    dt dx m j m j m

    j j r

    P u u c u

    ,0ndt dx mP u

  • 7/28/2019 CAAM452Lecture8(1)

    10/43CAAM 452 Spring 2005

    Stability

    Definition:

    A finite difference scheme for a first-order PDE is

    stable if there is an integer J and positive numbers dt0and dx0

    such that for any positive time T, there is a constant CT

    such that:

    ,0ndt dx mP u

    1 12 2

    0 0 0

    0 0

    for 0 ,0 and 0

    M J Mn j

    m T m

    m j m

    dx u C dx u

    ndt T dx dx dt dt

    i.e. for a scheme to be stable it must not increase the

    solution energy beyond some energy injected at the

    start of the time stepping.

  • 7/28/2019 CAAM452Lecture8(1)

    11/43CAAM 452 Spring 2005

    cont (norm notation)

    We define a discrete Euclidean norm on the discretesolution as:

    Then the stability condition is:

    Or equivalently:

    1

    0

    :

    or sometimes denoted by

    dx

    m M

    m m

    m

    h

    u dx u u

    u

    2

    0

    Jn j

    Tdx dxj

    u C u

    *

    0

    Jn j

    Tdx dxj

    u C u

  • 7/28/2019 CAAM452Lecture8(1)

    12/43CAAM 452 Spring 2005

    Well Posedness

    Definition:

    The initial value problem for a first-order PDE is well

    posed if the following holds for all initial data u(x,0)

    for some choice of norm (say with integration over

    the interval in x ) where the constant C(t) is

    independent of the solution.

    , ,0u x t C t u x

    2L

  • 7/28/2019 CAAM452Lecture8(1)

    13/43CAAM 452 Spring 2005

    Consequences of Well Posedness

    If a first order PDE is well posed, it satisfies ananalog of the numerical stability we have been

    seeking.

    There are two important consequences:

    two initial conditions which are almost everywhere

    identical will generate two solutions which are almosteverywhere identical.

    two solutions which start close together will remain

    close togetheralmost everywhere.

    , ,0u x t C t u x*

    0

    Jn j

    Tdx dx

    j

    u C u

  • 7/28/2019 CAAM452Lecture8(1)

    14/43CAAM 452 Spring 2005

    cont

    The following PDEs are well-posed

    2

    2

    3

    2

    2 2

    2

    u uc su

    t x

    u usu

    t x

    u u uc du

    t t x x

    u u ucu

    t t x x

  • 7/28/2019 CAAM452Lecture8(1)

    15/43CAAM 452 Spring 2005

    Convergence

    Definition:

    A one-step finite difference scheme approximating a PDE

    is a convergent scheme if for any solution to the PDE

    ,u(x,t), with solution to the finite difference scheme, ,such that converges to as m*dx converges tox,

    then converges to u(x,t) as (m*dx,n*dt) converges to

    (x,t) as (dt,dx) (0,0)

    n

    mu0

    mu 0u x

    n

    mu

  • 7/28/2019 CAAM452Lecture8(1)

    16/43CAAM 452 Spring 2005

    cont

    Convergence requires:

    for all solutions

    0

    0a) if as

    b) then , as ,

    when 0 0

    m

    n

    m

    u u x mdx x

    u u x t mdx x ndt t

    dt and dx

    0, with ,0u x t u x u x

  • 7/28/2019 CAAM452Lecture8(1)

    17/43CAAM 452 Spring 2005

    Lax-Richtmyer Equivalence Theorem

    Theorem:

    A consistent finite difference scheme for a partial

    differential equation for which the initial value problem

    is well-posed is convergent if and only if it is stable.

  • 7/28/2019 CAAM452Lecture8(1)

    18/43CAAM 452 Spring 2005

    Accuracy

    There is a technical issue in comparing the numericalsolution and the actual solution.

    For any specific resolution (choice of dt,dx) the

    numerical solution is defined at discrete points inspace and time.

    However, the actual solution to the PDE is defined

    over the entire interval.

    We now discuss how to compare these very different

    representations

  • 7/28/2019 CAAM452Lecture8(1)

    19/43CAAM 452 Spring 2005

    Solution Norms

    We will need to compare two solutions over theperiodic interval.

    We will use conventional L2 and slightly less

    conventional Hs,Sobolev, norms:

    Notice this Sobolev norm is constructed with

    respect to Fourier derivatives

    2

    2 2

    0

    22

    :

    : 1 s

    L

    L

    s

    H

    u dx u u dx

    u dx u

    A h 1) C S l ti With

  • 7/28/2019 CAAM452Lecture8(1)

    20/43CAAM 452 Spring 2005

    Approach 1) Compare Solution With

    Interpolated Numerical Solution

    In the first approach we compare the actual solutionand a trigonometric interpolation of the numerical

    solution.

    We find a Fourier sum which interpolates the

    numerical solution at the M data points.

    i.e. we form a Fourier series with uhat coefficients:

    21

    0

    1,

    jxMi

    n LM n j

    j

    I u x t u eM

  • 7/28/2019 CAAM452Lecture8(1)

    21/43CAAM 452 Spring 2005

    cont

    Where we demand that the interpolant agrees withthe vector of values of the numerical solution

    The interpolant is a map from discrete points to a

    function defined on the periodic interval, which we

    will denote as:

    21

    0

    1,

    mjxM in n L

    m M m n jj

    u I u x t u eM

    21 1

    0 0

    1jxM M

    in n L

    jk k

    j k

    Su u e

    M

    F

  • 7/28/2019 CAAM452Lecture8(1)

    22/43CAAM 452 Spring 2005

    Where Fis the discrete Fourier transform from Lecture 6

    Then a theorem indicating solution accuracy is:

    Theorem:

    If the initial value problem for a linear PDE (for which the initial value

    problem is well-posed), is approximated by a stable one-step finite

    difference scheme which is rth order method accurate in space and sth

    order in time (with r

  • 7/28/2019 CAAM452Lecture8(1)

    23/43CAAM 452 Spring 2005

    Approach 2) Compare Solution and

    Numerical Solution at Nodes

    It is trickier to perform a pointwise evaluation of thedifference between the numerical solution and the

    exact solution.

    The primary difficulty is that solutions in L2 are

    equivalent if they only differ on a set of measure

    zero.

    Since the set of data points is a set of measure

    zero the evaluation of an L2 solution at the points is

    not well defined.

  • 7/28/2019 CAAM452Lecture8(1)

    24/43CAAM 452 Spring 2005

    cont

    We rely on the following approximation result

    Theorem 1.3.4 GKO:

    Let u be a periodic function and assume that its Fourier

    coefficients satisfy:

    Then:

    where the norm is the sup norm.

    with 0, 1 mC

    u m

    1m

    Mu I u CCdx

    The assumption on the coefficients implies at least the mth order Fourier derivative exists.

  • 7/28/2019 CAAM452Lecture8(1)

    25/43

    CAAM 452 Spring 2005

    cont (sketch of convergence)

    With this estimate in hand:

    We consider:

    1m

    Mu I u CCdx

    ,

    ,

    ,

    ,

    , ,

    ,

    n

    m n m dx

    n

    n mM n M n dx

    n n n

    n M n M n m m mdx

    n n

    m m

    dx dx

    u x t u

    u t u

    u t I u t I u t v

    I u t I

    v u

    u t v v

    Bound by approximation estimate

    (assumes regularity of solution)

    Compare interpolant of solution

    and numerical solution started

    with M term series truncation of

    solution: nm

    v

  • 7/28/2019 CAAM452Lecture8(1)

    26/43

    CAAM 452 Spring 2005

    Sketch cont

    , ,,

    ,

    m n M m n

    n

    M m n m dx

    n n

    m m dx

    n

    x

    n

    m m dx

    dIu x t I u x t vu x t

    u x t u

    v u

    i. Bounded by approximation result

    ii. use well posedness to bound in

    terms of the initial data

    Bounded by approach 1 Bounded by

    stability of method

    and accuracy of

    initial condition

    Notice we use: regularity of the solution

    well posedness of the initial value problem

    comparison of interpolated numerical solution with solution

    stability of method

    accuracy of initial condition

  • 7/28/2019 CAAM452Lecture8(1)

    27/43

    CAAM 452 Spring 2005

    cont (final result)

    We are left with the final accuracy estimate theorem

    Theorem:

    If the initial value problem for a PDE for which the initial value

    problem is well posed, is approximated by a stable one-step

    finite difference scheme that is rth order in space and sth order

    in time with r

  • 7/28/2019 CAAM452Lecture8(1)

    28/43

    CAAM 452 Spring 2005

    Summary of Convergence Test for

    Finite Difference Schemes

    i. Is the PDE well posed (if in doubt look it up) ?

    ii. Is the finite-difference method stable ?

    i. use the method of lines

    ii. a standard time-stepping method has a known region of

    absolute stability bound for dt*maximum eigenvalue of

    the spatial operator

    iii. Is the finite-difference method consistent

    i. use a Taylor series to estimate the local truncation in both

    time and space

    iv. what is the method order of accuracy ?

    i. beware the case of low regularity initial data unbounded

    remainder terms from Taylor series analysis

    Finally, if the method order is p then the error analysis gives order p

    in the solution (assuming the solution has p bounded Fourier derivatives)

  • 7/28/2019 CAAM452Lecture8(1)

    29/43

    CAAM 452 Spring 2005

    Boundary Conditions

    We are now faced with the inevitable discussion ofhow to apply boundary conditions for a non-

    periodic domain.

    The advection equation only requires inflow data at

    the node

    nt

    3Mx 2Mx 1xx

    1Mx 0x

    advection directionM

    x

    Mx

  • 7/28/2019 CAAM452Lecture8(1)

    30/43

    CAAM 452 Spring 2005

    Example Right-Difference

    The obvious choice is to set the last node to be dxaway from the inflow boundary

    1

    inflow

    0,1,..., 1m m mm

    M

    du u uc u c m M dt dx

    u t u t

  • 7/28/2019 CAAM452Lecture8(1)

    31/43

    CAAM 452 Spring 2005

    System

    An example system for 10 data points this timelooks like:

    0 0 0

    1 1 1

    2 2 2

    9 9 9 in

    1 1

    1 1

    1 1

    1 1

    1 1

    1 1

    1 11 1

    1 1

    1

    u u u

    u u u

    u u u

    d d c cc

    dt dx dx dx

    u u u u

    flow

  • 7/28/2019 CAAM452Lecture8(1)

    32/43

    CAAM 452 Spring 2005

    Interim (summation by parts) Result

    First we define a discrete inner-product:

    and associated norm:

    Lemma (summation by parts formula):

    This looks very much like an integration by parts formula, but

    in this case with a discrete inner-product

    ,,

    m s

    r sr sm r

    u v dx u v

    2

    , ,,

    r s r su u u

    1 1, , ,, , , s s r rr s r s r su v u v dx u v u v u v

    E M th d f S i di t Diff A i ti

  • 7/28/2019 CAAM452Lecture8(1)

    33/43

    CAAM 452 Spring 2005

    Energy Method for Semi-discrete Difference Approximation

    of the Upwind Finite Difference Method

    We assume exact treatment of the time variableand 1st order upwind in the space derivative.

    The left hand side represents the time rate change

    of a numerical energy.

    2

    0, 1 0, 1

    0, 1 0, 1

    0, 1 0, 1

    0 00, 1

    ,

    , ,

    , ,,

    M M

    M M

    M M

    M MM

    d du u u

    dt dt

    du duu u

    dt dt

    c u u c u udxc u u c u u u u

  • 7/28/2019 CAAM452Lecture8(1)

    34/43

    CAAM 452 Spring 2005

    cont

    The right hand side indicates that the scheme is

    dissipative and the only source is from the inflow

    boundary condition.

    i.e. the total energy can only increase by input fromthe boundary condition

    2

    0 00, 1 0, 1

    2

    , M MM M

    M

    d u cdx u u c u u u udt

    c u

  • 7/28/2019 CAAM452Lecture8(1)

    35/43

    CAAM 452 Spring 2005

    cont

    Thus:

    we are certainly in good shape (see GKO p448 forgeneralization to discrete in time and space).

    The big but for this method is that it is first order in space

    A method of lines analysis reveals that all the eigenvalues ofthe homogeneous operator arec/dx and then we have torely on further results on the impact of lower order terms (inthis case the boundary condition contribution) on the

    stability of finite difference schemes

    2 2

    0, 1

    2 2 2

    inflow0, 1 0, 10

    0

    MM

    t

    M M

    d u c udt

    u t u c u d

  • 7/28/2019 CAAM452Lecture8(1)

    36/43

    CAAM 452 Spring 2005

    2nd Order Central + Boundary Conditions

    Consider the following semi-discrete scheme:

    We need special treatments for the two end points as the

    stencil extends beyond the end of the data.

    At the zero node we use the first order upwind condition:

    At the Mth node we supply the inflow data as before.

    0 for 1,2,..., 1

    0

    mm

    m m

    duc u m N

    dt

    u f x

    0 1 00

    du u uc u c

    dt dx

  • 7/28/2019 CAAM452Lecture8(1)

    37/43

    CAAM 452 Spring 2005

    System

    0 0 0

    1 1 1

    2 2 2

    9 9 9

    2 2

    1 0 1

    1 0 1

    1 0 1

    1 0 1

    1 0 12

    1 0 1

    1 0 1

    1 0 1

    1 0

    u u u

    u u u

    u u u

    d d cc

    dt dx dx

    u u u

    inflow

    2

    c

    dx

    u

  • 7/28/2019 CAAM452Lecture8(1)

    38/43

    CAAM 452 Spring 2005

    Interim (summation by parts) Result 2

    We define a modified discrete inner-product:

    and associated norm:

    Lemma (summation by parts formula with central differences):

    This looks very much like an integration by parts formula, but

    in this case with a discrete inner-product

    0 0 1, 1, : ,2 M Mdx Mdx

    u v u v u v u v

    2

    ,dx dxu u u

    0 0 1 1 1 1, ,1

    , , 2s s s s r r r r r s r su v u v u v u v u v u v

  • 7/28/2019 CAAM452Lecture8(1)

    39/43

    CAAM 452 Spring 2005

    Corollary

    Setting v=u

    This looks rather like a discrete analog of thedivergence theorem (or integration by parts).

    The end point evaluation is now approximated byan average of the end point and neighbor.

    0 0 1 1 1 1, ,

    0 0 1 1 1 1, ,

    1, ,

    2

    1, ,

    2

    s s s s r r r rr s r s

    s s s s r r r rr s r s

    u v u v u v u v u v u v

    u u u v u u u u u u u u

  • 7/28/2019 CAAM452Lecture8(1)

    40/43

    CAAM 452 Spring 2005

    Example 2: Energy Method

    The scheme:

    has an energy equation (in the tailored norm):

    0

    inflow

    0 1 0

    0

    for 1,2,..., 1

    0

    mm

    M

    m m

    du c u m N dt

    u u

    du u u

    c u cdt dx

    u f x

    22 2

    0Mdx

    du c u c u

    dt

    See GKO p452 for details

  • 7/28/2019 CAAM452Lecture8(1)

    41/43

    CAAM 452 Spring 2005

    Higher Order + Boundary Conditions

    It is possible to apply modification to the higher order

    central differences but it gets quite complicated.

    We will reserve higher order treatment of boundaryconditions for finite-element and discontinuousGalerkin where it is more straightforward toaccommodate boundary conditions (i.e. I havechickened out).

    For the interested, see GKO p474-484 for some nontrivial manipulations to the difference operators toaccommodate the boundary conditions in a stablemanner.

  • 7/28/2019 CAAM452Lecture8(1)

    42/43

    CAAM 452 Spring 2005

    Class Discussion

    i. Pros and cons of finite difference methodsi. ease of implementation in simple geometries

    ii. locality of derivatives

    iii. cheap!!!!!!!!!!

    iv. time stepping condition not generally artificially costly

    v. difficulty of implementing boundary conditionsvi. technical difficulties in analysis

    vii. spurious modes

    ii. Boundary conditionsi. using extra points at boundary

    ii. maintaining stabilityiii. one sided stencil interpolation

    iii. Geometryi. stair stepping in 2D,3D

    ii. embedded methods

    N L

  • 7/28/2019 CAAM452Lecture8(1)

    43/43

    Next Lecture

    Higher order PDEs 2D and 3D domains

    i.e. wrap up of finite-difference introduction.

    Preparation for finite-volume methods.