Computational Method in Chemical Engineering (TKK-2109) 14/15 Semester 5 Computational Method in Chemical Engineering (TKK-2109) Instructor: Rama Oktavian Email: rama.oktavian@ub.ac.id Office Hr.: M.13-15, T. 13-15, W. 13-15, F. 13-15
Ordinary Differential Equation An equation relating a dependent variable to one or more independent variables by means of its differential coefficients with respect to the independent variables is called a “differential equation”. Ordinary differential equation -------- only one independent variable involved: x Partial differential equation --------------- more than one independent variable involved: x, y, z,
Ordinary Differential Equation Ordinary differential equations are classified in terms of order and degree Order of an ordinary differential equation is the same as the highest order derivative The degree of a differential equation is the highest power of the highest order differential coefficient that the equation contains after it has been rationalized.
Ordinary Differential Equation Ordinary differential equations are classified in terms of order and degree 3rd order O.D.E. 1st degree O.D.E. 1st order O.D.E. 2nd degree O.D.E.
Ordinary Differential Equation Linear or non-linear Differential equations are said to be non-linear if any products exist between the dependent variable and its derivatives, or between the derivatives themselves. Product between two derivatives ---- non-linear Product between the dependent variable themselves ---- non-linear
Ordinary Differential Equation Swinging pendulum A second-order nonlinear ODE. Falling parachutist problem
Ordinary Differential Equation Ordinary differential equations are classified in terms of order and degree 3rd order O.D.E. 1st degree O.D.E. 1st order O.D.E. 2nd degree O.D.E.
Ordinary Differential Equation ODE in chemical engineering Illustrative Example: A Blending Process An unsteady-state mass balance for the blending system:
Ordinary Differential Equation ODE in chemical engineering or where w1, w2, and w are mass flow rates. The unsteady-state component balance is: For constant , Eqs. 2-2 and 2-3 become:
Ordinary Differential Equation ODE in chemical engineering Equation 2-13 can be simplified by expanding the accumulation term using the “chain rule” for differentiation of a product: Substitution of (2-14) into (2-13) gives: Substitution of the mass balance in (2-12) for in (2-15) gives:
Ordinary Differential Equation ODE in chemical engineering After canceling common terms and rearranging (2-12) and (2-16), a more convenient model form is obtained:
Ordinary Differential Equation ODE in chemical engineering
Ordinary Differential Equation Numerical method for solving ODE Euler’s method Φ Step size, h x y x0,y0 True value y1, Predicted value Slope Figure 1 Graphical interpretation of the first step of Euler’s method http://numericalmethods.eng.usf.edu
Ordinary Differential Equation Numerical method for solving ODE Euler’s method Φ Step size h True Value yi+1, Predicted value yi x y xi xi+1 Figure 2. General graphical interpretation of Euler’s method http://numericalmethods.eng.usf.edu
Ordinary Differential Equation Numerical method for solving ODE Euler’s method How does one write a first order differential equation in the form of Example is rewritten as In this case http://numericalmethods.eng.usf.edu
Ordinary Differential Equation Example Numerical method for solving ODE Euler’s method The concentration of salt, in a home made soap maker is given as a function of time by 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.
Ordinary Differential Equation Example Numerical method for solving ODE Euler’s method Step 1: is the approximate concentration of salt at
Ordinary Differential Equation Example Numerical method for solving ODE Euler’s method Step 2: is the approximate concentration of salt at
Ordinary Differential Equation Numerical method for solving ODE The exact solution of the ordinary differential equation is given by The solution to this nonlinear equation at t=3 minutes is
Ordinary Differential Equation Numerical method for solving ODE Figure 3. Comparing exact and Euler’s method
Ordinary Differential Equation Numerical method for solving ODE Table 1. Concentration of salt at 3 minutes as a function of step size, h 3 1.5 0.75 0.375 0.1875 −362.50 720.31 284.65 10.718 10.714 373.22 −709.60 −273.93 −0.0024912 0.0010803 3483.0 6622.2 2556.5 0.023249 0.010082 Step
Ordinary Differential Equation Numerical method for solving ODE Figure 4. Comparison of Euler’s method with exact solution for different step sizes
Ordinary Differential Equation Numerical method for solving ODE Runge Kutta 2nd order method Taylor’s expansion http://numericalmethods.eng.usf.edu
Ordinary Differential Equation Numerical method for solving ODE Runge Kutta 2nd order method Taylor’s expansion http://numericalmethods.eng.usf.edu
Ordinary Differential Equation Numerical method for solving ODE Runge Kutta 2nd order method However, it is relatively difficult to find second derivative of ODE For Runge Kutta 2nd order method is given by where http://numericalmethods.eng.usf.edu
Ordinary Differential Equation Numerical method for solving ODE Heun’s method x y xi xi+1 yi+1, predicted yi Here a2=1/2 is chosen resulting in where Figure 1 Runge-Kutta 2nd order method (Heun’s method) http://numericalmethods.eng.usf.edu
Ordinary Differential Equation Midpoint Method Numerical method for solving ODE Here is chosen, giving resulting in where http://numericalmethods.eng.usf.edu
Ordinary Differential Equation Ralston’s Method Numerical method for solving ODE Here is chosen, giving resulting in where http://numericalmethods.eng.usf.edu
Ordinary Differential Equation Example The concentration of salt, in a home made soap maker is given as a function of time by 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. http://numericalmethods.eng.usf.edu
Solution Step 1: x1 is the approximate concentration of salt at http://numericalmethods.eng.usf.edu
Solution Step 2: x1 is the approximate concentration of salt at http://numericalmethods.eng.usf.edu
Solution Table 1. Effect of step size for Heun’s method Step size, 3 1.5 0.75 0.375 0.1875 1803.1 3579.6 442.05 11.038 10.718 −1792.4 −3568.9 −431.34 −0.32231 −0.0024979 16727 33306 4025.4 3.0079 0.023311 (exact) http://numericalmethods.eng.usf.edu
Ordinary Differential Equation Numerical method for solving ODE Runge Kutta 4th order method Taylor’s expansion http://numericalmethods.eng.usf.edu
Ordinary Differential Equation Numerical method for solving ODE Runge Kutta 4th order method However, it is relatively difficult to find second and third derivative of ODE For Runge Kutta 4th order method is given by http://numericalmethods.eng.usf.edu
Ordinary Differential Equation Example The concentration of salt, in a home made soap maker is given as a function of time by 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. http://numericalmethods.eng.usf.edu
Solution Step 1: http://numericalmethods.eng.usf.edu
Solution is the approximate concentration of salt at http://numericalmethods.eng.usf.edu
Solution Step 2: http://numericalmethods.eng.usf.edu
Solution is the approximate concentration of salt at http://numericalmethods.eng.usf.edu
Solution Table 1 Value of concentration of salt at 3 minutes for different step sizes Step size, 3 1.5 0.75 0.375 0.1875 14120 11455 25.559 10.717 10.715 −14109 −11444 −14.843 −0.0014969 −0.00031657 131680 106800 138.53 0.013969 0.0029544 (exact) http://numericalmethods.eng.usf.edu
Thank You !