runge kutta.pptx

Upload: mohammad-rameez

Post on 04-Apr-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 runge kutta.pptx

    1/22

    RUNGE-KUTTA 4TORDER

    Presented by

    M.Saravanakum

  • 7/29/2019 runge kutta.pptx

    2/22

    The solution of a differential equation using higher

    order derivatives of the Taylor expansion is notpractical.

    Since for only the simplest functions, these higherorders are complicated. Also there is no simplealgorithm which can be developed.

    This is because each series expansion is unique.

  • 7/29/2019 runge kutta.pptx

    3/22

    However we have methods which use only 1st orderderivates while simulating higher order(producingequivalent results).

    These one step methods are called Runge-Kuttamethods.

    Approximation of the second, third and fourthorder (retaining h2, h3, h4 respectively in the Taylexpansion) require estimation at 2, 3 , 4 ptsrespectively in the interval (xi,xi+1).

  • 7/29/2019 runge kutta.pptx

    4/22

    The Runge-Kutta methods have algorithms of the

    form,

    where is the increment function.

    The increment function is a suitably chosenapproximation to on the interval

    hyxhyy iiii ,,1

    yxf ,

  • 7/29/2019 runge kutta.pptx

    5/22

    Fourth Order Runge-Kutta Method The fourth order Runge-Kutta (RK-4) method is derived by applying th

    1/3 or Simpsons 3/8 rule to integrating over the interval

    formula of RK-4 based on the Simpsons 1/3 is written as

    ),(' tyfy ,[ nt

    ),(

    )2

    ,(

    )2

    ,(

    ),(where

    226

    1

    34

    221

    3

    121

    2

    1

    43211

    htkyhfk

    htkyhfk

    htkyhfk

    tyhfk

    kkkkyy

    nn

    nn

    nn

    nn

    nn

  • 7/29/2019 runge kutta.pptx

    6/22

    The 4th Order Runge-KuttaThis is a fourth order function that solvesan initial value problems using a four step

    program to get an estimate of the Taylor

    series through the fourth order.

    This will result in a local error of O(Dh5

    )and a global error of O(Dh4)

  • 7/29/2019 runge kutta.pptx

    7/22

    4th-orderRunge-Kutta Method

    xi xi + h/2 xi + h

    f1

    f2

    f3

    f4

    4321 226

    1fffff

    f

  • 7/29/2019 runge kutta.pptx

    8/22

    Runge-Kutta Method(4th Order) Example

    Consider Exact Solution

    The initial condition is:

    The step size is:

    2xydx

    dy

    x222 exxy

    10 y

    1.0h

  • 7/29/2019 runge kutta.pptx

    9/22

    The 4th Order Runge-KuttaThe example of a single step:

    104829.1226

    1

    109499.0104988.1,1.01.0,

    10.02/.1,05.01.02

    1,

    2

    1

    10475.005.1,05.01.02

    1,

    2

    1

    1.0011.01,01.0,

    4321n1n

    34

    223

    12

    21

    kkkkyy

    fkyhxfhk

    kfkyhxfhk

    fkyhxfhk

    fyxfhk

  • 7/29/2019 runge kutta.pptx

    10/22

    Runge-Kutta Method (4th Order)Example

    The values for the 4th order Runge-Kutta method

    x y f(x,y) k 1 f2 k 2 f3 k 3 f4 k 4 Exact

    0 1 1 0.1 1.0475 0.10475 1.049875 0.104988 1.094988 0.109499 1

    0.1 1.104829 1.094829 0.109483 1.13707 0.113707 1.139182 0.113918 1.178747 0.117875 1.104829

    0.2 1.218597 1.178597 0.11786 1.215027 0.121503 1.216848 0.121685 1.250282 0.125028 1.218597

    0.3 1.340141 1.250141 0.125014 1.280148 0.128015 1.281648 0.128165 1.308306 0.130831 1.340141

    0.4 1.468175 1.308175 0.130817 1.331084 0.133108 1.332229 0.133223 1.351398 0.13514 1.468175

    0.5 1.601278 1.351278 0.135128 1.366342 0.136634 1.367095 0.13671 1.377988 0.137799 1.601279

    0.6 1.73788 1.37788 0.137788 1.384274 0.138427 1.384594 0.138459 1.38634 0.138634 1.737881

    0.7 1.876246 1.386246 0.138625 1.383059 0.138306 1.382899 0.13829 1.374536 0.137454 1.876247

    0.8 2.014458 1.374458 0.137446 1.360681 0.136068 1.359992 0.135999 1.340457 0.134046 2.014459

    0.9 2.150396 1.340396 0.13404 1.314915 0.131492 1.313641 0.131364 1.28176 0.128176 2.150397

    1 2.281717 1.281717 0.128172 1.243303 0.12433 1.241382 0.124138 1.195855 0.119586 2.281718

  • 7/29/2019 runge kutta.pptx

    11/22

    Runge-Kutta Method (4th Order)Example

    A comparison between the 2nd

    order andthe 4th order Runge-Kutta methods show aslight difference.

    Runge Kutta Comparison

    -10

    -8

    -6

    -4

    -2

    0

    2

    4

    0 1 2 3 4

    X Value

    YValue

    Exact

    2nd order

    4th order

    Error of the Methods

    0.00

    2.00

    4.00

    6.00

    8.00

    10.00

    0 1 2 3 4

    X Value

    Absolute|Error|

    Error 2nd order method

    Error 4th order method

  • 7/29/2019 runge kutta.pptx

    12/22

    Example-1

    A ball at 1200K is allowed to cool down in air at an ambienttemperature of 300K. Assuming heat is lost only due to radiation, the

    differential equation for the temperature of the ball is given by

    Kdt

    d12000,1081102067.2 8412

    Find the temperature at480

    t seconds using Runge-Kutta 4

    th

    order method.

    240h seconds.

    8412 1081102067.2 dt

    d

    8412 1081102067.2, tf

    Assume a step size of

    hkkkkii 43211 226

    1

  • 7/29/2019 runge kutta.pptx

    13/22

    Solution

    Step 1: 1200)0(,0,0 00 ti

    5579.410811200102067.21200,0, 841201 ftfk o

    38347.0108105.653102067.205.653,120

    2405579.42

    11200,240

    2

    10

    2

    1,

    2

    1

    8412

    1002

    f

    fhkhtfk

    8954.310810.1154102067.20.1154,120

    24038347.02

    11200,240

    2

    10

    2

    1,

    2

    1

    8412

    2003

    f

    fhkhtfk

    0069750.0108110.265102067.210.265,240240984.31200,2400,

    8412

    3004

    f

    fhkhtfk

  • 7/29/2019 runge kutta.pptx

    14/22

    Solution Cont

    1 is the approximate temperature at

    240240001 httt

    K65.675240 1

    K

    hkkkk

    65.675

    2401848.26

    11200

    240069750.08954.3238347.025579.46

    11200

    226

    1432101

  • 7/29/2019 runge kutta.pptx

    15/22

    Solution Cont

    Step 2: Kti 65.675,240,1 11

    44199.0108165.675102067.265.675,240, 8412111 ftfk

    31372.0108161.622102067.261.622,360

    24044199.02

    165.675,240

    2

    1240

    2

    1,

    2

    1

    8412

    1112

    f

    fhkhtfk

    34775.0108100.638102067.200.638,360

    24031372.02

    165.675,240

    2

    1240

    2

    1,

    2

    1

    8412

    2113

    f

    fhkhtfk

    25351.0108119.592102067.219.592,48024034775.065.675,240240,

    8412

    3114

    f

    fhkhtfk

  • 7/29/2019 runge kutta.pptx

    16/22

    Solution Cont

    2

    is the approximate temperature at

    48024024012 htt

    K91.594480 2

    K

    hkkkk

    91.594

    2400184.26

    165.675

    24025351.034775.0231372.0244199.06

    165.675

    2261 432112

  • 7/29/2019 runge kutta.pptx

    17/22

    Solution Cont

    The exact solution of the ordinary differential equation is given by tsolution of a non-linear equation as

    9282.21022067.000333.0tan8519.1300

    300ln92593.0 31

    t

    The solution to this nonlinear equation at t=480 seconds is

    K57.647)480(

  • 7/29/2019 runge kutta.pptx

    18/22

    Comparison with exact results

    Figure . Comparison of Runge-Kutta 4th order method with exact solutio

    -400

    0

    400

    800

    1200

    1600

    0 200 400 600

    Time,t(sec)

    Temperature,

    h=120

    Exact

    h=240

    h=480

    (K)

  • 7/29/2019 runge kutta.pptx

    19/22

    Step size, h (480) Et |t|%

    480

    240120

    60

    30

    90.278

    594.91646.16

    647.54

    647.57

    737.85

    52.6601.4122

    0.033626

    0.00086900

    113.94

    8.13190.21807

    0.0051926

    0.00013419

    Effect of step size

    Table 1. Temperature at 480 seconds as a function of step size

    K57.647)480( (exact)

  • 7/29/2019 runge kutta.pptx

    20/22

    Effects of step size on Runge-Kutta 4th

    Method

    Figure . Effect of step size in Runge-Kutta 4th order method

    -200

    0

    200

    400

    600

    800

    0 100 200 300 400 500

    Step size, h

    Te

    mperature,

    (480)

  • 7/29/2019 runge kutta.pptx

    21/22

    Summary Runge Kutta methods generate an accurate solution

    without the need to calculate high order derivatives Second order RK have local truncation error of orde

    O(h3) and global truncation error of order O(h2).

    Higher order RK have better local and globaltruncation errors.

    N function evaluations are needed in the Nth order Rmethod.

  • 7/29/2019 runge kutta.pptx

    22/22

    THANK YOU