runge 2 nd order method

19
06/28/22 http:// numericalmethods.eng.usf.edu 1 Runge 2 nd Order Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker http://numericalmethods.eng.u sf.edu Transforming Numerical Methods Education for STEM Undergraduates

Upload: xerxes

Post on 19-Mar-2016

40 views

Category:

Documents


0 download

DESCRIPTION

Runge 2 nd Order Method. Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker http://numericalmethods.eng.usf.edu Transforming Numerical Methods Education for STEM Undergraduates. Runge-Kutta 2 nd Order Method http://numericalmethods.eng.usf.edu. Runge-Kutta 2 nd Order Method. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Runge 2 nd  Order Method

04/24/23http://

numericalmethods.eng.usf.edu 1

Runge 2nd Order Method

Major: All Engineering Majors

Authors: Autar Kaw, Charlie Barker

http://numericalmethods.eng.usf.eduTransforming Numerical Methods Education for STEM

Undergraduates

Page 2: Runge 2 nd  Order Method

Runge-Kutta 2nd Order Method

http://numericalmethods.eng.usf.edu

Page 3: Runge 2 nd  Order Method

http://numericalmethods.eng.usf.edu3

Runge-Kutta 2nd Order Method

Runge Kutta 2nd order method is given by

hkakayy ii 22111

where ii yxfk ,1

hkqyhpxfk ii 11112 ,

For 0)0(),,( yyyxfdxdy

Page 4: Runge 2 nd  Order Method

http://numericalmethods.eng.usf.edu4

Heun’s Method

x

y

xi xi+1

yi+1, predicted

yi

Figure 1 Runge-Kutta 2nd order method (Heun’s method)

hkyhxfSlope ii 1,

iiii yxfhkyhxfSlopeAverage ,,21 1

ii yxfSlope ,

Heun’s method

21

1 a

11 p

111 q

resulting inhkkyy ii

211 2

121

where ii yxfk ,1

hkyhxfk ii 12 ,

Here a2=1/2 is chosen

Page 5: Runge 2 nd  Order Method

http://numericalmethods.eng.usf.edu5

Midpoint MethodHere 12 a is chosen, giving

01 a

21

1 p

21

11 q

resulting inhkyy ii 21

where ii yxfk ,1

hkyhxfk ii 12 2

1,21

Page 6: Runge 2 nd  Order Method

http://numericalmethods.eng.usf.edu6

Ralston’s MethodHere

32

2 a is chosen, giving

31

1 a

43

1 p

43

11 q

resulting inhkkyy ii

211 3

231

where ii yxfk ,1

hkyhxfk ii 12 4

3,43

Page 7: Runge 2 nd  Order Method

http://numericalmethods.eng.usf.edu7

How to write Ordinary Differential Equation

Example

50,3.12 yeydxdy x

is rewritten as

50,23.1 yyedxdy x

In this case

yeyxf x 23.1,

How does one write a first order differential equation in the form of

yxfdxdy ,

Page 8: Runge 2 nd  Order Method

http://numericalmethods.eng.usf.edu8

ExampleA 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

Kdtd 12000,1081102067.2 8412

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

240h seconds.

8412 1081102067.2

dtd

8412 1081102067.2, tf

hkkii

211 2

121

Page 9: Runge 2 nd  Order Method

http://numericalmethods.eng.usf.edu9

SolutionStep 1: Kti 1200)0(,0,0 00

5579.4

10811200102067.2

1200,0,

8412

01

ftfk o

017595.0

108109.106102067.2

09.106,2402405579.41200,2400

,

8412

1002

ff

hkhtfk

K

hkk

16.6552402702.21200

240017595.0215579.4

211200

21

21

2101

Page 10: Runge 2 nd  Order Method

http://numericalmethods.eng.usf.edu10

Solution ContStep 2: Khtti 16.655,2402400,1 101

38869.0

108116.655102067.2

16.655,240,

8412

111

ftfk

20206.0

108187.561102067.2

87.561,48024038869.016.655,240240

,

8412

1112

ff

hkhtfk

K

hkk

27.58424029538.016.655

24020206.02138869.0

2116.655

21

21

2112

Page 11: Runge 2 nd  Order Method

http://numericalmethods.eng.usf.edu11

Solution Cont

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

9282.21022067.00033333.0tan8519.1300300ln92593.0 31

t

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

K57.647)480(

Page 12: Runge 2 nd  Order Method

http://numericalmethods.eng.usf.edu12

Comparison with exact results

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

-400

0

400

800

1200

0 100 200 300 400 500

Time, t(sec)

Tem

pera

ture

,θ(K

) Exact h=120

h=240

h=480

Page 13: Runge 2 nd  Order Method

http://numericalmethods.eng.usf.edu13

Effect of step sizeTable 1. Temperature at 480 seconds as a function of step size, h

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

4802401206030

−393.87584.27651.35649.91648.21

1041.463.304

−3.7762−2.3406

−0.63219

160.829.7756

0.583130.36145

0.097625

K57.647)480( (exact)

Page 14: Runge 2 nd  Order Method

http://numericalmethods.eng.usf.edu14

Effects of step size on Heun’s Method

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

-400

-200

0

200

400

600

800

0 100 200 300 400 500Step size, h

Tem

pera

ture

,θ(

480)

Page 15: Runge 2 nd  Order Method

Step size,h

(480)Euler Heun Midpoint Ralston

4802401206030

−987.84110.32546.77614.97632.77

−393.87584.27651.35649.91648.21

1208.4976.87690.20654.85649.02

449.78690.01667.71652.25648.61

http://numericalmethods.eng.usf.edu15

Comparison of Euler and Runge-Kutta 2nd Order

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

K57.647)480( (exact)

Page 16: Runge 2 nd  Order Method

http://numericalmethods.eng.usf.edu16

Comparison of Euler and Runge-Kutta 2nd Order

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

Step size,h Euler Heun Midpoint Ralston

4802401206030

252.5482.96415.5665.03522.2864

160.829.7756

0.583130.361450.097625

86.61250.8516.58231.1239

0.22353

30.5446.55373.10920.722990.15940

K57.647)480( (exact)

%t

Page 17: Runge 2 nd  Order Method

http://numericalmethods.eng.usf.edu17

Comparison of Euler and Runge-Kutta 2nd Order

Methods

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

500

600

700

800

900

1000

1100

1200

0 100 200 300 400 500 600

Time, t (sec)

Tem

pera

ture

,

Analytical

Ralston

Midpoint

Euler

Heun

θ(K

)

Page 18: Runge 2 nd  Order Method

Additional ResourcesFor all resources on this topic such as digital audiovisual lectures, primers, textbook chapters, multiple-choice tests, worksheets in MATLAB, MATHEMATICA, MathCad and MAPLE, blogs, related physical problems, please visit

http://numericalmethods.eng.usf.edu/topics/runge_kutta_2nd_method.html

Page 19: Runge 2 nd  Order Method

THE END

http://numericalmethods.eng.usf.edu