lecture 22 :initial value problems

Upload: junayed-hasan

Post on 04-Jun-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Lecture 22 :initial value problems

    1/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.1

    LECTURE 22

    MULTI STEP METHODS

    Solve the i.v.p.

    Multi step methods use information from several previous or known time levels INSERT FIGURE NO. 100

    dydt ------ f y t ,( )= y t o( ) yo=

    y

    t

    y0

    t 0 t 1 t 2 t 3 t 4

    y1

    y2 y3

    y4

  • 8/13/2019 Lecture 22 :initial value problems

    2/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.2

    Open Formulae (Adams-Bashforth)

    explicit (non-iterative)

    can have stability problems

    Closed Formulae (Adams-Moulton)

    implicit (iterative)

    much better stability properties than open formulae

    Predictor-Corrector Methods

    1 cycle predictor open formula

    2-3 cycles corrector closed formula

    superior to either open or closed formulae separately

  • 8/13/2019 Lecture 22 :initial value problems

    3/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.3

    Open Formulae

    Derivation

    Develop a forward Taylor series of about

    However by denition and etc., thus

    (1)

    Now replace the various derivatives of with backward difference approximations

    1st Order Accurate Adams Open Formula

    Retain only the rst two terms in Equation (1)

    Same as the explicit or 1 st order Euler method

    y t j

    y j 1+ y j t + y jt ( )22!

    ------------- y jt ( )33!

    ------------- y j + + +=

    y j f j= y j f j=

    y j 1+ y j t f jt 2!----- f j

    t ( )23!

    ------------- f j + + + +=

    f j

    y j 1+ y j t f y j t j,( )+=

  • 8/13/2019 Lecture 22 :initial value problems

    4/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.4

    2nd Order Accurate Adams Open Formula

    Use a backward difference approximation for

    Substituting we obtain:

    f j

    f j f j f j 1

    t ----------------------- t

    2----- f j O t ( )2+ +=

    y j 1+ y j t f jt 2

    ----- f j f j 1

    t ----------------------- t

    2----- f j O t ( )2+ + t ( )

    2

    3!------------- f j+ +

    +=

    y j 1+ y j t 32--- f j

    12--- f j 1

    512------ t ( )3 f j O t ( )4+ + +=

    y j 1+ y j t 32--- f j12--- f j 1 O t ( )3+ +=

    y j 1+ y j t32--- f y j t j,( )

    12--- f y j 1 t j 1,( ) O t( )3++=

  • 8/13/2019 Lecture 22 :initial value problems

    5/24

  • 8/13/2019 Lecture 22 :initial value problems

    6/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.6

    Example Application of 2nd Order Adams Open Formula

    Problem

    i.c. gives us ,

    Apply 2nd order R.K. (Improved Euler) to start the calculations

    Now we know ,

    dydt ------ f y t ,( )= y t o( ) yo=

    yo t o

    t 1 t o t +=

    y1 * yo t f yo t o,( )+=

    y1 yo t 12--- f yo t o,( ) f y1 * t 1,( )+[ ]+=

    y1 t 1

  • 8/13/2019 Lecture 22 :initial value problems

    7/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.7

    From time level to ; apply 2nd order Adams Open Formula

    Now we know ,

    From time level to ; apply 2nd order Adams Open Formula

    Now we know ,

    j 1= j 1+ 2=

    t 2 t 1 t +=

    y2 y1 t 32--- f y1 t 1,( )

    12--- f yo t o,( )+=

    y2 t 2

    j 2= j 1+ 3=

    t 3 t 2 t +=

    y3 y2 t 3

    2

    --- f y2 t 2,( )1

    2

    --- f y1 t 1,( )+=

    y3 t 3

  • 8/13/2019 Lecture 22 :initial value problems

    8/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.8

    INSERT FIGURE NO. 102

    y(t)

    t

    y0

    t 0 t 1 t 2 t 3

    y1 y2

    y3

    *

    2nd order R-K

    2nd order Adams Open

    2nd order Adams Open

    y1*

  • 8/13/2019 Lecture 22 :initial value problems

    9/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.9

    3rd Order Accurate Adams Open Formula

    Substitute into Equation (1) for and using rst order accurate approximationscarrying a sufcient number of truncation terms as

    Note that the local truncation term for equation (1) must be

    If you use rst order accurate approximations, you must carry a sufcientnumber of truncation terms in each approximation to the derivatives of , i.e. ,

    , etc.

    Alternatively you must use an approximation which in of itself is accurateenough such that the leading order truncation term substituted into equation (1)leads to a truncation term.

    Collecting terms we have:

    f j f j

    f j f j f j 1

    t ----------------------- t

    2----- f j O t ( )2+ +=

    f j f j 2 f j 1 f j 2+

    t ( )2--------------------------------------------- O t ( )+=

    O t ( )4

    f j

    f j

    O t ( )4

    y j 1+ y j t2312------ f y j t j,( )

    1612------ f y j 1 t j 1,( )

    512------ f y j 2 t j 2,( )+ O t( )4+ +=

  • 8/13/2019 Lecture 22 :initial value problems

    10/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.10

    INSERT FIGURE NO. 103A

    Method is third order accurate

    Need to start this method with 2 steps of a 3rd order accurate R.K. method

    i.c. gives ,

    R.K. starter gives , and ,

    Now we can use the 3rd order Adams Open Formula

    y(t)

    t t j-2 t j-1 t j t j+1

    y j-2

    y j-1

    y j y j+1

    yo t o

    y1 t 1 y2 t 2

  • 8/13/2019 Lecture 22 :initial value problems

    11/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.11

    Summary of Adams Open Formulae

    General form of all Adams Open formulae

    Formulae are explicit: is computed in terms of slope at , ,

    All higher order Adams formulae are not self starting (dont know , , etc.).

    Must start method with an appropriate order Runge-Kutta formula.

    Open formulae are more efcient than R.K. methods of the same order since slopecalculations at a given point are re-used for at least several time steps.

    Open formulae are very easy to implement

    Open formulae may have stability problems

    y j 1+ y j t f y j t j,( ) f y j 1 t j 1,( ) f y j 2 t j 2,( ) f y j 3 t j 3,( ) + + + +[ ]+=

    y j 1+ t j t j 1 t j 2 ,

    f 1 f 2

    f y t ,( )

  • 8/13/2019 Lecture 22 :initial value problems

    12/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.12

    Closed Formulae

    Derivation

    Use a backward Taylor Series expansion for about . Hence

    Noting that , , , etc.

    (2)

    Now substitute in backward difference approximations for the various derivatives ,

    , etc.

    y t ( ) y t t +( )

    y j y j 1+ t dy

    dt ------

    j 1+ t ( )

    2

    2!------------- d

    2 y

    dt 2--------

    j 1+

    t ( )3

    3!------------- d

    3 y

    dt 3--------

    j 1+

    + +=

    dydt ------

    j 1+

    f j 1+= d 2 y

    dt 2--------

    j 1+

    f j 1+= d 3 y

    dt 3--------

    j 1+

    f j 1+=

    y j y j 1+ t f j 1+t ( )22!

    ------------- f j 1+t ( )33!

    ------------- f j 1+ ++=

    y j 1+

    y j

    t f j 1+

    t 2

    ----- f j 1+

    t 23!

    -------- f j 1+

    ++=

    f j 1+

    f j 1+

  • 8/13/2019 Lecture 22 :initial value problems

    13/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.13

    First Order Accurate Adams Closed Formula

    Only consider the rst two terms in the backward Taylor series, Equation (2)

    Notes Hence we are computing our updated point using the slope of our updated point

    (versus the open formula where we used the old point to compute the slope)!

    Formula is implicit since computation of involves evaluating the slope at

    First and second order closed formulae are self starting while higher order closedformulae are not

    If is a linear function of we can solve for directly:

    e.g. Solve using the rst order Adams Closed Formula

    y j 1+ y j t f y j 1+ t j 1+,( ) O t( )2+ +=

    y j 1+

    f y j 1+ t j 1+,( )

    f y t ,( ) y y

    dydt ------ y t 3+=

    y j 1+ y j t y j 1+ t j 1+3+( )+=

  • 8/13/2019 Lecture 22 :initial value problems

    14/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.14

    If is a nonlinear function of we must iterate to get a solution

    e.g. Solve using the First Order Adams Closed Formula

    Establish an iterative solution

    Note that this 1st order closed formula is self starting

    y j 1+ 1 t ( ) y j t t j 1+3+=

    y j 1+1

    1 t ( )------------------- y j t t j 1+3+[ ]=

    f y t ,( ) ydydt ------ y2 t 3+=

    y j 1+

    y j

    t y j 1+

    2 t j 1+

    3+( )+=

    y j 1+k 1+( ) y j t y j 1+k ( )( )2 t j 1+3+[ ]+=

  • 8/13/2019 Lecture 22 :initial value problems

    15/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.15

    2nd Order Accurate Adams Closed Formulae

    Approximate using a rst order backward difference approximation:

    Substituting into Equation (2) and collecting terms yields a locally 3rd and globally 2ndorder method:

    INSERT FIGURENO. 103B

    f j 1+

    f j 1+ f j 1+ f j

    t ----------------------- O t ( )+=

    y j 1+ y jt 2

    ----- f j 1+ f j+[ ] O t ( )3+ +=

    y j 1+ y j t1

    2--- f y j 1+ t j 1+,( ) f y j t j,( )+[ ] O t( )3+ +=

    y(t)

    t t j t j+1

    y j

    y j+1

  • 8/13/2019 Lecture 22 :initial value problems

    16/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.16

    Notes

    Formula is implicit, i.e. involves calculating

    Same as trapezoidal rule or Crank-Nicolson Slope is averaged between the old time level and the new time level

    INSERT FIGURE NO. 104

    Must iterate if is nonlinear in

    Formula is self starting

    y j 1+ f y j 1+ t j 1+,( )

    j 1+

    f j+1

    j+1 j

    f j

    y

    t

    f y t ,( ) y

  • 8/13/2019 Lecture 22 :initial value problems

    17/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.17

    3rd Order Accurate Adams Closed Formula

    INSERT FIGURE NO. 105

    Notes

    Formula derived by taking Equation (2) and substituting backward nite differenceapproximations for and .

    y j 1+ y j t5

    12------ f y j 1+ t j 1+,( )

    812------ f y j t j,( )

    112------ f y j 1 t j 1,( )+ O t( )4+ +=

    y(t)

    t t j-1 t j t j+1

    y j-1

    y j

    y j+1

    f j 1+ f j 1+

  • 8/13/2019 Lecture 22 :initial value problems

    18/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.18

    Difference approximations used in the derivation must be of sufcient accuracy! Youcan either:

    Apply rst order approximations and carry a sufcient number of truncationterms

    Apply higher order accurate approximations

    Either way, all truncated terms must be consistently !

    Formula is implicit since it involves computing using the slope

    Must iterate if is nonlinear

    Formula is third order accurate

    This formula and all closed formulae of 3rd order or higher accuracy are not self starting must use R.K. methods of equal or better order accuracy as starters

    It can be costly to iterate try to get a good rst guess for

    try

    another rst estimate could be obtained by using an open formula to computePredictor-Corrector Methods

    O t ( )4

    y j 1+ f y j 1+ t j 1+,( )

    f y t ,( )

    y j 1+0( )

    y j 1+0( ) y j

    y j 1+0( )

  • 8/13/2019 Lecture 22 :initial value problems

    19/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.19

    Predictor-Corrector Methods

    Provide a rst estimate for the new solution using an open formula Predictor

    Apply a closed formula using as an initial estimate to start the iteration

    Corrector. Only need a few iterations since initial guess is very good!

    Require that order of the corrector the order of the predictor

    Advantages of P-C methods

    Few iterations are required due to the excellent rst guess Stability properties are controlled by the corrector! Correctors or closed formulae

    have excellent stability properties.

    Error estimates are easy to obtain

    If needed, use R.K. single step methods as starters

    P-C methods overall are very efcient and are often used in production codes

    y j 1+0( )

    y j 1+0( )

  • 8/13/2019 Lecture 22 :initial value problems

    20/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.20

    Example

    Predictor: 4th order Adams Open

    Corrector: 4th order Adams Closed

    When has converged specied value

    Must start the method if higher than 2nd order starter

    Accuracy of the starter must be equal or better than the corrector

    Need to obtain values of and for the rst three steps beyond the i.c. ( , , ,with corresponding s such that the predictor can be used)

    Thus, in this case we would have taken 3 starter steps to obtain , and using atleast a 4th order accurate R.K.

    y j 1+0( ) y j t

    5524------ f y j t j,( )

    5924------ f y j 1 t j 1,( )

    3724------ f y j 2 t j 2,( )

    924------ f y j 3 t j 3,( )++=

    y j 1+k 1+( ) y j t

    924------ f y j 1+

    k ( ) t j 1+,( )1924------ f y j t j,( )

    524------ f y j 1 t j 1,( )

    124------ f y j 2 t j 2,( )+++=

    y j 1+k 1+( ) y j 1+k 1+( ) y j 1+k ( ) y j 1+ k 1+( ) y j 1+

    y yo y1 y2 y3

    y1 y2 y3

  • 8/13/2019 Lecture 22 :initial value problems

    21/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.21

    Improve the initial value for the corrector by estimating the truncation error of thepredictor modier

    where

    will be the value used to start the corrector

    = the value from the predictor

    = the nal solution (converged corrector solution) for the previous time step

    = the unmodied predictor value from the previous time step

    Estimate of the error in predictor comes from comparing the error series for thepredictor and the corrector

    The varies depending on the method!

    y j 1+0( ) y j 1+

    0( ) y j y j0( )( )+=

    y j 1+0( )

    y j 1+0( )

    y j

    y j0( )

  • 8/13/2019 Lecture 22 :initial value problems

    22/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.22

    Estimate for the truncation error of the corrector total truncation error per time step(not total solution error)

    allows modication of time step to obtain the desired accuracy

    i.e. you can estimate whether to increase/decrease )

    Summary of the steps in a P-C procedure

    (1) Use Starter for only the rst few time steps

    (2) Apply the Predictor

    (3) Apply the Modier

    (4) Apply the Corrector and iterate to a specied tolerance

    (5) Repeat step (2)

    E j 1+ 1 ( ) y j 1+ y j 1+0( )( )=

    t

    t

  • 8/13/2019 Lecture 22 :initial value problems

    23/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.23

    Implementation of Changes in Time Step

    Change time step from to

    INSERT FIGURE NO. 106

    If the formula contains only and no problem

    If formula contains there is a problem since you dont know the value of thesolution at

    Options:

    Use R.K. method to start up method from the time level where you change the timestep, i.e. time level

    Use a polynomial interpolator to get an actual continuous function of functionalvalues behind for some distance

    t 1 t 2

    j-1

    t 1

    t 2

    j j+1

    j 1+

    j 1 y t j 1

    t j

  • 8/13/2019 Lecture 22 :initial value problems

    24/24

    CE 341/441 - Lecture 22 - Fall 2004

    p. 22.24

    Comments Predictor-Corrector Methods

    For most problems P-C method uses less computer time than R.K. methods of the sameorder

    Many predictors have poor stability characteristics

    Unstable predictor stability has only one time step to be unstable before it isimproved by the corrector

    Hence it is important to have a stable corrector however many of the correctorshave very good stability characteristics!