32 Example 2
32 Example 2
Example 32.2
Problem Purpose
This problem will help you determine whether you have mastered the learning objectives for this
unit. It illustrates the analysis of a semi-batch reactor where a product boils off during processing. It also
illustrates a situation where the semi-batch reactor design equations must be formulated and solved
separately for two different stages of processing.
Problem Statement
When a solution containing A and B is allowed to react, it produces Y and Z according to reaction
(1). The product Z is only slightly soluble in the solution, and consequently it tends volatilize into the vapor
phase. The other reagents, A, B and Y have negligible vapor pressures at process conditions (which are
essentially isothermal due to a large excess of solvent and a low heat of reaction). At the process
temperature, the concentration equilibrium constant, K, is equal to 8 x 10-5, and the Henry’s law constant
for Z is equal to 8 x 10-4 mol L-1 atm-1. The rate expression is given in equation (2). The initial charge to
the reactor consists of 100 gal of a liquid solution containing A and B at equal concentrations of 4 mol L-1
at 80 °C. The reactor holds 100 gal of liquid with a headspace of 8 gal. At the start of processing, the
headspace is evacuated. Calculate the equilibrium conversion of A for a closed reactor and then plot the
conversion of A as a function of time for a process wherein a pressure relief valve is used to maintain a
maximum headspace pressure of 1.5 atm. Z is a small diatomic molecule, and its vaporization from the
liquid phase does not cause an appreciable change in the liquid volume.
A+B⇄Y+Z (1)
⎧ CC ⎫
( )
r1 = 5 × 10−4 L mol−1 min −1 C AC B ⎨1− Y Z ⎬
⎪⎩ KC AC B ⎪⎭
(2)
Problem Analysis
This is not a kinetics problem: we are given the rate expression and asked to analyze the
performance of reactors. First, we are asked for the equilibrium conversion for a closed reactor. There are
two ways to approach this problem: write the appropriate reactor design equations and solve them for the
conversion as the time approaches infinity or write and solve the equilibrium equations (since there are
two phases in the reactor, there will be two equilibrium expressions that must be solved simultaneously).
We will use the latter approach here. The second question is a reaction engineering problem and will be
solved by formulating and solving the reactor design equations. The problem specifies that the process is
isothermal, so the mole balance design equations can be solved independently of the energy balance
design equations. This particular problem does not ask any questions related to heat transfer or
temperature, so we will not need to formulate an energy balance. In formulating the mole balance design
equations, we will assume that the vapor and liquid phases are always equilibrated. Initially the pressure
relief valve will be closed, but once the pressure builds to 1.5 atm, it will open. As a consequence, the
semi-batch operation will need to be evaluated in two stages, one stage corresponding to the time when
the pressure valve is closed and the second stage corresponding to the time during which it is open.
Problem Solution
First consider the equilibration of a closed reactor. As indicated in the schematic diagram of Figure
1, there are a liquid phase and a vapor phase (head space) present in the reactor. At thermodynamic
equilibrium, reaction (2) must be at equilibrium in each of the two phases and the two phases must be in
equilibrium with each other. In this case, however, the problem statement indicates that the only species
present in the vapor phase is Z. In that situation, there can be no reaction in the vapor phase, so the only
requirements are that the reaction is at equilibrium in the liquid phase and the liquid and vapor phases are
equilibrated.
Z
⇅
A+B⇄Y+Z
After making a schematic, it is a good idea to read through the problem statement and assign every
quantity that is specified to an appropriate variable symbol. In this problem, the following quantities are
specified: PA = PB = PY = 0 atm, K = 8 x 10-5, hZ = 8 x 10-4 mol L-1 atm-1, k = 5.4 x 10-4 L mol-1 min-1,
Vliq,0 = Vliq(t) = 100 gal, CA,0 = CB,0 = 4 mol L-1, CY,0 = CZ,0 = 0 mol L-1, T0 = 80 ºC, Vvap = 8 gal, P0 = 0 atm
and Pmax = 1.5 atm. The maximum pressure only applies in the case where the reactor is fitted with a
pressure relief valve. Knowing the initial liquid volume and the initial liquid concentrations, the initial moles
of each species can be calculated according to equation (3) where i is equal to A, B, Y and Z.
To answer the first question, we need a reaction equilibrium expression, equation (4) and a phase
equilibrium expression, equation (5). We also could have obtained equation (4) by noting that the reaction
rate will equal zero at equilibrium. These are the two equations that must be solved in order to calculate
the equilibrium composition of the closed system.
CY ,eqCZ ,eq
K= (4)
C A,eqC B,eq
We have two equations, so they can be solved to find values for two unknowns. Here, I will choose
CA,eq and CZ,eq as the two unknowns to be found by solving equations (4) and (5). Having identified the
unknowns to be solved for, the equations can be written in the standard form with a zeroes on one side of
the equals sign and functions of the unknowns on the other side, as shown in equations (6) and (7). At the
same time, both sides of equation (4) were multiplied by CA,eqCB,eq to eliminate the denominator since this
often improves convergence during numerical solution.
( )
0 = f1 C A,eq ,CZ ,eq = KC A,eqC B,eq − CY ,eqCZ ,eq (6)
0 = f (C
2 A,eq
,CZ ,eq )= P h − CZ ,eq
Z ,eq Z
(7)
In order to solve these equations numerically, no matter what software is used, it will be necessary
to provide a guess for each of the two unknowns and computer code. That code will receive values for the
two unknowns, CA,eq and CZ,eq, and it must evaluate and return the corresponding values of the two
functions, f1 and f2, in equations (6) and (7). In order to evaluate those functions, the code must first
compute values for every quantity appearing in the functions. Looking at the two functions, the values of
the Henry’s law constant, hZ, and the equilibrium constant, K, have already been specified. Thus, in order
to evaluate functions f1 and f2, the supplied computer code will first need to calculate values for CB,eq,
CY,eq, and PZ,eq. It should be noted that since equation (7) is one of the equations being solved, it cannot
be used to compute the value of PZ,eq.
The code will be given values for CA,eq and CZ,eq. Having the value of CA,eq, the moles of A, nA,eq, can
be calculated using equation (8). Then, knowing the initial moles of A, the equilibrium extent of reaction,
ξeq, can be calculated, equation (9). That, in turn, permits calculation of the moles of B and Y, equations
(10) and (11), and then their concentrations, equations (12) and (13). The total moles of Z can also be
calculated from the extent of reaction, equation (14), but those moles of Z will be split between the liquid
and vapor phases. Since the code will be given the liquid phase concentration of Z, CZ,eq, the liquid phase
moles of Z can be calculated using equation (15). Subtracting the moles of Z in the liquid phase from the
total moles of Z gives the moles of Z in the vapor phase, equation (16). Finally, assuming ideal gas
behavior, the pressure of Z in the vapor phase can be calculated, equation (17).
nY ,eq = nY ,0 + ξ eq (11)
nB,eq
C B,eq = (12)
Vliq
nY ,eq
CY ,eq = (13)
Vliq
nZ ,vap,eq RT
PZ ,eq = (17)
Vvap
At this point, all the quantities needed to evaluate the functions, f1 and f2 in equations (6) and (7)
can be found, and therefore the code necessary to solve equations (6) and (7) numerically can be written
and the equations solved. Upon doing so, one finds CA,eq = 3.92 mol L-1 and CZ,eq = 0.017 mol L-1. The
moles of A can again be calculated using equation (8), and then the fractional conversion of A can be
calculated using equation (18). Performing the calculations, one finds fA,eq = 1.85%. Additional
calculations show that the final pressure is 20.8 atm at equilibrium.
nA,0 − nA,eq
fA,eq = (18)
nA,0
PZ(t)
⇅
CZ(t)
Now we can consider the second question from the problem statement where the reactor is fitted
with the pressure relief valve. During the first stage, the headspace is not vented because the pressure is
not sufficiently large to open the relief valve. Thus, as indicated in the schematic diagram, Figure 2, the
pressure in the headspace will increase over time, due to the continual generation of Z in the liquid phase
by reaction and the evaporation of Z into the headspace. We will assume that phase equilibrium exists at
all times. While nothing is leaving the reactor during this stage of processing, it is still a semi-batch
operation. This is so because the reactor design equations are balances on the reaction volume. In this
case, the reaction only takes place in the liquid phase, and the balances are written for that phase only.
From the perspective of the liquid phase, Z is leaving the reaction volume when it evaporates, making this
a semi-batch process.
The quantities provided in the problem statement have already been assigned to appropriate
variable symbols, so that need not be repeated here. As noted in the problem analysis, the reactor is
isothermal, so the mole balance design equations can be solved independently from the energy balance.
Indeed, in this problem, an energy balance is not needed in order to answer the questions posed. The
general form of the mole balance for a semi-batch reactor is given in equation (19). There is only one
reaction taking place in this system, so the summation in equation (19) will expand to a single term. Using
equation (19), mole balances can be written for each of the four reagents, leading to equations (20)
through (23). Notice that since only Z evaporates from the reacting liquid, ṅA, ṅB and ṅY are all equal to
zero. It should also be noted that since ṅZ represents the net molar flow of Z into the reactor, it will have a
negative value.
dni
dt
= n!i + V ∑ ν i, j rj (19)
j=all
reactions
dnA
= f3 ( t,nA ,nB ,nY ,nZ ) = −Vliq r1 (20)
dt
dnB
= f 4 ( t,nA ,nB ,nY ,nZ ) = −Vliq r1 (21)
dt
dnY
= f5 ( t,nA ,nB ,nY ,nZ ) = Vliq r1 (22)
dt
dnZ
= f6 ( t,nA ,nB ,nY ,nZ ) = n!Z + Vliq r1 (23)
dt
The design equations, (20) through (23), are a set of initial value ordinary differential equations
where the independent variable is time and the dependent variables are the moles of A, B, Y and Z in the
reactor. To solve the semi-batch design equations numerically, no matter what software is used, it will be
necessary to provide initial values (i. e. values of nA, nB, nY and nZ at t = 0), a final value of either t, nA, nB,
nY or nZ, and computer code that is given values for t, nA, nB, nY and nZ and uses them to evaluate and
return the values of functions f3 through f6 in equations (20) through (23). For this stage of the process,
the initial values are known as seen in equations (24) through (27).
nA ( t = 0 ) = C A,0Vliq (24)
nB ( t = 0 ) = C B,0Vliq (25)
nY ( t = 0 ) = CY ,0Vliq = 0 (26)
nZ ( t = 0 ) = CZ ,0Vliq = 0 (27)
The first stage ends when the pressure in the headspace reaches 1.5 atm. The time when this
occurs can be denoted as tf,1 (final time for stage 1). Since Z will be the only species present in the vapor
phase, that means the partial pressure of Z will equal 1.5 atm. Substituting that value into equation (4)
along with the known Henry’s law constant allows calculation of the final liquid phase concentration of Z.
Multiplying that concentration by the liquid volume gives the moles of Z at the end of the first stage,
equation (28). This is the final condition needed to solve the design equations for the first stage.
( )
nZ t = t f ,1 = VliqCZ = Vliq PZ hZ = (1.5 atm ) hZVliq (28)
The code that must be provided to numerically solve equations (20) through (23) will be given
values for t, nA, nB, nY and nZ, and it must use them to evaluate the functions, f3 through f6, in those
equations. Looking at functions f3 through f6 it can be seen that they contain quantities whose values are
not known, specifically r and ṅZ. These must be calculated before the functions can be evaluated.
Equation (2) can be used to compute the rate; the equilibrium constant is known but the reagent
concentrations are not. The concentrations of A, B, Y and Z can be calculated by definition (i. e. using
equations (12) and (13) and equivalent equations for Y and Z), after which the rate can be computed.
The molar flow rate of Z into the reactor, ṅZ, is the only other quantity needed in order to evaluate
the functions f3 through f6. To find ṅZ, a mole balance is written on the headspace. The molar flow of Z into
the headspace must equal the molar flow of Z from the liquid (which is the negative of ṅZ, the net molar
flow of Z into the liquid). Since nothing leaves the headspace and no reaction takes place in the
headspace, a mole balance on Z in the headspace requires the molar flow of Z in to equal the rate of
accumulation of Z, equation (29). Again, ṅZ will be negative, so the flow into the headspace in equation
(29) will be positive, as expected. Re-writing the moles of z in the headspace in terms of the ideal gas
law, substituting Henry’s law, equation (5), and then re-writing the liquid phase concentration of Z in terms
of the moles of Z and the liquid volume gives equation (30). Finally, substituting equation (23) into
equation (30) and rearranging gives equation (31) for the molar flow rate of Z leaving the liquid. All of the
quantities appearing in equation (31) are known, and so a value for ṅZ can be calculated. At this point, all
quantities needed in order to evaluate the functions, f3 through f6, in equations (20) through (23) are
known.
d
− n!Z = n (29)
dt Z ,vap
d d ⎛ PV ⎞ d ⎛C V ⎞ d ⎛ n V ⎞ Vhead dnZ
− n!Z = nZ ,vap = ⎜ Z head ⎟ = ⎜ Z head ⎟ = ⎜ Z head ⎟ = (30)
dt dt ⎝ RT ⎠ dt ⎝ hZ RT ⎠ dt ⎝ Vliq hZ RT ⎠ Vliq hZ RT dt
−Vliq r1
− n!Z =
Vhead dnZ
=
Vhead
(
n! + Vliq r1
Vliq hZ RT dt Vliq hZ RT Z
) ⇒ n!Z =
Vliq hZ RT
(31)
1+
Vhead
Upon writing the code to evaluate the functions, f3 through f6, and solving the design equations
numerically, one finds that the pressure in the headspace reaches 1.5 atm after 0.67 min. Solving the
design equations also gives the values of nA, nB, nY and nZ at that time. These are used as the initial
conditions for the second stage, shown schematically in Figure 3. Knowing the first stage lasts 0.67 min,
we can go back and solve the design equations for a range of times between 0 and 0.67 min, and each
time we solve them, we can calculate the conversion. This will generate the data needed for the
requested plot for times up to 0.67 min.
PZ = 1.5 atm Z
⇅
CZ(t)
During the second stage, the concentration of Z in the liquid phase remains constant because any
additional Z that is formed evaporates into the vapor phase and is immediately vented so that the
pressure in the headspace remains constant. That is, the liquid phase concentration of Z during the
second stage is constant, being in equilibrium with the Z in the headspace at a pressure of 1.5 atm, as
expressed in equation (32).
Since the liquid phase concentration of Z is not changing, we do not need the mole balance design
equation for Z, equation (23). The other three equations remain unchanged, and as already noted, the
initial conditions are simply the ending conditions from stage 1. Thus, the three remaining design
equations can be solved over a range of final times, and at each time the corresponding conversion of A
can be calculated via equation (33). Since we want the overall conversion, not that just for stage 2, we
use the original moles of A in equation (33).
nA,0 − nA
fA = (28)
nA,0
The resulting plot is shown in Figure 4. From it we can see that by venting the headspace the final
conversion is approximately 18% as compared to the non-vented equilibrium conversion of 1.85%. This
result illustrates a situation where a semi-batch reactor offers a performance advantage. In the closed
system the reaction reached equilibrium at a low conversion, but by allowing one component to boil off
and be vented, it was possible to reach a much higher conversion using essentially the same equipment.
18
16
14
12
Percent Conversion
10
0
0 100 200 300 400 500 600
Time (min)
The second modifications, shown in Listing 2, occurred within the internal function evalEqns. This is
the code to evaluate the functions, f1 and f2 in equations (6) and (7). Values for the unknowns are passed
into evalEqns as a vector named z. The unknowns, CA,eq and CZ,eq, are first extracted from that vector,
after which CB,eq, CY,eq, and PZ,eq are computed according to equations (8) through (17). The functions are
then evaluated and stored in the vector f, which is returned by evalEqns.
Guesses for the unknowns, CA,eq and CZ,eq, were next entered, after which the equilibrium
expressions were solved numerically, Listing 3.
Listing 3. Code that provides guesses and then solves the equilibrium expressions.
The final modification occurs after the equations have been solved, Listing 4. It entails calculating
the equilibrium conversion and the final pressure so they will be properly returned.
% calculate the conversion and set the return variable values
CA = z(1);
CZ = z(2);
nA = CA*V;
extent = nA0 - nA;
nZtot = nZ0 + extent;
nZliq = CZ*V;
nZhead = nZtot - nZliq;
fA_equil = (nA0 - nA)/nA0;
Pfinal = nZhead*R*T/Vhead;
end % of Example_32_2_equil.m
Listing 4. Calculation of the equilibrium conversion and the final pressure.
First stage of semi-batch operation. The template file SolvIVDifD.m was copied and saved as
Example_32_2_semi_a.m; a copy accompanies this solution. The first modification, shown in Listing 5,
entailed changing the introductory comment, renaming the function so that it returned the duration of the
first stage and the final moles of each of the reagents, and entering all the known constant quantities
specified in the problem statement. Additional constant quantities that could be computed at this point
were also calculated.
The second modifications, shown in Listing 6, occurred within the internal function odeqns. This is
the code to evaluate the functions, f3 through f6 in equations (20) through (23). Values for the unknowns
are passed into odeqns as a vector named z. The dependent variables, nA, nB, nY and nZ, are first
extracted from that vector, after which the rate and molar flow of Z are computed as described in the
solution and equations (29) through (31). The functions are then evaluated and stored in the vector dzdt,
which is returned by odeqns.
The initial values were then entered, along with a large value for the final value of the time. This
time should not be reached; the pressure in the headspace should reach 1.5 atm first. (If this final value of
the time is reached, the code will print a warning and the file will need to be edited, making this value
larger.) The final value of the dependent variable, nZ, is set within the internal function named stop. The
value is not entered directly, but instead, the variables stop_when is defined so that it will equal zero when
nZ reaches its desired final value. Here the partial pressure of Z is computed and the maximum pressure
is subtracted. If the partial pressure equals the maximum pressure, the difference will be zero, so
stop_when is set equal to this expression. These modifications are shown in Listing 7.
% Initial values
t0 = 0.0;
z0 = [
nA0
nB0
nY0
nZ0
];
nZ = z(4);
CZ = nZ/V;
PZ = CZ/hZ;
stop_when = PZ - Pmax;
end % of internal function stop
The final modification simply involves extracting the results so they will be properly returned, Listing
8.
end % of Example_32_2_semi_a.m
Listing 8. Setting the return values for the first stage of semi-batch processing.
Second stage of semi-batch operation. The template file SolvIVDifI.m was copied and saved as
Example_32_2_semi_b.m; a copy accompanies this solution. The first modification, shown in Listing 9,
entailed changing the introductory comment, renaming the function so that it received the duration of the
first stage, the final moles of each of the reagents and the desired total processing time as arguments,
and entering all the known constant quantities specified in the problem statement.
The second modifications, shown in Listing 10, occurred within the internal function odeqns. This is
the code to evaluate the functions, f3 through f5 in equations (20) through (22). This is the same as above,
except f6 does not need to be evaluated, and so the molar flow of Z does not need to be calculated.
The initial values were then entered, and the ODEs were solved, Listing 11. (The final value was
passed in as an argument and therefore did not need to be entered.)
% Initial and final values of the dependent variables (values for the
% independent variables are passed in as arguments)
z0 = [
nA0
nB0
nY0
];
The final modification simply involves extracting the results so they will be properly returned, Listing
12.
end % of Example_32_2_semi_b.m
Listing 12. Setting the return values for the first stage of semi-batch processing.
Coordinating the calculations. The MATLAB function that coordinates the calculations,
Example_32_2.m, is straightforward and will not be listed here (a copy accompanies this solution). Briefly,
it begins with the entry of the known constants and a total processing time for the requested plot. It then
calls Example_32_2_equil to solve the equilibrium equations, and reports the results. It next calls
Example_32_2_semi_a to evaluate the first stage of semi-batch processing, printing out the duration of
stage 1 and the corresponding conversion. Example_32_2_semi_b is then called to evaluate the second
stage of semi-batch processing. The results from the two stages are concatenated, the conversion is
calculated and the plot is made. Executing the function generates the plot (Figure 4) and the output
shown in Listing 13.
>> Example_32_2
Equation solved.
z =
3.9258
0.0167
f =
1.0e-05 *
-0.2987
-0.0000
pct_conversion =
1.8542
final_pressure_atm =
20.8304
Semi-Batch Reactor
first_stage_duration_min =
0.6696
first_stage_pct_conversion =
0.1335