You are on page 1of 299

# INTRODUCTION TO

NUMERICAL
METHODS IN
CHEMICAL
ENGINEERING
dCj k1
A+B C
= 0, j = A,B,C,D
dx k2
B+C D

d 2CA dCA
D 2 –u – k1CACB = 0
dx dx
d 2CB dCB d 2Ci Ci + 1 – 2Ci + Ci – 1
D 2
–u – k1CACB– k2CBCC = 0 D 2
=D
dx dx dx x2
D
d 2CC dCC dCi Ci – Ci – 1
D –u + k1CACB– k2CBCC = 0 u =u
dx2
dx dx x
D
d 2CD dCD u
D 2
–u + k2CBCC = 0 x
dx dx

dCj
uCj,in = uCj – D
dx

Introduction to
Numerical Methods in Chemical Engineering

Introduction to
Numerical Methods in
Chemical Engineering

Associate Professor
Department of Chemical Engineering and Technology
Institute of Technology, Banaras Hindu University
Varanasi

New Delhi-110001
2010

Rs. 275.00

INTRODUCTION TO NUMERICAL METHODS IN CHEMICAL ENGINEERING

be reproduced in any form, by mimeograph or any other means, without permission in writing from
the publisher.

ISBN-978-81-203-4018-3

The export rights of this book are vested solely with the publisher.

Published by Asoke K. Ghosh, PHI Learning Private Limited, M-97, Connaught Circus,
New Delhi-110001 and Printed by Jay Print Pack Private Limited, New Delhi-110015.

To
my Mother
Kamla Ahuja
and
All my Students

3 Minimum Fluidization Velocity 21 2. Chemical Engineering Thermodynamics 3152 3.3 GaussSeidel Method 10 Exercises 12 2.2 Pressure Drop in Pipe 20 2.3 Flash Calculations Using Raoults Law 35 3.4 Terminal Velocity 23 2.5 Flash Calculations Using Modified Raoults Law 40 3.9 Chemical Reaction EquilibriumTwo Simultaneous Reactions 47 3.1 Solution of Cubic Equations of State 31 3.7 P-x-y Diagram Using GammaPhi Approach 43 3.2 Bubble Point and Dew Point Temperature Calculations Using Raoults Law 33 3.1 Newtons Method 17 2.2.8 P-x-y Diagram Using Cubic Equation of State 44 3.10 Adiabatic Flame Temperature 49 Exercises 50 vii . Nonlinear Algebraic Equations 1730 2.2 Gauss Elimination Method 5 1.5 System of Nonlinear Equations 25 Exercises 29 3.2 Dew Point Temperature Calculation 34 3.2. Linear Algebraic Equations 116 1.Contents Preface ix 1.1 Tridiagonal Matrix Algorithm (TDMA) 1 1.6 Vapour Pressure Using Cubic Equation of State 42 3.1 Bubble Point Temperature Calculation 33 3.4 Bubble Point and Dew Point Temperature Calculations Using Modified Raoults Law 37 3.

Chemical Reaction and Diffusion in a Spherical Catalyst Pellet 155170 8.3 Second Order Reaction 129 7.5 Transient Conduction in Rectangular Slab 176 9.1 Boundary Value Problems in Chemical Reaction Engineering 119 7.9 Plug Flow Reactor 74 4.1 Upwind Schemes 105 6.1 Solution of Single Ordinary Differential Equation 53 4.2 Comparison of CDS and UDS 113 Exercises 114 7.2 One-Dimensional Steady Heat Conduction 93 5. One-Dimensional Transient Heat Conduction 171191 9.1 Discretization in One-Dimensional Space 85 5.6 Transient Conduction in Cylinder 181 9.4 Von Neumann Stability Analysis 174 9.3 Chemical Reaction and Diffusion in Pore 97 Exercises 99 6.4 Pneumatic Conveying 60 4.1 First Order Reaction 155 8.1 First Order Upwind Scheme 105 6.5 Solution of Simultaneous Ordinary Differential Equations 63 4.7 Transient Conduction in Sphere 183 9.6 Series of Stirred Tanks with Coil Heater 66 4.2 Explicit and Implicit Discretization 172 9.3 Stirred Tank with Coil Heater 57 4.viii Contents 4.3 CrankNicolson Discretization 173 9. Boundary Value Problems 85104 5.7 Initial Value Problems in Chemical Reaction Engineering 68 4.1.2 First Order Reaction 120 7.3 Non isothermal Conditions 161 Exercises 169 9. ConvectionDiffusion Problems 105118 6.1 Classification of Partial Differential Equations 171 9.2 Double Pipe Heat Exchanger 55 4.1. Initial Value Problems 5384 4.10 Nonisothermal Plug Flow Reactor 76 Exercises 80 5.2 Second Order Reaction 158 8. Tubular Reactor with Axial Dispersion 119154 7.8 Transient Diffusion in Sphere 186 Exercises 188 .4 Multiple Reactions 131 Exercises 153 8.8 Batch and Stirred Tank Reactors 69 4.2 Second Order Upwind Scheme 106 6.

3 Relaxation Parameter 194 10.5 ADI Method for Steady Heat Conduction 208 10.6 ADI Method for Transient Heat Conduction 214 Exercises 220 Appendix: Programs in C++ 225283 Bibliography 285286 Index 287289 .1 Discretization in Two-Dimensional Space 192 10. Contents ix 10. Two-Dimensional Steady and Transient Heat Conduction 192223 10.2 GaussSeidel Method 194 10.4 RedBlack GaussSeidel Method 195 10.

These shorter examples usually illustrate a particular point by means of hand calculations. are presented in the Appendix and about 148 exercises (including chapter- end exercises with answers) are solved. Chemical Reaction Engineering. this book can be used for the numerical solution aspects of chemical engineering problems. Also. For the solution of nonlinear equation(s). By changing various parameters the student can find out the conditions under which correct results are obtained as well as those under which correct results are not obtained. for the courses on Chemical Engineering Mathematics or Applied Mathematics in Chemical Engineering. In addition to the computer examples. The computer programs are listed in C++. For the solution of boundary value problems the Finite Difference method is used. For the solution of linear algebraic equations. The author feels that before using chemical engineering software (which use advanced numerical methods). Gauss elimination. In this book the following Finite Difference methods are discussed: Central Difference Scheme (CDS) for discretization of diffusion terms. The Finite Difference method is a simple yet very powerful tool for the solution of boundary value problems. The author assumes that the students are at least moderately familiar with the C++ language. 33 sample programs in C++. Newtons method is discussed and for initial value problems in ordinary differential equations the RungeKutta fourth order method is discussed. the students should have some hands-on experience on small programs and introductory numerical methods as well as their usage in chemical engineering. It is the basis for the Advanced Finite Volume and Finite Element methods. and Heat Transfer are discussed using introductory but efficient numerical methods. Upwind Difference Scheme (UDS) for xi . and GaussSeidel methods are discussed. arranged by chapter. there are several much shorter examples appearing throughout the text. The numerical solutions of algebraic (linear and nonlinear) and differential (ordinary and partial) equations encountered in subjects such as General Chemical Engineering.Preface This book entitled Introduction to Numerical Methods in Chemical Engineering is designed for a course on Numerical Methods in Chemical Engineering and the associated Computer Applications Laboratory course offered as part of undergraduate programmes in chemical engineering. The experience gained from using these programs helps in the development of basic understanding of numerical methods and confidence in handling numerical techniques. the tridiagonal matrix algorithm (TDMA). Chemical Engineering Thermodynamics. The students can also use the programs and build up their own programs to solve specific Design Project problems in chemical engineering. Some problems whose analytical solutions are available are also solved and the numerical and analytical results are compared. but requires a structured grid.

on which the contents of this book are principally based. Institute of Technology. Chapter 1 contains an introduction to the numerical solution of a system of linear algebraic equations. Vapourliquid equilibrium calculations are done for systems following Raoults law. The numerical solution of tubular reactors with axial dispersion and simultaneous chemical reaction and diffusion in spherical catalyst pellets are discussed in Chapters 7 and 8 respectively. Feedback from students has critically guided the development and evolution of the book. and the Alternating Direction Implicit (ADI) method for the numerical solution of two-dimensional steady and transient heat conduction. Implicit and CrankNicolson methods. The numerical solution of initial value problems in ordinary differential equations. is given in the Bibliography. The author is also thankful to all his B. The numerical solution of one-dimensional transient heat conduction/diffusion is discussed in Chapter 9. . Various problems in vapourliquid and chemical reaction equilibria are discussed. along with the initial value problems in double pipe heat exchanger and stirred tanks with coil heater. New Delhi. Varanasi. The author would like to thank the Department of Science and Technology. for providing the major part of the funds for the purchase of Fluent 25 Users Perpetual License software in the Department of Chemical Engineering and Technology. The numerical solution of computer-oriented problems in Chemical Engineering Thermodynamics is discussed in Chapter 3. Sudarshan Das. The author expresses his thanks to all those authors. too numerous to acknowledge individually. Chemical Engineering students who have taken up the Computer Laboratory course and various computational and other chemical engineering courses so enthusiastically and helped in many ways in developing this work. GammaPhi approach and PhiPhi approach. Banaras Hindu University. invaluable advice and encouragement. Abhjit Baroi and Mr. The books referred to by the author for the preparation of class notes. The author is indebted to all his colleagues for many positive interactions and discussions and also to all his friends for their constant appreciation. S. and in batch. stirred and plug flow reactors are discussed in Chapter 4. The author is grateful to Mr. The numerical solution of boundary value problems in ordinary differential equations and convectiondiffusion problems are discussed in Chapters 5 and 6 respectively. modified Raoults law.xii Preface discretization of convection terms. and that of two-dimensional steady and transient heat conduction is discussed in Chapter 10. The book is thus dedicated to all his students.N. The numerical solution of a single as well as two (simultaneous) nonlinear algebraic equation(s) and the calculation of pressure drop in a pipe under nonlaminar conditions. Director. taking it from a handwritten collection of notes to the present form.Tech. for providing partial financial support and Prof. Mr. Their inquisitive questions and enthusiasm towards the numerical solution of algebraic and differential equations in chemical engineering inspired the author to create a work of this kind. The Finite Difference method is used for the solution of boundary value problems in Chapters 510. which proved immensely useful in the process of writing this book. in which the numerical solution of various equations in chemical engineering is provided under one cover. Forward in Time and Central in Space (FTCS) difference scheme for discretization of the one-dimensional transient conduction/diffusion equation adopting the Explicit. Pankaj Manohar of PHI Learning for their cooperation. Upadhyay. minimum fluidization velocity and terminal velocity are all discussed in Chapter 2.

The author would be rather grateful if such errors are pointed out. help and understanding. Pradeep Ahuja . to his father A. some errors might have crept into the book. He would also very much appreciate any criticism or suggestion for improvement of the contents of the book from the readers. In spite of all efforts to the contrary. Ahuja. and his wife Preeti Bala Ahuja. for their care. Preface xiii The author is indebted and extremely thankful to his mother Kamla Ahuja.D. as without their support this work could never have been completed.

but if the equations are of tridiagonal type. and super-diagonal (ci. and the iterative method discussed is the Gauss-Seidel method. A tridiagonal or block tridiagonal set of linear algebraic equations is formed during the discretization of ordinary and partial differential equations. and thus is called a tridiagonal matrix. The algorithm for the solution of this sort of linear algebraic equation is called the TriDiagonal Matrix Algorithm or the Thomas algorithm. The GaussSeidel method is used for the solution of two-dimensional steady heat transfer. Chapter 1 Linear Algebraic Equations A system of linear algebraic equations can be solved by direct or iterative methods.1) « »« » « » «    » « » « » «    » « » « » « »« » « » « C0  D0  E0  » « Z 0  » « F 0  » « »« » « » ¬« C0 D0 ¼» ¬« Z 0 ¼» ¬« F 0 ¼» N linear algebraic equations can be written in the form Ax = d. i = 1 to N). which is discussed in Chapter 10. i = 1 to N  1). 1. All types of linear algebraic equations can be solved using the Gauss Elimination method. sub-diagonal (ai.1 Tridiagonal Matrix Algorithm (TDMA) TDMA is a direct method. i = 2 to N). The discretization of differential equations using the finite difference method is discussed in Chapters 5 to 10. The matrix A contains elements on the diagonal (bi. Consider the following tridiagonal set of linear algebraic equations: ªD E º ª Z º ª F º «C D E » «Z » «F » «  »«  » «  » « C D E » « Z » « F » « »« » « » « C D E » « Z » « F » «    » « » « » (1. then TDMA is very fast as compared to the Gauss Elimination method. 1 . The direct methods discussed in this chapter are the TriDiagonal Matrix Algorithm (TDMA) and Gauss Elimination methods.

7) D The algorithm for the solution of a tridiagonal set of linear algebraic equations is given below: (i) Calculate bi and gi for i = 1 to N. cN = 0 (1.5) © C  ¹ K a1 = 0. C0 E Z  (iii) Calculate Z HK  for i = N  1. (1.2) Let us write the solution at xi in terms of xi+1 as E Z  Z H  K K K K (1. therefore xN = g N. we get C E  C D  K K (1. . Thus we get § E Z · C ¨ H    ¸  D Z  E Z  K K K K K K K K F K © C  ¹ K The above equation can be written as § C E  · ¨D  ¸Z F  CH  E Z  K K K K K K K  K K © C  ¹ K Thus F  C H  E Z  Z  K K K K § · § C E  · K K C E  ¨D  ¸ ¨D  K K K K ¸ K K © C  ¹ © C  ¹ K K Comparing with Eq. Since cN = 0. E Z (ii) Calculate Z 0 H 0  0 0  .2 Introduction to Numerical Methods in Chemical Engineering The equations are of the type C Z   D Z  E Z  K K K K K K F K where a1 = 0. (1. therefore b1 = b1 (1. 3.3b) C K  where bi and gi are obtained by substituting Eq.3a).3b) into Eq. (1.6) and F H (1. N  2.3a) CK Then we can also write E  Z Z K H K   K K (1. K K K CK .2).4) K K C K F  CH  F  CH  HK K K K K K K § C E  · CK ¨D  ¸ K K K (1. 1. 2.

Linear Algebraic Equations 3 EXAMPLE 1.1 Solve the following set of linear algebraic equations using TDMA ª   º ª Z º ª  º «    » «Z » «  » « »« » « » «    » « Z » «  » « »« » « » «    » « Z » «  » «    » « Z » «  » « »« » « » «   » « Z » «  » «« ¬   »»¼ ««¬ Z »»¼ ««  »» ¬ ¼ Solution We have C D   F  H  D  C E   C D    C   F  CH     u    H C        C E   C D     C        F  CH   H  C    C E   C D     C     F  CH     H  C    C E   C D    C     .

 Z H   E Z    Z H     u  C    E Z   u  Z H      C   E Z  u  Z H       C  E Z  u  Z H       C  E Z   Z H      C   E Z  Z H     C  .4 Introduction to Numerical Methods in Chemical Engineering F  CH      H C     C E   C D     C        F  CH    H C     C E   C D     C        F  CH    H C     Now let us compute the solution starting with x7.

eliminate x1 from the third C equation by multiplying the first equation by  and then adding it to the third equation. The Gauss Elimination method reduces the system of equations to an upper triangular system which can then be solved by back substitution.1 uses the above method for solving the tridiagonal system of linear algebraic equations and is given in the Appendix. x2. Thus x2 is eliminated from the third equation. Linear Algebraic Equations 5 Program 1. and x3 can be obtained by back substitution. Similarly.8) « C C C F »¼ ¬ C Take the element a11 as the pivot.9) « c C c Fc »¼ C ¬ c C Now take the element a¢22 as the new pivot. This procedure is called partial pivoting. The pivots should be chosen in such a way that they are nonzero. which then becomes C § CC · § CC · C ¨ C  ¸ Z  ¨ C  ¸ Z F  F © C ¹ © C ¹ C Thus x1 is eliminated from the second equation.10) «  cc C Fcc »¼ ¬ The values of x1. 1. Consider the following system of three linear algebraic equations: C Z  C Z  C Z F C Z  C Z  C Z F C Z  C Z   C Z F The augmented matrix is ª C C C F º « » « C C C F » (1. Multiply the second equation by  and then c C add it to the third equation. Multiply the first equation by   and then add it to the second equation. At the end of the second stage the augmented matrix becomes ª C C C F º « » « c C c C Fc » (1. Rows can be exchanged so that the pivot is nonzero. .2 Gauss Elimination Method Gauss Elimination is a direct method. C At the end of the first stage the augmented matrix becomes ª C C C F º « » « c C c Fc » C (1.

From the second equation we get 9.6x3 = 42. Multiply the second equation by  and then add it to the  third equation. We get  ª    º « » «     » «     » ¬ ¼  This completes the first stage.2 Solve the following set of three linear algebraic equations in three variables using the Gauss Elimination method:  Z  Z    Z   Z   Z   Z  Z   Z    Z  Solution The augmented matrix is ª    º « » «    » «    » ¬ ¼  Multiply the first equation by  and then add it to the second equation. we get x3 = 5.418367 Solving.8x2 + 0. We get ª    º « » «     » «     »¼ ¬ From the previous equation we get 9.6 Introduction to Numerical Methods in Chemical Engineering EXAMPLE 1. We get  ª    º « » «     » «     »¼ ¬  Multiply the first equation by  and then add it to the third equation.68367x3 = 48.2    u  Thus Z   From the first equation we get 10x1 + x2 + 2x3 = 44 .

3 Solve the following set of three linear algebraic equations in three variables using the Gauss Elimination method:  Z  Z    Z   Z   Z   Z  Z  Z    Z  Solution The augmented matrix is ª     º « » «    » «    » ¬ ¼  Multiply the first equation by and then add it to the second equation. We get ª   º « » «   » «    »¼ ¬ From the previous equation. EXAMPLE 1. we get x3 = 1. Linear Algebraic Equations 7      u  Thus Z . We get  ª    º « » «   » «    » ¬ ¼ Multiply the second equation by 0.3076923 and then add it to the third equation.2 uses the Gauss elimination method for solving a system of linear algebraic equations and is given in the Appendix. We get  ª    º « » «   » «   »¼ ¬  Multiply the first equation by  and then add it to the third equation.5384 Solving.5384x3 = 3. we get 3.  Program 1. .

1.24 x2 = 0.10 B2 x3 = 0.65 x4 = 0.  EXAMPLE 1. D2.1. and xylene (4) are to be separated in the sequence of distillation columns shown in Fig.  From the first equation. .16 B1 x2 = 0. and xylene (4) are given below. The molar flow rate of the feed stream is 70 mol/min.35 x2 = 0.15 D2 x1 = 0. toluene (2). we get 3x1 + x2  2x3 = 9  Thus Z . D2.21 x2 = 0.4 Benzene (1). Also.15 B x1 = 0. Solution The material balance equations for benzene (1). B1. determine the molar flow rates and compositions of streams B and D.18 x3 = 0.42 x1 = 0. styrene (3). and B2 is shown in the figure.04 x4 = 0. D1 x1 = 0.1 Schematic diagram for Example 1.3333x2  3.6667x3 = 5    Thus Z  .4. 1. we get 4.54 x3 = 0. toluene (2).10 x4 = 0.40 70 mol/min x4 = 0. styrene (3).54 x3 = 0. and B2.24 Fig.8 Introduction to Numerical Methods in Chemical Engineering From the second equation.25 x4 = 0.01 x2 = 0. The composition of the feed stream and the streams D1. B1. Determine molar flow rates of streams D1.20 x3 = 0.07 D x1 = 0.

25 mol/min.5 mol/min D2 = 8. we get D1 = 26. Linear Algebraic Equations 9  u  &   \$  &  \$  u   &   \$   &   \$  u   &   \$   &  \$  u   &  \$  &   \$ The above equations can be written as ª    º ª & º ª  º « « » «    »» « \$ » « » « » «    » « & » «» « »« » « » «¬    »¼ ¬« \$ ¼» ¬«¼» Solving by using the Gauss Elimination method. The composition of stream B is given by &  \$ Z\$  \$  &   \$ Z \$  \$  &  \$ Z\$  \$ &   \$ Z \$  \$ D = D1 + B1 = 43. B = D2 + B2 = 26.75 mol/min B2 = 17.25 mol/min B1 = 17. The composition of stream D is given by &   \$ Z&  &  &   \$ Z &  & .5 mol/min.75 mol/min.

then on the right hand side for the variables x1 and x2 the updated values calculated from the first and second equations are used. when the new value of x2 is computed from the second equation then on the right hand side for the variable x1 the updated value calculated from the first equation. when the new value of x3 is calculated from the third equation. let us back-calculate the feed composition. The variable whose coefficient is the largest is used to express that variable in terms of the others. By doing this a higher convergence rate is obtained. So the latest values of the variables are always used. Now. Now we can assume some values of the variables. let us check the solution obtained. Consider a system of N linear algebraic equations in N variables. The GaussSeidel method has the disadvantage of not always converging to a solution and of sometimes converging very slowly. which is correct. and so on. . B + D is 70 mol/min. the second equation can be written with variable x2 on the left hand side and the rest of the terms on the right hand side. The first equation can be written with variable x1 on the left hand side and the rest of the terms on the right hand side. In the above explanation it is assumed that in the first equation the coefficient of x1 is the highest among the coefficients of the other variables. this method will always converge to a solution when the magnitude of the coefficient on the left hand side is sufficiently dominant with respect to the magnitudes of the other coefficients in that equation. &Z&  \$Z\$   &Z  &  \$Z  \$   &Z &  \$Z \$   &Z  &  \$Z  \$   1. Similarly.3 GaussSeidel Method GaussSeidel is an iterative method.10 Introduction to Numerical Methods in Chemical Engineering  &   \$ Z &  &  &  \$ Z&  & Now. and so on. and in the second equation the coefficient of x2 is the highest among the coefficients of the other variables. and compute the new value of x1 from the first equation and the new value of x2 from the second equation. Similarly. A survey of the given system of linear algebraic equations is made and that variable which has the highest coefficient is kept on the left hand side. However. All the equations have many variables in them. is used. In the GaussSeidel method.

Thus   ZP   ZP ZP      ZP   ZP ZP     ZP    ZP  ZP   Let us assume x2 = 0.5 Solve the following set of three linear algebraic equations in three variables using the GaussSeidel method: 10x1 + x2 + 2x3 = 44 2x1 + 10x2 + x3 = 51 x1 + 2x2 + 10x3 = 61 Solution It can be seen that the coefficient of x1 is dominant in the first equation. Linear Algebraic Equations 11 EXAMPLE 1.3 uses the GaussSeidel method for solving a system of linear algebraic equations and is given in the Appendix. x3 = 0. x 2 = 4. The initial values used will not affect the converged solution. and the coefficient of x2 and x3 are dominant in the second and third equations. First Iteration:      Z      u    Z          Z   Second Iteration:      u  Z      u    Z        u  Z   The final converged solution is x1 = 3. but will affect the number of iterations required for convergence. respectively.6 Solve the following set of three linear algebraic equations in three variables using the GaussSeidel method:  Z  Z    Z   Z   Z   Z   Z  Z    Z  . x3 = 5. Program 1. EXAMPLE 1.

x3 = 1. x3 = 0. x4 = 144.11.1 Solve the following using TDMA: ª   º ª Z º ª  º «    » « Z » « » « »« » « » «    » « Z » «  » « »« » « » «     » « Z » «  » «     » « Z » «  » « »« » « » «    » « Z » «  » «   » « Z » «  » « »« » « » ¬«   ¼» ¬« Z ¼» ¬«  ¼» (Ans: x1 = 111.66. second and third equations in the form   ZP   ZP ZP     ZP    ZP ZP     ZP   ZP  ZP   Let us assume x2 = 0.12 Introduction to Numerical Methods in Chemical Engineering Solution Let us write the first. x3 = 133.55. x8 = 188. First Iteration:  Z        Z         Z    Second Iteration:      u  Z        u  Z         Z    The final converged solution is x1 = 3. Exercises 1.33. x6 = 166.77.44.88) .22. x7 = 177. x2 = 2. x2 = 122. x5 = 155.

44.3 Solve the equations in Problem 1.2 Solve the following linear algebraic equations using the Gauss elimination method: 2x1  x2 = 100  x1 + 2x2  x3 = 0  x2 + 2x3  x4 = 0  x3 + 2x4  x5 = 0  x4 + 2x5  x6 = 0  x5 + 2x6  x7 = 0  x6 + 2x7  x8 = 0  x7 + 2x8 = 200 Note that the augmented matrix for this problem is ª          º « » «          » «          » « » «          » «          » « » «           » «          » « » «¬          »¼ (Ans: x1 = 111.77. Note that the equations are expressed in the form   ZP ZP   ZP   ZP ZP   ZP   ZP ZP   ZP   ZP Z P   ZP   ZP ZP   .2 using the GaussSeidel method.33. x6 = 166. x3 = 133.88) 1.22. x7 = 177. x5 = 155.11. x8 = 188.55.66. x2 = 122. Linear Algebraic Equations 13 1. x4 = 144.

x3 = 3) 1. x8 = 188. x2 = 2. x3 = 2.4 Solve the following linear algebraic equations using the Gauss elimination method: 4x1 + 2x2 + x3 = 11 x1 + 2x2 = 3 2x1 + x2 + 4x3 = 16 Note that the augmented matrix is ª    º « » «    » «     » ¬ ¼ (Ans: x1 = 1.8571) . x3 = 133.2857. x6 = 166. x2 = 1.44. x7 = 177. x5 = 155.11.14 Introduction to Numerical Methods in Chemical Engineering ZP   Z P ZP   ZP   ZP Z P     Z P  ZP   (Ans: x1 = 111.77. x4 = 144. x3 = 3) 1.5 Solve the linear algebraic equations of Problem 1. x2 = 122. x2 = 2.55.88) 1.4 using the GaussSeidel method: Note that for GaussSeidel to converge the equations are expressed in the form    ZP  ZP ZP     ZP  ZP      ZP   ZP  ZP   (Ans: x1 = 1.22.66.33.9286.6 Solve the following linear algebraic equations using the Gauss elimination method:  Z   Z   Z  Z   Z  Z   Z   Z   Z  (Ans: x1 = 1.

T3. T2.1 = 47. x3 = 2.3 = 182. T3.7 Solve the linear algebraic equations of Problem 1.3 = 182.86.8571) 1.2857. T3.86) .1 = 47. Linear Algebraic Equations 15 1. T2.3 = 220.2 = 91.14.6 using the Gauss-Seidel method: Note that for GaussSeidel to converge the equations are expressed in the form    ZP   ZP ZP     ZP   ZP ZP      ZP    ZP  ZP   (Ans: x1 = 1.9286.25.8 Solve the following linear algebraic equations using the Gauss elimination method: ª          º ª6  º ª  º «   « » «        »» «6  » «  » « » «          » «6 » «  » »« »  « « » «          » «6  » «  » «          » «6 » « » « »« » « »  «         » «6  » «  » «          » ««6 » » «  » « »  « » «         » «6  » «  » « »« » « » ¬«          ¼» ¬«6  ¼» ¬«  ¼» Note that for using the Gauss elimination method the equations have to expressed in the form of augmented matrix as ª           º « » «           » «           » « » «           » «          » « » «           » «           »» « «           » « » «¬           »¼ (Ans: T1.32.00. T2. T1.18.2 = 91. x2 = 1.1 = 57.14.2 = 115.25. T1.

T1.14.3 = 220.2 = 91. T1.32. T2. T2.1 = 57.3 = 182. T3.25.3 = 182.00.9 Solve the following linear algebraic equations using the GaussSeidel method: 6  6  6     6  6   6 6    6  6  6    6  6   6  6   6 6  6  6 6   6 6    6  6   6  6  6    6   6  6   6   6  6  6     Note that for GaussSeidel to converge the equations are to be expressed in the form   6P  6 P 6 P      6P   6 P  6 P   6 P       6P  6 P   6 P      6P  6 P  6 P   6 P       6P  6 P  6 P  6 P 6 P        6P   6 P   6 P   6 P       P  P P    6  6 6  P  P  P P  6  6  6   6  P  P  P  6  6   6  (Ans: T1.14.16 Introduction to Numerical Methods in Chemical Engineering 1.86.1 = 47.2 = 91.18.2 = 115. T2. T3. T3.25.1 = 47.86) .

FZ H (iii) Calculate the new value of x. xn+1 = xn. if more than one real root occurs. In Fig. The value of x is again updated and the procedure is repeated till there is no change in the previous and updated values of x.1). Note that when the root is obtained. that function value should become zero at the root. there is no change in the value of x. Examples discussed include the calculation of pressure drop in a pipe in nonlaminar range. 2. which implies f = 0. That is.1) Hc where xn is the value of x at the start of the iteration and xn+1 is the updated value after the iteration. different roots can be obtained. Chapter 2 Nonlinear Algebraic Equations Newtons (or NewtonRaphson) method for the numerical solution of a nonlinear algebraic equation is described first in this chapter. Note that Newtons method works only if.1 Newton's Method The function f is formulated in such a way that the polynomial or the expression whose root is to be determined is of the form f (x) = 0. FH (ii) Calculate f and H c at the value of xn. the function value becomes zero at the root xs. at f = 0. First an initial value of x is assumed. 2. else 17 . By taking different starting (old) values. stop. Thereafter the solution of two simultaneous nonlinear algebraic equations is discussed using Newtons method. Hc (iv) Check if Z P   Z P  F . which is the required condition. Newtons method is given by H Z P  ZP  (2. if yes. The algorithm of Newtons method is: (i) Take an initial value of xn. using Z P  Z P  .1. The assumed value is updated by using Newtons formula. and again the function value and its derivative are determined at this new value of x (see Fig. 2. and the calculation of minimum fluidization velocity and terminal velocity. and the function value and its derivative are determined at this assumed value. the derivative of the function is not zero. In this case the starting value is taken to be x1.

The derivation of Newtons formula is presented below. f f1 f2 f3 x 0 x1 x2 x3 xs Fig. Let a nonlinear algebraic equation be represented as f (x) = 0. We make a Taylor series to approximate f(x) in the vicinity of x0 as follows:  FH H Z. 2. e is the convergence criterion and may be of the order of 106. Let us start with an initial guess x0 of the solution and let us assume that it is close to the actual solution xs.18 Introduction to Numerical Methods in Chemical Engineering (v) Make xn = xn+1 and go to Step (ii) and repeat the procedure till the condition stated in (iv) is satisfied.1 Concept of Newtons method.

.

H Z  FZ Z  Z .

  FFZ H Z  Z .

H Z 5 = 0 and the Taylor series yields FH  F H .     " Z Z At the solution.

.

Z .

then   Z5  Z   Z5  Z   Z5  Z   " In this case. x1. as long as the first derivative is nonzero at x0. we obtain a reasonable approximation of the solution.   H Z  Z5  Z   5  Z " FZ Z  FZ  Z If x0 is sufficiently close to xs. from the rule FH  .

H Z  FZ  Z   Z .

(2.2) Z Successive application of this rule yields Newtons method for solving a single nonlinear algebraic equation in the form Z P  P Z  .

H ZP H c Z .

P .

Nonlinear Algebraic Equations 19 where f ¢ denotes the derivative of the function with respect to x.0 1.2 Various iterations in Newtons method for starting value of x 4 P  P H Iteration number Starting point f f¢ Z Z  Hc 1 4.00000 3.0 2.1.00000 0.0 30.0 4.5 1.00022 0. The iterations are stopped when the previous and updated values of x are less than eabs.0 Thus the three roots on which the solution converges are (2.10426 2.00022 6 2.0 2. that is Z P   Z P  F CDU (2. For the above equation the starting values taken and the corresponding roots are listed in Table 2.00176 2. and f ¢ = 3x2  4x  1 .37852 3.0 2.0 1.03959 3.0 1. f = x3  2x2  x + 2.03533 13.0 2.0 1. Newtons method discussed here determines only the real roots. Various iterations in Newtons method to determine the real root of the equation x3  2x2  x + 2 = 0 with starting value x = 4 are listed in Table 2.0 2. 1.0 100.0 0.0 1.0 28.38803 3 2.01529 2.00000 7 2.2.82478 6.1 Different roots obtained by taking different starting values in Newtons method Starting value Real root of x3  2x2  x + 2 = 0 by Newtons method 4.10969 4 2.00000 2.92857 7. Table 2.0 100.00000 In Table 2. Different roots are obtained by taking different starting values of x. Table 2.25 1.4) Z P  Consider that the real roots of the equation x3  2x2  x + 2 = 0 have to be determined.10969 0.01297 0.01297 5 2.55594 2.2.0 1.92857 2 2.00066 3.5 1. 1).0 0. .3) or Z P   Z P  F TGN (2.0 0.91362 2.38803 1.

it can be checked that the solution is 0. 2.8  S '2 (2.5.20 Introduction to Numerical Methods in Chemical Engineering EXAMPLE 2.0015 mm.6) 4G S8& where 4G .8  S '2 & Density of air at 25°C and 1 atm is 1.23 kg/m and viscosity is 1.5) & where 8 is the average velocity in the pipe of internal diameter D and the fluid density is r. the friction factor under laminar flow conditions is given by  H (2.2 Pressure Drop in Pipe The pressure drop in a pipe of length L is given by the relation H.201640. But for nonlaminar conditions the Colebrook equation has to be solved using Newtons method as described in the example below.5).79 ´ 105 kg/m-s. Solution With an initial value of 0. For the entire nonlaminar range the friction factor is given by the Colebrook N relation  § F &  ·   NQI ¨  ¸¸ (2. (2.5. When the pressure drop is given by Eq.7) H ¨  4G H © ¹ For the laminar conditions the friction factor can be easily determined.1 Apply Newtons method to determine a real root of the equation f (x) = x3  5x + 1 = 0 Take the initial approximation as x0 = 0. Calculate the friction factor using the Colebrook equation  § F &  ·   NQI ¨  ¸¸ H ¨  4G H © ¹ Determine the pressure drop in a 1 m section of the tube using the relation H. The roughness is e = 0. EXAMPLE 2. 3 Solution We have F   &  .2 Air at 25°C and 1 atm flows through a 4 mm diameter tube with an average velocity of 50 m/s.

F. Nonlinear Algebraic Equations 21 S8&  u  u  u   4G  N  u   Thus  §   ·   NQI ¨  ¸ H ¨   H ¸¹ © or  §  u   ·   NQI ¨  u    ¸¸ H ¨ H © ¹ Let us define a function. as  §  u   · (   NQI ¨  u    ¸¸ H ¨ H © ¹ The derivative of the function with respect to the friction factor is given by  u  u   u  .

H  (c   H    u     u   H  Using Newtons method. 2. Under these conditions the pressure drop in a 1 m section of the pipe is given by  u  u   u  '2  N/m2 = 11.19 kPa  u  Program 2. medium and high Reynolds number for pressure drop across a packed bed:   N X'.1 for calculating the pressure drop in a pipe under nonlaminar conditions is given in the Appendix.3 Minimum Fluidization Velocity Ergun proposed the following general equation applicable for low.0291.   F . we get f = 0.

 S X  '.   F .

r and m are respectively the density and viscosity of the fluid. dp is the particle diameter. At the point of incipient fluidization the force obtained from the pressure drop across the fluidized bed (DP ´ A) is equal to the gravitational force exerted by the mass of the particles minus the buoyancy force.8) GU F R F GU F R F where n is the superficial velocity of the fluid. fs is the sphericity of the particle. If Lmf is the height of the packed bed at the point of minimum fluidization . and DP is the pressure drop across the packed bed of length DL . '2      (2. e is the voidage in the packed bed.

OH #   F OH . then the total volume of the bed at minimum fluidization is Lmf ´ A and thus the volume of solids at minimum fluidization is Lmf A(1  emf). Thus at minimum fluidization conditions '2 u # .22 Introduction to Numerical Methods in Chemical Engineering and emf is the voidage of the packed bed at minimum fluidization. The gravitational force of the particles minus the buoyancy force is given by volume of the solid particles ´ (rp  r)g.

S R  S .

I (2.9)
or
'2
  F OH

S R  S

I (2.10)
.OH

Substituting this value in the Ergun equation for packed bed, we get

ª S   F OH

º  ª N   F

 º
«  » OH «  
X  
OH
» XOH    F OH

S R  S .

97. The voidage at minimum fluidization is 0.845 ´ 105 kg/m-s. Solution The density of air at 2.88.12 mm.0 atm and 25°C is given by 2/  u  u  u   S  kg/m3 46  u  The diameter of the particle is d p = 1.3 Solid particles having a diameter of 0. I  (2. The function is ª S   F OH . The viscosity of air under these conditions is 1.2*10-4 m.11) G F ¬« U R F OH ¼» «¬ GU F R F OH »¼ The real roots of the minimum fluidization velocity can be obtained using Newtons method.42.0 atm and 25oC. EXAMPLE 2. The molecular weight of air is 28. and a density of 1000 kg/m3 are to be fluidized using air at 2. shape factor fs = 0.

º  ª N   F .

 º H «  » XOH  «    OH » XOH    F OH .

S R  S .

I
«¬ GU F R F OH »¼ «¬ GU F R F OH »¼

and the derivative of the function with respect to nmf is

ª S   F OH

º  N   F OH

H c «  » XOH    
«¬ GU F R F OH »¼ GU F R F OH

Starting with an initial value of nmf = 0.1 m/s, the converged value is nmf = 0.0046 m/s.

Program 2.2 for calculating the minimum fluidization velocity is given in the Appendix.

Nonlinear Algebraic Equations 23

2.4 Terminal Velocity
Consider a particle of mass m kg falling at velocity of v m/s (see Fig. 2.2). The momentum
balance equation is given by
FX R
O
(I  (D  (& (2.12)
FV
Gravitational force minus the buoyancy force on the particle is given by
O
(I  (D 8R S R  S

I SR  S

Thus Eq.13) SR where VP is the volume of the particle and m is the mass of the particle.2 Various forces acting on particle falling in stationary fluid. I (2. 2. FD Fg  Fb = (rp  r)Vpg Fig.14) becomes   S XV  O  SR SR  S . (2. The terminal velocity or free settling velocity is a constant velocity fall and is given when FX R  .14) (& # R CD is given by % & . thus FV (I  (D (& (2.

As the velocity of particle rises the drag force also increases till the drag force balances the (gravitational  buoyancy) force.15) where Ap is the projected area of the particle on a plane at right angles to the direction of motion and nt is the terminal velocity of the falling particle. I S R  S . I  S #R%& XV (2. Thus.

O XV S R #R% & S .

24 Introduction to Numerical Methods in Chemical Engineering For spherical particles.   Q O Q TR S R F R S R   and the projected area is given by Q F R #R Q TR  Thus for spherical particles the expression for terminal velocity becomes  S R  S .

that is. in the Stokes law region  %& (2. We get the N following expression for terminal settling velocity in the laminar flow regime IF R S R  S . IF R X (2.17) 4G R S XF R where Rep is the particle Reynolds number and is given by 4G R .16) % S V & For laminar flow (Rep < 1).

44 (Rep > 1000 to 2 ´ 105). there are many correlations.18)  N V For turbulent flow. CD = 0. The Schiller and Nauman correlation is applicable for Rep < 800 and is given by  %& 4G R    4G  R . But for intermediate values of the particle Reynolds number. X (2.

(ii) At the assumed value the particle Reynolds number is calculated and thereafter CD is determined.19) The terminal velocity for the case of intermediate values of particle Reynolds number is determined using the following steps: (i) A value of terminal velocity is assumed.  S R  S . (2.

. % S V & If the assumed value and recalculated values are different. The procedure is repeated till the absolute value of the difference between the new value and the previous value of the terminal velocity in an iteration is negligible. IF R (iii) The terminal velocity is recalculated using X . the new calculated value becomes the starting value for the next iteration.

Nonlinear Algebraic Equations 25 EXAMPLE 2.85 ´ 105 kg/m-s. Calculate the terminal settling velocity of the particles. For air at these conditions.4 Oil droplets of diameter 2 mm are to be settled from air at 25°C and 1 atm. CD is given by  %& 4G R   4G  R . The density of oil is 900 kg/m3. m = 1.

m = 1.03 3.52 6. Solution The following data are given: dp = 2 ´ 103 m.5 191.5 1.35 0.47 6.3 for calculating the terminal velocity is given in the Appendix.38 0.47 6.85 ´ 105 kg/m-s.83 8.47 6.47 825.0 0.2 790.5 System of Nonlinear Equations We now extend Newtons method to solve a set of N simultaneous nonlinear algebraic equations for N unknowns. H Z  Z  Z !  Z 0 .5285 m/s.2 6. 2. Table 2.63 1.52 The terminal velocity obtained is 6. Program 2.9 625.6 Assumed nt Rep CD nt 0.0 0. The density of air under the given conditions is given by 2/  u  u   S  kg/m3 46  u  The particle Reynolds number is given by SI XV F R  u XV u  u   4G R XV N  u   The calculations are presented in Table 2.82 4.9 4.3 Calculations in Example 2.3.

 H Z  Z  Z !  Z 0 .

 H Z  Z  Z !  Z 0 .

 " H 0 Z  Z  Z !  Z 0 .

 We define the vector of unknowns .

representing the ith function in the vicinity of the current estimate xn as 0 0 0 HK    HK HK Z .26 Introduction to Numerical Methods in Chemical Engineering 6 Z > Z Z Z " Z 0 @ and write the system of equations as f (x) = 0 We use a Taylor series expansion to obtain Newtons method.

.

Ç HK Z P   Z ZO  Z OP   .

ZO  Z OP  Z  Z Ç Ç Z R  Z PR " .

.

O  O ZP O  R  O R ZP n Assuming that x is sufficiently close to the true solution xS. we can drop the quadratic and higher order terms 0 .

Ç ZHOK Z5 O  ZOP .

20) Z KO O P Z The truncated Taylor series expansion then becomes 0  | HK Z P  . K (2.   HK Z P   O  ZP For convenience we collect the first partial derivatives into the N ´ N Jacobian matrix H .

¦ .KOP ZOP   ZOP .

O  or 0 ¦ P 'Z P  . KO O   HK Z P .

(2.22) The terms on the left hand side of Eq. P 'Z P  . The linear system is . (2.21) are the ith component of a matrixvector product.21) O  where the update vector is given by 'Z P  Z P   Z P (2.

. x 2 . x3 . ËH H Û Ì  Z Z Ü Ë 'Z Û ËH Û Ì Ü Ì    Ü Ì 'Z Ü (2. x N . that is 'ZP   F CDU  'ZP   F CDU  'ZP   F CDU ! 'Z 0P   F CDU (2.23). x2).... x2) and f2(x1. The change in the values of x1 and x2 are determined using Eq.24) Let us consider two nonlinear equations f1(x1.23) Iterations are performed till there is no change in x1 . (2. some initial values of x1 and x2 have to be assumed. To start the iteration. H ZP (2.25) Í Ý Í H Ý H H ÌÍ   Z  Ü Z Ý .

Thus Eq. f2. H H H H (ii) Calculate f1. Nonlinear Algebraic Equations 27 Now we have to find the inverse of the Jacobian matrix.28) 'Z & and H  H  H  H Z Z (2. (2.26) Ì  Z Z ÜÝ Í  where H H H  H &    (2.27) Z Z Z Z Thus H H H  H  Z Z (2. and . P  P Go to (ii) till Z  Z  F and ZP   ZP  F . .29) 'Z & The algorithm for solution of two simultaneous nonlinear algebraic equations is given below: (i) Assume x1 and x2. Z  Z Z  Z (iii) Calculate Dx1 and Dx2. . The inverse of a nonsingular Ë C C Û   Ë C  C Û 2 ´ 2 matrix # is given by # Ì .5 Obtain the values of x and y that satisfy the following two nonlinear algebraic equations: H Z [ . EXAMPLE 2. .25) can be ÌC Í  C ÜÝ FGV # Í  C C ÜÝ written as Ë H  H Û  Ë 'Z Û  Ì Z Z Ü Ë H Û Ì 'Z Ü  Ì Ü Í Ý & Ì H  H Ü ÌÍ H ÜÝ (2. and (iv) Calculate new values of x1 and x2.

G Z  Z[    I Z [ .

UKP Z[  Z  [    Solution The partial derivatives of function f are given by H GZ  [ Z H Z [ .

28 Introduction to Numerical Methods in Chemical Engineering The partial derivatives of function g are given by I [ EQU Z[   Z I Z EQU Z[   [ Let us assume x = 0. H Z [ .1 and y = 0.5.

G Z  Z[    I Z [ .

9685  0.0008 1.9696 2.4.5406  0.13036 = 0.0295  0.9676 0.9992 0 1.5 + 0.4 Summary of iterations in Example 2.6157  0.03036 2.00088 0. UKP Z[  Z  [     H G Z  [  Z H Z  [ I [ EQU Z[    Z I Z EQU Z[    [ H I H I &   Z [ [ Z H I I  H [ [        'Z   &  I H H I '[ Z Z         &  New x = 0.5406 = 1.00086 0.6052 0.1  0.0107  0.0324 1.9992 0.9685 0.03036 New y = 0.99914 1.9676  0.5 H H I I x y f g D Dx Dy Z [ Z [ 0.0097 2. Table 2.0017  0.1 0.3991 1.0406 0.0721  0.03036 1.0008 0 1 0 0 2 0 2 1 2 0 0 .13036 0.0000  0.9992 0 0.0115 0.5 0.0406 The iterations are summarized in Table 2.0406  0.5 1.0615 0.0307 0 0.00086 1.1 1.9992 1 1.1552  0.1 1.

6 Modify Program 2. EXAMPLE 2. Program 2.4 for the solution of the above two simultaneous nonlinear equations is given in the Appendix. Nonlinear Algebraic Equations 29 The solution of the given nonlinear algebraic equations is x = 0 and y = 1.4 to solve the following system of two nonlinear algebraic equations: H Z  Z . Note that when f = 0 and g = 0 the solution is obtained.

 Z   Z    H Z  Z .

(Ans: 0.03467.79 ´ 105 kg/m-s. and density of 1000 kg/m3 are to be fluidized using air at 2. Exercises 2. shape factor fs = 0. (Ans: 2.4 can be modified to obtain the following solution: x1 = 3 and x2 = 4. The roughness is e = 0.33 kPa) 2. DP = 3.2 Air at 25°C and 1 atm flows through a 4 mm diameter tube with an average velocity of 25 m/s.3 Solid particles having a diameter of 0.0 atm and 25°C. The molecular weight of air is 28.  Z  Z    Solution For the given nonlinear equations H H H  H  Z  Z  Z CPF  Z  Z Z  Z Z  Program 2.97.845 ´ 10-5 kg/m-s. The friction factor is given by  § F &  ·   NQI ¨  ¸¸ H ¨  4G H © ¹ Determine the pressure drop in a 1 m section of the tube using the relation H.39.000611 m/s) . The voidage at minimum fluidization is 0. (Ans: f = 0.0015 mm.1 Determine the root of the equation  Z    Z    Z    which is close to 2.5034) 2. The viscosity of air under these conditions is 1.88.8  S '2 & The density of air at 25°C and 1 atm is 1.05 mm.23 kg/m3 and the viscosity is 1.5.

0327 m/s) 2. The density of oil is 900 kg/m3. Viscosity of air under these conditions is 1.3 for solid particles having a diameter of 0. (Ans: 0.2 mm are to be settled from air at 25°C and 1 atm.5 Oil droplets of diameter 0.25 mm. CD is given by  %& 4G R   4G  R . The voidage at minimum fluidization is 0. Calculate the terminal settling velocity of the particles.85 ´ 105 kg/m-s.30 Introduction to Numerical Methods in Chemical Engineering 2.48.4 Solve Exercise 2.

02 mm. (Ans: 0.6 Solve Exercise 2.0105 m/s) . (Ans: 0.5 for oil droplets of diameter 0.6462 m/s) 2.

and flash calculations using Raoults and modified Raoults law are discussed. The determination of vapour pressure at the given temperature for a pure substance following a cubic equation of state is thereafter discussed. dew point. and Peng Robinson cubic equations of state at the given temperature and pressure is discussed first in this chapter. RedlichKwong. The determination of system pressure and vapour phase composition at the given temperature and liquid phase composition is discussed using the gammaphi [ 2G Z H H and phiphi . bubble point. After this. Chapter 3 Chemical Engineering Thermodynamics The calculation of molar volume using the van der Waals.

.

then only one phase existsliquid or vapourand when three real roots exist. the starting value taken is V = b. To determine the molar volume of the liquid phase. The solution of two simultaneous chemical reactions in K K K K K equilibrium in the homogeneous phase and the calculation of adiabatic flame temperature are also discussed in this chapter. approaches. The cubic equations of state can have three real roots or one real root and two complex roots. The intermediate root is of the no physical significance.1) 8 D 8 The cubic form of the van der Waals cubic equation of state is given by § 46 ·  C CD 8  ¨D  ¸8  8   (3. 2 The van der Waals equation of state is 46 C 2   (3.1 Solution of Cubic Equations of State The molar volume of both the saturated vapour and saturated liquid can be calculated using cubic equations of state. [K 2GK8 ZK 2GK. and to determine the molar volume of the vapour 46 phase. then there are two phases. When there is only one real root. 3. The smallest root is the molar volume of saturated liquid and the largest root is the molar volume of saturated vapour. the starting value taken is 8 .2) © 2 ¹ 2 2  4 6E 46E where C and D  2E 2E 31 .

that is. At the given temperature and © 2 ¹ 2 2 pressure and given critical properties of the substance.32 Introduction to Numerical Methods in Chemical Engineering § 46 ·  C CD Let us define the function as H 8  ¨D  ¸8  8  .4) 8  D 6 8 8  D .1) Hc Thereafter.3) © 2 ¹ 2 A value of molar volume is assumed.1)] H 8 P  8P  (2. (2. The derivative of the function f with respect to the molar volume is given by § 46 · C H c 8    ¨ D  ¸8  (3. the only unknown in this equation is the molar volume V. The Redlich-Kwong equation of state is 46 C 2    (3. At the assumed molar volume the value of the function f and its derivative f ¢ are determined and the new molar volume is determined using Newtons method [see Eq. the new molar volume becomes the old molar volume. The procedure is repeated till there is a very meagre change between the new and old molar volumes. 8 P   8 P    . and f and f ’ are determined again at this molar volume.

V. The cubic form of the Redlich-Kwong cubic equation of state is given by 46  §  D46 C · CD 8  8  ¨D   ¸8   (3.6) 2 Ê 2 62Ú The PengRobinson equation of state is 46 C 2   (3. The derivative of the function f with respect to the molar volume is given by 46 È D46 C Ø H 8    8  É D   Ù (3. the only unknown in this equation is the molar volume. 2E 2E 46  §  D46 C · CD Let us define the function as H 8  8  ¨D   ¸8  .8) © 2 ¹ © 2 2¹ 2 2 . At the given 2 © 2 62 ¹ 62 temperature and pressure and given the critical properties of the substance.7) 8  D 8  D8  D  The cubic form of the PengRobinson cubic equation of state is given by § 46 ·  §   46D C · 46  CD 8  ¨D  ¸ 8  ¨ D   ¸ 8  D  D   (3.5) 2 © 2 62 ¹ 62 4 6E   46E where C and D .

Chemical Engineering Thermodynamics 33   46E .

1 Bubble Point Temperature Calculation When the liquid phase composition is given. The result obtained from the program is given below.25 ´ 105 m3/mol Saturated vapour volume using PengRobinson equation of state = 0. C B 2E § 6 · B   O ¨  ¨ ¸ © 6E ¸¹ O   X  X   46E D 2E Let us define the function as § 46 ·  §   46D C · 46  CD H 8  ¨D  ¸ 8  ¨ D   ¸ 8  D  D  © 2 ¹ © 2 2¹ 2 2 At the given temperature and pressure and given critical properties of the substance the only unknown in this equation is the molar volume V.030352 m3/mol Saturated liquid volume using RedlichKwong equation of state = 2. Newtons method .90 ´ 105 m3/mol Saturated vapour volume using van der Waals equation of state = 0.030469 m3/mol. 3. and w = 0. The derivative of the function f with respect to the molar volume is given by § 46 · §   46D C · H c 8    ¨ D  ¸ 8  ¨ D   ¸ (3.1 for calculating the molar volume at the given temperature and pressure using various cubic equations of state is given in the Appendix.64 ´ 105 m3/mol Saturated vapour volume using RedlichKwong equation of state = 0.345.325 kPa using van der Waals. the governing equation is 2 Z 2UCV  Z 2UCV .1 Calculate the molar volume of saturated liquid water and saturated water vapor at 100°C and 101. For water: TC = 647. Saturated liquid volume using PengRobinson equation of state = 2.030400 m3/mol Saturated liquid volume using van der Waals equation of state = 3.55 bar.2. along with the liquid phase composition the system pressure is given and the bubble point temperature and the vapour composition have to be determined. In this problem. Solution Program 3.1 K. RedlichKwong and PengRobinson cubic equations of state.2 Bubble Point and Dew Point Temperature Calculations Using Raoult's Law 3. PC = 220.9) © 2 ¹ © 2 2¹ EXAMPLE 3.

H 2  Z 2UCV  Z 2UCV (3. The only unknown is the temperature.12) © 6  % ¹ © 6  % ¹ In the above equation the Antoine parameters. system pressure and liquid composition are given.34 Introduction to Numerical Methods in Chemical Engineering is used to determine the temperature which satisfies the equation 2 Z 2UCV  Z 2UCV .10) Using Antoine equation \$ NP 2 UCV # (3.11) 6 % we get § \$ · § \$ · H 2  Z GZR ¨ #  ¸  Z GZR ¨ #  ¸ (3.13) 6  % . Let us formulate a function f. The derivative of the function f with respect to temperature is given by Z 2UCV \$ Z 2UCV \$ Hc   (3.

  6  % .

14) #  NP 2 Once the temperature that satisfies the equation 2 Z 2UCV  Z 2UCV is determined.2 Dew Point Temperature Calculation  [ [ When the vapour phase composition is given. (2. f and f ¢ are determined. Newtons method is used to determine the  [ [ temperature which satisfies the equation UCV  UCV . At the assumed temperature the value of function f and its derivative f ¢ are determined and the new temperature is determined using [see Eq. the vapour Z 2UCV Z 2UCV phase composition can be determined using [ and [ . 2 2 3. The procedure is repeated till there is a very meagre change between the new and old temperatures. Let us formulate a function f . 2 2 2 . 6 The assumed temperature is calculated from the relation 6 P ¦ ZK 6KUCV . The saturation temperatures 6UCV and 6UCV are calculated for the given pressure using the Antoine equation \$ 6 UCV % (3. 6 P   6 P    . that is. use is made of   . This equation can also be written as 6 P   6 P P     . In this problem 2 2UCV 2UCV system pressure is given along with vapour phase composition and dew point temperature and liquid phase composition have to be determined.1) Hc Thereafter the new temperature becomes the old temperature and again at this temperature.2.1)] H 6 P  6 P  (2.   A value of temperature is assumed.

The only unknown is the temperature. Chemical Engineering Thermodynamics 35  [ [ H  UCV  UCV (3. we get 6 %  § \$ · § \$ · H  [ GZR ¨  #  ¸  [ GZR ¨  #  ¸ (3.15) 2 2 2 \$ Using the Antoine equation NP 2 UCV # . The derivative of the function f with respect to temperature is given by [ \$ [ \$ Hc   (3.17) 2UCV 6  % .16) 2 © 6  % ¹ © 6  % ¹ Here in this equation the Antoine parameters. system pressure and vapour composition are given.

2UCV 6  % .

325 kPa for feed composition z1 = 0. At the assumed temperature the value of the function f and its derivative H c are determined and the new temperature is determined using H 6 P  6P  Hc Thereafter. 3. 6 P   6 P    . Assume the system to follow Raoults law. assuming Raoults law to be true. if the temperature lies between the bubble point and dew point . For a mixture at the given pressure. The result obtained from the program is bubble point temperature = 71.2 Calculate the bubble point and dew point temperatures for the acetone (1)  water (2) system at 101.3 Flash Calculations Using Raoult's Law The aim here is to calculate the compositions of the vapour and liquid phases at the given temperature and pressure under flash conditions.08°C. the liquid 2 2 2 [ 2 [ 2 phase composition can be determined using Z and Z . 2UCV 2UCV EXAMPLE 3. Solution Program 3. The procedure is repeated till there is a very meagre change between the new and old temperatures. K K  [ [ Once the temperature that satisfies the equation UCV  UCV is determined. A value of temperature is assumed.81°C. that is. the new temperature becomes the old temperature and f and H c are determined again at this temperature. dew point temperature = 87.2 for calculating the bubble and dew point temperatures for a system following Raoults law is given in the Appendix. The assumed temperature is calculated from the relation 6 P ¦ [ 6 UCV . This equation can also be written as 6 P  6 P 6 P     .5.

21) where the summation is over all the components. The overall composition is denoted by zi and L and V denote the amount of moles in the liquid and vapour phases respectively. Let the initial total number of moles before flashing be 1. The composition of the vapour in terms of Ki and feed composition is given by -\ [ K K (3. .19)   8  8- K K and the composition of the liquid phase is given by \ Z K (3. We can write for a particular species that [ . In this section we shall determine the equilibrium liquid and vapour phase compositions if the temperature. both liquid and vapour exist. . therefore. system pressure and feed composition are given.20)   8  8- K K Finally we should have -\ ¦ [ ¦   8  8- K K K K  (3. if the pressure lies between the dew point and bubble point pressure. K (3. if the temperature and the pressure K 2 K of the system are given.18) Z K K 2 UCV For a system following Raoults law. The distribution coefficient (Ki) for a species is defined as its composition in the vapour phase divided by its composition in the liquid phase.22) Therefore let us define a function . then the K values of all the components can be calculated. and also \ ¦ Z ¦   8  8- K K K  3.36 Introduction to Numerical Methods in Chemical Engineering temperatures or at the given temperature.  .

\ H ¦ [  ¦ Z ¦   8  8- K K K K K (3.  .23) The function has to be formulated in such a way that its required value is zero. which is the number of moles in the vapour phase per unit mol fed to the system. The derivative of the function with respect to V is given by  . In this equation the only unknown is V.

\ Hc  ¦   8  8.

24) K A value of V is assumed. K K  (3. At the assumed V the value of the function f and its derivative f ¢ are determined and the new V is determined using H 8 P  8P  Hc .

y3 = 0. Once V is determined. 3.294832.3.25057.84 kPa. z2 = 0.29) Í Z  Z / Z  Z /  Ý Ë / /  Û NP H   NP Z  Z /   Z Ì  Ü (3. The Wilson parameters are given by 8 È C Ø / GZR É   Ù (3. y2 = 0. the vapour and liquid phase composition can be determined.32 kPa. y1 = 0.224231. because for a given system the activity coefficients can be determined as a function of the temperature and the liquid composition.30) Í Z  Z / Z  Z /  Ý Calculation of bubble point pressure (i) Enter the temperature and the liquid composition. 8 P   8 P    .27) 8 Ê 46 Ú 8 È C Ø /  GZR É   Ù (3. The pressure of the system is 100 kPa. that is.75 kPa.490491.25) [ 2 Z H  2 UCV (3.3 and z3 = 0.44561. Solution Program 3. and 2UCV 50.3 for calculating the composition of the liquid and vapour phases under flash conditions for a system following Raoults law is given in the Appendix.4.26) The activity coefficients can be determined using various models. 2UCV 97.3 Calculate the compositions of the liquid and vapour phases for the acetone (1)acetonitrile (2)nitromethane (3) system. At the given temperature. x2 = 0.28) 8 Ê 46 Ú The activity coefficients are given by Ë / /  Û NP H   NP Z  Z /  Z Ì  Ü (3. x3 = 0. In the present case the Wilson model is used. Chemical Engineering Thermodynamics 37 Thereafter.301341.206026. The procedure is repeated till there is a very meagre change between the new and old values of V. The result obtained from the program is given below: x1 = 0. Assume the system to follow Raoults law. . The feed composition is z1 = 0.4 Bubble Point and Dew Point Temperature Calculations Using Modified Raoult's Law The modified Raoults law is given by [ 2 ZH  2UCV (3. EXAMPLE 3. the new V becomes the old V and again at this V the function f and its derivative f ¢ are determined. 2UCV 195. The number of moles in vapour phase is 0.

x1  x 2 (vi) At the liquid composition. calculate the vapour pressure of the components and the activity coefficients. (vii) Go to Step (iv) and repeat the procedure till convergence in activity coefficients is obtained. (iii) Initially assume the activity coefficients to be one and calculate the system pressure using  2 [ [ UCV  UCV H 2 H  2 [ 2 [ 2 (iv) Calculate the liquid composition using Z UCV and Z UCV . (ii) Calculate the vapour pressure of the components at the given temperature. (viii) Calculate the system pressure using .38 Introduction to Numerical Methods in Chemical Engineering (ii) Calculate the vapour pressure of the components at the given temperature. (iv) Update the vapour pressure of Component 1 using the relation 2 2UCV 2UCV ZH   ZH  2UCV (v) From the updated value of 2UCV . calculate the activity coefficients. (iii) Calculate the activity coefficients at the given temperature and liquid composition. H 2 H  2 x1 (v) Update the liquid composition using x1 and x 2 1  x1 . calculate the saturation temperature of the components and the assumed temperature using 6 P 6Z 6 UCV . Calculation of dew point pressure (i) Enter the temperature and the vapour composition. calculate the temperature using \$ 6  % #  NP 2UCV (vi) Go to Step (iii) and repeat the procedure till convergence in temperature is obtained. (iv) Calculate the bubble point pressure using the relation 2 ZH  2UCV  ZH  2UCV Calculation of bubble point temperature (i) Enter the pressure and the liquid composition (ii) At the given pressure. K K (iii) At the assumed temperature.

92 cm3/mol and V2 = 18. . (iii) At the assumed temperature. È[ [ 2 UCV Ø (viii) Update the vapour pressure of Component 1 using the relation 2UCV 2 É    UCV Ù Ê H  H  2 Ú \$ (ix) From the updated value of 2UCV .98 cal/mol and a21 = 1238 cal/mol. Z  Z (vi) At the liquid composition.325 kPa and x1 = 0. [ 2 [ 2 (iv) Calculate the liquid composition using Z UCV and Z . (ii) At the given pressure. The Antoine equations of the components are given by  NP 2UCV   6    NP 2UCV   6   where the temperature is in °C and the vapour pressure in kPa. H 2 UCV H  2 Z (v) Update the liquid composition using Z and x2 = 1  x1. calculate the vapour pressure of the components.07 cm3/mol.4 Consider a binary vapourliquid equilibrium system. Initially take K K g1 = g2 = 1.5. The parameters in the Wilson equation are: a12 = 437. (vii) Go to Step (iv) and repeat the procedure till convergence in activity coefficients is obtained. The molar volume of the components is V1 = 76. Assume the system to follow the modified Raoults law. calculate the temperature using 6  % #  NP 2UCV (x) Go to Step (iii) and repeat the procedure till convergence in temperature is obtained: EXAMPLE 3. calculate the saturation temperature of the components and the assumed temperature using 6 P 6[ 6 UCV . (ii) Calculate the bubble point temperature at 101. (i) Calculate the bubble point pressure at 100°C and x1 = 0. calculate the activity coefficients.5. Chemical Engineering Thermodynamics 39  2 [ [ UCV  UCV H 2 H  2 (ix) Go to Step (iv) and repeat the procedure till convergence in the pressure is obtained. Calculation of dew point temperature (i) Enter the pressure and the vapour composition.

264 kPa. H  2 UCV H  2 UCV Z (ix) Update the liquid composition using Z and x2 = 1  x1. 3. Solution Program 3. (vi) For the calculation of the dew point pressure (total feed as vapour). Then a pressure is chosen between the bubble point and dew point pressures. (ii) At the given temperature calculate the vapour pressure of components.5. The result obtained from the program is given below: (i) 204.4 for the bubble point and dew point calculations for a system following the modified Raoults law is given in the Appendix.  (vii) Calculate the pressure using 2 . The feed composition is given and the compositions of the liquid and vapour phases are to be determined using the modified Raoults law.5. [ [ UCV  UCV H  2 H  2 [ 2 [ 2 (viii) Calculate the liquid phase compositions using Z and Z . (ii) 80. first assume the activity coefficients to be1. calculate the activity coefficients. (iv) Calculate the bubble point pressure using the relation 2 ZH  2UCV  ZH  2UCV (v) Record the bubble point pressure (Pbubble) and the activity coefficients (g 1b and g 2b).325 kPa and y1 = 0.  (xii) Calculate the system pressure using 2 . (i) Enter the temperature. and (iv) 83.93°C.10 kPa. (iii) 184.5 Flash Calculations Using Modified Raoult's Law In flash the vapour and liquid phases coexist at the given temperature and pressure.40 Introduction to Numerical Methods in Chemical Engineering (iii) Calculate the the dew point pressure at 100°C and y1 = 0. (xi) Go to step (viii) and repeat the procedure till convergence in activity coefficients is obtained. (iv) Calculate the dew point temperature at 101. [ [ UCV  UCV H  2 H  2 (xiii) Go to step (viii) and repeat the procedure till convergence in pressure is obtained.82°C. (iii) Calculate the activity coefficients by assuming the total feed as liquid. (xiv) Store the dew point pressure (Pdew) and the activity coefficients (g 1d and g 2d). Z  Z (x) At the liquid composition. first the bubble point and dew point pressures are determined. . For the given temperature and feed composition.

2DWDDNG  2FGY (xvii) The assumed value of g 1 is calculated using 2  2FGY . Chemical Engineering Thermodynamics 41 (xv) Enter the pressure between the bubble point and dew point pressures. 2DWDDNG  2 (xvi) The assumed number moles in vapour phase is calculated using 8 .

H D  H F .

H  H F . 2DWDDNG  2FGY .

2  2FGY .

H D  H  F .

(xviii) The assumed value of g 2 is calculated using H  H F . 2DWDDNG  2FGY .

 [ [ (xxi) Calculate Z and Z . \ (xx) Calculate [ and [ .   8  8-   8  8. H  2 UCV H  2 UCV (xix) Calculate - and . 2 2 - \ .  . . - - (xxii) Define a function H [  Z  [  Z .  .

\ (xxiii) H c  ¦   8  8.

07 cm3/mol. (xxvi) Calculate g1 and g2. The parameters in the Wilson equation are: a12 = 292. The Antoine equations of the components are given by  NP 2UCV   6    NP 2UCV   6   where the temperature is in °C and the vapour pressure in kPa.05 cm3/mol and V2 = 18.66 cal/mol and a21 = 1445. . Assume the system to follow the modified Raoults law.3. K K  . (xxvii) Go to Step (xix) and repeat the procedure till convergence in activity coefficients is obtained. The molar volume of the components is V1 = 74.5 Calculate the composition of the liquid and vapour phases for the system acetone (1)water (2) at 100oC and 200 kPa. EXAMPLE 3. Hc (xxv) Go to Step (xx) and repeat the procedure till convergence in V is obtained. K H (xxiv) 8 P  8P  . The feed composition is z1 = 0.26 cal/mol.

a cubic equation of state can be used to determine the vapour pressure of a pure substance.42 Introduction to Numerical Methods in Chemical Engineering Solution Program 3. then another pressure is assumed and the pressure at which the fugacities are the same (f L = f V) is the vapour pressure. and go back to Step (ii) and repeat H8 the procedure till Condition (iv) is satisfied. (ii) At the given temperature and the assumed pressure. calculate VV and VL as described in Program 3. A pressure is assumed and the fugacities in the liquid and vapour phases are determined. dew point pressure = 142.47 kPa.045019 and y1 = 0. H8 H. (v) Calculate the new pressure using. H. For the PengRobinson cubic equation of state.80 kPa. At a given temperature. The system pressure chosen is 200 kPa and after convergence the number of moles in the vapour phase is 0.1. the fugacity of a pure substance is given by NP H § <    NP ¨ <  2D ·  C NP 8    D .5 for calculating the composition of the liquid and vapour phases under flash conditions for a system following the modified Raoults law is given in the Appendix. If at the assumed pressure the fugacities are not identical. The result obtained from the program is: bubble point pressure = 310. 3. (iii) Calculate f L and f V using cubic equation of state. (i) Assume a pressure. stop.511817.546235. The algorithm for calculation of vapour pressure is given below. x1 = 0.6 Vapour Pressure Using Cubic Equation of State The cubic equations of state are applicable for both the liquid and vapour phases. 2PGY 2QNF .  H8 (iv) If   .

¸ 2 © 46 ¹  D46 8     D .

31) The fugacity of the liquid phase is given by NP H. (3. . 2D · <    NP ¨ <   C NP 8. § .    D .

2 © 46 ¸¹  D46 8 .     D .

(3. <.31a) where 28 . 46 .

Chemical Engineering Thermodynamics 43 and the fugacity of the vapour phase is given by NP H8 § < 8    NP ¨ < 8  2D ·  C NP 88     D .

2 © 46 ¸¹  D46 88     D .

1 K.32) [ 2G8 ZH  H (3. w1. The vapour pressure of water at 100°C as obtained from the program is 96071. Tc1. ZC2. This is used to generate the Pxy diagram at the given temperature. 2 2 (vi) At the total pressure. calculate B11. (ii) x2 = 1  x1. ZC1. w2. For water: TC = 647. the equilibrium pressure and vapour composition are determined. (iii) At the given temperature and liquid phase composition. PC = 220. (v) Calculate the initial value of the total pressure using 2 ZH  2UCV  ZH  2UCV (only to start the solution do we assume the modified Raoults law to be true) and the ZH  2UCV ZH  2UCV composition in vapour phase using the relation [ and [ .345. (3. the equilibrium pressure and the vapour composition are determined. x1. The algorithm is given below. 2UCV . B12 and d12.31b) where 28 8 <8 46 EXAMPLE 3.375 Pa.6 for calculating the vapour pressure using the cubic equation of state is given in the Appendix. using the relation § \$ 2 UCV · ª 8 .33) At the given temperature and liquid phase composition. Pc1. Then again at the same temperature and at a different liquid phase composition. 2UCV . B22. Pc2. Solution Program 3. and w = 0.7 Pxy Diagram Using GammaPhi Approach In the GammaPhi approach. calculate the activity coefficients g1 and g2. 2  2 UCV . (iv) At the given temperature. 3. the vapourliquid equilibrium is described using the equation [ 2G8 ZH  H (3. Tc2. (i) Read T.55 bar. calculate the fugacity of the pure liquid species 1(f1) and 2(f2) at the given temperature and calculated pressure.6 Calculate the vapour pressure of water at 100°C using the PengRobinson cubic equation of state.

º» ¸¸ GZR « K K UCV H 2 GZR ¨¨ KK K © 46 « 46 » K K ¹ ¬ ¼ .

<.97 bar.7 for Pxy calculations using the GammaPhi approach is given in the Appendix. · NP G.07 cm3/mol.) ZH  H ZH  H (xi) Calculate the new pressure using 2  and calculate the new G G ZH  H ZH  H compositions in the vapour phase using [ and [ . G 2 G 2 (ix) Calculate 5 - u Z  . EXAMPLE 3.38 cal/mol and a21 = 469.1 K. . (This is because the composition of the vapour phase has changed and therefore the fugacity coefficients of the species in the vapour phase get changed.55 bar. Tc2 = 647. The result obtained from the program is given below: pressure = 344930. H  H H  H (viii) Calculate - and . Zc1 = 0. 2D . Go to Step (vii) and repeat the procedure 5 5 till dS < e. Pc2 = 220.73 cm3/mol and V2 = 18. Go to Step G 2 G 2 (vi) and repeat the procedure till dP < e. Use the GammaPhi approach. The molar volume of the components is V1 = 40.229. Zc2 = 0.6 K. The Antoine equations of the components are given by  NP 2UCV   6    NP 2UCV   6   where temperature is in °C and vapour pressure in kPa.7 Consider the methanol (1)  water (2) system in vapourliquid equilibrium. w1 = 0.55 cal/mol. Determine the system pressure and the vapour phase composition. Tc1 = 512. u Z  .564. The temperature of the system is 100°C and the liquid phase composition is x1 = 0.  . The parameters in the Wilson equation are: a12 = 107. w2 = 0.980694.345. Solution Program 3.59 Pa and y1 = 0. 3. Pc1 = 80.44 Introduction to Numerical Methods in Chemical Engineering (vii) Calculate the fugacity coefficient of the species 1( G ) and 2( G ) in the vapour phase.958.224.8 P-x-y Diagram Using Cubic Equation of State For the PengRobinson equation of state the fugacity coefficient of component 1 in the liquid phase is given by D § . - u Z - u Z (x) Calculate [ and [ .

 NP ¨¨ <  ¸ 46 ¸¹ © . D.

. Chemical Engineering Thermodynamics 45 . C ª  Z C  Z C .

D º  .

D ¼ 2D . » NP . 2D46 <.34)  «  .     (3.     . C. < .

 D 46 ¬ 46 and the fugacity coefficient of component 1 in the vapour phase is given by § 8 · NP G8 < 8  .

DD8  NP ¨¨ < 8  2D46 ¸¸  © ¹ 8 C 8ª  [ C  [ C .

D º  .

35) 8 C8 D ¼ 2D8 < 8     . 2D46 <8      «  8 » NP (3.

< . · NP G.  .  D 46 ¬ 46 The fugacity coefficient of component 2 in the liquid phase is given by § .

     .  NP ¨¨ < . DD.  2D  ¸ 46 ¸ © ¹ 2D . C ª.

D Z C  Z C º < .     46 .

» NP .     46 . (3.36)  « .  D 46 ¬ <.  . C D ¼ 2D .

and the fugacity coefficient of component 2 in the vapour phase is given by § 8 · NP G8 < 8  .

DD8  NP ¨¨ < 8  2D46 ¸¸  © ¹ 8 C 8 ª  [ C  [ C .

D º  .

2D46 <8      «  8 » NP 8 C8 D ¼ 2D8 (3.37) < 8     .

40) D8 [D  [ D (3. (3.  D 46 ¬ 46 where C.38) D. <. Z C  Z C   Z Z C (3.42) 46 .39) C8 [ C  [ C   [ [ C (3.41) 28 . ZD  Z D (3.

(i) Read T. x1. 46 (ix) Using Newtons technique. 46 (compressibility factor in the liquid phase). w 2 (ii) Calculate x2 = 1  x1 (iii) Calculate a11.45) and variables are T. calculate < . G. The algorithm for the calculation of the bubble point pressure and the vapour phase composition at the given temperature and the liquid phase composition for a binary mixture using the cubic equations of state is given below. (x) Calculate the fugacity coefficient of the components G8 and G8 in the vapour phase mixture. x1. Pc1.44) [ 2 G8 Z 2 G. Pc2.43) 46 For a binary VLE mixture the phase equilibrium equations are [ 2 G8 Z 2 G. and y1. (v) Assume some pressure (P) and composition in the vapour phase y1 (assume y1 greater than x1 if component 1 is the more volatile component). calculate < 8 46 (compressibility factor in the vapour phase).46 Introduction to Numerical Methods in Chemical Engineering 28 8 <8 (3. ZD  Z D . and G. (xi) Calculate - and . Tc2. a22. x2. calculate VV using aV. Take 8QNF because 2 28 8 the vapour phase molar volume is to be calculated. b1. P. (vi) Using Newtons technique. (3. x1. y2. . a and b for each phase are different. Take Vold = bL because 28 . and a and b for the vapour phase and then ZV and VV (the largest root). Tc1. if any two variables (T or P. 8 (viii) Calculate for the vapour phase: C [ C  [ C   [ [ C and D8 [D  [ D . (iv) Calculate for liquid phase: C Z C  Z C   Z Z C and D . the liquid phase molar volume is to be calculated. From VL. G. b2 . Since the compositions of the liquid and vapour phases are different. The molar volume is calculated by solving the cubic form of the PengRobinson equation of state. a12 a11 a 22 . (3. calculate VL using aL. Calculate a and b for the liquid phase and then ZL and VL (the smallest root). bV. G8 G8 (xii) Calculate 5WO - u Z  . From VV. x1 or y1) are specified the other two can be determined. Thus. in the liquid mixture. y1. u Z   . bL. w1. (vii) Calculate the fugacity coefficient of the components G.

calculate the equilibrium composition of the resulting mixture at 600°C and 1 atm. Solution Program 3. w1 = 0.5.2 K. Tc2 = 469. The number of moles of components at equilibrium is as follows: CH4: 1  X1 H2O: 5  X1  X2 CO: X1  X2 H2: 3X1 + X2 CO2: X2 Total: 6 + 2X1 . EXAMPLE 3.21 respectively.70 bar. Pc2 = 33. This is because the composition of the vapour phase has changed.9 Chemical Reaction EquilibriumTwo Simultaneous Reactions The solution of two simultaneous nonlinear algebraic equations is described in Section 2.5.574 and 2. The temperature of the system is 377. Pc1 = 73.224.81127. Chemical Engineering Thermodynamics 47 - u Z - u Z (xiii) Calculate [ and [ . (xiv) Calculate the new pressure using 2PGY 2QNF u 5WO . At this temperature the equilibrium constants for the first and second reaction are 0.9 In the production of synthesis gas the following two independent reactions take place CH4 + H2O ® CO + 3H2 CO + H2O ® CO2 + H2 Starting with 5 moles of steam and 1 mole of methane. and w2 = 0. The result obtained from the program is given below: Pressure = 6524432 Pa and y1 = 0.8 Consider the CO2 (1)  n-pentane (2) system in vapourliquid equilibrium. therefore aV and bV get changed.83 bar. 3. Go to Step (viii) and repeat the procedure 5WO 5WO till E 5WO  F .7 K. Determine the system pressure and the vapour phase composition using the PengRobinson cubic equation of state. Assume the gas mixture to follow ideal gas behaviour. The application in chemical reaction equilibrium in the homogeneous phase is described in the example below.65 K and the liquid phase composition is x1 = 0.252.8 for Pxy calculations using the PengRobinson cubic equation of state is given in the Appendix. EXAMPLE 3. Solution Let X1 be the reaction coordinate for the first reaction and X2 for the second. Go to Step (vi) and repeat the procedure till E 2  F . Tc1 = 304.

therefore K = KPKy = Ky.48 Introduction to Numerical Methods in Chemical Engineering Since the pressure is 1 atm. :  : .

 :  : .

    :   :  :     :  :  :  : .

 :  :    :  : The two nonlinear algebraic equations are :  : .

 :  : .

 H     : .

  :  : .

   : .

 :   :  :  .

H   :  :  .

  :  : .

and their derivatives are H  :  : .

:  : .

  :   : .

  :  : .

   : .

 :  : .

 :  : .

:   : :   :   :   .

   : .

   :  : .

    : .

  :  : .

 :  :  .

  :  :  .

  H  :    : .

  :  : .

   : .

 :  : .

 :  : .

   : .

  :  : .

    : .

 H  : :  :  : .

   : .

 : :  : .

  :  : .

:  : .

   :  : .

 H  :   : :  :  : .

 :  .

 : :  : .

  :  : .

:  : .

   :  : .

82 mol. moles of CO2 = 0.625 mol.285 mol. and total number of moles = 7.5.355 mol. The solution is X1 = 0. . Program 3. moles of CO = 0. The algorithm is described in Section 2. moles of H2 = 3.9 for solution of two chemical reaction equilibrium equations is given in the Appendix.633.912 and X2 = 0.465 mol. Thus at equilibrium: moles of CH4 = 0. moles of H2O = 3.09 mol.

sb. Read the standard temperature (T0) and inlet temperature (T1). (iii) Read the standard enthalpy of formation for various species and calculate the standard enthalpy change of reaction. The total enthalpy change is zero as there is no heat and work exchange with the surroundings. The algorithm for the calculation of adiabatic flame temperature is described below. (iv) Calculate sa. (ii) Read the various stoichiometric coefficients (ni) and moles of each species (ni) entering. sc.10 Adiabatic Flame Temperature First the inlet species are laised from inlet temperature (T1) to adiabatic flame temperature (T) and then the reaction at temperature T is carried out. Chemical Engineering Thermodynamics 49 3. (i) Read the various constants of molar heat capacity at constant pressure for various species. sd using the relations UC P C  P C  P C  P C UD PD  P D  P D  P D UE PE  P E  P E  P E UF PF  P F  P F  P F  (v) Calculate the heat required to raise the inlet species from the inlet temperature (T1) to the adiabatic flame temperature (T) using UD  UE  UF  UC 6  6 .

  6  6  .



6  6 

6  6

Note that this formula is valid for the molar heat capacity given by the equation
%2 C  D6  E6   F6 
(vi) Calculate
'C O  C  O  C  O  C  O  C 'D O  D  O  D  O  D  O D
'E O  E  O  E  O  E  O E 'F O  F   O  F  O  F  O F
(vii) Calculate the standard enthalpy change of reaction at the adiabatic flame temperature
(T) with respect to the standard enthalpy change of reaction at temperature (T0)
'D  'E  'F 
'*6  'C 6  6




6  6 


6  6 


6  6

.

(viii) Assume an adiabatic flame temperature and at that temperature calculate the value of the function UD  UE  UF  H UC 6  6 .

  6  6  .

 6  6   6  6 .

.

'D  'E  'F  + '*6  'C 6  6 .

  6  6   6  6  .

 6  6 .

.

and its derivative H c UC  UD u 6  UE u 6   UF u 6   'C  'D u 6  'E u 6   'F u 6  H (ix) Calculate new temperature using Newtons formula 6 P  . take this as the 6P  Hc old temperature and go to Step (n) and repeat the procedure till there is no significant change in temperature (dT < e). .

For water: TC = 647. y1 = 0. Species a b ´ 102 c ´ 105 d ´ 109 C2H6 1. The standard heat capacity is given by % 2 C  D6  E6   F6  .316 1.3 Calculate the composition of the liquid and vapour phases for the acetone (1) acetonitrile (2)nitromethane (3)system. and 2UCV 50.55 bar. The result obtained from the computer program is AFT = 2090.740 O2 6.320819.1709 0.0 MPa using the van der Waals.345. Assume the system to follow Raoults law.5 and z3 = 0.75 kPa. y3 = 0.10 for the calculation of adiabatic flame temperature (AFT) is given in the Appendix.784 H2O(g) 7.504845. The pressure of the system is 100 kPa. (Ans: Bubble point temperature = 58. VL using the Redlich Kwong equation of state = 2. VV using the PengRobinson equation of state = 0. 10 mol CO2 (3) and 0 mol of H2O (4). 4 mol O2 (2). VV using the RedlichKwong equation of state = 0. '*  % *  kcal/mol.1 Calculate the molar volume of saturated liquid water and saturated water vapour at 180°C and 1. x3 = 0.04594 0. and w = 0.175384.25. VL using the van der Waals equation of state = 4.9. RedlichKwong and PengRobinson cubic equations of state. dew point temperature = 66.161436.530 1.93°C) 3. The ethane is completely burned.2 Calculate the bubble point and dew point temperatures for the acetone (1)water (2) system at 101. x2 = 0. Assume the system to follow Raoults law.15 K is: '*  %1 H  kcal/mol.648 4.3133 CO2 5. The feed composition is z1 = 0. 2UCV 97.493941. (Ans: VL using the PengRobinson equation of state = 2. Exercises 3.325 kPa for feed composition z1 = 0.444331.700 0.124 1.25.003605 m3/mol.58°C.2521 0. '*  *1 I H  kcal/mol.343313.8362 1.8587 The standard enthalpy of formation at 298.) . z2 = 0. The number of moles in the vapour phase is 0.3631 0.95 ´ 105 m3/mol. PC = 220.10 Calculate the adiabatic flame temperature of a gas initially at 25oC containing 1 mol C2H6 (1).39 K.32 kPa. y2 = 0.47 ´ 105 m3/mol.31 ´ 105 m3/mol.003647 m3/mol) 3. (Ans: x1 = 0. H Solution The reaction with stoichiometric amount of oxygen is  % *   1 o %1  *  1  and the reaction with 4 mol of O2 and 10 mol CO2 is %  *   1   %1  o %1   *  1  1 Program 3.50 Introduction to Numerical Methods in Chemical Engineering EXAMPLE 3. where T is in K and % 2 in cal/mol-K. VV using the van der Waals equation of state = 0.4285 0.003570 m3/mol.085 0.1 K.84 kPa. At the given temperature: 2UCV 195.

Chemical Engineering Thermodynamics 51

3.4 Consider a binary vapourliquid equilibrium system. The Antoine equations of the
components are given by

NP 2UCV  
6  

NP 2UCV  
6  
where the temperature is in °C and the vapour pressure in kPa. The parameters in
the Wilson equation are: a12 = 437.98 cal/mol and a21 = 1238 cal/mol. The molar
volumes of the components are V1 = 76.92 cm3/mol and V2 = 18.07 cm3/mol.
Assume the system to follow the modified Raoults law.
(i) Calculate the bubble point pressure at 100°C and x1 = 0.3.
(ii) Calculate the bubble point temperature at 101.325 kPa and x1 = 0.3.
(iii) Calculate the dew point pressure at 100°C and y1 = 0.3.
(iv) Calculate the dew point temperature at 101.325 kPa and y1 = 0.3.
[Ans: (i) 193.78 kPa, (ii) 82.18°C, (iii) 140.78 kPa, and (iv) 91.00°C]
3.5 Calculate the composition of the liquid and vapour phases for the acetone (1)
water (2) system at 100°C and 200 kPa. The feed composition is z1 = 0.5. The
Antoine equations of the components are given by

NP 2UCV  
6  

NP 2UCV  
6  
where the temperature is in °C and the vapour pressure in kPa. The parameters in
the Wilson equation are: a12 = 292.66 cal/mol and a21 = 1445.26 cal/mol. The molar
volume of the components is V1 = 74.05 cm3/mol and V2 = 18.07 cm3/mol. Assume
the system to follow the modified Raoults law.
[Ans: Bubble point pressure = 334.97 kPa, dew point pressure = 195.68 kPa,
number of moles in vapour phase = 0.974685, x1 = 0.045018, y1 = 0.511817]
3.6 Calculate the vapour pressure of water at 120°C using the PengRobinson cubic
equation of state. For water: TC = 647.1 K, PC = 220.55 bar, and w = 0.345.
(Ans: 191689.125 Pa)
3.7 Consider the methanol (1)  water (2) system in vapourliquid equilibrium. The
temperature of the system is 100°C and the liquid phase composition is x1 = 0.5.
Determine the system pressure and the vapour phase composition. Use the Gamma-
Phi approach. The Antoine equations of the components are given by

NP 2UCV  
6  

52 Introduction to Numerical Methods in Chemical Engineering


NP 2UCV  
6  
where the temperature is in °C and the vapour pressure in kPa. The parameters in
the Wilson equation are: a12 = 107.38 cal/mol and a21 = 469.55 cal/mol. The molar
volumes of the components are V1 = 40.73 cm3/mol and V2 = 18.07 cm3/mol.
TC1 = 512.6 K, PC1 = 80.97 bar, w1 = 0.564, ZC1 = 0.224, TC2 = 647.1 K,
PC2 = 220.55 bar, w2 = 0.345, ZC2 = 0.229.
(Ans: Pressure = 253786 Pa, y1 0.757692)

3.8 Consider the CO2 (1)  n-pentane (2) system in vapourliquid equilibrium. The
temperature of the system is 377.65 K and the liquid phase composition is x1 = 0.35.
Determine the system pressure and the vapour phase composition using the Peng
Robinson cubic equation of state. TC1 = 304.2 K, PC1 = 73.83 bar, w1 = 0.224,
TC2 = 469.7 K, PC2 = 33.70 bar, w2 = 0.252.
(Ans: Pressure = 4572206 Pa, y1 0.782462)

3.9 Calculate the adiabatic flame temperature of a gas initially at 25°C containing 1 mol
C2H6 (1), 5 mol O2 (2), 10 mol CO2 (3) and 0 mol of H2O (4). The ethane is
completely burned. The standard heat capacity is given by C0P = a + bT + cT2
+ dT3 where T is in K and C 0P in cal/mol-K.
Species a b ´ 102 c ´ 105 d ´ 109
C2H6 1.648 4.124  1.530 1.740
O2 6.085 0.3631  0.1709 0.3133
CO2 5.316 1.4285  0.8362 1.784
H2O(g) 7.700 0.04594 0.2521  0.8587
The standard enthalpy of formation at 298.15 K is: '*  %1 a  kcal/mol,
H

'*  *1
I
H
 kcal/mol, and '*  % *H
 kcal/mol.
(Ans: AFT = 2024.45 K)

Chapter 4

Initial Value Problems

F[
Consider two simultaneous differential equations \ and F\  [ . The analytical solution
FZ FZ
of the differential equations is y = A sin(x + a) and z = A cos(x + a). There are two constants
of integration A and a. In general, a system of N first order equations has N constants of
integration. If the values of the dependent variables y and z are specified for a value of x, then
the problem of determining the values of y and z at some future x is called an initial value
problem. Alternatively, the values of some of the dependent variables may be specified at a
number of different values of x, then the problem is called a boundary value problem. The
most common form is a two-point boundary value problem where the function values are given
for two values of x. Boundary value problems are discussed in Chapters 510.
The examples discussed here include the calculation of temperature profile in a double
pipe heat exchanger, of a single stirred tank with coil heater and also of a series of stirred tanks
with coil heater. The velocity profile of a solid particle in a pneumatic conveyor, and the
calculation of the concentration profile in the batch, stirred and plug flow reactors is also
discussed in this chapter.

4.1 Solution of Single Ordinary Differential Equation
Consider an ordinary differential equation
F[
H Z [

(4.1)
FZ
with the initial condition: at x = x0, y = y0. The ordinary differential equation has to be
integrated to determine the value of y at some x. A step size, h, is chosen in the independent
variable. At the initial condition both x and y are known and after a step size in independent
variable, i.e. at x = x0 + h the value of y is computed. Then this becomes the starting point
for the next value of independent variable, x = x0 + 2h at which the value of dependent variable
is determined. This procedure is repeated till the value of x at which the y-value is to be
determined is reached. For each problem there exists an optimum step size. The step size
should not be high, otherwise the truncation errors will be high, and if the step size is very
small, then round-off errors are high. At the optimum step size the total error (truncation error
+ round-off error) is the least, and thus the numerical results are accurate.
53

54 Introduction to Numerical Methods in Chemical Engineering

In the numerical formulation of the problem some terms are left out; those errors are
called truncation errors. When the step size is small, these errors are less. If the step size is
very low, then the truncation errors are less but the round-off errors are high. Consider a step
size of 106 m; then to go from 1 to 10 m, the number of iterations required is 107, which is
huge. Whenever the new concentration is computed, the number is not completely stored, it
is stored up to some decimal places only, depending on the compiler used. So to avoid round-
off errors the step size should not be very small and to avoid truncation errors it should not
be very large. So there is an optimum step size and it varies with the problem. To determine
the optimum step size, at a particular value of independent variable x the value of the
dependent variable y is determined using various step sizes. When for two consecutive step
sizes the value of y is the same, then the higher of the two is the optimum step size.
In the RungeKutta fourth order method the following are computed:
M J u H Z  [

2) §   · M J u H ¨ Z  J [  M ¸ (4.4) ©   ¹ M J u H Z  J [  M . (4.3) ©   ¹ §   · M J u H ¨ Z  J [  M ¸ (4.

(4.5)  [ [  M   M   M  M .

05. To compute FZ y at x = 0. The initial condition is: at x = 0.10525.6)  From the initial condition (x0.05 = 0.00525) = 0.8) EXAMPLE 4.2.1.0525. Now again the above calculations are carried out to determine the value of y at x0 + 2h. The analytical solution is given by y = ex  x  1. The function is H Z  [ .0) = 0. due to which the value of y1 becomes y0 and x0 + h becomes x0.1 ´ 0.1 the starting point is x0 = 0 and y0 = 0.0) = 0.005.0) = 0. y0) we have determined the value of y at x0 + h.1 ´ f(0. f (0.7) y0 = y1 (4. y = 0.05.0. Determine the value of y at x = 0. F[ Solution Let us take step size of h = Dx = 0.0025) = 0. f (0. f (0. therefore k3 = 0. therefore k1 = 0. therefore k4 = 0. But before carrying out the next calculation the following statements. .1 Integrate the ordinary differential equation F[ Z[ FZ using the RungeKutta fourth order method. therefore k2 = 0.00525.05. are executed: x0 = x0 + h (4.0. (4.010525. f (0.1. The calculations are given below.

Initial Value Problems 55 Thus  [ M   M  M  M .

15. Thus  [      u    u    .0051708) = 0.022149. therefore k1 = 0.01042934) = 0. 0.01319225) = 0.2. therefore k3 = 0. 0. 0. therefore k2 = 0.15. For this computation the starting point is x0 = 0.1 and y0 = 0.0051708.1051708.2.  [  at x = 0.1  Now let us compute the value of y at x = 0.22149.16319225. f(0.1. The calculations are given below.0160429. f(0.016319225. f(0. 0. therefore k4 = 0.16042934.02149) = 0. f(0.01051708.

4. . The analytical solution at x = 0.0214025.2) = 0. Solution The initial condition is: at x = 0: y = 2.  2 6\  6TGH O%  2 6\  '\  6TGH O% Heat entering through whole circumference = U(2pRDz)(TS  T) Fig.1 (given in the Appendix) at step size of 0.0214028. The result from Program 4.2  0. Determine y at x = 2. We have to determine y at x = 2.1 Schematic diagram of double pipe heat exchanger.2 Solve the following ordinary differential equation: dy y  dx 1 x with the initial condition y(0) = 2.2 is y = e0.5 using the fourth-order RungeKutta method.5.57. The outer pipe contains steam at temperature TS and the fluid in the inner pipe is heated.5.2  1 = 0. EXAMPLE 4.1. which is close to the numerical solution.2 Double Pipe Heat Exchanger The schematic diagram of the inner pipe of the double pipe heat exchanger is shown in Fig. y = 0. 4.01 is: at x = 2. 4.   Thus the value of y (at x = 0.

Under steady conditions (Input  Output = 0)  2 6\  6TGH .56 Introduction to Numerical Methods in Chemical Engineering Consider a differential section of the inner pipe. Through the circumference of the inner pipe heat enters from steam in the outer pipe.

 O% O%  2 6\  '\  6TGH .

 7Q & '\ 65  6 .

 Dividing by Dz. we get §6  6\ ·  2 ¨ \  '\  O% ¸  7Q & 65  6 .

 © '\ ¹ As Dz ® 0. we get F6  2  O%  7Q & 65  6 .

The temperature of entering water is 20°C and the velocity of water is 1 m/s. EXAMPLE 4. Assume that the temperature does not change along the radius of the pipe. Solution The mass flow rate of water is  §  · O S X#  u  u Q ¨ ¸  kg/s ©  ¹ Eq. determine the temperature of water at the length of 5 and 10 m from the inlet. and O is the mass flow rate of fluid in inner pipe. The inner diameter of the inner pipe is 2.3 On one side of a double pipe heat exchanger is saturated steam and water is flowing in the inner tube.  (4.4 cm. The total length of the heat exchanger is 10 m. The analysis of the double pipe heat exchanger is described in the example below.9) F\ where T is the temperature of the fluid in the inner pipe and is a function of length. Under steady conditions. TS is the temperature of steam in the outer pipe and is constant. The overall heat transfer coefficient based on the inside area of the inner pipe is 200 W/ m2-K and the temperature of saturated steam is 250°C. The density of water is 1000 kg/m3 and the specific heat capacity is 4184 J/kg- K.9) becomes F6  u    u  u  u   6 . (4.

 F\ F6  u     6 .

01 m. The exit temperature of water at z = 10 m is 37. we get at z = 5 m. Program 4. The heat taken up by water is equal to UADTlmtd. The differential equation is integrated using the RungeKutta fourth order method. F\ The initial condition is: at z = 0. T = 28. T = 37. Let us now check the answer. T = 20.1 can be modified. The temperature is to be determined at z = 5 and z = 10.97°C and at z = 10 m.60°C.60°C. and with step size of 0. and from the energy balance equation we get 7 Q &. '6 NOVF  2 6  6 O%   .

250°C 250°C Steam temperature 20°C 37. In this problem the overall heat transfer coefficient is given and temperature of water is determined.2 Diagram for Example 4.2. 4. Usually in heat transfer laboratory experiments. 4. the exit temperature of water is known and the overall heat transfer coefficient is determined. 4. O O M = Mass of fluid in tank T TS Fig. The log mean temperature difference is given by    '6  §  · NOVF NP ¨ ¸ ©  ¹ Substituting the values in the energy balance equation. . 4. '6NOVF Q u  u  u  which is close to the given value. T2 is the temperature of the exit water. The temperatures in the double pipe heat exchanger are shown in Fig.60°C Water temperature Fig. and L = 10 m. 4. we get  2 6  6 O%  u  u  7  W/m2-K Q &.3.3 Stirred Tank with Coil Heater The schematic diagram of a stirred tank with coil heater is shown in Fig.3 Schematic diagram of stirred tank with coil heater.3. Initial Value Problems 57 where T1 is the temperature of the inlet water.

and the output is energy carried away by the exit stream. we get F6 /% 2  2 6  6 . The input is due to energy input by the entering stream and the heat input from the steam.58 Introduction to Numerical Methods in Chemical Engineering The energy balance equation is given by Accumulation = Input  Output. From the energy balance equation.

5 ´ 2 = 0. The temperature throughout the coil is TS as the steam is saturated. The heat transfer between the steam in the coil and the fluid is given by Q = UADTlmtd = UA(TS  T). CP = 4184 J/kg-K. and outside the whole coil. and Eq. and m  = 1 kg/s. The outside area of the coil through which heat exchange takes place is 1 m2. Note that though the temperature in the tank is uniform. therefore DTlmtd = TS  T.10) FV where T1 is the temperature of the entering stream and T is the temperature of exit stream and is equal to temperature of water in the stirred tank. water in the tank is heated by a coil containing steam whose overall heat transfer coefficient based on the outside area of the coil is 200 W/m2-K. therefore the mass of water in the tank is 500 kg. The specific heat capacity of water is 4184 J/kg-K. The temperature of inlet water is 20°C.  3 O% (4. Since the density of water is 1000 kg/m3.4 Consider a stirred tank heater. (4. Water is fed to the tank at a flow rate of 1L/s and exits out at the same flow rate from the top of the tank. T exists as the vessel is stirred. that is inside the tank uniform temperature. EXAMPLE 4. Thus M = 500 kg. The temperature of the steam is 250°C. 3 = UA(TS  T) = 200(TS  T).5 ´ 0.5 m on its sides and 2 m high and is filled with water at 20°C. After how much time is the temperature of exit water 28°C? What is the maximum temperature that can be reached in the tank? Solution Volume of tank = 0. It is a square tank 0. At time t = 0 s.5 m3.10) becomes F6  u   u  u   6 . it varies with time.

  u   6 .

we get F6   6 FV The initial condition is: at t = 0.1.81 750 28.46 5000 30. Table 4. and with step size of 0. We have to determine t at T = 28°C. The variation of temperature of the fluid in the tank with time is shown in Table 4. Program 4.31 1000 29. FV Simplifying.19 3000 30. T = 20°C.1 we get T = 28°C at t = 700 s.4 Time (s) Temperature (°C) 500 26.1 can be modified.1 Variation of fluid temperature in tank with time in Example 4.48 .

064  0. Note the temperature at 5000 s in Table 4. Show that F6 Q %U   6 FV Determine the solvent temperature after 50 min. Solution From the energy balance equation we know: Accumulation = Input  Output.5 Consider a stirred vessel which initially contains 760 kg of solvent at 25°C.5 kJ/min-K.1. thus FV the steady state temperature is given by 0. The heat supplied by steam to the solvent is given by 3 = UA(TS  T). At t = 0 the flow of steam is started in a coil in the stirred vessel. Also determine the maximum temperature that can be reached in the tank. where UA is the overall heat transfer coefficient multiplied by coil area through which heat exchange takes place and TS is the temperature of steam and is 150°C. Substituting the values in Eq. The specific heat of the solvent is Cp = 2. Here input energy is due to incoming fluid and steam and output is due to outgoing fluid. The same is also obtained from the numerical solution. Initial Value Problems 59 F6 The steady state temperature is obtained when in the differential equation  . 12 kg/min of solvent flows into the stirred vessel at 25°C and exits out also at the same rate. (4.10). UA = 11. EXAMPLE 4.0021 T = 0 or T = 30.48°C. we get F6    u  u    6 .3 kJ/kg- K.

   6 .

53 20000 61. In the coil throughout the temperature is TS and the fluid temperature is T. T = 49.69 5000 55.69°C.41 2000 44. where T is the temperature of the fluid in the stirred tank.1 can be modified. We have to determine T at t = 3000 s. Simplifying the above equation. and with step size of 0. The variation of temperature of the fluid in the tank with time is shown in Table 4. we get F6    6 FV The initial condition is: at t = 0. FV   Note that DTlmtd = TS  T.43 10000 60.64 25000 61. T = 25°C.5 Time (s) Temperature (oC) 1000 36. Program 4.78 15000 61.27 3000 49.01 we get: at t = 3000 s. Table 4.98 7500 59.2.66 .2 Variation of fluid temperature in tank with time in Example 4.

15)] FX R (&  (D  (I SR FV 8R where rp is the density of the particle. 4. FD is the drag force acting on the particle.4 Pneumatic Conveying Consider a pneumatic conveyor in which solids are inserted from the bottom along with the flowing gas. and Vp is the volume of the particle. The drag force is given by (& #R %&  SI XI  X R . vp is the upward velocity of the particle. The same is also obtained from the numerical solution. (2. Note the temperature at 25000 s in Table 4. Fg is the gravitational force acting on the particle. The momentum balance equation becomes [see Eq.66°C. buoyancy force acting upwards and gravitational force acting downwards.000373T = 0 or T = 61.2. The forces acting on the particle are: drag force acting upwards.023  0. thus the FV steady state temperature is given by 0.  . Fb is the buoyancy force acting on the particle.60 Introduction to Numerical Methods in Chemical Engineering F6 The steady state temperature is obtained when in the differential equation.

The gravitational force minus the buoyancy force on the particle is given by [see Eq.  (4.17)] (I  (D 8R S R  S I .11)  where rg is the density of the gas. and vg  vp is the relative velocity. (2. Ap is the projected area of the particle on a plane at right angles to the direction of motion.

4 Various forces (divided by volume of particle) acting on particle during pneumatic conveying.  #R S I%& X  X X  X  8R I R I R (rp  rg)g vg Fig. . I The various forces acting are shown in Figure 4.4. 4.

Initial Value Problems 61 Thus the momentum balance equation becomes FX R  #R XI  X R .

 S I  S R .

I  SR %& SI (4. we get FX R  SI #R § SI · XI  X R . Dividing both sides of the equation by rp.12) FV  8R Note that the terms have units of force acting on the particle divided by the volume of the particle.

 ¨  %&  ¸ I FV  S R 8R ¨ SR ¸ © ¹ The derivative FX R FX R XR FV F\ where z is the direction along the length of the pneumatic conveyor. Thus the momentum balance equation can be written as FX R  SI #R § SI · XI  X R .

Air is fed at 25°C and 1 atm and the viscosity of air under these conditions is 1. EXAMPLE 4. Use the following relation to determine CD:  %& 4G R   4G  R . Neglect wall effects.13) S R 8R ¨ ¸ F\  © SR ¹ Program 4.2 uses the RungeKutta fourth order method for integrating the above ordinary differential equation and is given in the Appendix. The initial velocity of the particle is zero and superficial velocity of air is 12 m/s.6 Determine the velocity of the solid particles of diameter 3 ´ 104 m along the length of the pneumatic conveyor.  ¨  XR %&  ¸ I (4. The density of the particle is 900 kg/m3.8 ´ 105 kg/m-s.

where Rep is the particle Reynolds number based on relative velocity and is given by SI XI  X R .

The density of air under the given conditions is given by 2/  u  u   SI  kg/m3 46  u  . F R 4G R N Solution The following data are given: dp = 3 ´ 104 m vg = 12 m/s m = 1.8 ´ 105 kg/m-s.

62 Introduction to Numerical Methods in Chemical Engineering The projected area of the particle divided by the volume of the particle is given by #R Q TR    1  m   8R Q TR TR FR  u    The particle Reynolds number is SI XI  X R .

F R  u   X R .

u  u   4G R    X R .

N  u   The momentum balance equation is FX R  SI #R § SI · XI  X R .

 ¨  XR %&  ¸ I F\  S R 8R ¨S ¸ © R ¹ FX R   §  ·   X R .

 ¨  XR %&   ¸  F\   ©  ¹   FX R %&   X R .

thus F[ .     F\ Let [ X R .

 %&   [   F\ where 4G R    [ .

   4G  and %& 4G R R .

0 10. Table 4.01 1.0 0. The problem can be solved using the RungeKutta fourth order method.01 m is taken.2 is presented in Table 4. The initial condition is at z = 0. The velocity of the particle along the length of the pneumatic conveyor as obtained from Program 4. .0 10.06 2.24 0.67 3.06 0.00 0. y = 0.83 5. The step size of 0.3.3 Velocity of particle as obtained from Program 4.90 10.1 5.90 .0 10.3 8.84 0.2 7.0 10.0 10.2 z (m) vp (m/s) 0.5 9.

5 Solution of Simultaneous Ordinary Differential Equations Consider a system of two ordinary differential equations F[ H Z [ \ . Initial Value Problems 63 4.

14) FZ F\ H  Z  [ \ . (4.

is chosen in the independent variable and after a step size in independent variable.. h. (4.e. The ordinary differential equations have to be integrated to determine the value of y and z at some x. y = y0 and z = z0.15) FZ with the initial condition: at x = x0. i. at x = x0 + h the value of y and z are to be computed. In the RungeKutta fourth order method the following are computed: M J u H Z  [  \ . A step size.

(4.16) N J u H Z  [  \ .

19) ©    ¹ §    · M J u H ¨ Z  J [  M  \  N ¸ (4.20) ©    ¹ §    · N J u H ¨ Z  J [  M  \  N ¸ (4.18) ©    ¹ §    · N J u H ¨ Z  J [  M  \  N ¸ (4.21) ©    ¹ M J u H Z  J [  M  \  N . (4.17) §    · M J u H ¨ Z  J [  M  \  N ¸ (4.

22) N J u H Z  J [  M  \  N . (4.

(4.23)  [ [  M   M   M  M .

(4.24)   \ \  N  N  N  N .

Now again. due to which the value of y1 becomes y0. z0). the above calculations are carried out to determine the value of y and z at x0 + 2h. But before carrying out the next calculation the following statements are executed.25)  From the initial condition (x0. z1 becomes z0 and x0 + h becomes x0: x0 = x0 + h y0 = y1 z0 = z1 . y0. we have determined the value of y and z at x0 + h. (4.

f2(0. f2(0.7935. therefore k2 = 1. f1(0.3.7.1665) = 37.7.1265.77135.21265. therefore k3 = 1. To compute the value at t = 0. f1(0. 5.7. x0 = 6 and y0 FV = 4. 5. x = 6.535) = 17. 6. 7.7935.1. FZ Solution Take step size of h = Dt = 0.865.07. 7.935.7 Integrate the ordinary differential equations dx x  2y dt dy 3x  2 y dt using the RungeKutta fourth order method.05.1. y = 4. 6. Thus  Z Z  M   M  M  M .3) = 30. f2(0.7135.665. The analytical solution is given by x = 4e4t + 2et and y = 6e4t  2et. therefore l4 = 3.535) = 31.05.3) = 17.2.64 Introduction to Numerical Methods in Chemical Engineering EXAMPLE 4. 4) = 26. 5. 4) = 14. Determine the values of x and y at t = 0.1665) = 22. therefore l1 = 3. f2(0.865. 6. 7.73.7935. The functions are H Z   [ and FV F[ H  Z   [ .1665. The initial condition is: at t = 0. The calculations are given below.05. 6. therefore l3 = 3. therefore k4 = 2.05. therefore l1 = 2. f1(0.6. therefore k1 = 1. 5. 7.4.1 the starting point is t0 = 0.1. 6. f1(0. 6.

 (at t = 0.1)   [ N  N  N  N .

0212875) = 44.4681075.7766. f2(0.205805. therefore l4 = 5.1176687. 9.1. 10.140725) = 37. .19646.75249187) = 34.61125.1. 8.15. The calculations are given below.761125.1.61176687.37477875) = 46. f1(0. f2(0. 7.2. 7.75249187) = 55. f1(0.15.  [  (at t = 0.8795. f2(0. f1(0. therefore k1 = 2. and y0 = 7.406881.1)  Now let us compute the value of y and z at t = 0. 11.519646.922075.681075. therefore l3 = 4.12270375.12270375.787226.6922075. x0 = 7.140725) = 22. therefore l2 = 4.05805.7766. therefore k2 = 2.37477875) = 27.06881.2.15.7766.563826. f1(0. f2(0. 9. 9.0212875) = 26. 9. 9. 11. 10. 8.563826. therefore k4 = 3. 9.87226.15. therefore l1 = 3. For this computation the starting point is t0 = 0. 7. therefore k3 = 2.8795.2.140725. 7.

Initial Value Problems 65 Thus at t = 0.2  Z      u    u   .

   [      u    u    .

1416 radians = 180°.27.236 cos(171.5396.   From the analytical solution at t = 0. z = 1.887 + 63. From the conversion of radians to degrees we know that 3. Determine the value of y at x = 3. z = 1. We have to determine y and z at x = 3. Thus x = 3 = 171. The result from Program 4.84 z = 2. y = 11. EXAMPLE 4.887°. Now let us check the numerical result with the analytical solution.435° and thus A = 2.236. Determine the value of y and z at x = 3.3 at step size of 0.8 Solve the following ordinary differential equations: F[ \ FZ F\ [ FZ with the initial condition y(0) = 2.27 which is the same as numerical solution. z(0) = 1.236 sin(171. Compare the numerical solution with the analytical solution.435) = 1. . y¢(0) = 1. First let us determine the constants A and a. y = 2. Solution The two simultaneous ordinary differential equations can be written as F[ H \ FZ F\ H [ FZ The initial condition is: at x = 0.84. At x = 0: y = 2. z = 1. At x = 3 the following is obtained: y = 2. EXAMPLE 4.2: x = 10.01 is: at x = 3: y = 1.887 + 63. which is close to the numerical solution.435) = 1.9 Solve the following ordinary differential equation: F [  [Z FZ  with the initial conditions y(0) = 2. The analytical solution of the given differential equations is y = Asin(x + a) and z = Acos(x + a). and thus 2 = A sin(0 + a) 1 = A cos(0 + a) Thus tan a = 2 or a = 63.7158.

3 can be modified (only the functions func1 and func2 have to be changed) and with step size of 0. Program 4.5. z = 1.15. The mass in each tank shall be assumed constant as the tank volume and density of oil are assumed constant. z = 1. 4.90. We have to determine y at x = 3. The energy balance of tank 1 (accumulation = Input  Output) gives F6 /% 2  2 6  6 .01 we get at x = 3: y = 1.6 Series of Stirred Tanks with Coil Heater The schematic diagram of a series of stirred tanks with coil heater is shown in Fig. y = 2.66 Introduction to Numerical Methods in Chemical Engineering Solution Let us take F[ \ FZ Then the given differential equation can be written as F\  [Z FZ The two simultaneous differential equations can be written as F[ H \ FZ F\ H  [Z FZ The initial condition is at x = 0. 4.

 7# 65  6 .

4. T0 is the inlet temperature O kg/s T1 T2 T3 T0 T1 T2 T3 Fig. . O% FV where M is the mass of oil in the tank and O is the flow rate of oil.5 Schematic diagram of series of stirred tanks with coil heater.

The energy balance of tank 2 gives F6 /%2  2 6  6 . T1. T2. Initial Value Problems 67 of the oil. TS is the temperature of steam. second and third tank respectively. and T3 are the temperatures of the first.

 7# 65  6 .

O% FV The energy balance of tank 3 gives F6 /%2  2 6  6 .

 7# 65  6 .

Oil is fed into the first tank at a rate of 2 kg/s and overflows into the second and third tanks at the same flow rate. EXAMPLE 4. 4. The rate of heat transferred to the oil from the steam is given by 3 = UA(TS  T).10 Three tanks in series are used to heat oil (see Fig. O% FV The analysis is described in the example below. Saturated steam at 250°C condenses within the coils immersed in each tank. where A is the outside area of the coil in one tank. A = 1 m2 and the overall heat transfer coefficient is based on the outside area of the coil. U = 200 W/m2-K. Cp of oil = 2000 J/kg-K. Each tank is initially filled with 1000 kg of oil at 20°C. From the first differential equation we get F6  u   u    6 . The temperature of the oil fed to the first tank is 20°C. The tanks are well mixed so that the temperature inside the tanks is uniform and the outlet stream temperature is the temperature within the tank. Determine the steady state temperature in all the three tanks. What time interval is required for T3 to reach 99% of this steady state value? Solution UA = 200 W/K.5).

    6 .

FV F6   6 FV From the second differential equation we get F6  u   u  6  6 .

    6 .

FV F6   6  6 FV From the third differential equation we get F6  u   u  6  6 .

    6 .

FV F6   6  6 FV The initial condition is: at t = 0: T1 = T2 = T3 = 20°C.4 for the solution of above . Program 4.

87 7500 30.1 is shown in Table 4. thus the FV steady state temperatures are given by  6  °C   u    6  °C   u    6  °C  The same steady state temperatures are also obtained from the numerical solution.98 49.95 41. Table 4. The results at step size of 0.08 39.7 Initial Value Problems in Chemical Reaction Engineering Batch and plug flow reactors are initial value problems.4.5 Initial conditions and ODEs for batch and plug flow reactors Initial ODEs for Batch Reactor Initial ODEs for Plug Flow Condition for Condition for Reactor Batch Reactor Plug Flow Reactor #  M o\$  F% # F% # #VV   M% # #VZ  W  M% # FV FZ %#  %#  F%\$ F% \$ %\$  M% # %\$  W M% # FV FZ .56 2500 30.68 Introduction to Numerical Methods in Chemical Engineering three ordinary differential equations by the RungeKutta fourth order method is given in the Appendix. From Program 4.61 36.31 F6 The steady state temperature is obtained when in the differential equation  . 4.89 40. Table 4.31 15000 30.99 ´ 51.80°C. We are required to determine the time required for temperature in tank 3 to reach 0.38 51.38 51.10.31 = 50.4 Results in Example 4. Note the temperature at 7500 s in Table 4.4.4 this time is 3150 s.5.95 41. The initial conditions and ordinary differential equations for batch and plug flow reactors are shown in Table 4. Time (s) T1 (oC) T2 (oC) T3 (oC) 1000 29.

Initial Value Problems 69 Table 4.5 (Cont. EXAMPLE 4. The rate constant of the reaction is 1 s1. Solution The differential equation is written in the form f = kCA.) M M #  o \$  o% #VV  F% # #VZ  F% # M% # W  M% # %#  FV %#  FZ F%\$ F%\$ %\$ %%  M% #  M%\$ %\$ %%  W M% #  M% \$ FV FZ F%% F%% M%\$ W M% \$ FV FZ #  \$  M o%  \$  % o & M  F% # F% # #VV  M% #% \$ #VZ  W  M% #%\$ FV FZ %# %\$  %# %\$  F% \$ F%\$ W  M% #%\$  M%\$%% %% %&  M% #% \$  M% \$%% %% %&  FV FZ F%% F%% M% #%\$  M%\$%% W M% #% \$  M% \$%% FV FZ F%& F% & M%\$%% W M% \$%% FV FZ 4. determine the concentration of A at 3 s.8 Batch and Stirred Tank Reactors The solution of initial value problems in batch and stirred tank reactors is described with the examples given below. CA = 1 mol/m3. Thereafter the following are computed: M J u H V  % . Using the RungeKutta fourth order method. The differential equation for species A is F% #  M% # FV The initial condition is: at t = 0.11 Consider a reaction A ® B carried out in a batch reactor.

§   · M J u H ¨ V  J %  M ¸ ©   ¹ §   · M J u H ¨ V   J %   M  ¸ ©   ¹ .

70 Introduction to Numerical Methods in Chemical Engineering M J u H V  J %  M .

 % %  M  M  M  M .

0 0.049787 0.11 t (s) CA (mol/m3) CA (mol/m3) = et Numerical solution Analytical solution 0. Both the reactant and product have the same density.006738 10.000045 0.12 A liquid phase reaction A ® B is carried out in a stirred vessel reactor.01 s are presented in Table 4. The volume of the tank is V = 10 L and the concentration of A of the solution in the tank is 1 mol/m3.367880 0.  V V  J %  % Program 4.135335 3.000045 EXAMPLE 4.6 Results in Example 4. Table 4.0 0.049787 5.0 0. The vessel may be considered perfectly mixed.367879 2.0 0.135335 0.1 can be modified and the results for step size of 0. Solution Mole balance on component A is given by Accumulation = Input  Output  Consumption Moles of A in the reactor = VCA F 8% # .0 1. Feed enters the reactor at a rate of F = 1 L/s and exits out also at the same flow rate.0 0. where k = 1 s1.000000 1. The rate of consumption of A equals kCA.006738 0. The concentration of reactant in the feed is CA0 = 1 mol/m3.6.000000 1. so that the concentration of A in the product stream equals that inside the tank. Determine the concentration of A at various time periods from 0 to 10 s.

Accumulation = FV Input = FCA0 Output = FCA Thus from the mole balance of component A. we get F 8% # .

(% #   (% #  M% #8 FV Substituting the values we get F % # .

   % #  % # FV F% #   % # FV .

Program 4.  . and C. A = A0.0909 F% #  At steady state.50 0. determine the concentration of A.0947 10. Thereafter the concentrations are computed at time t = t0 + h. Note the concentration at 10 s in the Table 4. The rate constants are k1 = 1 s1 and k2 = 1 s1. Using the RungeKutta fourth order method. CB = 0 mol/m3. respectively. Solution The differential equations are written in the form of functions H  M # H M #  M \$ H M \$ where A.0 0.0 0.13 Consider reaction #  M M o \$  o % carried out in a batch reactor.01 the concentration of component A in the tank with time is shown in Table 4. CA = 1 mol/m3.1 can be modified and at step size of 0. CA = 1 mol/m3.1248 5. and CC = 0 mol/m3. B and C are the concentrations of the components A. Initial Value Problems 71 The initial condition is: at t = 0. thus % #  mol/m3. B.0 0. B = B0. The same is also obtained from FV  numerical solution.0 0. EXAMPLE 4.9053 0. and C up to 10 s.6212 1. The initial condition is at time t = t0. B. The differential equation for component A is F% #  M% # FV for component B F% \$ M% #  M %\$ FV for component C F%% M % \$ FV The initial condition is: at t = 0. C = C0.10 0.0 0.7 Results in Example 4.7.7. .1927 3. Table 4.7891 0.3969 2.12 Time (s) CA (mol/m3) 0.25 0.

72 Introduction to Numerical Methods in Chemical Engineering M J u H V  #  \$  % .

N J u H  V  #  \$  % .

O J u H V  #  \$  % .

§     · M J u H ¨ V  J #  M  \$  N  %  O ¸ ©     ¹ §     · N J u H  ¨ V  J #  M  \$  N  %  O ¸ ©     ¹ §     · O J u H ¨ V  J #  M  \$  N  %  O ¸ ©     ¹ §     · M J u H ¨ V  J #  M  \$  N  %  O ¸ ©     ¹ §     · N J u H  ¨ V  J #  M  \$  N  %  O ¸ ©     ¹ §     · O J u H ¨ V  J #  M  \$  N  %  O ¸ ©     ¹ M J u H V  J #  M  \$  N  %  O .

N J u H V  J #  M  \$  N  %  O .

O J u H V  J #  M  \$  N  %  O .

 # #  M  M  M  M .

  \$ \$  N  N  N  N .

  % %  O  O  O  O .

. The results for step size of 0.  t 0 = t0 + h A0 = A1 B0 = B1 C0 = C1 Program 4.8.5 for the solution of the above three simultaneous ordinary differential equations by the RungeKutta fourth order method is given in the Appendix.01 s are presented in Table 4.

0 0.000454 0.073263 0.800852 4.0 0.908422 5.270671 0. CA = 1 mol/m3.999503 EXAMPLE 4.000045 0. .000000 0. Using the RungeKutta fourth order method determine the concentration of species A.018316 0.367879 0.0 0.000000 0.959573 10. CC = 0 mol/m3.149361 0.0 0.000000 1.14 Consider the following two reactions taking place in a batch reactor: M #  \$  o% M \$  %  o& The concentration of various species with time are given by the following differential equations: for component A F% #  M% #%\$ FV for component B F% \$  M% #% \$  M% \$%% FV for component C F%% M% #%\$  M%\$%% FV for component D F% & M% \$%% FV The initial conditions are: at t = 0.8 Results in Example 4. and CD = 0 mol/m3. CB = 1 mol/m3.0 1.006738 0.593994 3.6 for solution of the above four simultaneous ordinary differential equations by the RungeKutta fourth order method is given in the Appendix.135335 0.049787 0. B. The rate constant of the reactions are k1 = k2 = 1 m3/mol-s. The results for step size of 0.264241 2.01 s are presented in Table 4.0 0.367880 0.13 t (s) CA (mol/m3) CB (mol/m3) CC (mol/m3) 0. Solution Program 4. Initial Value Problems 73 Table 4.033690 0.9. and D up to 10 s.0 0. C.

000000 0.0 0.006738 10.404510 0.0 0.357692 0.337090 0.366553 0.000000 1.000000 0.0 1.049787 5.367880 2. Solution Program 4. The differential equation for species A along the length of the plug flow reactor of length 10 m is F% # W  M% # FZ The initial condition is: at x = 0 (inlet).14 t (s) CA (mol/m3) CB (mol/m3) CC (mol/m3) CD (mol/m3) 0.134230 2.10.0 0.0 0.317492 4.0 0. CA = 1 mol/m3.0 0.000000 1.135335 3.367737 0. The rate constant of the reaction is 1 s1.020275 0.327357 0.01 m are presented in Table 4.528875 0. The differential equation for component A is F% # W  M% # FZ .229376 3.15 Consider a reaction A ® B carried out in a plug flow reactor.000045 EXAMPLE 4.15 x (m) CA (mol/m3) 0. A fluid medium comprising initially only A flows through the reactor with a mean axial velocity u = 1 m/s.364356 0.318152 0.0 0.175134 0.000000 1.083121 0.366113 0. Table 4.394646 0.16 Consider a reaction #  M M o \$  o % carried out in a plug flow reactor.0 1.74 Introduction to Numerical Methods in Chemical Engineering Table 4.0 0.365561 0. Using the RungeKutta fourth order method.0 0.9 Results in Example 4.040733 0.0 0.1 can be modified and the results for step size of 0.000659 0.0 0. determine the concentration of A along the length of the plug flow reactor up to 10 m.296357 5.9 Plug Flow Reactor The solution of initial value problems in plug flow reactor is described with examples given below.336895 0.10 Results in Example 4. EXAMPLE 4.274571 4.307082 10.

and C along the length of the plug flow reactor up to 10 m.000000 1.5 can be modified (time replaced by distance along the length of the tubular reactor) and the results for step size of 0. and CC = 0 mol/m3.006806 0. Using the RungeKutta fourth order method.018500 0.000046 0. A fluid medium comprising initially only A flows through the reactor with a mean axial velocity u = 1 m/s.17 Consider the following two reactions taking place in a plug flow reactor: M #  \$  o% M \$  %  o& The concentration of various species with the length of the reactor are given by the following differential equations: for component A F% W #  M% #% \$ FZ for component B F% W \$  M% #%\$  M%\$%% FZ for component C F% W % M% #%\$  M%\$%% FZ for component D F% W & M  % \$ %% FZ .01 m are presented in Table 4. B. Table 4.260562 2.799353 4.591281 3. determine the concentration of A.136695 0.272024 0.0 0.959234 10.000000 0.999496 EXAMPLE 4.0 0.0 0.073814 0.000458 0.907686 5.0 1.0 0.371577 0.367861 0. The rate constants are: k1 = 1 s1 and k2 = 1 s1.0 0.033960 0.050287 0.11 Results in Example 4.000000 0.0 0.16 x (m) CA (mol/m3) CB (mol/m3) CC (mol/m3) 0.11. Solution Program 4. CA = 1 mol/m3.150359 0. CB = 0 mol/m3. Initial Value Problems 75 for component B F%\$ W M% #  M% \$ FZ for component C F%% W M% \$ FZ The initial condition is: at x = 0 (inlet).

54 cm.528875 0.020275 0.0 1.364356 0. The internal diameter of the reactor tubes may be taken as 2. B. Table 4. The rate constant of the first order . Reactant A is fed at the rate of 1.18 Consider the reaction A ® B carried out in a steam heated heat exchanger reactor. Solution Substituting k1 = k2 = 1 m3/mol-s and u = 1 m/s in the above ordinary differential equations. The length of the plug flow reactor is 10 m.134230 2. CB = 1 mol/m3.000000 1.229376 3.000659 0.17 x (m) CA (mol/m3) CB (mol/m3) CC (mol/m3) CD (mol/m3) 0.76 Introduction to Numerical Methods in Chemical Engineering The initial conditions are: at x = 0 (inlet).274571 4. and CD = 0 mol/m3. The feed consisting of pure A enters the reactor at a temperature of 21°C.296357 5.357692 0.000000 1.000000 0. It is desired to determine the height of reactor required for 90% conversion of A.000000 0. CC = 0 mol/m3. A fluid medium comprising initially only A and B flows through the reactor with a mean axial velocity u = 1 m/s.366113 0. we get F% #  % #% \$ FZ F% \$  % #% \$  % \$%% FZ F%% % #%\$  %\$%% FZ F% & % \$ %% FZ Program 4.6 can be modified (time replaced by distance along the length of the tubular reactor) and the results for step size of 0.01 m are presented in Table 4.394646 0.040733 0.0 0.317492 4.0 0.327357 0.365561 0.318152 0.366553 0.12. C.367737 0.0 0.0 0.337090 0.0 0.404510 0.10 Nonisothermal Plug Flow Reactor EXAMPLE 4.175134 0.12 Results in Example 4.307082 10. CA = 1 mol/m3.336895 0.26 kg/s per tube.71 K is available for heating purposes. determine the concentration of species A. and D along the length of the plug flow reactor up to 10 m. Using the RungeKutta fourth order method. The rate constant of the reactions are k1 = k2 = 1 m3/mol-s. Steam at 388.083121 0.0 0.

heat transfer coefficient based on inside area of reactor tube. '* TZP = 92. Cp = 15. MP# MP# Solution Since the reaction is first order. molecular weight of reacting stream.9 kJ/mol. M = 200 g/mol. Initial Value Problems 77 §  · reaction is given by M  Z GZR ¨  ¸ . M% #   : .7 J/kg-K. r = 980.314 J/mol-K. Assume the heat of reaction to be independent of temperature. U = 1900 W/  m2-K. Take the following © 46 ¹ parameters: R = 8.9 kg/m3. where T is in Kelvin.

where F is the volumetric ( ( flow rate of reactant A and P# is the inlet molar flow rate of A. The rate constant of the reaction can be written as ª §  ·º M M GZR «D ¨   ¸ » ¬ © G ¹¼ ' 6 where D . G and M  u  GZR D . .

46 6 T1 is a reference temperature and is taken to be the temperature of steam. . FP# F: P# F: T#  P# F8 F8 # F\ ª §  ·º M GZR « D ¨   ¸ »   : .

Thus the above equation becomes F6 7  2  O%  65  6 . thus a = pD (for one tube). F: T# ¬ © G ¹¼ F8 P# ( From energy balance on reactants we get F6  2 O%  T# #'*   S  F\ TZP where q = Ua(TS  T) and a is the total area of heat transfer per unit length. A is the cross-sectional area of the tube based on inside diameter.

 T# '*   F8 & TZP MI  O  O (   u   U  MI U '  D  46  u  M  u  GZR D .

 u  GZR  .

 S1 .

78 Introduction to Numerical Methods in Chemical Engineering ª §  ·º #M   : .

GZR « ¨   ¸ » F: ¬ © G ¹¼ F\ (  #M §  ·  Q¨ ¸   m1 ( ©  ¹  u  Thus F: ª § 6 ·º    : .

- a. The inlet molar flow rate of A is given by MI OQN OQN P#   U MI U F6 7  2  O%  65  6 . 9  2 O%    U MI  . A and U are all based on the internal diameter of tubes. GZR « ¨    ¸ » F\ ¬ © 6 ¹¼ MI .

 T# '*   #F\ & TZP  F6  u    65  6 .

 T# '*   Q  .

F\   TZP ª §  ·º ª § 6 ·º M P# GZR « D ¨   ¸ »   : .

 u GZR « ¨    ¸ »   : .

¬ © G ¹¼ ¬ © 6 ¹¼ T# (  u   ª § 6 ·º T#    : .

GZR « ¨    ¸ » ¬ © 6 ¹¼ ª § 6 ·º  T# '* TZP  u    : .

GZR « ¨    ¸ » ¬ © 6 ¹¼ ª § 6 ·º   u     : .

GZR « ¨    ¸ » T# '* TZP ¬ © 6 ¹¼ Thus the energy balance equation becomes F6 ª § 6 ·º    65  6 .

  u     : .

GZR « ¨    ¸ »  F\ ¬ © 6 ¹¼ .

Initial Value Problems 79 Thus the two simultaneous ordinary differential equations are F: ª §  · º    : .

GZR « ¨   ¸ F\ ¬ © 6 ¹ »¼ F6 ª §  · º    6 .

    : .

029 365. . Program 4.51 0.13.204 366.0 0.29 0.232 367.903 379.1 0.3 0.00094 361.118 366.176 366. Table 4.89 40 0.56 200 0.13 Results in Example 4.69 0.0015 362.59 300 0.059 365.287 367.76 250 0.71 15 0.017 365.011 365. The results for step size of 0.14 45 0.2 0.33 350 0.64 35 0.5 0.39 50 0.1 m are presented in Table 4.542 370.35 3.752 374.998 388.7 for the solution of the above two simultaneous ordinary differential equations by Runge-Kutta fourth order method is given in the Appendix.49 10 0.68 Thus 90% conversion is achieved at a height of 200 m.260 367.18 z (m) X T 0.93 20 0.87 2.87 0.4 0.40 30 0.088 365.005 364.0 0.000363 359.65 150 0. X = 0 and T = 294.147 366.69 1. GZR « ¨   ¸ F\ ¬ © 6 ¹ »¼ The initial condition is: at z = 0.0015 362.0 0.0 0.16 25 0.15 K.999 388.980 385.000026 343.40 5.66 100 0.

Determine x(20).1 Integrate the following ODEs using the RungeKutta fourth order method: FZ   Z   [ FV F[  Z  [  Z\ FV F\  \  Z[ FV Initial condition at t = 0: x = y = z = 5.80 Introduction to Numerical Methods in Chemical Engineering Exercises 4. z(20) = 10. z(20).2 Consider the second order ordinary differential equation F Z FZ    Z  FV FV FZ with the initial conditions x(0) = 3 and  . y(20) = 12.96) 4. y(20).61.76. (Ans: x(20) = 6.

therefore two conditions have to be given to completely define the problem.3 Consider the second order ordinary differential equation F[ F[    Z   [  FZ FZ F[ with the initial conditions y(0) = 1 and  . (Ans: x(5) = 4. FZ FV F[ Hint: Take [ and thus the given ODE becomes   Z   [ .9 ´ 106) 4. FZ H [ FV F[ H  Z   [ FV Initial condition at t = 0: x = 3 and y = 5. The two FV FV simultaneous differential equations can be solved using the Runge-Kutta fourth order method by taking the following functions.   . Note that since the ordinary differential equation is second order. Compute x(5).

The two FZ FZ  simultaneous differential equations can be solved using the RungeKutta fourth order method by taking the following functions: . Compute y(1). FZ F[ F\ Z  \   [  Hint: Take \ and thus the given ODE becomes .  .

8 ´ 105 kg/ m-s. The initial velocity of the particle is zero and superficial velocity of air is 10 m/s. ( Ans: y(1) = 0. Air is fed at 25°C and 1 atm and the viscosity of air under these conditions is 1.0003 m in a pneumatic conveyor at length of 10 m. Use the following relation to determine CD:  %& 4G R    4G  R . Initial Value Problems 81 F[ \H FZ F\ Z  \   [  H FZ  Initial condition at x = 0: y = 1 and z = 0. Neglect the wall effects. The density of the particle is 900 kg/m3.8785) 4.4 Determine the velocity of the solid particles of diameter 0.

where Re p is the particle Reynolds number based on relative velocity and is given S I XI  X R .

8 Solve Exercise 4. N (Ans: 8.01 s1. The differential equation for species A is F% # W  M% # F\ The initial condition is: at z = 0.7 Consider a reaction A ® B carried out in a plug flow reactor. CA = 1 mol/m3. The differential equation for species A is F% #  M% # FV The initial condition is: at t = 0.9044 m/s) 4.95123 mol/m3) .904838 mol/m3) 4.1 s1.7 for rate constant of the reaction of 0. determine the concentration of A at 10 s. determine the concentration of A at 5 m from entrance. CA = 1 mol/m3. Take u = 1 m/s.1 s1.6 Solve Exercise 4.606531 mol/m3) 4. (Ans: 0. (Ans: 0. The rate constant of the reaction is 0.36788 mol/m3) 4. Using RungeKutta fourth order method.5 for rate constant of the reaction of 0.01 s1. (Ans: 0. F R by 4G R . (Ans: 0.5 Consider a reaction A ® B carried out in a batch reactor. The rate constant of the reaction is 0. Using the RungeKutta fourth order method.

CC = 0. B. and C at 5 m from entrance. and C at 10 s.11 for the following rate constants: k1 = 0.82 Introduction to Numerical Methods in Chemical Engineering 4. The rate constants are: k1 = 1 s1 and k2 = 0.0666 mol/m3. CB = 0 mol/m3. CC = 0. (Ans: CA = 0. CC = 0. CA = 1 mol/m3.1 s1. CA = 1 mol/m3. CB = 0.3679 mol/m3.54 ´ 105 mol/m3. (Ans: CA = 4. CB = 0 mol/m3. and CC = 0 mol/ m3.0409 mol/m3.408704 mol/m3.9 Consider reaction #  M M o \$  o % carried out in a batch reactor. The differential equation for component A is F% #  M% # FV for component B F% \$ M% #  M %\$ FV for component C F%% M % \$ FV The initial condition is: at t = 0. (Ans: CA = 0.11 Consider reaction #  M M o \$  o % carried out in a plug flow reactor. Using the RungeKutta fourth order method. CB = 0.1 s1. CB = 0.3268 mol/m3) 4.13 Consider the following two reactions taking place in a batch reactor: M #  \$  o% M \$  %  o& .5912 mol/m3) 4. The rate constants are: k1 = 1 s1 and k2 = 0. Using the RungeKutta fourth order method. B.9 for the following rate constants: k1 = 0.6664 mol/m3.59125 mol/m3) 4.1 s1 and k2 = 1 s1. determine the concentration of A.006738 mol/m3. CC = 0. and CC = 0 mol/m3. determine the concentration of A.1 s1 and k2 = 1 s1. (Ans: CA = 0. CB = 0.3268 mol/m3) 4. The differential equation for component A is F% # W  M% # FZ for component B F%\$ W M% #  M% \$ FZ for component C F%% W M % \$ FZ The initial condition is: at x = 0.6065 mol/m3.12 Solve Exercise 4.10 Solve Exercise 4.

(Ans: CA = 0.0650 mol/m3. CB = 1 mol/m3. B.1032 mol/m3) 4.3452 mol/m3) 4.1392 mol/m3. and D at 10 s. (Ans: CA = 0. CB = 0. CA = 1 mol/m3. and CD = 0 mol/m3. CC = 0. C.13 for the following rate constants: k1 = 0.2447 mol/m3. CC = 0 mol/m3.0361 mol/m3.5899 mol/m3.14 Solve Exercise 4. CD = 0. determine the concentration of species A. CB = 0. Using the RungeKutta fourth order method. Initial Value Problems 83 The concentration of various species with time are given by the following differential equations: for component A F% #  M% #%\$ FV for component B F% \$  M% #% \$  M% \$%% FV for component C F%% M% #%\$  M%\$ %% FV for component D F% & M  % \$ %% FV The initial conditions are: at t = 0.1 m3/mol-s. CC = 0. CD = 0.15 Consider the following two reactions taking place in a plug flow reactor: M #  \$  o% M \$  %  o& The concentration of various species are given by the following differential equations: for component A F% # W  M% #% \$ FZ for component B F% \$ W  M% #%\$  M%\$%% FZ for component C F%% W M% #%\$  M%\$%% FZ .1 m3/mol-s and k2 = 1 m3/mol-s.7576 mol/m3. The rate constant of the reactions are k1 = 1 m3/mol-s and k2 = 0.

1 m3/mol-s. CD = 0. The rate constant of the reactions are k1 = 1 m3/mol-s and k2 = 0.7269 mol/m3. determine the concentration of species A.1168 mol/m3. CB = 0. B. (Ans: CA = 0. CD = 0. CC = 0.7009 mol/m3.4764 mol/m3.84 Introduction to Numerical Methods in Chemical Engineering for component D F%& W M  % \$ %% FZ The initial conditions are: at x = 0 (inlet). (Ans: CA = 0.0781 mol/m3) 4. CB = 1 mol/m3. Using the RungeKutta fourth order method. C.1949 mol/m3. CC = 0.16 Solve Exercise 4. CA = 1 mol/m3.0747 mol/m3. and D at 5 m from the entrance. CC = 0 mol/m3. and CD = 0 mol/m3.1 m3/mol-s and k2 = 1 m3/mol-s.2244 mol/m3) .15 for the following rate constants: k1 = 0. CB = 0.

y(x + Dx) can be expanded in Taylor series about y(x) as follows: F[ 'Z  F  [ 'Z  F  [ [ Z  'Z . resulting in simultaneous algebraic equations with all unknowns prescribed at discrete nodal points. One-dimensional steady heat conduction. 5. and chemical reaction and diffusion in a pore are also discussed in this chapter. Chapter 5 Boundary Value Problems The application of finite difference method for the numerical solution of boundary value problems in ordinary differential equations is discussed in this chapter with various examples. steady heat conduction in a fin. The discretization of the convection term is discussed in the next chapter.1 Discretization in One-Dimensional Space The basic idea of finite difference methods is that the derivatives in differential equations are written in terms of discrete quantities of dependent and independent variables. Consider a function y(x) and its derivatives at point x.

[ Z .

we get [ Z  'Z .  'Z   " (5.1) FZ Z  FZ  Z  FZ  Z Simplifying.

 [ Z .

F[ 'Z F  [  " 'Z FZ Z  FZ  Z Thus F[ [ Z  'Z .

 [ Z .

 1 'Z .

That is why we write the derivative at point x as F[ [ Z  'Z . FZ Z 'Z F[ The derivative is of first order in Dx. indicating that the truncation error O(Dx) goes to FZ Z zero like the first power in Dx.

 [ Z .

5. 85 .1. NKO FZ Z o 'Z  'Z Consider a one-dimensional body as shown in Fig.

5.2b) FZ  FZ   FZ   FZ  K K K K K K F[ From Eq. We may write y in Taylor series at i + 1 and i  1 as F[ 'Z  F  [ 'Z  F  [ 'Z  F  [ [  [  'Z      " (5.86 Introduction to Numerical Methods in Chemical Engineering i 2 i 1 i i+1 i+2 Fig.2a) FZ  FZ  FZ  FZ  K K K K K K F[ 'Z  F  [ 'Z  F  [ 'Z  F  [ [  [  'Z    " (5. (5. we get the forward difference approximation of at node i as FZ F[ [   [ K  1 'Z .1 One-dimensional body.2a).

2b) we get the backward difference approximation of at node i as FZ F[ [  [  K  1 'Z .3) FZ K 'Z F[ and from Eq. K (5. (5.

we get the central difference approximation of at node i as FZ F[ [   [  FZ K  'Z  1 'Z  K . K (5.4) FZ K 'Z F[ Subtracting Eq.2a). (5.2b) from Eq. (5.

Adding the two F[ equations. (5. whereas the central difference yields a second order truncation error. we get the central difference approximation of at node i FZ  F[ [    [  [  FZ  K 'Z  K  1 'Z  K .5) K It is seen that the truncation errors for the forward difference and backward differences are first order.

Dt ® 0. (5.6) K It should be noted that these finite difference approximations are only valid to some order of Dx. It is possible to get approximations which are valid to higher order by using more grid points in the approximations. The error in the approximations is called the truncation error. Even if the numerical scheme is consistent. . A numerical scheme is called consistent if the finite difference approximations have a truncation error that approaches zero in the limit that Dx ® 0. we are still not guaranteed that iterating the numerical scheme will give a good approximation to the true solution of the differential equation. But for our purposes the approximations given above will be sufficient. A numerical scheme is called convergent if the solution of the discretized equations approaches the exact solution of the differential equation in the limit that Dx ® 0. Dt ® 0.

2. Dirichlet boundary condition is the one in which the variable is defined such as y = 0 and Neumann boundary condition is the one in which the F[ gradient of the variable is defined perpendicular to the surface such as  . for smaller sizes. more computations need to be done to get solutions for the same domain and total time. As Dx and Dt are made smaller. The total error as a function of these sizes is shown in Fig. Neumann and mixed. However. For a second order differential equation. two boundary conditions have to be specified and thus the problem is called the two-point boundary value problem. Here it is assumed that the solution is calculated on the same domain and for the same total time. 5. Mixed FP boundary condition is the one which is a combination of Dirichlet and Neumann. such as F6 M J 6  6f . Error Total error Truncation error Round-off error Grid size Fig. 5. A scheme is called stable if it does not magnify errors that arise in the course of the calculation. the truncation error of approximating the derivatives by finite differences decreases. There are three types of boundary conditions: Dirichlet.2 Errors as function of grid size for finite difference calculation. which leads to increased round-off errors. Boundary Value Problems 87 For linear equations the issue of convergence is intimately related to the issue of stability of the numerical scheme.

A well-posed problem is the one which has a unique solution. solve the second order one dimensional linear differential equation F[   (0 < x < 1) FZ  with the Dirichlet boundary conditions at x = 0: y 0 at x = 1: y 0 .1 Using finite difference method. . FZ EXAMPLE 5.

4 Example 5. 5.4). 1 2 3 Fig. 1 2 3 4 Fig. 5.5.3). The exact solution is y = x2  x. 5. therefore Dx = 0.  EXAMPLE 5.2.88 Introduction to Numerical Methods in Chemical Engineering Compute the value of y at x = 0.5. 5.5.3 Example 5. Solution The central difference in space gives [    [  [  K K K  'Z  Substituting i = 2. which is the same as the exact solution. Make two parts (see Fig. Solution The central difference in space gives [    [  [  K K K  'Z  At node 2 [   [  [  'Z  . Make two parts (see Fig.1. solve the second order one dimensional linear differential equation F[   (0 < x < 1) FZ  with the following boundary conditions: At x = 0: y 0 Dirichlet boundary condition F[ At x = 1:  Neumann boundary condition FZ Compute the value of y at x = 0. It is given that y1 = 0 and y3 = 0 and we get  [  . we get [   [  [  'Z  Since two parts are made.2 Using the finite difference method.

Boundary Value Problems 89 Since y1 = 0.3 Using finite difference method.  EXAMPLE 5. solve the differential equation with the source term f(x) F[  [ H Z . Therefore  'Z   [   [  'Z  Thus 'Z  [  [  'Z   Solving the equations for nodes 2 and 3. we get [   [  'Z  At node 3 [   [  [  'Z  where node 4 is a hypothetical node. From the boundary condition at node 3. we get [  [   'Z thus y4 = y2 + 2Dx. we get [  and y3 = 0.

Make 3 parts (see Fig. (0 < x < 1) FZ  f(x) = 4x2  2x  4 with the Dirichlet boundary conditions At x = 0: y 0 At x = 1: y 1 The total length is 1 m.5). The exact solution is y = 2x2 + x. 5.3. Solution The central difference in space gives [    [  [  K K  [ K H 'Z  K K At node 2 [   [  [   [ H 'Z  . 5.5 Example 5. 1 2 3 4 Fig.

90 Introduction to Numerical Methods in Chemical Engineering [   [       [  §·  ¨¸ © ¹   [   [ .

  [   At node 3  [   [  [ §· §·     [ ¨ ¸  ¨ ¸    §· ©¹ © ¹  ¨ ¸ ©¹      [  [ .

we get y2 = 0.111 and y3 = 0. EXAMPLE 5.   [   Solving the equations for nodes 2 and 3.222.4 Using finite difference method. solve the differential equation with the source term f(x) F[  [ H Z.

(0 < x < 1) FZ  H Z.

6 Example 5. 5.6). 1 2 3 4 5 Fig. Z  Z   subject to the boundary conditions At x = 0: y = 0 F[  At x = 1: FZ The total length is 1 m. Solution The central difference in space gives [    [  [  K  [ K K H 'Z  K K At node 2 [   [  [   [ H 'Z  [   [       [  §·  ¨¸ © ¹ .4. Make 3 parts (see Fig. The exact solution is y = 2x2 + x. 5.

Boundary Value Problems 91   [   [ .

  [   At node 3  [   [  [ §· §·     [ ¨ ¸  ¨ ¸    §· ©¹ © ¹  ¨ ¸ ©¹   [   [  [ .

  [   At node 4 [   [  [    [  §· ¨¸ © ¹  [   [  [ .

From the boundary condition at node 4. therefore y 5 y 3  2 and the equation for node 4 becomes  'Z   [   [   .   [  where node 5 is a hypothetical node. we get [  [   .

  [   Thus the equation of node 2 is   [   [   Thus the equation of node 3 is   [   [   [   Thus the equation of node 4 is  [   [  The equation can be written as ª    º ª [ º ª    º «    »» «« [ »» «   » « « » «¬    »¼ «¬ [ »¼ «¬  »¼   Solving using TDMA. [  .   EXAMPLE 5.5 Solve the boundary value problem F [ [ FZ  F[  . we get [ . y4 = 1.

Take Dx = 0.  and y(1) = 1. Compare the results with the analytical solution FZ EQUJ Z [ EQUJ .1 m.

7. F[  y =1 FZ 1 6 11 Fig. 5. we get [    [  [  K K K [ 'Z  K K [     'Z  [  [  .92 Introduction to Numerical Methods in Chemical Engineering Solution The schematic diagram is shown in Fig.7 Example 5.5. 5. Discretizing the given differential equation at node i using the central difference scheme.

01y10 + y11 = 0 Since y11 = 1. thus  .  .1.01y1 + 2y2 = 0 At node 2 y1  2. K K  Since Dx = 0. the above equation becomes y9  2.01y2 + y3 = 0 At node 10 y9  2.01y10 = 1 Thus the unknowns are y1 to y10.01 and the above equation becomes [   [  [  K K K  At node 1 [  [  [  F[ [  [ Also at node 1. therefore Dx2 = 0. thus y0 = y2 and we get at node 1 FZ  'Z 2. The tridiagonal set of 10 equations becomes ª   º ª [ º ª º «    »«[ » « » « »«  » « » «    » «  » « » « »« » « » «   » « [ » « » ¬«  ¼» «¬ [ »¼ ¬« »¼ .

T10 = 200°C.7309 0. The numerical and analytical solution at nodes 1 to 10 are shown in Table 5. The temperature of the left side of the slab is 100°C and of the right side is 200°C.1.2 One-Dimensional Steady Heat Conduction The steady heat conduction in one dimension is described with examples given below. T1 = 100°C.1 0. Table 5.6515 0.5 0. Dx = 1.6482 0.111.6 Consider 1-dimensional steady state conduction without heat generation taking place in a rectangular slab.8 0. The equations can be written in tridiagonal form as . 5.8 Example 5. Using the central difference scheme. Boundary Value Problems 93 The solution can be obtained by modifying the parameters ai (i = 2 to N).6612 0.3 0. The governing equation is M   FZ Solution Let us make nine uniform divisions as shown in Fig. bi (i = 1 to N) and ci (i = 1 to N  1) in Program 1.6776 0.8668 0.0 0.6. The length of the slab is 10 cm and the thermal conductivity of the F 6 slab is 120 W/cm-K.1 Numerical and analytical solutions at nodes 1 to 10 for Example 5.8667 10 0.1 given in the Appendix.6774 6 0. 1 2 3 4 5 6 7 8 9 10 Fig.2 0. Make nine uniform divisions. 5.9 0. EXAMPLE 5.5 Node x (m) Numerical y Analytical y 1 0.7308 9 0. we get 6   6   6 M K K K  'Z  6   6  6  K K K  The equation for node 2 is 2T2  T3 = 100 Similar equations can be written for all the nodes and the following set of eight linear algebraic equations is obtained.8.6611 4 0.9287 5.6481 2 0.6513 3 0.9287 0.

0 1 2 3 4 Wall at 320°C x =0 0. The thermal conductivity of the rod is 50 W/m-K and the convective heat transfer coefficient from the rod to the surroundings is 100 W/m2-K.05 m using the finite difference technique taking four parts.05 m is  R . bi (i = 1 to N) and ci (i = 1 to N  1) in Program 1.1 given in the Appendix.02 m and length 0. where q = T  Tsurr and the boundary FZ M# FR J condition at x = 0. The temperature of the surroundings is 20°C. The temperature of the wall is 320°C.94 Introduction to Numerical Methods in Chemical Engineering ª   º ª6 º ª  º «    » «6 » « » « »« » « » «    » «6 » « » « »« » « » «    » «6 » « » «    » «6 » « » « »« » « » «    » «6 » « » «   » «6 » « » « »« » « » ¬«   ¼» ¬«6 »¼ ¬«  ¼» The solution can be obtained by modifying the parameters ai (i = 2 to N). 5. 5. 0.05 m q0 = 300 Fig.05 m is attached to a wall. .9.0125 0. FZ M Solution The schematic diagram of the fin is shown in Fig.025.9 Steady state heat transfer in fin.7 A fin of diameter 0. 0.0125.0375 and 0.025 0. Determine the temperature of the fin at x = 0. Using TDMA the following solution is obtained: ª6 º ª º «6 » « » «  » « » «6 » « » « » « » «6 » « » «6 » « » « » « » «6 » « » «6 » « » « » « » «¬6 »¼ ¬« ¼» EXAMPLE 5. The F R J2 governing differential equation is    R  .0375 x = 0.

M# F R J2 From the discretization of the differential equation   R  . Boundary Value Problems 95 J2 Let O . we get R   ª  O'Z . we get FZ  M# § R  R  R  ·  ¨  K  K ¸  O R K  'Z K © ¹ Simplifying.

FR J At x = L (node 4). º R  R    (for i = 1. J R R  R  'Z M Substituting this in the equation for node 4. we get q0 + Dq1  q2 = 0 Since q0 = 300 the above equation becomes Dq1  q2 = 300. we get q3 + Dq4  q5 = 0 where q5 is a hypothetical node to the right of node 4. we get q1 + Dq2  q3 = 0 Applying the above equation to node 3. the equation  R  is applicable and the difference equation FZ M becomes R  R J  R   'Z M From this expression we can determine T 5 in terms of T 3 and T 4 . 2. Therefore the above equation becomes qi1 + Dqi  qi+1 = 0 Applying the above equation to node 1. we get q2 + Dq3  q4 = 0 Applying the above equation to node 4. Applying the above equation to node 2. we get §  J 'Z · R   ¨ &  ¸R   © M ¹ . 3. 4) K ¬ ¼ K K Let D = 2 + (mDx)2.

96 Introduction to Numerical Methods in Chemical Engineering Thus the four difference equations are Dq1  q2 = 300  q1 + Dq2  q3 = 0  q2 + Dq3  q4 = 0 § J 'Z · R   ¨ &  ¸R   © M ¹ J2 J Q F .

J  u  O  M# §QF ·  MF  u  M¨ ¸ ©  ¹ &   O'Z .

0125 248.0375 191.2 Numerical and analytical results for Example 5.1 given in the Appendix.1125q4 = 0 The set of simultaneous linear algebraic equations can be written in tridiagonal form as ª  º ªR º ª º «    » «R » « » « »« » « » «   » «R  » « » « »« » « » ¬«  ¼» ¬«R  ¼» ¬«  ¼» The solution can be obtained by modifying the parameters ai (i = 2 to N).90 0.95 248.7 x (m) q (numerical solution q (analytical for 4 parts) solution) 0.0625q2  q3 = 0  q2 + 2.0625q3  q4 = 0  2q3 + 2.47 213.66 Even when 4 parts are made the difference between the numerical and analytical solution is meagre. Table 5. The comparison of numerical and analytical results is presented in Table 5. bi (i = 1 to N) and ci (i = 1 to N  1) in Program 1. .     u  u   Thus the four difference equations are 2.0625q1  q2 = 300  q1 + 2.13 180.025 213.75 0. The numerical solution can exactly match with the analytical solution if a greater number of parts is made.2.05 181.13 0.32 190.

8 Diffusion and reaction take place in a pore of 1mm in length. thus 'Z   m. Boundary Value Problems 97 5.10. The concentration at the surface of the mouth of the pore is 1 mol/m3.7) FZ  & Let us define M O (5.10a) and at x = L F%  (5. The rate constant of the reaction.8) & Thus the differential equation can be written as F %   O%  (5. D = 109 m2/s. C=1 F%  FZ 0 100 x=0 x = 1 mm Fig. 5. The boundary conditions are At x = 0: C=1 F% At x = 103 m:  FZ .3 Chemical Reaction and Diffusion in Pore The differential equation for diffusion and reaction in a pore is given by F % M  %  (5. k = 103s1 and effective diffusivity of species. Make 100 parts of the pore and determine the concentration at x = 0. The  schematic diagram of the pore is shown in Fig. The first node is labelled 0 and therefore the last node is the 100th node as 100 parts are made.9) FZ The boundary conditions are at x = 0 C = CS (5. 5.10b) FZ where CS is the concentration at the surface of the pore. EXAMPLE 5. Solution We have M   O  m1 &     The pore length is 1 mm = 10-3 m and 100 parts are made.10 Diffusion and reaction in pore.5 mm.

0001C100 = 0 The 100 equations can be written in tridiagonal form as .0001C99 + C100 = 0 At node 100 %  %  %     %  'Z %  %  %    %  F% %  % But  .98 Introduction to Numerical Methods in Chemical Engineering Discretizing the differential equation at node i. therefore %    %    %  'Z  Substituting the value of Dx = 105 m. we get 2C99  2.0001C2 + C3 = 0 At node 99 %  %  %    %  'Z  C100 + C98  2C99  104C99 = 0 C98  2. thus  and therefore C101 = C99. we get %  %  At node 2 %  %  %    %  'Z  C3 + C1  2C2  104C2 = 0 C1  2. FZ  'Z Substituting C101 = C99 in the previous equation. we get %    %    u   %  Simplifying. we get %   %   % K K    % K  'Z  K At node 1 %  %  %     %  'Z It is given that C0 = 1.

6) = 0.072919 y3 = y(0. Take Dx = 1.095313 y8 = y(0.1 Consider the two-point boundary value problem d2y  y 1 0 dx 2 with the boundary conditions y(0) = y(1) = 0.7) = 0. List the tridiagonal set of equations and determine y at x = 10.1.3) = 0.9) = 0. we get C = 0.1 given in the Appendix.095313 y4 = y(0.5 mm (50th node). Exercises 5. From the results.4) = 0.8) = 0. Take Dx = 0. .2) = 0.041253 5.072919 y9 = y(0. List the tridiagonal set of equations and determine y at various values of x.108661 y5 = y(0.108661 y7 = y(0.2 Consider the two-point boundary value problem F [ F[    [Z  FZ FZ with the boundary conditions y(0) = 5 and y(20) = 8.1) = 0. Boundary Value Problems 99 ª   º ª% º ª º « » « » « » «    » «% » « » «    » «% » « » « »« » « » «    » « » « » «    » « » « » « »« » « » «    » « » « » «    » «% » « » « » «  » « » «   » «% » « » « »« » « » ¬«  ¼» ¬«% ¼» ¬«  »¼ The solution can be obtained by modifying the parameters ai (i = 2 to N).73 at x = 0.113096 y6 = y(0.5) = 0. bi (i = 1 to N) and ci (i = 1 to N  1) and di (i = 1 to N) in Program 1.041253 y2 = y(0. (Ans: The tridiagonal set of equations are ª   º ª [ º ª º «    » «[ » « » « »« » « » «    » « » « » « »« » « » «   » « [ » « » ¬«  ¼» ¬« [ ¼» ¬« ¼» y1 = y(0.

4 Consider the ordinary differential equation F [ [ FZ  F[ with the boundary conditions: .100 Introduction to Numerical Methods in Chemical Engineering (Ans: The tridiagonal set of equations are ª   º ª [ º ª  º «    » «[ » «  » « »«  » « » «    » « » « » « »« » « » «   » « [ » « » ¬«  ¼» ¬« [ ¼» ¬« ¼» y10 = y(10) = 8. List the tridiagonal set of equations and determine y at various x.654857 y3 = y(2.076825.0) = 3.5) = 6. 5.3 Consider the ordinary differential equation d2y y dx 2 with the boundary conditions y(1) = 1.146603 y2 = y(2.018.5) = 2.514381. Take Dx = 0. 5.175 and y(3) = 10. (Ans: The tridiagonal set of equations are ª   º ª [ º ª º «   »» «« [ »» «  »» « « «¬  »¼ «¬ [ »¼ «¬ »¼ y1 = y(1.5.

 and F[  .

Take Dx = 0.552429 y2 = y(1.5.0) = 9.775857 .0) = 1. (Ans: The tridiagonal set of equations are ª   º ª [ º ª º «    » «[ » «  »» « »« » « «    » « [ » « » « »« » « » «   » « [ » « » ¬«  ¼» ¬« [ ¼» «¬ »¼ y1 = y(1.988840 y5 = y(3.0) = 3.333983 y3 = y(2.  .5) = 5. FZ FZ List the tridiagonal set of equations and determine y at various x.699032 y4 = y(2.5) = 2.

06 x = 0.3) = 85.1) = 95. List the tridiagonal set of equations and determine the temperature of the fin at x = 0.5) = 75. The thermal conductivity of rod is 25 W/m-K and convective heat transfer coefficient from rod to surroundings is 40 W/m2-K.0 T8 = T(0.02.6) = 70.0 T6 = T(0. Take Dx = 0.9) = 55.0 T2 = T(0. The temperature of surroundings is 25°C. The governing equation is F 6 .0 5. The temperature of the wall is 200°C. 5. Determine the temperature distribution in the slab and list the tridiagonal set of equations.0 T4 = T(0.08 m is attached to a wall (see Fig.4) = 80.04 0.06 and 0.08 m Fig.0 T7 = T(0.0 T3 = T(0.7) = 65.08 m is  R .5 Consider 1-D steady state conduction without heat generation taking place in a rectangular slab.11). The length of the slab is 1 m and the thermal conductivity of the slab is 120 W/cm-K. 0.04.2) = 90. using the finite difference technique taking four parts.6 A fin of diameter 0. where q = T  Tsurr and boundary condition at FZ M# FR J x = 0.02 0. FZ M 0 1 2 3 4 Wall at 200°C x=0 0.1 m.08 m.0 T9 = T(0. 0. The governing differential F R J2 equation is    R  . .8) = 60. Boundary Value Problems 101 5. The temperature of the left side of the slab is 100°C and of the right side is 50°C. FZ  (Ans: The tridiagonal set of equations are ª   º ª6 º ª  º «    » «6 » «  »» « »« » « «    » « » « » « »« » « » «   » «6 » « » «¬   »¼ «¬6 »¼ «¬  »¼ T1 = T(0. 5.02 m and length 0.0 T5 = T(0.6.11 Exercise 5.

FZ (Ans: The tridiagonal set of equations are ª   º ª% º ª º «    » «% » « » « »«  » « » «    » « » « » « »« » « » «   » «% » « » «¬  »¼ «¬% »¼ ¬«  ¼» .7 Diffusion and reaction take place in a pore of 1mm in length.6) = 0.98 q4 = q (0.941703 C4 = C(0.5) = 0. List the tridiagonal set of equations and determine the concentration along x.887947 C10 = C(1. Make 10 parts of the pore.06) = 80. The rate constant of the reaction. k = 0.102 Introduction to Numerical Methods in Chemical Engineering (Ans: The tridiagonal set of equations are ª  º ª R º ªº «    » «R » « » « »« » « » «   » «R  » « » « »« » « » «¬   »¼ «¬R  »¼ «¬  »¼ q1 = q (0. The concentration at the surface of the mouth of the pore is F% 1 mol/m3 and at pore end .44 q3 = q (0.8 Diffusion and reaction take place in a pore of 1 mm in length.88 5.2) = 0.5 ´ 104s1 and effective diffusivity of species.7) = 0.8) = 0.1 s1 and effective diffusivity of species.02) = 128.3) = 0.9) = 0.958723 C3 = C(0.4) = 0.896832 C8 = C(0. List the tridiagonal set of equations and determine the concentration along x. D = 109 m2/s.1) = 0.886838 Distance (in mm) is measured from the pore mouth.927039 C5 = C(0. D = 109 m2/s.978139 C2 = C(0.04) = 98.49 q2 = q (0. k = 2. The rate constant of the reaction.891275 C9 = C(0.914691 C6 = C(0. Make 10 parts of the pore.0) = 0. FZ (Ans: The tridiagonal set of equations are ª   º ª% º ª º « » « » « » «    » «%  » « » «    » « » « » « »« » « » «   » «% » « » «¬  »¼ ¬«% ¼» «¬  »¼ C1 = C(0.08) = 73. The concentration at the surface of the mouth of the pore is F% 1 mol/m3 and at pore end . 5.904631 C7 = C(0.

Boundary Value Problems 103 C1 = C(0. Compare the numerical solution with the analytical solution  È R Ø  W  É Ù [ J .000463 C9 = C(0.7) = 0. Make 10 parts.8) = 0.12.12 Illustration for Exercise 5. The spacing between the plates is 0.000198 C10 = C(1. Determine the velocity at various nodes between the symmetry line and the wall.055728 C4 = C(0.2) = 0.000132 Distance (in mm) is measured from the pore mouth.6) = 0.  N Ê Z Ú . Fluid moves in the x-direction parallel to the plates and there is no velocity in the y direction.9) = 0.003107 C7 = C(0.001190 C8 = C(0.145898 C3 = C(0.0) = 0. Using the finite difference method. solve the velocity profile equation wR w W  N   wZ w[ u y h x h Fig. 5. 5. 5.02 m and pressure gradient is  100 Pa/m.001 kg/m-s.3) = 0.4) = 0.9 Water flows between the two fixed parallel plates as shown in Fig.021286 C5 = C(0.381966 C2 = C(0.9.1) = 0.5) = 0. The viscosity of water under the flow conditions is 0.008131 C6 = C(0.

.3. (Ans: The tridiagonal set of equations are ª   º ªW º ª º «    » «W » « » « »«  » « » «    » « » « » « »« » « » «   » «W » « » «¬   »¼ «¬W »¼ «¬ »¼ and the results are presented in Table 5.

003 4 4.95 4.9 x (m) Node u.75 0.20 4. Numerical (m/s) u.3 Results in Exercise 5.55 0.55 0.006 7 3. Analytical (m/s) 0.75 3.008 9 1.80 0.009 10 0.00 5. .95 Distance (in m) is measured from the symmetry line.104 Introduction to Numerical Methods in Chemical Engineering Table 5.004 5 4.55 2.95 0.005 6 3.20 0.001 2 4.95 0.000 1 5.007 8 2.20 3.80 1.20 0.80 0.55 4.00 0.80 4.002 3 4.

whereas CDS is used for the discretization of the diffusion term. 6. The comparison of the central difference and upwind difference schemes for the discretization of convection term is also discussed here. ® u) (6. 6. The FZ FZ central difference scheme (CDS) or the upwind difference scheme (UDS) can be used for the discretization of the convection term. 105 .1. ¬ u) (6. The first order and second order upwind schemes are described below.1.1 First Order Upwind Scheme When the fluid is flowing from left to right properties at grid point i depend only on the properties at grid point i  1 and when the fluid is flowing from right to left properties at grid point i depend only on the properties at grid point i + 1. Chapter 6 ConvectionDiffusion Problems The convection-diffusion equation for the transport of a component of concentration C is given by F% F % W &   FZ FZ F% F % In the above equation.1) K K FZ 'Z and for information propagated from right to left discretization of convection term at node i is given by F% %   % (® x.1 Upwind Schemes The upwind scheme is used for the discretization of the convection term. 6. This is nothing more than obeying the physics of the flow. For information propagated from left to right discretization of convection term at node i is given by F% %  %  (® x. W is the convection term and &  is the diffusion term.2) K K FZ 'Z This is shown in Fig.

we shall consider nodes near to a boundary (see Fig. ¬u) (6. Since upwind scheme is one- sided.3) K K K FZ  'Z and for information propagated from right to left.1.2). Assume that C can be expressed near the boundary by the polynomial C = a + bx + cx2 . 6. discretization of convection term at node i is given by F% %  %   %   (® x. (b) Direction of flow opposite to direction of space. discretization of convection term at node i is given by F% %  %   %   (® x.2 Second Order Upwind Scheme For information propagated from left to right. 6.4) K K K FZ  'Z Direction of flow The information has passed through node i  1 and then comes to node i F% %  %  K K FZ 'Z i2 i1 i i+1 i+2 i+3 (a) The information has passed through node i + 1 Direction of flow and then comes to node i F% %  %   K K FZ 'Z i2 i1 i i +1 i+2 i+3 (b) Fig. ® u) (6.1 Discretization of convection term using first order upwind method: (a) Direction of flow and space identical. Let us now derive the formula for second order upwind scheme.106 Introduction to Numerical Methods in Chemical Engineering 6.

then È % Ø %  %   %   K K K ÉÊ  ÙÚ  'Z Z K Oscillations do not take place when first order upwind scheme is used for discretization of convection term. . This is because D  EZ FZ FZ F% and at x = 0. This becomes the basis for second order upwind scheme È % Ø %  %   %   K K K ÉÊ  ÙÚ  'Z Z K Here information is propagated in the opposite direction as compared to the direction of x. At point 1 (x = 0) C1 = a At point 2 (x = Dx) C2 = a + bDx + cDx2 At point 3 (x = 2Dx) C3 = a + 2bDx + 4cDx2 Solving the above equations for b. = b. ConvectionDiffusion Problems 107 3 u Dx 2 Dx x 1 Boundary Fig. If information is propagated in the direction of x. 6. Therefore at point 1 FZ F% %  %  % FZ  'Z This is a one-sided finite difference expression for the derivative at the boundary.2 Nodes near boundary. we get %  %  % D  'Z F% F% We find b because it is equal to at the wall (at node 1).

6. at x = 0: C = C0 and at x = L: C = CL.3 One-dimensional space. the analytical solution for 0 £ x £ L is Z 2G . Calculate the distribution of C as a function of x for x = 0. C = 0 and at x = 1 m. u x =0 x =1 Fig.3. Make 50 parts between x = 0 and x = 1 m. Discretize the equation using (i) central difference scheme for both diffusion and convection terms and (ii) central difference scheme for diffusion term and first order upwind scheme for convection term.108 Introduction to Numerical Methods in Chemical Engineering EXAMPLE 6.84 to 1. For the boundary conditions. Compare the numerical results with the analytical solution.0. 6.1 A component C is transported by means of convection and diffusion through a one-dimensional space shown in Fig. Discretize the convectiondiffusion equation F% F % W &   FZ FZ The boundary conditions are: at x = 0 m. C = 1.

 . G  % Z.

 % . %  %.

G 2G    where Pe is the Peclet number. we get § %  %  · § %  %   % · W ¨  K K ¸  & ¨  ¸ K K K  ©  'Z ¹ © 'Z  ¹ 'Z  Multiplying by  . Take Pe 50 . and W. we get & W'Z %   %  . the ratio of strength of convection by strength of diffusion. is given by 2G . & Solution We have (i) Central difference scheme for both diffusion and convection terms Using central difference scheme (CDS) at node i.

 %   %   %  & K K K K K The local Peclet number is given by W 'Z 2G & NQE .

ConvectionDiffusion Problems 109 Thus the discretized equation at node i becomes  2G NQE   .

%   %  2G K  K NQE  .

6.4 Schematic diagram.02 m. The schematic diagram is shown in Fig. C = C0.%  K   Let B 2G NQE   and C 2G NQE  Thus  C %   %  B %  K K K  Let the total length be 1 m and let us make 50 parts of the length. At node 1  C %  %  B %  Since the value of C0 is known. therefore 'x 0. 6. At node 0. therefore the equation for node 49 becomes  C %   %   B %  Thus the set of equations for value of C at node 1 to 49 using central difference scheme for both the diffusion and convection terms becomes . therefore the equation at node 1 becomes %  B % C % At node 2  C %  %  B %  At node 3  C %  %  B %   At node 48  C %   %   B %   At node 49  C %   %   B %  At node 50 the value of C50 is known.4. 0 10 20 30 40 50 x=0 x = 1 C = C0 C = C50 Fig.

 and the local Peclet number becomes 2G  u   . (ii) Central difference scheme for diffusion term and upwind difference scheme for convection term Using the upwind difference scheme (UDS) for the convection term and the central difference scheme for the diffusion term at node i. the discretized equation at node i becomes &  2G  .1. Thus & & NQE aÿ = Peloc  2 = 1 and bÿ = Peloc + 2 = 3. bi (i = 1 to N) and ci (i = 1 to N  1) in Program 1. we get § %  %  · § %  %   % · W ¨ K K ¸  & ¨  K K ¸ K  © 'Z ¹ © 'Z  ¹ 'Z  On multiplying by  . The numerical and analytical results are shown in Table 6.1 given in the Appendix. The solution can be obtained by modifying the parameters ai (i = 2 to N).110 Introduction to Numerical Methods in Chemical Engineering ª  B º ª% º ª C % º « C  B » «% » «  » « »«  » « » « C  B » «% » «  » « »« » « » « C  B » «% » «  » « C  B » «% » «  » « »« » « » « C  B » «% » «  » «    » « » «  » « »« » « » «    » « » «  » « »« » « » «    » « » «  » «    » « » «  » « »« » « » « C  B » «% » «  » ¬««  C  »¼» «¬«% ¼»» «« B % »» ¬  ¼ W W 'Z For Pe = 50.

%   2G   .

02 m. At node 0. At node 1 H %   C %  %   Since the value of C0 is known. therefore Dx = 0. C = C0. %  %   NQE K  NQE K K  Let b = Peloc + 2 and g = Peloc + 1 Thus H %   C %  %  K K K  Let the total length be 1 m and let us make 50 parts of the length. therefore the equation at node 1 becomes C %  % H % At node 2 H %  C %  %  .

96 0. The solution can be obtained by modifying the parameters ai (i = 2 to N).018316 47 0. ConvectionDiffusion Problems 111 At node 3 H %  C %  %  At node 48 H %  C %   %   At node 49 H %  C %  %  At node 50 the value of C50 is known.86 0.111111 0.000912 44 0. bi (i = 1 to N) and ci (i = 1 to N  1) in Program 1.012346 0.367879 . therefore the equation for node 49 becomes H %   C %  % Thus the set of equations for value of C at node 1 to 49 using the central difference scheme for the diffusion term and the first order upwind scheme for the convection term becomes ª C  º ª% º ªH % º « H C  » «% » «  » « »«  » « » « H C  » «% » «  » « »« » « » « H C  » «% » «  » « H C  » «% » «  » « »« » « » « H C  » «% » «  » «    » « » «  » « »« » « » «    » « » «  » « » « » « » «    »« » «  » «    » « » «  » « »« » « » « H C » «% » «  » ««¬ H C »»¼ ««¬% »»¼ «« % »» ¬  ¼ W W 'Z For Pe = 50.002479 45 0.92 0.000152 0.003906 0.000457 0.1 G Z   Node number x (m) C (CDS) C (CDS/UDS) % (Analytical) G   42 0.1 Numerical and analytical results for Example 6.062500 0.004115 0.006738 46 0.500000 0. Thus & & NQE b = Peloc + 2 = 3 and g = Peloc + 1 = 2.000335 43 0.001372 0. The numerical and analytical results are shown in Table 6.049787 48 0.1.1 given in the Appendix.333333 0.94 0.037037 0.015625 0.90 0. Table 6.88 0.125000 0.  and the local Peclet number becomes 2G  u   .98 0.007813 0.250000 0.135335 49 0.84 0.031250 0.

whereas for Peloc > 2 the subdiagonals elements are negative. then for all local Peclet number greater than zero.000000 44 0.1 given in the Appendix. whereas. then more accurate results are obtained. The subdiagonal elements are negative. The solution can be obtained by modifying the parameters ai (i = 2 to N). The numerical results are shown in Table 6.000000 45 0.000006 46 0.84 0.88 0.090909 When the local Peclet number is much below 1.666667 0. The numerical results are shown in Table 6. When the central difference scheme is used for the discretization of both the diffusion and convection terms. & & NQE Thus a = Peloc  2 = 8 and b = Peloc + 2 = 12. (ii) Central difference scheme for diffusion term and upwind difference scheme for convection term W W 'Z For Pe = 500.  and the local Peclet number becomes 2G  u  .2 Numerical results for Example 6. bi (i = 1 to N) and ci (i =1 to N  1) in Program 1.131687 0.2.94 0.92 0.296296 0. diagonals are positive and superdiagonals are negative for Peloc < 2.087791 0.112 Introduction to Numerical Methods in Chemical Engineering The central difference scheme is a second order scheme and is therefore more accurate.2 Solve the previous problem for Pe = 500.  and the local Peclet number becomes 2G  u   .90 0. EXAMPLE 6. It is seen that when Peloc > 2. when UDS is used for discretization of the convection term. b > 0 but a changes sign at Peloc = 2.008264 49 0. The importance of first order upwind scheme is shown in the next example.86 0. diagonals are positive and superdiagonals are positive.2 Node number x (m) C (CDS) C (CDS/UDS) 42 0.1 given in the Appendix. then diffusion is dominant and when the local Peclet number is much above 1.2.058528 0.000060 47 0. then convection is dominant. But if more parts are made. then for all values .444444 0.000751 48 0. oscillations occur in the solution of CDS.96 0.98 0.000000 43 0. The solution can be obtained by modifying the parameters ai (i = 2 to N). bi (i = 1 to N) and ci (i = 1 to N  1) in Program 1. Solution We have (i) Central difference scheme for both diffusion and convection terms W W 'Z For Pe = 500. whereas upwind scheme used is first order and is therefore less accurate. Table 6.039018 0. & & NQE Thus b = Peloc + 2 = 12 and g = Peloc + 1 = 11.197531 0.

8) FZ FZ ©  'Z ¹ 7&5 %&5 F% F% § %  %   %  · ¨ K ¸ K K (6. or UDS can be used to avoid oscillations. 6. When first order method (UDS) is used.5) 'Z  'Z © 'Z  'Z ¸¹ Thus 7&5 %&5 F% F% § %  %  %   %  · ¨ K  K K K (6. diagonals are positive and superdiagonals are negative. Thus if oscillations occur when CDS is used.9) FZ FZ ©  'Z ¹ 7&5 %&5 F% F% 'Z § %  %   %  ·  K K K (6. we get 7&5 F% F % W &  (6.12) FZ FZ  .1)] 7&5 F% %  %  (6.7) FZ FZ ©  'Z  'Z ¸¹ 7&5 %&5 F% F% § %  %   %   %  · ¨ K K ¸ K K (6. Note that the sign of subdiagonal. oscillations do not occur.2 Comparison of CDS and UDS The upwind difference scheme at node i is given by [see Eq. diagonal and superdiagonal elements in UDS match that of CDS for Peloc < 2. then a larger number of parts can be made so that Dx becomes less and thus Peloc becomes less than 2.1) K K FZ 'Z The right hand side can be written as %  %  %   %  § %  %  %   %  · K K K ¨ K  K K K K (6.10) FZ FZ  ¨© 'Z  ¸ ¹ 7&5 %&5 F% F% 'Z F  %  (6.6) FZ FZ © 'Z  'Z ¸¹ 7&5 %&5 F% F% § %  %  %   %  · ¨ K  K K K (6. ConvectionDiffusion Problems 113 of Peloc the subdiagonal elements are negative.11) FZ FZ  FZ  Now consider the discretization of the convectiondiffusion equation F% F % W &   FZ FZ Using the UDS for the discretization of the convection term. (6.

114 Introduction to Numerical Methods in Chemical Engineering Substituting Eq.15)  W'Z 2G NQE Thus due to the addition of the numerical diffusion term. Compare the & § G Z   · numerical result with the analytical solution % Z .14)  and the effective local Peclet number is W'Z W'Z   2G NQEGHH & W'Z &  GHH &   (6. Exercises 6. W Make 10 parts between x = 0 and x = 1 m. whatever the value of the local Peclet number and thus oscillations do not occur when first order UDS is used.12). (6. we get %&5 § F% 'Z F  % · F % W ¨  ¸  &  ¨ FZ ©  FZ  ¸¹ FZ  %&5 F% W'Z F  % F % W   &  (6. C = 1 and at x = 1 m. the effective local Peclet number is always less than 2. (6. Discretize the convection-diffusion equation using the central difference scheme for both diffusion and convection terms. C = 0.1 A component of concentration C is transported by means of convection and diffusion through a one-dimensional space F% F % &  W FZ FZ The boundary conditions are: at at x = 0 m. The effective diffusion coefficient is W 'Z &GHH & (6.11) in Eq. Calculate the distribution of C as a function of x.13) FZ  FZ FZ  Thus UDS is equivalent to adding the additional numerical diffusion (or artificial diffusion) term to the CDS. Take  m1.

  ¨  ¸. © G  ¹ (Ans: The tridiagonal set of equations are ª   º ª% º ª º «   » « » « » «  » «% » « » «    » «  » « » « »« » « » «   » «% » « » «¬   ¼» ¬«% ¼» ¬«  ¼» .

962979 0.999966 0. Compare the numerical result with the & § G Z   · analytical solution % Z .987671 0.999560 0.950256 0.9 0. Make 10 parts between W x = 0 and x = 1 m.6 0.4 0.1 0.888904 0.1 x (m) C (numerical  CDS) C (analytical) 0.997567 0.3 0.8 0. Take  m1.7 0.999710 0. ConvectionDiffusion Problems 115 and the results are shown in Table 6.999865 0.3 Results of Exercise 6. Calculate the distribution of C as a function of x. C = 1 and at x = 1 m.864704 0. C = 0. Discretize the convection-diffusion equation using the central difference scheme for the diffusion term and the first order upwind difference scheme for the convection term.993307 0.981729 0.999922 0.998645 0.999133 0.3.5 0.2 A component of concentration C is transported by means of convection and diffusion through a one-dimensional space F% F % W &   FZ FZ The boundary conditions are: At x = 0 m.995902 0.2 0.632149 6.666678 0. Table 6.

999922 0.938417 0.750733 0.2 x (m) C (numerical  CDS/UDS) C (analytical) 0.7 0.981729 0.993307 0. Table 6.2 0.4 Results of Exercise 6.997567 0.3 0.4.9 0.993157 0.864704 0.997068 0. © G  ¹ (Ans: The tridiagonal set of equations are ª   º ª% º ª  º «    » «% » «  » « »« » « » «    » « » « » « »« » « » «   » «% » «  » «¬  »¼ «¬% »¼ «¬  »¼ and the results are shown in Table 6.5 0.999133 0.6 0.999710 0.   ¨  ¸.4 0.500489 0.985337 0.1 0.632149 .969697 0.875855 0.8 0.950256 0.999023 0.

Compare the numerical result with the & § G Z   · analytical solution % Z .1 for  m1. W 6.116 Introduction to Numerical Methods in Chemical Engineering Since the first order upwind is used for the discretization of the convection term.3 Solve Exercise 6. therefore more parts are a must for a better answer as the first order method is O(Dx).

999999 0.3 x (m) C (numerical  CDS) C (analytical) 0.9 1. therefore central difference gives a wrong answer.000000 0.5.999999 0. Table 6.999665 0.864665 In this problem the local Peclet number is 2.000000 0.000000 0.   ¨  ¸.2 1.5 1.5 Results of Exercise 6.4 Solve Exercise 6.3 1.000000 0.000000 0. © G  ¹ (Ans: The tridiagonal set of equations are ª   º ª% º ª º «    » «% » « » « »« » « » «    » « » « » « »« » « » «    » «% » « » «¬  »¼ «¬% »¼ «¬  »¼ and the results are shown in Table 6.6 1. W 6.000000 0.2 for  m1.999999 0.4 1.981684 0.7 1.8 1.0.999994 0.000000 0.000000 0.000000 0.997521 0.1 1. Compare the numerical result with the & § G Z   · analytical solution % Z .999955 0.

© G  ¹ (Ans: The tridiagonal set of equations are ª   º ª% º ª º «   » « » « » «  » «% » « » «    » « » « » « »« » « » «   » «% » « » «¬   ¼» ¬«% ¼» ¬«  ¼» .   ¨  ¸.

999865 0.999665 0.9 0.962979 0.8 0.995902 0.1 0.6 0. Compare the numerical result with the & § G Z   · analytical solution % Z .5 Solve Exercise 6.999999 0.6. W 6.999999 0.6 Results of Exercise 6.2 0. ConvectionDiffusion Problems 117 and the results are shown in Table 6.999560 0.666678 0.999955 0.4 0.981684 0.4 x (m) C (numerical  CDS/UDS) C (analytical) 0.987671 0.864665 Since the first order upwind method is used for the discretization of the convection term.999999 0.997521 0.998645 0.888904 0.1 for  m1.999966 0. Table 6.3 0. therefore more parts are a must for a better answer as the first order method is O(Dx).7 0.999994 0.5 0.

5 1.7 1.2 0.4 0.7.993262 .9 1.999071 1.966466 0.014670 1.999955 0.5 x (m) C (numerical  CDS) C (analytical) 0.816497 0.999999 0.000000 0.3 1.1 1.000000 0.8 0.078942 0.428870 0.7 Results of Exercise 6.000000 0. Table 6.002865 1.000697 1.6 0. © G  ¹ (Ans: The tridiagonal set of equations are ª   º ª% º ª  º «    » «% » « » « »« » « » «    » « » « » « »« » « » «   » «% » « » «¬   »¼ «¬% »¼ «¬  »¼ and the results are shown in Table 6.000000 0.999999 0.   ¨  ¸.994011 1.000000 0.

Compare the numerical result with the & § G Z   · analytical solution % Z .2 for  m1.0. therefore central difference gives oscillations.6 Solve Exercise 6. W 6.118 Introduction to Numerical Methods in Chemical Engineering In this problem the local Peclet number is greater than 2.

3 0.999872 1.2 1.993262 Since the first order upwind method is used for the discretization of convection term.000000 0. © G  ¹ (Ans: The tridiagonal set of equations are ª   º ª% º ª  º «    » «% » « » « »« » « » «    » « » « » « »« » « » «    » «% » « » «¬   »¼ «¬% »¼ «¬  »¼ and the results are shown in Table 6.999999 0.8.995371 0.1 1.8 Results of Exercise 6. Table 6.833334 0.972223 0.000000 1.6 x (m) C (numerical  CDS/UDS) C (analytical) 0.5 0.999955 0.9 0.6 0. therefore more parts are a must for a better answer as the first order method is O(Dx)).999997 1.000000 0.000000 1.000000 0. .999229 0.4 0.999979 1.000000 0.7 0.8 0.   ¨  ¸.000000 0.999999 0.

1.1 Boundary Value Problems in Chemical Reaction Engineering In tubular reactor with axial dispersion the boundary conditions are specified. 7. The boundary conditions and ordinary differential equations for the tubular reactor with axial dispersion are shown in Table 7. The solution of various single. Danckwerts boundary conditions are considered here. series and parallel reactions are discussed using the finite difference method in this chapter. When axial dispersion takes place in a tubular reactor. Table 7. One boundary condition is specified at the inlet and one at the exit of the tubular reactor. Chapter 7 Tubular Reactor with Axial Dispersion Plug flow reactors were discussed in Chapter 4.1 Boundary conditions and ODEs for tubular reactor with axial dispersion Boundary condition Boundary condition ODEs for plug at x = 0 at x = L flow reactor M #  o\$ F% # F% # F % # F% W% # KP W% #  &  &  W #  M% #   FZ FZ FZ  FZ F%\$ F%\$ F %\$ F%\$ W%\$ KP W% \$  &  & W  M% #  FZ FZ FZ  FZ  M M #  o \$  o% F% # F% # F % # F% W% # KP W% #  &  &   W #  M% #  FZ FZ FZ  FZ F%\$ F%\$ F %\$ F%\$ W%\$ KP W% \$  &  & W  M% #  M%\$  FZ FZ   FZ FZ F%% F%% F %% F% W%% KP W%%  &  &  W %  M%\$  FZ FZ  FZ  FZ #  \$  M o%  \$  % o & M  119 . for each species. then the problem becomes a boundary value problem and the differential equation becomes second order due to the addition of a diffusion term. Thus two conditions are required to completely define the problem.

7. Consider a differential section in this vessel (see Fig.3) © FZ ¹ and that leaving through dispersion ª F% F § F% · º = & «  ¨ ¸ FZ » # (7.2) FZ that leaving through convection § F% · = W¨%  FZ ¸ # (7.) F% # F% # F % # F% # W% # W% #  &  & W  M% #%\$   KP FZ FZ FZ  FZ F%\$ F%\$ F % \$ F% W%\$ W% \$  &  &  W \$  M% #% \$  M%\$%%   KP FZ FZ FZ  FZ F%% F%% W%% W%%  &  F %% F%%  KP FZ FZ & W  M% #%\$  M% \$%%  F%& FZ  FZ F%& W%& W%&  &  F % & F%  KP FZ FZ &  W &  M% \$%%   FZ FZ 7.1) that entering through dispersion F% = & # (7.120 Introduction to Numerical Methods in Chemical Engineering Table 7. the axial dispersion coefficient is D.1). The velocity of the fluid is u.4) ¬ FZ FZ © FZ ¹ ¼ Accumulation F% = #FZ (7. In this differential section the material entering through convection = uCA (7.5) FV .1 Tubular reactor and differential section.1 (Cont. the concentration of species is C and A is the cross-sectional area. 7. dx Fig.2 First Order Reaction Consider a tubular vessel in which axial dispersion occurs along with convection.

we get F % F% &  W  T .8) FV FZ FZ At steady state and if reaction also occurs in the tubular vessel.7) FV FZ FZ © FZ ¹ F% F % F% &  W (7.6) FV FZ © FZ ¹ ¬ FZ FZ © FZ ¹ ¼ F% F% F § F% · FZ W FZ  & ¨ ¸ FZ (7. Tubular Reactor with Axial Dispersion 121 We know that Input  Output = Accumulation. Thus F% F% § F% · ª F% F § F% · º #FZ W%#  & #  W¨%   FZ ¸ #  & «  ¨ ¸ FZ » # (7.

and the outlet boundary condition becomes . The boundary conditions proposed by Danckwerts are F% At inlet: W% W%  & (7. the flux is F% W%  & FZ Balancing these two fluxes at x = 0 yields the inlet boundary condition F% W% W%  & FZ KP If the reaction stops once the stream leaves the reactor. The differential equation for species A along the length of the tubular reactor of length 10 m is F % # F% # &  W  M% #  FZ FZ . the concentration profile becomes F% uniform. Use of a dispersion model changes the reactor analysis from an initial value problem to a boundary value problem. FZ EXAMPLE 7.11) FZ At the reactor inlet.  (7.1 Consider a reaction A ® B carried out in a tubular reactor.10) FZ KP F% At exit:  (7.9) FZ FZ C now refers to the concentration of the reactant or product. the flux entering is uCin but once inside the reactor and in the presence of dispersion. r is a net positive quantity if C refers to a reactant and negative if C refers to a product.

Make 50. 7. The axial dispersion coefficient. Discretizing the differential equation at node i. CA. Z Z Fig.2 Example 7. we get §%  %   % · §% % · & ¨ # K #K #K ¸  W¨ #K #K  ¸  M%  'Z  'Z #K © ¹ © ¹ At node 1 § %  % #   % # · § % #  % # · & ¨ #  ¸  W¨ ¸  M% #  © 'Z ¹ © 'Z ¹ § & W · & § & W · % # ¨     M ¸   % #   % # ¨   ¸  © 'Z ' Z ¹ 'Z © 'Z ' Z¹ From the boundary condition at node 1. Solution We have Concentration profile for 50 parts 50 parts of the reactor are made as shown in Fig.2.  'Z  m  We solve the differential equation using upwind difference scheme for convection term. The inlet concentration.in = 1 mol/m3. we get § %  % # · W% #KP W% #  & ¨ #  ¸ ©  'Z ¹ . and 10 parts of the reactor and determine the concentration of A at various nodes along the length of the tubular reactor. 7.1.122 Introduction to Numerical Methods in Chemical Engineering The boundary conditions are F% # At x = 0 (inlet): W% # W% #  & FZ KP F% # At x = 10 m (exit):  FZ A fluid medium comprising initially only A flows through the reactor with a mean axial velocity u = 1 m/s. D = 104 m2/s and rate constant of the reaction is 1 s1. 20.

Tubular Reactor with Axial Dispersion 123 Solving for CA0 we get  W 'Z % # & % #KP  % # .

 % # Substituting for CA0 in the equation for node 1. we get § & W · & § & W · ª  W 'Z % # ¨    ' Z  M ¸   % #   ¨   'Z ¸« & % #KP  % # .

 % # »º  © 'Z ¹ 'Z © 'Z ¹¬ ¼ §  & W W  · § & W · §  W  W · ¨¨    M  ¸¸ % #  ¨   % # ¨  ¸ % #KP Z ¸¹ ¨ & 'Z ¸¹   © 'Z 'Z & ¹ © 'Z ' © At node 2 § & W · § & W · & ¨   ¸ % #  ¨     M ¸ % #   % #  © 'Z 'Z ¹ © 'Z 'Z ¹ 'Z At node 3 § & W · § & W · & ¨   ¸ % #  ¨     M ¸ % #   % #   © 'Z 'Z ¹ © 'Z 'Z ¹ 'Z At node 51 § & W · § & W · & ¨   ¸ % #   ¨     M ¸ % #   % #  © 'Z ' Z ¹ © 'Z 'Z ¹ 'Z From the boundary condition at node 51. we get § % #   % #  · ¨ ¸  thus CA52 = CA50 ©  'Z ¹ Substituting for CA52 in the equation for node 51. we get § & W · § & W · ¨   ¸ % #   ¨     M ¸ % #  © 'Z 'Z ¹ © 'Z 'Z ¹ The coefficients of equation 1 (at node 1) are & W W  u     Coefficient of % #     M           'Z 'Z &    & W  u    Coefficient of % #      'Z 'Z   § W W ·   Right hand side of equation 1 =  ¨ ¨ &  'Z ¸¸ % # KP         © ¹ .

The coefficients of equation 3 (at node 3) are & W    Coefficient of % #      'Z 'Z   & W  u    Coefficient of % #     M        'Z 'Z   &   Coefficient of % #  'Z   Right hand side of equation 3 = 0. ª   º ª% # º ª  º «    » «% » «  »» « » « # » « «    » « » « » « »« » « » «   » «% #  » « » ¬«   »¼ ¬«% #  ¼» «¬  »¼ .1 given in the Appendix.124 Introduction to Numerical Methods in Chemical Engineering The coefficients of equation 2 (at node 2) are & W    Coefficient of % #      'Z 'Z   & W  u    Coefficient of % #     M        'Z 'Z   &   Coefficient of % #  'Z   Right hand side of equation 2 = 0. bi (i = 1 to N) and ci (i = 1 to N  1) in Program 1. The solution can be obtained by modifying the parameters ai (i = 2 to N). The coefficients of equation 51 (at node 51) are & W  u    Coefficient of % #      'Z 'Z   & W  u    Coefficient of % #     M        'Z 'Z   Right hand side of equation 51 = 0. The above equations can be written in tridiagonal form as given below.

999908 2 0.8 0. Tubular Reactor with Axial Dispersion 125 The solution using TDMA is presented in Table 7.8 0.6 0.482236 6 1.6 0.6 0.2. Concentration profile for 20 parts  If 20 parts of the reactor are made.026089 22 4.193813 11 2.8 0.112165 14 2.334895 8 1.054095 18 3. then 'Z  m.161513 12 2.0 0.0 0.401869 7 1.031306 21 4.000110 More conversion would have occurred if the reactor is assumed to be ideal plug flow.6 0.4 0.077895 16 3.021741 23 4.8 0.093472 15 2.037567 20 3.578675 5 0.045080 19 3.279083 9 1.2 0. The coefficients of equation 1 (at node 1) are & W W Coefficient of % #    M  'Z  'Z &  u                 & W  u    Coefficient of % #      'Z 'Z   § W W ·   Right hand side of equation 1 =  ¨ ¨ &  'Z ¸¸ % # KP         © ¹ .694400 4 0.2 0.2 0.134596 13 2.2 0.2 0. The coefficients of the 21 equations  at 21 nodes are as given below.0 0.4 0.4 0.833268 3 0.4 0.232573 10 1.2 Results for concentration profile for 50 parts Node number x (m) CA 1 0.0 0. Table 7.018118 51 10.0 0.4 0.0 0.064913 17 3.

1 given in the Appendix. bi (i = 1 to N) and ci (i = 1 to N  1) in Program 1.3. .126 Introduction to Numerical Methods in Chemical Engineering The coefficients of equation 2 (at node 2) are & W    Coefficient of % #      'Z 'Z   & W  u    Coefficient of % #     M        'Z 'Z   &   Coefficient of % #  'Z   Right hand side of equation 2 = 0. The results are presented in Table 7. The coefficients of equation 3 (at node 3) are & W    Coefficient of % #     'Z   'Z  & W  u    Coefficient of % #     M       'Z 'Z   &   Coefficient of % #   'Z   Right hand side of equation 3 = 0. The above equations can be written in tridiagonal form as given below: ª   º ª% # º ª  º « »« » «  »» «    » «% #  » « «    » « » « » « »« » « » «    » «% #  » « » «¬   »¼ «¬% #  »¼ «¬  »¼ The solution can be obtained by modifying the parameters ai (i = 2 to N). The coefficients of equation 21 (at node 21) are & W  u    Coefficient of % #      'Z 'Z   & W  u    Coefficient of % #     M        'Z 'Z   Right hand side of equation 21 = 0.

017300 13 6.0 0.0 0.0 0. The coefficients of the 11 equations  at 11 nodes are as given below.0 0. The coefficients of equation 3 (at node 3) are & W    Coefficient of % #      'Z 'Z   .0 0.0 0.003400 17 8.197500 7 3.0 0. then 'Z  m.0 0.3 Results for concentration profile for 20 parts Node number x (m) CA 1 0.007700 15 7.444400 5 2.001500 19 9.0 0.999917 3 1.0 0.0 0.000677 21 10.000301 Concentration profile for 10 parts  If 10 parts of the reactor are made.087800 9 4. The coefficients of equation 1 (at node 1) are & W W  u     Coefficient of % #    M           'Z &   'Z   & W  u    Coefficient of % #     'Z   'Z  § W W ·   Right hand side of equation 1 =  ¨ ¨ &  'Z ¸¸ % # KP         © ¹ The coefficients of equation 2 (at node 2) are & W    Coefficient of % #      'Z 'Z   Coefficient of % # & W  u        M       'Z 'Z   &   Coefficient of % #  'Z   Right hand side of equation 2 = 0.039000 11 5. Tubular Reactor with Axial Dispersion 127 Table 7.

0 0. ª   º ª% # º ª  º « »« » «  »» «    » «% #  » « «    » « » « » « »« » « » «    » «% # » « » «¬   »¼ «¬% # »¼ «¬  »¼ The solution can be obtained by modifying the parameters ai (i = 2 to N).0 0.1 given in the Appendix.999925 2 1.0 0. Table 7. The results are presented in Table 7.0 0.4.0 0.031252 7 6.062502 6 5.000977 .0 0.125000 5 4.0 0.0 0.499975 3 2. The above equations can be written in tridiagonal form as given below.0 0.128 Introduction to Numerical Methods in Chemical Engineering & W  u    Coefficient of % #     M       'Z 'Z   &   Coefficient of % #  'Z   Right hand side of equation 3 = 0.015626 8 7. bi (i = 1 to N) and ci (i = 1 to N  1) in Program 1.001953 11 10.003907 10 9.007813 9 8.0 0.249994 4 3.4 Results for concentration profile for 10 parts Node number x (m) CA 1 0.0 0. The coefficients of equation 11 (at node 11) are & W  u    Coefficient of % #      'Z 'Z   & W  u    Coefficient of % #     M        'Z 'Z   Right hand side of equation 11 = 0.

2 Consider a reaction A ® B carried out in a tubular reactor. EXAMPLE 7. 'Z  m. The axial dispersion coefficient. Make 20 parts of the reactor and determine the concentration of A at various nodes along the length of the tubular reactor.  Solution Since 20 parts of the reactor are made. D = 104 m2/s and rate constant of the reaction is 1 m3/mol-s. The coefficients of the 21  equations at 21 nodes are as given below.3 Second Order Reaction Consider a tubular reactor with axial dispersion in which second order reaction takes place.in =1 mol/m3. The inlet concentration CA. The differential equation for species A along the length of the tubular reactor of length 10 m is F % # F% # &  W  M% #  FZ FZ The boundary conditions are F% # At x = 0 (inlet): W% # W% #  & FZ KP F% # At x = 10 m (exit):  FZ A fluid medium comprising initially only A flows through the reactor with a mean axial velocity u = 1 m/s. Tubular Reactor with Axial Dispersion 129 7. The coefficients of equation 1 (at node 1) are & W W Coefficient of % #    M% #  'Z  'Z &  u         % #     % #    & W  u    Coefficient of % #      'Z 'Z   § W W ·   Right hand side of equation 1 =  ¨ ¨ &  'Z ¸¸ % # KP         © ¹ The coefficients of equation 2 (at node 2) are & W    Coefficient of % #      'Z 'Z   . The analysis is described with an example.

these values are used to determine the coefficients in the matrix. The coefficients of equation 21 (at node 21) are & W  u    Coefficient of % #      'Z 'Z   & W  u    Coefficient of % #     M% #     % #    % # 'Z 'Z   Right hand side of equation 21 = 0. The coefficients of equation 3 (at node 3) are & W    Coefficient of % #      'Z 'Z   & W  u    Coefficient of % #     M% #     % #    % # 'Z 'Z   &   Coefficient of % #  'Z   Right hand side of equation 3 = 0.1 for the solution of the above problem is given in the Appendix. and after the coefficients are determined the TDMA is used to determine new values of concentration of A at nodes 1 to 21. Again. The above equations can be written in tridiagonal form as given below. The results are presented in Table 7. .5.130 Introduction to Numerical Methods in Chemical Engineering & W  u    Coefficient of % #     M% #     % #    % # 'Z 'Z   &   Coefficient of % #  'Z   Right hand side of equation 2 = 0. The procedure is repeated till there is no change in the concentration at each node. In the program the initial values of concentration of A at nodes 1 to 21 is assumed and then the TDMA is used to determine new values of concentration of A at nodes 1 to 21. ª   % #  º ª% # º ª  º « » «% » « «    % #  » « # » » « » «    » « » « » « » «% » « «    % #  » « # » » « » «¬    % # »¼ «¬% # »¼ «¬  »¼ Program 7.

Tubular Reactor with Axial Dispersion 131 Table 7.0 0. the concentration of various species along the length of the reactor are given by the following differential equations: for component A F % # F% # &  W  M% #%\$  FZ FZ for component B F % \$ F%\$ &  W  M% #%\$  M%\$%%  FZ FZ for component C F %% F%% &  W  M% #%\$  M%\$%%  FZ FZ for component D F % & F%& &  W  M%\$%%  FZ FZ .124379 19 9.387587 7 3.999923 3 1.0 0.0 0.5 Results in Example 7.3 Consider the following two reactions taking place in a tubular reactor with axial dispersion: M #  \$  o% M \$  %  o& Assuming the axial dispersion coefficient to be the same for all the species.290241 9 4.0 0.2 Node number x (m) CA 1 0.230588 11 5.0 0.0 0.4 Multiple Reactions Consider a tubular reactor with axial dispersion in which multiple reactions takes place.569732 5 2.0 0.111286 21 10.0 0.190624 13 6.0 0. EXAMPLE 7.0 0. The analysis is described with an example.140841 17 8.162124 15 7.0 0.100638 7.

D = 104 m2/s. The axial dispersion coefficient is the same for all the species. we get for species A §%  %   % · §% % · & ¨ #  K #K #K ¸  W¨ #K #K  ¸  M% %  'Z  'Z #K \$K © ¹ © ¹ for species B §%  %   % · §% % · & ¨ \$  K  \$K ¸  W¨ \$K \$K \$K  ¸  M% %  M% %  'Z #K \$K \$K %K © 'Z ¹ © ¹ for species C §%  %%K   %%K · § %%K  %%K  · & ¨ %K   ¸  W¨ ¸  M% #K % \$K  M% \$K %%K  © 'Z ¹ © 'Z ¹ for species D §%  %   % · §% % · & ¨ &  K &K &K ¸  W¨ &K &K  ¸  M% %  'Z  'Z \$K %K © ¹ © ¹ . The inlet concentrations of A and B are CA. Compute the concentration of various species along the length of the reactor.in = CB. Solution We have  'Z  m  We solve the differential equation using the upwind difference scheme for the convection term. Discretizing the differential equation at node i.in = 1 mol/m3.132 Introduction to Numerical Methods in Chemical Engineering The boundary conditions are F% # W% # W% #  & FZ KP F% \$ W% \$ W% \$  & FZ KP F%% At inlet: W%% W%%  & FZ KP F% & W% & W% &  & FZ KP F% # F%\$ F%% F%& At exit:    CPF  FZ FZ FZ FZ Make 20 parts of the reactor of length 10 m. A fluid medium comprising initially only A and B flows through the reactor with a mean axial velocity u = 1 m/s. and the rate constants of the reactions are k1 = k2 = 1 m3/mol-s.

Tubular Reactor with Axial Dispersion 133 At node 1 the discretized equation for the component A is § %  % #  % # · § % #  % # · & ¨ #  ¸  W¨ ¸  M% #% \$  © 'Z ¹ © 'Z ¹ § & W · & § & W · % # ¨     M% \$ ¸   % #   % #  ¨   ¸  © ' Z ' Z ¹ ' Z © ' Z ' Z¹ From the boundary condition at node 1. we get § %  % # · W% #KP W% #  & ¨ #  ¸ ©  'Z ¹ Solving for CA0. we get  W 'Z % # & % #KP  % # .

 % # Substituting for CA0 in the equation for node 1. we get § & W · & § & W · ª W 'Z º % # ¨    'Z  M% \$ ¸   % #   ¨   ¸« 'Z ¹ ¬ & % #KP  % # .

we get W 'Z %\$ & %\$KP  %\$ . we get § %  %\$ · W%\$KP W%\$  & ¨ \$  ¸ ©  'Z ¹ Solving for CB0.  % # »  © 'Z ¹ 'Z © 'Z ¼ §  & W W · § & W · § W W · ¨¨     M%\$  ¸¸ % #  ¨   % # ¨  ¸ % #KP © 'Z ' Z & ¹ © 'Z 'Z ¸¹ ¨ & © 'Z ¸¹ At node 1 the discretized equation for component B is § %  % \$   %\$ · § % \$  %\$ · & ¨ \$  ¸  W¨ ¸  M% #%\$  M% \$%%  © 'Z ¹ © 'Z ¹ § & W · & § & W · % \$ ¨     M% #  M%% ¸   % \$  % \$ ¨   ¸  © 'Z 'Z ¹ 'Z © 'Z 'Z ¹ From the boundary condition at node 1.

 %\$ Substituting for CB0 in the equation for node 1. we get § & W · & § & W · ª W 'Z º % \$ ¨    'Z  M% #  M%%  ¸   % \$   ¨   ¸« 'Z ¹ ¬ & % \$KP  % \$ .

 %\$  »  © 'Z ¹ 'Z © 'Z ¼ §  & W W · § & W · § W W · ¨¨     M% #  M%%  ¸¸ %\$  ¨   %\$  ¨  ¸ %\$KP © 'Z 'Z & ¹ © 'Z 'Z ¸¹ ¨ & © 'Z ¸¹ .

we get W'Z%% %%    %%  & Substituting for CC0. we get § & W · & § & W · § W 'Z% & · % & ¨    ¸   %&  ¨   ¸¨   %&  ¸  M% \$%% © 'Z 'Z ¹ 'Z © 'Z 'Z ¹ © & ¹ §  & W W · § & W ·    ¸ %&  ¨   %&   M%\$%% ¨¨ 'Z  'Z ¸ & ¹ © 'Z 'Z ¸¹ © . in the equation for node 1.134 Introduction to Numerical Methods in Chemical Engineering At node 1 the discretized equation for component C is § %  %%   %% · § %%  %%  · & ¨ %  ¸  W¨ ¸  M% #% \$  M% \$%%  © 'Z ¹ © 'Z ¹ § & W · & § & W · %% ¨     M % \$ ¸   %%   %%  ¨   ¸  M% #%\$ © ' Z ' Z ¹ ' Z © ' Z ' Z¹ From the boundary condition at node 1. we get W 'Z% & %&   %& & Substituting for CD0. we get § %  %& ·  W% &  & ¨ &  ¸ ©  'Z ¹ Solving for CD0. we get § %  %%  ·  W%%  & ¨ %  ¸ ©  'Z ¹ Solving for CC0. in the equation for node 1. we get § & W · & § & W · § W 'Z%% · %% ¨     M% \$ ¸   %%   ¨   ¸¨   %%  ¸  M% #% \$ © 'Z 'Z ¹ 'Z © 'Z 'Z ¹© & ¹ §  & W W  · § & W · ¨¨     M%\$  ¸¸ %%  ¨   ¸ %%   M% #%\$ © 'Z 'Z & ¹ © 'Z 'Z ¹ At node 1 the discretized equation for component D is § %  %&   % & · § %&  %&  · & ¨ &  ¸  W¨ ¸  M %\$%%  © 'Z ¹ © 'Z ¹ § & W · & § & W · % & ¨    ¸   % &   %&  ¨   ¸  M%\$%%  © 'Z ' Z ¹ 'Z © 'Z ' Z¹ From the boundary condition at node 1.

we get § & W · § & W · ¨   ¸ %%   ¨     M%\$ ¸ %%   M% #% \$ © 'Z 'Z ¹ © 'Z 'Z ¹ At node 21 the discretized equation for component D is § & W · § & W · & ¨   ¸ % &   ¨    ¸ % &    % &   M% \$ %%  © 'Z 'Z ¹ © 'Z 'Z ¹ 'Z From the boundary condition at node 21. species B) are Coefficient of CA1 = 0  u     Coefficient of CB1 =     % #  %%      % #  %%    Coefficient of CC1 = 0 Coefficient of CD1 = 0 Coefficient of CA2 = 0 . we get § %&   %&  · thus CD22 = CD20 ¨ ¸  ©  'Z ¹ Substituting for C D 22 in the equation for node 21.136 Introduction to Numerical Methods in Chemical Engineering Substituting for CC22 in the equation for node 21. we get § & W · § & W · ¨   ¸ % &   ¨    ¸ % &   M% \$%%  © 'Z 'Z ¹ © 'Z 'Z ¹ The coefficients of equation 1 (node 1. species A) are  u     Coefficient of % #     %\$      %\$    Coefficient of CB1 = 0 Coefficient of CC1 = 0 Coefficient of CD1 = 0  u    Coefficient of % #      Coefficient of CB2 = 0 Coefficient of CC2 = 0 Coefficient of CD2 = 0 § W W ·   Right hand side of equation 1 =  ¨¨  ¸%#      © & 'Z ¸¹   KP  The coefficients of equation 2 (node 1.

species C) are: Coefficient of CA1 = 0 Coefficient of CB1 = 0  u     Coefficient of CC1 =     %\$      %\$    Coefficient of CD1 = 0 Coefficient of CA2 = 0 Coefficient of CB2 = 0  u    Coefficient of CC2 =      Coefficient of CD2 = 0 Right hand side of equation 3 = CA1CB1. species A) are:    Coefficient of % #      . Tubular Reactor with Axial Dispersion 137  u    Coefficient of %\$      Coefficient of CC2 = 0 Coefficient of CD2 = 0 § W W ·   Right hand side of equation 2 =  ¨ ¨ &  'Z ¸¸ %\$ KP         © ¹ The coefficients of equation 3 (node 1. The coefficients of equation 5 (node 2. The coefficients of equation 4 (node 1. species D) are: Coefficient of CA1 = 0 Coefficient of CB1 = 0 Coefficient of CC1 = 0  u     Coefficient of %&           Coefficient of CA2 = 0 Coefficient of CB2 = 0 Coefficient of CC2 = 0  u   Coefficient of %&      Right hand side of equation 4 = CB1CC1.

The coefficients of equation 6 (node 2. species C) are: Coefficient of CA1 = 0 Coefficient of CB1 = 0    Coefficient of %%      . species B) are: Coefficient of CA1 = 0    Coefficient of %\$      Coefficient of CC1 =0 Coefficient of CD1 =0 Coefficient of CA2 =0  u    Coefficient of %\$     % #  %%     % #  %%    Coefficient of CC2 = 0 Coefficient of CD2 = 0 Coefficient of CA3 = 0   Coefficient of %\$   Coefficient of CC3 = 0 Coefficient of CD3 = 0 Right hand side of equation 6 = 0. The coefficients of equation 7 (node 2.138 Introduction to Numerical Methods in Chemical Engineering Coefficient of CB1 = 0 Coefficient of CC1 = 0 Coefficient of CD1 = 0  u    Coefficient of % #     %\$     %\$   Coefficient of CB2 = 0 Coefficient of CC2 = 0 Coefficient of CD2 = 0   Coefficient of % #   Coefficient of CB3 = 0 Coefficient of CC3 = 0 Coefficient of CD3 = 0 Right hand side of equation 5 = 0.

species A) are:  u    Coefficient of % #      Coefficient of CB20 = 0 Coefficient of CC20 = 0 Coefficient of CD20 = 0 . species D) are: Coefficient of CA1 = 0 Coefficient of CB1 = 0 Coefficient of CC1 = 0    Coefficient of %&      Coefficient of CA2 =0 Coefficient of CB2 =0 Coefficient of CC2 =0  u    Coefficient of %&        Coefficient of CA3 = 0 Coefficient of CB3 = 0 Coefficient of CC3 = 0   Coefficient of %&   Right hand side of equation 8 = CB2CC2. Tubular Reactor with Axial Dispersion 139 Coefficient of CD1 = 0 Coefficient of CA2 = 0 Coefficient of CB2 = 0  u    Coefficient of %%      %\$    %\$    Coefficient of CD2 = 0 Coefficient of CA3 = 0 Coefficient of CB3 = 0   Coefficient of %%    Coefficient of CD3 = 0 Right hand side of equation 7 = CA2CB2 The coefficients of equation 8 (node 2. The coefficients of equation 81 (node 21.

species B) are: Coefficient of CA20 = 0  u    Coefficient of %\$      Coefficient of CC20 = 0 Coefficient of CD20 = 0 Coefficient of CA21 = 0  u    Coefficient of %\$     % #  %%     % #  %%    Coefficient of CC21 = 0 Coefficient of CD21 = 0 Right hand side of equation 82 = 0. The coefficients of equation 84 (node 21. species D) are: Coefficient of CA20 = 0 Coefficient of CB20 = 0 Coefficient of CC20 = 0 . species C) are: Coefficient of CA20 = 0 Coefficient of CB20 = 0  u    Coefficient of %%       Coefficient of CD20 = 0 Coefficient of CA21 = 0 Coefficient of CB21 = 0  u    Coefficient of %%      %\$    %\$   Coefficient of CD21 = 0 Right hand side of equation 83 = CA21CB21.140 Introduction to Numerical Methods in Chemical Engineering  u    Coefficient of % #     %\$    %\$   Coefficient of CB21 = 0 Coefficient of CC21 = 0 Coefficient of CD21 = 0 Right hand side of equation 81 = 0. The coefficients of equation 83 (node 21. The coefficients of equation 82 (node 21.

B. C. Thus the set of equations for concentration of species A. and D at nodes 1 to 21 can be written in the block tridiagonal form as ª \$ % º ª : º ª & º «# \$ % » «: » «& » «  »«  » «  » « # \$ % » « : » « & » « »« » « » « # \$ % » « : » « & » « # \$ % » «: » « & » « »«  » « » « # \$ % » « : » « & » «    » « » « » « »« » « » «    » « » « » « »« » « » «    » « » « » «    » « » « » « »« » « » « # \$ % » « :  » « & » « # \$ »¼» ¬«« :  ¼»» «« & »» ¬« ¬  ¼ where ª% # º ª% # º ª% # º «% » «% » «% » : « \$ » : « \$ » :  « \$ » «%% » «%%  » «%%  » « » « » « » ¬«%& ¼» ¬«%&  ¼» ¬«%&  ¼» For node 1 ª   %\$    º «    % #  %%   » \$ « » «     % \$  » « » ¬«     ¼» . Tubular Reactor with Axial Dispersion 141  u    Coefficient of %&       Coefficient of CA21 = 0 Coefficient of CB21 = 0 Coefficient of CC21 = 0  u    Coefficient of %&        Right hand side of equation 84 = CB21CC21.

142 Introduction to Numerical Methods in Chemical Engineering ª     º «     »» % « «     » « » ¬«    ¼» ª  º «  » & « » « % #%\$ » « » «¬ %\$%% »¼ For node 2 ª     º «     »» # « «     » « » ¬«     ¼» ª   % \$     º «    % #   %%    » \$ « » «     % \$   » « » ¬«    ¼» ª    º «     » % « » «     » « » «¬     »¼ ª  º «  » & « » « % #%\$ » « » «¬ %\$%%  »¼ For node 3 ª     º «     »» # « «     » « » «¬     »¼ ª   % \$    º «    % #  %%    » \$ « » «     % \$  » « » «¬    »¼ .

A(10.16) = 0.0008.0008CA4CC4. A(2.13) = . A(7. A(17.0004.0004. A(9.17) = 0. A(14.0008.0008CB4.11) = 2. A(13.8) = 2. A(8. A(11. A(5.0008CA2CC2.0004.5) = 2.14) = 2. A(16.5) = 2. A(6.11) = 2.12) = 2.0008CB3.18) = 0. A(10.10) = 2.0004. A(5.5) = 2. A(7.0004.0004.6) = 2.0004.9992CB1. where A is a 84 ´ 84 matrix.0004. A(15.9992CB1.0004.15) = 2.0004. A(13.0004. A(9. A(1. A(9. A(10. A(14.0004. A(16.0008CB2.2) = 2. A(5.0004.11) = 0. A(11.8) = 2.7) = 2.1) = 2. A(16.0004.16) = 2.0004. A(15.4) = 20005. A(6.1) = 20005.0008.0008CB4. A(8.0008. A(12. A(15.0004.9992.3) = 20005. A(6. A(2.0004.10) = 2.9992CA1CC1.6) = 2.0008.8) = 2.0008CB3. A(13. A(12.0008CA3CC3.0004.3) = 2. A(11.9) = 0.0004.15) = 0.13) = 0.0004.0008CB2. A(7.0008 A(3. The variables can be written as 6 Z >% # %\$ %% %&     % # %\$ %%  %&  @ The Gauss elimination method can be used to solve these 84 linear algebraic equations. A(8.19) = 0. Tubular Reactor with Axial Dispersion 143 ª     º «     »» % « «     » « » «¬     »¼ ª  º «  » & « » « % #%\$ » « » «¬ %\$%%  »¼ For node 21 ª    º «     »» # « «     » « » «¬    »¼ ª   %\$    º «    % #  %%    »» \$ « «     %\$  » « » «¬    »¼ ª  º «  » & « » « % #%\$ » « » «¬ %\$%%  »¼ The 84 linear algebraic equations can be written in the form Ax = d. A(4.0004. A(4.13) = 2.0008.4) = 2.2) = 20005.12) = 2.9) = 2.6) = 2. and d is also a vector of size 84 ´ 1. A(12.9) = 2.10) = 0. x is the vector of size 84 ´ 1 containing the variables to be determined. The non-zero elements of the matrix A are A(1.14) = 0.0004. A(3.0004. A(14.20) = 0.7) = 2.7) = 2.12) = 0.0004.

36) = 2. A(63. A(59. A(30.0004.0004. A(61.51) = 0. A(50. A(69.0004.0004.0008CB12.0004. A(42.0004.47) = 2. A(34. A(71.50) = 0. A(60.0004.69) = 2. A(19.29) = 2. A(25.0004.38) = 2. A(78.0008CB9.0004.68) = 0. A(40.0008CB9.28) = 2. A(74.0004. A(53.43) = 2.52) = 0.72) = 2. A(34.23) = 0.77) = 2.42) = 0.71) = 2. A(31.40) = 2.0008CB11.63) = 2.0008 CA5CC5.0004.66) = 0. A(48.45) = 0.0004.38) = 2.28) = 0.0004.0008CA19CC19.61) = 2. A(17.0004.25) = 0.51) = 2. A(39.69) = 0. A(29.60) = 2. A(42. A(49. A(45.0004.0008 CA15CC15. A(49.0008CB14. A(36. A(71.15) = 2.0004. A(66.35) = 0. A(23. A(56. A(44. A(68. A(79.68) = 2.0004. A(40. A(44.0004.22) = 2.0004.0004.48) = 2.62) = 0.0008CB15. A(39.19) = 2. A(71.55) = 0.20) = 2.0004.34) = 2.56) = 2.0008CB20.0008CA10 CC10. A(72.0004. A(68.0004.0008. A(52.0004.77) = .0008CA8CC8.23) = 2.75) = 2. A(41. A(48.0004. A(72.0004. A(21. A(55.0004.73) = 2.0004. A(66.0008.0004. A(22.0008CB11.64) = 0.0004.0004.0004.0004.0008CA17CC17.0004. A(73.0008CB19.0004. A(70. A(41.0004.0008CB13.0004.31) = 2. A(60.0008CA7CC7. A(26.0008CB10.0004.0008.0004.0004.0004. A(24.0004.38) = 0. A(67. A(53.0004.0008CB15. A(64. A(46.21) = 2.0004.0008. A(63. A(38.30) = 0.0004. A(20.0004.62) = 2.0004. A(80.0004.0008CB18.21) = 2.17) = 2. A(70.0004. A(68.72) = 2.72) = 0.26) = 0. A(47. A(40.59) = 2.0004.58) = 2. A(28.0008CB13.48) = 2.74) = 0.26) = 2.76) = 2. A(54.69) = 2.75) = 2. A(74.80) = 0. A(19.0004. A(26.0004.0004.0008.0004. A(61.0004.0004.0004. A(51. A(69.0004. A(49.0004.40) = 0.0004. A(69.28) = 2.0004.78) = 0.83) = 0. A(51.70) = 0.32) = 2.61) = 2.0004. A(64. A(50.0008CB16.0004. A(43.66) = 2.57) = 2.0008CA16 CC16. A(80.16) = 2.31) = 2. A(24. A(78.41) = 0. A(65.53) = 0.0008CB7.19) = 2.43) = 2.37) = 2.0008CB5.0004. A(27.0004.0008CA18CC18.78) = 2.0004.0004. A(51.0008. A(30. A(57. A(20.32) = 0.70) = 2.0008CB6.0004.0004.54) = 2. A(75. A(62. A(38.0004. A(46.47) = 0.33) = 0.79) = 2.23) = 2. A(21. A(22. A(73. A(50.29) = 0.54) = 0. A(27.20) = 2.47) = 2.22) = 0. A(67.0004.25) = 2.0004.0004. A(41.41) = 2.0004.0008.0004.0004.0004.0004.0008. A(44.52) = 2.54) = 2.59) = 2. A(57. A(75.22) = 2. A(58.33) = 2. A(35. A(67.40) = 2. A(32.26) = 2.0004.0004. A(31. A(64. A(77. A(23.0008. A(33. A(27. A(58. A(56.0008CB8.0004.61) = 0. A(66.0008.70) = 2.0008CB8. A(20.0008CB7.0008CB16. A(79.17) = 2.37) = 0.34) = 2.0004.27) = 2.25) = 2.0008CA11CC11.0008CA20CC20. A(25.24) = 2.0004.0008CB6. A(62.44) = 2.0004. A(28.56) = 2.55) = 2.0008CB18. A(74.0004.60) = 0.73) = 2.71) = 2. A(78.144 Introduction to Numerical Methods in Chemical Engineering 2.0004.58) = 0. A(48. A(37. A(36.42) = 2. A(39.64) = 2. A(57.0004.0004.0004. A(65.0008CA6CC6.45) = 2.0008CA12CC12.55) = 2.71) = 0. A(73.48) = 0. A(59.65) = 2.31) = 0. A(18.0004. A(61.0004. A(29.0004.0004.44) = 0.0004. A(75. A(59.0008.0004. A(42. A(36.0004.0004.0004. A(45. A(77.0004.0004.56) = 0.36) = 0.49) = 0. A(76.67) = 2.67) = 0. A(24.0004.60) = 2.62) = 2.0004. A(34. A(18.0004.79) = 0.0004.35) = 2. A(63. A(60.82) = 0.52) = 2.39) = 2.59) = 0.30) = 2.81) = 0.0004.0004.49) = 2.0008CB17.36) = 2.0008CA13CC13.80) = 2.14) = 2. A(55.0004. A(19.53) = 2. A(62.0008CA9CC9. A(21.0008CB14.0004.0008. A(47.39) = 0.77) = 0. A(56. A(32.0004.49) = 2.66) = 2.44) = 2.67) = 2.34) = 0.35) = 2.0008CB19. A(72.0004. A(38. A(18.0004.0004. A(47.33) = 2. A(53.30) = 2. A(35.0008CB20.46) = 2. A(28.65) = 2.0004.0008CB17. A(37.21) = 0. A(52.24) = 0.0004. A(52.63) = 2. A(77.0004.73) = 0. A(45.46) = 0. A(76. A(54. A(43. A(79.0004.65) = 0.0008.0008.75) = 0. A(26.0008CB10.74) = 2.76) = 2. A(58.58) = 2. A(22.0004.57) = 0.0008CA14CC14. A(80.0008CB5. A(43. A(29.43) = 0. A(81.24) = 2.84) = 0.32) = 2.50) = 2.41) = 2. A(76.0004.0008CB12. A(55.0004. A(65.0004.0004.29) = 2.39) = 2.42) = 2.57) = 2.68) = 2.18) = 2.27) = 2.0004. A(17.27) = 0. A(32.74) = 2. A(33.63) = 0. A(35.0004.37) = 2. A(37.0004.0008.0004. A(31.0008.51) = 2.50) = 2. A(30.0004.64) = 2.45) = 2. A(25. A(54.76) = 0.0004. A(70. A(46. A(33.18) = 2.0004.53) = 2. A(23.46) = 2.

A(81.357413 0.5 0. Solution Since three parts are made. A(44. A(83.516040 0. species A) are: .85) = CA12CB12. A(84.336482 0.337623 0.423163 0.0 0.339638 21 10.335665 0.2 for the solution of the above problem is given in the Appendix. The results are shown in Table 7. A(56.339216 0.333705 0.85) = CB8CC8.6 Results in Example 7.241939 0.332252 0.85) = CA20CB20. A(11. A(35.85) = CB19CC19.0 0.82) = 2.5 0.0008. A(19.070151 0.85) = CA19CB19. A(59.0008 The nonzero right hand side terms are given in augmented matrix A form as A(1.128732 0.85) = CA3CB3. A(63.85) = CA16CB16.85) = CB16CC16.84) = 2. A(32. A(12.221265 6 2.337617 0. A(79. A(31.85) = 20004.85) = 20004.379579 0.175791 0.85) = CA5CB5.5 0.337649 0.028875 0. A(75.0 0.009008 0.273464 8 3. A(52.5 0.999925 0.460355 0. A(7.85) = CB11CC11.336717 0.5 0. A(2. A(15.85) = CA11CB11.85) = CA6CB6.337186 0.85) = CA18CB18.80) = 2.78) = 2.0008.79) = 2.319310 12 5.337671 0. A(27. A(40.366717 0. A(28. A(83.333075 0.474505 0.181438 5 2.5 0.337497 0.0008CB21.85) = CB9CC9.0 0. A(72.681292 0.0 0.290175 9 4.331960 15 7.85) = CB4CC4.337659 0.85) = CB12CC12.324724 13 6.0008.337466 18 8. A(8. therefore the total number of nodes is 4. Tubular Reactor with Axial Dispersion 145 2.85) = CB10CC10. A(55.189554 0.0008CA21CC21. A(80.350622 0.337668 0. A(76.0 0.002831 0. The concentration of various species along the length of the reactor is obtained using the Gauss elimination method.302718 10 4. A(71. A(51. A(43. A(84.0008.000006 2 0.329465 0.333583 0.336124 17 8.6. A(47. A(64.85) = CA17CB17. A(4.5 0.85) = CB1CC1.006742 0.602852 0.0 0.5 0.85) = CB15CC15. A(67.339160 20 9.85) = CA2CB2. The coefficients of equation 1 (node 1.337630 0.85) = CA1CB1.005048 0.85) = CA14CB14.332604 0.003780 0.85) = CA21CB21.337242 0.0 0.0 0. A(83.85) = CA4CB4.345632 0. A(20. A(3.85) = CB6CC6.328835 14 6.0008CB21. Table 7.002121 0.3 by making 3 parts of the reactor of length 3 m.85) = CB21CC21 Program 7. A(16.5 0.81) = 2.312168 11 5.0 0.094823 0.321230 0.85) = CB2CC2. A(39.85) = CA10CB10.339996 EXAMPLE 7.85) = CA15CB15.0 0.334547 0.337659 0.337612 0.5 0.85) = CA13CB13.251137 7 3.85) = CB3CC3.338454 19 9.335674 0.85) = CB14CC14.85) = CA9CB9.341947 0.85) = CA7CB7. A(36. A(82.85) = CB18CC18.4 Solve Example 7.334332 16 7.745869 0. A(68. A(23.83) = 2. A(48.999918 0.85) = CB13CC13.304402 0.85) = CA8CB8.021552 0.038739 0. A(24.016103 0.052067 0. A(60.337639 0.85) = CB5CC5.397574 0.85) = CB7CC7.129276 4 1.85) = CB20CC20. A(84.000060 0.064577 3 1.85) = CB17CC17.012040 0.3 Node number x (m) CA CB CC CD 1 0. A(82.268800 0.

species B) are: Coefficient of CA1 = 0       Coefficient of %\$     % #  %%      % #  %%    Coefficient of CC1 = 0 Coefficient of CD1 = 0 Coefficient of CA2 = 0      Coefficient of %\$      Coefficient of CC2 = 0 Coefficient of CD2 = 0 § W  W ·   Right hand side of equation 2 =  ¨¨  ¸ %\$      © & 'Z ¸¹   KP  The coefficients of equation 3 (node 1.146 Introduction to Numerical Methods in Chemical Engineering       Coefficient of % #     %\$      %\$    Coefficient of CB1 = 0 Coefficient of CC1 = 0 Coefficient of CD1 = 0 Coefficient of % #           Coefficient of CB2 = 0 Coefficient of CC2 = 0 Coefficient of CD2 = 0 § W  W ·   Right hand side of equation 1 =  ¨ ¨ &  'Z ¸¸ % #        KP  © ¹ The coefficients of equation 2 (node 1. species C) are: Coefficient of CA1 = 0 Coefficient of CB1 = 0       Coefficient of %%     %\$      %\$    Coefficient of CD1 = 0 Coefficient of CA2 = 0 Coefficient of CB2 = 0 .

The coefficients of equation 6 (node 2. species B) are: Coefficient of CA1 = 0 . species D) are: Coefficient of CA1 = 0 Coefficient of CB1 = 0 Coefficient of CC1 = 0       Coefficient of %&           Coefficient of CA2 = 0 Coefficient of CB2 = 0 Coefficient of CC2 = 0     Coefficient of %&      Right hand side of equation 4 = CB1CC1 The coefficients of equation 5 (node 2. species A) are:    Coefficient of % #      Coefficient of CB1 = 0 Coefficient of CC1 = 0 Coefficient of CD1 = 0      Coefficient of % #     %\$     %\$   Coefficient of CB2 = 0 Coefficient of CC2 = 0 Coefficient of CD2 = 0   Coefficient of % #   Coefficient of CB3 = 0 Coefficient of CC3 = 0 Coefficient of CD3 = 0 Right hand side of equation 5 = 0. Tubular Reactor with Axial Dispersion 147      Coefficient of %%       Coefficient of CD2 = 0 Right hand side of equation 3 = CA1CB1 The coefficients of equation 4 (node 1.

The coefficients of equation 7 (node 2. The coefficients of equation 8 (node 2.148 Introduction to Numerical Methods in Chemical Engineering    Coefficient of %\$      Coefficient of CC1 = 0 Coefficient of CD1 = 0 Coefficient of CA2 = 0      Coefficient of %\$     % #  %%     % #  %%    Coefficient of CC2 = 0 Coefficient of CD2 = 0 Coefficient of CA3 = 0   Coefficient of %\$   Coefficient of CC3 = 0 Coefficient of CD3 = 0 Right hand side of equation 6 = 0. species D) are: Coefficient of CA1 = 0 . species C) are: Coefficient of CA1 = 0 Coefficient of CB1 = 0    Coefficient of %%      Coefficient of CD1 = 0 Coefficient of CA2 = 0 Coefficient of CB2 = 0      Coefficient of %%      % \$    %\$   Coefficient of CD2 = 0 Coefficient of CA3 = 0 Coefficient of CB3 = 0   Coefficient of %%    Coefficient of CD3 = 0 Right hand side of equation 7 = CA2CB2.

The coefficients of equation 14 (node 4. species A) are:      Coefficient of % #      Coefficient of CB3 = 0 Coefficient of CC3 = 0 Coefficient of CD3 = 0      Coefficient of % #     %\$     %\$   Coefficient of CB4 = 0 Coefficient of CC4 = 0 Coefficient of CD4 = 0 Right hand side of equation 13 = 0. species B) are: Coefficient of CA3 = 0      Coefficient of %\$      Coefficient of CC3 = 0 Coefficient of CD3 = 0 Coefficient of CA4 = 0      Coefficient of %\$     % #   %%     % #  %%    . Tubular Reactor with Axial Dispersion 149 Coefficient of CB1 = 0 Coefficient of CC1 = 0    Coefficient of %&      Coefficient of CA2 =0 Coefficient of CB2 =0 Coefficient of CC2 =0      Coefficient of %&         Coefficient of CA3 = 0 Coefficient of CB3 = 0 Coefficient of CC3 = 0   Coefficient of %&   Right hand side of equation 8 = CB2CC2 The coefficients of equation 13 (node 4.

species C) are: Coefficient of CA3 = 0 Coefficient of CB3 = 0      Coefficient of %%       Coefficient of CD3 = 0 Coefficient of CA4 = 0 Coefficient of CB4 = 0      Coefficient of %%      %\$    %\$   Coefficient of CD4 = 0 Right hand side of equation 15 = CA4CB4. species D) are: Coefficient of CA3 = 0 Coefficient of CB3 = 0 Coefficient of CC3 = 0      Coefficient of %&      Coefficient of CA4 = 0 Coefficient of CB4 = 0 Coefficient of CC4 = 0      Coefficient of %&         Right hand side of equation 16 = CB4CC4.150 Introduction to Numerical Methods in Chemical Engineering Coefficient of CC4 = 0 Coefficient of CD4 = 0 Right hand side of equation 14 = 0 The coefficients of equation 15 (node 4. Thus the set of equations for concentration of species A. B. The coefficients of equation 16 (node 4. and D at nodes 1 to 4 can be written in the block tridiagonal form as ª \$ %   º ª : º ª&  º «  »» «« : »» « » « # \$ % « & » « # \$ % » « : » « & » « »« » « » ¬«   # \$ ¼» ¬« :  ¼» ¬« & ¼» . C.

Tubular Reactor with Axial Dispersion 151 where ª% # º ª% #  º ª% #  º «% » «% » «% » : « \$ » : « \$ » : « \$ » «%% » «%%  » «%%  » « » « » « » «¬%& »¼ «¬%&  »¼ «¬%&  »¼ For node 1 ª   %\$    º «    % #  %%   » \$ « » «     % \$  » « » «¬     »¼ ª    º «     »» % « «     » « » «¬     »¼ ª  º «  » & « » « % #%\$ » « » ¬« %\$%% ¼» For node 2 ª    º «     »» # « «     » « » «¬    »¼ ª   % \$     º «    % #   %%    » \$ « » «     %\$   » « » «¬     »¼ ª    º «     » % « » «     » « » «¬    »¼ .

152 Introduction to Numerical Methods in Chemical Engineering ª  º «  » & « » « % #%\$ » « » «¬ %\$%%  »¼ For node 3 ª    º «     »» # « «     » « » ¬«    ¼» ª   % \$    º «    % #  %%    » \$ « » «     %\$   » « » ¬«     ¼» ª     º «     »» % « «     » « » «¬    »¼ ª  º «  » & « » « % #%\$ » « » «¬ %\$%%  »¼ For node 4 ª    º «     »» # « «     » « » «¬     »¼ ª   % \$     º «    % #   %%    » \$ « » «     % \$   » « » ¬«     ¼» .

(Ans: The tridiagonal set of equations are .2 given in the Appendix).532064 0.503350 0.226697 0.120620 3 2 0. Make 10 parts of the reactor. The variables can be written as 6 Z >% # %\$ %% %&     % #  %\$  %%  %&  @ The Gauss elimination method can be used to solve these 16 linear algebraic equations (see Program 1.7. D = 104 m2/s and the rate constant of the reaction is 0. The results are given in Table 7.000060 0. The axial dispersion coefficient.289994 0. where A is a 16 ´ 16 matrix.310390 0.1 s1. Table 7. The differential equation for species A along the length of the tubular reactor of length 10 m is F % # F% # &  W  M% #  FZ FZ The boundary conditions are At x = 0 (inlet) F% # W% # W% #  & FZ KP At x = 10 m (exit) F% #  FZ A fluid medium comprising initially only A flows through the reactor with a mean axial velocity u = 1 m/s.430048 0.000006 2 1 0.in =1 mol/m3.4 Node number x (m) CA CB CC CD 1 0 0. x is the vector of size 16 ´ 1 containing the variables to be determined.259562 Exercises 7.206656 4 3 0.1 Consider a reaction A ® B carried out in a tubular reactor.170485 0. List the tridiagonal set of equations and determine the concentration of A at various positions along the length of the tubular reactor.7 Results in Example 7. Tubular Reactor with Axial Dispersion 153 ª  º «  » & « » « % # %\$  » « » ¬« %\$ %%  ¼» The 16 linear algebraic equations can be written in the form Ax = d.652683 0. The inlet concentration CA. and d is also a vector of size 16 ´ 1.999933 0.999927 0.296694 0.

0) = 0.564471 CA8 = CA(7. The differential equation for species A along the length of the tubular reactor of length 10 m is F % # F% # &  W  M% #  FZ FZ The boundary conditions are F% # At x = 0 (inlet): W% # W%  & FZ KP # F% # At x = 10 m (exit):  FZ A fluid medium comprising initially only A flows through the reactor with a mean axial velocity u = 1 m/s.916073 CA3 = CA(2.730059 CA6 = CA(5. The inlet concentration CA.0) = 0.0) = 0. Make 10 parts of the reactor.0) = 0.in = 1 mol/m3.0) = 0.0) = 0.0) = 0.424097 CA11 = CA(10.385549 7.0) = 0.751310 CA5 = CA(4.0) = 0.0) = 0.0) = 0.0) = 0.513156 CA9 = CA(8.605478 CA9 = CA(8.683009 CA6 = CA(5.0) = 0.1 m3/mol-s.999991 CA2 = CA(1.0) = 0.543192 CA11 = CA(10.0) = 0.844719 CA4 = CA(3.0) = 0.909083 CA3 = CA(2.0) = 0.154 Introduction to Numerical Methods in Chemical Engineering ª   º ª% # º ª  º « » « » «  » «    » «% #  » « » «    » « » «  » « »« » « » «    » «% # » «  » «¬   »¼ ¬«% # ¼» «¬  »¼ CA1 = CA(0.683363 CA7 = CA(6.0) = 0.783356 CA5 = CA(4.466506 CA10 = CA(9. D = 104 m2/s and rate constant of the reaction is 0.0) = 0.0) = 0.572688 CA10 = CA(9.0) = 0. (Ans: The tridiagonal set of equations are ª    % #  ºª % # º ª   º « «     % #   »« »« % # » » «  » « » «    »«  » « « »« »  » « » «     % #  »« %#  » «  » « »« »    % # %# « » «¬   »¼ «¬  »¼ ¬«  ¼» CA1 = CA(0.2 Consider a reaction A ® B carried out in a tubular reactor.642133 CA8 = CA(7.516529 .826440 CA4 = CA(3.0) = 0. The axial dispersion coefficient. List the tridiagonal set of equations and determine the concentration of A at various positions along the length of the tubular reactor.999991 CA2 = CA(1.620918 CA7 = CA(6.

1 First Order Reaction The differential equation for diffusion and reaction in a spherical catalyst pellet is given by § F %  F% · & ¨¨   ¸  M%  (8. The concentration at the surface of the spherical catalyst pellet is 1 mol/m3.1 The chemical reaction and diffusion in a spherical catalyst pellet is given by F % #  F% # &   &  M% #  FT T FT where D is the effective binary diffusivity of A within the catalyst pellet. 8. The finite difference method is used for the numerical solution of the first and second order reactions along with the diffusion term in a spherical catalyst pellet. because at the surface of the pellet the concentration of the species is known and at the centre of the pellet the gradient of concentration is zero. The numerical solution under nonisothermal conditions is also discussed in this chapter.1) © FT T FT ¸¹ It is assumed that the pellet is isothermal and therefore the rate constant is also fixed. D is the effective binary diffusivity of A within the catalyst pellet. The pellet is isothermal. thus the boundary conditions are 155 . EXAMPLE 8.1b) dr where CS is the concentration at the surface of the spherical catalyst pellet.Chapter 8 Chemical Reaction and Diffusion in Spherical Catalyst Pellet Chemical reaction and diffusion in a spherical catalyst pellet is a boundary value problem. The boundary conditions are at r = R C = CS (8.1b) and at r = 0 dC 0 (8.

The first node is labelled 0 and therefore the last node is the 100th node as 100 parts are made. thus 'T   m. Take the rate constant. Determine the concentration of species A at various nodes along the radius of the catalyst pellet. The boundary conditions are: at r = 1 cm C=1 r=0 F%  FT . Make 100 parts of the radius. &    The radius is 1 cm = 102 m and 100 parts are made.156 Introduction to Numerical Methods in Chemical Engineering at r = R CA = 1 at r = 0 F% #  FT The radius of the catalyst pellet is 1. The schematic  diagram of the spherical catalyst pellet is shown in Fig. 8.1 Diffusion and reaction in spherical catalyst pellet.1.0 cm. 100 r= R C100 = 1 0 r=0 Fig. Solution The differential equation for diffusion and reaction in a spherical catalyst pellet is F %  F% M    %  FT T FT & M   It is given that    m2. k = 10-3 s1 and D = 109 m2/s. 8.

we get %   %   %  § %   %  ·  K K K  K ¸   % K   O 'T ¨©  'T K 'T ¹  %   %   %  %   %  . Chemical Reaction and Diffusion in Spherical Catalyst Pellet 157 Discretizing the differential equation at node i.

   'T %  O K K K K K K  %   %   %  %   %  .

we get § %  %  % ·  ¨  ¸   %  © 'T  ¹  %  %  % .  %  O K K K K K K § · § · %  ¨   ¸  %  %  ¨   ¸  O¹ O¹ K K K © © At node 0 (centre of spherical catalyst pellet) the differential equation becomes F %     %  FT  Discretizing.

   'T  %   %  %  % .

and therefore C1 = C1. thus  .  %  F% %  % At node 0. Therefore the above equation FT  'T becomes  %  % .  .

 %  %  %  At node 1 (m = 1) § · § · %  ¨   ¸  %  %  ¨   ¸  O¹ O¹ K K K © © § · %  % ¨   ¸  © ¹ At node 2 (m = 2) § · § · % ¨   ¸  %  % ¨   ¸  © ¹ © ¹ At node 3 (m = 3) § · § · % ¨   ¸  %  % ¨   ¸  © ¹ © ¹ .

158 Introduction to Numerical Methods in Chemical Engineering At node 99 (m = 99) §  · §  · % ¨   ¸  %  % ¨   ¸  ©  ¹ ©  ¹ Since C100 = 1. we get §  · §  · % ¨   ¸  %  ¨  ¸ ©  ¹ ©  ¹ §  ·  % ¨   ¸  %  ©  ¹  The 100 equations can be written in tridiagonal form as ª   º % ª  º «        »ª  º «  » «   » « % » « » «        »« » «  » « » « % » « » «        »«% » «  » « »«  » «  » «    » «  » « » «    » «  » «  » « »« » «  » «        » «% » « » «  »«  «% » » «  » «        »  « »« » «  »     ¼» «¬% »¼ «¬   »¼ ¬« The solution can be obtained by modifying the parameters ai (i = 2 to N).2 Second Order Reaction The differential equation for diffusion and second order reaction in a spherical catalyst pellet is given by § F %  F% ·  & ¨¨   ¸¸  M%  (8. The boundary conditions are At r = R: C = CS F% At r = 0:  FT where CS is the concentration at the surface of the spherical catalyst pellet. .1 given in the next section. D is the effective binary diffusivity of A within the catalyst pellet.2) © FT T FT ¹ It is assumed that the pellet is isothermal and therefore the rate constant is also fixed. The results for nodes 77 to 99 are presented in Table 8. bi (i = 1 to N) and ci (i = 1 to N  1) in Program 1. 8.1 given in the Appendix.

thus the boundary conditions are At r = R: CA = 1 F% # At r = 0:  FT The radius of the catalyst pellet is 1. The first node is labelled 0 and therefore the last node is the 100th node as 100 parts are made. &     The radius is 1 cm = 102 m and 100 parts are made. The concentration at the surface of the spherical catalyst pellet is 1 mol/m3. Solution The differential equation for diffusion and reaction in a spherical catalyst pellet is F %  F% M     %  FT T FT & M   It is given that   .2 The chemical reaction and diffusion in a spherical catalyst pellet is given by  F% #F % # & &  M% #    FT T FT where D is the effective binary diffusivity of A within the catalyst pellet. Determine the concentration of species A at various nodes along the radius of the catalyst pellet. 8. Take the rate constant. The schematic  diagram of the spherical catalyst pellet is given in Fig. we get %   %   %  § %   %  ·   K K K  K ¸   % K   O 'T ¨©  'T K 'T ¹  %   %   %  %   %  . Chemical Reaction and Diffusion in Spherical Catalyst Pellet 159 EXAMPLE 8. Make 100 parts of the radius. Discretizing the differential equation at node i.1.0 cm. thus 'T   m. k = 103 m3/mol-s and D = 109 m2/s. The pellet is isothermal.

  'T %   O K K K K K K  %   %   %  %   %  .

 %   O K K K K K K § · § · %  ¨   ¸  %   % .

 %  ¨   ¸  O¹ O¹ K K K K © © At node 0 (centre of spherical catalyst pellet) the differential equation becomes F %      %   FT .

we get § %  %  % ·   ¨  ¸   %  © 'T  ¹  %  %  % .160 Introduction to Numerical Methods in Chemical Engineering Discretizing.

   'T %   %  %  % .

and therefore C1 = C1.  . thus   .  %  F% %  % At node 0. Therefore the above equation becomes FT  'T  %  % .

 %  %   % .

 %  At node 1 (m = 1) § · § · %  ¨   ¸    % .

%  %  ¨   ¸  O¹ O¹ K K K K © © ·   % .

%  % §¨   ¸  © ¹ At node 2 (m = 2) § · § · % ¨   ¸    % .

%  % ¨   ¸  © ¹ © ¹ At node 3 (m = 3) § · § · % ¨   ¸    % .

%  % ¨   ¸  © ¹ © ¹ At node 99 (m = 99) §  · §  · % ¨   ¸    % .

%  % ¨   ¸  ©  ¹ ©  ¹ Since C100 = 1. we get §  · §  · % ¨   ¸    % .

%  ¨   ¸ ©  ¹ ©  ¹ §  ·  % ¨   ¸    % .

%  ©  ¹  The 100 equations can be written in tridiagonal form as ª   %  º « »ª% º ª  º «     %   »«  » « » «   » « % » «  » «  » «  » «  » « »« » « » «      %   » «% » «  » «   » «  » «¬% »¼ « «¬   »¼     % » «¬  »¼ .

1 for the solution of the above problem is given in the Appendix.78 0.698366 0. The procedure is repeated till there is no change in the concentration profile.1.342438 0.835509 0.83 0.130331 0.95 0.89 0.334296 78 0.310759 8. Table 8. At these concentrations the coefficients are re-calculated and TDMA is used to determine the new concentrations.96 0. Therefore.488564 0.97 0.88 0.99 0.638586 0.85 0.313425 0.91 0.636593 92 0.914015 0.142186 0.82 0.84 0.930360 98 0.467374 86 0.812053 96 0.446290 85 0.3 Nonisothermal Conditions The differential equation for diffusion and reaction in a spherical catalyst pellet is given by § F %  F% · & ¨¨   ¸  M 6 .408536 83 0.374184 0.715865 94 0.868043 97 0.446948 0.375800 81 0.77 0.763826 0.674377 93 0.94 0.86 0.514766 88 0.570482 90 0.391599 82 0.87 0.93 0.583988 0.541468 89 0. the coefficients are calculated and TDMA is used to determine the new concentrations. Program 8.201735 0. Chemical Reaction and Diffusion in Spherical Catalyst Pellet 161 It is seen that the coefficient matrix also depends on the concentrations.81 0. The results for nodes 77 to 99 are presented in Table 8.408925 0.490138 87 0.240513 0.262670 0.79 0.347233 79 0.286908 0.92 0.1 Concentration of reactants in spherical catalyst pellet for first and second order reactions under isothermal condition Node number r (cm) C (first order reaction) C (second order reaction) 99 0.761560 95 0.90 0.426724 84 0.80 0.184799 0. to start the program the concentrations are assumed.155144 0.169310 0.98 0.534119 0.361041 80 0.602084 91 0.220257 0.322160 77 0.

or ª ' § 65 ·º M 6 . %  (8.3) © FT T FT ¸¹ where the rate constant is a function of the temperature.

M 65 .

GZR «  ¨  ¸» (8.4) ¬ 465 © 6 ¹¼ .

We wish to compute the effect of internal heat and mass transfer resistance upon the reaction rate and the concentration and temperature profiles within the pellet.162 Introduction to Numerical Methods in Chemical Engineering Consider the case of a non-isothermal first order reaction A ® B occurring in the interior of a spherical catalyst pellet. The concentration profile CA(r) is governed by the mole balance F §  F% # ·  T &#  T M 6 .

If k is the effective thermal conductivity of the pellet.5) FT ¨© FT ¸¹ where DA is the effective binary diffusivity of A within the pellet. the temperature profile T(r) is governed by the energy balance F §  F6 ·  ¨T M FT © FT ¹ . % #  (8.

¸  T  '* TZP ¬ª M 6 .

r = R: CA(R) = CAS and T(R) = TS. at the F% # F6 centre of the pellet. The temperature dependence of the FT T  FT T  rate constant is ª ' § 65 ·º M 6 . we have known values of the concentration and temperature at the surface. % # ¼º   (8. r = 0:  and  . Also.6) Neglecting external heat and mass transfer resistance.

M 65 .

7) ¬ 465 © 6 ¹¼  If we assume constant DA. GZR «  ¨  ¸» (8. we get § · F §  F% # · F ¨  M F6 ¸ T &  T  FT ¨© FT ¸¹ FT ¨ . Dividing the energy balance equation by '* TZP and adding to the mole balance equation. k and '*TZP the problem reduces to a single ordinary differential  equation.

we get ª º F% # M F6 » T  « &#  % « ¬ FT   '* TZP FT » ¼ .8)   '* TZP FT ¸ © ¹ Integrating. # (8.

9) 2 where C1 is the constant of integration.10) FT « ¬   '* TZP » ¼ T . (8. Dividing by r gives ª º F « M % &#% #  6» (8.

11) '* . From the symmetry boundary condition C1 = 0 and a second integration M &#% #  6 % (8.

 TZP where C2 is the constant of integration. At the surface.12) '* . we get the value of constant C2 as M % & # % #5  65 (8.

 TZP .

11) and (8. we get M M &#% #  6 & # % #5  65   '* TZP . Chemical Reaction and Diffusion in Spherical Catalyst Pellet 163 Comparing Eqs.12). (8.

'* .

13) Thus there exists the following linear relation between CA(r) and T(r):  &# '* TZP 6 T .  TZP (8.

 65 ª¬% # T .

we can show that at any point along the radius the temperature and concentration of '* TZP the reactant are related by Eq. if we assume constant DA.  % #5 º¼ (8.14) M Thus only the mole balance equation has to be solved. A parameter is defined as C  &  '* TZP %5 . k and  . (8. Thus.14).

14). we get  6 & '* TZP  %  %5 . (8.15) M65 From Eq. (8.

65 M65 Therefore 65  6  &'* TZP  %  %5 .

M65 Subtracting one from both the sides. we get  & '* TZP  %  %5 .

16) 6 & '* TZP  %  %5 . 65 M65   (8.

then C  &  '* TZP . M65 Let us define a parameter as ' H (8.17) 465 If CS = 1.

7) M65 becomes ª HC %  %5 . (8. and the expression for rate constant given in Eq.

º M 6 .

M 65 .

GZR «  » (8.18) ¬«   C %  %5 .

¼» .

D = 109 m2/s. The concentration at the surface of the spherical catalyst pellet CS = 1 mol/ m3. Solution The differential equation for diffusion and reaction in a non-isothermal spherical catalyst pellet is F %  F% M    %  FT T FT & where ª HC %  %5 . The rate constant of the reaction k(TS) = 103 s1 and effective diffusivity of species.164 Introduction to Numerical Methods in Chemical Engineering EXAMPLE 8. Make 100 parts of the radius and determine the concentration within the catalyst pellet.3 Diffusion and reaction take place in a non-isothermal spherical catalyst pellet of radius 1 cm. Take b = 1 and gÿ = 1.

º M 6 .

M 65 .

GZR «  » «¬   C %  %5 .

»¼ Thus the differential equation becomes F %  F% M 65 .

ª § HC %  %5 .

· º   « GZR ¨¨  ¸¸ » %  FT  T FT & «¬ ©   C %  %5 .

¹ »¼ M 65 .

  It is given that    m2.1. 8. The schematic  diagram of the spherical catalyst pellet is given in Fig. gÿ = 1. and CS = 1 mol/m3. The boundary conditions are At r = 1 cm: C =1 F% At r = 0:  FT Since b = 1. we get %   %   %  § %   %  · ª §   % ·º K K  K  ¨ ¸ K    «GZR ¨ K ¸» % K  O 'T ©  'T ©   % ¹ ¼» K 'T ¹ ¬« K  ª §% ·º %   %   %  %   %  . thus 'T   m. the differential equation becomes F %  F% ª §   % ·º      «GZR ¨ ¸» %  FT T FT ¬ ©   % ¹¼ Discretizing the differential equation at node i. &    The radius is 1 cm = 102 m and 100 parts are made.

  «GZR ¨ K ¸» %  O ©% K K K K K K «¬ K ¹ »¼ .

we get § %  %  % · ª §   % ·º ¨  ¸   «GZR ¨   % ¸ » %  © 'T  ¹ «¬ ©  ¹ »¼ ª §   % ·º  %  %  % . Chemical Reaction and Diffusion in Spherical Catalyst Pellet 165 § · ª §% ·º § · %  ¨   ¸  % «   GZR ¨ K ¸ »  %  ¨   ¸  O¹ ©% O¹ K K K © ¬« K ¹ ¼» © At node 0 (centre of spherical catalyst pellet). the differential equation becomes F % ª §   % ·º     «GZR ¨  ¸» %  FT ¬ ©   % ¹¼ Discretizing.

thus  . Therefore the above equation FT  'T becomes ª §   % ·º  %  % .   «GZR ¨ ¸ » %  ¬« ©   % ¹ ¼» F% %  % At node 0. and therefore C1 = C1.  .

  «GZR ¨ ¸ » %  «¬ ©   % ¹ »¼ ª §   % ·º «   GZR ¨ ¸ » %  %  ¬« ©   % ¹ ¼» At node 1 (m = 1) § · ª §   % ·º § · %  ¨   ¸  «   GZR ¨ ¸ » %  %  ¨   ¸  K O   % O K K K © ¹ ¬« © ¹ »¼ K © ¹ ª §   % · º § · «   GZR ¨ ¸ » %  % ¨   ¸  ¬ ©   % ¹ ¼ © ¹ At node 2 (m = 2) § · ª §   % · º § · % ¨   ¸  «   GZR ¨ ¸ » %  % ¨   ¸  © ¹ ¬ ©   % ¹ ¼ © ¹ At node 3 (m = 3) § · ª §   % · º § · % ¨   ¸  «   GZR ¨ ¸ » %  % ¨   ¸  ©  ¹ ¬« ©   % ¹¼» © ¹ At node 99 (m = 99) §  · ª §   % · º §  · % ¨   ¸  «   GZR ¨ ¸ » %  % ¨   ¸  ©  ¹ ¬« ©   % ¹ ¼» ©  ¹ .

3 for b = 10 and gÿ = 1.4 Solve Example 8. At these concentrations the coefficients are re-calculated and TDMA is used to determine the new concentrations. and CS = 1 mol/m3. The procedure is repeated till there is no change in the concentration profile. to start the program the concentrations are assumed. we get %   %   %  § %   %  · ª §   % ·º K K K  ¨ K ¸    «GZR ¨ K K ¸» %  'T  O'T ©  'T ©   % K ¹ ¬« K ¹ ¼»  ª §   % · º %   %   %  %   %  . EXAMPLE 8. Therefore. gÿ = 1. The results for nodes 77 to 100 are presented in Table 8.166 Introduction to Numerical Methods in Chemical Engineering Since C100 = 1. Solution Since b = 10.2 for the solution of the above problem is given in the Appendix. we get §  · ª §   % · º  % ¨   ¸  «   GZR ¨ ¸ » %  ©  ¹ «¬ ©   % ¹ »¼  The 100 equations can be written in tridiagonal form as ª § % · º «   GZR ¨  » « © % ¸¹ » ª  º « «   §  ·   GZR ¨ %   » % »ª  º « ¸ %  »» «  ©  ¹  »« % »  » « « »« «  » «  » «  » « » »« % » «  » «  § % ·  »«  » «    GZR ¨  «  » «  © % ¸¹  »« % ¬  ¼ » « » « » ¬  » « ¼ «  § %  · »    GZR ¨ ¸» « ¬«  © % »  ¹ ¼ It is seen that the coefficient matrix also depends on the concentrations. Program 8. the coefficients are calculated and TDMA is used to determine the new concentrations. the differential equation becomes F %  F% ª §   % · º      «GZR ¨ ¸» %  FT T FT ¬ ©   % ¹ ¼ Discretizing the differential equation at node i.2.

  «GZR ¨ ¸» % K  O ©   % ¹ ¼» K K K K K K ¬« K § ª · §   % · º § · %  ¨   ¸  % «   GZR ¨ ¸ »  %  ¨   ¸  K O¹ ©   % ¹ »¼ O¹ K K K © «¬ © K At node 0 (centre of spherical catalyst pellet). the differential equation becomes F % ª §   % · º    « GZR ¨ ¸» %  FT  ¬ ©   % ¹ ¼ .

Chemical Reaction and Diffusion in Spherical Catalyst Pellet 167 Discretizing. we get § %  %  % · ª §   % ·º ¨   ¸   «GZR ¨   % ¸ » %  © 'T ¹ «¬ ©  ¹ »¼ ª §   % · º  %  %  % .

Therefore the above equation FT  'T becomes ª §   % ·º  %  % .  . thus . and therefore C1 = C1.   «GZR ¨ ¸ » %  ¬« ©   % ¹ »¼ F% %  % At node 0.

we get §  · ª §   % · º  % ¨   ¸  «   GZR ¨ ¸ » %  ©  ¹ «¬ ©   % ¹ »¼  .   «GZR ¨ ¸ » %  «¬ ©   % ¹ »¼ ª §   % · º «   GZR ¨ ¸ » %  %  ¬« ©   % ¹ »¼ At node 1 (m = 1) § · ª §   % ·º § · %  ¨   ¸  «   GZR ¨ K ¸ » %  %  ¨   ¸  O ¹ «¬ ©   % O¹ K K K © K ¹ »¼ © ª §   % · º § · «   GZR ¨ ¸ » %  % ¨   ¸  ¬ ©   % ¹ ¼ © ¹ At node 2 (m = 2) § · ª §   % · º § · % ¨   ¸  «   GZR ¨ ¸ » %  % ¨   ¸  © ¹ ¬ ©   % ¹ ¼ © ¹ At node 3 (m = 3) § · ª §   % · º § · % ¨   ¸  «   GZR ¨ ¸ » %  % ¨   ¸  ©  ¹ ¬« ©   % ¹¼» © ¹ At node 99 (m = 99) §  · ª §   % · º §  · % ¨   ¸  «   GZR ¨ ¸ » %  % ¨   ¸  ©  ¹ ¬« ©   % ¹ ¼» ©  ¹ Since C100 = 1.

348888 92 0.90 0.267922 0.2.033247 77 0.752422 97 0.058529 0. to start the program the concentrations are assumed.389179 0.84 0.99 0. The results for nodes 77 to 100 are presented in Table 8.053280 80 0.407470 93 0. Program 8.343828 0.92 0.208414 0. Table 8.110677 0.136650 86 0. Therefore.83 0.79 0.88 0.554827 95 0.77 0.497557 0.646573 96 0.81 0.075543 0.097460 0.2 Concentration of reactant in spherical catalyst pellet under non-isothermal conditions for first order reaction for b = 1 and b = 10 Node number r (cm) C (b = 1) C (b = 10) 100 1.303586 0.440217 0. the coefficients are calculated and TDMA is used to determine the new concentrations.97 0.085810 0.93 0.038908 78 0.085352 83 0.86 0.78 0.91 0.066497 0. The procedure is repeated till there is no change in the concentration profile.072949 82 0.96 0.80 0.803074 0.873620 98 0.161913 0. At these concentrations the coefficients are re-calculated and TDMA is used to determine the new concentrations.183724 0.298610 91 0.901657 0.000000 1.028409 .475639 94 0.713959 0.218553 89 0.85 0.159829 87 0.98 0.633761 0.125665 0.2 can be modified to solve this problem.255496 90 0.561849 0.045531 79 0.062345 81 0.236345 0.142658 0.168 Introduction to Numerical Methods in Chemical Engineering The 100 equations can be written in tridiagonal form as ª % §     · º «   GZR ¨ ¸  » « % ©     ¹ » ª  º « «     GZR ¨ % §     ·   » % »ª  º « % ¸  »» «  ©     ¹  »« % »  » « « »« «  » «  » «  » « » »«% » «  » « «     GZR ¨ % §     ·   »«  » «  » «  % ¸ ©     ¹  % » ¬  »¼ « « » « » «  ¼ ¬ » «     GZR ¨ % §     · » ¸» « «¬  % ©     ¹ » ¼ It is seen that the coefficient matrix also depends on the concentrations.94 0.116820 85 0.87 0.89 0.186914 88 0.00 1.099585 84 0.000000 99 0.82 0.95 0.

1 The chemical reaction and diffusion in a spherical catalyst pellet is given by F % #  F% # & &   M% #  FT T FT where D is the effective binary diffusivity of A within the catalyst pellet. 8. Make 10 parts of the radius.000120 CA9 = CA(0.4) = 0. thus the boundary conditions are At r = R: CA = 1 F% # At r = 0:  FT .2) = 0.6) = 0. k = 0.0) = 0.000000 CA6 = CA(0.5) = 0.2 The chemical reaction and diffusion in a spherical catalyst pellet is given by F % #  F% # &   &  M% #  FT T FT where D is the effective binary diffusivity of A within the catalyst pellet.000000 CA7 = CA(0.1) = 0.0 cm. The concentration at the surface of the spherical catalyst pellet is 1 mol/m3 thus the boundary conditions are: At r = R: CA = 1 F% # At r = 0:  FT The radius of the catalyst pellet is 1.000000 CA4 = CA(0. (Ans: The tridiagonal set of equations are ª   º ª% # º ª  º «        »« » «  » «   » « % # » « » «    » «  » «  » « »« » « » «        » «% # » «  » « » «  » «¬     »¼ ¬«% # ¼» ¬  ¼ CA0 = CA(0.8) = 0.1 s1 and D = 109 m2/s.010894 Distance (in cm) is measured from the centre of the spherical pellet.7) = 0.3) = 0.000000 CA5 = CA(0. The pellet is isothermal.000000 CA2 = CA(0.000001 CA8 = CA(0.000000 CA1 = CA(0.9) = 0. Take the rate constant. Determine the concentration of species A at various positions along the radius of the catalyst pellet. The concentration at the surface of the spherical catalyst pellet is 1 mol/m3.000000 CA3 = CA(0. Chemical Reaction and Diffusion in Spherical Catalyst Pellet 169 Exercises 8. The pellet is isothermal.

000000 CA4 = CA(0.096965 Distance (in cm) is measured from the centre of the spherical pellet.002073 CA3 = CA(0.000000 CA2 = CA(0.011211 CA8 = CA(0.000000 CA3 = CA(0.1 m3/mol-s and D = 109 m2/s.0 cm.4) = 0.3) = 0. The concentration at the surface of the spherical catalyst pellet.0) = 0.170 Introduction to Numerical Methods in Chemical Engineering The radius of the catalyst pellet is 1. D = 109 m2/s.6) = 0.000000 CA7 = CA(0.006286 CA7 = CA(0. Make 10 parts of the radius. Determine the concentration of species A at various positions along the radius of the catalyst pellet.002419 CA4 = CA(0.2) = 0.001894 CA2 = CA(0.006659 Distance (in cm) is measured from the centre of the spherical pellet. Take b = 1 and g = 1. 8.001837 CA1 = CA(0.1 s1 and effective diffusivity of species.3) = 0.8) = 0.000000 CA8 = CA(0. (Ans: The tridiagonal set of equations are ª   % #   º « » ª% º ª  º «    % #    » « # » «  » «   » « % # » « » «    » «  » «  » « »« » « » «      % #   » «% # » «  » «   »« «  » «  » ¬% #  »¼ «¬   »¼    % #  «¬  »¼ CA0 = CA(0.9) = 0.4) = 0.000000 CA1 = CA(0.7) = 0.004131 CA6 = CA(0.000045 CA9 = CA(0.9) = 0. (Ans: The tridiagonal set of equations are ª § % · º «    GZR ¨  » « © % ¸¹ » ª  º « «  % §  ·  » »ª % º     GZR ¨ ¸  «  »» «  % ©  ¹  »« % »» « « »« «  » «  »«  » « » »« % »» «  » «  § % ·  »« «     GZR ¨  «  » «  © % ¸¹  » «¬ % »¼ « » «¬  »¼ « » «  § %  ·»     GZR ¨ ¸» « ¬«  © % »  ¹¼ CA0 = CA(0.5) = 0. CS = 1 mol/m3.0) = 0.003030 CA5 = CA(0.6) = 0.5) = 0.025902 CA9 = CA(0.7) = 0. Take the rate constant.1) = 0.000000 CA5 = CA(0. k = 0. The rate constant of the reaction k(TS) = 0.000000 CA6 = CA(0.2) = 0. .1) = 0.3 Diffusion and reaction take place in a non-isothermal spherical catalyst pellet of radius 1 cm.8) = 0. Make 10 parts of the radius and determine the concentration within the catalyst pellet.

When B2  4AC > 0. Chapter 9 One-Dimensional Transient Heat Conduction The numerical solution of one-dimensional transient heat conduction in a rectangular slab. characteristics do not exist and it is elliptic PDE. 9. two sets of characteristics exist and it is hyperbolic PDE.3) V Ê T  T T ÚÙ M where B . one set of characteristics exists and it is parabolic PDE. The explicit.1 Classification of Partial Differential Equations Consider the two-dimensional partial differential equation (PDE)  H  H  H H H # \$ %  & '  (H  )  (9. The one- dimensional transient heat conduction in a rectangular slab is given by 6  6 B (9.2) V Ê T  T T ÙÚ and in a sphere it is given by 6 È  6  6 Ø BÉ  (9. An example of one-dimensional transient diffusion is also discussed. implicit and CrankNicolson discretizations are discussed.1. Discretization is carried out using the forward in time and central in space S%2 (FTCS) difference scheme. which is used to determine the criteria under which the explicit scheme is stable. When B2  4AC = 0. is also discussed. A summary of the above result with examples is presented in Table 9. cylinder. and sphere is discussed in this chapter using the finite difference method. Von Neumann stability analysis.1) V Z  In a cylinder it is given by 6 È  6  6 Ø BÉ  (9. 171 .4) Z  Z [ [ Z [ When B2  4AC < 0.

2 Explicit and Implicit Discretization Consider conduction in a one-dimensional rectangular slab.5) with respect to t. Differentiating Eq.172 Introduction to Numerical Methods in Chemical Engineering Table 9.1 Classification of partial differential equations PDE Parameters Classification of PDE  6 6 A=1 B2  4AC = 4 < 0     B=0 Elliptic Z [ C=1 6 6 B   (a > 0) A = a B2  4AC = 0 V Z B=0 Parabolic C=0 1-D wave equation A=1 B2  4AC = 4a2 > 0 W W C  (a > 0) (9. (9. we get  W  W C   VZ Z Differentiating Eq. we get 6KP   6KP 6KP  6KP  6KP B (9. The partial differential equation is [see Eq. E.5) B=0 Hyperbolic V Z C = a2 The coefficients in the 1D wave equation are determined using the following. (9. we get  W  W  C  V  Z  A linear PDE is one in which A. (9. we get W  W C  V  V Z Combining the above two equations.6) 'V 'Z . B. and G are functions of x and y only.5) with respect to x. D. C. 9.1)] 6  6 B V Z  Using the forward in time and central in space explicit difference scheme. F.

 .

6KP / 6KP  6KP  6KP  6KP . One-Dimensional Transient Heat Conduction 173 If the solution is known at time n. then it is very easy to determine the solution at time n + 1 using the explicit method.

(9.7) where / B'V . 'Z .

the temperature at time t + 2Dt can be computed. It is stable only when 'V  B  d (9.  Thus if the temperature at all the nodes is known at time t. the temperature at time t + Dt can be computed and from this temperature at time t + Dt. But there is a disadvantage. Thus the temperature at any required time can be computed. Thus the values of all the nodes can be updated to compute the temperature profile at the required time.8) 'Z . which is that explicit discretization is not stable for all values of Dt and Dx.

 d 'Z . If the condition B is not satisfied.   'V Thus the choice of Dt and Dx is not independent.

(9. The implicit method is an unconditionally stable method and the implicit discretization of Eq.1) is given by 6KP   6KP 6KP  6KP  6KP  B (9.9) 'V 'Z .  then convergence shall not be obtained and the solution shall start diverging.

 When the temperature at time t is known.10) 'V Ì Í 'Z .1)] 6  6 B V Z  CrankNicolson discretization is given by 6KP   6KP B ËÌ 6KP  6KP  6KP  6KP  6K P  6KP Û Ü  (9.3 Crank-Nicolson Discretization Consider conduction in a rectangular slab. then to calculate the temperature at time t + Dt the tridiagonal set of linear algebraic equations is solved. The partial differential equation is [see Eq. Thus 6KP are known and 6KP  are calculated. Thus marching in time can be carried out to obtain the temperature at various nodes at the next time step for the parabolic PDE. (9. 9.

 'Z .

It is an .  ÜÝ In the CrankNicolson method the discretization of space term is carried out using the central difference scheme at time n and at time n + 1 and taking the mean of the two.

It is an more accurate than the implicit method. 9. The method shall be described for the one-dimensional transient heat conduction [see Eq. (9. (9. The central difference scheme is not used in time because it would require high storage. T n. The accuracy of the implicit method is O(Dt. as there would be terms of three typesT n+1.1)] 6  6 B  V Z Discretizing using the FTCS explicit scheme.174 Introduction to Numerical Methods in Chemical Engineering unconditionally stable method. whereas that of CrankNicolson is O(Dt2. we get at node i [see Eq.Dx2).4 Von Neumann Stability Analysis Von Neumann stability analysis is also called the Fourier method. T n1.6)] B'V 6KP  6KP  'Z  6  P K   6KP  6KP .Dx2).

Then. that is P  FK  F KP È F P  F KP  F KP Ø B É K   Ù (9. Let the numerical solution on a real machine with finite accuracy be N. N = D + e and the above equation becomes &KP   F KP   &KP  F KP È &KP  F KP  &KP  F KP   &KP  F KP Ø BÉ Ù (9. Let the exact solution of this equation be D. Thus. t) can be written as a series of the form F Z V .11) 'V Ê 'Z  Ú Since the exact solution D must satisfy the difference equation. This is the solution that would be obtained using a computer with infinite accuracy (infinite storage of each variable). the same is true of the error. round-off error = N  D = e.12) 'V Ê 'Z Ú Thus the exact solution D and the error e must both satisfy the same difference equation. The error e (x. Consider a distribution of errors at any time.

. 1. ÇG G OZ (9.14) . it is sufficient to . superposition may be used and we may examine the behaviour of a single term of the series. Thus. M¢ is the number of intervals (Dx units long) contained in length L. 2. when the finite difference equation (FDE) is linear.13) CV KM O where OQ MO m = 0. M¢ (9. Since the difference equation is linear.

Consider the term F O Z V . One-Dimensional Transient Heat Conduction 175 investigate only one component of the Fourier series. The error is in the form of Fourier series.

15) CV KM O Z where km is real but a may be complex. Substituting F O Z V . G G (9.

we get G . G G CV KM O Z into Eq. (9.12).

GKMO Z  G CV GKMO Z C V  'V / G CV G O KM Z  'Z .

  G CV GKMO Z  G CV G O KM Z  'Z .

.

16) B'V where / . we get CV  'Z G '  C V / G O'  G O '   KM Z KM Z . If we divide by G G KM O Z . (9.

17)  we get G C'V    / EQU C  . and if we utilize the relation G C  G C K K EQU C (9.

18) where C MO 'Z (9.23)  For negative sign C d / UKP  (9. This requires that C    / UKP  d (9.21)  Since F KP  G C'V F KP for each frequency present in the solution for the error.24)  Since M is positive.19) We know C   EQU C UKP  (9. If the sign on  F KP the left hand side of Eq.22) is either positive or negative. it is clear that if GC'V is less than or equal to one.20)   Thus C G C'V    / UKP  (9. For positive sign C  / UKP  ! (9. The second inequality is satisfied . two conditions result. the first condition is always satisfied.22)  P  C FK The factor    / UKP  (representing ) is called the amplification factor. (9. (9. a general component of the error will not grow from one time step to the next. Stability means that error should not grow.

Thus for the explicit finite difference  B'V equation 6KP  6KP   6KP  6KP  6KP to be stable 'Z .176 Introduction to Numerical Methods in Chemical Engineering  only if / d . which is the stability requirement.

j) using the FTCS explicit scheme. B'V d  (9. we get B'V B'V 6KP L 6KP L  'Z  6 P K  L  6KP L  6KP L  .25) 'Z   The two-dimensional transient heat conduction equation is 6 È  6 6 Ø BÉ  Ù (9.26) V Ê Z  [  Ú Discretizing at node (i.

'[  6 P K  L   6KP L   6KPL .

28) 'Z '[  When Dx = Dy = D. (9.26) becomes B'V 6KPL  6KPL   '  6  K P  L  6KP  L  6KPL   6KPL   6KPL      . (9. we get the explicit FTCS discretization to be stable when B'V B'V      (9.27) From the von Neumann stability analysis. the discretized form of Eq.

EXAMPLE 9. List the tridiagonal system .1 s.1 cm. Initially the temperature is uniform at 20°C. and a = 105 m2/s. (9. The temperature of the end faces of the rectangular slab is made 300°C at t = 0 s. Use implicit discretization and take Dx = 0.1 Consider transient heat conduction in a rectangular slab.8 cm.5 Transient Conduction in Rectangular Slab One-dimensional transient heat conduction in a rectangular slab using the implicit method is described in the example below. Dt = 0.29) and the stability criterion for explicit discretization becomes B'V    (9. The partial differential equation is 6  6 B V Z  The total width of the rectangular slab is 0.30) '  9.

Solution The schematic diagram of the rectangular slab is shown in Fig.1 Transient heat conduction in rectangular slab. 9. 1 2 3 4 5 Symmetry Wall at 300°C Fig. we get 6KP   6KP 6KP  6KP  6KP  B 'V 'Z . Using forward in time and central in space implicit difference scheme. One-Dimensional Transient Heat Conduction 177 of equations and determine the temperature at the centre and the intermediate points of the slab up to 3. 9.1.1 s.

 6KP  6KP / 6KP  6KP  6KP .

B'V where / . 'Z .

 / .

6KP   /  .

6KP   / .

6KP  6KP At node 2 / .

6P    /  .

6P   / .

6P   6P At node 3 / .

6P    /  .

6P   / .

6P   6P At node 4 / .

6P    /  .

6P   / .

6P   6P where T5 = 300°C. At node 1 the finite difference equation is / .

6P    /  .

6P   / .

6P   6P .

Z  'Z Thus at i = 1. we get  /  . we get  . thus  and so T0 T2n 1 . Since at x = 0 (node 1) the symmetry 6 6P   6P  n 1 condition is satisfied.178 Introduction to Numerical Methods in Chemical Engineering where 0 is a hypothetical node to the left of node 1.

6P    / .

Thus B'V     /  'Z . Dx = 0.1 cm. Dt = 0. 6P   6P The following tridiagonal set of linear algebraic equations is obtained: Ë  /   Û Ë6 P  Û Ë 6P Û Ì /   ÜÌ  Ü Ì Ü Ì  Ü Ì6P  Ü Ì  Ü Ì /  /   /  Ü Ì P  Ü Ì 6P Ü Ì Ü Ì  /  /   / Ü Ì6 Ü Ì 6P Ü Ì Ü Ì P  Ü ÌÍ   /  /  ÜÝ ÍÌ6 ÝÜ Ì P Ü ÌÍ 6   / ÜÝ where the old values are at time n and the computed values are at time n + 1. T5 = 300°C. 6P 6P 6P 6P  °C.1 s. Here a = 105 m2/s.

     .

1 are presented in Table 9. i + 1. for discretization at node i.2.1s. Program 9. use is made of the values at nodes i  1.   P  Ë 6P Û Ë     Û Ë6 Û Ì   Ü 6 P  Ü Ì Ì P Ü Ì   ÜÌ  Ü Ì 6 Ü Ì  Ì Ü Ì P Ü   Ü Ì6P  Ü Ì 6 Ü Ì Ü ÍÌ    ÜÝ ÌÌ6 P  ÜÜ Ì P Ü Í  Ý ÍÌ 6   ÝÜ At time t = 0. and i. The coefficient matrix parameters are constant.1 for the solution of the above problem is given in the Appendix. These become the old values for solution by TDMA at t = 0. Note that in this sort of discretization a tridiagonal matrix is bound to get formed because.2 s and so on. 6P 6P 6P 6P  °C and the solution by TDMA is obtained at time t = 0. . but the right hand side of the linear algebraic equations each time is updated. The results of Program 9.

1 31.63 287.98 283.99 294.05 1.62 2.20 239.0 279.7 169.29 265.89 285.35 117.66 295.42 219.10 2.54 274.87 61.49 1.34 293.49 0.5 m is initially at a uniform temperature of 300 K. 9.5 258.30 283.40 193.44 0. Solution The schematic diagram is shown in Fig.21 63.17 277.70 127.64 254.99 295.50 0.20 231.1 295.19 270.75 240.49 175.3 78.45 2.16 291.22 156.91 0.48 287.79 3.59 91.75 296.15 290. a = 105m2/s.33 EXAMPLE 9.2 284.32 1.59 292.16 291.6 291.29 297.5 289.27 289. Use implicit discretization and take Dx = 0.87 179.2 Example 9.3 244.66 1.58 297.2.1 225.83 2.2 A brick wall with a thickness of 0.6 263.71 0. Initial temperature = 300 425 600 1 6 11 Fig.37 296.2 Results of Program 9.66 0.72 221.51 2.92 297.90 195.0 214.21 230.44 262.85 295.0 s.13 2.98 296.64 271.8 272.60 255.28 131.9 276.31 293. One-Dimensional Transient Heat Conduction 179 Table 9.40 202.9 294.56 275.05 m.7 292.04 2.55 266.48 260.22 286.79 256.93 1.00 261.9 201.57 207.5 128.32 274.70 295.2 53.60 247.65 267.33 292.4 251.77 277.66 176.23 0.51 290.2.61 288.1 282.4 104.63 280.8 186.0 294. and Dt = 1.36 270. At time t = 0 the left surface is maintained at 425 K and right at 600 K. 9.04 219.82 290.48 1.2 235.46 298.91 37.6 150.40 1.4 288.65 295.32 280.8 293.09 2.7 268.07 2.92 298. .22 294.45 161.24 248.1 Time (s) T1 T2 T3 T4 0.09 241.78 281. Determine the time required for its centre temperature to reach 425 K.58 289.55 140.57 278.89 1.42 285.38 292.86 100.45 249.65 1.78 209.44 294.08 3.42 287.84 293.31 1.88 2.05 283.91 294.98 231.3 286.80 296.90 0.

180 Introduction to Numerical Methods in Chemical Engineering In a rectangular slab 6 6 B  V Z Discretizing using implicit FTCS at node i. thus B  . we get 6 P   6 P È 6 P  6 P   6 P Ø K K BÉ K K K Ù 'V Ê 'Z  Ú 'V   Dx = 0.0 s.05 m and Dt = 1. Therefore 'Z     6KP   6KP  6KP  6KP   6KP .

Program 9. we get 6P   6P  6P     At node 3 6P   6P   6P  6P At node 9 6P   6P   6P  6P At node 10 6P   6P   6P  6P Since T11 = 600. we get 6P   6P  6P     Thus the unknowns are T2 to T10. 6 P  6 P   6 P K K K 6P K At node 2 6P   6P   6P  6P Since T1 = 425. We have to determine the time when T6 = 425. After every iteration the time is incremented by 1 s.1 can . The tridiagonal set of 9 linear algebraic equations is P  Ë6P   Û Ë   Û Ë6 Û Ì  Ü 6 P  Ü Ì Ì P Ü Ì   ÜÌ  Ü Ì6 Ü Ì Ü Ì Ü Ì Ü Ì    Ü ÌÌ P  ÜÜ Ì Ü Ì     Ü 6 Ì6 P Ü ÌÍ Ì Ü Ì  Ü  ÜÝ Ì6 P  Ü ÌÍ6P   ÜÝ Í  Ý Initially 6P 6P 6P 6P 6P 6P 6P 6P 6P  .

24.95. T6 = 425. T5 = 412. and a = 105m2/s. T9 = 512. and T10 = 555.11.3 Consider a cylinder of radius 0. T4 = 407.1 s. T7 = 446. we get 6KP   6KP Ë 6 P   6 P   6 P   È 6KP  6KP Ø Û BÌ K  K  K  ÙÜ 'V 'T .4 cm. Solution The partial differential equation is 6 È  6  6 Ø BÉ  V Ê T  T T ÙÚ Using the forward in time and central in space implicit difference scheme.1 s.07. The temperature of the cylinder surface is made 300°C at t = 0 s. Dt = 0. EXAMPLE 9.6 Transient Conduction in Cylinder One-dimensional transient heat conduction in a cylinder using the implicit method is described in the example below. T8 = 476. List the tridiagonal system of equations and determine the temperature at the centre and the intermediate points of the cylinder up to 2.44.06.87. One-Dimensional Transient Heat Conduction 181 be modified by changing the coefficients and the following solution is obtained at 2865 s: T2 = 415. Use implicit discretization and take Dr = 0. T3 = 409.40. 9.1 cm. Initially the temperature is uniform at 20°C.24.

 O 'T ÊÉ  'T ÍÌ Ú ÝÜ  6 P   6 P K K Ë / Ì6 P  6 P  6 P   Í K K O K Û 6 P  6 P Ü Ý K K .

B'V where / . ' T .

 È /Ø È /Ø 6 P   6 P 6 P É /   6 P É /    /6 P  Ê O ÙÚ Ê  O ÙÚ K K K K K È / Ø P  È / Ø P  ÙÚ 6    /  .

6 P  ÉÊ /   É/  Ù 6  6P  O K Ê K O Ú K K At node 2 (m = 1) È / Ø P  È / Ø P  ÉÊ /  ÙÚ 6   /  .

6  ÉÊ /  ÙÚ 6 P   6P   At node 3 (m = 2) È / Ø P  È / Ø P  ÉÊ /   ÙÚ 6   /  .

6  ÉÊ /   ÙÚ 6 P   6P .

182 Introduction to Numerical Methods in Chemical Engineering At node 4 (m = 3) È / Ø P  È / Ø P  ÉÊ /   ÙÚ 6   /  .

Using implicit FTCS to discretize. the PDE becomes  . On using LHospitals rule at node 1. 6  ÉÊ /   ÙÚ 6 P   6P 6  6 where T5 = 300°C. we get V T  6KP   6KP  6KP  6KP  6KP  .

 'V 'T .

6KP   6KP  / 6KP  6KP  6KP  .

 / .

6 P   /  .

6 P    / .

we get  / . 6 P K K K  6PK At i = 1.

6P    /  .

6P    / .

we get  /  . 6P   6P where 0 is a hypothetical node to the left of node 1.   . 6 6 P   6P  Since at r = 0. . thus 6P  6P  . T  'T Thus at i = 1.

6P    / .

T5 = 300°C. Thus B'V     /  'T . Ë  /   /   Û P Ì  / Ü Ë6P  Û Ë 6 Û Ì /  /    Ü Ì P  Ü Ì P Ü Ì   Ü Ì6 Ü Ì 6 Ü Ì Ì Ü  /  /    / Ü Ì6 P  Ü Ì 6P Ü Ì  Ü  ÜÌ  Ü Ì Ì Ì P  Ü P / Ü Ì  / Ü Ì6 ÝÜ ÌÍ 6     ÜÝ Í    /   ÌÍ  ÜÝ where the old values are at time n and the computed values are at time n + 1.1 s. 6P 6P 6P 6P  °C.1 cm. 6P   6P The following tridiagonal set of linear algebraic equations is obtained. Dr = 0. Dt = 0. Here a = 105 m2/s.

 .

     P  Ë 6P Ë     Û Ë6 Û Û Ì   Ü 6 P  Ü Ì Ì P Ü Ì   ÜÌ  Ü Ì 6 Ü Ì  Ì Ü Ì P Ü   Ü Ì6P  Ü Ì 6 Ü Ì Ü ÍÌ     ÝÜ ÌÌ6 P  ÜÜ Ì P Ü Í  Ý ÍÌ 6   ÝÜ .

69 264.97 180.2 288.56 0.1 48.36 290.29 55.94 1.3.8 297.1 s.25 1.1 cm.65 102.1 s.49 298.13 299.11 299.38 299.1 can be modified to solve this problem and the results are given in Table 9.48 0.2 s and so on.1 283.6 229. Use implicit discretization and take Dr = 0.97 295. 6P 6P 6P 6P  °C.04 1. List the tridiagonal system of equations and determine the temperature at the centre and the intermediate points of the sphere up to 1. Dt = 0. and a = 105 m2/s.13 291.70 1.48 137.43 0.37 81.71 1.06 289.54 297.90 1.30 145.3 Results in Example 9.4 cm.83 298.17 251.4 174.02 296.51 296.60 299.78 253.09 295.26 297.18 299. One-Dimensional Transient Heat Conduction 183 At time t = 0.05 251.83 273.34 296.40 293.95 298.6 296.28 1.12 298.43 292.36 280.96 295.67 298.5 205.49 1.94 299.18 294.19 299.89 294. and the solution by TDMA is obtained at time t = 0.21 212.93 234.7 297.29 281.4 s.90 146.3 291.09 291. These become the old values for solution by TDMA at t = 0.66 0.85 0.31 234.56 0.22 285.58 298.4 Consider a sphere of radius 0.08 235.8 260.0 278.34 280.64 The number of parts can be increased to obtain a better solution.1 299.2 91.79 275.3 135. EXAMPLE 9. 9.02 1.51 203.0 298.46 298.51 298.91 0.93 299.5 295.84 266.92 285.9 270.55 2.32 289.7 Transient Conduction in Sphere One-dimensional transient heat conduction in a sphere using the implicit method is described in the example below.11 273.3 Time (s) T1 T2 T3 T4 0.4 293.9 298.60 1. Program 9.65 297.7 247. The temperature of the sphere surface is made 300°C at t = 0 s.72 264.42 2.33 183.39 0. Solution The partial differential equation is 6 È  6  6 Ø BÉ  V Ê T  T T ÚÙ .53 286. Table 9.93 211. Initially the temperature is uniform at 20°C.

184 Introduction to Numerical Methods in Chemical Engineering Using the forward in time and central in space implicit difference scheme. we get 6KP   6KP Ë 6 P   6 P   6 P   È 6KP  6KP Ø Û BÌ K  K  K  ÙÜ 'V 'T .

 O 'T ÊÉ  'T ÍÌ Ú ÝÜ  P  6 P   6 P K K Ë / Ì6 P  6 P  6 P   Í K K O K Û 6   6 P Ü Ý K K .

' T . B'V where / .

 È /Ø È /Ø 6 P   6 P 6 P É /  Ù  6 P É /  Ù   /6 P  K K K Ê OÚ Ê OÚ K K È /Ø È /Ø 6 P É /  Ù  6 P É /  Ù  6 P   /  .

6P K Ê OÚ Ê OÚ K K K At node 2 (m = 1) 6P  /  / .

 6P   .

 6P   /  .

 6P At node 3 (m = 2) È /Ø È /Ø 6P  É /  Ù  6P  É /  Ù  6P   /  .

 6P Ê Ú Ê Ú At node 4 (m = 3) È /Ø È /Ø 6P  É /  Ù  6P  É /  Ù  6P   /  .

 6P Ê Ú Ê Ú where T5 = 300°C 6  6 At node 1 the PDE becomes   . we get 6 P   6 P K K  6 P  6 P  6 P  K K K . using the implicit FTCS. V T Again.

 'V 'T .

6KP   6KP  / 6KP  6KP  6KP  .

6 P  / .

 6 P  / .

 6 P   /  .

we get 6P   / . K K K 6PK At i =1.

 6P   / .

 6P   /  .

 6P where 0 is a hypothetical node to the left of node 1.  . thus  and so 6P  6P  . T  'T . 6 6P   6P  At r = 0.

One-Dimensional Transient Heat Conduction 185 Thus at i = 1. we get 6P   / .

 6P   /  .

Dr = 0. 6P 6P 6P 6P  °C.1 cm.  6P The following tridiagonal set of linear algebraic equations is obtained: Ë  /   /   Û Ë P  Û Ë 6P Û Ì   /    /  Ü Ì6 Ü Ì P Ü Ì Ü Ì6 P  Ü Ì 6 Ü Ì /  / ÜÌ  Ü Ì P Ü   /   Ì   Ü Ì6P  Ü Ì 6 Ü Ì ÜÌ Ü Ì P / Ü /  /  Ü ÍÌ6P  ÝÜ Ì   ÌÍ 6     ÜÝ Í  Ý where the old values are at time n and the computed values are at time n + 1. Dt = 0. Thus B'V     /  'T .1 s. T5 = 300°C. Here a = 105 m2/s.

    .

7 279.74 295.16 299. 6P 6P 6P 6P  °C and the solution by TDMA is obtained at time t = 0.68 297.85 0.17 286.75 .17 299.6 267.87 0.60 293.57 189.11 298.25 296.71 0.47 299. Table 9.0 294.33 100.64 298.   P  Ë 6P Ë     Û Ë6 Û Û Ì Ì Ü Ì P Ü Ì     ÜÜ Ì6P  Ü Ì 6 Ü Ì  Ì Ü Ì P Ü   Ü Ì6P  Ü Ì 6 Ü Ì Ü ÍÌ     ÝÜ ÌÌ6 P  ÜÜ Ì P Ü Í  Ý ÍÌ 6   ÝÜ At time t = 0.4 Time (s) T1 T2 T3 T4 0.58 0.4 299.3 298.79 253.37 1.68 298.57 224.55 296.88 299. These become the old values for solution by TDMA at t = 0.64 0.09 291.9 291.41 1.81 299.3 180.71 273.75 289.2 s and so on.2 126.33 283.44 266.48 294.93 227. Program 9.66 246.60 1.1 can be modified to solve this problem and the results are given in Table 9.66 299.83 168.1 296.48 1.92 256.8 286.82 288.2 297.4 Results in Example 9.00 162.5 248.67 297.00 0.27 0.25 299.4.91 298.67 292.22 0.24 270.18 281.67 136.1 s.32 278.1 65.00 297.00 1.55 215.71 73.4 220.

3. 9. In a sphere % È  %  % Ø &É   V Ê T T T ÙÚ . The diffusion coefficient of drug in gel matrix is 3.0 ´ 107 cm2/s. CS = 0. Initial concentration = 68.5. EXAMPLE 9. Solution The radius of the bead is 0.52 mm diameter bead which contains 10 mg of a certain drug in gel matrix.186 Introduction to Numerical Methods in Chemical Engineering 9.3 Example 9.9 mg/cm3 T  r= R F% C =0  FT 0 5 10 Fig.5 Consider a 6. 9.0 s. Take Dt = 1. The drug is immediately swept away once it reaches the bulk solution. 12. that is. The transient diffusion of the drug is given by % È  %  % Ø &É   V Ê T T T ÙÚ The boundary conditions are At r = 0: % t ³0  T At r = R: C = CS = 0 t>0 The initial condition is At t = 0: C = C0 0£r£R Determine the concentration of the drug in the centre of the bead after 3. The schematic diagram of the bead from r = 0 to r = R with  Q 4  10 parts is shown in Fig.8 Transient Diffusion in Sphere One-dimensional transient diffusion in a sphere using the implicit method is described in the example below. and 48 h. Make 10 parts of the radius from r = 0 to r = R.326 cm and the initial concentration of the drug in the  OI bead is =  mg/cm3. 24.

One-Dimensional Transient Heat Conduction 187 Discretizing using FTCS at node i. we get % P   % P § % P   % P   % P  % P  % P · K K & ¨  K  K K ¸¸ K K 'V ¨ 'T  O 'T  'T © ¹ & 'V ª P   P  % P   % P K 'T ¬ %  «   % P   % P  K O K º %   % P » ¼ K K K K .

0 s.0326 cm and Dt = 1. Thus 'V     &      'T    Thus at node i  P  % P   % P K K ª     «% P  % P   % P  ¬ K O K º %   % P » K ¼ K K . Dr = 0.

the PDE at node 0 becomes %  % &  V T Discretizing the above equation at node 0. we get %P   %P & 'V 'T  %  P    %P   %P . § · § · % P ¨   ¸  % P   % P ¨   ¸ % P O O K K K K © ¹ © ¹ Using LHospitals rule.

 %P   %P .

 %  P    %P   % P .

Thus the above equation T  'T becomes  %P   %P .  . and therefore C1 = C1. thus  . % %  % At node 0.

 %   %  .

P   P    %P  % .

%  %  P  P   P   Thus the equation at node 0 is %P   %P  %P At node 1 È Ø È Ø %P  É   Ù  %P   %P  É  Ù %P Ê Ú Ê Ú .

188 Introduction to Numerical Methods in Chemical Engineering At node 2 È Ø È Ø %P  É   Ù  %P   %P  É   Ù %P Ê Ú Ê Ú At node 8 È Ø È Ø %P  É   Ù  %P   %P  É   Ù %P Ê Ú Ê Ú At node 9 È Ø P  È Ø %P  É   Ù  %P   % ÉÊ   ÙÚ %P Ê  Ú  Since C10 = 0. the equation for node 9 becomes È Ø %P  É   Ù  %P  %P Ê Ú The above set of 10 equations (at nodes 0 to 9) can be written in tridiagonal form as Ë   Û Ì Ü Ë% P  Û Ì .

Ì          .

 ÜÌ  Ü Ü Ì%P  Ü Ë %P Û Ì Ì%P Ü Ü Ì    ÜÌ Ü Ì Ü Ì Ü Ì Ü Ì  Ü Ì Ì .

     .

    Ü Ì%P  Ü  ÜÌ Ü Ì% P Ü Ì  Ü .

(Ans: The tridiagonal set of equations is .1 Consider transient heat conduction in a rectangular slab. and a = 105 m2/s. Dt = 0.2 for the solution of the above problem is given in the Appendix. after 12 h the concentration is 26. The total width of the rectangular slab is 1 cm.99 mg/cm3. Program 9. Initially the temperature is uniform at 25°C. The following concentration of drug at the centre of the bead is obtained from Program 9.36 mg/cm3. Ì Ü Ì% P  Ü ÌÍ%P ÜÝ Ì     Ü Í  Ý ÌÍ  ÜÝ Initially %P %P %P %P %P %P %P %P %P %P  mg/cm3.2: after 3 h the concentration is 62.1 s.39 mg/cm3. The temperature of the end-faces of the rectangular slab is made 300°C at t = 0 s. List the tridiagonal system of equations and determine the temperature at the centre and the intermediate points of the slab after 5 s. Use implicit discretization and take Dx = 0. Exercises 9. after 24 h the concentration is 7.73 mg/cm3. and after 48 h the concentration is 0. At the comple- tion of an iteration.1 cm. time is incremented by 1 s.

Use implicit discretization and take Dr = 0.5 cm. and a = 105 m2/s.3 Consider a sphere of radius 0.4) = 228.45 T5 = T(0.81 T2 = T(0.1) = 158.1) = 96.46 T4 = T(0. Use implicit discretization and take Dr = 0. (Ans: The tridiagonal set of equations is P Ë   Û Ë6P  Û Ë 6 Û Ì    Ì Ü P  Ü Ì P Ü Ì Ü Ì6 Ü Ì 6 Ü Ì    Ü Ì P  Ü Ì 6 P Ü Ì Ü Ì6 Ü Ì  Ü Ì   Ì Ü P  Ü Ì P Ü  6 Ì   Ü Ì6 Ü Ì  Ü Ì Ü ÌÍ  ÜÝ ÌÍ6P  ÜÝ Ì 6P   Ü Í  Ý .3) = 166.1 cm. 9. Initially the temperature is uniform at 25°C.0) = 87.5 cm. 9. and a = 105 m2/s.98 T5 = T(0.2) = 122.16. Dt = 0.06 T3 = T(0.0) = 150. (Ans: The tridiagonal set of equations is Ë   Û Ë6 P  Û Ë 6P Û Ì    ÜÌ  Ü Ì P Ü Ì Ü Ì6 P  Ü Ì 6 Ü Ì    ÜÌ  Ü Ì P Ü Ì Ü 6 P  Ì 6 Ü Ì   ÜÌ  Ü Ì P Ü Ì   Ü Ì6P  Ü Ì 6 Ü Ì Ü Ì   Ü Ì P  Ü Ì P  Ü 6 6  ÍÌ  ÝÜ Í  Ý ÍÌ   ÝÜ T1 = T(0.44 T4 = T(0. One-Dimensional Transient Heat Conduction 189 Ë P  Û Ë 6P Û Ë   Û Ì6 Ü Ì P Ü Ì    Ü Ì6 P  Ü Ì 6 Ü Ì ÜÌ  Ü Ì P Ü Ì    Ü Ì6P  Ü Ì 6 Ü Ì Ü    Ü Ì6 P  Ü Ì P Ü Ì Ì  Ü Ì 6 Ü ÌÍ   ÝÜ Ì P  Ü Ì P Ü Í6 Ý Í 6   Ý T1 = T(0.43 T2 = T(0. List the tridiagonal system of equations and determine the temperature at the centre and the intermediate points of the sphere after 5 s.4) = 256.06 Distance (in cm) is measured from the centre. List the tridiagonal system of equations and determine the temperature at the centre and the intermediate points of the cylinder after 5 s.08 T3 = T(0.2) = 179.1 s.3) = 213.1 s. Initially the temperature is uniform at 25°C. The temperature of the sphere surface is made 300°C at t = 0 s. Distance (in cm) is measured from the centre.1 cm. The temperature of the cylinder surface is made 300°C at t = 0 s. Dt = 0.2 Consider a cylinder of radius 0.

The slab is dried from both sides. 9.5 h. 9.25 cm2/h. Dt = 10 s.4) = 28. The temperature of one surface of the wall x = 0 is suddenly raised to 80°C and the right surface at x = 0.2) = 49.25 ´ 105 m2/s. It is known that.01 h.2 cm. List the tridiagonal system of equations and determine the duration of the constant rate period and the distribution of water within the clay at the end of the constant rate period. Use implicit discretization and take Dx = 0. (Ans: The tridiagonal set of equations are P  Ë 6P   Û Ë   Û Ë6 Û Ì   Ü 6 P  Ü Ì Ì P Ü Ì  Ü ÌÌ  ÜÜ Ì 6 Ü Ì Ì P Ü   Ü Ì6P  Ü Ì 6 Ü Ì Ü ÍÌ   ÝÜ Ì6 P  Ü Ì P Ü ÍÌ  ÝÜ ÍÌ 6  ÝÜ T2 = T(0. Z % &  Z (Ans: The solution of the problem is obtained by calculating the time required for the surface concentration to fall to 0.07 Distance (in cm) is measured from the centre.70 T5 = T(0.5 m remains always at 20°C. Use implicit discretization and take Dx = 0.2257 g/cm3.1) = 64. Initially the temperature is uniform at 20°C. and D = 0. Dt = 0.5 m thick.2) = 221.1 m.3) = 37.0) = 200. The partial differential equation is %  % & V Z  and the boundary conditions are: at x = 0 (centre). with the proposed drying conditions.06 T3 = T(0.1) = 205.3) = 245.5 A large flat slab of clay is to be dried.190 Introduction to Numerical Methods in Chemical Engineering T1 = T(0. and a = 1. the drying will occur in the constant rate period at a rate of 0. List the tridiagonal system of equations and determine the temperature distribution throughout the slab after 1 h.4) = 274.66 T4 = T(0.68 T4 = T(0.2257 g of water per cm3.4 Consider a concrete wall 0.21 T2 = T(0. The movement of water within the clay occurs by diffusion. %  and at x = 2 cm. The tridiagonal set of equations is .5 g of water per cm3.88 T5 = T(0.13 Distance (in m) is measured from surface at 80°C.1 g/cm2-h of water as long as the surface moisture concentration remains above 0. is 4 cm thick and has an initial uniform water concentration of 0. This concentration is obtained at 1.72 T3 = T(0.

One-Dimensional Transient Heat Conduction 191 P  Ë %P Ë   Û Ë% Û Û Ì    Ü % P  Ü Ì Ì P Ü Ì ÜÌ  Ü Ì  % Ü Ì Ü Ì Ü Ì Ü    Ì  Ü Ì Ü Ì Ü P  Ì   Ü Ì% Ü Ì % P Ü ÌÍ Ì Ü Ì  Ü   ÜÝ Ì% P  Ü P ÌÍ %  ÜÝ Í  Ý At t = 1.6) = 0.2983 C11 = C(2.2257 Distance (in cm) is measured from the centre.6) = 0.2) = 0.4) = 0.4904 C4 = C(0.8) = 0.0) = 0.4841 C5 = C(0.4947 C2 = C(0.4) = 0.4937 C3 = C(0.4011 C9 = C(1.2) = 0.4738 C6 = C(1.8) = 0.0) = 0.4342 C8 = C(1.4578 C7 = C(1.3563 C10 = C(1.5 h: C1 = C(0.0) = 0. .

10. The temperature in the control volume is uniform and under steady conditions the heat input through all the sides of the control volume is zero. The temperature gradients around the control volume (i. The boundary conditions like convection.1) Z  [  This is an elliptic partial differential equation and the temperature T(x. Around each node a control volume is made.1 Discretization in Two-Dimensional Space Consider a two-dimensional body as shown in Fig. j) may be written as 192 . Therefore the derivatives and have to be evaluated at the Z [ Z [ control volume boundaries. The numerical solution of two-dimensional transient heat conduction is discussed using ADI method. If there is no net accumulation of mass in the body.26)] 6 È  6  6 Ø BÉ  Ù V Ê Z  [  Ú This is a parabolic partial differential equation. The numerical solution of two-dimensional steady heat conduction is carried out by the GaussSeidel. exterior corner with convection. Relaxation techniques are used for the numerical solution of elliptic equations. Two- dimensional transient heat conduction is given by [see Eq. and Alternating Direction Implicit (ADI) methods. then the mass balance equation at a node can be interpreted as indicating that the net mass entering through all the four sides of the control volume is zero. interior corner with convection and insulation are discussed in this chapter. The heat inputs are given by terms 6 6 6 6 like  M# and  M# . It is also called line-by-line TDMA. whereas marching in time is used for parabolic equations. (9. The depth of the body in the z-direction may be taken to be unity. y) must satisfy this equation as well as the boundary conditions along the entire boundary of the plate. RedBlack GaussSeidel.Chapter 10 Two-Dimensional Steady and Transient Heat Conduction Two-dimensional steady heat conduction is given by 6  6   (10. 10. which is an implicit method and is therefore unconditionally stable.1.

Two-Dimensional Steady and Transient Heat Conduction 193 6 6   6   K L K L Z  'Z (10.1 Control volume around node.3) K L K  L Z K   L 'Z  6 6  6  (10. j  1 Dx Fig. j K  L K  L   K L    i.2) K  L  6 6 6  (10.5) K L K L [ K L   '[  i. 10. j + 1 K L    Dy i  1. j i. j i + 1. The second derivatives may be written as 6 6   6  Z  K  L  Z K   L  6   6   6   6  K L K L K L K L .4) K L K L [ K L   '[  6 6 6   (10.

6)  Z Z   Z    'Z 'Z K L K K   6 6   6  [   K L   [ K L     6 K L   6  6  6 K L K L K L  . 6   6   6  K L K L K L (10.

6 K L   6K L   6  K L (10.7)  [ [   [    '[ '[ K L L  L    .

(10.j is updated.1.9) becomes 6KP L  6KPL  6KP L   6KP L 6KPL (10. (10. (1.10). Eq. and is given by 6 P  6 P  X'6 P  (10.9) consist initially of estimated values or known boundary values..1).10).0) and the top right node being (10.0).2 Gauss-Seidel Method In calculating Ti. (0. (10.j the values of the temperatures on the right hand side of Eq. (10.0). However. with the bottom left node being (0.. (2. superseded by a new calculated value. or more than T n+1. we get 6   6   6   6  K L K L K L K L   6 K L   6  K L  or 6   6   6    6  6 K L K L K L K L (10.11) The parameter w is known as the relaxation parameter. in turn. Consider nodes in a two-dimensional space. Now. (0.1).1). this calculated value supersedes the estimated value and is used as the temperature at that point until it is. the values Ti1.0) is updated first followed by node (1. .10).2).. by the time the value of Ti.2). Then.. (1. we get  Z [ 6   6   6  6   6   6    K L K L K L K L K L K L   (10.0). (1.10)  10. Suppose that node (0.10)..2). between Tn and T n+1. (0. as soon as an appropriate temperature at a node is calculated.9)  K L 10.8) 'Z '[ For Dx = Dy. The various cases are described in Table 10.j and Ti. (10. (10.3 Relaxation Parameter The temperature taken at the beginning of an iteration is Tn and the new temperature computed during the iteration is T n+1. for the next iteration the temperature can be taken to be either T n+1.194 Introduction to Numerical Methods in Chemical Engineering  6  6 Discretizing the equation    for any interior node in which the source term is  zero.j1 have already been updated. On using the GaussSeidel method. Thus the latest calculated values of the temperatures are always used in calculating newer and better values.

For overrelaxation the relaxation parameter lies between 1 and 2 and for underrelaxation between 0 and 1. RBRBRBRBRBRBRBRB BRBRBRBRBRBRBRBR RBRBRBRBRBRBRBRB BRBRBRBRBRBRBRBR RBRBRBRBRBRBRBRB BRBRBRBRBRBRBRBR RBRBRBRBRBRBRBRB BRBRBRBRBRBRBRBR Fig.5 Underrelaxation 100 110 115 1. Thus we can carry out one half-sweep updating the red points and then another half-sweep . This method for solution of elliptic PDE is RedBlack GaussSeidel. The other four nodes are called the corner nodes of node (i. 10. 10. west.4 RedBlack GaussSeidel Method When the GaussSeidel method is used. the nodes are processed down the rows (or columns) or the mesh is divided into black and red nodes as shown in Fig. Both GaussSeidel and RedBlack GaussSeidel are pointwise methods. The Alternating Direction Implicit (ADI) method described in the next section is a line-by-line method. it becomes the Gauss Seidel method. The optimum value of w is different for each problem. Two-Dimensional Steady and Transient Heat Conduction 195 Table 10.2 Redblack nodes in two-dimensional space. It has to be determined by hit and trial. Consider again the finite difference equation (10.1 Relaxation parameter values Temperature New Temperature Relaxation Type of taken at the temperature taken at the parameter Relaxation beginning of computed beginning of iteration during iteration next iteration 100 110 110 1 GaussSeidel 100 110 105 0. 10. j).9): 6   6  6  6  6 K L K  L K L K L  K L Red points depend only on the black points and black points depend only on the red points. When w = 1. The surrounding nodes are those nodes which are to the east.2. north and south of a node. The nodes surrounding the black node are all red and the nodes surrounding the red node are all black.5 Overrelaxation The method is convergent only for 0 < w < 2.

10.1 Determine the temperature at various nodes shown in Fig. The two-  6  6 dimensional heat transfer is given by the equation   .3 T2.3 T3.2 20°C 20°C T1. 10. j) is given by 6   6   6   6  6 K L K  L K L  K L   K L Thus P P P    6  6   6  P  P P P  6  6  6   6  P  P P  6  6     6  P  P P P  6  6  6   6  P  P  P P P  6  6  6  6 6  .3.3. The boundary conditions Z  [  are shown in Fig. 10. 400°C T1. This procedure is repeated till the following convergence criterion is satisfied: 6KP L  6KP L  F .1 T3.2 T3.3 Example 10.5 m.3 T1. Thus. Use the Gauss Seidel method. EXAMPLE 10.2 T2. therefore the discretized equation at node (i.1 T2.1 20°C Fig.1 Solution Since all the nodes are interior nodes. The size of the slab is 2 m ´ 2 m and Dx = Dy = 0. the RedBlack GaussSeidel method is the one in which the red nodes are updated using black nodes and then the black nodes are updated using the updated red nodes.196 Introduction to Numerical Methods in Chemical Engineering updating the black points with the new red values.

2.25 T1.2 = 115. The iterations are performed till there is no change in P  P the value of temperature 6K L  6K L  F .32 T3.3 = 182.14 T1. To start the iteration.14 T2. The body is very long so that heat transfer takes place in two dimensions only.21 W/m-K. Take 'Z '[ m. The converged solution is T1.86 T2.4. some initial values of all the nine variables are assumed and thereafter their latest values are used to update the solution.86 EXAMPLE 10.2 = 91.1 = 57.1 = 47. Program 10.3 = 220.3 = 182.1 = 47. Two-Dimensional Steady and Transient Heat Conduction 197 P  P  P P  6  6  6   6  P  P P    6  6   6  P  P  P P  6  6  6   6  P  P  P    6  6   6  Note that the coefficient of the term on the left hand side is the highest among all the other coefficients in the linear algebraic equation.00 T3. That is why convergence is obtained when the GaussSeidel method is used for solving the above set of linear algebraic equations.2 = 91.25 T2.2 Consider the following body in which the inner face is at 200°C and the outer face is at 100°C.  3m 1m 3m 1 1m 200°C 100°C 2 5 4 3 Fig.4 Example 10.18 T3. The thermal conductivity of the body is 1. 10. .1 for the solution of the above problem is given in the Appendix. 10. The dimensions of the  body are shown in Fig.

T5 = 145. B4 = 220°C.83°C. we get 6P   6P   6P   6P   6P   6P   6P   6P   6P   6P   6P   6P    6P   On modifying the Program 10.83°C. B3 = 90. T3 = 120. The size of the slab is 2 m ´ 2 m and Dx = Dy = 0. 10. Solution Since there is no source term. The boundary conditions are shown in Z  [  the figure.198 Introduction to Numerical Methods in Chemical Engineering Using the GaussSeidel method. Use the RedBlack Gauss Seidel method.3 Determine the temperature at various nodes shown in Fig. the following solution is obtained: T1 = 145.67°C. 10. Now we compute values at the red nodes using the assumed values at the black nodes. B2 = 90.5 m. 400°C R4 B4 R5 B2 R3 B3 20°C 20°C R1 B1 R2 20°C Fig.5 Example 10.1. Solution Before starting the iterations the following initial values of temperatures at the black nodes are assumed: B1 = 55.5.         4 q%   . T4 = 141. solve for the temperatures at nodes 1 to 5.3. T2 = 141.83°C. The heat  6  6 transfer is given by the equation   . EXAMPLE 10.67°C.

j) of a convection boundary as shown in Fig. we get: B1 = 56.80. j  1 Dx Fig. 6KP L  6KP L  F . Updating the black nodes using updated red node values. B2 = 90.6 Convection boundary condition.   6  6 EXAMPLE 10.  Z  [  T¥ h i. R5 = 182. Note that even after two iterations the temperatures are close to the converged values obtained using the GaussSeidel method in Example 10. Two-Dimensional Steady and Transient Heat Conduction 199         4 q%           4 q%           4 q%           4 q%   Now let us update the black node values using the updated values at the red nodes. B4 = 219.4 Discretize the equation   at node (i. B3 = 90.88°C. R2 = 46. 10.375. . 10. R4 = 182. j i. we get: R1 = 46.578.6.938. j Dy dq3 Convection boundary Dx 2 i. R3 = 114.938.994.1. The iterations are performed till there is no change in the value of temperature.578°C.80.        \$ q%         \$ q%         \$ q%         \$ q%  Updating the red nodes using the updated black node values. j + 1 dq1 dq4 dq2 i  1.

the summation of S entering the control volume from all the four sides is FS 6 FS 6 zero. j) are FS 'Z È 6 6  Ø M  K L K L FV  ÉÊ '[ ÙÚ FS È6 6 Ø  M '[ É  K L K  L FV Ê 'Z ÙÚ FS 'Z È 6 6  Ø M  K L K L FV  ÉÊ '[ ÙÚ FS FV J '[ 6  6  K L . and from top and bottom. From the left and right sides.  M# .  M# . The various energy inputs into the control volume around node (i.200 Introduction to Numerical Methods in Chemical Engineering Solution The given differential equation is at steady state and therefore in the control volume around node (i. the depth is taken to be unity. j). FV Z FV [ To determine the area for heat transfer into the control volume.

Thus. j . from the energy balance at node i.

. we get FS FS FS FS     FV FV FV FV Thus 'Z § 6 6 · §6 6 · 'Z § 6 6 · J '[ 6  6f .

the equation becomes M  6  6  .   M ¸  M '[ ¨ ¸M K L K L K L K  L K L K L ¨ ¨ ¸  © '[ 'Z  © '[ K L ¹ © ¹ ¹ where T¥ is the free stream temperature of the surrounding fluid and h is the convective heat transfer coefficient between the convection boundary surface and fluid. If Dx = Dy.

 M 6  6  .

 M 6  6  .

 J 'Z 6  6f .

we get 6    6  K L K L   6 K L  .j on one side and the rest of the terms on the other side. K L K L  K L K  L K L K L  K L Collecting the terms of Ti.

 \$K6f 6 \$K   K L where the Biot number is given by J 'Z \$K M An equation of this type is applicable for each node along the convection boundary surface. .

10. 10.7 Exterior corner with convection boundary condition. we get '[ § 6 6 · 'Z § 6 6 · 'Z '[ M  © ¨ K L 'Z K  L ¸M  © ¨ K L '[ K L  ¸ J  6 K L  6f . T¥ h i  1. Two-Dimensional Steady and Transient Heat Conduction 201  6  6 EXAMPLE 10. j i. Solution From the energy balance at node (i. j  1 i  1.5 Discretize the equation   at node (i. j  1 Dx Fig.7. j T¥ h Dy Dx 2 i. j) of an exterior corner Z  [  with convection boundary condition as shown in Fig. j).

 J  6K L  6f .

If Dx = Dy. ¹ ¹ where T¥ is the free stream temperature of the surrounding fluid and h is the convective heat transfer coefficient between the convection boundary surface and the fluid. the equation becomes M   6 K L 6 K  L .

 M 6 K L 6 K L  .

J 'Z 6 K L  6f .

we get  6   6  K L K L  . Collecting the terms of Ti. j on one side and the rest of the terms on the other side.

6 Discretize the equation   at node (i. j) of an interior corner Z  [  with the convection boundary condition as shown in Fig.8. 10.  \$K6f 6 \$K   K L  6  6 EXAMPLE 10. .

8 Interior corner with convection boundary condition. j).202 Introduction to Numerical Methods in Chemical Engineering i. j Dy Dx T¥ h 2 i. Solution From the energy balance at node (i. 10. we get '[ § 6 6 · §6 6  · §6 6 · 'Z § 6 6  · M ¸  M 'Z ¨ ¸  M '[ ¨ ¸M K L K  L K L K L K L K  L K L K L ¨ ¨ ¸  © 'Z ¹ © '[ ¹ © 'Z ¹  © '[ ¹ 'Z '[ J  6  6f . j + 1 i  1. j  1 Dx Fig. j i + 1. j i.

 J 6  6f .

K L  K L where T¥ is the free stream temperature of the surrounding fluid and h is the convective heat transfer coefficient between the convection boundary surface and the fluid. Taking Dx = Dy and dividing by k. we get   6K L  6  K L .

  6 K L 6 K L  .

 6 K L 6 K L   6   6  K L K L  \$K 6   6f .

we get 6K L  6 K  L   6  K  L 6 K L  . K L Collecting the terms of Ti. j on one side and the rest of the terms on the other side.

10.  \$K6f 6 \$K   K L 6  6 EXAMPLE 10. j) of an insulation Z  [  boundary as shown in Fig.9. .7 Discretize the equation   at node (i.

j + 1 i  1. j). Solution The given differential equation is at steady state and therefore in the control volume around node (i. There is no heat flux across the insulation boundary. the equation becomes    6 K L 6 K L  . j Dy i. j) the summation of S entering the control volume from all the three sides is zero. From the energy balance at node (i. 10. j Insulation boundary Dx 2 Dx Fig. Two-Dimensional Steady and Transient Heat Conduction 203 i. we get 'Z È 6 6  Ø È 6   6  Ø 'Z È 6   6   Ø M ÙÚ  M '[ ÉÊ M  K L K L K L K L K L K L  ÉÊ '[ 'Z Ù Ú  ÉÊ '[ ÙÚ If Dx = Dy.9 Insulation boundary condition.

 6 K L  6   K L  6  6 K L K L  .

we get 6   6  6  6 K L K L K L  K L Note that the insulation boundary equation is obtained by setting h = 0 in the equation for convection boundary.  Collecting the terms of Ti. j on one side and the rest of the terms on the other side. 10. The left face is maintained at Z  [  . The  6  6 steady heat transfer is given by the equation   .8 Determine the temperature at various nodes shown in Fig. EXAMPLE 10.10.

2 T3. These convection boundary conditions have been described in previous examples. Use the GaussSeidel method.  At the interior nodes the discretized equation is 6   6  6  6  6 K L K  L K L K L  K L At nodes T1. 500°C T1. Thus the following nodal equations are obtained: P 6P     6 P      .3 h = 10 W/m2-K 100°C T1. The convective heat transfer coefficient between the right and bottom walls to the surrounding fluid is 10 W/m2-K.  Solution 'Z '[ m.1 T3.1 2 T¥ = 100°C h = 10 W/m -K Fig.2. T2.1 T2.2 T2.3 T3.10 Example 10.1 the exterior corner convection boundary condition exists.3 the convection boundary condition exists.204 Introduction to Numerical Methods in Chemical Engineering 100oC and the top face at 500°C.8.1. The block is 1 m ´ 1 m. T3. while the other two faces are exposed to an environment at 100oC. 10.2 T¥ = 100°C T1.1.3 T2. and T3. and at node T3.

6      P  P P P  6  6    6 6  P  P P    6    6 6   P  P 6   6P  6 P    .

6    P  P P  P P  6  6  6  6 6  P  P  P P    6  6  6 6  .

Two-Dimensional Steady and Transient Heat Conduction 205  P  P  6 P   6  .

 6    P  P  6 P    6 P  6  .

  6    P  P  6 P    6    .

1 = 175.68 T2. Dx = Dy = 1 cm. some initial values of all the nine variables are assumed and thereafter their latest values are used to update the solution.1 = 184.9. k = 15 W/m-K.11 Example 10. The iterations are performed till there is no change in the value of the temperature at the given node.3 = 309.3 = 330.9 For the L-shaped body shown in Fig.1 can be modified for the solution of this problem.2 = 217. The heat transfer coefficient between the top surface and the ambient air is 75 W/m2-K. 1 2 3 h = 75 W/m2-K T¥ = 25°C Dy = 1 cm Insulated 4 5 6 7 8 9 Heat flux 4500 W/m2 Surface at 90°C Dx = 1 cm Fig.2 = 192. .  .25 T3. 6KP L  6KPL  F . determine the temperatures at  6  6 nodes 1 to 9.1 = 157.51 T3. 10. The thermal conductivity of the body. Program 10. Steady heat conduction takes place in the body.03 T3. The converged solution is (all T in °C) T1. The right surface is subjected to uniform heat flux of 4500 W/m2.   6    Note that the coefficient of the term on the left hand side is the highest among all the other coefficients in the linear algebraic equation and that is why convergence is obtained when the GaussSeidel method is used.11.34 T2. The left surface  Z  [  is insulated and the bottom surface is at a uniform temperature of 90°C. To start the iteration. that is.2 = 231. The entire top surface is subjected to convection to ambient air at 25°C.32 T1.3 = 280.01 T1.32 EXAMPLE 10. 10.65 T2.

206 Introduction to Numerical Methods in Chemical Engineering Solution Equation for node 1: 'Z § 6  6 · '[ § 6  6 · 'Z M ¨ ¸M J 6  6f .

 © '[ ¹  ¨© 'Z ¸¹  M 6  6 .

 M 6  6 .

J'Z 6  6f .

J 'Z 6  6  6  6  6  6f .

M  Thus the equation for node 1 becomes 6  6  6   6f .  M J 'Z    where  .

therefore 6  6   6  Equation for node 2: '[ § 6  6 · '[ § 6  6 · § 6  6 · M ¨ ¸ M ¨ ¸  M 'Z ¨  ¸ J 'Z 6  6f .  The coefficient of T1 is the highest.

 © 'Z ¹  © 'Z ¹ © '[ ¹   J 'Z 6  6 .

 6  6 .

 6  6 .

6f  6 .

  M  6  6 .

 6   6  Equation for node 3: '[ § 6  6 · 'Z § 6  6 · 'Z '[ M ¸  M  ¨ '[ ¸ J 6  6f .

 J 6  6f .

 ¨© 'Z ¹ © ¹   6  6 6  6 J 'Z  6f  6 .

  M  6  6 .

  6  Equation for node 4: 'Z § 6  6 · 'Z § 6   · § 6  6 · M ¨ ¸M ¨ ¸  M '[ ¨ ¸   © '[ ¹  © '[ ¹ © 'Z ¹ 6  6 6     6  6    6  6   6  .

Two-Dimensional Steady and Transient Heat Conduction 207 Equation for node 5: § 6  6 · § 6  6 · § 6  6 · § 6  6 ·  M '[ ¨  ¸  M '[ ¨  ¸  M 'Z ¨  ¸  M 'Z ¨ ¸  © 'Z ¹ © 'Z ¹ © '[ ¹ © '[ ¹ 6  6  6   6  Equation for node 6: 'Z § 6  6 · § 6  6 · § 6  6 · '[ § 6  6 · M ¨ ¸  M '[ ¨ ¸  M 'Z ¨ '[ ¸  M  ¨ 'Z ¸  © '[ ¹ © ' Z ¹ © ¹ © ¹ 'Z '[ J 6  6f .

 J 6  6f .

  6  6 6  6 J 'Z  6  6  6  6   6f  6 .

  M 6     6  6 .

  6  Equation for node 7: '[ § 6  6 · '[ § 6  6 · § 6   · M M  M 'Z ¨  ¸ J 'Z 6  6f .

 ¨© 'Z ¸¹  ¨© 'Z ¸¹ © '[ ¹   J 'Z 6  6 .

 6  6 .

 6   .

6f  6 .

  M  6  6 .

    6  Equation for node 8: '[ § 6  6 · '[ § 6  6 · § 6   · M ¨ ¸ M ¨ ¸  M 'Z ¨  ¸ J 'Z 6  6f .

 © 'Z ¹  © 'Z ¹ © '[ ¹   J 'Z 6  6 .

 6  6 .

 6   .

6f  6 .

  M  6  6 .

    6  Equation for node 9: '[ § 6  6 · 'Z § 6   · '[ 'Z M ¨ ¸ M ¨ ¸   J 6  6f .

 © 'Z ¹  © '[ ¹      '[ J 'Z 6  6 .

 6   .

 6f  6 .

    M 6   6  .

86.27. The ADI method is also called the line-by-line j+1 Sweep direction j Sweep direction i i+1 (a) First half-step of iteration (b) Second half-step of iteration Fig.8)] 'Z  '[  This equation can be split into the following two half-steps:    P P P 6   6    6  È 6 P   6 P  6 P  Ø K L K L K L É K L Ù K L K L (10.54°C.12). The converged solution is: T1 = 83.12)  'Z Ê '[  Ú È P  P   P Ø 6KP L  6KPL  6KP L É 6   6   6  Ù   É Ù (10. T8 = 87. T7 = 86.13) K L K L K L   '[ É ' Z Ù Ê Ú The first half-step is executed on all the nodes. we get 6   6 6 6   6 6  K L K L K  L  K L K L K L  [see Eq. 10.12 First half-step and second half-step in ADI iteration. .1 can be modified for the solution of this problem.5 ADI Method for Steady Heat Conduction The Alternating Direction Implicit (ADI) method can also be applied for the solution of the two-dimensional steady heat conduction equation (10.26. 10.78.19. T3 = 81.step on all the nodes (see Fig. 10.1)  6  6   Z  [  Using the central difference scheme.72. (10. T4 = 86. This is followed by computation of the second half. and T9 = 88.43.208 Introduction to Numerical Methods in Chemical Engineering Program 10. T6 = 85. T5 = 86.49. T2 = 82.

10.5 m. (10.0 20°C Fig. in which the sweep direction is along the x-axis and each line of nodes along the x-axis is updated.12) is considered for the first half of iteration.1 T3.1 T1. ADI is a line-by-line method. The heat  6  6 transfer is given by the equation   .4 T2.4 T1. whereas Gauss Seidel is a pointwise method.0 T3.1 T0. The size of the slab is 2 m ´ 2 m and Dx = Dy = 0. (10. 10. and thus the values of nodes along a line are updated.13 Example 10. The iterations are performed till convergence in temperature is achieved.2 20°C T0.3 T1. Two-Dimensional Steady and Transient Heat Conduction 209 TDMA.3 T4.10 Determine the temperature at various nodes shown in Fig.0 T2.10. TDMA can be used to solve them.2 20°C T1.4 T3.2 T3. Solution The first half iteration is performed (scanning various i nodes for given j) using the discretized equation    P P P 6   6   6   6 P   6 P   6 P   K L K L K L K L K L K L 'Z  '[  Since Dx = Dy. Initially.3 T3. 6KP L  6KPL  F .13. as in each line of nodes taken a tridiagonal set of linear algebraic equations is formed. the discretized equation becomes    P P P 6   6   6  K L K L K L   6 P   6 P  K L K L At node 1.1 T4. EXAMPLE 10.3 T2. Then Eq.13) is considered for the second half of iteration.1 T2. Use the ADI method. in which the sweep direction is along the y-axis and each line of nodes along the y-axis is updated. Eq.3 T0.13.2 T4. 400°C T1. The boundary conditions are shown in Z  [  Fig.1    P P P P P 6   6   6   6  6 . 10.2 T2.

Now let us write the equations for various i nodes at j = 2.1 is always at 20°C. T3. the above equation becomes    P P P  P P 6  6   6   6  6         At node 2.71. 6  = 46.1 is always at 20°C. Since T0. At node 1.2 = 90. the above equation becomes    P P P P P 6   6   6   6  6         At node 2.43°C.1    P P P    P P 6  6  6  6  6    P P P  P P 6  6   6   6  6       At node 3.43. Since T0.3 = 220.2 is always at 20°C. T2.2    P P P P P 6   6   6   6  6 Let us assume the following initial temperatures: T1. T3. 6  = 55. T2.2 = 110.3 = 180.2 = 90.1    P P P P P 6   6   6   6  6    P P P    P P 6  6  6  6  6 Since T4.210 Introduction to Numerical Methods in Chemical Engineering Let us assume the following initial temperatures: T1.2    P P P P P 6   6   6   6  6    P P P P P 6   6   6   6  6       .3 = 180. the above equation becomes    P P P P P 6   6   6   6  6         The following tridiagonal set of linear algebraic equations is obtained for various i nodes at j=1 Ë P  Û  Ë    Û Ì6 Ü Ë  Û Ì   ÜÜ Ì6  Ü P  Ì  Ü Ì Ì Ü Ì Ü ÌÍ    ÜÝ Ì6 P   Ü ÌÍ  ÜÝ Í  Ý    P P P The solution by TDMA is 6  = 46.

At node 1. 6  = 90.3 is always at 20°C.98.3    P P P P P 6   6   6   6  6 Since T0.3 is always at 20°C. Now let us write the equations for various i nodes at j = 3.3    P P P P P 6   6   6   6  6    P P P P P 6   6   6   6  6 Since T4.2    P P P    P P 6  6  6  6  6    P P P P P 6   6   6   6  6 Since T4. the above equation becomes    P P P P P 6   6   6   6  6         .10. the above equation becomes    P P P   P  P 6  6  6  6  6         The following tridiagonal set of linear algebraic equations is obtained for various i nodes at j = 2: Ë P  Û  Ë    Û Ì6 Ü Ë Û Ì   ÜÜ Ì6  Ü ÌÌ ÜÜ P  Ì Ì Ü ÍÌ    ÝÜ Ì6 P   Ü ÍÌ ÝÜ Í  Ý    P P P The solution by TDMA is: 6  = 90. 6  = 113. Two-Dimensional Steady and Transient Heat Conduction 211 At node 3. the above equation becomes    P P P   P P 6  6  6  6  6         At node 2.3    P P P P P 6   6   6   6  6    P P P    P P 6  6  6  6  6       At node 3.10°C.2 is always at 20oC.

6  = 182. the above equation becomes P  P  6  6         The following tridiagonal set of linear algebraic equations is obtained for various j nodes at i = 1: P  Ë    Û Ë6 Û Ë  Û Ì   Ü 6 P  Ü Ì  Ü Ì Ì Ü Ì  Ü Ì Ü ÌÍ    ÜÝ ÌÌ6 P  Ü ÌÍ  ÜÝ Í ÝÜ .3 P  P  P  P  P  6  6  6  6   6  Since T1. 6  = 219.72.46. The second half iteration (scanning various j nodes for given i) is performed using the discretized equation    P P P 6K L  6K L  6   6 P   6 P   6 P    K L K L K L K L  'Z '[  Since Dx = Dy. the above equation becomes   P P P  P  P  6  6  6  6   6          At node 1.212 Introduction to Numerical Methods in Chemical Engineering The following tridiagonal set of linear algebraic equations is obtained for various i nodes at j = 3: Ë P  Û  Ë    Û Ì6 Ü Ë  Û Ì   ÜÜ Ì6  Ü ÌÌ  ÜÜ P  Ì Ì Ü ÌÍ    ÜÝ Ì6 P   Ü ÌÍ  ÜÝ Í  Ý    P P P The solution by TDMA is: 6  = 182.46°C.2   P P P  P  P  6  6  6  6   6  P  P  P  6  6  6       At node 1.4 is always at 400°C.0 is always at 20°C. the discretized equation becomes   P P 6 P   6 P   6 P  K L K L K L  6   6  K L K L At node 1.1   P P P  P  P  6  6  6  6   6    P P P  P  P    6  6  6  6  6 Since T1.

4 is always at 400°C.87. the above equation becomes   P P P  P  P    6  6  6  6  6         At node 3. 6 = 182.0 is always at 20°C. At node 3.0 is always at 20°C. the above equation becomes   P P P  P  P  6  6  6  6   6          At node 2.2   P P P  P  P    6  6  6  6  6 P  P  P  6  6  6       At node 2. 6 = 219. At node 2.63.1   P P P  P  P  6  6  6  6   6    P P P  P  P    6  6  6  6  6 Since T2.63°C.1   P P P  P  P    6  6  6  6  6   P P P  P  P  6  6  6  6   6  Since T3.41. Two-Dimensional Steady and Transient Heat Conduction 213 P  P  P  The solution by TDMA is: 6 = 46.2   P P P  P  P  6  6  6  6   6  P  P  P  6  6  6       . 6 = 114.81. 6 = 90. the above equation becomes P  P  6  6         The following tridiagonal set of linear algebraic equations is obtained for various j nodes at i = 2: P  Ë    Û Ë6 Û Ë  Û Ì   Ì P  Ü Ì ÜÜ Ì6 Ü Ì  Ü Ì Ü ÌÍ  Ì Ü   ÜÝ Ì6 Ü P  ÌÍ  ÜÝ Í Ý P  P  P  The solution by TDMA is: 6 = 56.3   P P P  P  P  6  6  6  6   6  Since T2.88°C.

The explicit schemes are stable only with some constraints on Dx and Dt.16.32. 6 = 91.03.2 = 115.2 = 91. whereas implicit schemes are not associated with these constraints.1 in which the problem was solved using the GaussSeidel method.00. Program 10.25. T1.3   P P P  P  P    6  6  6  6  6 Since T3. T2.14. the above equation becomes P  P  6  6         The following tridiagonal set of linear algebraic equations is obtained for various j nodes at i = 3: P  Ë    Û Ë6 Û Ë Û Ì   Ü 6 P  Ü Ì Ü Ì Ì Ü Ì  Ü Ì Ü Ì P  Ü Ì ÍÌ    ÝÜ Ì6 Í ÜÝ Í  ÝÜ P  P  P  The solution by TDMA is: 6 = 46. (9. Therefore the ADI method.14. T2.1 = 57. the results from the computer program are: T1.86°C.2 = 91.6 ADI Method for Transient Heat Conduction The ADI method can be extended for the solution of two-dimensional transient heat conduction.25. T2.4 is always at 400°C. we get  È P    Ø P P P 6   6 P P P P É 6   6   6   6    6    6  Ù K L K L BÉ K L K L  K L K L K L K L Ù (10.3 =220. T1. which is an implicit method shall be used. 6 = 182.97. Transient heat conduction in two-dimensional space is given by [see Eq.3 = 182. T3. 10.214 Introduction to Numerical Methods in Chemical Engineering At node 3. T3.86. T3.14) 'V   É 'Z  '[  Ù Ê Ú B'V Letting D = Dx = Dy and / .26)] 6 È  6 6 Ø BÉ  Ù V Ê Z  [  Ú Taking the first half-step in time.2 for the solution of the above problem is given in the Appendix.73°C. we get ' .1 = 47.3 = 182.1 = 47. After 25 iterations when convergence is obtained. Similar results are obtained in Example 10.

Sweeping of each line along the x-axis is carried out from bottom to top.21) Ê /Ú K L K L K L ÊÉ / Ú ADI is an implicit method and is therefore unconditionally stable.16) /ÊÉ K L K L ÙÚ K L K L K L K L    P È  Ø P P È Ø 6   É   Ù 6    6  6 P   6 P   6 P É  Ù (10. . In this equation. This temperature profile at t + Dt can be used to obtain the temperature profile at t + 2Dt by again carrying out the first half and the second half of the iteration.19)  ÉÊ ÙÚ  Multiplying both sides by . Thus marching in time is carried out for this parabolic PDE.21) is considered for the second half of the iteration. The sweeping of each line along the y-axis is carried out from left to right and the temperature profile at time t + Dt is computed. we get /      È P  P Ø P P P É 6K  L  6K L  Ù 6KPL  6KP L  6KP L  6K L   6K  L  6K  L  (10. moreover.17) K Ê L /Ú K L K L K L K L Ê/ Ú K L Now let us carry out the second half of the iteration  È P    Ø P P P 6KPL  6  P  P  P  É 6   6   6   6    6    6  Ù   K L BÉ K L  K L Ù K L K L K L K L (10. In this equation.15)  ÉÊ ÙÚ  Multiplying both sides by . TDMA can be used to update the temperature for nodes in a line. Then  P Eq. (10.18) 'V   É 'Z  '[ Ù Ê Ú     P / È P  P P P Ø 6KPL  6K L  6 É K L   6 P  K  L   6 P  K L  6   6   6  K  L K  L K L Ù (10. 6  are known and 6 P  are computed.20) / ÉÊ ÙÚ    È Ø P P P È Ø 6KP L  É   Ù 6 P   6 P  6K L  6K L  6   Ù (10.17) is considered for the first half of the iteration. we get /      È P  P Ø P P P É6   6  Ù 6K L  6K L  6    6 P   6 P   6 P (10. because it is a line-by-line method. Initially Eq. Tn is the P temperature at time t and 6  are the updated temperatures computed in this first half of iteration. Two-Dimensional Steady and Transient Heat Conduction 215     P / È P  P P Ø 6K L   6KP L 6 É K  L  6   6   6 P K  L K L P P K  L   6K L   6K  L Ù (10. (10.

Solution The upper quadrant of the slab is shown in Fig. Determine the temperature of the slab at various nodes at t = 0.1 m. (10.1) (11. 10.1)   P P   P P At node (1. '  / / 400°C (1. using Eq.17) and from symmetry 6 6 .1). therefore D = Dx = Dy = 0.11 A slab of size 2 m ´ 2 m is initially at 0°C. and at t = 0 all the four sides of the slab are made at 400oC.17) and from symmetry 6 6 .14 Upper quadrant of slab in Example 10.11) (11. The size of the quadrant is 1 m ´ 1 m and 10 parts along an axis are made. Thus    and    .05 s and for computing consider the upper quadrant of the slab.1).5 s.1). Let us take B'V    't 0. therefore /    .1) to node (10.11. (10.216 Introduction to Numerical Methods in Chemical Engineering EXAMPLE 10. 10.11) 6 400°C  Z (1.1) 6  [ Fig. First half of iteration Equations for node (1.05 s. we get    P P P  P P 6  6   6  6  6 P P At node (3.14. Take D = Dx = Dy = 0.1 m and a = 1 m2/s. Take Dt = 0. using Eq. (10.17) and from symmetry 6 6 and 6 6 . we get   P P  P P 6  6  6  6 P P At node (2. using Eq. we get    P P P P P 6   6   6  6  6 .

using Eq. Equations for node (1. (10. (10. using Eq. Equations for node (1.10) using Eq. using Eq.2 = 400.10).1).2). we get    P P P P P 6   6 6  6  6 In the above equation on the right hand side. T11. (10.10)   P P At node (1.2) to node (10. we get    P P P P P P 6  6  6 6  6  6 At node (10. using Eq.2)   P P At node (1.2). (10. (10. using Eq.17).10).17) we get    P P P P P P 6  6 6  6  6  6 . and from symmetry 6 6 .17). we get   P P P P P 6  6 6  6  6 At node (2.17). using Eq.17). The above set of 10 equations constitute a tridiagonal matrix and can be solved using TDMA. we get    P P P P P P 6   6 6  6  6  6 In the above equation on the right hand side.10) to node (10.2). (10.17). we get    P P P P P P 6  6  6 6  6  6 At node (3.17) and from symmetry 6 6 . (10. we get    P P P P P P 6   6   6  6  6  6 At node (3.2).17).1 = 400. we get   P P P P P 6   6  6  6  6 At node (2.17) and from symmetry 6   6 . we get    P P P    P P P 6  6  6 6  6  6 At node (10. T11.10). The above set of 10 equations constitute a tridiagonal matrix and can be solved using TDMA. (10. (10. using Eq. Two-Dimensional Steady and Transient Heat Conduction 217 P P At node (10. using Eq.

The above set of 10 equations constitute a tri-diagonal matrix and can be solved using TDMA. we get    P P P P  P  P  6  6  6 6   6   6  At node (2.10)   P P P P At node (1.11 = 400 and T11.10). using Eq. using Eq. (10. using Eq.21) and from symmetry 6 6 .21) and from symmetry 6 6 . using Eq.1). using Eq.3).2). we get   P P P  P  P    6  6  6 6  6 P P At node (1.21). using Eq. (10. we get   P P P  P    6  6 6  6 P P At node (1.21) and from symmetry 6  6 . (10. The above set of 10 equations constitute a tridiagonal matrix and can be solved using TDMA. Equations for node (2. (10.1) to node (2. we get    P P P P  P  P  6  6 6  6  6  6 .218 Introduction to Numerical Methods in Chemical Engineering In the above set of equations on the right hand side. we get   P P P  P  P  6  6 6  6  6 In the above equation on the right hand side.2). (10. (10. (10. using Eq. T1.10 = 400.10). using Eq. Ti.10)   P P At node (2.11 = 400. we get    P P P P  P  P     6  6  6 6  6  6 At node (2. (10. we get   P P P  P  P    6  6  6 6  6 P P At node (1.21).21) and from symmetries 6  6  and 6 6 .3).21) and from symmetry 6 6 . we get    P P P P  P  6  6 6   6   6  At node (2.21).1). Second half of iteration Equations for node (1.1) to node (1.

09 T3.1 = 329.85 T4.11 T1. The above set of 10 equations constitute a tridiagonal matrix and can be solved using TDMA.9 = 380.81 T4.3 = 336. The temperatures (in °C) at t = 0.43 T5. using Eq.3 = 330.19 T2.5 = 349.58 T5.39 T2.10 = 389.61 T1. using Eq.77 T5.29 T5.10 = 390.4 = 350.10 T1.31 T3.61 T4.3).5 s are presented in Table 10.96 T4.6 = 360.6 = 350.10)   P P At node (2.64 T2.10 T3.71 T1.59 T4.6 = 332.20 T1.83 T2.10).6 = 355.70 .i = 400 and T10.54 T3.1 = 331.11 = 400. The above set of 10 equations constitute a tridiagonal matrix and can be solved using TDMA.7 = 358.8 = 370. T2.9 = 376.9 = 378.2 Temperatures in Example 10. we get    P P P P  P  P  6  6  6 6  6   6 At node (2.42 T2. using Eq.2 = 345.4 = 344.80 T4.2 = 339. we get    P P P P  P  6  6 6  6   6 At node (2.8 = 364.64 T1.10 = 388.30 T3. Two-Dimensional Steady and Transient Heat Conduction 219 In the above equation on the right hand side.3 = 341.80 T1.10 T4.68 T3.2 = 334.65 T5.1 = 334.7 = 355.70 T3.9 = 382.1 = 339. Note that for both the first-half and second-half iterations the tridiagonal matrix that is formed has the following coefficients: C C C C C C C C C  D D D D D D D D D D  E   E E E E E E E E   Program 10.33 T2.80 T2.77 T2. (10.49 T5.02 T2.5 = 341.60 T5.11 = 400. (10.7 = 362.4 = 340.94 T3. we get    P P P P  P  P  6  6 6  6  6  6 In the above set of equations on the right hand side.6 = 347.01 T5.34 T2.68 T1.86 T4.1) to node (10.21 T4. T11.10 = 367.2 = 329.5 = 331.2).8 = 374.3 = 347.21).1 = 345.1). we get    P P P P  P  P  6  6  6 6  6   6 At node (2.22 T3.82 T5.21).5 = 344.4 = 330.4 = 336.5 = 354.85 T3.2. Equations for node (10.9 = 349. (10.3 for the solution of the above problem is given in the Appendix.7 = 335.3 = 333. Table 10.8 = 367.21).8 = 340.21) and from symmetry 6 6 .10 = 389.86 T1.39 T5. (10. using Eq.76 T4.7 = 366.2 = 331.25 T1.

4 = 357.16 T9.8 = 381. T2 = 437.60 T6.71 T10.9 = 390.98 T10.2 75°C 50°C T1.18 T7.1 T3.96 T9.6 = 386.7 = 388.81 T8. 3 and 4 shown in Fig.5. 10. (Ans: T1 = 487.5 W/m-K.47 T6.90 T9.4 = 372.15 Exercise 10.8 = 377.54 T9.52 T7.59 T10.2 T3.10 = 394.80 T9.7 = 381.98 T7.6 = 371.7 = 371.37 T7.6 = 391.5 = 390. T3 = 362.2.5. determine the temperatures at positions 1.2 = 388.60 T8.25 T10.8 = 391.1 = 381.37 T8.9 = 387.42 T8.86 T10.27 T6.9 = 385. 100°C T1.47 T6.16 T10. 10.38 T8.10 = 391.10 = 396.3 = 370.1 T2.2 Using the Gauss-Seidel method. 10. The thermal conductivity of aluminium is 0.17 T6.07 T10.3 T1.22 T9.31 T10.5 = 384.96 Exercises 10.63 T9.3 = 354.4 = 364.6 = 378.4 = 389.88 T6.6 = 365.10 = 397.2 = 353.35 T7.3 = 388.49 T10.1. .65 T8.75 T8.8 = 394.7 = 376. 700°C 4 1 100°C 400°C 3 2 500°C Fig.1 = 388.3 T2.30 T6.2 T2.73 T9.1 = 360.16.4 = 383.9 = 396.5.7 = 392.06 T8.10 = 393. determine the temperature of the heated plate shown in Fig.1 0°C Fig.3 = 362.220 Introduction to Numerical Methods in Chemical Engineering T6.81 T8.68 T8.9 = 394.06 T7.2 = 361.1 = 369. T4 = 412.87 T9.3 = 381.2 = 369. 10.5 = 361.15.3 T2.1 Using the Gauss-Seidel method. 2.76 T7.5 = 375.5 = 367.67 T7.2 = 381.5°C) 10.79 T7.8 = 385.09 T10.16 Exercise 10. The dimension of the plate is 40 cm ´ 40 cm and is made of aluminium.88 T9.08 T7.38 T6.03 T6.1 = 352.

At t = 0 s.49. Two-Dimensional Steady and Transient Heat Conduction 221 (Ans: T1. T16 = 94. T2 = 27.2 = 63. T6 = 47.4. T3. all the four sides of the slab are made at 600°C.5 A slab of size 2 m ´ 2 m shown in Fig.17. T4 = 48.89. .67.19. (Ans: T1 = 35. Take a = 1 m2/s. T2.63. T3.2°C) 10.6. Take Dx = Dy = 20 cm and k = 2.46.3 = 76.6. T7 = 61.84. T¥ = 15°C 3 4 50°C 50°C 5 6 50°C Fig.20. T2.3 Using the Gauss-Seidel method. T9 = 72. 10. 10. 10.24.91.2 = 56. T3.5 W/m-K. The thermal conductivity of the body is 1.3 = 69.4 Calculate the steady state temperatures for nodes 1 to 16 shown in Fig.1 = 42.18 Exercise 10. T5 = 55. T4 = 41.64°C) 10.3 = 78.13oC) 10.2. T3 = 38.94.01. Determine the temperature of the slab at various nodes at t = 0. h = 23 W/m2-K.12.3.2 = 52. consider the upper quadrant of the slab as shown in Fig. 10. T1.6. 10.58.19 is initially at 0°C. T¥ = 25°C 1 2 3 4 5 6 7 8 Insulation 100°C 9 10 11 12 13 14 15 16 100°C Fig. T15 = 89. T3 = 41.1 = 33.93.36. Take Dt = 0.17 Exercise 10. T2 = 35.17. T1.3 W/m-K.1 m. T13 = 86.1 = 33. and for computing. 10. determine the steady state temperatures for nodes 1 to 6 shown in Fig.05 s. T12 = 86.57. T6 = 56. T8 = 74.18. T14 = 87.6. T2. 1 2 h = 12 W/m2-K. T10 = 73.37. Dx = Dy = 25 cm. T5 = 47.86.25 s. (Ans: T1 = 27. Take Dx = Dy = 0.25.28.26. T11 = 78.66.

3 = 435.4 = 506.47 T7.222 Introduction to Numerical Methods in Chemical Engineering 600°C (1.10 = 563.5 = 458.4 = 292.10 T5.43 T4.31 T1.8 = 551.95 T2.01 T6.3 = 500.88 T10.1) 6 (11.7 = 474.96 T2.7 = 434.59 T1.37 T5.13 T10.5 = 355.6 = 383.7 = 586.89 T6.8 = 518.03 T1.1 = 427.63 T4.3 = 399.3.57 T8.7 = 518.09 T6.6 = 402.10 = 576.41 T10.8 = 535.3 = 305.10 T4.35 T2.3 = 469.4 = 444.4 = 354.4 = 380.10 = 589.33 T10.5 T1.67 T9.3 = 577.11) (11.94 T3.09 T9.28 T9. Table 10.95 T4.9 = 540.3 = 291.10 = 571.8 = 469.20 T7.1 = 294.6 = 302.4 = 319.10 = 596.9 = 592.91 T10.10 = 580.3 = 340.1 = 576.19 Exercise 10.2 = 290.74 T2.3 = 319.5 = 296.1 = 496.9 = 527.1 = 308.07 T10.12 T8.10 = 585.39 T5.20 T9.2 = 332.9 = 497.94 .24 T7.39 T1.29 T3.25 s are presented in Table 10.4 = 477.26 T3.69 T2.7 = 538.77 T1.2 = 392.5 = 427.5 = 580.1 = 329.5 = 375.8 = 443.2 = 359.20 T8.84 T2.95 T5.6 = 424.18 T3.54 T9.9 = 563.20 T5.07 T3.8 = 336.5 = 399.6 = 583.88 T1.7 = 401.90 T9.7 = 314.2 = 464.4 = 411.1 = 390.9 = 552.7 = 452.10 = 562.3 can be modified and the temperatures (in °C) at t = 0.85 T8.5 = 515.67 T4.48 T4.36 T9.17 T8.18 T2.89 T8.87 T6.7 = 417.66 T1. 10.9 = 491.9 = 505.34 T2.02 T7.3 Temperatures in Exercise 10.19 T5.27 T10.61 T3.45 T7.38 T10.00 T8.61 T5.11) 6  600°C Z (1.3 = 367.1 = 290.10 = 566.48 T2.7 = 497.1 = 462.01 T6.9 = 378.2 = 576.99 T1.70 T8.6 = 366.53 T4.60 T7.2 = 429.2 = 297.5.88 T7.10 T2.5 = 488.16 T5.14 T6.23 T6.1 = 356.40 T5.39 T8.64 T5.47 T3.4 = 579.11 T7.9 = 515.84 T3.92 T10.69 T6.28 T7.01 T6.6 = 449.6 = 526.17 T9.30 T4.25 T7.32 T3.32 T3.6 = 502.5 = 339.8 = 483.48 T9.10 = 455.8 = 589.48 T4.1)  [ Fig.58 T10.63 T6.2 = 497.4 = 334. (Ans: Program 10.63 T9.03 T8.6 = 476.8 = 456.2 = 311.8 = 500.51 T1.67 T4.

51 T5.97 T10.6 = 540.70 T9.75 T9.7 = 572.40 T5.10 = 596.64 T4.2 = 494.8 = 551.89 T10.44 T9.5 = 551.15 T4.27 T3.27 T4.4 = 525.02 T2.77 T7.2 = 529.78 T2.24 T10.29 T4.2 = 509.1 = 582.89 T4.66 T2.5 s.7 = 543.20 T4.3 = 582.5 = 524.73 T5.73 T10.48 T5.3 = 500.08 T10.62 T7.02 T8.05 T6.64 T7.4 = 559.40 T6.2 = 518.37 T1.6 T1.9 = 570.1 = 540.2 = 571.10 = 583.42 T1.7 = 503.5 to determine the temperature profile at 0.1 = 571.37 T5.3 = 521.10 = 595.6 = 557.71 T8.10 = 587.69 T7.3 = 505.8 = 566.1 = 517.5 = 541.63 T8.6 = 498.95 T1.45 T4.56 T6.2 = 541.03 T7.09 T9.96 T3.63 T2.65 T5.74 T2.61 T10.4 = 583.7 = 564.72 T8.4 = 517.10 = 584.97 T7.29 T1.00 T2.2 = 497.95 T6.83 T3.59 T7.9 = 585.9 = 524.7 = 550.8 = 578.16 T5.03 T1.8 = 572.04 T6.21 T4.06 T7.10 = 551.33 T9.8 = 591.6 = 567.4 = 547.91 T8.9 = 577.4 = 495.1 = 528.87 T10.7 = 532.5 = 585.5 s are presented in Table 10.1 = 508.93 T5.05 T8.3 = 556.81 T9.6 = 587.6 = 532.6 = 579.3 = 543.3 = 572.8 = 561.7 = 557.8 = 510.6 Solve Exercise 10.3 = 495.6 = 520.90 T6.71 T1. Table 10.4 = 510.01 T7.10 = 590.71 T2.5 = 576.80 T1. (Ans: Program 10.95 T3.09 T5.7 = 537.57 T8.2 = 582.03 T2.32 T6.64 T10.84 T9.1 = 501.31 T3.94 T9.14 T1.8 = 556.94 .9 = 574.64 T3.31 T9.7 = 589.96 T2.6 = 548.48 T8.4.5 = 532.55 T3.23 T5.5 = 496.4 = 536.59 T2.4 = 574.91 T4.7 = 583.65 T3.5 = 511.62 T8.9 = 594.3 = 532.59 T8.3 can be modified and the temperatures (in °C) at t = 0.21 T6.06 T1.3 = 512.26 T6.4 = 505.8 = 586.5 = 517.4 Temperatures in Exercise 10.1 = 496.01 T3.32 T4.9 = 581.71 T6.42 T3.9 = 591.9 = 567.2 = 554.8 = 547. Two-Dimensional Steady and Transient Heat Conduction 223 10.2 = 502.10 = 592.78 T7.6 = 526.1 = 554.32 T9.1 = 494.10 = 583.5 = 562.10 = 586.9 = 565.29 T10.97 T10.

9 Program for the solution of two simultaneous chemical reactions in chemical equilibrium 3. assuming Raoults law to be true 3.6 Program to calculate the vapour pressure at the given temperature using the Peng Robinson equation of state by comparing the fugacities of the liquid and vapour phases 3.3 Program to solve for terminal velocity 2.3 Program to calculate the compositions of the vapour and liquid phases at the given temperature and pressure under flash conditions.1 Program to calculate the molar volume in the liquid and vapour phases at the given temperature and pressure 3.Appendix Programs in C++ Program Title 1. assuming the modified Raoults law to be true 3. assuming Raoults law to be true 3.2 Program for the solution of linear algebraic equations by the Gauss Elimination method 1.7 Program to calculate the bubble point pressure using the gammaphi approach 3.2 Program to solve for minimum fluidization velocity 2.1 Program to solve an ordinary differential equation by the RungeKutta method 4. dew point pressure and dew point temperature of a mixture of given composition.10 Program to calculate the adiabatic flame temperature (AFT) for a fuel 4.1 Program for the solution of tridiagonal equations 1.8 Program to calculate the bubble point pressure using the PengRobinson equation of state 3.2 Program to determine the velocity of a particle in a pneumatic conveyor 225 .4 Program for the solution of two simultaneous nonlinear equations 3.1 Program to solve for pressure drop in a pipe (nonlaminar case) 2.5 Program to calculate the compositions of the vapour and liquid phases at the given temperature and pressure under flash conditions.2 Program to calculate the bubble point temperature and the dew point temperature of a mixture of given composition.3 Program for the solution of linear algebraic equations by the GaussSeidel method 2. bubble point temperature. assuming the modified Raoults law to be true 3.4 Program to calculate the bubble point pressure.

4 Program to solve three simultaneous ordinary differential equations by the Runge Kutta method 4.1 Program to calculate the temperature profile in a rectangular slab during transient heat conduction 9.beta[21]. //a is subdiagonal.1 //program for the solution of tridiagonal equations #include<iostream.6 Program to solve four simultaneous ordinary differential equations for the reactions A + B ® C and B + C ® D by the RungeKutta method 4.j.n1.2 Program to calculate the temperature profile in a two-dimensional body during steady heat conduction using the ADI method 10.b[21].++i) { .3 Program to calculate the temperature profile in a two-dimensional body during transient heat conduction using the ADI method PROGRAM 1.2 Program to calculate the concentration profile in a sphere during transient diffusion of drug from spherical pellet 10. b is diagonal and c is superdiagonal for(i=2.1 Program to calculate the concentration profile in a tubular reactor with axial dispersion (second order reaction) 7.h> void main() { clrscr().1 Program to calculate the temperature profile in a two-dimensional body during steady heat conduction using the Gauss-Seidel method 10. beta = 1) 9.i<=7.h> #include<conio.1 Program to calculate the concentration profile along the radius for reaction diffusion in a spherical catalyst pellet (second order isothermal reaction) 8.k.x[21]. int i.1 //PROGRAM 1.d[21]. float a[21].5 Program to solve three simultaneous ordinary differential equations for the reaction A ® B ® C by the RungeKutta fourth order method 4.2 Program to calculate the concentration profile along the radius for reaction- diffusion in a spherical catalyst pellet (non-isothermal.226 Appendix: Programs in C++ 4.n.7 Program to solve ordinary differential equations in a non-isothermal tubular reactor by the RungeKutta method 7.2 Program to calculate the concentration profile in a tubular reactor with axial dispersion in which two parallel reactions take place 8.i1.c[21].h> #include<math.3 Program to solve two simultaneous ordinary differential equations by the Runge Kutta method 4.gamma[21].

i<=7.0.2 //program for the solution of linear algebraic equations //by the Gauss Elimination method #include<iostream.h> .0. for(i=2. } d[1]=-240. gamma[j]=(d[j]-a[j]*gamma[j-1])/beta[j]. for(j=i1.2 //PROGRAM 1. } for(i=1.i<=7.0. } PROGRAM 1. x[j]=gamma[j]-c[j]*x[j+1]/beta[j].j<=n.i<=6. } for(i=1. } x[n]=gamma[n]. } d[7]=-60. for(k=1.++i) { cout<<x[i]<<endl.++i) { d[i]=-40. n1=n-i. Appendix: Programs in C++ 227 a[i]=1. beta[i]=b[i].k<=n1.++i) { b[i]=-2. } getch().0.++i) { c[i]=1. n=7.++k) { j=n-k.++j) { beta[j]=b[j]-a[j]*c[j-1]/beta[j-1]. i1=i+1. } cout<<\t\t\t THE SOLUTION BY TDMA<<endl. i=1. for(i=1.0.0. gamma[i]=d[i]/beta[i].i<=6.

quot.big.k<=l.i++) { for(j=1.jj. . jj=i. jj=k.j<=m.j<=m.j++) { cout<<a[i][j]<<endl.j++) { t=a[jj][j].228 Appendix: Programs in C++ #include<conio.i<=n.j++) { cin>>a[i][j]. int n. cout<<n<<endl.k. m=n+1.m.ip1. } } for(i=1. float a[10][11].t.nn.j<=m.sum.i.ab.i<=n.0) { big=ab. n=4. } } for(k=1.j. cout<<Input the elements of A rowwise and elements of B<<endl.x[10]. for(i=1. l=n-1.h> void main() { clrscr(). if((big-ab)<0. } } if((jj-k)>0) { for(j=k.k++) { big=fabs(a[k][k]).i++) { ab=fabs(a[i][k]).i<=n.kp1.h> #include<math. for(i=kp1.i++) { for(j=1. a[jj][j]=a[k][j].l. kp1=k+1.

h> #include<math. } } for(i=kp1. ip1=i+1.j++) { a[i][j]=a[i][j]-quot*a[k][j]. i=n-nn.nn++) { sum=0.x3old. } x[i]=(a[i][m]-sum)/a[i][i].x3new. x1new=2.j<=n.0. Appendix: Programs in C++ 229 a[k][j]=t.i++) {cout<<x[i]<<endl. float x1old.h> void main() { clrscr().i<=n.h> #include<conio.x2old. for(nn=1. } for(i=1. for(j=ip1.j<=m. for(j=kp1.i++) { a[i][k]=0.0. } } for(i=kp1.x2new.j++) { sum=sum+a[i][j]*x[j].3 //program for the solution of linear algebraic equations //by the Gauss-Seidel method #include<iostream. .i<=n.x1new. } } x[n]=a[n][m]/a[n][n].3 //PROGRAM 1.} getch().i++) { quot=a[i][k]/a[k][k]. } PROGRAM 1.nn<=l.i<=n.0.

epsilon=0.23.mu.f. . int n.0. x1new=(44. do { fricf=fricfnew.a2. Re=rho*v*d/mu.004.rho. fricfnew=fricf-f/fdash. cin>>fricf. x3new=4.0015e-3.h> #include<math.230 Appendix: Programs in C++ x2new=3.-1.h> #include<conio.fdash. a2=2.0-x2old-2*x3old)/10.h> void main() { clrscr(). cout<<x1new<< <<x2new<< <<x3new<<endl. x3new=(61. do { x1old=x1new. n=n+1.fricfnew.d. a1=epsilon/d.0. cout<<\t\t\t OUTPUT<<endl.5*pow(fricf.mu=1.0*log10((a1/3.v=50.epsilon.a3. x2new=(51.length.0/sqrt(fricf))+2.length=1. getch(). d=0.01.1 //program to solve for pressure drop in a pipe (nonlaminar case) #include<iostream.0-2*x1new-x3old)/10.7)+(a2/sqrt(fricf))). fdash=a3+2. cout<<\nEnter the initial value of fricfact.0. fricfnew=0. float fricf.0.0*a2*a3/((a1/3.0.Re.5).deltap. x2old=x2new.7)+(a2/sqrt(fricf))).0.0.a1.51/Re.1 //PROGRAM 2.0-x1new-2*x2new)/10.v. } PROGRAM 2. }while(fabs(x1new-x1old)>1e-6&&fabs(x2new-x2old)>1e-6&&fabs(x3new- x3old)>1e-6). n=0. f=(1.79e-5. a3=-0. x3old=x3new.rho=1.

h> void main() { clrscr().phis. mu=1. cout<<Number of iterations performed <<n<<endl.42.81.h> #include<conio. n=n+1. float epsilon.a1.h> #include<math.2 //program to solve for minimum fluidization velocity #include<iostream. deltap=fricfnew*length*v*v*rho/(2. dp=0.mu. a2=150.0*d).v. vnew=0. phis=0. a3=(1. } PROGRAM 2. cout<<\t Velocity at minimum fluidization is <<vnew<<  m/s <<endl. n=0.rhop.3)). cin>>vmf. const g=9. epsilon=0.a3.3.0)).0-epsilon)/(phis*phis*dp*dp*pow(epsilon. } . rhog=2.2 //PROGRAM 2. cout<<\t\t\t OUTPUT<<endl.0-epsilon)*(1.0. int n. rhop=1000.0*a1*v+a2. }while(fabs(vnew-v)>1e-6). vnew=v-f/fdash. cout<<\t Friction factor is <<fricfnew<<endl. cout<<\nEnter the initial value of vmf in m/s .vmf.0-epsilon)*(rhop-rhog)*g.a2. f=a1*v*v+a2*v-a3.845e-5.f.374.fdash.88.rhog. Appendix: Programs in C++ 231 }while(fabs(fricfnew-fricf)>1e-6).00012.0-epsilon)/(phis*dp*pow(epsilon.01.vnew.75*rhog*(1. getch(). cout<<Pressure drop is <<deltap<<endl. cout<<Number of iterations performed were <<n<<endl.0*mu*(1. getch().dp. do { v=vnew. a1=1. fdash=2.

int n.rhog. rep=rhog*vt*dp/mu.1.232 Appendix: Programs in C++ PROGRAM 2.rep.002.mu.h> void main() { clrscr(). float g=9. n=n+1. do { vt=vtnew. cout<<number of iterations performed is <<n<<endl.h> void main() { clrscr(). a1=4. cin>>vtnew. .h> #include<conio. x1new=0.x1new.3 //program to solve for terminal velocity #include<iostream.687))/rep. getch(). float vt. int n.4 //PROGRAM 2.x2new.cd.deltax2.df1dx2.h> #include<math. cout<<\t Value of terminal velocity is <<vtnew<<endl.rhop=900. rhog=1.df1dx1.f1.vtnew.df2dx1.mu=1.15*pow(rep.0.0*cd*rhog).h> #include<conio.0+0.85e-5. float d. vtnew=sqrt(a1).x2. }while(fabs(vtnew-vt)>1e-6).18. float x1.a1.h> #include<math. cd=24.dp.4 //program for the solution of two simultaneous nonlinear equations #include<iostream.0. } PROGRAM 2.0*(1.81. cout<<\nEnter the value of initial value of terminal velocity in m/ s .dp=0.3 //PROGRAM 2.f2.0*(rhop-rhog)*g*dp/(3.deltax1.df2dx2.rhop.

} PROGRAM 3.pc.sol[2]. f2=sin(x1*x2)+x1+x2-1. getch().71828. x1new=x1+deltax1.tc. n=n+1. cout<<Enter the value of acentric factor.314.71828. Appendix: Programs in C++ 233 x2new=0.B. cout<<Enter the value of temperature in deg K and pressure in Pa.h> #include<conio. f1=pow(2.vnew. cout<<The number of iterations performed is <<n<<endl.P) // .x1)+x2.r=8.5.vold.0.f1.b0.0. cin>>w. deltax1=(f2*df1dx2-f1*df2dx2)/d. x2new=x2+deltax2. }while(fabs(x1new-x1)>1e-6&&fabs(x2new-x2)>1e-6). deltax2=(f1*df2dx1-f2*df1dx1)/d. df2dx1=x2*cos(x1*x2)+1. df1dx1=pow(2.0.k.h> void main() { clrscr().tr. cin>>tc>>pc. df1dx2=x1.h> #include<math. float w.s.1 //program to calculate the molar volume in the liquid and vapour phases at the //given temperature and pressure #include<iostream. float p. df2dx2=x1*cos(x1*x2)+1.1 //PROGRAM 3.lpha.0.a. x2=x2new.x1)+x1*x2-1.b. d=df1dx1*df2dx2-df1dx2*df2dx1. // //VIRIAL GAS EQUATION OF STATE Z(T. cin>>t>>p. n=0.t. cout<<x1new<< <<x2new<<endl. do { x1=x1new.f. cout<<Enter the value of critical temperature in deg K and critical pressure in Pa.b1.

f1=p/(r*t)+B/(vold*vold).139-0.26992*w*w..2). cout<<Volume of vapour by virial eos Z(T. vnew=vold-f/f1.-1.37464+1.083-0.V) <<vnew<<m3/mol<<endl. cout<<Volume of vapour by virial eos Z(T.45724*r*r*tc*tc*lpha/pc. // //PENGROBINSON CUBIC EQUATION OF STATE // int i=0. f=f+(p*b*b*b+b*b*r*t-a*b).07780*r*tc/pc.++i) { do { vold=vnew. lpha=pow(s. b=.234 Appendix: Programs in C++ tr=t/tc.3)*p+vold*vold*(p*b-r*t)-vold*(3*p*b*b+2*b*r*t-a). f=pow(vold. B=(b0+w*b1)*r*tc/pc.2).-4.422*pow(tr. s=1+k*(1-pow(t/tc.5)). a=.P) <<vnew<<m3/mol<<endl. // //VIRIAL GAS EQUATION OF STATE Z(T.i<=1. } while(fabs(vnew-vold)>1e-6). vnew=r*t/p.6). vnew=r*t/p+B. for(i=0.V) // vnew=r*t/p.172*pow(tr. vnew=b. k=. f1=pow(vold. } while(fabs(vnew-vold)>1e-6). } cout<<Volume of saturated liquid by Peng-Robinson <<sol[0]<<m3/ mol<<endl<< .54226*w-. do { vold=vnew. vnew=vold-f/f1. sol[i]=vnew. b1=. b0=. f=p*vold/(r*t)-1-B/vold.2)*3*p+vold*2*(b*p-t*r)+(a-3*b*b*p-2*r*t*b).

vnew=r*t/p. sol[i]=vnew.3)*p-vold*vold*(p*b+r*t)+a*vold-a*b. f1=pow(vold. vnew=vold-f/f1. f1=pow(vold. vnew=b.08664*r*tc/pc.5)/pc. Appendix: Programs in C++ 235 Volume of saturated vapour by Peng-Robinson <<sol[1]<<m3/mol\n.2. vnew=b. // //REDLICHKWONG CUBIC EQUATION OF STATE // i=0. f=pow(vold. a=27*r*r*tc*tc/(64*pc).++i) { do { vold=vnew. } . for(i=0.2)*3*p-vold*2*r*t-(p*b*b+b*r*t-a/sqrt(t)). a=. sol[i]=vnew. // //VAN DER WAALS CUBIC EQUATION OF STATE // i=0. } while(fabs(vnew-vold)>1e-6).42748*r*r*pow(tc. for(i=0. b=r*tc/(8*pc). f=pow(vold.i<=1. vnew=r*t/p.2)*3*p-vold*2*(b*p+t*r)+a. b=.3)*p-r*t*vold*vold-vold*(p*b*b+b*r*t-a/sqrt(t))-a*b/ sqrt(t).i<=1. } cout<<Volume of saturated liquid by RedlichKwong <<sol[0]<<m3/ mol<<endl<< Volume of saturated vapour by RedlichKwong <<sol[1]<<m3/mol\n. } while(fabs(vnew-vold)>1e-6). vnew=vold-f/f1.++i) { do { vold=vnew.

002.x2.39155.z1.p1satn.a1.y1. cout<<\nEnter the pressure in kPa.c1. //CALCULATION OF BUBBLE POINT TEMPERATURE x1=z1. float f.2 //PROGRAM 3.317.887.h> void main() { clrscr(). a1=14. tnew=x1*t1sat+x2*t2sat.x1. assuming Raoults law to be true //BPT is calculated by taking the given composition to be in liquid phase //DPT is calculated by taking the given composition to be in vapour phase #include<iostream. b2=3799.y2. cout<<\nEnter the mole fraction of component 1. . t2sat=b2/(a2-log(p))-c2. cin>>z1. float told. p1sat=exp(a1-b1/(told+c1)). cin>>p. For use of // these constants temperature is in deg C and pressure in kPa.p2sat.b2. a2=16. float p. getch(). t1sat=b1/(a1-log(p))-c1.t1sat.h> #include<conio.a2.2 //program to calculate the BPT and DPT //of a mixture of given composition. c1=230.c2. do { told=tnew.b1.tnew. b1=2795.h> #include<math. // the Antoine constants are for acetone (1) and water (2). c2=226.f1.p1sat.t2sat.236 Appendix: Programs in C++ cout<<Volume of saturated liquid by van der Waals <<sol[0]<<m3/ mol<<endl<< Volume of saturated vapour by van der Waals <<sol[1]<<m3/mol\n.346.26205. x2=1-z1. } PROGRAM 3.

f=(1/p)-(y1/p1sat)-(y2/p2sat). tnew=told-f/f1. assuming Raoults law //to be true #include<iostream.dpp. f1=-x1*p1sat*b1/((told+c1)*(told+c1))-x2*p2sat*b2/ ((told+c2)*(told+c2)). int i.h> #include<math. getch(). t1sat=b1/(a1-log(p))-c1.z[4]. p1sat=exp(a1-b1/(told+c1)). y2=1-z1.3 //PROGRAM 3.p.psat[2]=97.Vo. psat[1]=195. cout<<\nThe dew point temperature is <<tnew.psat[3]=50.bpp. tnew=y1*t1sat+y2*t2sat. cout<<\nThe bubble point temperature is:<<tnew. // dpp is the dew point pressure. f=p-x1*p1sat-x2*p2sat.h> #include<conio. //CALCULATION OF DEW POINT TEMPERATURE y1=z1.x[4].h> void main() { clrscr(). tnew=told-f/f1.f. Appendix: Programs in C++ 237 p2sat=exp(a2-b2/(told+c2)).75. } PROGRAM 3.V. .f1.y[4].3 //program to calculate the compositions of the vapour and liquid phases //at the given //temperature and pressure under flash conditions.84. }while(fabs(tnew-told)>1e-6).k[4]. }while(fabs(tnew-told)>1e-6). f1=(y1*b1/((told+c1)*(told+c1)))/(p1sat)+(y2*b2/ ((told+c2)*(told+c2)))/(p2sat). bpp is bubble point pressure and // V is the number of moles in the vapour phase. p2sat=exp(a2-b2/(told+c2)). do { told=tnew. t2sat=b2/(a2-log(p))-c2. float psat[4].32.

cout<<x[1]+x[2]+x[3]=<<x[1]+x[2]+x[3]<<endl. bpp=z[1]*psat[1]+z[2]*psat[2]+z[3]*psat[3]. for(i=1. } cout<<\n Enter an assumed value for the vapour fraction V.238 Appendix: Programs in C++ cout<<Enter the composition of acetone (1).i++) { f=f+z[i]*(k[i]-1)/(1-Vo+Vo*k[i]). for(i=1. cout<<Mole fraction of nitromethane in liquid phase is <<x[3]<<endl. dpp=1/(z[1]/psat[1]+z[2]/psat[2]+z[3]/psat[3]). cout<<Mole fraction of acetone in the vapour phase is <<y[1]<<endl. acetonitrile (2). cout<<Bubble point pressure of the mixture is <<bpp<< kPa<<endl. } cout<<Mole fraction of acetone in the liquid phase is <<x[1]<<endl. getch().2).i<4. cin>>z[1]>>z[2]>>z[3].0. cout<<Mole fraction of acetonitrile in the liquid phase is <<x[2]<<endl. cout<<Number of moles in vapour phase is <<V<<endl. for(i=1. cout<<Mole fraction of nitromethane in vapour phase is <<y[3]<<endl. } . cout<<\nEnter the pressure in kPa in between DPP and BPP \n. nitromethane (3). cout<<Mole fraction of acetonitrile in the vapour phase is <<y[2]<<endl. cout<<Dew point pressure of the mixture is <<dpp<< kPa<<endl. } V=Vo-f/f1. cin>>p.i<4. } while(fabs(V-Vo)>1e-6). f1=f1-z[i]*(k[i]-1)*(k[i]-1)/pow((1-Vo+Vo*k[i]).i<4. do { Vo=V.i++) { x[i]=z[i]/(1-V+V*k[i]).i++) { k[i]=psat[i]/p. cin>>V. f = f1 = 0. cout<<y[1]+y[2]+y[3]=<<y[1]+y[2]+y[3]<<endl. y[i]=x[i]*k[i].

a2=16.m.y2.b2.678.y1.4 //PROGRAM 3.g11.g2. .a1. a1=16. float V1=76. //dew point pressure and dew point temperature. b2=3816.61. //the component 1 is acetone and 2 is water.r=8. h12=V2*exp(-a12/(r*(t+273. c2=227. x2=1-x1. m=h12/(x1+x2*h12)-h21/(x2+x1*h21). cout<<BPP=<<p<<kPa\n.c2. bubble point temperature. The pressure in Antoine equation //is in kPa and temperature in deg C. t1sat=b1/(a1-log(p))-c1. float tnew. a12 and a21 are in cal/mol. assuming the modified //Raoults law to be true #include<iostream.4 //program to calculate the bubble point pressure.g22. b1=3640. cout<<Enter the value of temperature in deg C and mole fraction x1.t.pnew. cout<<Enter the value of pressure in kPa and x1\n.b1.a12=437.p2sat. // //CALCULATION OF BPP (temperature and liquid phase composition are given) cout<<Calculation of BPP<<endl. t2sat=b2/(a2-log(p))-c2.a21=1238*4.44. Appendix: Programs in C++ 239 PROGRAM 3. g2=exp(-log(x2+x1*h21)-x1*m).07. float p.15)))/V2. // //CALCULATION OF BPT (pressure and liquid phase composition are given) cout<<Calculation of BPT<<endl.02. x2=1-x1.x2.314.c1.h> #include<conio.h12.t1sat.98*4. g1=exp(-log(x1+x2*h12)+x2*m).V2=18. c1=219.p1sat.h> #include<math.2.told.186.186. p1sat=exp(a1-b1/(c1+t)).t2sat.g1. cin>>t>>x1. cin>>p>>x1.h21.h> void main() { clrscr().2887. h21=V1*exp(-a21/(r*(t+273. p2sat=exp(a2-b2/(c2+t)).x1.pold.a2.92. p=x1*g1*p1sat+x2*g2*p2sat.15)))/V1.

do { pold=pnew. g22=exp(-log(x2+x1*h21)-x1*m). g2=g22.001)). do { g1=g11. cout<<Enter the temperature in deg C and y1\n. cout<<BPT=<<tnew<<deg C\n. } while((fabs(g11-g1)>. tnew=b1/(a1-log(p1sat))-c1.15)))/V1. } while(fabs(tnew-told)>. p1sat=p/(g1*x1+g2*x2*(p2sat/p1sat)). // //CALCULATION OF DPP (temperature and vapour phase composition are given) cout<<Calculation of DPP<<endl. } . p2sat=exp(a2-b2/(c2+told)). g1=exp(-log(x1+x2*h12)+x2*m). cin>>t>>y1. h21=V1*exp(-a21/(r*(told+273. do { told=tnew. h12=V2*exp(-a12/(r*(told+273. g11=g22=1.0001).240 Appendix: Programs in C++ tnew=x1*t1sat+x2*t2sat. g11=exp(-log(x1+x2*h12)+x2*m).15)))/V1. h12=V2*exp(-a12/(r*(t+273. y2=1-y1. p1sat=exp(a1-b1/(c1+told)). m=h12/(x1+x2*h12)-h21/(x2+x1*h21). g1=g2=1.001)&&(fabs(g22-g2)>. x2=1-x1. pnew=1/(y1/(g1*p1sat)+y2/(g2*p2sat)). m=h12/(x1+x2*h12)-h21/(x2+x1*h21). x1=x1/(x1+x2). x2=y2*pold/(g2*p2sat). pnew=1/(y1/(g1*p1sat)+y2/(g2*p2sat)). p1sat=exp(a1-b1/(c1+t)). h21=V1*exp(-a21/(r*(t+273. g2=exp(-log(x2+x1*h21)-x1*m).15)))/V2. p2sat=exp(a2-b2/(c2+t)). x1=y1*pold/(g1*p1sat).15)))/V2.

0001)&&(fabs(g22-g2)>.5 //program to calculate the compositions of the liquid and vapour phases under //flash conditions. x1=x1/(x1+x2). x1=y1*p/(g1*p1sat). do { told=tnew.0001). // //CALCULATION OF DPT (pressure and vapour phase composition are given) cout<<Calculation of DPT<<endl. y2=1-y1. cout<<Enter the pressure in kPa and y1\n.5 //PROGRAM 3. g22=exp(-log(x2+x1*h21)-x1*m). tnew=y1*t1sat+y2*t2sat. cin>>p>>y1. g11=g22=1. t1sat=b1/(a1-log(p))-c1. h12=V2*exp(-a12/(r*(told+273. x2=1-x1. } while(fabs(tnew-told)>. getch(). t2sat=b2/(a2-log(p))-c2. p1sat=exp(a1-b1/(c1+told)). g11=exp(-log(x1+x2*h12)+x2*m). } PROGRAM 3.15)))/V2. assuming the modified Raoults law to be true #include<iostream.h> . tnew=b1/(a1-log(p1sat))-c1. p2sat=exp(a2-b2/(c2+told)). cout<<DPP=<<pnew<<kPa\n. Appendix: Programs in C++ 241 while(fabs(pnew-pold)>. do { g1=g11. } while((fabs(g11-g1)>.15)))/V1.0001). cout<<DPT=<<tnew<<deg C\n.0001)). m=h12/(x1+x2*h12)-h21/(x2+x1*h21). p1sat=p*(y1/g1+y2*p1sat/(g2*p2sat)). h21=V1*exp(-a21/(r*(told+273. x2=y2*p/(g2*p2sat). g2=g22.

B1. cin>>t.k1. The pressure in Antoine equation // is in kPa and temperature in deg C. g1=exp(-log(x1+x2*h12)+x2*m).z2.15)))/V1. B1=2795. . cout<<Enter the overall composition of species 1.pnew. cout<<Enter the temperature in deg C.k2.C1. x2=z2.f.gb1.p2sat.gb2. p2sat=exp(A2-(B2/(t+C2))).66. y2=z2.05. z2=1-z1.346.g1.a21=1445. // the component 1 is acetone and 2 is water. m=(h12/(x1+x2*h12))-(h21/(x2+x1*h21)).g2n.h21.z1.39155.07. float x1. h21=V1*exp(-a21/(r*(t+273. //Listing the values of the Antoine parameters A1=14. g1=g2=1.987. pnew=1/(y1/(g1*p1sat)+y2/(g2*p2sat)). p1sat=exp(A1-(B1/(t+C1))). A2=16.V2=18. p1sat=exp(A1-(B1/(t+C1))).y1. h12=V2*exp(-a12/(r*(t+273.002.Vnew.V.g1n. p2sat=exp(A2-(B2/(t+C2))). //Calculation of DPP y1=z1. B2=3799.C2.h> void main() { clrscr(). bpp=p.817. gb1=g1.p. C2=226. float p1sat.A2.dpp.h> #include<math.15)))/V2.26205. C1=230. g2=exp(-log(x2+x1*h21)-x1*m).242 Appendix: Programs in C++ #include<conio. cout<<BPP=<<p<<kPa\n. //Calculation of BPP x1=z1.pold.y2.887.x2. cin>>z1.m. p=x1*g1*p1sat+x2*g2*p2sat. gb2=g2.bpp.f1. a12 and a21 are in cal/mol.g2.h12. float A1.gd2.B2. float r=1.a12=292. float t.26.V1=74.gd1.

0001&&fabs(g2n-g2)>. x2=1-x1.15)))/V2. g2=g2n. V=(bpp-p)/(bpp-dpp). Appendix: Programs in C++ 243 g1n=g1. h12=V2*exp(-a12/(r*(t+273. g1n=exp(-log(x1+x2*h12)+x2*m). m=(h12/(x1+x2*h12))-(h21/(x2+x1*h21)).0001). k2=g2n*p2sat/p. g2n=g2. do { pold=pnew. x1=y1*pold/(g1*p1sat). g1=((p-dpp)*(gb1-gd1))/(bpp-dpp)+gd1. do { V=Vnew.g2n=g2. f=y1-x1+y2-x2. cout<<Enter a pressure between <<dpp<< and <<bpp<<\n. do { g1=g1n. . cout<<DPP=<<pnew<<\n. x2=y2*pold/(g2*p2sat). y2=(k2*z2)/(1-V+V*k2). } while(fabs(g1n-g1)>. x1=y1/k1. } while(fabs(pnew-pold)>. gd2=g2n. gd1=g1n. x2=y2/k2. //Calculation of distribution coefficients do { g1n=g1. dpp=pnew.15)))/V1. cin>>p. y1=(k1*z1)/(1-V+V*k1). h21=V1*exp(-a21/(r*(t+273.0001). g2=((p-dpp)*(gb2-gd2))/(bpp-dpp)+gd2. k1=g1n*p1sat/p. g2n=exp(-log(x2+x1*h21)-x1*m). x1=x1/(x1+x2). pnew=1/(y1/(g1n*p1sat)+y2/(g2n*p2sat)).

m=(h12/(x1+x2*h12))-(h21/(x2+x1*h21)). cout<<x1=<<x1<<\n.pc. cout<<Enter the temperature in deg K and assumed pressure in Pa. cin>>tc>>pc. b=.244 Appendix: Programs in C++ f1=-(z1*(k1-1)*(k1-1)/((1-V+V*k1)*(1-V+V*k1))+ z2*(k2-1)*(k2-1)/((1-V+V*k2)*(1-V+V*k2))).p.00001).k.h> #include<math.lpha.b.t. float vliq. } while(fabs(g1-g1n)>. cout<<Enter the value of the acentric factor.0001&&fabs(g2-g2n)>.0001). g2=exp(-log(x2+x1*h21)-x1*m). k=.zliq. .r=8. } while(fabs(Vnew-V)>.45724*r*r*tc*tc*lpha/pc. h21=V1*exp(-a21/(r*(t+273.37464+1. float w.2).. h12=V2*exp(-a12/(r*(t+273. getch().15)))/V2.vold. Vnew=V-f/f1.vnew.fv.314.26992*w*w.c.6 //PROGRAM 3.d. cout<<y1+y2=<<(y1+y2)<<\n.6 //program to calculate the vapour pressure at the given //temperature using the PengRobinson eos by comparing the fugacities of the //liquid and vapour phases #include<iostream.f.54226*w-.15)))/V1. cout<<y1=<<y1<<\n.07780*r*tc/pc. } PROGRAM 3. cin>>t>>pnew.5)). a=.h> void main() { clrscr(). cin>>w.s. cout<<The number of moles in vapour phase is<<Vnew<<\n.a.fl. g1=exp(-log(x1+x2*h12)+x2*m). cout<<x1+x2=<<(x1+x2)<<\n. cout<<Enter the value of the critical temperature in deg K and the critical pressure in Pa.h> #include<conio.vvap.zvap. lpha=pow(s.f1. s=1+k*(1-pow(t/tc.tc.pnew.

f=pow(vold.0*sqrt(2. f1=pow(vold.0*r*t*b).0*p*b*b+2.2.0*(b*p-t*r)+(a-3.0*b*b*p-2. fv=p*exp(zvap-1.0*b*r*t-a).7 //PROGRAM 3. vliq=vnew. f=f+(p*b*b*b+b*b*r*t-a*b).0+sqrt(2.h> . } while(fabs(vnew-vold)>1e-6).0))*b*p/(r*t))/ (zliq+(1. } PROGRAM 3. Appendix: Programs in C++ 245 do { p=pnew.0))*b*p/(r*t))/ (zvap+(1.0)*3. do { vold=vnew. c=(a/(2. vnew=b. vnew=vold-f/f1. f1=pow(vold. pnew=p*fl/fv. getch(). d=(a/(2.0)*p+vold*vold*(p*b-r*t)-vold*(3.0*sqrt(2.0)*b*r*t))*(log((zvap+(1. vnew=vold-f/f1. f=pow(vold. fl=p*exp(zliq-1-log(zliq-p*b/(r*t))-c).0*b*b*p-2.0)*b*r*t))*(log((zliq+(1. } while(fabs(vnew-vold)>1e-6).0))*b*p/(r*t)))).3.0*(b*p-t*r)+(a-3.0+sqrt(2.0-sqrt(2.0*p*b*b+2. cout<<The saturated vapour pressure at <<t<< deg K is <<pnew<< Pa<<endl.0*b*r*t-a).0*p+vold*2. f=f+(p*b*b*b+b*b*r*t-a*b).0*p+vold*2.3.0)*p+vold*vold*(p*b-r*t)-vold*(3. do { vold=vnew.2. vvap=vnew.0-log(zvap-b)-d). vnew=r*t/p. } while(fabs(pnew-p)>1e-6). zvap=p*vvap/(r*t).7 //program to calculate the bubble point pressure using the gammaphi approach #include<iostream.0))*b*p/(r*t)))).0-sqrt(2.0*r*t*b). zliq=p*vliq/(r*t).0)*3.

314.w1.w1.pnew.-1.6. w12=(w1+w2)*0.y1. v2=18.C2. p1sat=p1sat*1000.w2=0.5.2).2620.tr12. // converting kPa to Pa p2sat=p2sat*1000.76. z=h12/(x1+x2*h12)-h21/(x2+x1*h21).422*pow(tr1.b12.x1.89. tr1=t/tc1.tc2. g2=exp(-log(x2+x1*h21)-x1*z). float v2.p2sat.w2.b11.083-0. A2=16.h> #include<math.35. p2sat=exp(A2-B2/(C2+t)). w1=0. tc12=pow((tc1*tc2).w12.B1.water (2) system // A1.-1.A1. vc1=zc1*r*tc1/pc1.h> void main() { clrscr().zc2.tc1. t=t+273.97*pow(10.zc1=0. g1=exp(-log(x1+x2*h12)+x2*z).b1.A2.958.pc2=220.snew=0. .15. h21=(v1/v2)*exp(-a21/(r*t)).422*pow(tr2.1.g1. C2=226.246 Appendix: Programs in C++ #include<conio. b22=(r*tc2/pc2)*(b0+w2*b1). b0=.186.r=8.186.tc12. p1sat=exp(A1-B1/(C1+t)).229.vc2=zc2*r*tc2/pc2.t.-6). b0=.6).zc2 // the data given are for the methanol (1) . float b22.vc2.tc2.6).5938.0. A1=16. //feed the temperature in degree C t=100.pc1=80.zc12.C1. b1=.fc2. C1=239. h12=(v2/v1)*exp(-a12/(r*t)).k2.tr2.345.564.55*4. C2 denote the Antoine constants in this program a12=107. b1=.224.v1.38*4.tc2=647.07*pow(10.5).a21=469.-6).0. // read the values of tc1.a12. B1. zc12=(zc1+zc2)*0.-4. tr2=t/tc2.zc2=0.139-0.5).0.zc1.55*pow(10.vc12.k1.3.v1=40.B2.f1.pc1. A2.083-0.z. B2=3799.f2.-4. C1.h21. float p.172*pow(tr2.h12. float fc1.y2.vc1.73*pow(10.2).d12.172*pow(tr1.w2.p1sat.x2.sold.pc1. b11=(r*tc1/pc1)*(b0+w1*b1).b0.5.5).a21.pc2.tr1.139-0. tc1=512.x2=1-x1. B2.g2.pc12.zc1. B1=3644.x1=0.pc2.

Appendix: Programs in C++ 247 vc12=pow((pow(vc1. snew=x1*k1+x2*k2.0. b1=.y2=x2*g2*p2sat/p.3). do { p=pnew. y1=x1*g1*f1/(fc1*pnew).33333))*0. cout<<fc1=<<fc1<<endl<<fc2=<<fc2<<endl. cout<<k1=<<k1<<endl<<k2=<<k2<<endl. pc12=zc12*r*tc12/vc12. getch().y2=x2*g2*f2/(fc2*pnew). b12=(r*tc12/pc12)*(b0+w12*b1). d12=2*b12-b11-b22. k1=g1*f1/(fc1*p). } while(fabs(pnew-p)>1e-6).-1.172*pow(tr12. fc1=exp((p/(r*t))*(b11+y2*y2*d12)). f2=p2sat*(exp(b22*p2sat/(r*t)))*(exp((v2*(p-p2sat)/(r*t)))).2).6). y1=x1*g1*p1sat/p.333333)+pow(vc2. cout<<p=<<p<<endl<<y1=<<y1<<endl. k2=g2*f2/(fc2*p).8 //program to calculate the bubble point pressure using the PengRobinson eos #include<iostream. y2=x2*k2/snew. p=x1*g1*p1sat+x2*g2*p2sat. fc2=exp((p/(r*t))*(b22+y1*y1*d12)). f1=p1sat*(exp(b11*p1sat/(r*t)))*(exp((v1*(p-p1sat)/(r*t)))). pnew = p.h> #include<math.h> #include<conio. y1=x1*k1/snew. tr12=t/tc12.0.8 //PROGRAM 3.h> void main() { .-4. pnew=(x1*g1*f1/fc1)+(x2*g2*f2/fc2). b0=.5.422*pow(tr12.083-0. } PROGRAM 3. } while(fabs(snew-sold)>1e-6).139-0. do { sold=snew. cout<<g1=<<g1<<endl<<g2=<<g2<<endl.

//the data are for the CO2 (1)  n-pentane (2) system t=377.w2=0. f=pow(v. do { v=vnew.314.07780*r*tc2/pc2.26992*w1*w1. f1=pow(v.224. f=f+(p*bliq*bliq*bliq+bliq*bliq*r*t-aliq*bliq). m1=1+k1*(1-pow(t/tc1.248 Appendix: Programs in C++ float t.0. b1=0.snew.fc2v.x1.y1.w1=0.sold. r=8.b2.bvap. k2=0.m1.26992*w2*w2.zliq.455724*r*r*tc1*tc1*lpha1/pc1.5.414*bliq*p/ (r*t)))/(zliq- (.lpha2.fc2l. vnew=bliq.y2=1-y1.455724*r*r*tc2*tc2*lpha2/pc2. a22=0.37464+1.252. float fc1l. bliq=x1*b1+x2*b2.a11.a12. do { p=pnew. } while(fabs(vnew-v)>1e-6). m2=1+k2*(1-pow(t/tc2.54226*w1-0. zliq=p*vnew/(r*t).pc2=33.83e5. clrscr().tc2. lpha1=m1*m1. fc1l=exp((b1/bliq)*(zliq-1)-log(zliq-bliq*p/(r*t))-(aliq/ (2*sqrt(2)*r*t*bliq))* ((2*(x1*a11+x2*a12)/aliq)-(b1/bliq))*log((zliq+(2.y1n.x2=1-x1. cout<<Enter an assumed value of y1 greater than x1 \n.pnew.bliq.07780*r*tc1/pc1.65.y2.x2. float k1.m2.5)).w1. aliq=(x1*x1*a11+x2*x2*a22+2*x1*x2*a12).0.pc1.2.v.0.3)*p+v*v*(p*bliq-r*t)-v*(3*p*bliq*bliq+2*bliq*r*t-aliq).2)*3*p+v*2*(bliq*p-r*t)+(aliq-3*bliq*bliq*p-2*r*t*bliq).w2.37464+1.5)).414*bliq*p/(r*t))))). vnew=v-(f/f1). lpha2=m2*m2.70e5.p.tc2=469.zvap. cout<<The value of x1=<<x1<<endl. a11=0. pnew=50e5. // assumed value for pressure in Pa snew=0.f1. b2=0.k2.vnew.pc1=73.r.tc1. tc1=304.a22.pc2.0.54226*w2-0.f.5)).b1.7.y2n. a12=(pow(a11*a22. . float aliq. k1=0.lpha1.avap.x1=0. cin>>y1.fc1v.

Appendix: Programs in C++ 249 fc2l=exp((b2/bliq)*(zliq-1)-log(zliq-bliq*p/(r*t))-(aliq/ (2*sqrt(2)*r*t*bliq))* ((2*(x1*a12+x2*a22)/aliq)-(b2/bliq))*log((zliq+(2. y2=k2*x2/snew.414*bvap*p/(r*t))))). } while(fabs(snew-sold)>1e-6).2)*3*p+v*2*(bvap*p-r*t)+(avap-3*bvap*bvap*p-2*r*t*bvap).414*bvap*p/ (r*t)))/(zvap- (. } . f=pow(v.k2=fc2l/fc2v. zvap=p*vnew/(r*t). pnew=p*snew. cout<<k1=<<k1<<endl<<k2=<<k2<<endl<<bpp=<<pnew<<endl<<y1=<<y1<<endl.414*bvap*p/(r*t))))). } while(fabs(pnew-p)>1e-6). getch().3)*p+v*v*(p*bvap-r*t)-v*(3*p*bvap*bvap+2*bvap*r*t-avap). vnew=r*t/p. bvap=y1*b1+y2*b2. k1=fc1l/fc1v. snew=k1*x1+k2*x2. do { sold=snew.cout<<k1=<<k1<<endl<<k2=<<k2<<endl. avap=(y1*y1*a11+y2*y2*a22+2*y1*y2*a12). fc1v=exp((b1/bvap)*(zvap-1)-log(zvap-bvap*p/(r*t))-(avap/ (2*sqrt(2)*r*t*bvap))* ((2*(y1*a11+y2*a12)/avap)-(b1/bvap))*log((zvap+(2.414*bliq*p/ (r*t)))/(zliq- (.414*bliq*p/(r*t))))). f1=pow(v. vnew=v-(f/f1). } while(fabs(vnew-v)>1e-6).414*bvap*p/ (r*t)))/(zvap- (. do { v=vnew. f=f+(p*bvap*bvap*bvap+bvap*bvap*r*t-avap*bvap). y1=k1*x1/snew. fc2v=exp((b2/bvap)*(zvap-1)-log(zvap-bvap*p/(r*t))-(avap/ (2*sqrt(2)*r*t*bvap))* ((2*(y1*a12+y2*a22)/avap)-(b2/bvap))*log((zvap+(2.

d3=pow((3*x1+x2). d7=(1-x1)*(5-x1-x2)*(6+2*x1)*(6+2*x1). x1new=x1+deltax1. n=0.d7. df1dx2=(d6/d7)+d8. d11=x2*(3*x1+x2)*(2*x2-5)/((pow((x1-x2).3)*(x1-x2)*(8*x1*x1+6*x1*x2-24*x1+2*x2-16).2)*pow((6+2*x1). f1=(d1/d2)-0.f2. x1new=0.3).x2.d.575.250 Appendix: Programs in C++ PROGRAM 3.d2. do { x1=x1new.deltax1. d1=(x1-x2)*pow((3*x1+x2).2). d5=pow((1-x1). d=df1dx1*df2dx2-df1dx2*df2dx1.d9.h> #include<conio. df2dx2=d10-d11. float x1.21.d11. d6=3*(x1-x2)*(3*x1+x2)*(3*x1+x2)-pow((3*x1+x2). df2dx1=3*x2/((x1-x2)*(5-x1-x2))-(x2*(3*x1+x2)*(5-2*x1))/d9.d3. deltax1=(f2*df1dx2-f1*df2dx2)/d.d4.3).0*x1-8. n=n+1. d9=(x1-x2)*(x1-x2)*(5-x1-x2)*(5-x1-x2).d8.2))*pow((5-x1-x2).d10.d5. int n. float d1.h> #include<math.9.x1new. d2=(1-x1)*(5-x1-x2)*pow((6+2*x1).5.df1dx1.df2dx2.deltax2. d4=pow((3*x1+x2).2)).9 //program for the solution of two simultaneous chemical reactions #include<iostream. f2=(x2*(3*x1+x2)/((x1-x2)*(5-x1-x2)))-2. x2new=x2+deltax2.0*x2)/((1-x1)*(5-x1 x2) *(6+2*x1)*(6+2*x1)).3). deltax2=(f1*df2dx1-f2*df1dx1)/d.2)*pow((5-x1-x2). d8=((x1-x2)*(pow((3*x1+x2).2)*(12.9 //PROGRAM 3.3)))/((1-x1)*(5-x1-x2)*(5-x1-x2) *(6+2*x1)*(6+2*x1)). .h> void main() { clrscr(). x2=x2new. x2new=0.df1dx2.df2dx1.f1. d10=(3*x1+2*x2)/((x1-x2)*(5-x1-x2)).d6. df1dx1=d3-(d4/d5).x2new.

getch().5. // n1.784e-9.d3=1.n3.dd.da. 3.124e-2. dd=u4*d4+u3*d3-u2*d2-u1*d1. cout<<Enter the value of n1.dc. } PROGRAM 3.740e-9.2521e-5. n3. 2.u4=3.sd.b4=.530e-5. t1=t1+273.a4=7. float b1=4.c2=-.b2=. n4 are the number of moles entering of species // 1. cin>>t1. and u4 are their stoichiometric // coefficients. tnew=1000.1709e-5. float sa.t. sc=n1*c1+n2*c2+n3*c3+n4*c4.15. u2.f.tnew.n4\n.h0.sc.7979)+u3*(-94.c4=. u3.10 //PROGRAM 3.d4=-.085.8587e-9.u2=3. cin>>n1>>n2>>n3>>n4.316.236))*1000. sb=n1*b1+n2*b2+n3*b3+n4*b4.n2.u3=2.4285e-2.t0=298. //for various old values of tnew the final answer is the same do { .10 //program to calculate the adiabatic flame temperature (AFT) for a fuel //case of complete conversion #include<iostream. n2. float u1=1.04594e-2. Appendix: Programs in C++ 251 }while(fabs(x1new-x1)>1e-6&&fabs(x2new-x2)>1e-6).h> #include<math.h> void main() { clrscr(). dc=u4*c4+u3*c3-u2*c2-u1*c1. cout<<\nEnter the inlet temperature in deg C. cout<<x1new<< <<x2new<<endl.b3=1.n2.db. h0=(u4*(-57. cout<<The number of iterations performed is <<n<<endl.c3=-. sa=n1*a1+n2*a2+n3*a3+n4*a4. O2 is 2.n4. da=u4*a4+u3*a3-u2*a2-u1*a1. float d1=1. db=u4*b4+u3*b3-u2*b2-u1*b1. float c1=-1. 4 respectively and u1.a3=5.15.d2=.8362e-5.sb.052)-u2*0-u1*(-20.h> #include<conio. The data is given for the reaction // C2H6 + 3.3133e-9.5O2 = 2CO2 + 3H2O // C2H6 is 1.3631e-2.n3.648. CO2 is 3 and H2O is 4 float a1=1. sd=n1*d1+n2*d2+n3*d3+n4*d4.a2=6.f1.t1.700.n1.

}while(fabs((tnew-t)/tnew)>1e-6). } PROGRAM 4. tnew=t-f/f1. for(int i=0.h> #include<math.y+0.y. x0=0.5*k2).h> void main() { clrscr(). x0=x0+h.00000.252 Appendix: Programs in C++ t=tnew. cout<<\t\t\t OUTPUT<<endl. n=(xf-x0)/h. f=f+h0+da*(t-t0)+(db/2)*(t*t-t0*t0)+(dc/3)*(t*t*t-t0*t0*t0)+(dd/4) *(t*t*t*t-t0*t0*t0*t0).i<=n-1.5*k1).0*k3+k4)/6. cout<<endl. cout<<AFT=<<tnew. cin>>xf. float func(float.5*h.y+k3).float). k3=h*func(x0+0.1 //PROGRAM 4. } float func(float x.00000. int n.k4.xf. y=y+((k1+2. cin>>h. } cout<<\t Value found by Runge-Kutta method at given x: <<y.i++) { k1=h*func(x0. getch().y+0. k4=h*func(x0+h.y=2. cout<<\nEnter the value of x at which y is required: .x0.1 //program to solve an ordinary differential equation by the RungeKutta method #include<iostream.0*k2+2. float h.k1. float y) { . getch(). f1=sa+sb*t+sc*t*t+sd*t*t*t+da+db*t+dc*t*t+dd*t*t*t.0).5*h.h> #include<conio. f=sa*(t-t1)+(sb/2)*(t*t-t1*t1)+(sc/3)*(t*t*t-t1*t1*t1)+(sd/4) *(t*t*t*t-t1*t1*t1*t1). k2=h*func(x0+0. cout<<\tEnter the value of step length (h): .k3.k2.y).

float b) { float rep=19.h> void main() { clrscr(). cin>>zf.0+x).y0+0. n=(zf-z0)/h. getch().0.k2.5*h. cout<<endl. cin>>h.0-sqrt(b))-19.687))/rep.float). } float func(float a.594. cout<<\nEnter the value of z in m at which vp is required: .zf. } .i++) { k1=h*func(z0. return(f).2 //PROGRAM 4.z0.0-sqrt(b)).5*k1). k2=h*func(z0+0.y0=0. z0=0. k4=h*func(z0+h.i<=n-1. float func(float.00000.y0.0*k2+2. for(int i=0.648*(12. cout<<\t\t\t OUTPUT<<endl.y. } cout<<\t Value found by Runge-Kutta method at given z: <<vp. y=y0+((k1+2.y0+k3).2 //program to determine the velocity of a particle in a pneumatic conveyor #include<iostream. int n. cout<<\t Value found at z = <<z0<<  = <<vp<<endl. cout<<\tEnter the value of step length (h): .k4. k3=h*func(z0+0.00000.k1.0).y0+0. float h. float f=6. vp=sqrt(y).15*pow(rep. float cd=24.z.0*(1. z0=z0+h.h> #include<math.0-sqrt(b))*(12.5*h.0+0.5*k2).0*k3+k4)/6.k3.y0).h> #include<conio. return(f). } PROGRAM 4.vp. Appendix: Programs in C++ 253 float f=-y/(1. y0=y.55*cd*(12.

k2=h*func1(x0+0.y+0. } float func1(float x.5*k2.00000.5*h. cout<<\nEnter the value of x at which y and z are required: .z). for(int i=0.254 Appendix: Programs in C++ PROGRAM 4. y=y+((k1+2.h> #include<conio. float func1(float.k3.0*l3+l4)/6.float).5*h.z). l1=h*func2(x0.x0.float.5*k1.0). z=z+((l1+2.0). getch().z+0. float h.y.0*l2+2. float z) { float f=z. float y.z=1.3 //PROGRAM 4. return(f).y+k3.float).l1.5*l2). float y.k4.y.i++) { k1=h*func1(x0.z+l3). cout<<\tEnter the value of step length (h): .00000.y+0. float z) { .00000.z.5*k1.i<=n-1.5*l2).z+l3).y=2.5*l1). float func2(float.l2. l3=h*func2(x0+0. n=(xf-x0)/h. cout<<endl. k3=h*func1(x0+0.0*k3+k4)/6. cin>>h.z+0.z+0.3 //program to solve two simultaneous ordinary differential equations //by Runge-Kutta method #include<iostream. cin>>xf. } cout<<\t Value at given x: <<y<< <<z. l4=h*func2(x0+h. cout<<\t\t\t OUTPUT<<endl.z+0. k4=h*func1(x0+h.y+k3.5*k2. x0=x0+h.5*h.y+0.0*k2+2. x0=0.float.xf.y+0. l2=h*func2(x0+0.5*l1).5*h.l4.y.l3. } float func2(float x. int n.k2.k1.h> void main() { clrscr().h> #include<math.

return(f). l3=h*func2(t0+0.4 //program to solve three simultaneous ordinary differential equations //by the Runge-Kutta method #include<iostream.temp1+k3.00000. m2=h*func3(t0+0.m4.k4.temp1+k3.double.temp2+0.5*l2.temp2+0.double.5*m1).temp3+m3).i++) { k1=h*func1(t0.temp2+0.k1.temp1+0.temp1+0.0).5*h. m4=h*func3(t0+h.5*l1. Appendix: Programs in C++ 255 float f=-y.temp2+0. temp3=temp3+((m1+2.00000.temp1+0.m3. l1=h*func2(t0. t0=0.temp1+0. cout<<The number n is = <<n<<endl. long n.temp2. cout<<\tEnter the value of the step length (h): .temp3+0. cout<<\nEnter the value of t in sec at which temperatures are required: .double).0*m3+m4)/6.5*m2).l3.5*k2.temp1.5*k1. n=(tf-t0)/h.temp3+0.temp1+0.temp1+k3.temp3=20.temp2.temp3+0.temp3). l4=h*func2(t0+h. double func1(double.5*h. for(long i=0.5*l2. l2=h*func2(t0+0.l4.temp1=20.5*l1.5*k2.temp3+m3).temp2+l3.double.0).double.h> #include<math. double h.0).temp2+0. temp1=temp1+((k1+2.5*l2.5*l1.k3.double).5*m2). k3=h*func1(t0+0.5*h.temp2+l3. .temp2=20.00000. cin>>tf.temp3+0.5*m2).temp3+m3).double. m3=h*func3(t0+0. cin>>h.m1. double l1. m1=h*func3(t0.temp1.0*l2+2.4 //PROGRAM 4.double.l2.temp3).0*l3+l4)/6.temp1.temp2+l3.5*m1).temp3). temp2=temp2+((l1+2.t0.temp1+0.5*k1.5*h.00000.k2.temp2.0*m2+2.temp2.i<=n-1. double func2(double.0*k2+2. double func3(double. cout<<\t\t\t OUTPUT<<endl.temp1.m2.temp2+0.5*h.5*k2.5*h.5*m1).5*k1.tf.0*k3+k4)/6. k4=h*func1(t0+h.h> void main() { clrscr().temp3.h> #include<conio. } PROGRAM 4.double).temp3+0.temp3+0. k2=h*func1(t0+0.

002*temp2-0.0021*temp1.float.5 //PROGRAM 4.5 //program to solve three simultaneous ordinary differential equations //for the reaction a -> b -> c by the Runge-Kutta fourth order method #include<iostream. n=(tf-t0)/h. t0=0.float). cin>>tf.m4. . cin>>h.float.065-0.k1. float h. } double func3(double t. cout<<endl. double temp3) { double f=0. double temp2. float func1(float.c. float func2(float. getch().00000. double temp3) { double f=0.float.256 Appendix: Programs in C++ t0=t0+h.b.float.l2. double temp1. double temp2.b=0. cout<<\tEnter the value of step length (h): .c=0.0021*temp3+0.h> #include<conio.float).0021*temp2+0. return(f).00000.a.float. } cout<<\t Value at given t: <<temp1<< <<temp2<< <<temp3. return(f).025. double temp1.tf.k4. int n. double temp3) { double f=0.h> #include<math.m1.025.002*temp1-0.l3. double temp2.00000.t0.k3. float l1. cout<<\t\t\t OUTPUT<<endl.m3.float).l4.m2. double temp1.00000.float. } double func1(double t. return(f). float func3(float.a=1. } double func2(double t. } PROGRAM 4.h> void main() { clrscr(). cout<<\nEnter the value of t in sec at which concentrations are required: .k2.

c+0. float c) { float f=b.0).c+0.5*h.b+0.5*m1).c).5*l2.0).0*k2+2.b+l3. c=c+((m1+2.5*h.a+0.i<=n-1. } PROGRAM 4. l4=h*func2(t0+h.a+0.5*m1).5*k1.a+0.0*l3+l4)/6.5*m2).0*m2+2. m2=h*func3(t0+0.b.a+k3. float a.5*l2.6 //program to solve four simultaneous ordinary differential equations //for the reactions a + b -> c and b + c -> d by the Runge-Kutta method #include<iostream.b+0.b+0. b=b+((l1+2.0*m3+m4)/6.5*k2.c+0. l2=h*func2(t0+0.b+l3.5*l1. float a.c+m3). float b. float c) { float f=-a.b. float a. } float func1(float t.a. k2=h*func1(t0+0.c+m3). getch().a+0.6 //PROGRAM 4.c). return(f).a+0. float b.c+m3).0*l2+2.0*k3+k4)/6.a.a+0.0). m3=h*func3(t0+0. } cout<<\t Value at given t: <<a<< <<b<< <<c<<endl.a+k3. float c) { float f=a-b. return(f).5*k2.5*k1.c). l1=h*func2(t0.c+0.a+k3.i++) { k1=h*func1(t0.5*m2).b+l3. a=a+((k1+2.5*k1. t0=t0+h.5*m2).5*l1. k4=h*func1(t0+h.b.5*k2.h> .b+0.5*h.5*l1.5*m1). float b. m4=h*func3(t0+h.b+0. m1=h*func3(t0. } float func2(float t. Appendix: Programs in C++ 257 cout<<The number n is <<n<<endl. k3=h*func1(t0+0.h> #include<conio. } float func3(float t.5*l2.b+0. l3=h*func2(t0+0.c+0. for(int i=0.a.5*h.5*h. return(f).5*h.c+0.

5*h.b+l3.c+0.k2. m4=h*func3(t0+h.d).b. k4=h*func1(t0+h.c+m3.k1.c+0.5*h.d+0.b+l3.5*l2.5*m1.a+0. double h.d). getch(). a=a+((k1+2.a+0.00000.double.c+0.5*n1).d.d+n3). cout<<\tEnter the value of step length (h): .d+n3). m1=h*func3(t0.5*n1).c.double.5*n1).double).n1.double.a+k3.double. long n.d+0.00000.l4. } cout<<\t Value at given t: <<a<< <<b<< <<c<< <<d<<endl. l2=h*func2(t0+0.5*n2).a+0.5*l1.5*l1.d+n3).double.5*k1.a.c+0. double func4(double.258 Appendix: Programs in C++ #include<math.a=1. m2=h*func3(t0+0.5*m1.b.m1.5*k2.5*l2.00000.5*n2).m4.b=1. } .5*n2).a+0.d=0.5*h.0*n3+n4)/6.n3.5*k2.5*m1.double.h> void main() { clrscr().double).5*l1.c.a+k3. cout<<The number n is = <<n<<endl.d).k3.0*m2+2.b. m3=h*func3(t0+0.double. t0=t0+h. k3=h*func1(t0+0.c+0.5*k1.00000.0*n2+2.5*l2.b+0.00000.5*m2.5*l2.b.c=0.i<=n-1.5*m2.0).0*l3+l4)/6. double func3(double.a+k3.a.0*l2+2.b+0.5*k1.b+0.double.0*k3+k4)/6.b+0.double.d+0.5*h.a.5*n1).d+0.5*n2).m2. d=d+((n1+2.5*k2.0*m3+m4)/6.5*m2. l1=h*func2(t0.k4. cin>>tf.c+0. c=c+((m1+2.5*l1.double.d+0.double. n1=h*func4(t0. n=(tf-t0)/h.c+m3. t0=0.b+0.b+l3.a+0.a+0.d+n3).c+m3.a.5*h.0). n4=h*func4(t0+h.5*k2.double. double func1(double. cout<<\nEnter the value of t in sec at which concentrations are required: .5*h.l2.c+0.double).n2.0*k2+2.0).tf. cout<<\t\t\t OUTPUT<<endl.c. for(long i=0.b+l3.m3.b+0.5*h.5*h.d+0.l3.c+0. n2=h*func4(t0+0.5*m2.5*m1. double l1.t0.a+0. double func2(double. b=b+((l1+2.d+0. l3=h*func2(t0+0.5*k1.b+0. n3=h*func4(t0+0.d+0.a.b.i++) { k1=h*func1(t0.0).double).d). k2=h*func1(t0+0.b+0. l4=h*func2(t0+h.c+m3.a+0.n4.c.c.a+k3. cin>>h.

7 //PROGRAM 4.k4.float. double a.t.float). double b. Appendix: Programs in C++ 259 double func1(double t. } double func2(double t. return(f).h> void main() { clrscr(). cout<<\tEnter the value of step length (h): .h> #include<math.00000. } double func4(double t.z0. double d) { double f=-a*b-b*c. cin>>h. double b. double c. double d) { double f=a*b-b*c. return(f). cout<<\nEnter the value of z in m at which x and t are required: . double a. double d) { double f=-a*b. z0=0. float func1(float. float h. } PROGRAM 4. n=(zf-z0)/h.k3.l2.h> #include<conio. double a. double c.7 //program to solve ordinary differential equations in a non-isothermal //tubular reactor by the Runge-Kutta method #include<iostream.x. double c.i++) { .l1. for(int i=0.t=294. double b. double c. return(f). return(f). double d) { double f=b*c. cin>>zf. cout<<\t\t\t OUTPUT<<endl.x=0. float func2(float.zf.00000. int n.15. double a.float.l3.k1.i<=n-1.float).k2. double b.l4. } double func3(double t.

t+0.5*l1).x. float x. for(i=2.5*k2.0527*(1-x)*exp(33.0).x+0.5*h. getch().x+k3.d[101].n1. k4=h*func1(z0+h.0008.5*l2).5*h.x1[101]. } float func1(float z.iter.1 //PROGRAM 7. z0=z0+h.t+l3).t).beta[101].0*l3+l4)/6. l4=h*func2(z0+h.x+k3. float a[101]. return(f).h> #include<math.5*h.i1. float t) { float f=7.t+l3).t+0. float t) { float f=0.71/t)).68*(1-388.5*h.71/t)). x=x+((k1+2.gamma[101].++i) {a[i]=2.1*0. k3=h*func1(z0+0.665*(388.5*k1.++i) .0527*(1-x)*exp(33.5*l2). l3=h*func2(z0+0.t+0. int i.t).c[101].0008. } cout<<\t Value at given z: <<x<< <<t<<endl. } PROGRAM 7.5*k1. return(f). k2=h*func1(z0+0. l2=h*func2(z0+0.i<=20.i<=20.x+0.b[101].h> void main() { clrscr().j.1 //program to calculate the concentration profile in a //tubular reactor with axial dispersion (second order reaction) #include<iostream. cout<<endl.0*l2+2. c[1]=2. l1=h*func2(z0.5*l1).71-t)-29554.0). } a[21]=2.n.68*(1-388. for(i=2.k.260 Appendix: Programs in C++ k1=h*func1(z0.0*k3+k4)/6. } float func2(float z.x[101].x+0.0004. float x.5*k2.x.h> #include<conio. t=t+((l1+2.t+0.x+0.0*k2+2.

for(i=1. x[j]=gamma[j]-c[j]*x[j+1]/beta[j]. } for(i=1.++j) { beta[j]=b[j]-a[j]*c[j-1]/beta[j-1].0. for(i=2. } cout<<Number of iterations is <<iter. } . } x[n]=gamma[n]. getch(). do { iter=iter+1. for(i=2.k<=n1.i<=21. Appendix: Programs in C++ 261 {c[i]=0. cout<<\t\t\t THE SOLUTION BY TDMA<<endl.++i) {x[i]=0. n1=n-i.++k) { j=n-k. for(i=1.j<=n. i1=i+1. beta[i]=b[i]. } d[1]=-20004.++i) {d[i]=0.0008-x1[i].i<=21.0004. for(k=1.++i) {x1[i]=x[i].++i) { cout<<x[<<i<<] = <<x[i]<<endl. gamma[j]=(d[j]-a[j]*gamma[j-1])/beta[j].0.i<=21.i<=21. } }while(fabs(x[12]-x1[12])>1e-6&&fabs(x[18]-x1[18])>1e-6). n=21.i<=21.0.} b[1]=-20005.9992-x1[1]. for(j=i1. } i=1. } iter=0.++i) {b[i]=-2. gamma[i]=d[i]/beta[i].

sum.ab.0004. a[4][8]=2.l.0. a[3][3]=-20005. a[7][7]=-2.0004.i++) {x1[i]=x[i].2 //PROGRAM 7.0008-x1[6].9992-x1[2].jj.big.x[90]. float a[90][91]. . a[7][3]=2. a[4][4]=-20005.nn.i<=84.0008.quot. a[6][2]=2.9992. cout<<n<<endl.ip1.i++) { for(j=1. a[6][10]=0. for(i=1.0008-x1[5]-x1[7].t.i<=n. a[2][6]=2.j++) { a[i][j]=0. l=n-1.kp1.m.0008.262 Appendix: Programs in C++ PROGRAM 7.i++) {x[i]=0. a[5][5]=-2. m=n+1.9992-x1[1]-x1[3].} do { for(i=1.01.0004.2 //program to calculate the concentration profile in a tubular reactor //with axial dispersion in which two parallel reactions take place #include<iostream.0008-x1[6]. a[3][7]=2.9992-x1[2].j<=m. a[2][2]=-20005.0008. n=84.i<=84. int n. a[5][1]=2.h> #include<math. a[5][9]=0.0008.x1[90].i. } } for(i=1.0004.j.h> #include<conio.0004. a[6][6]=-2.k.} a[1][1]=-20005. a[1][5]=2.h> void main() { clrscr().

a[20][16]=2.0008-x1[21]-x1[23].0004.0004.0004.0008-x1[14]. a[9][13]=0.0008. a[12][12]=-2. a[15][11]=2. a[22][26]=0. a[18][22]=0.0008-x1[10].0004. a[15][15]=-2.0004. a[19][23]=0.0004.0004.0004. a[19][19]=-2. a[21][21]=-2. a[16][16]=-2.0004. a[8][12]=0.0004.0008.0004. a[13][17]=0.0004. a[14][18]=0.0004. a[21][25]=0. a[15][19]=0. a[14][14]=-2. a[18][18]=-2.0004.0004. a[18][14]=2. a[20][24]=0.0004.0004. a[13][13]=-2. a[10][10]=-2. a[19][15]=2. a[8][8]=-2.0008-x1[14].0004. a[20][20]=-2.0004. a[13][9]=2.0004.0004.0004. Appendix: Programs in C++ 263 a[7][11]=0. a[11][15]=0. a[9][9]=-2.0004. a[11][7]=2.0008.0004.0008. a[10][14]=0. a[10][6]=2. .0004.0008-x1[17]-x1[19]. a[11][11]=-2.0008-x1[9]-x1[11].0008-x1[18]. a[12][8]=2.0004. a[16][12]=2. a[17][17]=-2. a[17][21]=0.0004. a[9][5]=2. a[22][22]=-2.0008-x1[22]. a[17][13]=2.0004. a[14][10]=2.0004.0008-x1[18].0004. a[8][4]=2.0008-x1[13]-x1[15]. a[22][18]=2.0004. a[12][16]=0.0008-x1[10]. a[16][20]=0. a[21][17]=2.

0004. a[36][32]=2.0004.0004.0008-x1[30].0004. a[26][26]=-2.0004.0004. a[23][23]=-2. a[32][36]=0. a[38][34]=2. a[35][35]=-2.0004.0004. a[24][20]=2. a[23][27]=0.0008. a[32][28]=2. a[33][33]=-2. a[37][33]=2.0004.0004.0004. a[36][40]=0.0004.0008-x1[34]. a[25][25]=-2. a[26][30]=0. a[29][33]=0. a[37][37]=-2.0004. a[26][22]=2.0004.0004.0004. a[25][21]=2. a[34][30]=2.0008-x1[26]. a[25][29]=0.0004. a[27][31]=0.0004.0004.0008-x1[29]-x1[31]. a[31][31]=-2. a[35][31]=2.0004.0008.0008.0004. a[34][34]=-2.0008-x1[22]. a[31][27]=2. a[33][29]=2. a[28][32]=0.0004. a[30][30]=-2. .0004. a[34][38]=0. a[31][35]=0. a[24][24]=-2.0004.264 Appendix: Programs in C++ a[23][19]=2.0004.0008-x1[30].0004. a[29][29]=-2.0008-x1[38]. a[30][34]=0. a[33][37]=0.0004. a[27][23]=2. a[24][28]=0.0004.0004.0004. a[35][39]=0. a[28][28]=-2. a[30][26]=2. a[32][32]=-2. a[27][27]=-2. a[28][24]=2. a[37][41]=0.0008-x1[34].0008-x1[33]-x1[35].0004.0008-x1[25]-x1[27]. a[29][25]=2.0008-x1[26].0008. a[36][36]=-2.

0004.0004. a[39][39]=-2.0004. a[50][50]=-2. a[49][53]=0.0008-x1[42].0004. a[44][40]=2.0004. a[45][49]=0.0004. a[41][41]=-2.0004. a[52][56]=0.0004.0008-x1[45]-x1[47]. a[50][54]=0. a[53][49]=2. a[46][50]=0.0004. a[49][45]=2.0008. a[39][43]=0.0008-x1[37]-x1[39].0004.0004. a[49][49]=-2. Appendix: Programs in C++ 265 a[38][38]=-2.0004. a[44][48]=0.0004. a[47][51]=0.0004. a[52][48]=2.0004.0004.0004. a[44][44]=-2. a[45][41]=2.0004. a[46][46]=-2. a[43][47]=0. . a[48][44]=2.0008-x1[50].0008-x1[50].0004. a[42][38]=2. a[41][45]=0.0004.0004. a[47][47]=-2.0008. a[53][53]=-2. a[38][42]=0.0004. a[39][35]=2.0008-x1[41]-x1[43].0004. a[47][43]=2. a[45][45]=-2.0008-x1[46]. a[43][43]=-2.0004. a[51][47]=2. a[51][51]=-2. a[40][40]=-2. a[48][48]=-2.0008-x1[46].0008.0008-x1[49]-x1[51].0008-x1[38]. a[42][42]=-2.0004. a[46][42]=2.0004. a[52][52]=-2. a[42][46]=0. a[41][37]=2.0008-x1[42].0008.0004. a[48][52]=0.0008-x1[54].0004. a[51][55]=0. a[50][46]=2. a[40][36]=2. a[43][39]=2. a[40][44]=0.0004.0004.

a[57][53]=2. a[66][62]=2. a[59][63]=0.0008-x1[66]. a[54][50]=2.0004. a[62][62]=-2.0004. a[58][58]=-2.0008.0008-x1[61]-x1[63]. a[60][56]=2.0004. a[65][69]=0. a[54][58]=0. a[67][71]=0.0004.0004.0004. a[61][57]=2. a[56][56]=-2. a[60][60]=-2. a[56][60]=0.0004.0004. a[57][57]=-2. a[65][65]=-2. a[55][59]=0. . a[68][68]=-2. a[62][66]=0. a[68][64]=2.0004. a[63][63]=-2.0004.0008-x1[53]-x1[55].0008.0008.0008-x1[54].0004. a[64][60]=2.0008-x1[58].0004.0008-x1[65]-x1[67].0004.0008-x1[58].0008-x1[62]. a[61][61]=-2. a[58][54]=2. a[66][66]=-2.0004.0004. a[66][70]=0.0004. a[59][55]=2.0004. a[55][55]=-2.0004.0004.0004. a[67][63]=2.0004. a[59][59]=-2. a[61][65]=0. a[54][54]=-2.0004. a[65][61]=2.0004.0008-x1[62]. a[62][58]=2. a[58][62]=0. a[55][51]=2.0004.0004. a[64][68]=0. a[56][52]=2.0004. a[67][67]=-2. a[63][67]=0.0004.0004.0004. a[63][59]=2. a[60][64]=0.0008-x1[57]-x1[59]. a[64][64]=-2.0004. a[68][72]=0.266 Appendix: Programs in C++ a[53][57]=0.0004.0008. a[57][61]=0.0008-x1[66].

a[76][76]=-2. a[71][75]=0. a[80][76]=2.0004. a[77][77]=-2. a[82][82]=-2.0004. a[71][71]=-2. a[77][81]=0. a[82][78]=2.0004.0008-x1[82].0008-x1[82]. a[75][71]=2. a[2][85]=-20004.0008-x1[81]-x1[83]. a[1][85]=-20004. a[75][79]=0. a[78][74]=2. a[72][68]=2. a[79][79]=-2.0004. a[72][72]=-2.0004.0004. a[78][82]=0. a[72][76]=0. a[83][83]=-2.0008. a[74][74]=-2. a[79][75]=2. a[84][80]=2.0008-x1[70]. Appendix: Programs in C++ 267 a[69][65]=2. a[81][77]=2.0004.0004.0008.0008-x1[78].0004.0004. a[70][66]=2. a[69][69]=-2.0008-x1[78].0004.0008-x1[70].0004. a[73][77]=0. a[73][69]=2.0008-x1[69]-x1[71]. a[77][73]=2. a[79][83]=0.0.0004. a[73][73]=-2.0004. a[76][80]=0.0008.0004. a[78][78]=-2. a[70][70]=-2.0008.0004.0004. a[71][67]=2.0008-x1[74]. a[75][75]=-2.0. a[69][73]=0.0004.0004. a[83][79]=2.0008-x1[73]-x1[75].0004.0008-x1[77]-x1[79].0008. .0008-x1[74].0008.0004.0008. a[74][70]=2.0008.0004.0004. a[76][72]=2. a[80][84]=0.0004. a[70][74]=0. a[81][81]=-2. a[74][78]=0. a[84][84]=-2. a[80][80]=-2.

268 Appendix: Programs in C++ a[3][85]=-x1[1]*x1[2]. a[35][85]=-x1[33]*x1[34]. a[36][85]=-x1[34]*x1[35].0. a[4][85]=-x1[2]*x1[3]. a[17][85]=0. a[22][85]=0. a[23][85]=-x1[21]*x1[22]. a[26][85]=0.0. a[25][85]=0. a[9][85]=0. a[20][85]=-x1[18]*x1[19].0. a[21][85]=0.0. a[29][85]=0.0. a[15][85]=-x1[13]*x1[14].0. a[48][85]=-x1[46]*x1[47]. a[24][85]=-x1[22]*x1[23]. a[27][85]=-x1[25]*x1[26]. a[13][85]=0.0. a[6][85]=0. a[7][85]=-x1[5]*x1[6]. a[12][85]=-x1[10]*x1[11].0. a[42][85]=0. a[8][85]=-x1[6]*x1[7].0. a[32][85]=-x1[30]*x1[31]. a[45][85]=0. a[40][85]=-x1[38]*x1[39].0.0. a[41][85]=0.0. a[44][85]=-x1[42]*x1[43]. a[37][85]=0. a[38][85]=0.0. . a[28][85]=-x1[26]*x1[27]. a[10][85]=0.0.0. a[31][85]=-x1[29]*x1[30]. a[33][85]=0.0.0. a[11][85]=-x1[9]*x1[10]. a[30][85]=0. a[5][85]=0. a[46][85]=0.0.0. a[19][85]=-x1[17]*x1[18].0.0. a[18][85]=0. a[39][85]=-x1[37]*x1[38].0. a[43][85]=-x1[41]*x1[42]. a[14][85]=0. a[16][85]=-x1[14]*x1[15]. a[34][85]=0. a[47][85]=-x1[45]*x1[46].

a[51][85]=-x1[49]*x1[50]. a[73][85]=0. a[71][85]=-x1[69]*x1[70]. for(i=kp1.0. a[75][85]=-x1[73]*x1[74]. a[84][85]=-x1[82]*x1[83]. a[56][85]=-x1[54]*x1[55].0. a[70][85]=0. a[68][85]=-x1[66]*x1[67].0.0.0.0. if((big-ab)<0. a[83][85]=-x1[81]*x1[82]. a[72][85]=-x1[70]*x1[71]. a[59][85]=-x1[57]*x1[58].k++) { big=fabs(a[k][k]). a[82][85]=0.i++) { ab=fabs(a[i][k]). a[63][85]=-x1[61]*x1[62]. a[55][85]=-x1[53]*x1[54]. a[53][85]=0. jj=k. a[61][85]=0. a[64][85]=-x1[62]*x1[63].0. a[50][85]=0. a[74][85]=0. a[52][85]=-x1[50]*x1[51]. a[69][85]=0.0.0. a[81][85]=0. a[65][85]=0. a[77][85]=0.0. a[67][85]=-x1[65]*x1[66]. a[54][85]=0.0. a[62][85]=0. a[80][85]=-x1[78]*x1[79].0.i<=n. kp1=k+1.0.0. a[58][85]=0. a[79][85]=-x1[77]*x1[78]. a[76][85]=-x1[74]*x1[75]. a[66][85]=0.0. a[57][85]=0.0. Appendix: Programs in C++ 269 a[49][85]=0.0) { .0. for(k=1. a[60][85]=-x1[58]*x1[59].k<=l. a[78][85]=0.0.

nn++) { sum=0. for(nn=1. } . a[k][j]=t.j<=m. for(j=ip1. } } if((jj-k)>0) { for(j=k. } }while(fabs(x[21]-x1[21])>1e-6&&fabs(x[84]-x1[84])>1e-6).i<=n. } } x[n]=a[n][m]/a[n][n]. } } for(i=kp1.j++) { t=a[jj][j]. } x[i]=(a[i][m]-sum)/a[i][i].0. a[jj][j]=a[k][j]. ip1=i+1. for(i=1.j<=m. } } for(i=kp1.i++) { quot=a[i][k]/a[k][k].270 Appendix: Programs in C++ big=ab. jj=i.0.j++) { a[i][j]=a[i][j]-quot*a[k][j].i<=n.} getch().j<=n.i<=n. i=n-nn. for(j=kp1.j++) { sum=sum+a[i][j]*x[j].i++) {cout<<x[i]<<endl.nn<=l.i++) { a[i][k]=0.

++j) { . float a[105]. for(j=i1.++i) {a[i]=1. do { iter=iter+1.j<=n.0/(i-1. } for(i=1.beta[105]. for(i=2. for(i=1.h> #include<math.i<=99.01*x1[1].i<=99.0.0-(1.0. } b[1]=-6.0)). int i. } for(i=2.x[105].++i) {d[i]=0.i<=100.iter.0-0. i1=i+1.n.d[105]. for(i=1.b[105]. } c[1]=6.n1.j.++i) {x[i]=0.i1.0-0.0/(i-1.0)).i<=100. for(i=2.++i) {b[i]=-2.1 //PROGRAM 8. beta[i]=b[i].0. gamma[i]=d[i]/beta[i].++i) {x1[i]=x[i].i<=100. } //loop starts from here iter=0. n=100.0+(1.1 //program to calculate the concentration profile along the radius for //reaction-diffusion in a spherical catalyst pellet (second order //isothermal reaction) #include<iostream. Appendix: Programs in C++ 271 PROGRAM 8.h> void main() { clrscr().01*x1[i].k.0.i<=100.. } d[100]=-100. i=1.c[105].0/99.h> #include<conio.gamma[105].++i) {c[i]=1.x1[105].

h> #include<math.i1. } iter=0.i<=100. cout<<\t\t\t THE SOLUTION BY TDMA<<endl. int i.k<=n1. getch().k. n1=n-i. } PROGRAM 8.++i) {x1[i]=x[i]. for(i=1. x[j]=gamma[j]-c[j]*x[j+1]/beta[j]. } }while(fabs(x[1]-x1[1])>1e-6&&fabs(x[100]-x1[100])>1e-6).iter.gamma[105].++i) .++i) { cout<<x[<<i<<] = <<x[i]<<endl.0.2 //program to calculate the concentration profile along the radius for //reaction-diffusion in a spherical catalyst pellet (non-isothermal.h> void main() { clrscr(). //loop starts from here do { iter=iter+1. float a[105].n1.i<=100. } cout<<Number of iterations is <<iter.i<=100.2 //PROGRAM 8.n. for(i=1.j.beta[105].x1[105]. } x[n]=gamma[n].b[105]. beta=1) #include<iostream.i<=100. for(i=1.c[105]. } for(i=2.272 Appendix: Programs in C++ beta[j]=b[j]-a[j]*c[j-1]/beta[j-1].h> #include<conio.++i) {x[i]=0.++k) { j=n-k. for(k=1. gamma[j]=(d[j]-a[j]*gamma[j-1])/beta[j].d[105].x[105].

0)).0-0. } cout<<Number of iterations is <<iter.++i) {d[i]=0.0/(i-1.0-x1[i])/(2. cout<<\t\t\t THE SOLUTION BY TDMA<<endl. x[j]=gamma[j]-c[j]*x[j+1]/beta[j]. for(k=1.01*exp((1.i<=99. getch(). gamma[j]=(d[j]-a[j]*gamma[j-1])/beta[j]. n1=n-i. Appendix: Programs in C++ 273 {a[i]=1. } }while(fabs(x[1]-x1[1])>1e-6&&fabs(x[100]-x1[100])>1e-6).1 //PROGRAM 9.0/99. beta[i]=b[i]. gamma[i]=d[i]/beta[i]. i=1.++i) { cout<<x[<<i<<] = <<x[i]<<endl. } d[100]=-100.++k) { j=n-k.0/(i-1.i<=99. } b[1]=-6. } PROGRAM 9.++j) { beta[j]=b[j]-a[j]*c[j-1]/beta[j-1].0.0)).k<=n1. } x[n]=gamma[n].1 //program to calculate the temperature profile in a rectangular //slab during transient heat conduction .0.0-x1[1])/(2. } c[1]=6.0-x1[1])).0-x1[i]))..0-(1.01*exp((1. for(j=i1.++i) {c[i]=1.0. n=100.0+(1. for(i=1. for(i=2. i1=i+1.i<=100.0-0. } for(i=1.i<=100.j<=n. for(i=2.++i) {b[i]=-2.

time<timef. float a[21].0.k. gamma[j]=(d[j]-a[j]*gamma[j-1])/beta[j].++j) { beta[j]=b[j]-a[j]*c[j-1]/beta[j-1].1.0.time. x[2]=20. for(time=0. x[4]=20.time=time+0. d[4]=-x4old-300.0.0.0.i1.0. i=1.0. c[1]=1. d[2]=-x2old.0.0.0. c[2]=1. d[3]=-x3old. x3old=x[3].h> #include<math. i1=i+1. b[3]=-3. b[4]=-3. c[3]=1.j<=n.0.x[21]. x[1]=20. int i.1) { x1old=x[1].x2old.x3old. time=0. b[2]=-3.5.n. x[3]=20. for(j=i1. float x1old.beta[21]. gamma[i]=d[i]/beta[i].274 Appendix: Programs in C++ #include<iostream.h> void main() { clrscr(). d[1]=-0. beta[i]=b[i].0.0. b is diagonal and c is superdiagonal a[2]=1. x4old=x[4].0. } .n1. b[1]=-1. //a is subdiagonal.x4old.0.5*x1old.h> #include<conio.0.c[21]. a[3]=1. a[4]=1.b[21].gamma[21].timef. n=4.j.d[21]. x2old=x[2]. timef=3.

0-1.beta[21].x[21]. b is diagonal and c is superdiagonal for(i=2. float a[21].x9old.k<=n1.x10old.0/(i-1.0. float x1old.0.d[21].b[21].i<=9.2 //PROGRAM 9. cout<<x[1]<< <<x[2]<< <<x[3]<< <<x[4]<<endl. } b[1]=591.i<=10. } cout<<\t\t\t THE SOLUTION BY TDMA AT TIME = <<time<< seconds<<endl. } for(i=2.x6old.x4old. for(i=1.x8old.h> void main() { clrscr().h> #include<conio.++i) { b[i]=3544.timef.gamma[21]. } getch().9.n1. //a is subdiagonal. } time=0.i1.c[21].i<=10.n. for(k=1. for(i=2.time.5.++i) { x[i]=68.2 //program to calculate the concentration profile in a sphere //during transient diffusion of drug from spherical pellet #include<iostream.x3old.k.h> #include<math.j. } PROGRAM 9. timef=10800. x[j]=gamma[j]-c[j]*x[j+1]/beta[j].i<=10.++i) { .++k) { j=n-k.4.++i) { a[i]=-(1. int i.0)). n1=n-i.x7old.x5old.x2old. Appendix: Programs in C++ 275 x[n]=gamma[n].

time=time+1.4. d[9]=x9old*3542.++k) { j=n-k. d[3]=x3old*3542.k<=n1.5. d[4]=x4old*3542. x10old=x[10]. } x[n]=gamma[n].++j) { beta[j]=b[j]-a[j]*c[j-1]/beta[j-1]. for(k=1.0)).5.5.5. x[j]=gamma[j]-c[j]*x[j+1]/beta[j].0/(i-1. d[10]=x10old*3542. for(time=0.0) { x1old=x[1]. d[1]=x1old*590. x9old=x[9].0+1.0. } c[1]=-1. n1=n-i.time<timef. for(j=i1.5.i<=10.5. beta[i]=b[i]. x8old=x[8].5. x2old=x[2]. d[6]=x6old*3542. x4old=x[4]. x3old=x[3]. d[2]=x2old*3542. i=1. } } cout<<\t\t\t THE SOLUTION BY TDMA AT TIME = <<time<< seconds<<endl. n=10. x7old=x[7]. gamma[i]=d[i]/beta[i].276 Appendix: Programs in C++ c[i]=-(1.++i) . x5old=x[5]. for(i=1. d[8]=x8old*3542.5.j<=n. gamma[j]=(d[j]-a[j]*gamma[j-1])/beta[j].5. d[7]=x7old*3542. d[5]=x5old*3542.0. i1=i+1. x6old=x[6].

t12old. t13new=(t12new+t23old+600)/4. t31new=(0. t23old=t23new.t12new.h> #include<math. t11new=t12new=t13new=101.t22old.0. float t21old. t23new=(t13new+t22new+t33old+500)/4.5*t21new+0. t21new=t22new=t23new=101.1 //program to calculate the temperature profile in a 2-D body //during steady heat conduction using the GaussSeidel method #include<iostream.5*t32new+100/3)*3/7.t31new.5*t33old+100/3)*3/7. float t31old. t33new=(t23new+250+0. t32old=t32new. t13old=t13new.t23old.5*t11new+0. t22new=(t12new+t32old+t23old+t21new)/4. t21old=t21new.t22new. float t11old. do { t11old=t11new.t33new.0/3.h> void main() { clrscr().1 //PROGRAM 10. t22old=t22new. t12old=t12new.t23new. t21new=(t22old+0.t32old.h> #include<conio.t33old.5*t31new+0.5*t32old+100/3)*3/4. Appendix: Programs in C++ 277 { cout<<x[i]<<endl. t32new=(t22new+0.0)*3/7.5*t21old+100.5*t31old+100/3)*3/7.t13new. } getch(). t31new=t32new=t33new=101. t11new=(t12old+50+0. } PROGRAM 10.t32new.0.0.t21new. t12new=(t11new+t13old+t22old+100)/4. t33old=t33new.t11new. t31old=t31new.t13old. }while(fabs(t11new-t11old)>1e-6&&fabs(t12new-t12old)>1e- 6&&fabs(t13new-t13old)>1e-6 .0.

i1.0.0.0.0. c[1]=1. a[2]=1. t[1][4]=tstar[1][4]=400. t[4][2]=tstar[4][2]=20.b[21]. t[2][0]=tstar[2][0]=20. cout<<Enter the maximum number of iterations .h> void main() { clrscr().0. } PROGRAM 10.h> #include<conio.beta[21].j. float tstar[21][21]. t[3][4]=tstar[3][4]=400.n.0.0.0.n1.nn.0. t[21][21].0.0. float a[21]. b[1]=-4.2 //program to calculate the temperature profile in a 2D body //during steady heat conduction using the ADI method #include<iostream.jj.0. getch(). cout<<t11new<< <<t12new<< <<t13new<<endl. b[3]=-4. t[3][0]=tstar[3][0]=20. int i.0. cout<<t31new<< <<t32new<< <<t33new<<endl.d[21]. t[0][3]=tstar[0][3]=20.0. a[3]=1.h> #include<math. c[2]=1. t[2][4]=tstar[2][4]=400. t[1][0]=tstar[1][0]=20.gamma[21]. b[2]=-4.x[21]. cout<<t21new<< <<t22new<< <<t23new<<endl.k. t[0][2]=tstar[0][2]=20.0. t[4][3]=tstar[4][3]=20.0.0.278 Appendix: Programs in C++ &&fabs(t21new-t21old)>1e-6&&fabs(t22new-t22old)>1e-6&&fabs(t23new- t23old)>1e-6 &&fabs(t31new-t31old)>1e-6&&fabs(t32new-t32old)>1e-6&&fabs(t33new- t33old)>1e-6).c[21].2 //PROGRAM 10. t[0][1]=tstar[0][1]=20. . t[4][1]=tstar[4][1]=20.nmax.0.ii. cin>>nmax.0.

gamma[i]=d[i]/beta[i].j++) { t[i][j]=20.k<=n1.jj++) { d[1]=-t[0][jj]-t[1][jj+1]-tstar[1][jj-1].++j) { beta[j]=b[j]-a[j]*c[j-1]/beta[j-1]. x[j]=gamma[j]-c[j]*x[j+1]/beta[j]. for(j=i1. d[2]=-tstar[ii+1][2]-tstar[ii-1][2]. beta[i]=b[i]. i=1.jj<=3. gamma[j]=(d[j]-a[j]*gamma[j-1])/beta[j]. } for(ii=1. tstar[3][jj]=x[3]. Appendix: Programs in C++ 279 for(i=1. beta[i]=b[i]. n=3.0.j<=n. d[3]=-t[4][jj]-t[3][jj+1]-tstar[3][jj-1]. for(k=1. gamma[i]=d[i]/beta[i]. } } for(nn=1. i1=i+1.j<=3.ii++) { d[1]=-t[ii][0]-tstar[ii+1][1]-tstar[ii-1][1].++k) { j=n-k.nn++) { for(jj=1. } tstar[1][jj]=x[1]. i=1. . } x[n]=gamma[n]. i1=i+1. n=3.i++) { for(j=1.ii<=3. n1=n-i.nn<=nmax. tstar[2][jj]=x[2]. d[2]=-t[2][jj+1]-tstar[2][jj-1].i<=3. d[3]=-t[ii][4]-tstar[ii+1][3]-tstar[ii-1][3].

k.4. t[ii][3]=x[3]. float a[21]. getch().h> #include<conio.ii.++k) { j=n-k. cout<<t[3][1]<< <<t[3][2]<< <<t[3][3]<<endl.k++) { a[k]=-1.n1.gamma[21].b[21].x[21].++j) { beta[j]=b[j]-a[j]*c[j-1]/beta[j-1].timef.i1.beta[21].nmax.n. cout<<t[1][1]<< <<t[1][2]<< <<t[1][3]<<endl.nn.h> void main() { clrscr(). for(k=1.3 //program to calculate the temperature profile in a 2D body //during transient heat conduction using the ADI method #include<iostream.jj.k<=n1.time. gamma[j]=(d[j]-a[j]*gamma[j-1])/beta[j]. for(k=1.3 //PROGRAM 10.h> #include<math. n1=n-i.d[21].t[21][21]. } t[ii][1]=x[1].j.j<=n. } . cout<<t[2][1]<< <<t[2][2]<< <<t[2][3]<<endl.kk. timef=0.5.k<=10. x[j]=gamma[j]-c[j]*x[j+1]/beta[j]. } } cout<<\t\t\t THE SOLUTION BY ADI<<endl. int i. b[k]=2. } PROGRAM 10.c[21].0.count. float tstar[21][21]. c[k]=-1.280 Appendix: Programs in C++ for(j=i1. } x[n]=gamma[n]. t[ii][2]=x[2].0.

ii++) { d[ii]=2*t[ii][2]-1. for(k=1.0.0. gamma[j]=(d[j]-a[j]*gamma[j-1])/beta[j]. tstar[k][11]=400.ii++) { d[ii]=t[ii][jj+1]+t[ii][jj-1]-1.0. beta[i]=b[i]. i1=i+1.jj<=10. } } for(time=0.j<=10. n=10.i<=10.jj++) { if(jj==1) { for(ii=1.0. t[k][11]=400.0.0.k<=11.time<=timef. } else { for(ii=1. gamma[i]=d[i]/beta[i]. } d[10]=d[10]+400. } i=1. } . tstar[i][j]=0.05) { for(jj=1.i++) { for(j=1. for(j=i1. tstar[11][k]=400. } for(i=1.j++) { t[i][j]=0.0. } d[10]=d[10]+400. Appendix: Programs in C++ 281 c[1]=-2.ii<=10.0.0.6*t[ii][1].0.j<=n.k++) { t[11][k]=400.ii<=10.time=time+0.++j) { beta[j]=b[j]-a[j]*c[j-1]/beta[j-1].6*t[ii][jj].

} i=1.jj++) { d[jj]=2*tstar[ii+1][1]-1. } d[10]=d[10]+400. i1=i+1. } d[10]=d[10]+400.jj<=10.jj<=10. } else { for(jj=1. } x[n]=gamma[n]. gamma[j]=(d[j]-a[j]*gamma[j-1])/beta[j].6*tstar[ii][jj].jj++) { d[jj]=tstar[ii-1][jj]+tstar[ii+1][jj]-1. n=10.ii<=10.count=count+1) { tstar[count][jj]=x[count]. beta[i]=b[i].0.6*tstar[ii][1].ii++) { if(ii==1) { for(jj=1.j<=n.282 Appendix: Programs in C++ x[n]=gamma[n]. n1=n-i. for(k=1.count<=10.++j) { beta[j]=b[j]-a[j]*c[j-1]/beta[j-1].++k) { .k<=n1. } } for(ii=1.0.k<=n1. n1=n-i. } for(count=1. gamma[i]=d[i]/beta[i]. x[j]=gamma[j]-c[j]*x[j+1]/beta[j]. for(k=1.++k) { j=n-k. for(j=i1.

} } } cout<<\t\t\t THE SOLUTION BY ADI AT TIME = <<time<< s<<endl.i<=10.count<=10.j<=10. } .count=count+1) { t[ii][count]=x[count].j++) { cout<<t[<<i<<][<<j<<] = <<t[i][j]<<\t. for(i=1. } } getch().i++) { for(j=1. x[j]=gamma[j]-c[j]*x[j+1]/beta[j]. } for(count=1. Appendix: Programs in C++ 283 j=n-k.

J. New Delhi.B. 1969 Cengel. 2nd ed. S. New York. R.S. Applied Numerical Methods.O. New Delhi..D. Computational Fluid Dynamics: The Basics with Applications. K. New York. Chung.M.. Computational Fluid Dynamics..J.V. Fogler. New York. H. 2002. Transport Phenomena. 2003 Chapra.. New York.. R. Tata McGraw-Hill. New Delhi.A. Anderson. Cambridge. Reaction Kinetics and Reactor Design... J.C. 1980.A.Bibliography Ahuja. 1995. and Rousseau. A. 285 .P. Finlayson... B. Stewart. Nonlinear Analysis in Chemical Engineering. Prentice Hall. New York. John Wiley. Elementary Principles of Chemical Processes. 2nd ed.. 1998..B. Cambridge University Press. John Wiley.. Beers. 1980. B. Upper Saddle River. Introduction to Chemical Engineering Computing. E.. UK.A. New York... and Wilkes.. Englewood Cliffs. Numerical Methods for Engineers. New Jersey. McGraw-Hill. Carnahan. 4th ed. W. 1971 Felder. G. Elements of Chemical Reaction Engineering. and Canale. and Jeffreys. 2002... 2006. 3rd ed. Y. Edinburgh. 2009.. Tata McGraw-Hill.E. PHI Learning. Chemical Kinetics and Reactor Design. Numerical Methods for Chemical Engineering: Applications in MATLAB. John Wiley. B. Chemical Engineering Thermodynamics. Cambridge University Press. 2000. T. J. R. H. John Wiley.W. Pearson Education/Prentice Hall. Luther. New Jersey. and Lightfoot. New York.A.. Finlayson. P.. Oliver and Boyd.R.. Cooper.J. 2007 Bird. 2006. Heat Transfer: A Practical Approach. McGraw-Hill. R. Butt.N.

UK. 1997. R.E. C.K.P. New Jersey. 5th ed. 2004.. 2nd ed.H. 1997.. 2001. Washington.K...... 6th ed.... John Wiley.V. W.T. New York. and Flannery. Hill. J.G. H. and Jeffreys. 1977. and Pletcher.. 2001.. John Wiley. and Osiishi. New York. Numerical Methods for Scientific and Engineering Computation. Academic Press. S. H. Heat. Prentice Hall. Wiley Eastern. Cambridge University Press. Sherwood. Prentice-Hall of India. C. Fundamentals of Chemical Reaction Engineering. Englewood Cliffs.. Versteeg. 4th ed.. New York. and Engineering Thermodynamics. New Delhi.K.... New Delhi. Introduction to Chemical Kinetics and Reactor Design. Prentice Hall.. New York. An Introduction to Computational Fluid Dynamics The Finite Volume Method. D.D. B. and McDonald. 3rd ed. 1979 Holman.S. and Reed..K. Iyengar. 3rd ed. 2007. Wicks. R. 2006.. Mickley. D. 1957. 1977.E. Smith. Applied Mathematics in Chemical Engineering.. Kreyszig.. 2001. Chemical.. E. Jain. Young. S. S. 5th ed.. Biochemical. Sastry. New Delhi.. Prentice Hall. Computational Fluid Mechanics and Heat Transfer.C.F. New Jersey. 1998.R. Fundamentals of Momentum. New York. C. Sandler. New York... Gear..C. New Age International. W. J.. 2007. Tannehill. Munson.. V. M...P. van Ness. T. J. Jr. H..H.. Cambridge. A.G. Jenson. J..K.. Numerical Initial Value Problems in Ordinary Differential Equations. Wiley India Edition. Advanced Engineering Mathematics. 2nd ed. New York.C. R. B. New York.R..T. S. McGraw-Hill. and Jain. John Wiley.286 Bibliography Fox. John Wiley.. Numerical Recipes: The Art of Scientific Computing. 8th ed. Teukolsky.K. and Rorrer.E. 5th ed. Englewood Cliffs. D. and Anthony. R. and Abbott. 4th ed. and Mass Transfer. Introduction to Chemical Engineering Thermodynamics. McGraw-Hill. Vetterling. G..G..S. Introduction to Fluid Mechanics. McGraw-Hill.A.A. Anderson. and Malalasekera. T. Gupta... Fundamentals of Fluid Mechanics. 1995. 2nd ed. Press.W. S. 8th ed. Holland. John Wiley. R. C. Levenspiel.R. 3rd ed... G. C. W. Welty.W. New York. Heat Transfer.. New Delhi. John Wiley. 1999... 2006. 1971. Mathematical Methods in Chemical Engineering...M..L. Introductory Methods of Numerical Analysis. Taylor and Francis..I..H. Wilson. New York. O. 1995. M. Numerical Methods for Engineers.M. New York. Chemical Reaction Engineering. .

68–79 Chemical reaction equilibrium—two simultan. 32 Dirichlet. 155–168 Drag coefficient. 171 208–220 hyperbolic. 20 Antoine equation. 121 Bubble point temperature. 171 for steady heat conduction. 155. 113–114 Control volume. 193 Convection–diffusion problems. elliptic. 172 non-isothermal conditions. 87 van der Waals. 192–194 second order reaction. 105 Backward difference scheme. 173 Batch reactor. 113 Dirichlet boundary condition. 87 Chemical reaction and diffusion Discretization first order reaction. 97 of differential equations. 158–161 Double pipe heat exchanger. Adiabatic flame temperature. Effective diffusion coefficient. 86. 186–188 Central difference scheme. 33 Boundary conditions. 172. 186–188 of drug from a spherical gel matrix. 161–168 in two-dimensional space. 23. 192–194 in a pore. 37 Classification of partial differential equations. 155–158 in one-dimensional space. 31–33 Block tridiagonal matrix. 33–34. 31 mixed. 49–50 171 Alternating direction implicit (ADI) method. 68–79. 105. 34–35. 171 for transient heat conduction. 87 Boundary value problem (BVP). 34 Comparison of central and upwind difference Axial dispersion. 87 Neumann. 38 using modified Raoult’s law. 150 Peng-Robinson. 119 schemes. 33–34 using Raoult’s law. 38 Dew point temperature. 55–56 in a spherical catalyst pellet. 60 Chemical reaction engineering. 69–74 Cubic equations of state.Index Activity coefficient. 119–170 initial value problems. 86. 208–214 parabolic. 39–40 using modified Raoult’s law. 86 Crank-Nicolson method. 85 Danckwert’s boundary conditions. 119–170 boundary value problems. 34–35 Diffusion. 214–220 Colebrook equation. 39–40 using Raoult’s law. 87 Redlich-Kwong. 171 287 . 47–48 Elliptic partial differential equation. 114 eous reactions. 97–99. 86.

194 Linear algebraic equations. 208. 56 underrelaxation. 171 parabolic. 120. 176 effective. 208 Plug flow reactor. 176–181 Forward difference scheme. 195. 43–44 using cubic equation of state. 173 steady heat conduction. 158 stirred tank reactor. 176–185. 195 Relaxation parameter. 176–185 using modified Raoult’s law. 173 FTCS explicit scheme. 176. 155 plug flow reactor.288 Index Ergun equation for packed beds. 174–176 Overall heat transfer coefficient. 120. 56 Friction factor. 155 Fourier stability analysis. 1–12 overrelaxation. 94 Newton’s method. 69 Raoult’s law. 105–107 transient diffusion in a sphere. 114 forward difference. 181–183 using Raoult’s law. 186–188 Flash calculations. 69. 33–37 in chemical reaction engineering. 214 Pneumatic conveying. 69 Red-black Gauss-Seidel method. 172–173 Newton-Raphson method (see Newton’s method) backward difference. 194 L’ Hospitals rule. 60 Pressure drop in a pipe under nonlaminar conditions. 93 local. 172–173 Ordinary differential equation. 53. 17 Finite difference schemes. 5 Partial differential equation (PDE). 86 FTCS Crank-Nicolson scheme. 108–114 one-dimensional steady. 194–195 Line-by-line TDMA (see ADI method) Gauss-Seidel. 74 second order reaction. 109 one-dimensional transient. 105. 40–42 in a cylinder. 182. 114 two-dimensional steady. 53 difference scheme. 195 Log mean temperature difference. 68–79 Rate constant. 35–37. 17–29 central difference. 87. 87 Fin. 155. 93. 86 Numerical diffusion term. 40–42 transient heat conduction. 86 Nonlinear algebraic equations. 43–47 Gamma-phi approach. 158 nonisothermal plug flow reactor. 24 Heat conduction. 105–107. 86. 76 first order reaction. 10 using gamma-phi approach. 86 in a sphere. 172 Neumann boundary conditions. 53–79 batch reactor. 129. 172 Initial value problems (IVP). 21 Minimum fluidization velocity. 93 upwind difference. 187 technique. 20 Implicit method. 35–37 in a rectangular slab. 21 Explicit method. 195. 44–47 Gauss-Seidel method. 69. 172 One-dimensional FTCS implicit scheme. 183–185 Forward in time and central in space (FTCS) Optimum step size. 20–21 P-x-y diagram. 43–44 Gaussian elimination method. 74 two-dimensional transient. 129. 214–220 Particle Reynold’s number. 195 . 214 Peclet number.

2 using modified Raoult’s law. 128. 1 Vapour pressure using cubic equation of state. 217–219 Runge-Kutta fourth order method. 174–176 . 33–47 Tridiagonal matrix. Index 289 Reynold’s number. 1. 110. 194 of linear algebraic equations. 129–131 Step size. 168. 1 using Raoult’s law. 185. 96. 106–108 Terminal velocity. 131–153 Standard enthalpy change of reaction. 57 steady heat conduction. 120–128 Stability. 214–220 boundary value problem. 119–153 first order reaction. 25 transient heat conduction. 130. 1 using Gamma-Phi approach. 182. 105 Taylor series expansion. 131 initial value problem. 87 Tubular reactor with axial dispersion. 54 Truncation error. 20 158. 178. 53. 131 using ADI method. 99. Round-off error. 1–12 using red-black Gauss-Seidel method. 85 second-order. 192–214 series of. 63 Upwind difference schemes. 208 System using Gauss-Seidel method. 53 Two-dimensional Stirred tank with coil heater. Von Neumann stability analysis. 166. 214–220 of ordinary differential equations. 23 Thomas algorithm (see Tridiagonal matrix algorithm) Vapour–liquid equilibrium calculations. 33–37 super-diagonal elements. 111. 174–176 multiple reactions. 87. 160. 43–44 algorithm (TDMA). 1 using Phi-Phi approach. 63. 87 188. 195 of nonlinear algebraic equations. 66 using ADI method. 37–42 diagonal elements. 180. 42–43 94. 44–47 sub-diagonal elements. Tridiagonal set of linear algebraic equations. 49 second order reaction. 53. 105–108 first-order. 124. 126. 210–214.

275. Dr.phindia. The Appendix contains a total of 33 programs in C++ related to the various numerical methods explained in the book. Varanasi.com . The initial chapters discuss the linear and nonlinear algebraic equations. Upwind Difference Scheme (UDS) method and Alternating Direction Implicit (ADI) method. Ahuja is a recipient of the AICTE Career Award for Young Teachers and a life member of the Indian Institute of Chemical Engineers (IIChE). Amiya K. the book will also be useful to research and development/process professionals in the fields of chemical. Newton’s method. Banaras Hindu University. boundary value problems and convection–diffusion problems. Pallab Ghosh Process Simulation and Control Using ASPEN ™. Dutta Principles of Mass Transfer and Separation Processes.D. The ensuing chapters cover the problems in chemical engineering thermodynamics as well as initial value problems.. Binay K. The answers to all chapter-end exercises are provided. Pradeep Ahuja Process Control: Concepts. is Reader in the Department of Chemical Engineering and Technology. S. Singh Heat Transfer: Principles and Applications.00 9 788120 340183 www. Ph. He has more than a decade’s experience in teaching chemical engineering at the BE/BTech level. Our other useful books Chemical Engineering Thermodynamics. Binay K. Runge–Kutta fourth-order method. Dynamics and Applications. mechanical and biomedical engineering. He has published several research papers in national and international journals. biochemical. Topics related to chemical reaction. Dutta Colloid and Interface Science. Jana ISBN:978-81-203-4018-3 Rs. Intended primarily as a textbook for BE/BTech students of chemical engineering. THE AUTHOR PRADEEP AHUJA. INTRODUCTION TO NUMERICAL METHODS IN CHEMICAL ENGINEERING Pradeep Ahuja T his book is an exhaustive presentation of the numerical methods used in chemical engineering. Strong emphasis is given on applications and uses of numerical analysis specifically required at the undergraduate level. The book covers a large number of numerical methods including tridiagonal matrix algorithm (TDMA) method.K. Institute of Technology. The book contains numerous worked-out examples and chapter-end exercises. dispersion and diffusion as well as steady and transient heat conduction are treated in the final chapters.