Research Journal of Chemical Sciences ______ ______________________________ ______ ____ ISSN 2231 - 606X Vol. 2 ( 4 ), 79 - 85 , April (201 2 ) Res.J.Chem.Sci. International Science Congress Association 79 Review Paper Modeling and Simulation Study of the CSTR for Complex Reaction by Using Polymath Kanse Nitin G. 1 , Dhanke P.B. 1 and Thombare Abhijit 3 1 Department of Chemical Engineering, FAMT Ratnagiri - 415639, MH, INDIA 3 Department of Chemical Engineering T.K.I.E.T. Warananagar, MH, INDIA Available online at: www.isca.in (Received 21 st February 201 2 , revised 27 th February 201 2 , accepted 1 st March 201 2 ) Abstract This paper deals with basic simulation studies on of the common used devices in chemical industry Continuous Stirred Tank Reactor (CSTR). Simulations on mathematical models has several advantages over the experiment on a real model or system. The mathematical model is developed from material balances. Simulation is very important and popular tool now a days, when computation speed of computers increases exponentially every day n umerical mathematics is used for steady - state analysis and dynamic anal ysis. Simulation results are used for choosing of an optimal working point and an external linear model of this nonlinear plant. This paper deals with simulation experiments on one type of nonlinear systems, CSTR reactor. This simulation s results in optima l working point, external linear model and they will be later used for choosing of an optimal working point and mainly for control purpose. Keywords: Polymath, CSTR, steady - state, dynamics, Runge - Kutta’s method . Introduction There are several types of stirred reactors used in chemical or biochemical industry. Continuous Stirred Tank Reactors (CSTR) are common used because of their technological paramers. Reaction inside flows continuously and we can control this reaction by fo r example volumetric flow rate of the reactant (Ingham et al. 2000). The first step is introducing of the mathematical model which describes relations between state variables in the mathematical way. This mathematical model comes from material or heat bala nces inside the reactor. In our case of isothermal reactor with complex reaction (Russell and Denn 1972) is mathematical model the set of ordinary differential equations (ODE). Simulation usually consists of steady - state analysis which observes behaviour o f the system in steady - state and dynamic analysis which shows dynamic behavior after the step change of the input quantity (Ingham et al. 2000, Luyben 1989). Model of the Reactor Reactor under the consideration is i sothermal reactor with complex reaction. Reactions inside the reactor can be described by following reactions: Ü£ ܤ à°­ ܺ (1) ܤ ܺ à°® Ü» (2) ܤ Ü» à°¯ ܼ (3) This reaction has sequential Ü£ ܺ Ü» ܼ , As well as parallel characteristics ܤ ܺ ܤ Ü» ܤ ܼ Mathematical description of all variables is of course very complicated. Therefore there must be introduced some simplifications before we start to build the mathematical model of the plant. We expect, that reactant inside the tank is perfectly mixed and v olume of the reactant is constant during the reaction. The mathematical model of the system is then derived from the material balances inside the reactor. All three reactions are assumed to follow second order kinetics. Tacking component balance on A, We get. ஼ ଴ Ü¥ ஺ ଴ Ü¥ ஺ ଵ Ü¥ ஺ Ü¥ à®» (4) Dividing by V on both side ஼ à°¬ ஼ à°¬ ஼ ଵ Ü¥ ஺ Ü¥ à®» (5) Tacking component balance on B, We get. ஼ ଴ Ü¥ à®» ଴ Ü¥ à®» ଵ Ü¥ ஺ Ü¥ à®» ଶ Ü¥ à®» Ü¥ ௑ ଷ Ü¥ à®» Ü¥ ௒ (6) Dividing by V on both side ஼ ଴ Ü¥ à®» ଴ Ü¥ à®» ଵ Ü¥ ஺ Ü¥ à®» ଶ Ü¥ à®» Ü¥ ௑ ଷ Ü¥ à®» Ü¥ ௒ (7) Similarly, We can write for component X, Y, Z ஼ ೉ à°¬ ஼ ೉ à°¬ ஼ ೉ ͳ Ü¥ ஺ Ü¥ à®» ଶ Ü¥ à®» Ü¥ ௑ (8) ஼ ೊ à°¬ ஼ ೊ à°¬ ஼ ೊ ଶ Ü¥ à®» Ü¥ ௑ ଷ Ü¥ à®» Ü¥ ௒ (9) ஼ ೋ à°¬ ஼ ೋ à°¬ ஼ ೋ ଷ Ü¥ à®» Ü¥ ௒ (10) Research Journal of Chemical Sciences ______ _ _ _______________________________ ______________ _ ____ ISSN 2231 - 606X Vol. 2 ( 4 ), 79 - 85 , April (201 2 ) Res.J.Chem.Sci International Science Congress Association 80 Figure - 1 Isothermal CSTR This set of nonlinear ODE describes behavior of the state variables which are in this case concentrations of components A, B, X, Y and Z are C A , C B , C C , C X , C Y and C Z in time t respectively. We can say, that this CSTR belongs to the class of nonlinear lump ed - parameters systems. In above equation no.(4) to equation no. (10), F denotes volumetric flow rate, V is volume of the tank, k means rate constants and C are concentrations. Numerical subscripts 1, 2 and 3 represent reaction steps. Assuming inlet flow ra te is equal to outlet flow rate i.e. ଴ . Some technological parameters and constants are shown in t able 1. Table - 1 Parameters of the Reactor Sr.no. Parameter Value of parameter with unit 1. k 1 5×10 - 4 (m 3 /kmol.s) 2. k 2 5×10 - 2 (m 3 /kmol.s) 3. k 3 2×10 - 2 (m 3 /kmol.s) 4. C A0 0.4 ( kmol/m 3 ) 5. C B0 0.6 ( kmol/m 3 ) 6. C X0 , C Y0, C Z0 0 ( kmol/m 3 ) 7. V 1 (m 3 ) 8. F 0.01 (m 3 /s) Simulation Results There were done two basic simulation studies steady state analysis and dynamic analysis. Both analyses use numerical methods for computation. Steady - state analysis: Steady - state analysis means computation of the state variables in time where we expect that the value of this quantity is stable. From the computation point of view it means, that all derivat ives with respect to time are equal to zero, i.e. d(·)/dt = 0. ஼ Ͳ ஼ à°¬ ஼ ଶ Ü¥ ஺ Ü¥ à®» Ü¥ ஺ Ü¥ ஺ ଴ ଵ Ü¥ à®» (11) Similarly, equation (7) to (10) we get, steady state equations of C A , C B , C X , C Y , and C Z Ü¥ à®» Ü¥ à®» ଴ ଵ Ü¥ ஺ ଶ Ü¥ ௑ ଷ Ü¥ ௒ (12) Ü¥ ௑ Ü¥ ௑ ଴ ଵ Ü¥ ஺ Ü¥ à®» ଶ Ü¥ à®» (13) Ü¥ ௒ Ü¥ ௒ ଴ ଶ Ü¥ à®» Ü¥ ௑ ଷ Ü¥ à®» (14) Ü¥ ௓ Ü¥ ௓ ଴ ଷ Ü¥ à®» Ü¥ ௒ (15) Figures 2 represent course of the computed steady - state values of the state variables. As it can been seen, value is computed value is stable nearly around t=1000 sec, after that the concentration values are not changed. Table - 2 Calculated values of steady state concentrations Variable Initial value Minimal value Maximal value Final value 1 t 0 0 1500. 1500. 2 CA 0.4 0.3888017 0.4 0.3888017 3 CB 0.6 0.5760397 0.6 0.5760397 4 CX 0 0 0.0029114 0.002886 5 CY 0 0 0.0038744 0.0038624 6 CZ 0 0 0.0044498 0.0044498 7 F 0.01 0.01 0.01 0.01 8 V 1. 1. 1. 1. 9 CA0 0.4 0.4 0.4 0.4 10 CB0 0.6 0.6 0.6 0.6 11 CX0 0 0 0 0 12 CY0 0 0 0 0 13 CZ0 0 0 0 0 14 k1 0.0005 0.0005 0.0005 0.0005 15 k2 0.05 0.05 0.05 0.05 16 k3 0.02 0.02 0.02 0.02 Research Journal of Chemical Sciences ______ _ _ _______________________________ ______________ _ ____ ISSN 2231 - 606X Vol. 2 ( 4 ), 79 - 85 , April (201 2 ) Res.J.Chem.Sci International Science Congress Association 81 Figure - 2 Steady state concentration profile vs time Figure - 3 Steady state concentration of C X , C Y , and C Z vs time Research Journal of Chemical Sciences ______ _ _ _______________________________ ______________ _ ____ ISSN 2231 - 606X Vol. 2 ( 4 ), 79 - 85 , April (201 2 ) Res.J.Chem.Sci International Science Congress Association 82 The second analysis were done for various flow rates in the range F=, 0.01�-80; m 3 /s. the main goal of the static analysis is to find optimal volumetric flow rate. Optimal in this case means point where product concentration is maximal. Only concentrations C X and C Y has maximum in this case, concentration C Z s has decreasing progress whic h is not very relevant for us. Maximum values of all concentrations and appropriate volumetric flow rate q are given below. This flow rate is used lately for the dynamic analysis. Steady state values of the state variables in the working point are, F=0.002 5 (m 3 /s), C A = 0.3369774 (kmol/m 3 ), C B = 0.4246187 (kmol/m 3 ), C X = 0.0032226 (kmol/m 3 ), C Y = 0.0072414 (kmol/m 3 ). Table - 3 Steady state values of concentrations for different flow rates F(m 3 /s) C A C B C X C Y C Z 0 0.2913335 0.2874315 0.0029428 0.0075455 0.0981782 0.001 0.3369774 0.4246187 0.0032226 0.0072414 0.0525587 0.002 0.3574784 0.4858989 0.0033037 0.0068562 0.0323617 0.003 0.3683311 0.5179965 0.0033011 0.006401 0.0219668 0.004 0.3748571 0.5370401 0.0032626 0.0059435 0.0159368 0.005 0.3791706 0.5494394 0.0032079 0.0055118 0.0121097 0.006 0.3822247 0.5580807 0.0031458 0.005115 0.0095145 0.007 0.384499 0.5644126 0.0030808 0.004754 0.0076662 0.008 0.3862581 0.5692315 0.0030151 0.0044269 0.0062998 0.009 0.3876593 0.5730086 0.0029499 0.0041308 0.0052599 0.01 0.3888017 0.5760397 0.002886 0.0038624 0.0044498 Figure - 4 Research Journal of Chemical Sciences ______ _ _ _______________________________ ______________ _ ____ ISSN 2231 - 606X Vol. 2 ( 4 ), 79 - 85 , April (201 2 ) Res.J.Chem.Sci International Science Congress Association 83 Figure - 5 Steady - state values of the concentrations C A , C B , C X , C Y and C Z for different volumetric flow rate F Dynamic Analysis: The next step after the steady - state analysis is usually dynamic analysis which observes behavior of the system after the step change of the input variable. In this case is input variable step change of the volumetric flow rate ΔF . Mathematically dynamic a nalysis means numerical solving of the set of ODE with some convenient method. Runge Kutta’s standard method was used for solving of this problem (Shampire 1994). This Method belongs to the class of the high - order, it is self - started and should be used bot h for computing of initial assessments and final solutions too. Despite the fact, that in Polymath, in which Runge - Kutta’s method build - in function RKF56, RKF45 etc. Computation was done with the general description of Runge - Kutta’s standard method. This method uses first four parts of Taylor series The polymath programs used the following equation and RKF45 is used for the simulation purpose. The fourth order runge - kutta algorithm is widely used in chemical engineering. The Runge - kutta algorithm is giv en below ଵ ଵ ଺ ଵ Í´ ଶ Í´ ଷ ସ ହ (16) ଵ ଶ ଶ à°­ ଶ ଷ ଶ à°® ଶ ସ ଷ k 1 , k 2 , k 3 , k 4 are approximate derivative values computed on the interval ଵ and h is the step size ଵ Where local error term for the fourth order Runge - kutta is O(h 5 ) Simulation took time t = ; 20 000�-70; s and integration step was h = 10 s. Steady - state values of the state variables C A , C B , C X , C Y and C Z computed from the previous steady - state analysis for this concreat working point were used as initial conditions. There were done four step changes of the input variable volumetric flow rate of the reactant, F, - 50% of its steady - state value (i.e. - 0.0005 m 3 /s); - 25% ( - 0.00025 m 3 /s); 25% (0.00025 m 3 /s) and 50% (0.0005 m 3 /s). Outputs y 1 - 3 in table below difference between actual value of the output and its initial value ଵ Ü¥ ௑ Ü¥ ଶ Ü¥ ௒ Ü¥ ௒ ଷ Ü¥ ௓ Ü¥ ௓ This difference is made only because of better display of outputs they started in zero point. 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 - 1.04E - 17 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01 Concentration ( kmol/m^3) Flow rate (m^3/s) CA CB CX CY CZ Research Journal of Chemical Sciences ______ _ _ _______________________________ ______________ _ ____ ISSN 2231 - 606X Vol. 2 ( 4 ), 79 - 85 , April (201 2 ) Res.J.Chem.Sci International Science Congress Association 84 Table - 4 Main program used for finding out concentration # Main Program d(CA)/d(t) = (F * (CA0 - CA) / V) - (k1 * CA * CB) # Concentration of A CA(0) = .4 d(CB)/d(t) = (F * (CB0 - CB) / V) - (k1 * CA * CB) - (k2 * CB * CX) - (k3 * CB * CY) # Concentration of B CB(0) = 0.6 d(CX)/d(t) = (F * (CX0 - CX) / V) + (k1 * CA * CB) - (k2 * CB * CX) # Concentration of X CX(0) = 0 d(CY)/d(t) = (F * (CY0 - CY) / V) + (k2 * CB * CX) - (k3 * CB * CY) # Concentration of Y CY(0) = 0 d(CZ)/d(t) = (F * (CZ0 - CZ) / V) + (k3 * CB * CY) # Concentration of Z CZ(0) = 0 # The explicit equations F = 0.01 # Mass flow rate (m^3/sec) V = 1 # Volume of reactor(m^3) CA0 = 0.4 # Initial concentration of A CB0 = 0.6 # Initial concentration of B CX0 = 0 # Initial concentration of X CY0 = 0 # Initial concentration of Y CZ0 = 0 # Initial concentration of Z k1 = 5 * 10 ^ - 4 # Rate constant for reaction 1 k2 = 5 * 10 ^ - 2 # Rate constant for reaction 2 k3 = 2 * 10 ^ - 2 # Rate constant for reaction 3 # Initial/final values of the independent differentiation variable t(0) = 0 t(f) = 1500 Differential equations 1 d(CA)/d(t) = (F * (CA0 - CA) / V) - (k1 * CA * CB) Concentration of A 2 d(CB)/d(t) = (F * (CB0 - CB) / V) - (k1 * CA * CB) - (k2 * CB * CX) - (k3 * CB * CY) Concentration of B 3 d(CX)/d(t) = (F * (CX0 - CX) / V) + (k1 * CA * CB) - (k2 * CB * CX) Concentration of X 4 d(CY)/d(t) = (F * (CY0 - CY) / V) + (k2 * CB * CX) - (k3 * CB * CY) Concentration of Y 5 d(CZ)/d(t) = (F * (CZ0 - CZ) / V) + (k3 * CB * CY) Concentration of Z Parameters used for Programming Total number of equations 15 Solution method RKF_45 Number of differential equations 5 Step size guess. h 0.000001 Number of explicit equations 10 Truncation error tolerance. eps 0.000001 Elapsed time 0.000 sec Research Journal of Chemical Sciences ______ _ _ _______________________________ ______________ _ ____ ISSN 2231 - 606X Vol. 2 ( 4 ), 79 - 85 , April (201 2 ) Res.J.Chem.Sci International Science Congress Association 85 Conclusion Paper deals with simulation of the CSTR which is typical nonlinear system with lumped parameters. Mathematical model of the plant comes from material balances inside the reactor which results in the set of nonlinear ODE. Simple Polymath programming is used for solving of a steady - state. All results are s hown in result are done by polymath software The steady - state analysis for different value of input volumetric flow rate shows nonlinear properties of the system and the optimal working point is for volumetric flow rate F is 0.001 m 3 /s where the concentrat ion of the product Y has its maximum. References 1. Ingham J., Dunn I.J., Heinzle E. and Prenosil J.E. , Chemical Engineering Dynamics. An Introduction to Modeling and Computer Simulation. Second, Completely Revised Edition, VCH Verlagsgesellshaft, Weinheim (2000) 2. Luyben W.L. , Process Modelling, Simulation and Control for Chemical Engineers. McGraw - Hill, New York , (1989) 3. Shampine L.F. , Numerical Solution of Ordinary Differential Equations, Chapman and Hall, New York , (1994) 4. Vojtesek J. and Dostal P. , From steady - state and dynamic analysis to adaptive control of the CSTR reactor , In: Proc. of 19th European Conference on Modelling and Simulation ESM 2005 , Riga, Latvia, 591 - 598 , (2005) 5. Kokossis A.C. and Floudas C.A., Synthesis of isothermal reactor - separatorr ecycle systems, Chem. Eng. Sci ., 46(5/6) , 1361 – 1383 (1991) 6. Levenspiel O ., Chemical Reaction Engineering , 3rd ed., John Wiley and Sons, New York, (1999) 7. Aweh E.A. , One parameter model and computer simulation of a non - ideal plug flow reactor , B.Eng. thesis , Federal University of Technology, Minna, Nigeria , (2002) 8. Fogler H.S. , Elements of Chemical Engineering Reaction , 3 nd ed., Prentice - Hall of India private Ltd., New Delhi, 811 - 41 (2002 )