0% found this document useful (0 votes)
269 views64 pages

MATLAB Exercises for Chemical Engineering

This document provides 9 practice problems for using MATLAB to model chemical processes and solve systems of equations. The problems cover topics such as solving linear and nonlinear algebraic equations, material balances in separation processes, and using the Peng-Robinson equation of state. The document was prepared by Dr. Hong-ming Ku for chemical engineering students at King Mongkut's University of Technology Thonburi.

Uploaded by

amanda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
269 views64 pages

MATLAB Exercises for Chemical Engineering

This document provides 9 practice problems for using MATLAB to model chemical processes and solve systems of equations. The problems cover topics such as solving linear and nonlinear algebraic equations, material balances in separation processes, and using the Peng-Robinson equation of state. The document was prepared by Dr. Hong-ming Ku for chemical engineering students at King Mongkut's University of Technology Thonburi.

Uploaded by

amanda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CHE656

Modeling Chemical Processes

Using MATLAB

Exercise Problems
7th Edition

Prepared by

Dr. Hong-ming Ku

King Mongkuts University of Technology Thonburi


Chemical Engineering Department
Chemical Engineering Practice School

2003- 2013 Use with Permission of the Author Only

1
1. System of Linear Algebraic Equations, I
Use MATLAB to solve the following system of linear algebraic equations, correct to 4
decimal places:

x1 + 2x2 + x3 + x5 1 = 0
2x1 4x2 x3 + x4 + x5 + 2 = 0
2x2 + 4x3 + x4 6x5 + 6 = 0
3x1 + x4 2x5 4 = 0
x1 + x2 + x3 + 3x4 + 8x5 = 0

2. System of Linear Algebraic Equations, II


Use MATLAB to solve the following system of linear algebraic equations, correct to 4
decimal places:

x1 + 3x2 + 2x3 x5 + 4x6 = 2


2x1 2x2 + 4x3 + x4 + x5 = 1
3x1 2x2 + 4x3 + 5x4 + 2x5 x6 = 0
x2 + 2x4 + 6x5 + 4x6 = 3
2x1 + 3x4 + 4x5 + 5x6 = 6
6x1 2x2 x3 3x4 + 4x5 + 2x6 =5

3. System of Nonlinear Algebraic Equations


Use MATLAB to solve the following system of nonlinear algebraic equations:

exp(2x1) x2 4 = 0
x2 x32 1 = 0
x3 sin(x1) = 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.

Cv,1 = 0.4 ft3/(psia)1/2-hr Cv,2 = 0.3 ft3/(psia)1/2-hr


Cv,3 = 0.2 ft3/(psia)1/2-hr Cv,4 = 0.1 ft3/(psia)1/2-hr

2
1
P = 40 psia Cv,1
Pump
Cv,2 Cv,3

