Lecture Notes Chemical Engineering

computational methods in chemical engineering with maple and lecture notes for chemical engineering thermodynamics pdf free downlaod
RyanCanon Profile Pic
RyanCanon,United Arab Emirates,Teacher
Published Date:21-07-2017
Your Website URL(Optional)
Lecture Notes for Computational Methods in Chemical Engineering (CL 701) Sachin C. Patwardhan, Department of Chemical Engineering, Indian Institute of Technology, Bombay, Mumbai 400076, India.Contents Chapter 1. Mathematical Modeling and Simulation 1 1. Introduction 1 2. Mechanistic Models and Abstract Equation Forms 3 3. Summary 19 4. Appendix: Basic Concepts of Partial Differential Equations 19 Chapter 2. Fundamentals of Functional Analysis 23 1. Introduction 23 2. Vector Spaces 26 3. Normed Linear Spaces and Banach Spaces 29 4. Inner Product Spaces and Hilbert Spaces 33 5. Problem Formulation, Transformation and Convergence 42 6. Summary 51 7. Exercise 51 Chapter 3. Linear Algebraic Equations and Related Numerical Schemes 55 1. Solution ofAx =b and Fundamental Spaces ofA 55 2. Direct Solution Techniques 60 3. Solutions of Sparse Linear Systems 61 4. Iterative Solution Techniques for solvingAx =b 73 5. Well Conditioned and Ill-Conditioned Problems 88 6. Solving Nonlinear Algebraic Equations 97 7. Solutions of ODE-BVP and PDEs by Orthogonal Collocation 108 8. Summary 115 9. Appendix 115 10. Exercise 119 Chapter 4. ODE-IVPs and Related Numerical Schemes 127 1. Motivation 127 2. Analytical Solutions of Multivariable Linear ODE-IVP 135 3. Numerical Methods for the solution of ODE-IVP 141 4. Stability Analysis and Selection of Integration Interval 156 5. Summary 161 iiiiv CONTENTS 6. Exercise 162 Chapter 5. Optimization and Related Numerical Schemes 165 1. Introduction 165 2. Principles of Optimization 165 3. Model Parameter Estimation 171 4. Multivariate Linear Regression 179 5. Projections: Geometric Interpretation of Linear Regression 182 6. Statistical Interpretations of Linear Regression 189 7. Simple Polynomial Models and Hilbert Matrices 199 8. Nonlinear in Parameter Models 203 9. Unconstrained Nonlinear Programming 207 10. Numerical Methods Based on Optimization Formulation 222 11. Summary 238 12. Exercise 238 Bibliography 243CHAPTER 1 Mathematical Modeling and Simulation 1. Introduction A modern chemical plant consists of interconnected units such as heat exchangers, reactors, distillation columns, mixers etc. with high degree of inte- grationtoachieveenergyefficiency. Designandoperationofsuchcomplexplants is a challenging problem. Mathematical modeling and simulation is a cost ef- fective method of designing or understanding behavior of these chemical plants when compared to study through experiments. Mathematical modeling can- not substitute experimentation, however, it can be effectively used to plan the experiments or creating scenarios under different operating conditions. Thus, best approach to solving most chemical engineering problems involves judicious combination of mathematical modeling and carefully planned experiments. To begin with, let us look at types of problems that can arise in context of modeling and simulation. Consider a typical small chemical plant consisting of a reactor and a distillation column, which is used to separate the product as overhead (see Figure 1). The reactants, which are separated as bottomproduct of thedistillationcolumn, arerecycledtothereactor. Wecanidentifyfollowing problems • Process Design problem Given: Desired product composition, raw material composition and avail- ability. • To Find: Raw material flow rates, reactor volume and operating con- ditions (temperature, pressure etc.), distillation column configuration (feed locations and product draws), reboiler,condenser sizes and oper- ating conditions (recycle and reflux flows, steam flow rate, operating temperatures and pressure etc.) • Process Retrofitting: Improvements in the existing set-up or oper- ating conditions Plant may have been designed for certain production capacity and assuming certain raw material quality. We are often required to assess whether 12 1. MATHEMATICAL MODELING AND SIMULATION —Isitpossibletooperatetheplantatadifferent production rate? — What is the effect of changes in raw material quality? — Is it possible to make alternate arrangement of flows to reduce energy consumption? • Dynamic behavior and operability analysis: Any plant is de- signed by assuming certain ideal composition of raw material quality, temperature and operating temperatures and pressures of utilities. In practice, however, it is impossible to maintain all the operating condi- tionsexactlyatthenominaldesignconditions. Changesinatmospheric conditions of fluctuations in steamheader pressure, cooling water tem- perature, feed quality fluctuations, fouling of catalysts, scaling of heat transfer surfaces etc. keep perturbing the plant from the ideal oper- ating condition. Thus, it becomes necessary to understand transient behavior of the system in order to — rejectofeffectsofdisturbancesonthekeyoperatingvariablessuch as product quality — achieve transition from one operating point to an economically profitable operating point. — carry out safety and hazard analysis Inordertosolveprocessdesignorretrofittingproblems,mathematicalmod- els are developed for each unit operation starting from first principles. Such mechanistic (or first principles) models in Chemical Engineering are combina- tion of mass, energy and momentum balances together with associated rate equations, equilibrium relation and equations of state. • Mass balances:overall,component. • Rate equations: mass, heat and momentum transfer rates (constitu- tive equations.), rate of chemical reactions • Equilibrium principles : physical( between phases) and chemical (reaction rate equilibrium). • Equations of state: primarily for problems involving gases. Frommathematicalviewpoint,thesemodelscanbeclassifiedintotwobroad classes • Distributed parameter model: These models capture the relationship between the variables involved as functions of time and space. • Lumped parameter models: These models lump all spatial variation and all the variables involved are treated as functions time alone.2. MECHANISTIC MODELS AND ABSTRACT EQUATION FORMS 3 Figure 1. Typical processing plant: Schematic daigram The above two classes of models together with the various scenarios under consideration give rise to different types of equation forms such as linear / non- linear algebraic equations, ordinary differential equations or partial differential equations. In order to provide motivation for studying these different kinds of equationforms, wepresentexamplesofdifferentmodelsinchemicalengineering and derive abstract equation forms in the following section. 2. Mechanistic Models and Abstract Equation Forms 2.1. Linear Algebraic Equations. Plant wide or section wide mass balances are carried out at design stage or later during operation for keeping material audit. These models are typical examples of systems of simultaneous linear algebraic equations..4 1. MATHEMATICAL MODELING AND SIMULATION Figure 2 Example 1. Recovery of acetone from air -acetone mixture is achieved us- ing an absorber and a flash separator (Figure 2). A model for this system is developed under following conditions • All acetone is absorbed in water • Air entering the absorber contains no water vapor • Air leaving the absorber contains 3 mass % water vapor Theflash separator acts as a single equilibrium stage such that acetone mass fraction in vapor and liquid leaving the flash separator is related by relation (2.1)y=20.5x wherey mass fraction of the acetone in the vapor stream andx mass fraction of the acetone in the liquid stream. Operating conditions of the process are as follows • Air in flow: 600 lb /hr with 8 mass % acetone • Water flow rate: 500 lb/hr It is required that the waste water should have acetone content of 3 mass % and we are required to determine concentration of the acetone in the vapor stream and flow rates of the product streams. Mass Balance: (2.2) Air : 0.92Ai=0.97Ao (2.3)Acetone :0.08Ai=0.03L+ yV (2.4) Water :W =0.03Ao+(1−y)V +0.97L (2.5) Design requirement :x=0.032. MECHANISTIC MODELS AND ABSTRACT EQUATION FORMS 5 Figure 3. Flash Drum: Schematic Diagram Equilibrium Relation: (2.6)y =20.5x (2.7)⇒y=20.5×0.03 = 0.615 Substituting for all the known values and rearranging, we have ⎡⎤⎡⎤⎡⎤ 0.97 0 0Ao 0.92×600 ⎢⎥⎢⎥⎢⎥ (2.8) 00.03 0.615L = 0.08×600 ⎣⎦⎣⎦⎣⎦ 0.03 0.385 0.97V 500 Theabovemodelisatypicalexampleofsystemoflinearalgebraicequations, whichhavetobesolvedsimultaneously. Theaboveequationcanberepresented in abstract form set of linear algebraic equations (2.9)Ax =b n wherex andb are a (n×1) vectors (i.e. x,b∈R )andA is a (n×n) matrix. 2.2. Nonlinear Algebraic Equations. Consider a stream of two components A and B at a high pressureP and temperatureT as shown in ff Figure3. IftheP isgreaterthanthebubblepointpressureatT ,novaporwill ff bepresent. Theliquidstreampassesthrougharestriction(valve)andisflashed in the drum, i.e. pressure is reduced fromP toP. This abrupt expansion f takes place under constant enthalpy. If the pressureP in the flash drum is less than the bubble point pressure of the liquid feed atT , the liquid will partially f6 1. MATHEMATICAL MODELING AND SIMULATION Figure 4 vaporize and two phases at the equilibrium with each other will be present in the flash drum. The equilibrium relationships are • Temperature of the liquid phase = temperature of the vapor phase. • Pressure of the liquid phase = pressure of the vapor phase. 0 • Chemical potential of theith component in the liquid phase = Chem- 0 ical potential of theith component in the vapor phase Example 2. Consider flash vaporization unit shown in Figure 4. A hydro- carbon mixture containing 25 mole % of n butane, 45 mole %of n -hexane is to be separated in a simple flash vaporization process operated at 10 atm. and 0 270 F. The equilibrium k- values at this composition are Component z k ii n-butane 0.25 2.13 n-pentane 0.45 1.10 n-hexane 0.30 0.59 Letx represent mole fraction of the componenti in liquid phase andy ii represent mole fraction of the componenti in vapor phase. Model equations for the flash vaporizer are • Equilibrium relationships (2.10)k =y/x (i=1,2,3) iii • Overall mass balance (2.11)F =L+V2. MECHANISTIC MODELS AND ABSTRACT EQUATION FORMS 7 • Component balance (2.12)z∗F =x∗L+y∗V (i=1,2,3) iii (2.13) =x∗L+k∗x∗V iii X (2.14)x =1 i Note that this results in a set of simultaneous 5 nonlinear algebraic equations in 5 unknowns Equations (2.11-2.14) can be written in abstract form as follows (2.15)f (x ,x ,x ,L,V)=0 1 1 2 3 (2.16)f (x ,x ,x ,L,V)=0 2 1 2 3 ............................ =0 (2.17)f (x ,x ,x ,L,V)=0 5 1 2 3 which represent coupled nonlinear algebraic equations. These equations have to be solved simultaneously to find solution vector h i T (2.18) x =xxx LV 1 2 3 The above 5 equations can also be further simplified as follows ∙ µ ¶ ¸ V x =z/ 1+ (k−1) iii F P Usingx =1,we have i X zi (2.19)f (V/F)=−1=0 1+(V/F)(ki−1) In general, we encountern nonlinear algebraic equations inn variables, whichhavetobesolvedsimultaneously. Thesecanbeexpressedinthefollowing abstract form (2.20)f (x ,x ,x......x)=0 1 1 2 3,n (2.21)f (x ,x ,x......x)=0 2 1 2 3,n ............................ =0 (2.22)f (x ,x ,x......x)=0 n 1 2 3,n Using vector notation, we can write n (2.23)F(x)=0; x∈R h i T x = xx...x 1 2n8 1. MATHEMATICAL MODELING AND SIMULATION n where 0 representsn×1 zero vector. HereF(x)∈R representsn dimensional function vector defined as h i T (2.24)F(x)=f (x)f (x)...f (x) 1 2n 2.3. Optimization Based Formulations. Variety of modeling and de- signproblems inchemical engineeringareformulatedasoptimizationproblems. Example 3. Consider a simple reaction A→B modelled using the following reaction rate equation −E n (2.25)−r =−dC/dt =k (C ) exp( ) aaoa RT carried out in a batch reactor. It is desired to find the kinetic parametersk ,E o andn from the experimental data. The following data is collected from batch experiments in a reactor at different temperatures Reaction Rate Concentration Temperature −rCT a1a1 1 −rCT a2a2 2 .... .... .... −rCT aNaNN SubstitutingthesevaluesintherateequationwillgiverisetoNequationsin threeunknowns,whichisanoverdeterminedsetequations. Duetoexperimental errors in the measurements of temperature and reaction rate, it may not be possibletofindasetofvaluesofk ,E,nsuchthatthereactionrateequationis o satisfiedatallthedatapoints. HoweveronecandecidetoselectV o,E,nsuch that the quantity ∙ ¸ N 2 X −E n (2.26)Φ =−r−k (C ) exp( ) aioai RT i i=1 Suppose we use−r to denote the estimated reaction rate aie −E n (2.27)−r =kC exp( ) aieo ai R∗T i then, the problem is to choose parameters k ,E,n such that the sum of the o square of errors between the measured and estimated rates is minimum, i.e.2. MECHANISTIC MODELS AND ABSTRACT EQUATION FORMS 9 N X Min 2 (2.28)Φ(k ,E,n)= −r−(−r ) oaiaie k ,E,n o i=1 Example 4. Cooling water is to be allocated to three distillation columns. Upto8millionlitersperdayareavailable,andanyamountuptothislimit may be use. The costs of supplying water to each equipment are Equip. 1:f =1−D −1 for 0≤D≤ 2 1 1 1 =0 (otherwise) −1 2 Equip. 2:f =−exp( (D−5) ) for 0≤D ≤∞ 2 2 2 2 2 Equip. 2:f =D−6D +8 for 0≤D≤ 4 2 3 3 3 P MinimizeΦ =f to findD ,D, andD i 1 2 3 Note that this is an example of a typical multi-dimensional optimization problem, which can be expressed in abstract form Min (2.29)Φ(x) x nn where x∈R andf(x):R→R is a scalar objective function. A general problemofthistypemayincludeconstraintsonx or functions ofx. 2.4. ODE - Initial Value Problem (ODE-IVP). For most of the processing systems of interest to the chemical engineer, there are three funda- mental quantities :mass, energy and momentum. These quantities are can be characterizedbyvariablessuchasdensity, concentration, temperature, pressure andflowrate. Thesecharacterizingvariablesarecalledasstateoftheprocessing system. The equations that relate the state variables (dependent variables) to theindependentvariablesarederivedfromapplicationofconservationprinciple on the fundamental quantities and are called the state equations. Let quantity S denote any one of the fundamental quantities • Total mass • Mass of the individual components • Total energy. • Momentum Then, the principles of the conservation of the quantity S states that: Accumulation of S within a system = Flow of S in the system time period time period -FlowofSoutofthesystem time period10 1. MATHEMATICAL MODELING AND SIMULATION Figure 5. General lumped parameter system + Amount of S generated within the system time period -Amount of S consumed by the system time period Figure 5 shows schematic diagram of a general system and its interaction with external world. Typical dynamic model equations are as follows Total Mass Balance X X ρF−ρF d(ρV)= ij ij i:inletj:outlet Mass Balance of the component A X X dnd(CV) aa (2.30) = =CF−CF +or− rV aiiaji dtdt Total energy Balance X X dEd(U +K +P)dH (2.31) = =ρFh−ρFh ±Q±W ' iijjS ij dtdtdt i :inletj :outlet where ρ : density of the material in the system2. MECHANISTIC MODELS AND ABSTRACT EQUATION FORMS 11 ρ : density of the material in the i’th inlet stream i ρ : density of the material in the j’th outlet stream j V : Total volume of the system F Volumetric flow rate of the i’th inlet stream i: F Volumetric flow rate of the j’th outlet stream j: n : number of moles of the component A in the system a C : Molal concentration ( moles /volume)of A in the system A C : Molal concentration ( moles /volume)of A in the i’th inlet stream Ai C : Molalconcentration(moles/volume)ofAinthej’thoutletstream Aj r : reaction rate per unit volume of the component A in the system. h specific enthalpy of the material in the i’th inlet stream i: specific enthalpy of the material in the j’th outlet stream h i: U, K , P :internal, kinetic and potential energies of the system, respectively. Q : Amount of the heat exchanged between the system and the sur- roundings per unit time W : Shaft work exchanged between the system and its surroundings. S By convention, a quantity is considered positive if it flows in and negative if it flows out. The state equations with the associated variables constitute the ’lumpedparametermathematicalmodel’ofaprocess, whichyieldsthedynamic or static behavior of the process. The application of the conservation principle statedabovewillyieldasetofdifferentialequationswiththefundamentalquan- titiesasthedependentvariablesandtimeasindependentvariable. Thesolution of the differential equations will determine how the state variables change with time i.e., it will determine the dynamic behavior of the process. The process is said to be at the steady state if the state variables do not change with time. In this case, the rate of accumulation of the fundamental quantity S is zero and theresultingbalanceyieldsasetofalgebraicequations Example 5. Stirred Tank Heater (STH) System (Figure 6): Total momentum of the system remains constant and will not be considered. Total mass balance: Total mass in the tank at any time t =ρV =ρAh where A represents cross sectional area. d(ρAh) (2.32) =ρF−ρF i dt Assuming that the density is independent of the temperature, dh (2.33)A =F−F i dt12 1. MATHEMATICAL MODELING AND SIMULATION Hot Water Flow Cold Water Flow CV-3 CV-1 FC FT LT LC Flow Setpoint Valve Position Level CV-2 Setpoint Steam Flow TT Figure 6. Stitted Tank Heater (STH) System Now, flow out due to the gravity is also a function of height √ F =kh Thus, √ dh (2.34)A +kh =F i dt Total energy of liquid in the tank is given by E =U +k +P However, since tank does not move dkdPdEdU = =0; = dtdtdtdt For liquid systems dUdH (2.35)≈ dtdt where H is total enthalpy of the liquid in the tank. (2.36)H =ρVC (T−T )=ρAhC (T−T ) p refp ref T represents reference temperature where the specific enthalpy of the liquid is ref assumed to be zero. Now, using the energy conservation principle d(ρAhC (T−T )) p ref (2.37) =ρFC (T−T )−ρFC (T−T )+Q ipi refp ref dt2. MECHANISTIC MODELS AND ABSTRACT EQUATION FORMS 13 where Q is the amount of heat supplied by the steam per unit time. Assuming T =0, we have ref d(hT)Q (2.38)A =FT− FT + ii dtρC p d(hT)dTdh A =Ah +AT dtdtdt dT =Ah +T(F−F) i dt Q =FT− FT + ii ρC p Or dTQ Ah =F (T−T)+ ii dtρC p Summarizing modelling steps √ dh 1 1 (2.39) = (F−F)= (F−kh) ii dtAA dTFQ i (2.40) = (T−T)+ i dtAhAhρC p The associated variables can be classified as • state(or dependent) variables :h,T • Input (or independent) variables :T ,F ,Q ii • Parameters:A,ρ,C p Steady state behavior can be computed by solving following two equations √ dh (2.41) =F−kh=0 i dt dTFQ i (2.42) = (T−T)+ =0 i dtAhρC p Once we choose independent variablesF =F ,T =T andQ =Q,thesteady iiii stateh =h andT =T can be computed by simultaneously solving nonlinear algebraic equations (2.41-2.42). The system will be disturbed from the steady state if the input variables suddenly change value att=0. Consider following two situations in which we need to investigate transient behavior of the above process •T decreases by 10% from its steady state valueT att=0. Liquid level ii remains at the same steady state value asT does not influence the total i mass in tank. The temperatureT in the tank will start decreasing with time (see Figure 7). HowT(t) changes with time is determined by the14 1. MATHEMATICAL MODELING AND SIMULATION Figure 7. System response to step change inT i Figure 8. System reponse for step change inF i solution of the equation (2.39) using the initial as conditionT(0) =T, the steady state value ofT. •F isdecreasedby10%fromitssteadystatevalueF :SinceF appears iii inboththedynamicequations,thetemperatureandtheliquidlevelwill start changing simultaneously and the dynamics will be governed by simultaneous solution of coupled nonlinear differential equations (2.39- 2.40) starting with initial conditionsT(0) = T, h(0) =h. Figures 8 show schematic diagrams of the process responses for step change inF. i It is also possible to investigate response of the system for more complex inputs, such as T (t)=T +∆T sin(ωt) iii where above function captures daily variation of cooling water inlet tempera- ture.Ineachcase,thetransientbehaviorT(t) andh(t) is computed by solving the system of ODEs subject to given initial conditions and time variation of independent inputs (i.e. forcing functions).2. MECHANISTIC MODELS AND ABSTRACT EQUATION FORMS 15 The model we considered above did not contain variation of the variables with respect to space. Such models are called as ’Lumped parameter models’ and are described by ordinary differential equations of the form dx 1 (2.43) =f x (t),x (t),...,x (t),u (t),..,u (t) 1 1 2n 1m dt ............................................ dx n (2.44) =f x (t),x (t),...,x (t),u (t),..,u (t) n 1 2n 1m dt x (0) = x,....x (0) =x (Initial conditions) 1 1nn wherex (t)denotethestate(ordependent)variablesandu (t)denoteinde- ii pendent inputs (or forcing functions) specified fort≥ 0. Using vector notation, we can write the above set of ODEs in more compact form dx (2.45) =F(x,u) dt (2.46) x(0) = x 0 where Tn (2.47) x(t)=x (t)......x (t)∈R 1n Tm (2.48) u(t)=u (t)......u (t)∈R 1n Tn (2.49)F(x,u)=f (x,u)........f (x,u)∈R 1n andu(t) is a forcing function vector defined overt≥ 0. • Steady State Simulation Problem: If wefixindependent inputs tosome constantvalue, sayu(t)=u fort≥=0,thenwecanfindasteadystate solution x = x corresponding to these constant inputs by simultane- ously solvingn nonlinear algebraic equations (2.50)F(x,u)= 0 obtained by settingdx/dt = 0 where 0 representsn×1 zero vector. • Dynamic Simulation Problem: Given input trajectories T (2.51) u(t)=u (t) u (t)......u (t) 1 2m asafunctionoftimefort≥=0andwiththeinitialstatex(0),integrate dx (2.52) =F(x,u(t)) dt over interval 0≤t≤t to determine state trajectories f T (2.53) x(t)=x (t)x (t)..........x (t) 1 2n16 1. MATHEMATICAL MODELING AND SIMULATION Figure 9. Shell and tube heat exchanger Sinceu(t) is a known function of time, we re-state the above problem as dx (2.54) =F (x,t); x(0) =x u 0 dt F (x,t)(=F(x,u(t))) denotesF() with the givenu(t). u 2.5. PDEsandODE-BoundaryvalueProblems. Mostofthesystems encountered in chemical engineering are distributed parameter systems. Even though behavior of some of these systems can be adequately represented by lumped parameter models, such simplifying assumptions may fail to provide accurate picture of system behavior in many situations and variations of vari- ablesalongtimeandspacehavetobeconsideredwhilemodeling. Thistypically result in a set of partial differential equations. Example 6. Consider thedoublepipe heat exchanger in whicha liquidflow- ing in the inner tube is heated by steamflowing countercurrently around the tube (Figure 10). The temperature in the pipe changes not only with time but also along the axial directionz. While developing the model, it is assumed that the temperaturedoesnotchangealongtheradiusofthepipe. Consequently, wehave only two independent variables, i.e.z andt. To perform the energy balance,we consider an element of length∆z as shown in the figure. For this element, over aperiodoftime∆t (2.55)ρCA∆z(T )−(T )=ρC VA(T)∆t−ρC VA(T)∆t pt+Λttpzpz+∆z (2.56) +Q∆t(πD∆z) This equation can be explained as accumulation of the enthalpy during the time period∆t =flow in of the enthalpy during∆t-flow out of the enthalpy during∆t enthalpy transferred from steam to the liquid through wall during∆t

Advise: Why You Wasting Money in Costly SEO Tools, Use World's Best Free SEO Tool Ubersuggest.