Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Process Modelling, Simulation and Control for Chemical Engineer-

ing. Solved problems. Chapter 5: Simulation examples.


This document contains my own solutions to the problems proposed at the end of each chapter of the book
”Process Modelling, Simulation and Control for Chemical Engineers” Second Edition, by William L. Luyben.
As such, I can’t guarantee that the proposed solutions are free from errors. Think about them as a starting point
for developing or as a means of checking your own solutions. Any comments or corrections will be appreciated.
Contact me at francisco.angel.rod@gmail.com
The computer scripts used in this chapter (Python) are available at:
https://drive.google.com/drive/folders/1dXziWHQKDvn4NaEIFepX1GegTDs6C0-s?usp=sharing

Problem 1
The system corresponds to a non-isothermal CSTR, cooled by fluid circulating inside a jacket, modelled by the
following equations:
dV
= F0 − F (1)
dt
d
(V CA ) = F0 CA0 − F CA − V kCA (2)
dt
d λV kCA U AH
(V T ) = F0 T0 − F T − − (T − Tj ) (3)
dt ρCp ρCp
dTj Fj (Tj0 − Tj ) U AH
= + (T − Tj ) (4)
dt Vj ρj Cp,j Vj
k = αe−E/RT (5)
F = 40 − 10(48 − V ) (6)
Fj = 49.9 − Kc (600 − T ) (7)

Equations (1) and (2) are total and by-species mass balances at reactor, (3) is the energy balance, (4) is the
energy balance for the jacket, (5) is a kinetic equation, (6) and (7) are control equations for reactor discharge
rate and cooling flow rate. Both reactor and jacket are treated as CSTR’s. Values of the parameters are shown
in Table 1.

Table 1: Parameter values.


F0 = 40 [ft3 /h] Vj = 3.85 [ft3 ] T0 = 530 [◦ R]
E = 30000 [BTU/lbmol] Cp = 0.75 [BTU/lbmol ◦ R] U = 150 [BTU/h ft2 ◦ R]
Tj0 = 530 [◦ R] ρ = 50 [lbm /ft3 ] Kc = 4 [ft/h ◦ R]
α = 7.08 ∗ 1010 [h−1 ] R = 1.99 [BTU/lbmol ◦ R] Ah = 250 [ft2 ]
λ = −30000 [BTU/lbmol] Cp,j = 1 [BTU/lbmol ◦ R] ρj = 62.3 [lbm/ft3 ]

Starting values of the variables correspond to steady state values for CA0 = 0.50, the perturbation is an increase
in feed concentration to CA0 = 0.55.
First the results for the solution of the problem using the parameters given in the text, this is using a time step
of 0.01 and the Euler method, are shown in Figure 1.
For this time step the results of all monitored variables converge to steady state values for t = 3 [h]. The
calculation was repeated using different time step sizes. The accuracy calculation was carried out by comparing
the values of CA , T and Tj for a given solution (∆t), with the solution using a time step equal to 0.5∆t.
The maximum time step for the Euler method was 0.01098, with the values for the error shown in Table 2. The
results are shown in Figure 2. The greatest average error corresponds to the jacket temperature, even oscillating
at the end of the simulation period. 455 time steps were performed (455 derivative evaluations).

Table 2: Error results, Euler method.


Error(%) CA T Tj
Average 4.26 ∗ 10−3 1.58 ∗ 10−3 0.01108
Max. 0.02416 0.00345 0.0284

The maximum time step for the Runge-Kutta method was 0.01529, with the error values shown in Table 3.
The results are shown in Figure 3. Again the jacket temperature has the greatest average error. 327 time steps

1
0.258
602
0.256
601

Concentration [lbmol/ft^3]
600 0.254
Temperature [R]

599 0.252
598 0.250
597
0.248
596
T 0.246
595 Tj
0 1 2 3 4 0 1 2 3 4
Time [h] Time [h]

Figure 1: Results for ∆t = 0.01, Euler method.

0.258
602
0.256
601 Concentration [lbmol/ft^3]
600 0.254
Temperature [R]

599 0.252
598 0.250
597
0.248
596
T 0.246
595 Tj
0 1 2 3 4 5 0 1 2 3 4 5
Time [h] Time [h]

Figure 2: Results for ∆t = 0.01098, Euler method.

were carried out, equivalent to 1308 derivative evaluations. From the results obtained, in this particular case,
the Euler method solves the problem at the accuracy required with fewer derivative evaluations.
Code(s) used: P1 errorAnalysis.py P1 graphs.py P1 nonIsothermalCSTR.py

Table 3: Error results, Runge-Kutta method.


Error(%) CA T Tj
Average 1 ∗ 10−4 2.02 ∗ 10−3 0.01635
Max. 2 ∗ 10−4 6.87 ∗ 10−3 0.05522