P = 14.7 psia Cv,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 = log10(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 = log10(A) C = 8 12 24 7
6 10 4 0 -1 5 6
3 8

3
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 22 and 33 Matrices


Use MATLAB to write a program that can determine the inverse and determinants of any
22 and 33 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 22 and 33 matrices are as
follows:

a a12 a
11 a12
A= det( A) = a11a 22 a12 a 21 1 1 22
If then A =
a 21 a 22 det( A) a
21 a11

a a12 a13
11

If A = a 21 a 22 a 23 then det( A) = a11 (a33 a 22 a32 a 23 ) a 21 (a33 a12 a32 a13 )

a a32 a33 + a31 (a 23 a12 a 22 a13 )
31

a a a a a32 a13 a 33 a12 a 23 a12 a 22 a13


33 22 32 23

1
and A 1 = a31 a 23 a33 a 21 a33 a11 a 31a13 a 21 a13 a 23 a11
det( A)
a a a a a31a12 a32 a11 a 22 a11 a 21 a12
32 21 31 22

Use the above formulae to solve the following two systems of linear algebraic equations:

(a) 2 x1 3x 2 = 6 x1 + 2 x 2 = 1

(b) x1 + 2 x 2 6 x3 = 2 5 x1 + 3x 2 + x3 = 0 4 x1 x 2 2 x3 = 3

4
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
D1 4% Styrene
54% Toluene
35% Benzene

18% Xylene
24% Styrene
15% Xylene B1 42% Toluene
25% Styrene 16% Benzene
40% Toluene D2
20% Benzene 15% Xylene
10% Styrene
FT = 70 kgmol/min 54% Toluene
B 21% Benzene

24% Xylene
B2 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:

RT a
P= 2
Vm b Vm + 2bVm b 2

where R 2TC2
a = 0.45724

PC

RT
b = 0.07780 C
PC

5
= [1 + (0.37464 + 1.54226 0.26992 2 )(1 Tr0.5 )]2

T
Tr =
TC
P VAP (Tr = 0.7)
= 1.0 log10
PC

The variables are defined by:

P = pressure in MPa
Vm = molar volume in cm3/gmole
T = temperature in K
R = gas constant (8.314 cm3-MPa/gmole-K)
TC = the critical temperature (150.86 K for argon)
PC = the critical pressure (4.898 MPa for argon)
PVAP = vapor pressure (0.4946 MPa at Tr = 0.7 for argon)

Alternatively, this equation of state can be expressed in polynomial forms as given below:

aP
A=
R 2T 2

bP
B=
RT

Z 3 + ( B 1) Z 2 + ( A 2 B 3B 2 ) Z + ( AB + B 2 + B 3 ) = 0

PVm
where Z = , the compressibility factor
RT

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
phases between solid, liquid, and gas. One such problem is to determine the change in

6
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 (Vg Vf ) 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 Vg and Vf 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, Vg, and Vf also can be obtained directly from the steam table
data. In this case, 100C corresponds to T = 373.15 K, while Vg = 1.673 m3/kg, and Vf =
0.00104 m3/kg. The objective here is to estimate the heat of vaporization h (in kJ/kg) at
100C.

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 = 120C.

7
d

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:
RT a
P=
V b V (V + b) T

where for propane, a = 182.23 bar-m6-K5/kmol2 and b = 0.06242 m3/kmol

8
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


The data consist of undergraduate GPAs of 21 students from
ChEPS Class-11 and their ChEPS GPAs upon graduation. We
3.58 3.97 like to find out if there is a strong correlation between these two
3.33 3.71 set of data. You are asked to carry out a number of statistical
3.28 3.57 analyses using MATLABs matrix functionality. You must first
3.27 3.54 create a 212 matrix that contain the data given in the table.
From that matrix, do the following:
3.15 3.61
3.33 3.75 1. Compute the maximum, minimum, mean, and median of
2.97 3.72 the students undergraduate GPAs and ChEPS GPAs.
3.09 3.42 2. Compute the standard deviations of undergraduate
GPAs and ChEPS GPAs using the following formula:
3.22 4.00
2.89 3.66
1 N
3.05 3.89 s=
N 1 i =1
( xi ) 2
2.90 3.28
where N = total data size and = mean of the data. Do
3.10 3.71 not use the built-in function in MATLAB to compute
3.01 3.64 this number.
3.31 3.64
3. Compute the Pearsons correlation coefficient r, which
3.45 3.64
indicates the correlation between undergraduate GPA
3.22 3.64 and ChEPS GPA, as given by the formula below:
3.19 3.61
3.14 3.78 N ( xy ) ( x y )
r=
3.16
3.45
3.64
3.85 [N ( x ) ( x) ] [N ( y ) ( y ) ]
2 2 2 2

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.

9
Maximum Minimum Mean Median STDEV
------------- ------------- --------- ----------- ---------
Underg GPA [Link] [Link] [Link] [Link] [Link]
ChEPS GPA [Link] [Link] [Link] [Link] [Link]

Pearson correlation coefficient r = [Link]

Maximum Minimum Mean Median STDEV

Underg GPA ________ ________ ________ ________ ________

ChEPS GPA ________ ________ ________ ________ ________

Pearsons correlation coefficient r = ____________

13. Using MATLAB to Solve Simple ChE Problems, I


Use MATLAB to determine the stoichiometric ratios of molecular species in the following
reaction:

C6H12O6 + NH3 + O2 C5H9NO2 + CO2 + H2O

= __________ = __________ = __________ = _________

14. Using MATLAB to Solve Simple ChE Problems, II


It is proposed that a steel tank be used to store carbon dioxide at 300 K. The tank is 2.5 m3
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 CO2 that can be stored in the tank

P = RT + + +
V V2 V3 V4

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 B0 A0 R c
T2

= R T B0 b A0 a R c B0
T2

10
= R T B0 b c
T2

For CO2, A0 = 5.0065, a = 0.07132, B0 = 0.10476, b = 0.07235, and c = 66.0104

Note that 1 m3 = 1000 L and 1 kg-mole = 1000 gmoles

15. 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 r3 and the area of a sphere is 4r2.

16. pH of Natural Rain Water


CO2 is a trace yet important constituent of the atmosphere that keeps the earth warm enough
for life in their current forms. The concentration of CO2 before the industrial revolution has
been relatively constant over a long period. CO2 is slightly water soluble, which makes the
natural rain in a clean atmosphere slightly acidic due to the dissolution of CO2 into the cloud
droplets. The partitioning of CO2 into a droplet can be described by the following
equilibrium relations:

11
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 = log10[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 CO2/H2O system (and thus the pH) can be determined
using the following equation:

where pCO2 is the partial pressure of CO2 in the atmosphere (in units of atm); KH,CO2,
Ka1,CO2, Ka2,CO2 are Henrys law constant (in units of M/atm), and first and second acid
dissociation constants for CO2, respectively, and Kw is the water dissociation constant
(which varies with temperature). For a given value of the partial pressure of CO2, the
concentration of H+ and thus the pH can be determined.

(a) Given that Kw = 1.810-14 (when T = 30C) KH,CO2 = 10-1.46, Ka1,CO2 = 10-6.3, Ka2,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:
f ( xk )
xk +1 = x k k = 1, 2, 3, ...
f ( x k )

Write a MATLAB program to generate a plot of CO2 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 CO2 partial pressures between the range
of 280 ppm and 420 ppm using an increment of 20 ppm (use a FOR loop). At pCO2 =
280 ppm, use an initial guess of [H+] = 5.010-6 to solve Equation (1). For subsequent
pCO2s, use the answer from the previous increment as the initial guess, e.g. use the
[H+] solution from the case where pCO2 = 280 ppm as a starting point for the case
where pCO2 = 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 (pCO2 = 280 ppm) = ____________

pH (pCO2 = 360 ppm) = ____________ pH (pCO2 = 420 ppm) = ____________

12
17. Solving a System of ODEs Using MATLAB
Solve the following set of 1st-order ODEs, which is an initial-value problem, using
MATLABs ode45 function from x = 0 to x = 2 with an increment of 0.1:

dy1
= y2 + x
dx
dy 2
= y1 + 1 subject to: y1(0) = y2(0) = 0
dx

Make a plot of the 2 equations (y1 and y2 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.
y1(x) = c1ex + c2e-x 2
y2(x) = c1ex c2e-x x

18. Solving ODEs with MATLAB


(a) Solve the following 1st-order ODE using MATLABs ode45 function from x = 0 to x = 2
with an increment of 0.1.

dy 2 x
= xy y(0) = 1
dx y

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(-x2)]1/2

and report the relative % differences. Include 6 decimal places in reporting all your
numbers.

(b) Solve the following 2nd-order ODE, which is an initial-value problem, using
MATLABs ode45 function from x = 1 to x = 3 with an increment of 0.1:

y + xy = x3 4/x3

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 = x2
2/x by reporting the relative % differences. Include 6 decimal places in reporting all
your numbers.

13
19. The Shooting Method to Solve a Linear ODE
Solve the following 2nd-order linear ODEs, which is a boundary-value problem, using
MATLABs 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.

20. Solving a 3rd-Order Boundary-Value ODE Using the Shooting Method


Consider the following 3rd-order ODE which is a boundary-value problem (t = 0 to 2):

d3y dy
3
+ 10 5 y 3 = t 3 t y
dt dt
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 2nd-Order ODE Boundary-Value Problem


Consider the following 2nd-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) = ______________

14
22. Solving a 3rd-Order ODE Boundary-Value Problem
Consider the following 3rd-order ODE which is a boundary-value problem

y = ty + (t 3 2t 2 5t 3)e t 0 t 1, s.t. y (0) = 0, y (1) = 0, y (1) = e1

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).

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 3rd-Order ODE Boundary-Value Problem


