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

10/20/2015 1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

Jan 02, 2016

Download

Documents

Tamsin Joseph
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

04/20/23http://

numericalmethods.eng.usf.edu 1

Runge 2nd Order Method

Chemical Engineering Majors

Authors: Autar Kaw, Charlie Barker

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

Undergraduates

Page 2: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

Runge-Kutta 2nd Order Method

http://numericalmethods.eng.usf.edu

Page 3: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

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 ,

For0)0(),,( yyyxf

dx

dy

Page 4: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

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 ,,2

1 1

ii yxfSlope ,

Heun’s method

2

11 a

11 p

111 q

resulting in

hkkyy ii

211 2

1

2

1

where

ii yxfk ,1

hkyhxfk ii 12 ,

Here a2=1/2 is chosen

Page 5: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

http://numericalmethods.eng.usf.edu5

Midpoint MethodHere 12 a is chosen, giving

01 a

2

11 p

2

111 q

resulting in

hkyy ii 21

where

ii yxfk ,1

hkyhxfk ii 12 2

1,

2

1

Page 6: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

http://numericalmethods.eng.usf.edu6

Ralston’s MethodHere

3

22 a is chosen, giving

3

11 a

4

31 p

4

311 q

resulting in

hkkyy ii

211 3

2

3

1

where ii yxfk ,1

hkyhxfk ii 12 4

3,

4

3

Page 7: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

http://numericalmethods.eng.usf.edu7

How to write Ordinary Differential Equation

Example

50,3.12 yeydx

dy x

is rewritten as

50,23.1 yyedx

dy x

In this case

yeyxf x 23.1,

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

yxfdx

dy,

Page 8: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

http://numericalmethods.eng.usf.edu8

Example

The concentration of salt, in a home made soap maker is given as a function of time by

x

xdt

dx5.35.37

At the initial time, t = 0, the salt concentration in the tank is 50g/L. Using Euler’s method and a step size of h=1.5 min, what is the salt concentration after 3 minutes.

xdt

dx5.35.37

xxtf 5.35.37,

hkkxx ii

211 2

1

2

1

Page 9: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

http://numericalmethods.eng.usf.edu9

SolutionStep 1: 50,0,0 00 xti

50.137505.35.3750,0,01 fxtfk o

38.58425.1565.35.37

25.156,5.15.150.13750,5.10, 1002

ffhkxhtfk

Lg

hkkxx

/16.385

5.144.22350

5.138.5842

150.137

2

150

2

1

2

12101

x1 is the approximate concentration of salt at min5.15.1001 httt

g/L16.3855.1 1 xx

Page 10: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

http://numericalmethods.eng.usf.edu10

Solution ContStep 2: Lgxhtti /16.385,5.15.10,1 101

5.131016.3855.35.3716.385,5.1, 111 fxtfk

8.55696.15805.35.37

6.1580,35.15.131016.385,5.15.1, 1112

ffhkxhtfk

Lg

hkkxx

/7.3579

5.16.212916.385

5.18.55692

15.1310

2

116.385

2

1

2

12112

x1 is the approximate concentration of salt at min35.15.112 httt

g/L7.35793 1 xx

Page 11: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

http://numericalmethods.eng.usf.edu11

Solution Cont

The exact solution of the ordinary differential equation is given by

The solution to this nonlinear equation at t=3 minutes is

xetx 5.3286.39714.10)(

g/L715.103 x

Page 12: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

http://numericalmethods.eng.usf.edu12

Comparison with exact results

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

Page 13: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

Step size,

31.5

0.750.3750.1875

1803.13579.6442.0511.03810.718

−1792.4−3568.9−431.34

−0.32231−0.0024979

16727333064025.43.0079

0.023311

http://numericalmethods.eng.usf.edu13

Effect of step size

h tE %|| t

(exact)

3x

715.10)3( x

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

Page 14: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

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: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

Step size,h Euler Heun Midpoint Ralston

31.50.75

0.3750.1875

−362.50720.31284.6510.71810.714

1803.13579.6442.0511.03810.718

1803.13579.6442.0511.03810.718

1803.13579.6442.0511.03810.718

http://numericalmethods.eng.usf.edu15

Comparison of Euler and Runge-Kutta 2nd Order

Methods

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

(exact)715.10)3( x

)3(x

Page 16: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

http://numericalmethods.eng.usf.edu16

Comparison of Euler and Runge-Kutta 2nd Order

Methods

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

(exact)

Step size,h Euler Heun Midpoint Ralston

31.50.750.3750.1875

3483.06622.22556.50.0232490.010082

16727333064025.43.00790.023311

16727333064025.43.00790.023311

16727333064025.43.00790.023311

715.10)3( x

%t

Page 17: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

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: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

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: 10/20/2015  1 Runge 2 nd Order Method Chemical Engineering Majors Authors: Autar Kaw, Charlie Barker .

THE END

http://numericalmethods.eng.usf.edu