Problem 2
The system is an ideal binary distillation column with liquid hold up, which is modelled by the following
equations:
dMn
= Ln+1 − Ln (8)
dt
d
(Mn xn ) = Ln+1 xn+1 + V yn−1 − Ln xn − V yn (9)
dt
αxn
yn = (10)
1 + (α − 1)xn
Mn − Mn∗
Ln = L∗n + (11)
β
Equations (8) and (9) are total and by-component mass balances at each tray, (10) is vapor-liquid phase
equilibrium equation, and (11) is a liquid hydraulic relationship. The perturbation corresponds to an increase

2
0.258
602
0.256
601

Concentration [lbmol/ft^3]
0.254
600
Temperature [R]

599 T 0.252
Tj
598 0.250
597
0.248
596
595 0.246

0 1 2 3 4 5 0 1 2 3 4 5
Time [h] Time [h]

Figure 3: Results for ∆t = 0.01529, Runge-Kutta method.

in feed composition from Z = 0.50 to Z = 0.55. Both the reboiler and condenser composition are controlled
varying the vapor flow rate V and reflux rate R, respectively, with set point values of 0.02 and 0.98.
First the results for the solution of the problem using the parameters given in the text, this is using a time step
of 0.005 and the Euler method are shown in Figure 4.

0.9808
0.0225 0.9807
0.0220 0.9806
Condenser composition
Reboiler composition

0.0215 0.9805
0.9804
0.0210
0.9803
0.0205
0.9802
0.0200 0.9801
0.0195 0.9800
0 5 10 15 20 25 0 5 10 15 20 25
Time Time

Figure 4: Results for ∆t = 0.005, Euler method.

The code was modified in the same way as for Problem 1, the accuracy was calculated comparing the values of
reboiler composition (XB) and condenser composition (XD), between the solution using a time step ∆t and the
solution using a time step equal to 0.5∆t, with 0.1% as criterion for the maximum error.
The results for the error are shown in Table 4. For the Runge-Kutta the maximum ∆t was 0.27, the results are
shown in Figure 5. The greatest values for the error are for the reboiler composition (XB). The results are in
good agreement compared to Figure 4, 909 time steps were performed, equivalent to 3636 derivative evaluations.

Table 4: Results for error.


Euler Runge-Kutta
Error XB XD XB XD
Average 0.037 2.2 ∗ 10−4 0.021 1.4 ∗ 10−4
Maximum 0.10 7.1 ∗ 10−4 0.10 5.9 ∗ 10−4

For the Euler method, the maximum value of ∆t was 0.0135. The results are shown in Figure 6. Again
the greatest error values correspond to XB. 1852 time steps were performed, equivalent to 1852 derivative
evaluations.
For this particular problem, the Euler method solves the problem under the constraints imposed using fewer
derivative evaluations.
Code(s) used: P2 BinaryDistillation.py P2 errorAnalysis.py P2 graphs.py

3
0.9808
0.0225 0.9807
0.0220 0.9806

Condenser composition
Reboiler composition

0.0215 0.9805
0.9804
0.0210
0.9803
0.0205
0.9802
0.0200 0.9801
0.0195 0.9800
0 5 10 15 20 25 0 5 10 15 20 25
Time Time

Figure 5: Results for ∆t = 0.027, Runge-Kutta method.

0.9808
0.0225 0.9807
0.0220 0.9806
Condenser composition
Reboiler composition

0.0215 0.9805
0.9804
0.0210
0.9803
0.0205
0.9802
0.0200 0.9801
0.0195 0.9800
0 5 10 15 20 25 0 5 10 15 20 25
Time Time

Figure 6: Results for ∆t = 0.0135, Euler method.

Problem 3
The mass balance for component A at lump i is:
dCA,i
Vg = A(CA,i−1 vi−1 − CA,i vi ) − V akCA,i (12)
dt
where A is the transverse area of the reactor, and the chemical reaction was considered to occur at the surface
of the packing, the packing temperature was used to calculate the specific reaction rate.
Energy balance for the gas phase (the heat of reaction was considered to be absorbed entirely by the gas phase):
dTg,i
Cp,g Mg = −V ah(Tg,i − Tp,i ) − V aλkCA,i + ACp,g ((vρT )g,i−1 − (vρT )g,i ) (13)
dt
Energy balance for the packing:
dTp,i
Cp,p Mp = V ah(Tg,i − Tp,i ) (14)
dt
The velocity was calculated assuming a constant mass flow across each section, based on the conditions at
the entrance of the reactor. Pressure drop was assumed negligible. The results for concentration are shown
in Figure 7, steady state values are reached after approximately 400 [s]. The concentration increase in a
short period, of approximately 5 seconds, as can be seen in Figure 7(right). The final values obtained are
Ci = [1.07, 0.161, 0.0253, 0.00403, 0.000648]10−4 [lbmol/ft3 ], respectively.
The results for the packing and gas temperature are shown in Figure 8. The profiles looks almost identical,
this is due to the high value of the heat transfer coefficient. The final values of gas temperature are Ti =
[921, 986, 992, 981, 959]◦ F, the values of packing temperature are similar. Temperature values influence the
concentration profile (due to kinetic constant), but the effect seems to be small, because the concentration
profile reaches almost steady values before temperature profile.

