Docsity

Runge 2nd Order Method - Numerical Methods - Lecture Slides, Slides of Mathematical Methods for Numerical Analysis and Optimization

Partial preview of the text

Download Runge 2nd Order Method - Numerical Methods - Lecture Slides and more Slides Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Runge 2

nd

Order Method

Runge-Kutta 2

nd

Order Method

f ( x , y ), y ( 0 ) y 0

dx

dy

Runge Kutta 2nd order method is given by

y i + 1 = yi + ( a 1 k 1 + a 2 k 2 ) h

where

k 1 = f ( xi , yi )

k (^) 2 = f^ (^ xi + p 1 h , yi + q 11 k 1 h )

For

Midpoint Method

Here a 2 = 1 is chosen, giving

a 1 = 0

p 1 =

2

1 q 11 =

resulting in

y (^) i + 1 = yi + k 2 h

where

k 1 = f ( xi , yi )

k (^) 2 = f xi + h yi + k 1 h 2

Ralston’s Method

Here

3

2

a 2 = is chosen, giving

a 1 =

4

3 p 1 =

q 11 =

resulting in

y i yi k k  h

where

k 1 = f ( xi , yi )

k (^) 2 = f xi + h yi + k 1 h 4

Example

A ball at 1200K is allowed to cool down in air at an ambient temperature

of 300K. Assuming heat is lost only due to radiation, the differential

equation for the temperature of the ball is given by

( ) ( ) K

dt

d

  1. 2067 10 81 10 , 0 1200

12 4 8 =− × θ − × θ =

θ (^) −

Find the temperature at t^ =^480 seconds using Heun’s method. Assume a step size of

h = (^240) seconds.

12 4 8 =− 2. 2067 × 10 θ − 81 × 10

θ (^) −

dt

d

12 4 8 , θ =− 2. 2067 × 10 θ − 81 × 10 − f t

i i k k ^ h

Solution

Step 1: (^) i 0 , t 0 , ( 0 ) 1200 K

( )

( )

12 4 8

1 0

=− × − ×

−

f

k f t θ o (^ )

( ( ) )

( )

12 4 8

2 0 0 1

=− × − ×

−

f

f

k f t h θ kh

( ) ( )

( )

K

k k h

1 0 1 2

θ =θ + +

Solution Cont

The exact solution of the ordinary differential equation is given by the

solution of a non-linear equation as

  1. 8519 tan ( 0. 0033333 ) 0. 22067 10 2. 9282

0. 92593 ln

1 3

− =− × −

θ t θ

θ

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

θ( 480 )= 647. 57 K

Comparison with exact results

0

400

800

1200

0 100 200 300 400 500

Time, t(sec)

Temperature,

θ(K)

Exact h=

h=

h=

Figure 2. Heun’s method results for different step sizes

Effects of step size on Heun’s Method

0

200

400

600

800

0 100 200 300 400 500 Step size, h

Temperature,

θ(480)

Figure 3. Effect of step size in Heun’s method

Step size,

h

θ(480)

Euler Heun Midpoint Ralston

480

240

120

60

30

−987.

−393.

Comparison of Euler and Runge-Kutta 2

nd

Order Methods

θ( 480 ) = 647. 57 K

Table 2. Comparison of Euler and the Runge-Kutta methods

(exact)

Comparison of Euler and Runge-Kutta 2

nd

Order Methods

500

600

700

800

900

1000

1100

1200

0 100 200 300 400 500 600

Time, t (sec)

Temperature,

Analytical

Ralston

Midpoint

Euler

Heun

θ(K)

Figure 4. Comparison of Euler and Runge Kutta 2nd^ order methods with

exact results.