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

Runge 2 nd Order Method

  • Upload
    nora

  • View
    59

  • Download
    0

Embed Size (px)

DESCRIPTION

Runge 2 nd Order Method. Civil 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. For. - PowerPoint PPT Presentation

Citation preview

Page 1: Runge 2 nd  Order Method

04/24/23http://

numericalmethods.eng.usf.edu 1

Runge 2nd Order Method

Civil 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 polluted lake with an initial concentration of a bacteria is 107 parts/m3, while the acceptable level is only 5×106 parts/m3. The concentration of the bacteria will reduce as fresh water enters the lake. The differential equation that governs the concentration C of the pollutant as a function of time (in weeks) is given by

710)0(,006.0 CCdtdC

Find the concentration of the pollutant after 7 weeks. Take a step size of 3.5 weeks.

CdtdC 06.0

CCtf 06.0,

hkkCC ii

211 2

121

Page 9: Runge 2 nd  Order Method

http://numericalmethods.eng.usf.edu9

SolutionStep 1:

700 10,0,0 Cti

6000001006.010,0, 77001 fCtfk

474000109.706.0109.7,5.3

5.360000010,5.30,66

71002

f

fhkChtfk

36

7

7

2101

parts/m101205.8

5.353700010

5.347400021600000

2110

21

21

hkkCC

C1 is the approximate concentration of bacteria at weeks5.35.3001 httt

361 parts/m101205.85.3 CC

Page 10: Runge 2 nd  Order Method

http://numericalmethods.eng.usf.edu10

Solution ContStep 2:

36101 parts/m101205.8,5.35.30,1 Chtti

487230101205.806.0101205.8,5.3, 66111 fCtfk

384910641520006.06415200,7

5.3487230101205.8,5.35.3, 61112

ffhkChtfk

36

6

6

2112

parts/m105943.6

5.3436070101205.8

5.338491021487230

21101205.8

21

21

hkkCC

C2 is the approximate concentration of bacteria at weeks75.35.312 httt

362 parts/m105943.67 CC

Page 11: Runge 2 nd  Order Method

http://numericalmethods.eng.usf.edu11

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

The solution to this nonlinear equation at t=7 weeks is

503

7101)(t

etC

36 parts/m105705.6)7( C

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

Page 13: Runge 2 nd  Order Method

Step size,

73.51.75

0.8750.4375

6.6520×106

6.5943×106

6.5760×106

6.5718×106

6.5708×106

−111530−23784−5489.1−1318.8−323.24

1.69750.36198

0.0835420.0200710.0049195

http://numericalmethods.eng.usf.edu13

Effect of step size

h tE %|| t

(exact)6105705.6)7( C

7C

Table 1. Effect of step size for Heun’s method

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

Page 15: Runge 2 nd  Order Method

Step size,h Euler Heun Midpoint Ralston

73.5

1.750.875

0.4375

5.8000×106

6.2410×106

6.4160×106

6.4960×106

6.5340×106

6.6820×106

6.5943×106

6.5760×106

6.5718×106

6.5708×106

6.6820×106

6.5943×106

6.5760×106

6.7518×106

6.5708×106

6.6820×106

6.5943×106

6.5760×106

6.5718×106

6.5708×106

http://numericalmethods.eng.usf.edu15

Comparison of Euler and Runge-Kutta 2nd Order

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

(exact)6105705.6)7( C

)7(C

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

(exact)

%t

6105705.6)7( C

Step size,h Euler Heun Midpoint Ralston

73.5

1.750.8750.4375

11.7265.01442.34471.1362

0.55952

1.69750.36198

0.0835420.020071

0.0049195

1.69750.36198

0.0835420.020071

0.0049195

1.69750.36198

0.0835420.020071

0.0049195

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.

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