CHE654 Problems 2012
Comments
Description
1CHE654 Modeling Chemical Processes Using MATLAB Exercise Problems 6 th Edition Prepared by Dr. Hong-ming Ku King Mongkut’s University of Technology Thonburi Chemical Engineering Department Chemical Engineering Practice School ©2003- 2012 – Use with Permission of the Author Only 2 1. System of Linear Algebraic Equations, I Use MATLAB to solve the following system of linear algebraic equations, correct to 4 decimal places: x 1 + 2x 2 + x 3 + x 5 – 1 = 0 2x 1 – 4x 2 – x 3 + x 4 + x 5 + 2 = 0 –2x 2 + 4x 3 + x 4 – 6x 5 + 6 = 0 –3x 1 + x 4 – 2x 5 – 4 = 0 x 1 + x 2 + x 3 + 3x 4 + 8x 5 = 0 2. System of Linear Algebraic Equations, II Use MATLAB to solve the following system of linear algebraic equations, correct to 4 decimal places: 2x 1 + 4x 2 – x 3 + x 4 = 6 –x 1 + 2x 2 + x 3 – x 4 + x 5 = 8 –x 2 – x 3 + 2x 4 + x 5 = –12 4x 1 + x 2 + x 3 + x 4 + 2x 5 = –2 6x 1 + 2x 3 – 4x 4 – 2x 5 = 4 3. System of Nonlinear Algebraic Equations Use MATLAB to solve the following system of nonlinear algebraic equations: exp(2x 1 ) – x 2 – 4 = 0 x 2 – x 3 2 – 1 = 0 x 3 – sin(x 1 ) = 0 4. Pressures in a Pipeline Network Consider the following interconnected liquid pipeline network which contains 4 valves with the following valve coefficients. Calculate the pressure at each location/node indicated in the network. C v,1 = 0.2 ft 3 /(psia) 1/2 -hr C v,2 = 0.1 ft 3 /(psia) 1/2 -hr C v,3 = 0.4 ft 3 /(psia) 1/2 -hr C v,4 = 0.3 ft 3 /(psia) 1/2 -hr 3 1 P = 50 psia C v,1 Pump C v,2 C v,3 2 P = 14.7 psia C v,4 Reservoir 5. Simple Calculations and Array Manipulations in MATLAB, I Consider the following arrays: 2 4 6 2 4 1 8 20 5 40 9 11 23 7 A = 8 10 2 B = log 10 (A) C = 0 -1 -5 6 3 π 9 Write MATLAB expressions in an M-file (script file) to do the following (use “format short” in all calculations unless otherwise told): (a) Determine the sum of the second column of B. (b) Select the first 3 columns and the first 3 rows of A and B and add their determinants . (c) Determine the square root of the product (a scalar) between the last row of C and the second column of A. (d) Determine the sum of the second row of A divided element-by-element by the third column of C. (e) Evaluate the hyperbolic secant of (0.01 * A * C). (f) Evaluate the following function: tan -1 (0.1 * B * C) in 6 decimal places. 6. Simple Calculations and Array Manipulations in MATLAB, II Consider the following arrays: 1 3 5 2 4 4 8 A = 10 5 30 B = log 10 (A) C = 8 12 24 7 6 10 4 0 -1 5 6 3 π 8 4 Write MATLAB expressions in an M-file (script file) to do the following (use “format short” in all calculations unless otherwise told): (a) Determine the sum of the second column of B. (b) Select the first 3 columns and the first 3 rows of A and B and add their determinants . (c) Determine the square root of the product (a scalar) between the last row of C and the second column of A. (d) Determine the sum of the second row of A divided element-by-element by the third column of C. (e) Evaluate the hyperbolic secant of (0.01 * A * C). (f) Evaluate the following function: tan -1 (0.1 * B * C) in 6 decimal places. 7. Inverse and Determinant of 2×2 and 3×3 Matrices Use MATLAB to write a program that can determine the inverse and determinants of any 2×2 and 3×3 matrices, which can then be used to solve a system of linear algebraic equations in 2 or 3 unknowns. Recall that the formulae for calculating the determinant of 2×2 and 3×3 matrices are as follows: If then If then and Use the above formulae to solve the following two systems of linear algebraic equations: ( ( ( ¸ ( ¸ = 22 21 12 11 a a a a A 21 12 22 11 ) det( a a a a A − = ( ( ( ¸ ( ¸ − − = − 11 21 12 22 1 ) det( 1 a a a a A A ( ( ( ( ( ( ¸ ( ¸ = 33 32 31 23 22 21 13 12 11 a a a a a a a a a A ) ( ) ( ) ( ) det( 13 22 12 23 31 13 32 12 33 21 23 32 22 33 11 a a a a a a a a a a a a a a a A − + − − − = ( ( ( ( ( ( ¸ ( ¸ − − − − − − − − − = − 12 21 11 22 11 32 12 31 22 31 21 32 11 23 13 21 13 31 11 33 21 33 23 31 13 22 12 23 12 33 13 32 23 32 22 33 1 ) det( 1 a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a A A 3 2 4 0 3 5 2 6 2 ) ( 1 2 6 3 2 ) ( 3 2 1 3 2 1 3 2 1 2 1 2 1 = − − = + + − − = − + − = + − = − x x x x x x x x x b x x x x a 5 8. Steady-State Material Balances on a Separation Train Paraxylene, styrene, toluene, and benzene are to be separated with an array of distillation columns shown in the figure below. 7% Xylene D 1 4% Styrene 54% Toluene 35% Benzene D 18% Xylene 24% Styrene 15% Xylene B 1 42% Toluene 25% Styrene 16% Benzene 40% Toluene D 2 20% Benzene 15% Xylene 10% Styrene F T = 70 kgmol/min 54% Toluene B 21% Benzene 24% Xylene B 2 65% Styrene 10% Toluene 1% Benzene Formulate the problem as a system of simultaneous linear equations and solve it using MATLAB. 9. Using MATLAB to Solve the Peng-Robinson Equation of State The Peng-Robinson equation of state contains 2 empirical parameters a and b, and its conventional form is given by: where 2 2 2 b bV V a b V RT P m m m − + − − = | | ¹ | \ | = C C P T R a 2 2 45724 . 0 α | | ¹ | \ | = C C P RT b 07780 . 0 6 The variables are defined by: P = pressure in MPa V m = molar volume in cm 3 /gmole T = temperature in K R = gas constant (8.314 cm 3 -MPa/gmole-K) T C = the critical temperature (150.86 K for argon) P C = the critical pressure (4.898 MPa for argon) P VAP = vapor pressure (0.4946 MPa at T r = 0.7 for argon) Alternatively, this equation of state can be expressed in polynomial forms as given below: Use MATLAB to compute the molar volume of argon using both the conventional form and the polynomial form at T = 105.6 K and P = 0.498 MPa. The two solutions should be the same. Because the two equation forms are both cubic in molar volume, you should obtain 3 different answers in volume. Briefly describe the physical meaning or significance of each answer. 10. Pressure-Temperature Curve of Saturated Water Chemical engineers use tabulated pressure-volume-temperature (PVT) data to analyze the characteristics of various liquids such as ethanol, refrigerant, and water, which change 2 5 . 0 2 )] 1 )( 26992 . 0 54226 . 1 37464 . 0 ( 1 [ r T − − + + = ω ω α C r T T T = ( ¸ ( ¸ = − − = C r VAP P T P ) 7 . 0 ( log 0 . 1 10 ω 2 2 T R aP A = RT bP B = 0 ) ( ) 3 2 ( ) 1 ( 3 2 2 2 3 = + + − + − − + − + B B AB Z B B A Z B Z factor ility compressib the RT PV Z where m , = 7 phases between solid, liquid, and gas. One such problem is to determine the change in enthalpy of saturated water as it is vaporized to steam. Suppose the system consists of 1 kg of saturated water. An appropriate model to use in this instance is the Clapeyron equation. ∆h = T (V g – V f ) dP dT Here ∆h is the change in enthalpy between the liquid and gas phase as the water vaporizes. The parameter T denotes the temperature in degrees Kelvin, and V g and V f are the specific volumes of the gas and liquid, respectively. The derivative, dP/dT denotes the rate of change of pressure with respect to temperature. Numerical pressure-temperature points are available from standard steam tables and are summarized in the following table: Pressure-Temperature Data for Saturated Water T (° C) P (bars) 50 0.1235 60 0.1994 70 0.3119 80 0.4739 90 0.7014 100 1.014 110 1.433 120 1.958 130 2.701 140 3.613 150 4.758 Values for the constants T, V g , and V f also can be obtained directly from the steam table data. In this case, 100°C corresponds to T = 373.15 K, while V g = 1.673 m 3 /kg, and V f = 0.00104 m 3 /kg. The objective here is to estimate the heat of vaporization ∆h (in kJ/kg) at 100°C. To estimate the value of dP/dT , a number of approaches might be used. One possibility is to compute a numerical derivative directly from the data in the table. Another approach to be used here is to fit a curve to the data and then differentiate the curve analytically. In this case, use a cubic polynomial curve in MATLAB. Make a plot of the fitted curve and the data (on the same graph). 11. Propane Cylinder A gas cylinder, whose exterior dimensions are a height of h = 1.35 m and a diameter of d = 0.25 m, is shown below. The cylinder contains m = 2.9 kg of propane at T = 120°C. d 8 h Suppose that readings from a pressure gauge attached to the cylinder indicate that the pressure of the propane is P = 30 bars (absolute). The objective is to determine the interior volume of the cylinder and from that the wall thickness. Use the Redlich-Kwong equation of state which contains 2 empirical parameters a and b as follows: where for propane, a = 182.23 bar-m 6 -K 5 /kmol 2 and b = 0.06242 m 3 /kmol T b V V a b V RT P ) ( + − − = 9 12. Statistical Analyses Using Matrices in MATLAB You are to use MATLAB to carry out some statistical analyses on a set of data given in the table below. Undergr. GPA ChEPS GPA 3.58 3.97 3.33 3.71 3.28 3.57 3.27 3.54 3.15 3.61 3.33 3.75 2.97 3.72 3.09 3.42 3.22 4.00 2.89 3.66 3.05 3.89 2.90 3.28 3.10 3.71 3.01 3.64 3.31 3.64 3.45 3.64 3.22 3.64 3.19 3.61 3.14 3.78 3.16 3.64 3.45 3.85 where x = undergraduate GPA and y = ChEPS GPA. Please note that you are not allowed to use for loop or any control statements in your calculations. Use only vectors, matrices, and their manipulations. Finally, use fprintf to output your results that look like the table below. The spacing is not important as long as your table looks neat. Note that I want 2 decimal places for the maximum and the minimum and 3 decimal places for the mean, the median, and the standard deviation. For the correlation coefficient, I want an answer in 4 decimal places. Maximum Minimum Mean Median STDEV ------------- ------------- --------- ----------- --------- Underg GPA x.xx x.xx x.xxx x.xxx x.xxx The data consist of undergraduate GPAs of 21 students from ChEPS Class-11 and their ChEPS GPAs upon graduation. We like to find out if there is a strong correlation between these two set of data. You are asked to carry out a number of statistical analyses using MATLAB’s matrix functionality. You must first create a 21×2 matrix that contain the data given in the table. From that matrix, do the following: 1. Compute the maximum, minimum, mean, and median of the students’ undergraduate GPAs and ChEPS GPAs. 2. Compute the standard deviations of undergraduate GPAs and ChEPS GPAs using the following formula: where N = total data size and µ = mean of the data. Do not use the built-in function in MATLAB to compute this number. 3. Compute the Pearson’s correlation coefficient r, which indicates the correlation between undergraduate GPA and ChEPS GPA, as given by the formula below: ∑ = − − = N i i x N s 1 2 ) ( 1 1 µ ( ) ( ) ( ) ( ) | | ( ) ( ) | | 2 2 2 2 ∑ ∑ ∑ ∑ ∑ ∑ ∑ − − − = y y N x x N y x xy N r 10 ChEPS GPA x.xx x.xx x.xxx x.xxx x.xxx Pearson correlation coefficient r !.xxxx Maximum Minimum Mean Median STDEV Underg GPA ________ ________ ________ ________ ________ ChEPS GPA ________ ________ ________ ________ ________ Pearson’s correlation coefficient r = ____________ 13. Using MATLAB to Solve Simple ChE Problems (a) Use MATLAB to determine the stoichiometric ratios of molecular species in the following reaction: C 6 H 12 O 6 + α NH 3 + β O 2 γ C 5 H 9 NO 2 + CO 2 + δ H 2 O α = __________ β = __________ γ = __________ δ = _________ (b) It is proposed that a steel tank be used to store carbon dioxide at 300 K. The tank is 2.5 m 3 in volume, and the maximum pressure it can safely withstand is 100 atm. Using the Beattie-Bridgeman equation of state given below, determine the maximum number of moles of CO 2 that can be stored in the tank P = RT + β + γ + δ V V 2 V 3 V 4 where R = gas constant = 0.08206 L-atm/gmole-K P, V, T = pressure in atm, molar volume in L/gmole, and temperature in K respectively β = R T B 0 – A 0 – R c T 2 γ = R T B 0 b – A 0 a – R c B 0 T 2 δ = R T B 0 b c T 2 For CO 2 , A 0 = 5.0065, a = 0.07132, B 0 = 0.10476, b = 0.07235, and c = 66.0×10 4 11 Note that 1 m 3 = 1000 L and 1 kg-mole = 1000 gmoles 14. Expansion and Contraction of a Balloon A balloon expands or contracts in volume so that the pressure inside the balloon is approximately the atmospheric pressure. (a) Develop a mathematical model (i.e. write the differential equation) for the volume of a balloon that has a slow leak. Let V represent the volume of the balloon and q represent the molar flowrate of air leaking from the balloon. Define all variables in your model and state all assumptions. (b) The following experimental data have been obtained for a leaking balloon. t (minutes) r (cm) 0 10 5 7.5 Predict when the radius of the balloon will reach 5 cm using two different assumptions for the molar rate of air leaving the balloon: (i) The molar rate is constant. (ii) The molar rate is proportional to the surface area of the balloon. Reminder: The volume of a sphere is 4/3 πr 3 and the area of a sphere is 4πr 2 . 15. Dynamics of a Gas Surge Drum Surge drums are often used as intermediate storage capacity for gas streams that are transferred between chemical process units. Consider a drum in the figure below, where q f is inlet molar flowrate and q is the outlet molar flowrate. q f , P f , T q, P, T (a) Let V, P, and T be the volume, the pressure, and the temperature of the drum, respectively. Write a model (one differential equation) to describe how the pressure in the tank varies with time. Assume ideal gas and isothermal operation. (b) Solve for P analytically using the following data: q f = 2.0 + 0.1t kmol/min q = 3.0 kmol/min V = 50 m 3 T = 300 K R = 8314 m 3 -Pa/kmol-°K P, V, T 12 if the drum initially contains 10 kmol of methane. Assuming that the vessel was built to withstand a maximum pressure of 50 atm, how long can we run this operation before the inlet gas flow must be shut off? (c) The ideal gas law is a poor assumption because of high pressure in the drum. Suppose the methane gas stream obeys the virial equation of state as follows: For simplicity, we will truncate all terms after the second virial coefficient B(T). Repeat the calculations in Part (b). For methane, B(T=300 K) = 0.04394 m 3 /kmol. 16. pH of Natural Rain Water CO 2 is a trace yet important constituent of the atmosphere that keeps the earth warm enough for life in their current forms. The concentration of CO 2 before the industrial revolution has been relatively constant over a long period. CO 2 is slightly water soluble, which makes the natural rain in a clean atmosphere slightly acidic due to the dissolution of CO 2 into the cloud droplets. The partitioning of CO 2 into a droplet can be described by the following equilibrium relations: The concentration of hydrogen ion (H + ) in the water determines its acidity. A higher concentration of H + means higher acidity. The acidity of a rain or cloud droplet is usually quantified by the pH of the droplet, which is related with the concentration of H + ([H + ]) using the following equation: pH = −log 10 [H + ]. Thus, lower pH means higher acidity. Based on the above equilibrium relationships and the principle of charge balance in an aqueous solution, the [H + ] in the CO 2 /H 2 O system (and thus the pH) can be determined using the following equation: where pCO 2 is the partial pressure of CO 2 in the atmosphere (in units of atm); K H,CO2 , K a1,CO2 , K a2,CO2 are Henry’s law constant (in units of M/atm), and first and second acid ..... ) ( ) ( ) ( 1 3 2 + + + + = V T D V T C V T B RT PV 13 dissociation constants for CO 2 , respectively, and K w is the water dissociation constant (which varies with temperature). For a given value of the partial pressure of CO 2 , the concentration of H+ and thus the pH can be determined. (a) Given that K w = 1.8×10 -14 (when T = 30°C) K H,CO2 = 10 -1.46 , K a1,CO2 = 10 -6.3 , K a2,CO2 = 10 -10.3 , and pCO2 = 280 ppm (atm), use function solve in MATLAB to determine the pH of natural rain water. Use format short in all your calculations. (b) Verify the answer in Part (a) by using the function roots in MATLAB. (c) Equation (1) which is nonlinear can be solved using a root-finding algorithm. One such method discussed in class is Newton-Raphson whose iterative formula for one variable is given by: Write a MATLAB program to generate a plot of CO 2 partial pressure (ppm) vs. pH of natural rain water using Newton-Raphson. Provide a title and label your x-axis and y- axis properly. The pH should be calculated at CO 2 partial pressures between the range of 280 ppm and 420 ppm using an increment of 20 ppm (use a FOR loop). At pCO 2 = 280 ppm, use an initial guess of [H + ] = 5.0×10 -6 to solve Equation (1). For subsequent pCO 2 ’s, use the answer from the previous increment as the initial guess, e.g. use the [H + ] solution from the case where pCO 2 = 280 ppm as a starting point for the case where pCO 2 = 300 ppm. You may rearrange Equation (1), f ([H + ]) = 0, into another form in order to help determine f '([H + ]) more easily. The termination criterion for Newton-Raphson is when the absolute relative percent error of the pH (not [H + ]) between two successive iterations is less than 10 -4 . Answers: pH (pCO 2 = 280 ppm) = ____________ pH (pCO 2 = 360 ppm) = ____________ pH (pCO 2 = 420 ppm) = ____________ 17. Solving a System of ODEs Using MATLAB Solve the following set of 1 st -order ODEs, which is an initial-value problem, using MATLAB’s ode45 function from x = 0 to x = 2 with an increment of 0.1: subject to: y 1 (0) = y 2 (0) = 0 Make a plot of the 2 equations (y 1 and y 2 versus x solutions from MATLAB). Then, compare your MATLAB solution with the analytical solution below by reporting the relative % differences. Include 6 decimal places in reporting all your numbers. 1 1 2 2 1 + = + = y dx dy x y dx dy ... , 3 , 2 , 1 ) ( ) ( 1 = ' − = + k x f x f x x k k k k 14 y 1 (x) = c 1 e x + c 2 e -x – 2 y 2 (x) = c 1 e x – c 2 e -x – x 18. Solving ODEs with MATLAB (a) Solve the following 1 st -order ODE using MATLAB’s ode45 function from x = 0 to x = 2 with an increment of 0.1. y(0) = 1 Make a plot of the equation y vs. x with solutions from MATLAB. Then compare your MATLAB solutions with those from the analytical solution of y(x) = [2 – exp(-x 2 )] 1/2 and report the relative % differences. Include 6 decimal places in reporting all your numbers. (b) Solve the following 2 nd -order ODE, which is an initial-value problem, using MATLAB’s ode45 function from x = 1 to x = 3 with an increment of 0.1: yª + xy = x 3 – 4/x 3 subject to: y(1) = –1, y'(1) = 4 Make a plot of the 2 equations: y and y' versus x with solutions from MATLAB. Then compare your MATLAB solutions with those from the analytical solution of y = x 2 – 2/x by reporting the relative % differences. Include 6 decimal places in reporting all your numbers. 19. The Shooting Method to Solve a Linear ODE Solve the following 2 nd -order linear ODEs, which is a boundary-value problem, using MATLAB’s ode45 function with an increment in x of 0.05: yª – xy' + 3y = 11x subject to: y(1) = 1.5 y(2) = 15 Make a plot of the equation y(x), and compare your MATLAB solution with the exact solution of y'(1) = 5.500000 by reporting the relative % difference. Include 6 decimal places in reporting all your numbers. xy y x dx dy − = 2 15 20. Solving a 3 rd -Order Boundary-Value ODE Using the Shooting Method Consider the following 3 rd -order ODE which is a boundary-value problem (t = 0 to 2): subject to y(0) = 0, y(2) = −1, and yª(2) = 0 (a) Is the above ODE linear or nonlinear? (b) Write a MATLAB program to implement the shooting method to solve the above ODE (use ode45). Use “format short”. Note that if the ODE is nonlinear, you are not guaranteed to obtain the correct solution in 3 trials. You will need to keep guessing until you find the correct answers that match all the given initial and boundary conditions. (c) Plot y(t), y'(t), and yª(t) as a function of t on the same graph. 21. Solving a 2 nd -Order ODE Boundary-Value Problem Consider the following 2 nd -order ODE which is a boundary-value problem whose domain t ranges from t = 1 to t = 10. 2yª + y' − 0.5y = exp(−y/t) s.t. y'(1) = 1 and y'(10) = 10 What are the values of y at t = 1 and t = 10? Use format short to show all your calculations. Answers: (accurate to 4 decimal places) y(1) = _______________ y(10) = ______________ 22. Solving a 3 rd -Order ODE Boundary-Value Problem Consider the following 3 rd -order ODE which is a boundary-value problem Use ode45 in MATLAB to solve for numerical solutions of the above ODE between t = 0 and t = 1, showing a step size of 0.1. The analytical (exact) solution of the above ODE is: y(t) = t(a + bt)exp(ct) where a, b, and c are constant coefficients. Also, use MATLAB and the numerical answers from ode45 to determine the correct values of a, b, and c, without taking any derivatives of y(t). y t t y dt dy dt y d − = − + 3 3 3 3 5 10 1 2 3 ) 1 ( , 0 ) 1 ( , 0 ) 0 ( . . , 1 0 ) 3 5 2 ( e y y y t s t e t t t ty y t − = ' = = s s − − − + = ' ' ' 16 Answers: y(t=0) = ______0______ y'(t=0) = _____________ y''(t=0) = _____________ y(t=0.5) = ____________ y'(t=0.5) = ____________ y''(t=0.5) = ____________ y(t=1) = ______0______ y'(t=1) = ___−2.7183____ y''(t=1) = _____________ The values of coefficients are: a = _____ b = _____ c = _____ 23. Solving a 3 rd -Order ODE Boundary-Value Problem Consider the following 3 rd -order ODE which is a boundary-value problem: The analytical (exact) solution of the above ODE is: Use ode23 in MATLAB to solve for numerical solutions of the above ODE between t = 0 and t = 1, when l = 2 and a = −3, showing a step size of 0.1. Then compare the numerical solutions with the exact solutions by calculating the relative percentage deviation in 6 decimal places at t = 0, 0.2, 0.4, 0.6, 0.8, and 1.0. Note that the percentage deviations must be positive numbers. Answers: (accurate to 6 decimal places) y(t=0) MATLAB = __________ y(t=0) EXACT = __________ % Deviation = __________ y(t=1) MATLAB = __________ y(t=1) EXACT = __________ % Deviation = __________ 24. Solving a 2 nd -Order Boundary-Value ODE Using the Shooting Method The diffusion and simultaneous first-order irreversible chemical reaction in a single phase containing only reactant A and product B results in a second-order ODE given by: where C A is the concentration of reactant A (kmol/m 3 ), z is the distance variable (m), k is the homogeneous reaction rate constant (s -1 ), and D AB is the binary diffusion coefficient (m 3 /s). A AB A C D k dz C d = 2 2 2640 . 0 ) 5 . 0 ( , 0 ) 5 . 0 ( , 0894 . 0 ) 0 ( . . , 1 0 0 2 − = ' = = s s = + ' − ' ' ' y y y t s t a y l y 17 A typical geometry for the above ODE is that of a one-dimensional layer that has its surface exposed to a known concentration and allows no diffusion across its bottom surface. Thus, the initial and boundary conditions are: C A (z = 0) = C A0 and dC A (z = L) = 0 dz where C A0 is the constant concentration at the surface (z = 0) and there is no transport across the bottom surface (z = L) so the derivative is zero. This differential equation has an analytical solution given by: (a) Is the above ODE linear or nonlinear? Write a MATLAB program to implement the shooting method to solve the above ODE (use ode23), in which C A0 = 0.2 kmol/m 3 , k = 0.001 s -1 , D AB = 1.2x10 -9 m 2 /s, and L = 0.001 m. Use “format short e”. (b) Compare the concentration profiles over the thickness as predicted by the numerical solution of (a) with the analytical solution by reporting the relative percentage differences accurate to 6 decimal places with an increment of ∆z = 10 -4 . (c) Obtain a numerical solution for a second-order reaction that requires the C A term on the right side of the ODE to become squared. The second-order rate constant is given by k = 0.02 m 3 /(kmole-s). Use “format short e” and ode23. Is this new ODE linear or nonlinear? 25. Solving a Nonlinear 3 rd -Order ODE Boundary-Value Problem Consider the following nonlinear 3 rd -order ODE which is a boundary-value problem: with the following boundary conditions: y(0) = 1.0, y(2) = 29.3373, yª(2) = 5.1807. Use the shooting method and ode45 in MATLAB to solve the above equation numerically from t = 0 to t = 2. Because the ODE is nonlinear, your answer will not be correct after 3 trials. Rather than guessing the answer repeatedly, you are to use the while loop in MATLAB to keep interpolating linearly between the two latest guesses until | answer – target | < 0.0001. Start your shooting method with the following two guesses: G1 = 10 and G2 = 20. After obtaining G3 from linear interpolation, your G1 becomes G2 and G2 becomes G3. Keep repeating the process until the tolerance of 0.0001 is achieved. ( ( ¸ ( ¸ | | ¹ | \ | ( ( ¸ ( ¸ | ¹ | \ | − | | ¹ | \ | = AB AB A A D k L L z D k L C C cosh 1 cosh 0 t e y y t y y 2 3 ) cos( ) ( 4 = + ' − ' ' ' 18 Answers: (accurate to 4 decimal places) y(0) = __1.0000___ y'(0) = __________ y''(0) = __________ y(1) = __________ y'(1) = __________ y''(1) = __________ y(2) = __29.3373__ y'(2) = __________ y''(2) = __5.1807___ 26. Isothermal Compression of Ethane Ethane is being compressed isothermally at 50 °C (323.15 Kelvin) to 1/100 th (i.e. 1%) of its initial volume in a closed vessel. The initial pressure of the gas is 1.01325 bar. We wish to calculate the work per gmole required in this compression. For a closed system in a reversible isothermal compression from V 1 to V 2 , the work W done on the system can be calculated from: dW = −P dV Use MATLAB to do the following: (a) Calculate the work W using the ideal gas assumption. (b) Calculate the work W using the Redlich-Kwong-Soave equation of state, which is given by: P = V = T = R = T C = P C = ω = Answers: (a) Work (ideal gas) = _________________ (b) Work (RKS gas) = ___________________ bar 27. Heat Transfer in a Tapered Fin Consider a tapered fin of trapezoidal profile: The governing equation for the temperature dis second-order differential equation where y = dimensionless x = dimensionless where q is the uniform rate of internal heat generation per unit volume (via nuclear fission, electrical dissipation, chemical reaction, etc.) and k is the thermal conductivity. 19 = pressure in bar = molar volume in L/gmole = temperature in K = gas constant (0.08315 bar-L/gmole-K) = critical temperature in K (305.556 K for ethane) critical pressure in atm (48.2989 bar for ethane) Pitzer acentric factor (0.1064 for ethane) ___________________ bar-L/gmole ___________________ bar-L/gmole Heat Transfer in a Tapered Fin Consider a tapered fin of trapezoidal profile: The governing equation for the temperature distribution in the fin is the dimensionless order differential equation y = dimensionless temperature = (T – T ∞ ) / (T w + T ∞ ) x = dimensionless distance = (T w – T ∞ ) q is the uniform rate of internal heat generation per unit volume (via nuclear fission, electrical dissipation, chemical reaction, etc.) and k is the thermal conductivity. critical temperature in K (305.556 K for ethane) critical pressure in atm (48.2989 bar for ethane) tribution in the fin is the dimensionless q is the uniform rate of internal heat generation per unit volume (via nuclear fission, electrical dissipation, chemical reaction, etc.) and k is the thermal conductivity. where h is the average convective heat transfer coefficient Based upon the known physical conditions for a fin, it is dimensional temperature distribution inside the fin if we know the boundary conditions. For this problem, the fin has adiabatic ends, i.e. T = T The physical conditions of the fin are given as follows: e = 30 cm k = 60 J/sec-cm T · = 20°C Use ode45 in MATLAB to solve the above ODE numerically and answer the following questions. Use format short versus x. Label your x-axis and Answers: (accurate to 4 decimal places) y'(0) = _______________ 28. Maclaruin Series Expansion A Maclaurin series is a Taylor series expansion of a function about 0, and are named after the Scottish mathematician Maclaurin. If enough terms are carried, the Maclaurin series can approximate any mathematical function to the desired accuracy. the sine function and the square root are Write a MATLAB program to compute the value of given point using the given Maclaurin formulae: x x) sin( 20 is the average convective heat transfer coefficient. Based upon the known physical conditions for a fin, it is possible to solve for the one dimensional temperature distribution inside the fin if we know the boundary conditions. For this problem, the fin has adiabatic ends, i.e. T = T · at u = 0 and T = T w The physical conditions of the fin are given as follows: b = 60 cm l = 300 cm cm-°C q = 0.016 J/cm 3 -sec h = 0.01 J/cm T w = 100°C in MATLAB to solve the above ODE numerically and answer the following format short to show all your calculations. Also in your output, plot axis and y-axis properly and include a legend in your graph as we (accurate to 4 decimal places) (0) = _______________ T(u=150 cm) = _______________ Maclaruin Series Expansion series is a Taylor series expansion of a function about 0, and are named after the Scottish mathematician Maclaurin. If enough terms are carried, the Maclaurin series can approximate any mathematical function to the desired accuracy. The Maclaurin and the square root are as follows: Write a MATLAB program to compute the value of the following two functions at the given point using the given Maclaurin formulae: radians in is x where x at , 2 = possible to solve for the one dimensional temperature distribution inside the fin if we know the boundary conditions. For w at u = l. = 300 cm h = 0.01 J/cm 2 -sec-°C in MATLAB to solve the above ODE numerically and answer the following to show all your calculations. Also in your output, plot y and y' axis properly and include a legend in your graph as well. (u=150 cm) = _______________ °C series is a Taylor series expansion of a function about 0, and are named after the Scottish mathematician Maclaurin. If enough terms are carried, the Maclaurin series can The Maclaurin formula for the following two functions at the 21 ) ( 3 ) ( 4 t D P P t F C D g v µ µ µ v = − = Both values should be computed accurate to 14 decimal places which is the accuracy of format long in MATLAB when compared with the exact solution. This means using the following convergence criterion: Also, in your MATLAB program, report the total number of terms needed in the series expansion in order to achieve the desired accuracy. Answers: Maclaurin series solution for the sine function = ___________________________ Number of terms required = __________ Maclaurin series solution for the square root function = _____________________ Number of terms required = __________ 29. Solving for Terminal Velocity of Solid Particles with Successive Substitution The direct method (or successive substitution) can be used to solve a nonlinear algebraic equation. The algorithm is iterative in which a newly calculated value of x (the unknown) is used as the next guess according to the following formula: x k+1 = F(x k ) k = 0, 1, 2, ….. Note that this formula requires that x be expressed explicitly as the unknown on the left- hand side in the nonlinear equation (although the right-hand side F(x) will also contain x). Terminal velocity of a solid spherical particle falling in fluid media can be expressed by the equation: (1-1) where v t = the terminal velocity (m/s) g = gravitational acceleration (= 9.80665 m/s 2 ) µ P = the particle density (kg/m 3 ) 14 10 − s − Solution Maclaurin Solution Exact 5 . 0 1 = + x at x x 22 D P = the diameter of a spherical particle (m) C D = dimensionless drag coefficient The drag coefficient varies with the Reynolds number (Re) as follows: C D = 24 for Re < 0.1 (1-2) Re C D = 24 (1 + 0.14 Re 0.7 ) for 0.1 s Re s 1000 (1-3) Re where Re = v t D P µ / µ µ = the density of the fluid (kg/ m 3 ) µ = the fluid viscosity (Pa-s) Consider uniform spherical iron pellets with D P = 0.5 mm, µ P = 7860 kg/ m 3 that are falling in air (µ = 1.23 kg/ m 3 , µ = 1.79 x 10 -5 Pa-s) at terminal velocity. Write a MATLAB program to do the following (use “format short” in all calculations): (a) Plot F(v t ) and v t versus v t in the range 0.01 s v t s 10 m/s and locate the approximate root of equation (1-1), which will be used as the initial guess in Part (b) of the direct method. (b) Implement the direct method to solve for the terminal velocity and accept the solution only if | v t − F(v t ) | s 0.0001. 30. Programming in MATLAB (Guess-the-Sum Game) You are to write a MATLAB program which will allow a user to play a little game, called Guess-the-Sum, with your computer. The principal idea is very simple. Each time you play the game, you will think of an integer m between 0 and 5 inclusively, while MATLAB will randomly generate an integer n between 0 and 5 inclusively as well. Assuming that the computer doesn’t know what number is in your mind and you don’t know what number the computer has randomly generated, you and the computer will each take turn guessing the sum, m+n, of these two integers. That is, each time you play the game, the computer will guess the sum once and you will guess it once. For example, if the computer generated an integer 5, and your number is 3, whoever guesses the sum to be 8 wins the game. In many cases, though, the sum you and the computer guess is not the correct answer. Hence, we use the following rules to award points during the game. 1. Whoever guesses the correct sum will receive 10 points. 2. If the guess is incorrect, 1 point is deducted for every integer that is larger than or smaller than the correct sum. For example, if the correct sum is 9 and your guess is 5, 4 points (9 – 5) are deducted; hence, you will receive 6 points for your guess. 23 The result is that the closer your guess is to the correct sum, the more points you get. 3. You will always let the computer guess first, which will be randomized but whose value must be equal to or larger than n (the computer shouldn’t be stupid enough to guess the sum to be less than its integer n). However, you may not guess the same sum that the computer already picked. If the user enters the same sum, make him guess again. Play the game 10 times and compare the cumulative points you and the computer receive and declare the winner. Be sure to include error-checking in your programming to detect non-integers or outside-the-range numbers in user input. Your output should look as follows: Game # 1: Please enter an integer between 0 and 5: 1 The computer picked 8 to be the sum. Now, it's your turn to guess the sum: 7 Computer receives 5 points. Player receives 6 points. Game # 2: Please enter an integer between 0 and 5: 8 Sorry, 8 is outside the range. Please enter an integer between 0 and 5: 4.5 Sorry, 4.50000 is not an integer number. Please enter an integer between 0 and 5: 2 The computer picked 6 to be the sum. Now, it's your turn to guess the sum: 6 Your guess is the same as the computer's. Guess again. Now, it's your turn to guess the sum: 8 Computer receives 7 points. Player receives 9 points. Game # 3: Please enter an integer between 0 and 5: 0 The computer picked 7 to be the sum. Now, it's your turn to guess the sum: 5 Computer receives 8 points. Player receives 10 points. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Game #10: 24 Please enter an integer between 0 and 5: 5 The computer picked 5 to be the sum. Now, it's your turn to guess the sum: 7 Computer receives 8 points. Player receives 10 points. ---------------------------------------------------------------- The computer receives a total score of 75 points. The player receives a total score of 85 points. The player is the winner. ---------------------------------------------------------------- 31. Programming with MATLAB (Classification of Numbers) In this problem, you are given a list of positive integers that we like to classify as either prime number, square number, semi-square number, or neither (i.e. the number does not belong to any of the 3 classes). You are to write a MATLAB to do the classification. Here are the definitions of each class of number: 1. Prime number – a positive integer larger than 1 that is not divisible by any integer except 1 and the number itself. Examples of prime numbers are 3, 11, 23, and 29. 2. Square number – a positive integer n which is the sum of the square of consecutive positive integers starting at 1. For example, 140 is a “square” number because 140 = 1 2 + 2 2 + 3 2 + 4 2 + 5 2 + 6 2 + 7 2 . 3. Semi-square number – a positive integer n which is the sum of the square of consecutive positive odd or even integers starting at 1 or 2, respectively. For example, 84 is a semi- square number because 84 = 1 2 + 3 2 + 5 2 + 7 2 . So is 120 because 120 = 2 2 + 4 2 + 6 2 + 8 2 . Note that a given positive integer will only belong to one of the four number classes. Finally, you need to know the 4 simple rules of finding a prime number as follows: (i) Rule 1: Check if the number is even. If it is, it is not a prime number because it is divisible by 2 (Note that 2 is the exception and is a prime number). (ii) Rule 2: Check if the number is divisible by 3 or 5. If it is, it is not a prime number. (iii) Rule 3: Find the square root of the number. If the square root results in an integer, the number is not a prime number. (iv) Rule 4: Divide the number by all the prime numbers less than the square root (but can skip 2, 3, and 5). If the number is not divisible by any of the prime number less than the square root, the number is a prime. Otherwise, it is a composite. You will also need the following prime numbers up to 100 in Rule (iv): [7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97] 25 You will test your program on a total of 10 positive integers with the following values which you should put into a vector: [455, 647, 650, 731, 991, 969, 652, 819, 560, 863] The output from MATLAB should show which class or classes a given number belongs to. Answers: Prime numbers are: _____________________________________ Square numbers are: _____________________________________ Semi-square numbers are: _____________________________________ Neither are: _____________________________________ 32. Programming with MATLAB (a) Study the pattern below and write a MATLAB program that produces the table including the heading (spacing is not important) with 10 or fewer than 10 lines of codes. A Board of Digits 1 0 0 0 0 0 0 0 0 2 2 0 0 0 0 0 0 0 3 3 3 0 0 0 0 0 0 4 4 4 4 0 0 0 0 0 5 5 5 5 5 0 0 0 0 6 6 6 6 6 6 0 0 0 7 7 7 7 7 7 7 0 0 8 8 8 8 8 8 8 8 0 9 9 9 9 9 9 9 9 9 You must use for loops in your programming, i.e. you may not enter the values of this matrix directly, and must begin your M-file with clc and clear (counted as 2 lines of codes). Finally, if you use a comma to separate two statements on the same line, it will be counted as 2 lines of programming. Points will be deducted if your MATLAB code is longer than 10 lines. (b) Long, long ago in places far far away, way before the advent of the computer game, Neanderthals (a primitive human race which died out thousands of years ago) played games with sticks. In the pursuit of the wisdom of the ancients, we return to this humble setting in order to come to a deeper understanding of the universe and computer programming. One such game was called Nimrod (after the man who invented it, 26 Nimble Roderick). Nimrod is played with two piles of rods and two players. The objective is to be player who takes the last rod. A valid move is to take any number of rods from either pile, or an equal number from both piles. Play progresses until no rods remain. A sample game: Pile 1: 5, Pile 2: 9 Ben takes 0 from Pile 1 and 2 from Pile 2 Pile 1: 5, Pile 2: 7 Jen takes 2 from Pile 1 and 2 from Pile 2 Pile 1: 3, Pile 2: 5 Ben takes 3 from Pile 1 and 0 from Pile 2 Pile 1: 0, Pile 2: 5 Jen takes 0 from Pile 1 and 5 from Pile 2 Pile 1: 0, Pile 2: 0 Jen wins! Ben loses! Write a MATLAB program to play Nimrod. Use the following rules and guidelines: (1) The number of rods in each pile must be generated randomly between 5 and 10 inclusively. (2) Ben and Jen will each take turn to play the game, so in your output be sure to print out whether it is Ben’s or Jen’s turn. When testing your program, you will need to take turn pretending to be either Ben or Jen. (3) In your programming, you will need to let the player choose the option of removing rods from just one pile or equal number of rods from both piles. (4) The only error checking you need to implement is to make sure that the player does not remove a non-positive number of rods (s 0) or remove more than what is in the pile. A sample output from this program looks as follows: IT IS BEN'S TURN Pile 1: 7, Pile 2: 9 Enter 1 to remove rods from one pile and 2 to remove rods from both piles: 2 Enter the number of rods to remove from both piles: 3 Ben takes 3 from Pile 1 and 3 from Pile 2 IT IS JEN'S TURN Pile 1: 4, Pile 2: 6 Enter 1 to remove rods from one pile and 2 to remove rods from both piles: 1 Which pile? (1 or 2): 1 Enter the number of rods to remove from Pile 1: 5 Enter the number of rods to remove from Pile 1: 2 Jen takes 2 from Pile 1 and 0 from Pile 2 27 IT IS BEN'S TURN Pile 1: 2, Pile 2: 6 Enter 1 to remove rods from one pile and 2 to remove rods from both piles: 2 Enter the number of rods to remove from both piles: 4 Enter the number of rods to remove from both piles: 1 Ben takes 1 from Pile 1 and 1 from Pile 2 IT IS JEN'S TURN Pile 1: 1, Pile 2: 5 Enter 1 to remove rods from one pile and 2 to remove rods from both piles: 1 Which pile? (1 or 2): 2 Enter the number of rods to remove from Pile 2: 0 Enter the number of rods to remove from Pile 2: 3 Jen takes 0 from Pile 1 and 3 from Pile 2 IT IS BEN'S TURN Pile 1: 1, Pile 2: 2 Enter 1 to remove rods from one pile and 2 to remove rods from both piles: 2 Enter the number of rods to remove from both piles: 1 Ben takes 1 from Pile 1 and 1 from Pile 2 IT IS JEN'S TURN Pile 1: 0, Pile 2: 1 Enter 1 to remove rods from one pile and 2 to remove rods from both piles: 1 Which pile? (1 or 2): 2 Enter the number of rods to remove from Pile 2: 1 Jen takes 0 from Pile 1 and 1 from Pile 2 Jen wins! Ben loses! 33. Mass Balance in a Two-Tank System Consider the following two vessels connected in series. Initially (at t = 0), Tank 1 is filled with 20 kg of brine solution with 10 kg of dissolved salt (i.e. 10 kg water + 10 kg salt), while Tank 2 is filled with 10 kg of pure water. Pure water is then added to Tank 1. At the same time, 1 + 0.1t kg/min of liquid from Tank 1 flows into Tank 2 (meaning that this inter- vessel flow increases linearly with time, while 2 kg/min of liquid from Tank 2 flows out. 2 kg/min, pure water 1+ 0.1t kg/min 2 kg/min x 1 x 2 Tank 1 Tank 2 28 (a) If we define x 1 and x 2 as the mass fraction of salt in Tank 1 and Tank 2, respectively, derive an analytical expression of x 1 as a function of time t. Calculate the concentration (i.e. mass fraction) of salt in Tank 1 at the time when there is a maximum amount of liquid in Tank 1. Answer: x 1 (t = ____ min) = ___________ when liquid in Tank 1 is at maximum Useful integration formula: where B = a + bx + cx 2 , γ = 4ac – b 2 , ω = b + 2cx (b) Derive an ODE dx 2 /dt, and together with dx 1 /dt in Part (a) use MATLAB to solve for the numerical solutions of x 1 and x 2 of this system of two ODEs using ode45. Run your model from t = 0 to t = 30 minutes. Make a plot of the numerical solutions as well. Your solution should show x 2 going through a maximum, as salt enters Tank 2 but then its brine solution becomes more dilute as more pure enters Tank 1. Based on MATLAB solutions, answer the following questions (correct to 1 decimal place for time and 3 decimal places for mass fractions): Questions: 1. x 2 (at t = ______ mins) = _________ when x 2 goes through a maximum 2. Did x 1 and x 2 ever become equal? Yes or No: ______ If yes, x 1 = x 2 (at t = ______ mins) = ____________ 34. A Two-Tank System A large tank is connected to a smaller tank by means of a valve, which remains closed at all times. The large tank contains nitrogen (assume it is an ideal gas) at 700 kPa, while the small tank is evacuated (vacuum). The valve between the two tanks starts to leak and the 0 tanh 2 0 2 0 tan 2 1 1 < | | ¹ | \ | − − − = − = > | | ¹ | \ | + − − } γ γ ω γ γ ω γ γ ω γ if if B dx if 29 rate of gas leakage is proportional to the pressure difference between the two tanks, as given by where P AVG = average absolute pressure across the valve = (P 1 + P 2 )/2 Valve constant C V = 3.6×10 -4 kmol/kPa-hour. Tank volumes are 30 m 3 and 15 m 3 . Assume constant temperature of 293.15 K in both tanks. Universal gas constant = 8.31439 kPa-m 3 /kmol-K. Nitrogen P 2 V 2 P 1 V 1 Leak (a) Derive an analytical expression of dn 1 /dt as a function of n 1 , where n 1 is the number of moles of nitrogen in the large tank. This ODE of yours should contain only n 1 as the unknown variable. Use MATLAB to solve for n 1 (use ode45 and “format short”), and run the model up until t = 25 hours. Answer: n 1 (t = 25 hours) = _______________ kmoles (b) As a good chemical engineer, you always look for ways to simplify your engineering calculations. In this particular problem, it is possible to derive an analytical solution when t is small, i.e. when P 2 << P 1 . Derive an analytical expression for n 1 as a function of time t. Calculate n 1 after 2 hours and 4 hours, and compare these solutions with those from Part (a) by reporting the absolute % relative errors (assuming the MATLAB solutions are exact and show 4 decimal places). Answers: n 1 (t = 2 hours) = _____________ kmoles % relative error = ___________ n 1 (t = 4 hours) = _____________ kmoles % relative error = ___________ ) ( 2 1 P P P C Flow Leak AVG V − = 30 35. Mixing Tank with 2 Feeds Consider the following mixing tank problem. Water is flowing into a well-stirred tank at 120 kg/hr and methanol is being added at 20 kg/hr. The resulting solution is leaving the tank at 100 kg/hr. There is 100 kg of fresh water in the tank at the start of the operation. We are interested in determining the mass fraction of methanol in the outlet as a function of time t. 120 kg/hr water 20 kg/hr methanol 100 kg/hr solution (a) Derive an analytical expression for solving the mass fraction of methanol as a function of time t. An analytical solution is possible for this particular system. (b)Use MATLAB to solve for the mass fraction of methanol in the outlet after 1 hour, and compare the number to the exact solution in Part (a). Also, what is the methanol mass fraction in the outlet at steady state? (c) Of course, steady-state condition probably cannot be achieved in this system because the inflow rate is greater than the outflow rate, and sooner or later, the tank will fill and overflow. Assuming that the density of the solution in the tank is always constant at 1000 kg/m 3 and the volume of the tank is 1.0 m 3 , compute the time it takes for the tank to overflow. 36. Mixing Methanol and Water in a Rectangular Tank (a) Consider the following mixing tank problem. Initially at t = 0 hr, the rectangular tank contains a solution of 80 kg water and 20 kg methanol. Pure water then flows into the well-stirred tank at 100 kg/hr. The resulting solution leaves the tank at 100 kg/hr. We are interested in determining the mass fraction of methanol in the outlet as a function of time t. 31 100 kg/hr pure water 100 kg/hr solution Derive an analytical expression for methanol mass fraction in the outlet as a function of time, and calculate this mass fraction after 1 hour of operation. (b) After 1 hour, a pure methanol feed is introduced into the tank at 20 kg/hr, as shown in the figure below. This operation continues until t = 20 hours. Derive an analytical expression for solving the mass fraction of methanol as a function of time t. Compute the methanol fraction in the outlet after 20 hours. 100 kg/hr pure water 20 kg/hr methanol 100 kg/hr solution (c) Because the inflow rate is greater than the outflow rate, sooner or later, the tank will fill and overflow. Assuming that the density of the solution in the tank is always constant at 1000 kg/m 3 and the cross-sectional area of the tank is 0.1 m 2 , compute the minimum tank height to prevent the tank from overflowing after 20 hours of operation. (d) Finally, after 20 hours of operation the methanol feed is suddenly changed from a constant flow rate to F methanol = 20z 1/2 kg/hr (i.e. the flow now changes as the square root of the liquid height). Use MATLAB to solve for methanol mass fraction in the outlet at t = 30 hours. 37. Continuous Cone-Shaped Open Vessel Consider a conical open vessel as shown in the following figure. The vessel has a radius R at the top and a height H. Water flows into the vessel at a rate of F 1 and it flows out through a valve at a rate of F 2 . The following data are given: 32 F 1 P 0 H = 10 ft Water z P 1 C v P 2 R = 3 ft F 2 P 0 = P 2 = 14.7 psia C v = characteristic valve constant = 3.0 ft 3 /psia 1/2 -min | = water mass density = 62.4 lbm/ft 3 z 0 = initial liquid height = z(t = 0) = 5 ft F 1 is not constant but is controlled such that it varies with the liquid height according to: F 1 = 2z 1/2 ft 3 /min Solve for z analytically as a function of time. z Hint: Volume of a cone V = } 0 A(z)dz where A(z) = cone cross-sectional area and is a function of z 38. Adiabatic Expansion/Compression in an Enclosed Vessel Consider the following system in which air is trapped inside an enclosed vessel while water flows into the vessel at a rate of F 1 and flows out at a rate of F 2 . P 0 Air Water Z P 1 F 1 P 2 F 2 C L Initially, the air is at 25°C and 1.01325x10 5 Pa (Pascal), and the liquid height is 5.0 meter. The following data are available: 33 Gravitational acceleration g = 9.80665 m/s 2 Air C V (heat capacity at constant volume) = 2.0731x10 4 J/kmol°C Vessel volume =10.0 m 3 Vessel cross-sectional area = 1.0 m 2 Water density = 1000 kg/m 3 Gas constant R = 8314 m 3 Pa/kmol°K = 8314 J/kmol°K Air MW = 29.0 kg/kmol Valve constant C L = 0.001 m 3 /Pa 1/2 min Outlet flow rate F 2 = 0.1 m 3 /min Source pressure P 1 = 3.0x10 5 Pa (a) Assuming adiabatic expansion/compression due to the rise/fall of the liquid height, write down all the system-describing equations. Be sure to define all your variables which are unknown. Use the data given and simplify each equation as much as possible. (b) Derive an ordinary differential equation that relates the liquid height as a function of time. Your final equation must contain Z as the only dependent variable. (c) Solve the ODE in Part (b) using MATLAB and plot the liquid height Z as a function of time. 39. Two Open Continuous Flow Tanks in Series Consider two tanks in series as shown where the flow out of the first tank enters the second tank. Our objective is to develop a model to describe how the height of liquid in tank 2 changes with time, given the input flowrate F 0 (t). Assume that the flow out of each tank is a linear function of the height of liquid in the tank (i.e. F 1 = β 1 h 1 and F 2 = β 2 h 2 ) and each tank has a constant cross-sectional area. F 0 F 1 h 1 1 h 2 2 F 2 (a) Develop a system of equations to describe the liquid height of the two tanks as a function of time, assuming constant liquid density. Be sure to define all your variables. (b)Solve for h 1 and h 2 analytically if A 1 = 10 ft 2 A 2 = 20 ft 2 F 0 = 2 ft 3 /hr β 1 = β 2 = 1 ft 2 /hr where A i is the cross-sectional area of tank i 34 and tank 1 initially has a liquid height of 1 ft of while tank 2 is empty. Plot the two liquid height profiles as a function of time from 0 hr to 5 hr. (c) Suppose F 0 is no longer constant but equals to 2t + 1 ft 3 /hr. Use MATLAB to solve for the liquid heights in both tanks. Plot both profiles as a function time up to 5 hr. 40. Liquid Height in a Spherical Tank The following figure shows a spherical tank for storing water. The tank is filled through a hole in the top and drained through a hole in the bottom. If the tank’s radius is R, one can h use integration to show that the volume of water in the tank as a function of its height h is given by: V(h) = πRh 2 − πh 3 3 Studies in fluid mechanics have identified the relation between the volume flow through the bottom hole and the liquid height as: where A is the area of the hole, g is the acceleration due to gravity (32.2 ft/sec 2 ), and C d is an experimentally determined value that depends partly on the type of fluid (for water, C d = 0.6). Suppose the initial height of water is 8 ft and the tank has a radius of 5 ft with a 1-inch diameter hole in the bottom. Use MATLAB to determine how long it will take for the tank to empty (i.e. drain completely), to the nearest second (i.e. no decimal places). 41. Cylindrical and Conical Open Continuous Vessels in Series Consider two tanks in series as shown where the flow out of the first tank enters the second tank. The first tank is a cylindrical vessel with a radius R 1 = 1 m, a height H 1 = 4 m, and the second tank is a cone-shaped vessel with a radius R 2 = 1 m, a height H 2 = 5 m. The geometry of the vessels is shown in the diagram. Our objective is to develop a model to describe how the heights of liquid (water), z 1 and z 2 , in the 2 tanks change with time. R gh A C F d 2 = 35 F 1 R 1 = 1 m P 0 H 1 = 4 m Z 1 Water C V P 2 F 2 P 1 H 2 = 5 m z 2 F 3 R 2 = 1 m (a) Given the following data on the cylindrical vessel, derive an analytical expression of z 1 (t) as a function of time. Based on this expression, determine whether the cylindrical vessel will drain completely or overflow, and if so when (i.e. after how many minutes?). F 1 = 1.0 m 3 /min P 0 = P 2 = 1 atm | water = 1000 kg/m 3 g = gravitational constant = 9.80665 m/s 2 C V = 0.001 m 3 /Pa 1/2 -min z 1 (t=0) = 2 m (b) A controller was installed in the cone-shaped vessel which regulates the outflow of the vessel according to F 3 = −ln(1 − 0.09903z 1 1/2 ) If z 2 (t = 0) = 3 m, derive an analytical expression of z 2 (t) as a function of time. Based on this expression, determine whether the cone-shaped vessel will drain completely or overflow, and if so when (i.e. after how many minutes?). Hint: Note that the cross-sectional area is no longer constant. Volume of a cone z 2 V = } 0 A(z 2 )dz 2 , where A(z 2 ) = cone cross-sectional area and is a function of z 2 . (c) Suppose the inflow F 1 into the first tank is now reduced to 0.3 m 3 /min and the outflow F 3 from the second tank is maintained at a constant value of 0.05 m 3 /min, while the rest of the data remain the same. We wish to solve this problem again. The above conditions 36 will cause both vessels to overflow after a certain time. Use MATLAB to determine which vessel will overflow first and exactly when (correct to within 0.1 min). 42. Modeling Liquid Heights in a Two-Vessel System An open spherical vessel is connected to a closed rectangular tank through an open valve as shown in the figure below. Water flows continuously into the spherical vessel at a volumetric flow rate of F 1 with some of the water in the sphere also flowing into the rectangular tank at a rate of F 2 . Water then flows out of the rectangular tank at a flow rate of F 3 , and the temperature inside the tank is always maintained at 298.15 K. We wish to study the dynamics of the liquid heights in the two vessels using MATLAB. The following data are known about the system: C V = 1×10 -5 m 3 /Pa 1/2 -min (characteristic valve constant) P 0 = 1.01325×10 5 Pascal Cross-sectional area of rectangular tank = 3 m 2 Radius of sphere R = 2 m Height of rectangular tank = 10 m Initially at t = 0, z 1 = 3 m, z 2 = 2 m, P = 1.01325×10 5 Pascal Gravitational acceleration g = 9.80665 m/s 2 | (water) = 1000 kg/m 3 Universal gas constant R = 8314 m 3 -Pa/kmol-K = 8314 J/kmol-K Liquid volume inside a sphere as a function of liquid height z is given by: Use MATLAB’s ode45 to determine whether the liquid heights in the two vessels will ever be equal, i.e. z 1 = z 2 . If so, report the time (accurate to one decimal place) at which this happens and the height.. If z 1 is never equal to z 2 , determine when the two liquid heights are at the closest. Run your model for 20 minutes, which should be sufficient to answer the questions. F 1 = 0.1 m 3 /min F 3 = 0.3 m 3 /min F 2 P 0 P 2 P 1 P z 2 z 1 Air 3 3 2 z z R V π π − = 37 Answer the following questions: Are the two liquid heights ever equal? Yes No If yes, z 1 = z 2 = ____________ meters Time at which the two liquid heights are equal or at the closest = _____________ minutes 43. Modeling Liquid Heights in a Two-Vessel System An open rectangular vessel is connected to a well-insulated (i.e. adiabatic) and closed spherical vessel shown in the figure below. Water from the rectangular vessel is drained through a hole (radius = 4 cm) at its bottom into the spherical vessel at a volumetric flow rate of: where A is the area of the hole, g is the acceleration due to gravity, and C d is an experimentally determined value that depends partly on the type of fluid (for water, C d = 0.6). Water then flows out of the spherical vessel at a flow rate of F 2 . We wish to study the dynamics of the liquid heights in the two vessels using MATLAB. The following data are known about the system: C valve = 1×10 -3 m 3 /Pa 1/2 -min (characteristic valve constant) Cross-sectional area of the rectangular vessel = 4 m 2 Radius of sphere R = 2 m P 2 = 1.01325×10 5 Pascal | (water) = 1000 kg/m 3 C V (air heat capacity at constant volume) = 20850 J/kmol-K Initially at t = 0, z 1 = 6 m, z 2 = 2 m, P 0 = 1.01325×10 5 Pascal, T G = 303.15 K Gravitational acceleration g = 9.80665 m/s 2 = 35303.94 m/min 2 Universal gas constant R = 8314 m 3 -Pa/kmol-K = 8314 J/kmol-K 1 1 2gz A C F d = F 1 F 2 P 2 P 1 z 1 Air P 0 z 2 Water 38 Conversion factors: 1 Pascal = 1 N/m 2 = 1 kg/m-s 2 , 1 N = kg-m/s 2 , 1 J = kg-m 2 /s 2 Liquid volume inside a sphere as a function of liquid height z is given by: Derive an ODE for z 2 as a function of time (without z 1 in the ODE) and use MATLAB’s ode45 to simulate its dynamics until either the rectangular vessel dries up or the spherical vessel is full. You must simplify your final ODE as much as possible before using it in MATLAB. Note that ode45 may result in solutions with imaginary parts. You can ignore them as long as the values are small which come from inherent problems in numerical integrations. Hint: Be very careful with your units and their conversions. Answer the following questions: Time at which the rectangular vessel dries up or the spherical vessel is full (whichever is smaller) = ____________ minutes 44. Modeling Liquid Heights in a Two-Vessel System Consider two tanks in series as shown where the water flow out of the first tank enters the second tank. The first tank is a cubic vessel with a width of 10 ft, a length of 10 ft, and a height of 10 ft, whereas the second tank is a cone-shaped vessel with a radius of 5 ft at the top and a height of 20 ft. The first tank is filled with water at a volumetric flow rate F 1 and is drained through a hole (radius = 1 inch) at the bottom. Studies in fluid mechanics have identified the relation between the volume flow through the bottom hole and the liquid height as: where A is the area of the hole, g is the acceleration due to gravity (32.2 ft/sec 2 ), and C d is an experimentally determined value that depends partly on the type of fluid (for water, C d = 0.6). Initially at t = 0, the cubic tank is filled with 2 ft of water and the cone-shaped tank is filled with 15 ft of water. 1 2 2gz A C F d = 3 3 2 z z R V π π − = 39 (a) Derive an analytical expression of liquid height z 1 of the cubic tank as a function of time. Does z 1 ever reach the steady-state, and if so, what is this value? Based on your analytical answer, also comment on whether z 1 reaches a maximum, reaches a minimum, overflows, or goes to zero and the time for that to happen. In your derivation, you are not allowed to use tables of integrals to perform the integration. Instead, use substitution and be careful with your unit conversions. (b) Derive an ODE that describes the liquid height z 2 in the second tank. Together with the ODE for z 1 in Part (a), use MATLAB (ode45) to solve for z 2 as a function of time and plot both z 1 and z 2 as a function of time. Run the simulation for 20 minutes. Answer the following questions: z 1 (t = 10 minutes) = ____________ ft z 2 (t = 10 minutes) = ____________ ft 45. Modeling Concentrations of Water and Methanol in a Two-Tank System Consider a system of two interconnecting two tanks as shown below, in which pure water flows continuously into Tank 1, while pure methanol flows continuously into Tank 2. The flow rates into and out the two tanks are shown in the figure in terms of kg/min. F 2 F 1 = 15 ft 3 /min z 1 z 2 F 3 = 20 ft 3 /min 40 At t = 0, Tank 1 is filled with 10 kg of pure methanol, while Tank 2 is filled with 100 kg of pure water. We define x 1 as the mass fraction of water in Tank 1 and x 2 as the mass fraction of methanol in Tank 2 at any given time t. (a) Derive analytically an expression for x 2 , the methanol mass fraction in Tank 2, as a function of time. (b) Using the result in Part (a), derive an ODE for x 1 , the water mass fraction in Tank 1, as a function of time. Then use MATLAB (ode45) to solve the ODE by running the simulation from t = 0 to t = 20 minutes (Why do we only run the model up to 20 minutes and not more?). Also, make a plot of x 1 versus time. Answer the following questions: x 2 (t = 10 minutes) = _______________ x 1 (t = 10 minutes) = _____________ Why shouldn’t we run the model in Part (b) beyond 20 minutes? _____________________________________________________________________ 46. Simultaneous Mass and Energy Balance Consider the following heating tank problem. A dilute solution at 20 °C is added to a well- stirred tank at the rate of 180 kg/hr. A heating coil having an area of 0.9 m 2 is located in the tank and contains steam condensing at 150 °C. The heated liquid leaves at 120 kg/hr and at the temperature of the solution in the tank. There is 500 kg of solution at 40 °C in the tank at the start of the operation. The overall heat-transfer coefficient is 342 kcal/hr-m 2 -°C and the heat capacity of water is 1 kcal/kg-°C. Water, 4 kg/min MeOH, 3 kg/min 2 kg/min 6 kg/min x 2 x 1 Tank 1 Tank 2 41 H = 2 m R = 0.5 m F 1 = 8 + 0.2t F 2 = 10 kg/min z 20 °C 180 kg/hr 120 kg/hr T (Temperature) 150 °C 0.9 m 2 (a) Develop a system of mathematical equations to model this system. We are interested in determining the temperature of the solution in the tank at any given time. (b) Solve for the temperature in the tank after 1 hour of heating. An analytical solution is possible for this particular system. (c) Use MATLAB to solve for the temperature in the tank after 1 hour, and compare the answer with the exact solution in Part (b). 47. Mass and Energy Balance in an Open Cone-Shaped Vessel Consider a conical open vessel as shown in the following figure. The vessel has a radius R at the top and a height H. Methanol flows into the vessel at a rate of F 1 (in kg/min) as a function of time, and it flows out at a constant rate of F 2 (also in kg/min). At t = 0, the liquid height is 1 meter. Note that the liquid height will initially go down and then go up, which causes the vessel to eventually overflow. 42 The following data are available on methanol: T B = 64.75 °C µ = 23.4 kmol/m 3 MW = 32.04 kg/kmol C P = 2707.55 J/kg-°C (a) Assuming the vessel is not heated, first derive an analytical expression for z, the liquid height, as a function of time t. Then use the expression to answer the following questions. Do not use MATLAB for this part, although you could use it to verify your analytical answer. Hint: Be very careful in solving the mass balance correctly; otherwise, your energy balance in Part (b) will be wrong. Answer the following question: Time to reach minimum liquid height = ___________ minutes Minimum liquid height = ___________ meters Time at which the vessel overflows = ____________ minutes z Note that the volume of a cone is V = } 0 A C (z)dz, where A C (z) = cone cross-sectional area and is a function of z. (b) Consider the same problem in Part (a) again. This time, the vessel is jacketed with steam condensing at 100 °C and a heat transfer coefficient of U = 30000 J/min-m 2 -°C providing the heat. The initial temperature of the liquid at t = 0 is 30 °C, while the temperature of the inlet flow is maintained at 20 °C. Use MATLAB to determine whether the vessel will overflow first or the temperature of methanol will reach its boiling point T B first. Assuming that the vessel doesn’t overflow, how long does it take for the liquid to reach T B ? Note that the heat transfer area A T should not be treated as constant. z The surface area of a cone A T at any height z = } 0 2πr dz Answer the following questions: Check one: O Vessel overflows first O T of methanol reaches its T B first Time to reach T B = ______________ minutes 48. Energy Balance in a Two-Tank System Consider the following two-tank system in which water in the first tank flows into the second one with a flow rate of F 1 = 2 kg/min and vice versa with a flow rate F 2 = 2 kg/min. Water in both vessels is being heated with a heating coil with the same constant heat transfer area of A = 0.5 m 2 and the same heat transfer coefficient of U = 4 kcal/m 2 -min-°C. 43 However, the temperature of the heating coil in Tank 1 (100 °C) is lower than that of the heating coil in Tank 2 (120 °C). We define M 1 , T 1 , M 2 , and T 2 as the mass and the temperature of water in the first vessel and in the second vessel, respectively. (a) Using the following data about the system, derive two ODEs that describe T 1 and T 2 as a function of time. C P (water) = 1.0 kcal/kg-°C Initially at t = 0: M 1 = 50 kg of water, T 1 = 20 °C, M 2 = 100 kg of water, T 2 = 10°C (b) Solve the two ODEs in Part (a) and derive an analytical expression for T 1 and T 2 as a function of time. (c) What is the domain of this system, i.e. the maximum time the derived model is valid for? Also, determine the time at which the temperatures in Tank 1 and Tank 2 are equal. Answer the following questions: Domain of this system = ____________ minutes T 1 = T 2 = ____________ °C when t = ____________ minutes 49. Mass and Energy Balance in a Stirred Tank Heater Consider the following stirred tank heater shown below, where the tank inlet stream is received from another process unit. A heat transfer fluid is circulated through a jacket to heat the fluid in the tank. Assume that no change of phase occurs in either the tank liquid or the jacket liquid. The following symbols are used: F i = volumetric flowrate of stream i, and T i = temperature of stream i. F 2 M 2 T 2 F 1 M 1 T 1 Tank 1 Tank 2 44 Tank Inlet F 1 T 1 Jacket Inlet F 3 T 3 Jacket Outlet V T Tank Outlet F 4 T 4 Jacket V j F 2 T 2 Additional assumptions are: 1. The liquid levels in both the tank and the jacket are constant. 2. There is perfect mixing in both the tank and the jacket. 3. The rate of heat transfer from the jacket to the tank is governed by the equation Q = UA(T 4 – T 2 ), where U is the overall heat transfer coefficient and A is the area of heat exchange. (a) Write the dynamic modeling equations (ODEs) to find the tank and jacket temperatures. Do not use any numerical values – leave these equations in terms of the process parameters and variables. Be sure to define any new symbols you introduce into the equations. (b) Assume that both the tank fluid and the jacket fluid are water. The steady-state values of this system variables and some parameters are: F 1 = 1.0 ft 3 /min µC P (in tank) = µC P (in jacket) = 61.3 Btu/°F-ft 3 T 1 = 50 °F T 2 = 125 °F V = 10 ft 3 T 3 = 200 °F T 4 = 150 °F V j = 1 ft 3 Solve for F 3 and UA (show units) at steady-state. (c) If initially (t = 0), T 2 = 50 °F and T 4 = 200 °F, solve for T 2 and T 4 from the ODEs in Part (a) analytically as a function of time. 50. Mass and Energy Balance in a Gas Surge Drum Consider a gas surge drum with variable inlet and outlet molar flowrates, q f and q, respectively. Assume that heat is being added to the tank at a rate of Q and ideal gas behavior in the drum. 45 T f , q f , P f q, P, T (a) Write the modeling equations (ODEs) that describe how the temperature, T, and pressure, P, inside the drum vary with time. Note that for a gas, the accumulation term on the left-hand side of the energy equation is dH – d(PV) = energy in – energy out dt dt where dH/dt = d(µC P VT)/dt and C P is assumed constant. For liquids, the d(PV)/dt term is considered negligible (incompressible fluid and constant volume). So do not forget the PV term in your energy balance. (b) Solve the two ODEs in the Part (a) using MATLAB and find the values of P and T after 10 minutes. The data are: V = 100 m 3 R = 8.205x10 -2 m 3 -atm/kmol-K = 8.315 kJ/kmol-K C P (gas) = 125 kJ/kmol-K q f = 1.0 kmol/min T f = 25 °C q = 0.5 kmol/min Q = 1.5x10 4 kJ/min T(t=0) = 298.15 K = 25 °C P(t=0) = 1 atm 51. Mass and Energy Balance in a 2-Tank System Consider the following 2 tanks (both cylindrical vessels) in series used to store a liquid solution. Tank 1 is heated while Tank 2 is not. Liquid is drawn from Tank 1 into Tank 2 at the rate of 10 kg/min. At the same time, a feed (40 °C) enters Tank 2 at the rate of 20 kg/min, and an outflow of 30 kg/min leaves the vessel. Initially (at t = 0), Tank 1 is charged with 300 kg of the solution at a temperature of 20 °C, while Tank 2 is charged with 100 kg at a temperature of 30 °C. 20 kg/min Tank 1 Tank 2 40 °C T 1 T 2 10 kg/min 30 kg/min P, V, T 46 (a) Assuming that Tank 1 is being heated with a heating coil that remains submerged at all times (hence, the heat transfer area remains constant), derive an analytical expression for T 2 , the temperature inside Tank 2 as a function of time. Also, compute T 2 at the time when Tank 1 is completely emptied. Use the following data: C P = liquid heat capacity = 2.0 kJ/kg-°C UA = 40 kJ/min-°C T S = heating coil temperature = 200 °C Assume there is no phase change in either tank (i.e. no boiling occurs). (b) Consider again a similar 2-tank system in which Tank 1 is jacketed and is heated with steam at 200 °C as shown in the figure below. In this case, the heat transfer area is no longer constant and will vary with the liquid volume inside Tank 1. 20 kg/min 40 °C T 1 Steam T 2 10 kg/min 30 kg/min This liquid solution is known to boil at 150 °C. Determine the time it takes for the liquid in Tank 1 to boil off completely (including the time to heat the liquid to the boiling temperature). Use the following data: C P = liquid heat capacity = 2.0 kJ/kg-°C U = overall heat transfer coefficient = 25 kJ/m 2 -min-°C T S = steam temperature = 200 °C | = liquid mass density = 1200 kg/m 3 R = radius of both cylindrical vessels = 0.3 m ì = heat of vaporization at 150 °C = 1500 kJ/kg Use the initial conditions given in Part (a) 52. Boiling of Ethanol in a Cylindrical Vessel Consider the following cylindrical vessel which is initially filled with 100 kg of ethanol at the temperature of 20 °C. The vessel is constantly being heated with a heating coil (assume constant heat transfer area) at T = 100 °C and UA = 10 kJ/min-°C. The heating goes on until ethanol starts to boil at its normal boiling point of 78.55 °C. While the heating is taking place and then later when boiling occurs as well, ethanol also flows out of the vessel at the rate of F 1 . Use the following additional data about ethanol to calculate the time it 47 takes for ethanol to completely disappear from the cylindrical vessel. Also, how much faster does the boiling help in emptying the vessel? MW (molecular weight) = 46.07 ì (heat of vaporization) = 38600 kJ/kmol C P (heat capacity) = 78.28 kJ/kmol-°C Hint: Watch the units and their conversions carefully in your calculations Answer the following question: Time when ethanol disappears completely from the vessel = ____________ minutes Time by which the boiling helps the vessel to empty faster = ____________ minutes 53. Boiling and Draining of Ethanol in a Spherical Vessel Consider the boiling of pure ethanol in a jacketed spherical vessel with a radius R = 1 meter, as shown in the diagram. The liquid is drained at the bottom of the vessel while some of it is boiled and escapes as vapor through the top of the vessel. Steam T S 1 z C V 1 atm v P 0 v when boiling occurs F 1 = 2 kg/min 48 The following data are available: MW = 46.07 ì(T B ) = 3.858x10 7 J/kmol µ = 16.575 kmol/m 3 C P = 1.4682x10 5 J/kmol-°C log 10 P vap = 8.04494 − __1554.30__ T in °C and P vap in mmHg T + 222.65 C V = 4.5 m 3 -atm -1/2 /hr = valve constant T S = 100 °C U = 2.0x10 6 J/hr-m 2 -°C P 0 = 1 atm z 0 = z(t=0) = 1 m (a) Model this operation and use MATLAB to determine the time it takes for the vessel to completely empty, assuming that initially the liquid is at its boiling point. Note that the heat transfer area A T is not constant. (b)Repeat the calculations in Part (a), assuming that there is no draining of the liquid at the bottom (i.e. the liquid leaves the vessel only through boiling). Determine the solution analytically (an exact solution is possible in this case). Useful conversion factors and formulae: g = gravitational constant = 9.807 m/s 2 1 atm = 1.01325x10 5 N/m 2 1 N = 1 kg-m/s 2 The volume of liquid V(z) in a spherical vessel as a function of its height z is given by V(z) = πRz 2 − πz 3 3 while the surface area S(z) is given by S(z) = 4πRz − πz 54. Boiling of Water in a Closed Cylindrical Vessel A closed cylindrical vessel (R = 0.5 m and H =5.0 m) contains 500 kg of water at its boiling temperature of 100 °C (373.15 K) as shown in the figures below. Let’s assume that initially at t = 0, the water (500 kg) is already at 100 °C and starts to boil. Initially, there is also 5 kg of water vapor (or steam) in the gas phase of the vessel. We assume the water vapor is an | | } + − + = + 2 ) ln( b bx a a bx a dx bx a x 49 ideal gas and that the temperature in the gas and liquid phases are always in thermal equilibrium at 100 °C. The following data are also known about water: MW (molecular weight) = 18.015 kg/kmol | (mass density) = 1000 kg/m 3 ì (heat of vaporization) = 2256.84 kJ/kg C P (liquid heat capacity) = 4.1813 kJ/kg-K R (universal gas constant) = 0.08206 atm-m 3 /kmol-K This problem is divided into two parts, namely Part 1 and Part 2. Part 1: In this part, water is being boiled by a heating coil at T S = 200 °C with a constant heat transfer area A = 2.0 m 2 and an overall heat transfer coefficient U = 100 kJ/min-m 2 -°C as shown in the figure for Part 1. (a) Derive an analytical expression of the liquid height z as a function of time. (b) Derive an analytical expression of the water gas pressure P G as a function of time. Plot your analytical solution in MATLAB and run the model until all the water has vaporized. Hint: You may check the correctness of your analytical solution by checking P G at t = 0 and at t when all water has been vaporized. Answer the following questions: How long does it take for water in Part 1 to boil off completely? ____________ minutes What is the gas pressure in Part 1 at the following conditions? (i) P G = ____________ atm after 30 minute Water V L v z P G V G Figure for Part 1 Figure for Part 2 Steam v P G V G V L Water 50 (ii) P G = ____________ atm when water has boiled off completely Part 2: Now, let’s study the same system in which the cylindrical vessel is being heated by steam in a jacketed chamber as shown in the figure for Part 2. In this case, the heat transfer area decreases with the liquid height and is no longer constant. The heating now comes from the surrounding wall and the bottom of the vessel. We assume U and T S to be the same as in Part 1. (a) Derive an analytical expression of liquid volume V L as a function of time. (b) Derive a single ODE for the gas pressure P G using the analytical expression in Part 2(a). Then use MATLAB (ode45) to solve the ODE for P G from t = 0 to t when all liquid is gone, and make a plot of the P G profile. Note that the final value of P G when the vessel contains only gas in Part 2(b) should be equal to that in Part 1(b). Answer the following questions: How long does it take for water in Part 2 to boil off completely? ____________ minutes What is the gas pressure in Part 2 at the following conditions? (i) P G = ____________ atm after 30 minutes (ii) P G = ____________ atm when water has boiled off completely 55. Boiling of Acetone in a Cylindrical and a Spherical Vessels in Series Consider the boiling of pure acetone in a jacketed cylindrical vessel and a jacketed spherical vessel in series, as shown in the diagram. The cylinder has a radius of R 1 = 1.0 m and a height of H = 1.5 m, while the sphere has a radius of R 2 = 1.0 m. In addition to the liquid already in the vessel, pure acetone at its boiling point is added continuously at a rate F 1 = 15 m 3 /hr. The cylinder also has a hole at the bottom, which allows acetone to flow out and into the sphere according to the relation F 2 = C d A(2gz 1 ) 1/2 (in m 3 /hr) where A is the area of the hole, g is the acceleration due to gravity, and C d is an experimentally determined value. 51 F 1 = 15 m 3 /hr at 56.0 °C Steam at T S1 H z 1 F 2 Steam at T S2 z 2 The following data are available: MW = 58.08 µ = 13.62 kmol/m 3 ì(T B ) = 3.02x10 7 J/kmol T B = 56.0 °C C P = 1.30735x10 5 J/kmol-°C U = 3.0x10 6 J/hr-m 2 -°C (for both vessels) T S1 = 150 °C T S2 = 100 °C C d = 0.5 g = gravitational constant = 1.271x10 8 m/hr 2 r = hole radius = 0.01 m z 1 (t=0) = 0.5 m z 2 (t=0) = 1.5 m (a) Model this operation and determine the time in hours (correct to 2 decimal places) at which the cylindrical vessel will either empty completely or overflow. Assume that the liquid in both vessels is already at its boiling point at t = 0. (b) Determine the time in hours (correct to 2 decimal places) at which the liquid height z 1 in the cylinder is equal to the liquid height z 2 in the sphere. v 1 R 2 v 2 52 56. Semi-Batch Reactor with a Single 1 st -Order Reaction Consider the case where a batch reactor is being filled. Assume a single, first-order reaction (A ÷ B) and a sinusoidal volumetric flowrate into the reactor F = 4.0 + 2sin(10t) with no flow out of the reactor. F C AF A B If C AF (feed concentration) = 5 mol/m 3 , k = 1 hr –1 , with V = 2.0 m 3 and C A = 0 at t = 0, simulate the concentration of A as a function of time using MATLAB. Run the model for 10 hours and plot the concentration profile. 57. Batch Reactor with a Series Reaction Consider the series reaction: k 1 k 2 k 3 A ÷ B ÷ C ÷ D (a) Assuming that each of the reactions is first-order and constant volume, write down the modeling equations for C A , C B , and C C , where C A , C B , and C C represent the concentrations (mol/volume) of components A, B, and C, respectively. (b) Derive a third-order ODE for the concentration of C. That is, your ODE should look like f( d 3 C C , d 2 C C , dC C , C C , k 1 , k 2 , k 3 ) = 0 dt 3 dt 2 dt (c) If k 1 = 1 hr –1 , k 2 = 2 hr –1 , k 3 = 3 hr –1 , and C A0 = C A (t=0) = 1 mol/liter, solve the ODE in Part (b) analytically for the concentration of C at any given time t. 58. Batch Reactor with a Series Reaction Consider a batch reactor with a series reaction where component A reacts to form component B. Component B can also react reversibly to form component C. The reaction scheme can be characterized by: 53 k 1 k 2f A B C k 2r Here k 2f and k 2r represent the kinetic rate constants for the forward and reverse reactions for the conversion of B to C, while k 1 represents the rate constant for the conversion of A to B. (a) Assuming that each of the reactions is first-order and constant volume, write down the 3 modeling equations for C A , C B , and C C , where C A , C B , and C C represent the concentrations (mol/volume) of components A, B, and C, respectively. (b)Using the following definitions: Dimensionless time, t = k 1 t Conversion of A, x 1 = (C A0 – C A ) / C A0 Dimensionless concentration of B, x 2 = C B / C A0 Ratio of rate constants, α = k 2f / k 1 Ratio of forward and reverse rate constants, β = k 2r / k 1 Derive a second-order ODE for the dimensionless concentration of B. Your ODE must contain only dimensionless quantities (x 2 , t, α, and β). (c) Solve the ODE in Part (b) analytically to find x 2 as a function of t, α, and β. (d) Using the following data: k 1 = 1.0 min -1 k 2f = 1.5 min -1 k 2r = 2.0 min -1 C A0 = C A (t = 0) = 3.0 mol/liter C B0 = C B (t=0) = 0 mol/liter C C0 = C C (t=0) = 0 mol/liter Solve for C B analytically as a function of time. (e) Given the data in Part (d), find the maximum concentration of B and the reaction time at this concentration. If no such maximum exists, prove it mathematically. Repeat the above calculations for the case of k 1 = 3 min -1 , k 2f = 1.5 min -1 , k 2r = 1 min -1 while the initial conditions remain the same. (f) Validate your analytical solutions by solving the differential equations in Part (a) with MATLAB and plot the time profiles of components A, B, and C. Use both sets of rate constants (i.e. k 1 = 1.0 min -1 , k 2f = 1.5 min -1 , k 2r = 2.0 min -1 and k 1 = 3.0 min -1 , k 2f = 1.5 min -1 , k 2r = 1.0 min -1 ). 59. Modeling an Isothermal Serial Reaction Consider an isothermal batch reactor with the following two reactions in series: 54 k 1 k 3 A B C k 2 k 4 Both reactions are reversible. The forward reaction in the first reaction is zero-order while the remaining three reactions follow the stoichiometry. That is, (a) Derive a second-order ODE of C B as a function of time. Note that your final ODE for C B must be expressed in terms of k 1 , k 2 , k 3 , and k 4 . (b) Given that k 1 = 4.0 gmol/liter-hr, k 2 = 2.0 hr -1 , k 3 = 1.0 hr -1 , k 4 = 2.0 hr -1 , and C B (t = 0) = C C (t = 0) = 0, solve for an analytical expression of C B as a function of time. Does C B go through a maximum or minimum? If yes, determine the time at which this maximum/minimum occurs. (c) Given that C A (t = 0) = C A0 = 5 gmol/liter, derive an analytical expression for C A and C C as a function of time. Answer the following questions: C A (t = 1 hr) = _______________ gmol/liter C B (t = 1 hr) = _______________ gmol/liter C C (t = 1 hr) = _______________ gmol/liter Does C B go through a maximum or minimum? Yes _____ No _____ If yes, the time at which the maximum/minimum occurs = ____________ hour 60. Isothermal Semi-Batch Reactor (a) Consider an isothermal semi-batch reactor where a single reaction takes place in a solvent S, which is inert. In this reaction, 2 moles of component A react with one C B C C B B B B A C k C k dt dC C k C k C k k dt dC C k k dt dC 4 3 4 3 2 1 2 1 − = + − − = + − = 55 k 1 mole of component B to form one mole of component C: 2A + B -----> C. The reaction rate does not conform to the stoichiometry but is 1 st -order with respect to each reactant as follows: r A = −k 1 C A C B F A = 15 liter/min F B = 10 liter/min Initially (t = 0 min), the reactor contains 100 liters of solution and 300 moles of A. Assuming that all components have the same density of 60 mol/liter, derive 3 ODE equations needed to compute C A , C B , and C C , the concentrations (moles/liter) of A, B, and C, respectively. Use ode45 in MATLAB to solve for and plot (in a single graph) the concentrations of the 3 components. Run the model for 20 minutes with an increment of 0.5 minute. The following experimental data have been obtained for this reaction when carried out in a batch reactor: Time(minute) 0 5.0 7.5 12.0 15.5 25.0 32.0 40.0 C A (mol/liter) 2.0 1.65 1.52 1.40 1.28 1.17 1.10 1.06 C B (mol/liter) 0.5 (b) At the end of 20 minutes, the 2 feeds to the reactor are suddenly shut off, and 4,500 moles of a new component called D (same density as components A, B, and C) are charged to the reactor. That is, the reactor now operates in a batch mode. Component D reacts with component C to form A and B, and the reaction now looks as follows: k 1 2A + B C + D k 2 with a reaction rate of r A = −k 1 C A C B + k 2 C D (2 nd -order forward and 1 st -order reverse). The value of k 2 has been measured to be 1.0 min -1 . Derive analytically the concentration of A as a function of time, and compute C A at steady state based on your derived equation. Your final expression should be simplified as much as possible and should not contain any parameters except t (time) and C A . 56 Useful Integrals: where B = a + bx + cx 2 γ = 4ac – b 2 ω = b + 2cx 61. Determination of Reaction Kinetics (a) The following laboratory data were obtained for the irreversible reaction under isothermal constant-volume conditions: 2A÷B + C Time (min) 0 3.2 5.0 9.6 12.5 18.4 25.0 [A] (mol/liter) 0.1345 0.0772 0.0602 0.0352 0.0261 0.0168 0.0110 Determine the kinetics to explain these data (i.e. find the order of the reaction and its rate constant). (b) The following laboratory data were obtained for the irreversible reaction under isothermal constant-volume conditions: A + B ÷ C + D Time (sec) 0 2790 7690 9690 14000 19100 [A] (mol/liter) 0.1908 0.1833 0.1745 0.1719 0.1682 0.1650 } | ¹ | \ | + | ¹ | \ | − = + x bx a a bx a x dx ln 1 ) ( 0 tanh 2 0 2 0 tan 2 1 1 < | | ¹ | \ | − − − = − = > | | ¹ | \ | + − − } γ γ ω γ γ ω γ γ ω γ if if B dx if 57 [B] (mol/liter) 0.0313 0.0238 0.0150 0.0123 0.0086 0.0055 Determine the kinetics to explain these data. 62. Isothermal Batch Reactor with a Series Reaction Consider an isothermal batch reactor with a series reaction where 2 moles of component A react to form one mole of component B. Component B also reacts to form component C. The reaction scheme can be characterized as follows: k 1 k 2 2A B C Initially (t = 0 hr), C A = C A0 , C B = 0, and C C = 0, where C A , C B , and C C represent the concentrations (mol/liter) of components A, B, and C, respectively. (a) Assume constant volume and that the first reaction 2A ÷ B is one-half order and the second reaction B ÷ C is first-order, i.e. dC A /dt = −k 1 C A 1/2 dC B /dt = k 1 C A 1/2 − k 2 C B 2 Derive an analytical expression for C B as a function of time. (b) The following experimental data were obtained for component C A : Time(hr) 0 0.05 0.15 0.35 0.60 0.85 1.0 C A (mol/liter) 1.0 0.93 0.79 0.54 0.30 0.13 0.06 C B was also measured to be 0.11 mol/liter at t = 1 hr. Determine the values of k 1 and k 2 and the time t max at which C B is at its maximum. Hint: Use Polyfit function in MATLAB to help determine k 1 and k 2 . (c) Now, suppose the order of the above series reaction conforms to the stoichiometry, derive analytically a 1 st -order ODE for C B , i.e. dC B /dt + p(t)C B = q(t) but do not solve this ODE. 58 (d) When the reaction order conforms to the stoichiometry, the following experimental data were obtained for C A : Time(hr) 0 0.03 0.06 0.10 0.15 0.20 0.30 C A (mol/liter) 1.0 0.76 0.63 0.51 0.39 0.33 0.25 It was also observed that C B reached a maximum of 0.14 mol/liter at t = 0.1 hr. Determine the values of k 1 and k 2 . 63. Maximizing Product Yield in an Isothermal Batch Reactor Consider an isothermal batch reactor with the following series of two reactions: k 1 k 2 A B C Chemical B is the desirable product. The two reactions do not follow the stoichiometry. Instead, the first reaction is one-half th -order while the second reaction is first-order with respect to the reactant, i.e. dC A = −k 1 C A 1/2 dt dC B = k 1 C A 1/2 − k 2 C B dt (a) Given that at t = 0, C A = C A0 and C B = 0, derive analytically an expression of C B as a function of time. Note that your final equation for C B must be expressed in terms of C A0 , k 1 , and k 2 . (b) It is obvious that the concentration of product B will go through a maximum. Determine the time at which the concentration of B is at the maximum if C A0 = 1.0 kmol/liter, k 1 = 1.5 kmol 1/2 /liter 1/2 -hour, and k 2 = 2.0 hour -1 . Also, calculate this maximum concentration. Answer the following questions: t max = __________________ hour C B,max = ________________ kmol/liter 64. Modeling an Isothermal Reversible Reaction and Determining Rate Constants Consider an isothermal batch reactor with the following reversible reaction: 59 k 1 A B k 2 The reversible reaction does not follow the stoichiometry. Instead, the forward reaction is zero th -order while the backward reaction is second-order with respect to the reactant, i.e. (a) Given that at t = 0, C A = C A0 and C B = C B0 , derive analytically an expression of C B as a function of time. Note that your final equation for C B must be expressed in terms of C B0 , k 1 , and k 2 . (b) Based on the result in Part (a), derive now an analytical expression of C A as a function of time. Again, your final equation for C A must be expressed in terms of C A0 , C B0 , k 1 , and k 2 . (c) The following data are available from experiments: -------------------------------------------------------------------------------- t (hour) 0 0.05 0.15 0.30 0.40 0.55 0.70 -------------------------------------------------------------------------------- C B (mol/liter) 6.0 4.40 3.10 2.36 2.20 2.08 2.03 C A (mol/liter) 6.0 -------------------------------------------------------------------------------- Also, it was observed that at steady-state, C B = 2.0 mol/lier. Determine the values of the two rate constants k 1 and k 2 . Answer the following questions: k 1 = ______________ mol/hr k 2 = _____________ liter 2 /mol-hr 65. Modeling Three Reactions in Series Consider the following three reactions in series: k 1 k 2 k 3 A B C D 2 2 1 2 2 1 B B B A C k k dt dC C k k dt dC − = + − = 60 The orders of the three reactions do not follow the stoichiometry but instead can be described by the following modeling equations: (a) Derive an exact (analytical) expression of C B as a function of time. Note that your final equation for C B must be expressed in terms of k 1 , k 2 , C A0 , and C B0 , and that C B0 is not necessarily equal to zero. (b) Also derive an exact (analytical) expression of C D as a function of time in terms of k 2 , k 3 , C C0 , and C D0 . Note that C C0 and C D0 are not necessarily equal to zero. (c) Component B is the desired product whose concentration should be maximized. Given that k 1 = 0.5 liter 1/2 /gmol 1/2 -hr, k 2 = 2.0 gmol/liter-hr, and C A0 = 10 gmol/liter, and C B0 = 3.0 gmol/liter, determine the maximum C B and the time at which this maximum occurs. (d) Given that C C0 = 1.0 gmol/liter, C D0 = 0, and k 3 = 1.0 hr -1 , compute the concentration of A, B, C, and D after 1 hour. What is the domain of this modeling problem, i.e. how long should the reactions be simulated? Why? Answer the following questions: C A (t = 1 hr) = _______________ gmol/liter C B (t = 1 hr) = _______________ gmol/liter C C (t = 1 hr) = _______________ gmol/liter C D (t = 1 hr) = _______________ gmol/liter C B, max = ______________ gmol/liter t max = _______________ hours Domain of this modeling = ____________ hours Reason: __________________________________________________________________ _________________________________________________________________________ 66. Batch Distillation, I A liquid mixture containing 70.0 mole% n-pentane and 30.0 mole% n-hexane is distilled in a batch still, and is initially charged with 100 gmoles of the mixture. C D C C A B A A C k dt dC C k k dt dC k C k dt dC C k dt dC 3 3 2 2 2 / 3 1 2 / 3 1 = − = − = − = 61 V (gmoles/sec) y i x i L (gmoles) (a) The equilibrium relationship between the mole fraction x of n-pentane in the liquid and that in the vapor y is of the form y C5 = x C5 a + b 1+ x 2 C5 Note that this equation is only valid for n-pentane, and not necessarily for n-hexane. Assuming ideal gas and ideal liquid and given For n-pentane, log 10 P VAP = 6.85221 − __1064.630__ T + 232.00 P VAP in mmHG For n-hexane, log 10 P VAP = 6.87776 − __1171.53_ T in °C T + 224.366 Calculate the mole fraction of pentane in the vapor phase in equilibrium with the 70 mole% pentane-30 mole% hexane mixture at the initial system temperature of 46 °C. Also, calculate the coefficients a and b in the n-pentane x-y relationship. (b) At any given instant, the vapor leaving the still may be considered to be in equilibrium with the remaining liquid. Assuming that the values of a and b do not change with time and that vapor and liquid phases are constantly in equilibrium with each other, derive an analytical equation relating L, the amount of liquid left in the still, to x, the mole fraction of n-pentane in this liquid, i.e. L = function(x C5 ) 67. Batch Distillation, II A liquid mixture containing 60.0 mole% n-pentane and 40.0 mole% n-hexane is to be distilled in a batch still, and is initially charged with 100 gmoles of the mixture. The 62 equilibrium relationship between the mole fraction x of n-pentane in the liquid and that in the vapor y has been correlated to the following equation: y = 1.8804 x – 0.8804 x 2 Note that this equation is only valid for n-pentane, and not necessarily for n-hexane. V (gmol/min) y i x i L (gmoles) (a) Calculate the system temperature at which the above equilibrium relationship was established for the given liquid mixture (i.e. determine T in °C at which the above equation is valid). Also, compute the total system pressure P at the system temperature. Assume ideal gas and ideal liquid, and the vapor pressures of the two components are: For n-pentane, log 10 P VAP = 6.85221 − __1064.630__ T + 232.00 P VAP in mmHG For n-hexane, log 10 P VAP = 6.87776 − __1171.53_ T in °C T + 224.366 (b) Derive an analytical expression relating the amount of liquid left in the batch still L as a function of x (mole fraction of n-pentane in the still) and compute the value of x after 90% of liquid has been vaporized. 68. Semi-Batch Distillation Benzene and ethanol form an azeotrope. The experimental x-y data of this binary system at 45°C was reported by I. Brown and F. Smith, Austral. J. Chem. 7, 264 (1954) as follows: 63 x ethanol y ethanol x ethanol y ethanol 0 0 0.5284 0.4101 0.0374 0.1965 0.6155 0.4343 0.0972 0.2895 0.7087 0.4751 0.2183 0.3370 0.8102 0.5456 0.3141 0.3625 0.9193 0.7078 0.4150 0.3842 0.9591 0.8201 0.5199 0.4065 1.00 1.00 (a) Use the Polyfit function in MATLAB to fit the above data to a 5 th -degree polynomial in the form of y = ax 5 + bx 4 + cx 3 + dx 2 + ex + f and make a plot showing the 45°-line, the experimental data (without joining them), and the polynomial curve. (b) The benzene-ethanol system is distilled in a batch still as shown, which is initially charged with 100 gmoles of the mixture. A feed F 1 (in gmol/min) containing a mixture of benzene and ethanol (whose composition is different from that initially charged) is then continuously fed into the batch and is controlled such that F 1 = 2[1 − exp(-t)] On the other hand, the heating of the batch still is controlled in such a way that it slowly increases linearly as a function of time, and can be correlated to the rate of boiling V as follows: V = 4 + 0.1t F 1 V (gmol/min) y i x i L (gmoles) 64 Determine the time it takes to completely boil off the liquid inside the still. (c) It has been observed that it takes exactly 20 minutes to distill the mixture to reach the azeotrope. If the continuous feed F 1 is a mixture with 50 mole% ethanol and 50 mole% benzene, use MATLAB to determine the mole% of ethanol in the initial 100-gmole charge. 69. Batch Distillation of a Water/Acetic-Acid System The following vapor-liquid equilibrium data (mole fractions) are available for the water/acetic-acid binary system at 25 °C. x water y water x water y water 0 0 0.6 0.6993 0.1 0.2329 0.7 0.7770 0.2 0.3558 0.8 0.8530 0.3 0.4517 0.9 0.9274 0.4 0.5379 1.0 1.0 0.5 0.6198 First, we will use the Polyfit function in MATLAB to fit the above data to a quadratic polynomial in the form of y = ax 2 + bx + c The water-acid system is distilled in a batch still as shown, which is initially charged with 100 gmoles of the mixture. The heating of the batch still is controlled such that it vaporizes 5 gmoles of the liquid every minute. V (gmol/min) y i x i L (gmoles) 65 It has also been observed that it takes exactly 10 minutes to distill the mixture to reach 50 mole% water in the liquid. Without using the ode solver in MATLAB (although you may use it to verify your answer), compute analytically the initial composition of the liquid mixture. Answer the following question: Initial mole fraction of water in the liquid mixture = _______________
Copyright © 2024 DOKUMEN.SITE Inc.