4
1.6 1.6
Concentration*10**4 [lbmol/ft**3]

Concentration*10**4 [lbmol/ft**3]
1.4 1.4
1.2 1.2
1.0 L0 1.0 L0
L1 L1
0.8 L2 0.8 L2
L3 L3
0.6 L4 0.6 L4
0.4 0.4
0.2 0.2
0.0 0.0
0 100 200 300 400 500 600 0 5 10 15 20 25 30
Time [s] Time [s]

Figure 7: Concentration profile.

The temperature values decrease along the reactor at the start of the process, when the concentration of A at the
inlet of the reactor is increased. At the end of the simulation the temperature increases along the reactor, which
is expected for the steady solution because the reactor don’t have heat losses. From the concentration graph
it is observed that the majority of the reaction occurs in the first lump, which correspond to the temperature
increase from around 500[◦ F] at inlet to 900 [◦ F] at first lump, whereas for the next lumps the temperature
increase is around 100 [◦ F] at most.
Code(s) used: P3 graphs.py P3 Lumped.py

1000 L0 1000 L0
L1 L1
900 L2 900 L2
L3 L3
Solid temperature [F]

Gas temperature [F]

L4 L4
800 800

700 700

600 600

500 500
0 200 400 600 800 1000 1200 0 200 400 600 800 1000 1200
Time [s] Time [s]

Figure 8: Packing temperature (left) and gas temperature (right) profiles.

Problem 4
The inlet temperature as a function of time is shown in Figure 10. For every flow rate, the fluid velocity inside
the pipe can be calculated as:
v = q/Ap
where q is the flow rate and Ap is the cross sectional area of the pipe. The results for the velocity as a function
of time are shown in Figure 11.
For the fluid entering the pipe at time t, the time required for it to exit at the other end (travel time) was
determined. A recursive function (ttime t) was used (Figure 9):
• The inputs of the function are: t time at which the fluid enters the pipe; tstart: an array containing
the times at which the various velocity regimes start; vel: the velocity values for each regime; ind: an
index indicating at which velocity regime the fluid enters the pipe, and finally L: the distance that the
fluid needs to travel before reaching the end of the pipe.
• First, it is assumed that the fluid reaches the end of the pipe under the same velocity regime at which
entered.

5
• It is verified that the travel time obtained this way is consistent with the previous assumption, this is if
t+ttime<=tstart(ind+1).
• If the fluid travels through the pipe under more than one velocity regime, then a recursive call to ttime
is done, and the travel time is the the sum of tstart[ind+1]-t, and the result of calling ttime with
entering time tstart[ind+1] and the travel distance reduced accordingly.

ttime t(t,tstart,vel,ind,L)

Assume constant velocity: vel[ind]

Calculate travel time:


ttime=L/vel[ind]

Check if
ttime+t<=tstart[ind+1] Yes

No Return ttime

Return (tstart[ind+1]-t)+ttime t(t*,tstart,vel,ind*,L*)


t* = tstart[ind+1]
ind*=ind+1
L* = L-vel[ind](tstart[ind+1]-t)

Figure 9: Algorithm for calculation of travel time.

The outlet temperature at t+ttime is the inlet temperature at t. The results are shown in Figure 10. It can be
noted that in the transition from a flow rate of 1000 [gpm] to 500 [gpm] the outlet looks wider (as compared to
inlet oscillations), because the retardation experienced by the signal. The contrary is observed in the transition
from 500 [gpm] to 2000 [gpm], where the oscillations looks thinner. It must be remembered that for a single
value of the dead time, the oscillations travel the pipe unchanged, regardless of the velocity with which they
are travelling.
Code(s) used: P4 deadTime.py

110.0 110.0
107.5 107.5
105.0 105.0
Outlet temperature [F]
Inlet Temperature [F]

102.5 102.5
100.0 100.0
97.5 97.5
95.0 95.0
92.5 92.5
90.0 90.0
0 2 4 6 8 10 0 2 4 6 8 10
Time [min] Time [min]

Figure 10: Left: inlet temperature, right: outlet temperature.

Donations
If you want to make a donation, use my PayPal account: francisco.angel.rod@gmail.com

6
1400 0.9

1200 0.8
0.7
Fluid velocity [ft/min]

Travel time [min]

1000
0.6
800 0.5
600 0.4
0.3
400
0.2
0 2 4 6 8 10 0 2 4 6 8 10
Time [min] Time [min]

Figure 11: Left: fluid velocity, right: travel time.

You might also like