September 13, 2002 110.34. Numerical Methods Applied to Chemical EngineeringHomework # 1. Linear Algebraic Equation SetsAssigned Friday 9/6/02, Due Friday 9/13/021. Solution of a mass balance problemFor the following separation system, we know the inlet mass flowrate (in Kg/hr) and the mass fractions of each species in the inlet (stream 1) and each outlet (streams 2, 4, and 5).FIGURE 1. Process diagram for separation systemHere we use the notation that is the mass flow rate of stream # i, and is the mass fraction of species # j in stream # i.We want to calculate the unknown mass flow rates of each outlet stream. If we define the unknowns as, , (EQ 1)and set up the mass balances for1. the total mass flow rate2. the mass flow rate of species 13. the mass flow rate of species 2Fiwijx1F2=x2F4=x3F5=September 13, 2002 2we obtain a set of three linear algebraic equations for the three unknown outlet flow rates.Convert this set of equations to matrix form, and solve the system by hand using Gaussian elimination with partial pivoting.Make sure that you clearly identify what calculations you perform at each row and pivot operation.2. Solution of a 1-D transport problem with finite differencesBackgroundIn this problem, we consider the use of the method of finite differences to convert a boundary value problem from fluid mechanics into a set of linear algebraic equations. We will then modify the standard Gaussian elimination method to solve the resulting linear system in a very efficient manner.Consider the case of a Newtonian fluid undergoing laminar, pressure-driven flow between two parallel, infinite flat plates separated by a distance (see figure below). The bottom plate is stationary and the top plate moves at a constant velocity . We know the value of the constant dynamic pressure gradient, , , and wish to calculate the resulting velocity profile. FIGURE 2. Pressure-driven flow between two infinite, parallel, flat platesIf we assume a velocity profile of the form(EQ 2)the equation of continuity for an incompressible fluid, , is satisfied automatically and the Navier-Stokes equation,(EQ 3)reduces toBVup∆P∆x⁄Ppgr•–=vrt,()vxy()ex=v∇•0=ρDvDt-------P∇– µv∇2+=September 13, 2002 3(EQ 4)subject to the no-slip boundary conditions(EQ 5)This is a classic problem from fluid mechanics that is solved easily by integrating the dif-ferential equation twice and using the boundary conditions to specify the values of the constants of integration. The resulting solution is(EQ 6)We now wish to employ a numerical method to “solve” this problem by converting the boundary value problem into a set of algebraic equations. For this particular problem, there is little actual need to do so since an analytical solution is available. We shall find, however, that the technique that we develop here can be used to obtain numerical approxi-mations to the solution of boundary value problems even when no analytical solution exists.For this example, we use the conceptually-simple method of finite differences that is based on the following definition of the derivative of a differentiable function ,(EQ 7)In the limit as , all three finite difference approximations agree. In the method of finite differences, we use finite, but “small”, values of in one of these approximations to convert the derivatives appearing in a differential equation to algebraic forms. We shall study this method in more detail later; however, for now we merely note that the first approximation formula given above, the central difference approximation, is more accu-rate than the one-sided differences.Our differential equation in this example involves the second derivative of the velocity; therefore, we need to construct an algebraic approximation to this higher-order derivative. We place a grid of points along the computational domain (see figure below) at the locations,0∆P∆x-------– µy22ddvx+=vxy=0()0= vxy=B()Vup=vxy() VupyB---12µ------∆P∆x-------y2yB–()+=fx()xddffx ∆x+()fx ∆x–()–2∆x--------------------------------------------------∆x 0→limfx ∆x+()fx()–∆x--------------------------------------∆x 0→limfx() fx ∆x–()–∆x-------------------------------------∆x 0→lim===∆x 0→∆xNy 0 B[,]∈September 13, 2002 4(EQ 8)FIGURE 3. Placement of grid points for finite difference computationAt grid point j, we use a central-difference formula to approximate the local value of the second derivative of the velocity,(EQ 9)Here, the values of the first derivatives are evaluated at the mid-points between the grid locations. We then use yet other central-difference formulas for these mid-point values,(EQ 10)(EQ 11)to obtain the following approximation of the second derivative at each grid point,(EQ 12)In general, this algebraic approximation of the second derivative is not exact, and one must reduce the value of by increasing the number of grid points until the magnitude of the approximation error is below some acceptable value. For this particular problem, since the true solution is a simple quadratic function, we are lucky and this algebraic approximation is exact.To “solve” a boundary value problem using the method of finite diffferences, we formu-late a set of algebraic equations for the set of unknowns . For each grid yjj ∆y()= ∆yBN 1+-------------= j 12…N,, ,=y22ddvxyjyddvxyj∆y()2⁄+yddvxyj∆y()2⁄––∆y-------------------------------------------------------------------------------≈yddvxyj∆y()2⁄+vxyj 1+()vxyj()–∆y-----------------------------------------≈yddvxyj∆y()2⁄–vxyj() vxyj 1–()–∆y-----------------------------------------≈y22ddvxyjvxyj 1+()2vxyj()– vxyj 1–()+∆y()2------------------------------------------------------------------------≈∆yNNNy1y2…yN,,{, }September 13, 2002 5point, we need a separate algebraic equation, that we obtain by requiring the differential equation to hold locally,(EQ 13)If we insert the central-difference approximation for the second derivative, the algebraic equation for grid point is(EQ 14)We write this in a more compact form by defining the column vector as(EQ 15)so that the algebraic equation for grid point becomes(EQ 16)If we assemble these equations in matrix form, we obtain the system(EQ 17)where(EQ 18)and(EQ 19)0∆P∆x-------–
View Full Document