Holistic Numerical Methods
Holistic Numerical Methods
04
Runge-Kutta 4th Order Method for Ordinary
Differential Equations-More Examples
Chemical Engineering
Example 1
The concentration of salt x in a home made soap maker is given as a function of time by
dx
37.5 3.5 x
dt
At the initial time, t 0 , the salt concentration in the tank is 50 g/L Using Runge-Kutta 4th
order method and a step size of, h 1.5 min , what is the salt concentration after 3 minutes?
Solution
dx
37.5 3.5 x
dt
f t , x 37.5 3.5x
xi 1 xi k1 2k 2 2k 3 k 4 h
1
6
For i 0 , t 0 0 , x0 50
k1 f t 0 , x0
f 0,50
37.5 3.5(50)
137.5
1 1
k 2 f t 0 h, x0 k1 h
2 2
f 0 1.5,50 137.51.5
1 1
2 2
f 0.75,53.125
37.5 3.5(53.125)
223.44
1 1
k 3 f t 0 h, x0 k 2 h
2 2
f 0 1.5,50 223.441.5
1 1
2 2
08.04.1
08.04.2 Chapter 08.04
f 0.75,217.58
37.5 3.5(217.58)
724.02
k 4 f t 0 h, x0 k 3 h
f 0 1.5,50 724.031.5
f 1.5,1036.0
37.5 3.5(1036.0)
3663.6
1
x1 x0 (k1 2k 2 2k 3 k 4 )h
6
50 137.5 2223.44 2 724.02 3663.6 1.5
1
6
50 2525.0 1.5
1
6
681.24 g/L
x1 is the approximate concentration of salt at
t t1 t 0 h 0 1.5 1.5
x1.5 x1 681.24 g/L
For i 1, t1 1.5, x1 681.24
k1 f t1 , x1
f 1.5,681.24
37.5 3.5(681.24)
2346.8
1 1
k 2 f t1 h, x1 k1 h
2 2
f 1.5 1.5, 681.24 2346.81.5
1 1
2 2
f 2.25,1078.9
37.5 3.5(1078.9)
3813.6
1 1
k 3 f t1 h, x1 k 2 h
2 2
f 1.5 1.5, 681.24 3813.61.5
1 1
2 2
f 2.25, 3541.4
37.5 3.5(3541.4)
12358
k 4 f t1 h, x1 k 3 h
Runge-Kutta 4th order Method for ODE-More Examples: Chemical Engineering 08.04.3
Figure 1 compares the exact solution with the numerical solution using Runge-Kutta 4th order
method using different step sizes.
08.04.4 Chapter 08.04
Figure 1 Comparison of Runge-Kutta 4th order method with exact solution for
different step sizes.
Table 1 and Figure 2 show the effect of step size on the value of the calculated temperature at
t 3 min.
In Figure 3, we are comparing the exact results with Euler’s method (Runge-Kutta 1st order
method), Heun’s method (Runge-Kutta 2nd order method) and Runge-Kutta 4th order method.
08.04.6 Chapter 08.04