MATLAB Exercises for Chemical Engineering
MATLAB Exercises for Chemical Engineering
Using MATLAB
Exercise Problems
7th Edition
Prepared by
Dr. Hong-ming Ku
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
exp(2x1) x2 4 = 0
x2 x32 1 = 0
x3 sin(x1) = 0
2
1
P = 40 psia Cv,1
Pump
Cv,2 Cv,3
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):
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):
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
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.
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
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.
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:
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).
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
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.
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]
P = RT + + +
V V2 V3 V4
= R T B0 A0 R c
T2
= R T B0 b A0 a R c B0
T2
10
= R T B0 b c
T2
(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.
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.
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
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
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
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.
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
(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.
What are the values of y at t = 1 and t = 10? Use format short to show all your calculations.
14
22. Solving a 3rd-Order ODE Boundary-Value Problem
Consider the following 3rd-order ODE which is a boundary-value problem
Use ode45 in MATLAB to solve for numerical solutions of the above ODE between t = 0 and
t = 1, showing a step size of 0.1.
The analytical (exact) solution of the above ODE is: y(t) = t(a + bt)exp(ct)
where a, b, and c are constant coefficients. Also, use MATLAB and the numerical answers
from ode45 to determine the correct values of a, b, and c, without taking any derivatives of
y(t).
Answers:
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.
15
y(t=0)MATLAB = __________ y(t=0)EXACT = __________ % Deviation = __________
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:
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.
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
(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:
18
The governing equation for the temperature dis
distribution
tribution in the fin is the dimensionless
second-order
order differential equation
(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.
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.
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
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:
Also, in your MATLAB program, report the total number of terms needed in the series
expansion in order to achieve the desired accuracy.
Answers:
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
The drag coefficient varies with the Reynolds number (Re) as follows:
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.
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.
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:
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.
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
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.
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:
where PAVG = average absolute pressure across the valve = (P1 + P2)/2
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.
(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:
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.
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.
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.
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
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:
(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.
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.
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.
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).
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)
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).
F1 = 0.1 m3/min
P Air
P0
F3 = 0.3 m3/min
z1 z2
P2
P1
F2
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
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.
Time at which the two liquid heights are equal or at the closest = _____________ minutes
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
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.
Time at which the rectangular vessel dries up or the spherical vessel is full (whichever is
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:
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.
_____________________________________________________________________
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).
40
F1 = 8 + 0.2t
H=2m
z
R = 0.5 m F2 = 10 kg/min
(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.
Note that the volume of a cone is V = A (z)dz, where A (z) = cone cross-sectional
0
C C
(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
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.
(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:
Tank Inlet F1 T1
Jacket Inlet
F3 T3
(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:
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.
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
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:
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:
(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:
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)
F1 = 2 kg/min
Hint: Watch the units and their conversions carefully in your calculations
Time when ethanol disappears completely from the vessel = ____________ minutes
Time by which the boiling helps the vessel to empty faster = ____________ minutes
46
Steam TS
1
1 atm
v
CV
P0
The following data are available:
(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).
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
Steam
PG VG PG VG
v v
z Water VL Water VL
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.
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.
How long does it take for water in Part 1 to boil off completely? ____________ minutes
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.
(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).
How long does it take for water in Part 2 to boil off completely? ____________ minutes
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
(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.
F
CAF
A B
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
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.
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 .
(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).
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.
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:
(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
2A B + C
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
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
(b) The following experimental data were obtained for component CA:
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.
(d) When the reaction order conforms to the stoichiometry, the following experimental data
were obtained for CA:
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.
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
57
Answer the following questions:
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
(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.
--------------------------------------------------------------------------------
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 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?
59
Reason: __________________________________________________________________
_________________________________________________________________________
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
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)
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:
(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:
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
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.
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.
64