Consider the following 3rd-order ODE which is a boundary-value problem:

y l 2 y + a = 0 0 t 1, s.t. y (0) = 0.0894, y (0.5) = 0, y (0.5) = 0.2640

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)

15
y(t=0)MATLAB = __________ y(t=0)EXACT = __________ % Deviation = __________

y(t=1)MATLAB = __________ y(t=1)EXACT = __________ % Deviation = __________

24. Solving a 2nd-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:

d 2C A k
2
= CA
dz D AB

where CA is the concentration of reactant A (kmol/m3), z is the distance variable (m), k is the
homogeneous reaction rate constant (s-1), and DAB is the binary diffusion coefficient (m3/s).
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:

CA(z = 0) = CA0 and dCA (z = L) = 0


dz

where CA0 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:

k
cosh L 1 z

C A = C A0 D AB L
k
cosh L

D
AB

(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 CA0 = 0.2 kmol/m3, k =
0.001 s-1, DAB = 1.2x10-9 m2/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 CA term on the
right side of the ODE to become squared. The second-order rate constant is given by k
= 0.02 m3/(kmole-s). Use format short e and ode23. Is this new ODE linear or
nonlinear?

16
25. Solving a Nonlinear 3rd-Order ODE Boundary-Value Problem
Consider the following nonlinear 3rd-order ODE which is a boundary-value problem:

4 y ( y ) t 3 y + cos( y ) = e 2t
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.

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/100th (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 V1 to V2, 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:

17
P = pressure in bar
V = molar volume in L/gmole
T = temperature in K
R = gas constant (0.08315 bar-L/gmole-K)
TC = critical temperature in K (305.556 K for ethane)
PC = critical pressure in atm (48.2989 bar for ethane)
= Pitzer acentric factor (0.1064 for ethane)

Answers:

(a) Work (ideal gas) = ___________________


_________________ bar-L/gmole

(b) Work (RKS gas) = ___________________ bar-L/gmole


bar

27. Heat Transfer in a Tapered Fin


Consider a tapered fin of trapezoidal profile:

18
The governing equation for the temperature dis
distribution
tribution in the fin is the dimensionless
second-order
order differential equation

where y = dimensionless temperature = (T T ) / (Tw + T )


x = dimensionless distance =

(Tw T )

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.

where h is the average convective heat transfer coefficient.


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 = Tw at u = l.

The physical conditions of the fin are given as follows:

e = 30 cm b = 60 cm l = 300 cm

k = 60 J/sec-cm
cm-C q = 0.016 J/cm3-sec h
h = 0.01 J/cm2-sec-C

T = 20C Tw = 100C

Use ode45 in MATLAB to solve the above ODE numerically and answer the following
questions. Use format short to show all your calculations. Also in your output, plot y and y
versus x. Label your x-axis
axis and y-axis
axis properly and include a legend in your graph as well.
we

Answers: (accurate to 4 decimal places)

y(0)
(0) = _______________ T(u=150
(u=150 cm) = _______________ C

19
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 Maclaurin formula for
the sine function 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:

sin( x)
at x = 2, where x is in radians
x
x 1 + x at x = 0.5

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:

Exact Solution Maclaurin Solution 10 14

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 = __________

20
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:

xk+1 = F(xk) 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:

4 g ( P ) DP
t = = F ( t ) (1-1)
3C D

where vt = the terminal velocity (m/s)


g = gravitational acceleration (= 9.80665 m/s2)
P = the particle density (kg/m3)
DP = the diameter of a spherical particle (m)
CD = dimensionless drag coefficient

The drag coefficient varies with the Reynolds number (Re) as follows:

CD = 24 for Re < 0.1 (1-2)


Re

CD = 24 (1 + 0.14 Re0.7) for 0.1 Re 1000 (1-3)


Re

where Re = vt DP /
= the density of the fluid (kg/ m3)
= the fluid viscosity (Pa-s)

Consider uniform spherical iron pellets with DP = 0.5 mm, P = 7860 kg/ m3 that are falling
in air ( = 1.23 kg/ m3, = 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(vt) and vt versus vt in the range 0.01 vt 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 | vt F(vt) | 0.0001.

21
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 doesnt know what number is in your mind and you dont 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.
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 shouldnt 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.

22
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:
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 = 12
+ 22 + 32 + 42 + 52 + 62 + 72.

23
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 = 12 + 32 + 52 + 72. So is 120 because 120 = 22 + 42 + 62 +
82.

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]

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.

24
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,
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.

25
(2) Ben and Jen will each take turn to play the game, so in your output be sure to print
out whether it is Bens or Jens 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 ( 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

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

26
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

x2 2 kg/min
x1
1+ 0.1t kg/min
Tank 1 Tank 2

(a) If we define x1 and x2 as the mass fraction of salt in Tank 1 and Tank 2, respectively,
derive an analytical expression of x1 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: x1 (t = ____ min) = ___________ when liquid in Tank 1 is at maximum

Useful integration formula:


2
+ tan 1 if > 0

dx 2
B
=

if = 0

2
tanh 1 if < 0

27
where B = a + bx + cx2, = 4ac b2, = b + 2cx

(b) Derive an ODE dx2/dt, and together with dx1/dt in Part (a) use MATLAB to solve for the
numerical solutions of x1 and x2 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 x2 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. x2 (at t = ______ mins) = _________ when x2 goes through a maximum

2. Did x1 and x2 ever become equal? Yes or No: ______

If yes, x1 = x2 (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
rate of gas leakage is proportional to the pressure difference between the two tanks, as given
by

Leak Flow = CV PAVG ( P1 P2 )

where PAVG = average absolute pressure across the valve = (P1 + P2)/2

Valve constant CV = 3.610-4 kmol/kPa-hour.


Tank volumes are 30 m3 and 15 m3.
Assume constant temperature of 293.15 K in both tanks.
Universal gas constant = 8.31439 kPa-m3/kmol-K.

Nitrogen
P2 V2
P1 V1

Leak

28
(a) Derive an analytical expression of dn1/dt as a function of n1, where n1 is the number of
moles of nitrogen in the large tank. This ODE of yours should contain only n1 as the
unknown variable. Use MATLAB to solve for n1 (use ode45 and format short), and
run the model up until t = 25 hours.

Answer: n1 (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 P2 << P1. Derive an analytical expression for n1 as a function
of time t. Calculate n1 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:

n1 (t = 2 hours) = _____________ kmoles % relative error = ___________

n1 (t = 4 hours) = _____________ kmoles % relative error = ___________

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.

29
(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/m3 and the volume of the tank is 1.0 m3, 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.

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

30
(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/m3 and the cross-sectional area of the tank is 0.1 m2, 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 Fmethanol = 20z1/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 F1 and it flows out through
a valve at a rate of F2. The following data are given:

F1

P0

H = 10 ft Water z

P1 Cv
P2
R = 3 ft
F2

P0 = P2 = 14.7 psia
Cv = characteristic valve constant = 3.0 ft3/psia1/2-min
= water mass density = 62.4 lbm/ft3
z0 = initial liquid height = z(t = 0) = 5 ft

F1 is not constant but is controlled such that it varies with the liquid height according to:

F1 = 2z1/2 ft3/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

31
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 F1 and flows out at a rate of F2.

P0 Air

Water Z
P1 F1
P2 F2
CL

Initially, the air is at 25C and 1.01325x105 Pa (Pascal), and the liquid height is 5.0 meter.
The following data are available:

Gravitational acceleration g = 9.80665 m/s2


Air CV (heat capacity at constant volume) = 2.0731x104 J/kmolC
Vessel volume =10.0 m3 Vessel cross-sectional area = 1.0 m2
Water density = 1000 kg/m3 Gas constant R = 8314 m3Pa/kmolK
= 8314 J/kmolK
Air MW = 29.0 kg/kmol Valve constant CL = 0.001 m3/Pa1/2min
Outlet flow rate F2 = 0.1 m3/min Source pressure P1 = 3.0x105 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 F0(t). Assume that the flow out of each tank is a
linear function of the height of liquid in the tank (i.e. F1 = 1 h1 and F2 = 2 h2) and each
tank has a constant cross-sectional area.

32
F0

F1
h1 1

h2 2
F2

(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 h1 and h2 analytically if

A1 = 10 ft2 A2 = 20 ft2 F0 = 2 ft3/hr


1 = 2 = 1 ft2/hr where Ai is the cross-sectional area of tank i

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 F0 is no longer constant but equals to 2t + 1 ft3/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 tanks radius is R, one can

use integration to show that the volume of water in the tank as a function of its height h is
given by:
V(h) = Rh2 h3
3
Studies in fluid mechanics have identified the relation between the volume flow through
the bottom hole and the liquid height as:

33
F = C d A 2 gh

where A is the area of the hole, g is the acceleration due to gravity (32.2 ft/sec2), and Cd is
an experimentally determined value that depends partly on the type of fluid (for water, Cd =
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 R1 = 1 m, a height H1 = 4 m, and the
second tank is a cone-shaped vessel with a radius R2 = 1 m, a height H2 = 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), z1 and z2, in the 2 tanks change with time.

F1

R1 = 1 m

P0
H1 = 4 m
Z1
Water CV P2 F2
P1

H2 = 5 m z2

F3
R2 = 1 m

(a) Given the following data on the cylindrical vessel, derive an analytical expression of z1(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?).

34
F1 = 1.0 m3/min P0 = P2 = 1 atm
water = 1000 kg/m3 g = gravitational constant = 9.80665 m/s2
CV = 0.001 m3/Pa1/2-min z1(t=0) = 2 m

(b) A controller was installed in the cone-shaped vessel which regulates the outflow of the
vessel according to
F3 = ln(1 0.09903z11/2)

If z2(t = 0) = 3 m, derive an analytical expression of z2(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
z2

V= 0
A(z2)dz2, where A(z2) = cone cross-sectional area and is a function of z2.

(c) Suppose the inflow F1 into the first tank is now reduced to 0.3 m3/min and the outflow F3
from the second tank is maintained at a constant value of 0.05 m3/min, while the rest of
the data remain the same. We wish to solve this problem again. The above conditions
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 F1 with some of the water in the sphere also flowing into the
rectangular tank at a rate of F2. Water then flows out of the rectangular tank at a flow rate
of F3, 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.

F1 = 0.1 m3/min

P Air
P0
F3 = 0.3 m3/min
z1 z2
P2
P1
F2

The following data are known about the system:

35
CV = 110-5 m3/Pa1/2-min (characteristic valve constant) P0 = 1.01325105 Pascal
Cross-sectional area of rectangular tank = 3 m2 Radius of sphere R = 2 m
Height of rectangular tank = 10 m
Initially at t = 0, z1 = 3 m, z2 = 2 m, P = 1.01325105 Pascal
Gravitational acceleration g = 9.80665 m/s2 (water) = 1000 kg/m3

Universal gas constant R = 8314 m3-Pa/kmol-K = 8314 J/kmol-K


Liquid volume inside a sphere as a function of liquid height z is given by:

z3
V = R z2
3

Use MATLABs ode45 to determine whether the liquid heights in the two vessels will ever
be equal, i.e. z1 = z2. If so, report the time (accurate to one decimal place) at which this
happens and the height.. If z1 is never equal to z2, determine when the two liquid heights are
at the closest. Run your model for 20 minutes, which should be sufficient to answer the
questions.

Answer the following questions:

Are the two liquid heights ever equal? Yes No

If yes, z1 = z2 = ____________ 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:

F1 = C d A 2gz1

where A is the area of the hole, g is the acceleration due to gravity, and Cd is an
experimentally determined value that depends partly on the type of fluid (for water, Cd =
0.6). Water then flows out of the spherical vessel at a flow rate of F2. We wish to study the
dynamics of the liquid heights in the two vessels using MATLAB.

36
P0 Air
z1
Water

z2
F1
P1 P2

F2

The following data are known about the system:

Cvalve = 110-3 m3/Pa1/2-min (characteristic valve constant)


Cross-sectional area of the rectangular vessel = 4 m2
Radius of sphere R = 2 m P2 = 1.01325105 Pascal (water) = 1000 kg/m3
CV (air heat capacity at constant volume) = 20850 J/kmol-K

Initially at t = 0, z1 = 6 m, z2 = 2 m, P0 = 1.01325105 Pascal, TG = 303.15 K


Gravitational acceleration g = 9.80665 m/s2 = 35303.94 m/min2

Universal gas constant R = 8314 m3-Pa/kmol-K = 8314 J/kmol-K


Conversion factors: 1 Pascal = 1 N/m2 = 1 kg/m-s2, 1 N = kg-m/s2, 1 J = kg-m2/s2
Liquid volume inside a sphere as a function of liquid height z is given by:

z3
V = R z2
3

Derive an ODE for z2 as a function of time (without z1 in the ODE) and use MATLABs
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

37
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 F1 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:

F2 = C d A 2gz1

where A is the area of the hole, g is the acceleration due to gravity (32.2 ft/sec2), and Cd is
an experimentally determined value that depends partly on the type of fluid (for water, Cd =
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.

F1 = 15 ft3/min

z1 F2

z2
F3 = 20 ft3/min

(a) Derive an analytical expression of liquid height z1 of the cubic tank as a function of
time. Does z1 ever reach the steady-state, and if so, what is this value? Based on your
analytical answer, also comment on whether z1 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 z2 in the second tank. Together with the
ODE for z1 in Part (a), use MATLAB (ode45) to solve for z2 as a function of time and
plot both z1 and z2 as a function of time. Run the simulation for 20 minutes.

38
Answer the following questions:

z1 (t = 10 minutes) = ____________ ft z2 (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.

Water, 4 kg/min MeOH, 3 kg/min

2 kg/min
6 kg/min
x1 x2
Tank 1 Tank 2

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 x1 as the mass fraction of water in Tank 1 and x2 as the mass fraction
of methanol in Tank 2 at any given time t.

(a) Derive analytically an expression for x2, the methanol mass fraction in Tank 2, as a
function of time.

(b) Using the result in Part (a), derive an ODE for x1, 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 x1 versus time.

Answer the following questions:

x2 (t = 10 minutes) = _______________ x1 (t = 10 minutes) = _____________

Why shouldnt we run the model in Part (b) beyond 20 minutes?

_____________________________________________________________________

39
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 m2 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-m2-C and
the heat capacity of water is 1 kcal/kg-C.

20 C
180 kg/hr

120 kg/hr
T (Temperature)

150 C
0.9 m2

(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 F1 (in kg/min) as a
function of time, and it flows out at a constant rate of F2 (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.

40
F1 = 8 + 0.2t

H=2m
z

R = 0.5 m F2 = 10 kg/min

The following data are available on methanol:

TB = 64.75 C = 23.4 kmol/m3 MW = 32.04 kg/kmol CP = 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 = A (z)dz, where A (z) = cone cross-sectional
0
C C

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-m2-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 TB first. Assuming that the vessel doesnt overflow, how long does it take
for the liquid to reach TB? Note that the heat transfer area AT should not be treated as
constant.

41
z

The surface area of a cone AT at any height z = 2r dz


0

Answer the following questions:

Check one: O Vessel overflows first O T of methanol reaches its TB first

Time to reach TB = ______________ 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 F1 = 2 kg/min and vice versa with a flow rate F2 = 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 m2 and the same heat transfer coefficient of U = 4 kcal/m2-min-C.
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 M1, T1, M2, and T2 as the mass and the
temperature of water in the first vessel and in the second vessel, respectively.

Tank 1 Tank 2

M2 T2
F1
M1 T1
F2

(a) Using the following data about the system, derive two ODEs that describe T1 and T2 as a
function of time.

CP (water) = 1.0 kcal/kg-C

Initially at t = 0: M1 = 50 kg of water, T1 = 20 C, M2 = 100 kg of water, T2 = 10C

(b) Solve the two ODEs in Part (a) and derive an analytical expression for T1 and T2 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.

42
Answer the following questions:

Domain of this system = ____________ minutes

T1 = T2 = ____________ 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: Fi = volumetric flowrate of stream i, and
Ti = temperature of stream i.

Tank Inlet F1 T1

Jacket Inlet
F3 T3

Jacket Outlet V T Tank Outlet


F4 T4 Jacket Vj F2 T2

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(T4 T2), 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:

F1 = 1.0 ft3/min CP (in tank) = CP (in jacket) = 61.3 Btu/F-ft3


T1 = 50 F T2 = 125 F V = 10 ft3
T3 = 200 F T4 = 150 F Vj = 1 ft3

43
Solve for F3 and UA (show units) at steady-state.

(c) If initially (t = 0), T2 = 50 F and T4 = 200 F, solve for T2 and T4 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, qf and q,
respectively. Assume that heat is being added to the tank at a rate of Q and ideal gas
behavior in the drum.

Tf , qf, Pf P, V, T 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(CPVT)/dt and CP 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 m3 R = 8.205x10-2 m3-atm/kmol-K


= 8.315 kJ/kmol-K
CP (gas) = 125 kJ/kmol-K qf = 1.0 kmol/min
Tf = 25 C q = 0.5 kmol/min
Q = 1.5x104 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

44
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

T1

T2
10 kg/min 30 kg/min

(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 T2, the temperature inside Tank 2 as a function of time. Also, compute T2 at the
time when Tank 1 is completely emptied. Use the following data:

CP = liquid heat capacity = 2.0 kJ/kg-C UA = 40 kJ/min-C


TS = 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

T1

Steam T2
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:

CP = liquid heat capacity = 2.0 kJ/kg-C


U = overall heat transfer coefficient = 25 kJ/m2-min-C
TS = steam temperature = 200 C
= liquid mass density = 1200 kg/m3

45
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 F1. Use the following additional data about ethanol to calculate the time it
takes for ethanol to completely disappear from the cylindrical vessel. Also, how much
faster does the boiling help in emptying the vessel?

v when boiling occurs

F1 = 2 kg/min

MW (molecular weight) = 46.07 (heat of vaporization) = 38600 kJ/kmol


CP (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.

46
Steam TS

1
1 atm
v

CV

P0
The following data are available:

MW = 46.07 (TB) = 3.858x107 J/kmol


= 16.575 kmol/m3 CP = 1.4682x105 J/kmol-C
log10 P = 8.04494 __1554.30__
vap
T in C and Pvap in mmHg
T + 222.65
CV = 4.5 m3-atm-1/2/hr = valve constant
TS = 100 C U = 2.0x106 J/hr-m2-C
P0 = 1 atm z0 = 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 AT 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/s2

1 atm = 1.01325x105 N/m2 1 N = 1 kg-m/s2

The volume of liquid V(z) in a spherical vessel as a function of its height z is given by

V(z) = Rz2 z3
3
while the surface area S(z) is given by

S(z) = 4Rz z

47
x [a + bx a ln(a + bx)]
a + bx
dx =
b2

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. Lets 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
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/m3


(heat of vaporization) = 2256.84 kJ/kg CP (liquid heat capacity) = 4.1813 kJ/kg-K
R (universal gas constant) = 0.08206 atm-m3/kmol-K

Steam

PG VG PG VG
v v

z Water VL Water VL

Figure for Part 1 Figure for Part 2

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 TS = 200 C with a constant
heat transfer area A = 2.0 m2 and an overall heat transfer coefficient U = 100 kJ/min-m2-C
as shown in the figure for Part 1.

(a) Derive an analytical expression of the liquid height z as a function of time.

48
(b) Derive an analytical expression of the water gas pressure PG 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 PG 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) PG = ____________ atm after 30 minute

(ii) PG = ____________ atm when water has boiled off completely

Part 2: Now, lets 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 TS to be the same as in Part 1.

(a) Derive an analytical expression of liquid volume VL as a function of time.

(b) Derive a single ODE for the gas pressure PG using the analytical expression in Part 2(a). Then
use MATLAB (ode45) to solve the ODE for PG from t = 0 to t when all liquid is gone, and
make a plot of the PG profile. Note that the final value of PG 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) PG = ____________ atm after 30 minutes

(ii) PG = ____________ 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 R1 = 1.0 m and a
height of H = 1.5 m, while the sphere has a radius of R2 = 1.0 m. In addition to the liquid
already in the vessel, pure acetone at its boiling point is added continuously at a rate F1 = 15
m3/hr. The cylinder also has a hole at the bottom, which allows acetone to flow out and into
the sphere according to the relation

49
F2 = Cd A(2gz1)1/2 (in m3/hr)

where A is the area of the hole, g is the acceleration due to gravity, and Cd is an
experimentally determined value.

F1 = 15 m3/hr at 56.0 C

Steam at TS1

v1 H

z1

F2

Steam at TS2
R2
v2

z2

The following data are available:

MW = 58.08 = 13.62 kmol/m3


(TB) = 3.02x107 J/kmol TB = 56.0 C
CP = 1.30735x105 J/kmol-C U = 3.0x106 J/hr-m2-C (for both vessels)
TS1 = 150 C TS2 = 100 C
Cd = 0.5 g = gravitational constant = 1.271x108 m/hr2
r = hole radius = 0.01 m
z1(t=0) = 0.5 m z2(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.

50
(b)Determine the time in hours (correct to 2 decimal places) at which the liquid height z1 in
the cylinder is equal to the liquid height z2 in the sphere.

56. Semi-Batch Reactor with a Single 1st-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
CAF

A B

If CAF (feed concentration) = 5 mol/m3, k = 1 hr 1, with V = 2.0 m3 and CA = 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:

k1 k2 k3
A B C D

(a) Assuming that each of the reactions is first-order and constant volume, write down the
modeling equations for CA, CB, and CC, where CA, CB, and CC 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( d3CC, d2CC, dCC, CC, k1, k2, k3 ) = 0


dt3 dt2 dt

(c) If k1 = 1 hr 1, k2 = 2 hr 1, k3 = 3 hr 1, and CA0 = CA(t=0) = 1 mol/liter, solve the ODE


in Part (b) analytically for the concentration of C at any given time t.

51
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:

k1 k2f
A B C
k2r

Here k2f and k2r represent the kinetic rate constants for the forward and reverse reactions for
the conversion of B to C, while k1 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 CA, CB, and CC, where CA, CB, and CC represent the
concentrations (mol/volume) of components A, B, and C, respectively.

(b)Using the following definitions:

Dimensionless time, = k1 t
Conversion of A, x1 = (CA0 CA) / CA0
Dimensionless concentration of B, x2 = CB / CA0
Ratio of rate constants, = k2f / k1
Ratio of forward and reverse rate constants, = k2r / k1

Derive a second-order ODE for the dimensionless concentration of B. Your ODE must
contain only dimensionless quantities (x2, , , and ).

(c) Solve the ODE in Part (b) analytically to find x2 as a function of , , and .

(d)Using the following data:

k1 = 1.0 min-1 k2f = 1.5 min-1 k2r = 2.0 min-1


CA0 = CA (t = 0) = 3.0 mol/liter
CB0 = CB (t=0) = 0 mol/liter
CC0 = CC (t=0) = 0 mol/liter

Solve for CB 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 k1 = 3 min-1, k2f = 1.5 min-1, k2r = 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

52
constants (i.e. k1 = 1.0 min-1, k2f = 1.5 min-1, k2r = 2.0 min-1 and k1 = 3.0 min-1, k2f = 1.5
min-1, k2r = 1.0 min-1).

59. Modeling an Isothermal Serial Reaction


Consider an isothermal batch reactor with the following two reactions in series:

k1 k3

A B C
k2 k4

Both reactions are reversible. The forward reaction in the first reaction is zero-order while
the remaining three reactions follow the stoichiometry. That is,

dCA
= k1 + k 2CB
dt

dCB
= k1 k 2CB k3CB + k 4CC
dt

dCC
= k3CB k 4CC
dt

(a) Derive a second-order ODE of CB as a function of time. Note that your final ODE for CB
must be expressed in terms of k1, k2, k3, and k4.

(b) Given that k1 = 4.0 gmol/liter-hr, k2 = 2.0 hr-1, k3 = 1.0 hr-1, k4 = 2.0 hr-1, and CB(t = 0) =
CC(t = 0) = 0, solve for an analytical expression of CB as a function of time. Does CB go
through a maximum or minimum? If yes, determine the time at which this
maximum/minimum occurs.

(c) Given that CA(t = 0) = CA0 = 5 gmol/liter, derive an analytical expression for CA and CC
as a function of time.

Answer the following questions:

CA(t = 1 hr) = _______________ gmol/liter CB(t = 1 hr) = _______________ gmol/liter

CC(t = 1 hr) = _______________ gmol/liter

Does CB go through a maximum or minimum? Yes _____ No _____

If yes, the time at which the maximum/minimum occurs = ____________ hour

53
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

k1
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 1st-order with respect to each
reactant as follows: rA = k1CACB

FA = 15 liter/min FB = 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 CA, CB, and CC, 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

CA(mol/liter) 2.0 1.65 1.52 1.40 1.28 1.17 1.10 1.06


CB(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:

k1
2A + B C + D
k2

with a reaction rate of rA = k1CACB + k2CD (2nd -order forward and 1st-order reverse).
The value of k2 has been measured to be 1.0 min-1. Derive analytically the

54
concentration of A as a function of time, and compute CA 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 CA.

dx 1 a + bx
Useful Integrals: x(a + bx)
= ln
a x

2
+ tan 1 if > 0

dx 2
B
=

if = 0

2
tanh 1 if < 0

where B = a + bx + cx2
= 4ac b2
= 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:

55
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

[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:

k1 k2
2A B C

Initially (t = 0 hr), CA = CA0, CB = 0, and CC = 0, where CA, CB, and CC 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.

dCA/dt = k1CA1/2

dCB/dt = k1 CA1/2 k2CB


2

Derive an analytical expression for CB as a function of time.

(b) The following experimental data were obtained for component CA:

Time(hr) 0 0.05 0.15 0.35 0.60 0.85 1.0

CA(mol/liter) 1.0 0.93 0.79 0.54 0.30 0.13 0.06

CB was also measured to be 0.11 mol/liter at t = 1 hr. Determine the values of k1 and k2
and the time tmax at which CB is at its maximum. Hint: Use Polyfit function in MATLAB
to help determine k1 and k2.

56
(c) Now, suppose the order of the above series reaction conforms to the stoichiometry,
derive analytically a 1st-order ODE for CB, i.e.

dCB/dt + p(t)CB = q(t)

but do not solve this ODE.

(d) When the reaction order conforms to the stoichiometry, the following experimental data
were obtained for CA:

Time(hr) 0 0.03 0.06 0.10 0.15 0.20 0.30

CA(mol/liter) 1.0 0.76 0.63 0.51 0.39 0.33 0.25

It was also observed that CB reached a maximum of 0.14 mol/liter at t = 0.1 hr.
Determine the values of k1 and k2.

63. Maximizing Product Yield in an Isothermal Batch Reactor


Consider an isothermal batch reactor with the following series of two reactions:

k1 k2
A B C

Chemical B is the desirable product. The two reactions do not follow the stoichiometry.
Instead, the first reaction is one-halfth-order while the second reaction is first-order with
respect to the reactant, i.e.

dCA = k1CA1/2
dt

dCB = k1CA1/2 k2CB


dt

(a) Given that at t = 0, CA = CA0 and CB = 0, derive analytically an expression of CB as a


function of time. Note that your final equation for CB must be expressed in terms of CA0,
k1, and k2.

(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 CA0 = 1.0
kmol/liter, k1 = 1.5 kmol1/2/liter1/2-hour, and k2 = 2.0 hour-1. Also, calculate this
maximum concentration.

57
Answer the following questions:

tmax = __________________ hour CB,max = ________________ kmol/liter

64. Modeling an Isothermal Reversible Reaction and Determining Rate Constants


Consider an isothermal batch reactor with the following reversible reaction:

k1
A B
k2

The reversible reaction does not follow the stoichiometry. Instead, the forward reaction is
zeroth-order while the backward reaction is second-order with respect to the reactant, i.e.

dCA
= k1 + k 2CB2
dt

dCB
= k1 k 2CB2
dt

(a) Given that at t = 0, CA = CA0 and CB = CB0, derive analytically an expression of CB as a


function of time. Note that your final equation for CB must be expressed in terms of CB0,
k1, and k2.

(b) Based on the result in Part (a), derive now an analytical expression of CA as a function
of time. Again, your final equation for CA must be expressed in terms of CA0, CB0, k1,
and k2.

(c) The following data are available from experiments:

--------------------------------------------------------------------------------
t (hour) 0 0.05 0.15 0.30 0.40 0.55 0.70
--------------------------------------------------------------------------------
CB (mol/liter) 6.0 4.40 3.10 2.36 2.20 2.08 2.03
CA (mol/liter) 6.0
--------------------------------------------------------------------------------

Also, it was observed that at steady-state, CB = 2.0 mol/lier. Determine the values of the
two rate constants k1 and k2.

58
Answer the following questions:

k1 = ______________ mol/hr k2 = _____________ liter2/mol-hr

65. Modeling Three Reactions in Series


Consider the following three reactions in series:

k1 k2 k3
A B C D

The orders of the three reactions do not follow the stoichiometry but instead can be
described by the following modeling equations:

dC A dCB
= k1C A3 / 2 = k1C A3 / 2 k 2
dt dt

dCC dCD
= k 2 k 3CC = k 3CC
dt dt

(a) Derive an exact (analytical) expression of CB as a function of time. Note that your final
equation for CB must be expressed in terms of k1, k2, CA0, and CB0, and that CB0 is not
necessarily equal to zero.

(b) Also derive an exact (analytical) expression of CD as a function of time in terms of k2, k3,
CC0, and CD0. Note that CC0 and CD0 are not necessarily equal to zero.

(c) Component B is the desired product whose concentration should be maximized. Given
that k1 = 0.5 liter1/2/gmol1/2-hr, k2 = 2.0 gmol/liter-hr, and CA0 = 10 gmol/liter, and CB0 =
3.0 gmol/liter, determine the maximum CB and the time at which this maximum occurs.

(d) Given that CC0 = 1.0 gmol/liter, CD0 = 0, and k3 = 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:

CA(t = 1 hr) = _______________ gmol/liter CB(t = 1 hr) = _______________ gmol/liter

CC(t = 1 hr) = _______________ gmol/liter CD(t = 1 hr) = _______________ gmol/liter

CB, max = ______________ gmol/liter tmax = _______________ hours

Domain of this modeling = ____________ hours

59
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.

V (gmoles/sec)
yi

xi 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

b
y C 5 = xC 5 a + 2

1 + x 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, log10 PVAP = 6.85221 __1064.630__


T + 232.00
PVAP in mmHG
For n-hexane, log10 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

60
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(xC5)

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
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 x2

Note that this equation is only valid for n-pentane, and not necessarily for n-hexane.

V (gmol/min)
yi

xi 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, log10 PVAP = 6.85221 __1064.630__


T + 232.00
PVAP in mmHG
For n-hexane, log10 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.

61
68. Semi-Batch Distillation
Benzene and ethanol form an azeotrope. The experimental x-y data of this binary system at
45C was reported by I. Brown and F. Smith, Austral. J. Chem. 7, 264 (1954) as follows:

xethanol yethanol xethanol yethanol

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 5th-degree polynomial in
the form of

y = ax5 + bx4 + cx3 + dx2 + 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 F1 (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

F1 = 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

62
F1
V (gmol/min)
yi

xi L (gmoles)

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 F1 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.

xwater ywater xwater ywater

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 = ax2 + 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.

63
V (gmol/min)
yi

xi L (gmoles)

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 = _______________

64

You might also like