You are on page 1of 55

A COLLECTION OF TEN NUMERICAL PROBLEMS IN

CHEMICAL ENGINEERING SOLVED BY VARIOUS


MATHEMATICAL SOFTWARE PACKAGES

Michael B. Cutlip, Department of Chemical Engineering, Box U-222, University


of Connecticut, Storrs, CT 06269-3222 (mcutlip@uconnvm.uconn.edu)
John J. Hwalek, Department of Chemical Engineering, University of Maine,
Orono, ME 04469 (hwalek@maine.maine.edu)
H. Eric Nuttall, Department of Chemical and Nuclear Engineering, University
of New Mexico, Albuquerque, NM 87134-1341 (nuttall@unm.edu)
Mordechai Shacham, Department of Chemical Engineering, Ben-Gurion Uni-
versity of the Negev, Beer Sheva, Israel 84105 (shacham@bgumail.bgu.ac.il)
Joseph Brule, John Widmann, Tae Han, and Bruce Finlayson, Department of
Chemical Engineering, University of Washington, Seattle, WA 98195-1750
(finlayson@cheme.washington.edu)
Edward M. Rosen, EMR Technology Group, 13022 Musket Ct., St. Louis, MO
63146 (EMRose@compuserve.com)
Ross Taylor, Department of Chemical Engineering, Clarkson University, Pots-
dam, NY 13699-5705 (taylor@sun.soe.clarkson.edu)

ABSTRACT
Current personal computers provide exceptional computing capabilities to engineer-
ing students that can greatly improve speed and accuracy during sophisticated prob-
lem solving. The need to actually create programs for mathematical problem solving
has been reduced if not eliminated by available mathematical software packages.
This paper summarizes a collection of ten typical problems from throughout the
chemical engineering curriculum that requires numerical solutions. These problems
involve most of the standard numerical methods familiar to undergraduate engineer-
ing students. Complete problem solution sets have been generated by experienced
users in six of the leading mathematical software packages. These detailed solutions
including a write up and the electronic files for each package are available through
the INTERNET at www.che.utexas.edu/cache and via FTP from ftp.engr.uconn.edu/
pub/ASEE/. The written materials illustrate the differences in these mathematical
software packages. The electronic files allow hands-on experience with the packages
during execution of the actual software packages. This paper and the provided
resources should be of considerable value during mathematical problem solving and/
or the selection of a package for classroom or personal use.

iNTRODUCTION
Session 12 of the Chemical Engineering Summer School* at Snowbird, Utah on

* The Ch. E. Summer School was sponsored by the Chemical Engineering Division of the American
Society for Engineering Education.

Page 1
Page 2 A COLLECTION OF TEN NUMERICAL PROBLEMS

August 13, 1997 was concerned with “The Use of Mathematical Software in Chemical Engineering.”
This session provided a major overview of three major mathematical software packages (MathCAD,
Mathematica, and POLYMATH), and a set of ten problems was distributed that utilizes the basic
numerical methods in problems that are appropriate to a variety of chemical engineering subject
areas. The problems are titled according to the chemical engineering principles that are used, and the
numerical methods required by the mathematical modeling effort are identified. This problem set is
summarized in Table 1.

Table 1 Problem Set for Use with Mathematical Software Packages

MATHEMATICAL
SUBJECT AREA PROBLEM TITLE MODEL PROBLEM

Introduction to Molar Volume and Compressibility Factor Single Nonlinear 1


Ch. E. from Van Der Waals Equation Equation

Introduction to Steady State Material Balances on a Sep- Simultaneous Lin- 2


Ch. E. aration Train* ear Equations

Mathematical Vapor Pressure Data Representation by Polynomial Fit- 3


Methods Polynomials and Equations ting, Linear and
Nonlinear Regres-
sion

Thermodynamics Reaction Equilibrium for Multiple Gas Simultaneous 4


Phase Reactions* Nonlinear Equa-
tions

Fluid Dynamics Terminal Velocity of Falling Particles Single Nonlinear 5


Equation

Heat Transfer Unsteady State Heat Exchange in a Simultaneous 6


Series of Agitated Tanks* ODE’s with known
initial conditions.

Mass Transfer Diffusion with Chemical Reaction in a Simultaneous 7


One Dimensional Slab ODE’s with split
boundary condi-
tions.

Separation Binary Batch Distillation** Simultaneous Dif- 8


Processes ferential and Non-
linear Algebraic
Equations

Reaction Reversible, Exothermic, Gas Phase Reac- Simultaneous 9


Engineering tion in a Catalytic Reactor* ODE’s and Alge-
braic Equations

Process Dynamics Dynamics of a Heated Tank with PI Tem- Simultaneous Stiff 10


and Control perature Control** ODE’s

* Problem originally suggested by H. S. Fogler of the University of Michigan


** Problem preparation assistance by N. Brauner of Tel-Aviv University
A COLLECTION OF TEN NUMERICAL PROBLEMS Page 3

ADDITIONAL CONTRIBUTED SOLUTION SETS


After the ASEE Summer School, three more sets of solutions were provided by authors who had
considerable experience with additional mathematical software packages. The current total is now six
packages, and the packages (listed alphabetically) and authors are given below.

Excel - Edward M. Rosen, EMR Technology Group

Maple - Ross Taylor, Clarkson University

MathCAD - John J. Hwalek, University of Maine

MATLAB - Joseph Brule, John Widmann, Tae Han, and Bruce Finlayson, Department of Chemi-
cal Engineering, University of Washington

Mathematica - H. Eric Nuttall, University of New Mexico

POLYMATH - Michael B. Cutlip, University of Connecticut and Mordechai Shacham, Ben-


Gurion University of the Negev

The complete problem set has now been solved with the following mathematical software pack-
ages: Excel*, Maple†, MathCAD‡, MATLAB•, Mathematica#, and Polymath¶. As a service to the aca-
demic community, the CACHE Corporation** provides this problem set as well as the individual
package writeups and problem solution files for downloading on the WWW at http://
www.che.utexas.edu/cache/. The problem set and details of the various solutions (about 300 pages) are
given in separate documents as Adobe PDF files. The problem solution files can be executed with the
particular mathematical software package. Alternately, all of these materials can also be obtained
from an FTP site at the University of Connecticut: ftp.engr.uconn.edu/pub/ASEE/

USE OF THE PROBLEM SET


The complete problem writeups from the various packages allow potential users to examine the
detailed treatment of a variety of typical problems. This method of presentation should indicate the
convenience and strengths/weaknesses of each of the mathematical software packages. The problem
files can be executed with the corresponding software package to obtain a sense of the package opera-
tion. Parameters can be changed, and the problems can be resolved. These activities should be very
helpful in the evaluation and selection of appropriate software packages for personal or educational
use.
Additionally attractive for engineering faculty is that individual problems from the problem set
can be easily integrated into existing coursework. Problem variations or even open-ended problems
can quickly be created. This problem set and the various writeups should be helpful to engineering
faculty who are continually faced with the selection of a mathematical problem solving package for
* Excel is a trademark of Microsoft Corporation (http://www.microsoft.com)
† Maple is a trademark of Waterloo Maple, Inc. (http://maplesoft.com)
‡ MathCAD is a trademark of Mathsoft, Inc. (http://www.mathsoft.com)
• MATLAB is a trademark of The Math Works, Inc. (http://www.mathworks.com)
# Mathematica is a trademark of Wolfram Research, Inc. (http://www.wolfram.com)
¶ POLYMATH is copyrighted by M. B. Cutlip and M. Shacham (http://www.che.utexas/cache/)
** The CACHE Corporation is non-profit educational corporation supported by most chemical engineering departments
and many chemical corporation. CACHE stands for computer aides for chemical engineering. CACHE can be contacted
at P. O. Box 7939, Austin, TX 78713-7939, Phone: (512)471-4933 Fax: (512)295-4498, E-mail: cache@uts.cc.utexas.edu,
Internet: http://www.che.utexas/cache/
Page 4 A COLLECTION OF TEN NUMERICAL PROBLEMS

use in conjunction with their courses.

THE TEN PROBLEM SET


The complete problem set is given in the Appendix to this paper. Each problem statement carefully
identifies the numerical methods used, the concepts utilized, and the general problem content.

APPENDIX
(Note to Reviewers - The Appendix which follows can either be printed with the article or provided
by the authors as a Acrobat PDF file for the disk which normally accompanies the CAEE Journal. File
size for the PDF document is about 135 Kb.)
A COLLECTION OF TEN NUMERICAL PROBLEMS Page 5

1. MOLAR VOLUME AND COMPRESSIBILITY FACTOR FROM VAN DER WAALS EQUATION

1.1 Numerical Methods


Solution of a single nonlinear algebraic equation.

1.2 Concepts Utilized


Use of the van der Waals equation of state to calculate molar volume and compressibility factor for a
gas.

1.3 Course Useage


Introduction to Chemical Engineering, Thermodynamics.

1.4 Problem Statement


The ideal gas law can represent the pressure-volume-temperature (PVT) relationship of gases only at
low (near atmospheric) pressures. For higher pressures more complex equations of state should be
used. The calculation of the molar volume and the compressibility factor using complex equations of
state typically requires a numerical solution when the pressure and temperature are specified.
The van der Waals equation of state is given by

 P + ------
a
- ( V – b ) = RT (1)
 2
V
where
2 2
27  R T c 
a = ------  -------------- (2)
64  P c 

and
RT c
b = ----------- (3)
8P c

The variables are defined by


P = pressure in atm
V = molar volume in liters/g-mol
T = temperature in K
R = gas constant (R = 0.08206 atm.liter/g-mol.K)
Tc = critical temperature (405.5 K for ammonia)
Pc = critical pressure (111.3 atm for ammonia)
Page 6 A COLLECTION OF TEN NUMERICAL PROBLEMS

Reduced pressure is defined as


P
P r = ------ (4)
Pc

and the compressibility factor is given by


PV
Z = --------- (5)
RT

(a) Calculate the molar volume and compressibility factor for gaseous ammonia at a pressure
P = 56 atm and a temperature T = 450 K using the van der Waals equation of state.
(b) Repeat the calculations for the following reduced pressures: Pr = 1, 2, 4, 10, and 20.
(c) How does the compressibility factor vary as a function of Pr.?
A COLLECTION OF TEN NUMERICAL PROBLEMS Page 7

2. STEADY STATE MATERIAL BALANCES ON A SEPARATION TRAIN

2.1 Numerical Methods


Solution of simultaneous linear equations.

2.2 Concepts Utilized


Material balances on a steady state process with no recycle.

2.3 Course Useage


Introduction to Chemical Engineering.

2.4 Problem Statement


Xylene, styrene, toluene and benzene are to be separated with the array of distillation columns that is
shown below where F, D, B, D1, B1, D2 and B2 are the molar flow rates in mol/min.
7% Xylene
D1
{ 4% Styrene
54% Toluene
35% Benzene
#2
D

18% Xylene

15% Xylene
25% Styrene
#1
B1
{ 24% Styrene
42% Toluene
16% Benzene
40% Toluene
15% Xylene

{
20% Benzene D2 10% Styrene
54% Toluene
F=70 mol/min 21% Benzene

#3
B

24% Xylene
B2
{ 65% Styrene
10% Toluene
1% Benzene
Figure 1 Separation Train
Page 8 A COLLECTION OF TEN NUMERICAL PROBLEMS

Material balances on individual components on the overall separation train yield the equation set
Xylene: 0.07D 1 + 0.18B 1 + 0.15D 2 + 0.24B 2 = 0.15 × 70
Styrene: 0.04D 1 + 0.24B 1 + 0.10D 2 + 0.65B 2 = 0.25 × 70
(6)
Toluene: 0.54D 1 + 0.42B 1 + 0.54D 2 + 0.10B 2 = 0.40 × 70
Benzene: 0.35D 1 + 0.16B 1 + 0.21D 2 + 0.01B 2 = 0.20 × 70

Overall balances and individual component balances on column #2 can be used to determine the
molar flow rate and mole fractions from the equation of stream D from
Molar Flow Rates: D = D1 + B1

Xylene: XDxD = 0.07D1 + 0.18B1


Styrene: XDsD = 0.04D1 + 0.24B1 (7)
Toluene: XDtD = 0.54D1 + 0.42B1
Benzene: XDbD = 0.35D1 + 0.16B1

where XDx = mole fraction of Xylene, XDs = mole fraction of Styrene, XDt = mole fraction of Toluene,
and XDb = mole fraction of Benzene.
Similarly, overall balances and individual component balances on column #3 can be used to
determine the molar flow rate and mole fractions of stream B from the equation set
Molar Flow Rates: B = D2 + B2

Xylene: XBxB = 0.15D2 + 0.24B2


Styrene: XBsB = 0.10D2 + 0.65B2 (8)
Toluene: XBtB = 0.54D2 + 0.10B2
Benzene: XBbB = 0.21D2 + 0.01B2

(a) Calculate the molar flow rates of streams D1, D2, B1 and B2.
(b) Determine the molar flow rates and compositions of streams B and D.
A COLLECTION OF TEN NUMERICAL PROBLEMS Page 9

3. VAPOR PRESSURE DATA REPRESENTATION BY POLYNOMIALS AND EQUATIONS

3.1 Numerical Methods


Regression of polynomials of various degrees. Linear regression of mathematical models with variable
transformations. Nonlinear regression.

3.2 Concepts Utilized


Use of polynomials, a modified Clausius-Clapeyron equation, and the Antoine equation to model
vapor pressure versus temperature data

3.3 Course Useage


Mathematical Methods, Thermodynamics.

3.4 Problem Statement


Table (2) presents data of vapor pressure versus temperature for benzene. Some design calculations

Table 2 Vapor Pressure of Benzene (Perry3)

Temperature, T Pressure, P
(oC) (mm Hg)
-36.7 1
-19.6 5
-11.5 10
-2.6 20
+7.6 40
15.4 60
26.1 100
42.2 200
60.6 400
80.1 760

require these data to be accurately correlated by various algebraic expressions which provide P in
mmHg as a function of T in °C.
A simple polynomial is often used as an empirical modeling equation. This can be written in gen-
eral form for this problem as

P = a 0 + a 1 T + a 2 T 2 + a 3 T 3 + ...+a n T n (9)

where a0... an are the parameters (coefficients) to be determined by regression and n is the degree of
the polynomial. Typically the degree of the polynomial is selected which gives the best data represen-
Page 10 A COLLECTION OF TEN NUMERICAL PROBLEMS

tation when using a least-squares objective function.


The Clausius-Clapeyron equation which is useful for the correlation of vapor pressure data is
given by
B
log ( P ) = A – --------------------------- (10)
T + 273.15
where P is the vapor pressure in mmHg and T is the temperature in °C. Note that the denominator is
just the absolute temperature in K. Both A and B are the parameters of the equation which are typi-
cally determined by regression.
The Antoine equation which is widely used for the representation of vapor pressure data is given
by
B
log ( P ) = A – --------------- (11)
T+C
where typically P is the vapor pressure in mmHg and T is the temperature in °C. Note that this equa-
tion has parameters A, B, and C which must be determined by nonlinear regression as it is not possi-
ble to linearize this equation. The Antoine equation is equivalent to the Clausius-Clapeyron equation
when C = 273.15.

(a) Regress the data with polynomials having the form of Equation (9). Determine the degree of
polynomial which best represents the data.
(b) Regress the data using linear regression on Equation (10), the Clausius-Clapeyron equation.
(c) Regress the data using nonlinear regression on Equation (11), the Antoine equation.
A COLLECTION OF TEN NUMERICAL PROBLEMS Page 11

4. REACTION EQUILIBRIUM FOR MULTIPLE GAS PHASE REACTIONS

4.1 Numerical Methods


Solution of systems of nonlinear algebraic equations.

4.2 Concepts Utilized


Complex chemical equilibrium calculations involving multiple reactions.

4.3 Course Useage


Thermodynamics or Reaction Engineering.

4.4 Problem Statement


The following reactions are taking place in a constant volume, gas-phase batch reactor.
A+B↔C+D
B+C↔ X+Y
A+ X↔Z
A system of algebraic equations describes the equilibrium of the above reactions. The nonlinear
equilibrium relationships utilize the thermodynamic equilibrium expressions, and the linear relation-
ships have been obtained from the stoichiometry of the reactions.
CC C D C X CY CZ
K C1 = ---------------- K C2 = ----------------- K C3 = -----------------
C ACB C B CC C AC X
(12)
C A = C A0 – C D – C Z C B = C B0 – C D – C Y
CC = C D – CY CY = C X + C Z

In this equation set C A , C B , C C , C D , C X , C Y and C Z are concentrations of the various species at


equilibrium resulting from initial concentrations of only CA0 and CB0. The equilibrium constants KC1,
KC2 and KC3 have known values.

Solve this system of equations when CA0 = CB0 = 1.5, K C1 = 1.06 , K C2 = 2.63 and K C3 = 5
starting from four sets of initial estimates.
(a) C D = C X = C Z = 0
(b) C D = C X = C Z = 1
(c) C D = C X = C Z = 10
Page 12 A COLLECTION OF TEN NUMERICAL PROBLEMS

5. TERMINAL VELOCITY OF FALLING PARTICLES

5.1 Numerical Methods


Solution of a single nonlinear algebraic equation..

5.2 Concepts Utilized


Calculation of terminal velocity of solid particles falling in fluids under the force of gravity.

5.3 Course Useage


Fluid dynamics.

5.4 Problem Statement


A simple force balance on a spherical particle reaching terminal velocity in a fluid is given by
4 g ( ρ p – ρ )D p
vt = ------------------------------------- (13)
3C D ρ

where v t is the terminal velocity in m/s, g is the acceleration of gravity given by g = 9.80665 m/s2, ρ p
is the particles density in kg/m3, ρ is the fluid density in kg/m3, D p is the diameter of the spherical
particle in m and CD is a dimensionless drag coefficient.
The drag coefficient on a spherical particle at terminal velocity varies with the Reynolds number
(Re) as follows (pp. 5-63, 5-64 in Perry3).
24
C D = ------- for Re < 0.1 (14)
Re

24 0.7
C D = ------- ( 1 + 0.14 Re ) for 0.1 ≤ Re ≤ 1000 (15)
Re

C D = 0.44 for 1000 < Re ≤ 350000 (16)

4
C D = 0.19 – 8 ×10 ⁄ Re for 350000 < Re (17)

where Re = D p v t ρ ⁄ µ and µ is the viscosity in Pa⋅s or kg/m⋅s.

(a) Calculate the terminal velocity for particles of coal with ρp = 1800 kg/m3 and D p =
0.208×10-3 m falling in water at T = 298.15 K where ρ = 994.6 kg/m3 and µ = 8.931×10−4 kg/
m⋅s.
(b) Estimate the terminal velocity of the coal particles in water within a centrifugal separator
where the acceleration is 30.0 g.
A COLLECTION OF TEN NUMERICAL PROBLEMS Page 13

6. HEAT EXCHANGE IN A SERIES OF TANKS

6.1 Numerical Methods


Solution of simultaneous first order ordinary differential equations.

6.2 Concepts Utilized


Unsteady state energy balances, dynamic response of well mixed heated tanks in series.

6.3 Course Useage


Heat Transfer.

6.4 Problem Statement


Three tanks in series are used to preheat a multicomponent oil solution before it is fed to a distillation
column for separation as shown in Figure (2). Each tank is initially filled with 1000 kg of oil at 20°C.
Saturated steam at a temperature of 250°C condenses within coils immersed in each tank. The oil is
fed into the first tank at the rate of 100 kg/min and overflows into the second and the third tanks at
the same flow rate. The temperature of the oil fed to the first tank is 20°C. The tanks are well mixed
so that the temperature inside the tanks is uniform, and the outlet stream temperature is the temper-
ature within the tank. The heat capacity, Cp, of the oil is 2.0 KJ/kg. For a particular tank, the rate at
which heat is transferred to the oil from the steam coil is given by the expression
Q = UA ( T steam – T ) (18)

where UA = 10 kJ/min·°C is the product of the heat transfer coefficient and the area of the coil for
each tank, T = temperature of the oil in the tank in °C , and Q = rate of heat transferred in kJ/min.

Steam Steam Steam

T0=20oC T1 T2 T3

W1=100 kg/min T1 T2 T3

Figure 2 Series of Tanks for Oil Heating

Energy balances can be made on each of the individual tanks. In these balances, the mass flow
rate to each tank will remain at the same fixed value. Thus W = W1 = W2 = W3. The mass in each tank
will be assumed constant as the tank volume and oil density are assumed to be constant. Thus M =
M1 = M2 = M3. For the first tank, the energy balance can be expressed by
Accumulation = Input - Output
dT 1
MC p ----------- = W C p T 0 + UA ( T steam – T 1 ) – W C p T 1 (19)
dt
Note that the unsteady state mass balance is not needed for tank 1 or any other tanks since the mass
Page 14 A COLLECTION OF TEN NUMERICAL PROBLEMS

in each tank does not change with time. The above differential equation can be rearranged and explic-
itly solved for the derivative which is the usual format for numerical solution.
dT 1
----------- = [ W C p ( T 0 – T 1 ) + UA ( T steam – T 1 ) ] ⁄ ( MC p ) (20)
dt
Similarly for the second tank
dT 2
----------- = [ W C p ( T 1 – T 2 ) + UA ( T steam – T 2 ) ] ⁄ ( MC p ) (21)
dt
For the third tank
dT 3
----------- = [ W C p ( T 2 – T 3 ) + UA ( T steam – T 3 ) ] ⁄ ( MC p ) (22)
dt

Determine the steady state temperatures in all three tanks. What time interval will be required
for T3 to reach 99% of this steady state value during startup?
A COLLECTION OF TEN NUMERICAL PROBLEMS Page 15

7. DIFFUSION WITH CHEMICAL REACTION IN A ONE DIMENSIONAL SLAB

7.1 Numerical Methods


Solution of second order ordinary differential equations with two point boundary conditions.

7.2 Concepts Utilized


Methods for solving second order ordinary differential equations with two point boundary values typ-
ically used in transport phenomena and reaction kinetics.

7.3 Course Useage


Transport Phenomena and Reaction Engineering.

7.4 Problem Statement


The diffusion and simultaneous first order irreversible chemical reaction in a single phase containing
only reactant A and product B results in a second order ordinary differential equation given by
2
d CA k
= ------------C A (23)
dz
2 D AB

where CA is the concentration of reactant A (kg mol/m3), z is the distance variable (m), k is the homo-
geneous reaction rate constant (s-1) and DAB is the binary diffusion coefficient (m2/s). A typical geom-
etry for Equation (23) is that of a one dimension layer which has its surface exposed to a known
concentration and allows no diffusion across its bottom surface. Thus the initial and boundary condi-
tions are
C A = C A0 for z = 0 (24)

dC A
= 0 for z = L (25)
dz
where CA0 is the constant concentration at the surface (z = 0) and there is no transport across the bot-
tom surface (z = L) so the derivative is zero.
This differential equation has an analytical solution given by

cosh [ L ( k ⁄ D AB ) ( 1 – z ⁄ L ) ]
C A = C A0 ----------------------------------------------------------------------------- (26)
cosh ( L k ⁄ D AB )
Page 16 A COLLECTION OF TEN NUMERICAL PROBLEMS

(a) Numerically solve Equation (23) with the boundary conditions of (24) and (25) for the case
where CA0 = 0.2 kg mol/m3, k = 10-3 s-1, DAB = 1.2 10-9 m2/s, and L = 10-3 m. This solution
should utilized an ODE solver with a shooting technique and employ Newton’s method or
some other technique for converging on the boundary condition given by Equation (25).
(b) Compare the concentration profiles over the thickness as predicted by the numerical solu-
tion of (a) with the analytical solution of Equation (26).
A COLLECTION OF TEN NUMERICAL PROBLEMS Page 17

8. BINARY BATCH DISTILLATION

8.1 Numerical Methods


Solution of a system of equations comprised of ordinary differential equations and nonlinear
algebraic equations.

8.2 Concepts Utilized


Batch distillation of an ideal binary mixture.

8.3 Course Useage


Separation Processes.

8.4 Problem Statement


For a binary batch distillation process involving two components designated 1 and 2, the moles of liq-
uid remaining, L, as a function of the mole fraction of the component 2, x2, can be expressed by the fol-
lowing equation
dL L
--------- = -------------------------- (27)
dx 2 x2 ( k2 – 1 )

where k2 is the vapor liquid equilibrium ratio for component 2. If the system may be considered ideal,
the vapor liquid equilibrium ratio can be calculated from k i = P i ⁄ P where Pi is the vapor pressure of
component i and P is the total pressure.
A common vapor pressure model is the Antoine equation which utilizes three parameters A, B,
and C for component i as given below where T is the temperature in °C.

 A – --------------
B 
-
 T + C
P i = 10 (28)

The temperature in the batch still follow the bubble point curve. The bubble point temperature
is defined by the implicit algebraic equation which can be written using the vapor liquid equilibrium
ratios as
k1 x1 + k2 x2 = 1 (29)

Consider a binary mixture of benzene (component 1) and toluene (component 2) which is to be


considered as ideal. The Antoine equation constants for benzene are A1 = 6.90565, B1 = 1211.033 and
C1 = 220.79. For toluene A2 = 6.95464, B2 = 1344.8 and C2 = 219.482 (Dean1). P is the pressure in mm
Hg and T the temperature in °C.

The batch distillation of benzene (component 1) and toluene (component 2) mixture is being car-
ried out at a pressure of 1.2 atm. Initially, there are 100 moles of liquid in the still, comprised of
60% benzene and 40% toluene (mole fraction basis). Calculate the amount of liquid remaining in
the still when concentration of toluene reaches 80%.
Page 18 A COLLECTION OF TEN NUMERICAL PROBLEMS

9. REVERSIBLE, EXOTHERMIC, GAS PHASE REACTION IN A CATALYTIC REACTOR

9.1 Numerical Methods


Simultaneous ordinary differential equations with known initial conditions.

9.2 Concepts Utilized


Design of a gas phase catalytic reactor with pressure drop for a first order reversible gas phase reac-
tion.

9.3 Course Useage


Reaction Engineering

9.4 Problem Statement


The elementary gas phase reaction 2 A C is carried out in a packed bed reactor. There is a heat
exchanger surrounding the reactor, and there is a pressure drop along the length of the reactor.

q
Ta
FA0 X
T0 T
Ta
q

Figure 3 Packed Bed Catalytic Reactor

The various parameters values for this reactor design problem are summarized in Table (3).

Table 3 Parameter Values for Problem 9.

CPA = 40.0 J/g-mol.K R = 8.314 J/g-mol.K


CPC = 80.0 J/g-mol.K FA0 = 5.0 g-mol/min
∆ H R = - 40,000 J/g-mol Ua = 0.8 J/kg.min.K
EA = 41,800 J/g-mol.K Ta = 500 K
k = 0.5 dm6/kg⋅min⋅mol @ 450 K α = 0.015 kg-1
KC = 25,000 dm3/g-mol @ 450 K P0 = 10 atm
CA0 = 0.271 g-mol/dm3 yA0 = 1.0 (Pure A feed)
T0 = 450 K
A COLLECTION OF TEN NUMERICAL PROBLEMS Page 19

(a) Plot the conversion (X), reduced pressure (y) and temperature (T ×10-3) along the reactor
from W = 0 kg up to W = 20 kg.
(b) Around 16 kg of catalyst you will observe a “knee” in the conversion profile. Explain why this
knee occurs and what parameters affect the knee.
(c) Plot the concentration profiles for reactant A and product C from W = 0 kg up to W = 20 kg.

Addition Information
The notation used here and the following equations and relationships for this particular problem are
adapted from the textbook by Fogler.2 The problem is to be worked assuming plug flow with no radial
gradients of concentrations and temperature at any location within the catalyst bed. The reactor
design will use the conversion of A designated by X and the temperature T which are both functions of
location within the catalyst bed specified by the catalyst weight W.
The general reactor design expression for a catalytic reaction in terms of conversion is a mole
balance on reactant A given by
dX
F A0 --------- = – r' A (30)
dW
The simple catalytic reaction rate expression for this reversible reaction is
CC
– r' A = k C 2A – -------- (31)
KC

where the rate constant is based on reactant A and follows the Arrhenius expression
EA 1 1
k = k ( @T=450°K ) exp -------- --------- – ---- (32)
R 450 T

and the equilibrium constant variation with temperature can be determined from van’t Hoff’s equa-
˜ = 0
tion with ∆C P

∆H R 1 1
K C = K C ( @T=450°K ) exp ------------- --------- – ---- (33)
R 450 T

The stoichiometry for 2 A C and the stoichiometric table for a gas allow the concentrations to
be expressed as a function of conversion and temperature while allowing for volumetric changes due
to decrease in moles during the reaction. Therefore

1 – X P T0 T0
C A = C A0  ----------------- ------ ------ = C A0  ---------------------- y ------
1–X
(34)
 1 + εX  P 0 T  1 – 0.5 X  T

and
P
y = ------
P0
(35)
0.5C A0 X T 0
CC =  ------------------------ y ------
 1 – 0.5 X  T
Page 20 A COLLECTION OF TEN NUMERICAL PROBLEMS

The pressure drop can be expressed as a differential equation (see Fogler2 for details)

d  ------
P
 P 0 – α ( 1 + εX ) P 0 T
---------------- = ----------------------------- ------ ------ (36)
dW 2 P T0

or

dy – α ( 1 – 0.5 X ) T
--------- = ---------------------------------- ------ (37)
dW 2y T0

The general energy balance may be written at

dT U a ( T a – T ) + r' A ( ∆ H R )
--------- = --------------------------------------------------------------- (38)
dW

F A0 ( θ i C Pi + X ∆C ˜ )
P

which for only reactant A in the reactor feed simplifies to

dT U a ( T a – T ) + r' A ( ∆ H R )
--------- = --------------------------------------------------------------- (39)
dW F A0 ( C PA )
A COLLECTION OF TEN NUMERICAL PROBLEMS Page 21

10. DYNAMICS OF A HEATED TANK WITH PI TEMPERATURE CONTROL

10.1 Numerical Methods


Solution of ordinary differential equations, generation of step functions, simulation of a proportional
integral controller.

10.2 Concepts Utilized


Closed loop dynamics of a process including first order lag and dead time. Padé approximation of time
delay.

10.3 Course Useage


Process Dynamics and Control

10.4 Problem Statement


A continuous process system consisting of a well-stirred tank, heater and PI temperature controller is
depicted in Figure (4). The feed stream of liquid with density of ρ in kg/m3 and heat capacity of C in
kJ / kg⋅°C flows into the heated tank at a constant rate of W in kg/min and temperature Ti in °C. The
volume of the tank is V in m3. It is desired to heat this stream to a higher set point temperature Tr in
°C. The outlet temperature is measured by a thermocouple as Tm in °C, and the required heater input
q in kJ/min is adjusted by a PI temperature controller. The control objective is to maintain T0 = Tr in
the presence of a change in inlet temperature Ti which differs from the steady state design tempera-
ture of Tis.

PI
controller

Heater TC Set point


Tr

Feed

W, Ti, ρ, Cp
q
Measured
Tm
V, T
W, T0, ρ, Cp

Thermocouple

Figure 4 Well Mixed Tank with Heater and Temperature Controller


Page 22 A COLLECTION OF TEN NUMERICAL PROBLEMS

Modeling and Control Equations


An energy balance on the stirred tank yields

dT W C p(T i – T ) + q
-------- = --------------------------------------------- (40)
dt ρV C p

with initial condition T = Tr at t = 0 which corresponds to steady state operation at the set point tem-
perature Tr..
The thermocouple for temperature sensing in the outlet stream is described by a first order sys-
tem plus the dead time τd which is the time for the output flow to reach the measurement point. The
dead time expression is given by
T 0 ( t ) = T ( t – τd ) (41)

The effect of dead time may be calculated for this situation by the Padé approximation which is a first
order differential equation for the measured temperature.

dT 0 τ d dT 2
----------- = T – T 0 –  -----  -------- ----- I. C. T0 = Tr at t = 0 (steady state) (42)
dt 2 dt τ d

The above equation is used to generated the temperature input to the thermocouple, T0.
The thermocouple shielding and electronics are modeled by a first order system for the input
temperature T0 given by

dT m T0 – Tm
------------ = --------------------- I. C. Tm = Tr at t = 0 (steady state) (43)
dt τm

where the thermocouple time constant τm is known.


The energy input to the tank, q, as manipulated by the proportional/integral (PI) controller can
be described by
Kc
∫0 ( T r – T m ) dt
t
q = q s + K c ( T r – T m ) + ------- (44)
τI

where Kc is the proportional gain of the controller, τI is the integral time constant or reset time. The qs
in the above equation is the energy input required at steady state for the design conditions as calcu-
lated by
q s = W C p ( T r – T is ) (45)

The integral in Equation (44) can be conveniently be calculated by defining a new variable as
d
( errsum ) = T r – T m I. C. errsum = 0 at t = 0 (steady state) (46)
dt
Thus Equation (44) becomes
Kc
q = q s + K c ( T r – T m ) + ------- ( errsum ) (47)
τI

Let us consider some of the interesting aspects of this system as it responds to a variety of parameter
Page 23 A COLLECTION OF TEN NUMERICAL PROBLEMS

and operational changes.The numerical values of the system and control parameters in Table (4) will
be considered as leading to baseline steady state operation.

Table 4 Baseline System and Control Parameters for Problem 10

ρVCp = 4000 kJ/°C WCp = 500 kJ/min⋅°C

Tis = 60 °C Tr = 80 °C

τd = 1 min τm = 5 min
Kc = 50 kJ/min⋅°C τI = 2 min

(a) Demonstrate the open loop performance (set Kc = 0) of this system when the system is ini-
tially operating at design steady state at a temperature of 80°C, and inlet temperature Ti is sud-
denly changed to 40°C at time t = 10 min. Plot the temperatures T, T0, and Tm to steady state,
and verify that Padé approximation for 1 min of dead time given in Equation (42) is working
properly.
(b) Demonstrate the closed loop performance of the system for the conditions of part (a) and the
baseline parameters from Table (4). Plot temperatures T, T0, and Tm to steady state.
(c) Repeat part (b) with Kc = 500 kJ/min⋅°C.
(d) Repeat part (c) for proportional only control action by setting the term Kc/τI = 0.
(e) Implement limits on q (as per Equation (47)) so that the maximum is 2.6 times the baseline
steady state value and the minimum is zero. Demonstrate the system response from baseline
steady state for a proportional only controller when the set point is changed from 80°C to 90°C at
t = 10 min. Kc = 5000 kJ/min⋅°C. Plot q and qlim versus time to steady state to demonstrate the lim-
its. Also plot the temperatures T, T0, and Tm to steady state to indicate controller performance
Page 24 A COLLECTION OF TEN NUMERICAL PROBLEMS

REFERENCES

1. Dean, A. (Ed.), Lange’s Handbook of Chemistry, New York: McGraw-Hill, 1973.


2. Fogler, H. S. Elements of Chemical Reaction Engineering, 2nd ed., Englewood Cliffs, NJ: Prentice-Hall,
1992.
3. Perry, R.H., Green, D.W., and Malorey, J.D., Eds. Perry’s Chemical Engineers Handbook. New York:
McGraw-Hill, 1984.
4. Shacham, M., Brauner; N., and Pozin, M. Computers Chem Engng., 20, Suppl. pp. S1329-S1334 (1996).
Page 25 A COLLECTION OF TEN NUMERICAL PROBLEMS
Page 26 A COLLECTION OF TEN NUMERICAL PROBLEMS
MATHCAD SOLUTIONS TO THE CHEMICAL
ENGINEERING PROBLEM SET

Mathematical Software Session

John J. Hwalek, Department of Chemical Engineering


University of Maine, Orono, Me 04469-5737 (hwalek@maine.maine.edu)

INTRODUCTION

This document contains Mathcad solutions for a set of chemical engineering problems developed
for the Use of Mathematical Software Packages in Chemical Engineering Education Session at the
ASEE Chemical Engineering Summer School held in Snowbird, Utah on August 13, 1997. The
problems chosen are representative of numerical problems that are typically found in most
chemical engineering undergraduate courses.

Mathcad is a commercial software package developed by MathSoft, Inc. It is widely used by


engineers, scientists and mathematicians in universities as well as industry. Mathcad allows for the
integration of equations, text and graphics in a WYSIWYG interface. It has built into it a wide
variety of numerical routines to solve problems including simultaneous nonlinear equations,
systems of ordinary differential equations, numerical integration and differentiation, regression
and curve fitting as well as many other powerful features. Complete details of Mathcad's features,
system requirements and academic pricing can be found on the MathSoft Web site
(www.mathsoft.com). The solutions presented here are available at the Chemical Engineering
Mathcad Users' Group Web site
( ftp://ftp.umecheme.maine.edu/mathcad/asee).
Page MC-2 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Mathcad Solution to Problem 1


Mathcad uses a structure called a solve block to solve non-linear equations. The solve block
starts with a Given statement and ends with a Find which includes the variables to be solved
for. Mathcad requires an initial guess of the solution before the start of the solve block. Note
that Mathcad allows for dimensional variables with automatic units conversion and the final
solution can be expressed in any desired units.

The equation to be solved is the van der Waals equation:

a .( V
P b ) R .T
2
V

Define the constants to be used in the calculations (units included).

atm .liter
R 0.08206 .
mole .K

For ammonia: Tc 405.5 . K Pc 111.3 .atm

2.
R .T c
2
27 . R T c atm .liter
2
liter
a a = 4.197 b b = 0.037
64 Pc mole
2 8 .P c mole

a) Specify T and P: P 56 .atm T 450 .K

Solve for the molar volume using a solve block


R .T liter
V V = 0.659
Initial guess of V using Ideal Gas Law: P mole

Given Start of Solve Block

a .( V
P b ) R .T Equation to be solved
2
V

liter
V Find( V ) V = 0.575 End of Solve Block
mole
P.V
Z Z = 0.872
R .T

In the Find statement above, Mathcad solves for the value of the unknown variable but does
not change the value of the variable (V). Therefore, the value of the solution of the equation is
assigned to the variable (V) so that it can be used in subsequent calculations (e.g., calculation
of the compressibility factor (Z).
Page MC-3 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

b) Reformulate solution in terms of Pr. One powerful feature of Mathcad is the ability to define a
function using a solve block. The argument of the function is one of the variables in the equation
being solved and the value of the function is the solution of the equation. In this case the molar
volume is defined as a function of the reduced pressure. The structure of the solve block is
essentially the same as in part a).
liter
Initial guess for volume: V 0.6 .
mole
Given

a .
P r .P c (V b ) R .T
2
V

P r . P c .V P r
V Pr Find( V ) Z Pr
R .T

i 1 .. 5 The variable i here is called a range variable and takes on a range of values, in
this case 1, 2, ..., 5. This is similar to an index variable in a counted loop. Pr is
an array of values specified in the problem statement.

Pr V Pr
i i
Z Pr
liter .mole
1 i
1
0.704
2 0.234
0.466
4 0.077
0.731
10 0.061
1.533
20 0.051
2.783
0.046
c) The reduced pressure can be defined as a range variable and the molar volume can then be
plotted as a function of reduced pressure.
Pr 0.1 , 0.2 .. 50
8

7
6

5
Z Pr 4

3
2

1
0
0 5 10 15 20 25 30 35 40 45 50
Pr
Page MC-4 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Mathcad Solution to Problem 2

There are two approaches to solving this problem in Mathcad. The first is to simply include
all of the equations in a Solve Block and solve for the unknown variables. This simplifies the
formulation of the numerical problem because the problem does not need to be rewritten in
matrix form. In the second method, the problem is broken up into a problem requiring the
solution of 4 simultaneous linear equations followed by a series of simple algebraic equations.

First method solving all of the equations in a solve block

Defined feed rate and mole fractions.

F 70 x FX 0.15 x FS 0.25 x FT 0.4 x FB 0.2

x D1X 0.07 x D1S 0.04 x D1T 0.54 x D1B 0.35

x B1X 0.18 x B1S 0.24 x B1T 0.42 x B1B 0.16

x D2X 0.15 x D2S 0.10 x D2T 0.54 x D2B 0.21

x B2X 0.24 x B2S 0.65 x B2T 0.10 x B2B 0.01

F D D
Guess values of flow rates D D1 B1
and mole fractions: 2 2 2

F B B
B D2 B2
2 2 2

x DX 0.25 x DS 0.25 x DT 0.25 x DB 0.25

x BX 0.25 x BS 0.25 x BT 0.25 x BB 0.25


Page MC-5 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Given
Component balances over entire system

x FX .F x D1X . D 1 x B1X . B 1 x D2X . D 2 x B2X . B 2

x FS . F x D1S .D 1 x B1S .B 1 x D2S . D 2 x B2S .B 2

x FT . F x D1T .D 1 x B1T .B 1 x D2T . D 2 x B2T . B 2

x FB . F x D1B . D 1 x B1B .B 1 x D2B .D 2 x B2B .B 2

Overall Balances on columns #2 and #3


D D1 B1 B D2 B2
Component balances over column #2 Component balances over column #3
x DX .D x D1X .D 1 x B1X .B 1 x BX .B x D2X .D 2 x B2X .B 2

x DS .D x D1S .D 1 x B1S . B 1 x BS . B x D2S . D 2 x B2S .B 2

x DT .D x D1T .D 1 x B1T . B 1 x BT .B x D2T . D 2 x B2T . B 2

x DB .D x D1B .D 1 x B1B .B 1 x BB .B x D2B .D 2 x B2B . B 2

D
B
D1

B1

D2

B2

x DX

x DS Find D , B , D 1 , B 1 , D 2 , B 2 , x DX , x DS , x DT , x DB , x BX , x BS , x BT , x BB

x DXT

x DXB

x BX

x BS

x BT

x BB
Page MC-6 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Answer
D 1 = 26.25
D = 43.75 x DX = 0.114 x DS = 0.12 x DT = 0.25 x DB = 0.25
B 1 = 17.5

D 2 = 8.75
B = 26.25 x BX = 0.21 x BS = 0.467 x BT = 0.247 x BB = 0.077
B 2 = 17.5
The second method starts with the solution the component balances over the entire process.
This yields a system of four linear equations in four unknowns. The problem is formulated in
matrix form and is solved by matrix inversion.

x D1X x B1X x D2X x B2X x FX . F D1

x D1S x B1S x D2S x B2S x FS .F B1


A .b
1
A b
x D1T x B1T x D2T x B2T x FT .F D2

x D1B x B1B x D2B x B2B x FB .F B2

The remaining total and component balances yield a series of simple algebraic equations.
B D2 B2
D D1 B1
x D2X . D 2 x B2X . B 2
x D1X . D 1 x B1X . B 1 x BX
x DX B
D
x D2S .D 2 x B2S . B 2
x D1S .D 1 x B1S .B 1 x BS
x DS B
D
x D2T .D 2 x B2T .B 2
x D1T .D 1 x B1T .B 1 x BT
x DT B
D
x D2B .D 2 x B2B .B 2
x D1B .D 1 x B1B .B 1 x BB
x DB B
D

Answer
D 1 = 26.25
D = 43.75 x DX = 0.114 x DS = 0.12 x DT = 0.492 x DB = 0.274
B 1 = 17.5

D 2 = 8.75
B = 26.25 x BX = 0.21 x BS = 0.467 x BT = 0.247 x BB = 0.077
B 2 = 17.5
Page MC-7 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Mathcad Solution to Problem 3

There are a variety of ways to solve this problem in Mathcad. To fit a polynomial, the
Mathcad function, linfit, can be used to fit any linear combination of arbitrary functions in the
form y = a0 + a1*f 1(x) + a2*f 2(x) + ... + an*fn(x). Mathcad gives as the result the vector a, the
coefficients of the linear combination.

Both the Clausius-Clapeyron and Antoine equations can be rewritten in a form so that linear
regression can be used. Otherwise, a non-linear least-squares technique could be applied.

a) To fit an nth order polynomial, an vector containing the n+1 functions is used in the linfit
function. The function also requires the vectors containing the data. To calculate the
variance of the error, the Mathcad function var is used. This example shows the calculation
for the polynomial that gave the smallest variance. The variance for other polynomials is
shown in a table below.
36.7 1
Define vectors T and P containing the data:
19.6 5
11.5 10
Define the vector of functions, F(x), to be fit:
2.6 20
1
7.6 40
x T P
15.4 60
2
x
26.1 100
F( x ) 3
x 42.2 200
4
x 60.6 400
5 80.1 760
x
Use the last function to count the number of data points, ndata, and the number of terms in
the function array. Note that Mathcad starts vectors and matrices with index 0 as the default.
The last function actually gives the index of the last term in the vector.
ndata last( T ) i 0 .. ndata n last( F( 1 ) )
24.754264
Results:
1.609017
c linfit( T , P , F ) 0.035605 Order Variance
1 11,859
c= 4 2 852
4.129782 10
3 20
6 4 0.199
4.226066 10
5 0.1944
9 6 0.1210
2.505099 10
n
Calculate the errors
c. T
j
errori P var( error ) = 0.194361
and then the variance i j i
j=0
Page MC-8 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Plot the results for the polynomial fit

800

600
P
i

n
j 400
c. T
j i
j= 0

200

0
40 20 0 20 40 60 80 100
T
i

For the Clausius-Clapeyron and Antoine equations the equations can be rearranged into a form
so that linear regression can be used. By multiplying by the denominator of the second term on
the right hand side and rearranging algebraically, the following equations are obtained:

Clausius-Clapeyron: log(P) = A - B/(T+273.15)

Antoine: T*log(P) = A*T - C*log(P) + [A*C - B]

For the Clausius-Clapeyron equation linear regression can be used by setting y = log(P) and
x = 1/(T+273.15). The slope = -B and the intercept = A. Mathcad has slope and intercept
functions for linear regression.

For the Antoine equation, least squares is used using a psuedo-inverse calculation.

b) Fitting the Clausius-Clapeyron equation.


1
xi yi log Pi
Ti 273.15

A intercept( x , y ) A = 8.75201
3
B slope ( x , y ) B = 2.035 10
B 3
Calculate the errors errori log Pi A var( error ) = 6.073244 10
and then the variance Ti 273.15
Page MC-9 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Plot the results for the Clausius-Clapeyron equation


1000

P
i

B 500
A
T 273.15
i
10

0
220 240 260 280 300 320 340 360
T 273.15
i

c) Fitting the Antoine equation


Define the matrix M with first column Ti, second column -log(P i) and third column filled with 1's.

Mi , 0 Ti Mi , 1 log Pi Mi , 2 1

Define the vector b with columns Ti*log(Pi). bi Ti .log Pi


Solve for the coefficients using a psuedo-inverse calculation. A
1
K is defined as the combination A*C-B. A and C are found
M .M . MT . b
T
directly and B from the definition of K. C
K
B A .C K Results: A = 5.733 B = 665.423 C = 152.469

B
Calculate the errors errori log Pi A 4
Ti C var( error ) = 2.26 10
and then the variance

Plot the results for the Antoine equation


1000

P
i

B 500
A
T C
i
10

0
40 20 0 20 40 60 80 100
T
i
Page MC-10 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Mathcad Solution to Problem 4

This problem can be solved directly using a Mathcad Solve Block. The Solve Block includes
the equilibrium equations as well as the equations describing the stoichiometry. An initial
guess must be made for the concentrations. Initial guesses will be used as given.
Given initial concentrations and equilibrium constants: C A0 1.5 C B0 1.5

K C1 1.06 K C2 2.63 K C3 5

a) First set of initial guesses: CD 0 CX CD CZ CD

C A0 C B0 C A0
CA CB CC CY 0
2 2 2
Given

K C1 . C A .C B C C .C D K C2 . C B .C C C X .C Y K C3 . C A .C X CZ

C A C A0 CD CZ C B C B0 CD CY CC CD CY CY CX CZ

0.4207
0.2429
0.1536
Find C A , C B , C C , C D , C X , C Y , C Z = 0.7053
0.1778
0.5518
0.374

b) Second set of initial guesses: CD 1 CX CD CZ CD


Given

K C1 . C A .C B C C .C D K C2 . C B .C C C X .C Y K C3 . C A .C X CZ

C A C A0 CD CZ C B C B0 CD CY CC CD CY CY CX CZ

0.4207
0.2429
0.1536
Find C A , C B , C C , C D , C X , C Y , C Z = 0.7053
0.1778
0.5518
0.374
Page MC-11 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

c) Third set of initial guesses: CD 10 CX CD CZ CD


Given

K C1 . C A .C B C C .C D K C2 . C B .C C C X .C Y K C3 . C A .C X CZ

C A C A0 CD CZ C B C B0 CD CY CC CD CY CY CX CZ

0.4207
0.2429
0.1536
Find C A , C B , C C , C D , C X , C Y , C Z = 0.7053
0.1778
0.5518
0.374

Mathcad gives the same results for all sets of starting values.
Page MC-12 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Mathcad Solution to Problem 5


A Mathcad Solve Block will be used to solve the force balance for the terminal velocity, vt.
The drag coefficient can be defined using a Mathcad if function. The first argument in the if
function is a conditional. The second argument is an expression that defines the value of the
function if the conditional is true The third argument is an expression that defines the value of
the function if the conditional is false. In this case nested if functions are used for the three
cases.

Define the drag coefficient, CD, based on the value of the Reynolds number.

8 .10
4
24 24 .
0.14 .Re
0.7
C D ( Re ) if Re < 0.1 , , if Re < 1000 , 1 , if Re < 350000 , 0.44 , 0.19
Re Re Re

a) Define the physical properties and dimensions of the system

kg
0.208 .10 .m 1800 .
3
Particle diameter and density Dp ρp
3
m

4 kg kg
Fluid viscosity and density µ 8.931 .10 . ρ 994.6 .
m . sec m
3

Define the Reynolds number as D p .ρ .v t


Re v t
a function of the terminal velocity: µ

m
vt 1.
Guess a starting value of the terminal velocity: sec

Given

4 . g. ρ p ρ . D p
vt
3 . C D Re v t .ρ

vt Find v t

m
Answer: v t = 0.016 Re v t = 3.656
sec

Note that units have been included for all of the variables. The answer can be expressed in
any set of units desired. Some examples are given below.
ft mi mm in
v t = 0.052 v t = 0.035 v t = 15.782 v t = 37.279
sec hr sec min
Page MC-13 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

b) Mathcad has the gravitational acceleration predefined. For this case, g is redefined as 30g.
m
g 30 .g Guess: vt 1.
sec
Given

4 . g. ρ p ρ . D p
vt
3 . C D Re v t .ρ

vt Find v t

m
Answer: v t = 0.206 Re v t = 47.723
sec
Page MC-14 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Mathcad Solution to Problem 6


Mathcad has built-in a variety of differential equation solvers. In this case, an adaptive
Runge-Kutta method will be used since the solution varies slowly with time and all of the
functions vary on the same time scale (i.e., they are not stiff).
System physical constants and properties kg 1 min 1 kJ 1 C 1

Mass of oil in each tank: M 1000 . kg


kg kJ
Oil mass flow rate: W 100 . Oil heat capacity: Cp 2.
min kg .C

Temperature of entering oil: T 0 20 . C


kJ
Steam temperature: T steam 250 .C Heat transfer coefficient: UA 10 .
min . C

Calculate the steady state temperature by setting derivatives to zero and solving remaining
equations using a Mathcad Solve Block.

Initial guess for temperatures: T1ss 20 T2ss 20 T3ss 30

Given

W .C p . T 0 T1ss UA . T steam T1ss


0
M .C p

W .C p .( T1ss T2ss ) UA . T steam T2ss


0
M .C p

W .C p .( T2ss T3ss ) UA . T steam T3ss


0
M .C p
T1ss
T2ss Find( T1ss , T2ss , T3ss )
T3ss

Steady state temperatures: T1ss = 30.952 C T2ss = 41.383 C T3ss = 51.317 C


Page MC-15 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

For the solution of multiple ODEs Mathcad requires that the functions of the right hand side be
defined in a vector of functions. The initial conditions are assigned to the vector variable to be
solved for.
20 W .C p . T 0 T1 UA . T steam T1

Initial conditions: T 20 M .C p
20 W .C p . T1 T2 UA . T steam T2
D( t , T )
Function vector: M .C p

W .C p . T2 T3 UA . T steam T3
M .C p

Set initial time, final time and size of time step in minutes. Calculate number of points calculated.

t final t0
t0 0 t final 100 ∆t 1 npoints 1
∆t
Solve the differential equations using the function Rkadapt.
Z Rkadapt T , 0 , t final , npoints , D
The solution is stored in an array. The first column represents the time at each step. The
remaining columns represent the solution vectors.
Assign columns of the solution array to vectors for clarity

n 1 .. npoints timen Zn , 1 T1n Zn , 2 T2n Zn , 3 T3n Zn , 4


60

64
99 .% .T3ss

50
T1
n

T2
n 40

T3n

30

20
0 20 40 60 80 100
time
n

99% of steady state value: 99 .% .T3ss = 50.804 Calculate value at 64 minutes: T3 64 = 50.777
∆t

From the graph, T3 reaches 99% of steady state at approximately 64 minutes


Page MC-16 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Mathcad Solution to Problem 7

The solution to this problem will use Mathcad's ability to solve two point boundary value
problems. The solution method has two parts. In the first part, Mathcad estimates the missing
boundary conditions at the first point. These estimated values are then used in the standard ODE
solvers to find the solution between the two boindary points. Check the Mathcad help files for
more details on using this method.

Assign values to the pysical properties and dimensions for the problem

1.2 . 10
9 3
Diffusivity D AB Reaction rate constant k 10
3
Initial concnetration: C A0 0.2 Slab depth: L 10
L
Set position of first and second point and step size: z1 0 z2 L ∆z
100

Mathcad uses the load and score functions in estimating the missing initial conditions
Initial guess for vector of unknown initial conditions: v0 1

C A0
Initial conditions (including guess vector): load( z1, v )
v0

Vector of functions representing the right hand side of the differential equations:

C1

D( z , C ) k .C
0
D AB

Score function is a measure of the difference between the computed and given values at the end
point.

score ( z2 , C ) C1
Function sbval calculates the missing initial conditions:

C1 sbval( v , 0 , L, D , load , score ) C1 131.911

Now solve the differential equation using the estimated value of the inital conditions.

C0 C A0
L
z0 0 z end L npoints 1
∆z
Y Rkadapt C , z 0 , z end , npoints , D
Page MC-17 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Assign columns of the solution array to vectors for clarity

n 0 .. npoints zn Yn , 0 CA Yn, 1 dC A Yn , 2
n n

Verify boundary value at endpoint (dCA /dz = 0)


4
dC A = 2.787 10 Close enough!
npoints

Plot solution and compare with analytical solution

0.2

0.19

0.18

CA
n

z 0.17
cosh L . . 1
k n
D AB L
C A0 .
cosh L .
k 0.16
D AB

0.15

0.14

0.13
0 2 10 4 4 10 4 z 6 10 4 8 10 4
n

Numerical solution matches analytical solution very closely.


Page MC-18 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Mathcad Solution to Problem 8


This problem requires the simultaneous solution of a nonlinear equation (bubble point vapor
composition) and an ordinary differential equation (unsteady state material balance). The
ability to define a function using a Solve Block makes Mathcad a powerful tool in solving this
problem.

The differential equation that describes the unsteady state material balance includes the
k-value of component 2, k2. k2 depends implicitly on the mole fraction of component 2, x2. A
solve block will be used to define k2 as a function of x2. The first step in doing this is to write
the equilibrium temperature, Teq, as a function of x2. The vapor mole fraction can then be
defined as a function of x2 assuming the liquid behaves as an ideal solution and the vapor as
an ideal gas. k2 can then be defined as the ratio y2/x2.
atm
mole 1 mmHg C K
Coefficients for Antoine equation 760

Benzene: A1 6.90565 B1 1211.033 .C C1 220.79 . C

Toluene: A2 6.95464 B2 1344.8 . C C2 219.482 . C

Antoine equation for vapor pressure

B1 B2
A1 A2
T C1 T C2
P 1( T ) 10 . mmHg P 2( T ) 10 . mmHg

Define the equilibrium temperature using a solve block


Set pressure to given value: P 1.2 . atm

Guess temperature for solve block T 90 .C

Given
1 x 2 .P 1( T ) x 2 .P 2( T ) P

Teq x 2 Find( T )

x 2 .P 2 Teq x 2
Define vapor mole fraction assuming ideal gas: y2 x2
P

y2 x2
Definition of k-value: k2 x2
x2
Page MC-19 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Now solve the unsteady state material balance equation using the adaptive Runge-Kutta method

Initial condition: L0 100 . mole

Define the function on the right hand side of the differential equation:
L
D x 2, L
x 2. k 2 x 2 1

x 2f x 2i
Set initial and final values x 2i 0.4 x 2f 0.8 ∆x 2 0.01 npoints 1
∆x 2

Solve the differential equation: Z Rkadapt L, x 2i , x 2f , npoints , D

i 0 .. npoints Li Zi , 1 x2 Zi , 0
i

Teq x 2i = 95.585 C y 2 x 2i = 0.213 k 2 x 2i = 0.533


Initial values: L0 = 100

Final conditions:Lnpoints = 14.042 Teq x 2f = 108.572 C y 2 x 2f = 0.629 k 2 x 2f = 0.786

Plot of mass of liquid remaining


100

80

60

L
i

40

20

0
0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75
x2
i
Page MC-20 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Mathcad Solution to Problem 9


This problem involves the solution of 3 simultaneous ODEs and uses the adaptive
Runge-Kutta Method built into Mathcad.
m J
Define auxiliary units: J joule dm R 8.314.
10 mole. K

Physical properties and other parameters as given in the problem statement


J J
Heat capacities: C PA 40.0. C PB 80.0.
mole . K mole. K

J J
Heat of reaction: ∆H R 40000 . Activation energy: EA 41800 .
mole mole. K
6
dm
k 450 0.5 .
Arrhenius constant at 450 K: kg. min. mole

3
dm
Equilibrium constant at 450 K: K C450 25000 .
mole

J
Heat transfer coefficient: UA 0.8 . Coolant temperature: Ta 500. K
kg. min. K

mole mole
Initial flow rate, concentration and pressure: F A0 5.0 . C A0 0.271. P0 10. atm
min 3
dm
y A0 1.0
Initial temperature and gas mole fraction of A: T0 450. K
1
Constant used in calculating pressure drop: α 0.015. kg

EA
Kinetic rate expression: k( T ) k 450. exp . 1 1
R T0 T

∆H R
Equilibrium expression: K C( T ) K C450. exp . 1 1
R T0 T

Concentrations expressed as a function of conversion, vapor mole fraction and temperature

1 X . .T 0 0.5 . X . . T 0
C A( X , y, T ) C A0. y C C ( X , y, T ) C A0. y
1 0.5 . X T 1 0.5 . X T
Page MC-21 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Reaction rate expressed as a function of conversion, vapor mole fraction and temperature

2
C C( X , y , T )
r A( X , y , T ) k( T ) . C A( X , y , T )
K C( T )

Mathcad requires the unknown variables to be expressed as a vector. We will define the variables
as follows: X = x0, y = x1 and T = x2

Express the right hand side of the three differential equations as a vector of functions

r A x0 , x1 , x2. T 0
F A0

1 0.5 . x0 x2. T 0
D( W , x ) α. .
2 . x1 T0

UA. T a x2. T 0 r A x0 , x1 , x2. T 0 . ∆H R


F A0. C PA. T 0

0
Initial conditions: x 1
1

Wf W0
Initial and final weight of catalyst: W0 0 Wf 20 ∆W 0.1 npoints 1
∆W

Solve the differential equations: Z Rkadapt x , W 0 , W f , npoints , D

Assign columns of the solution array to vectors for clarity

i 0 .. npoints Wi Zi , 0 Xi Zi , 1 yi Zi , 2 Ti Zi , 3. T 0
Page MC-22 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

a) Plot the results

1.5

X 1 y
i i

y
i

Ti Ti /(1000K) Xi
1000. K 0.5

0
0 2 4 6 8 10 12 14 16 18 20

W
i

b) The "knee" in the curve represents the acceleration in reaction rate due to the rapid increase in
temperature for the exothermic reaction.

c) Evaluate the concentration profiles using the calculated values of conversion, vapor mole
fraction and temperature

0.3

0.25

C A X ,y ,T CA
i i i 0.2
mole
3
dm
0.15
C C X ,y ,T
i i i
mole
3 0.1
dm

0.05

0
0 5 10 15 20
W
i
Page MC-23 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Mathcad Solution to Problem 10


The solutions to this problem make use of the differential equation solver built into Mathcad

Define physical properties of the system as given in the problem statement.

ρVC p 4000 WC p 500

Inlet temperature: T is 60 Set point temperature: Tr 80

Tank dead time τd 1 Thermocouple time constant: τm 5

Controller gain: KC 2 Controller integral time: τI 2

Calculate steady state heat input: qs WC p . T r T is

KC
Define the heat input calculated by the controller: q T m, e .e
qs K C. T r Tm
τI
Mathcad requires the unknown variables to be expressed as a vector. We will define the variables
as follows: T = x0, T0 = x1, Tm = x2, and errsum = x3

a) Open Loop Performance

The step change in inlet temperature is represented in Mathcad by defining the inlet temperature as
a function of time using an if function.

Ti( t ) if t < 10 , T is , T is 20

For open loop performance, set the controller gain to zero. Kc 0

Define the vector of functions representing the right hand side of the ODEs
WC p . Ti( t ) x0 q x2 , x3
ρVC p

τ d WC p . Ti( t ) x0 q x2 , x3
x0 x1 . .2
D( t , x ) 2 ρVC p τd

x1 x2
τm

Tr x2
Page MC-24 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Initial conditions: Tr Initial time: t0 0

Tr Final time: tf 60
x
Tr Time step: ∆t 0.1
tf t0
0 npoints 1 i 1 .. npoints
∆t

Solve the system of ODEs using the adaptive Runge-Kutta method

Z Rkadapt x , t 0 , t f , npoints , D

Assign columns of the solution array to vectors for clarity

ti Zi , 0 Ti Zi , 1 T0 Zi , 2 Tm Zi , 3 errsumi Zi , 4
i i

85

80

T
i 75

T0
i

T m 70
i

65

60
0 10 20 30 40 50 60
t
i
Page MC-25 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

b) Closed loop performance


Controller gain: Controller integral time:
KC
KC 50 τI 2 q T m, e qs K C. T r Tm .e
τI

Define the vector of functions representing the right hand side of the ODEs
WC p . Ti( t ) x0 q x2 , x3

ρVC p

τ d WC p . Ti( t ) x0 q x2 , x3
x0 x1 . .2
D( t , x ) 2 ρVC p τd

x1 x2

τm

Tr x2

Initial conditions: Tr Initial time: t0 0

Tr Final time: tf 200


x
Tr Time step: ∆t 0.1
tf t0
0 1 npoints i 1 .. npoints
∆t
Solve the system of ODEs using the adaptive Runge-Kutta method
Z Rkadapt x , t 0 , t f , npoints , D

Assign columns of the solution array to vectors for clarity


ti Zi , 0 Ti Zi , 1 T0 Zi , 2 Tm Zi , 3 errsumi Zi , 4
i i

85

T 80
i

T0
i
75
Tm
i

Tr 70

65
0 20 40 60 80 100 120 140 160 180 200
t
i
Page MC-26 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

c) Closed loop performance - increasing KC to 500


Controller gain: Controller integral time:
KC
KC 500 τI 2 q T m, e qs K C. T r Tm .e
τI

Define the vector of functions representing the right hand side of the ODEs
WC p . Ti( t ) x0 q x2 , x3

ρVC p

τ d WC p . Ti( t ) x0 q x2 , x3
x0 x1 . .2
D( t , x ) 2 ρVC p τd

x1 x2

τm

Tr x2

Initial conditions: Tr Initial time: t0 0

Tr Final time: tf 200


x
Tr Time step: ∆t 0.1
tf t0
0 1 npoints i 1 .. npoints
∆t
Solve the system of ODEs using the adaptive Runge-Kutta method
Z Rkadapt x , t 0 , t f , npoints , D

Assign columns of the solution array to vectors for clarity


ti Zi , 0 Ti Zi , 1 T0 Zi , 2 Tm Zi , 3 errsumi Zi , 4
i i

100

T
i

T0
i
80
Tm
i

Tr

60
0 20 40 60 80 100 120 140 160 180 200
t
i
Page MC-27 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

d) Closed loop performance - Proportional only controller


Controller gain: Controller integral time:
KC 500 τI 0 q T m, e qs K C. T r Tm

Define the vector of functions representing the right hand side of the ODEs
WC p . Ti( t ) x0 q x2 , x3

ρVC p

τ d WC p . Ti( t ) x0 q x2 , x3
x0 x1 . .2
D( t , x ) 2 ρVC p τd

x1 x2

τm

Tr x2

Initial conditions: Tr Initial time: t0 0

Tr Final time: tf 60
x
Tr Time step: ∆t 0.1
tf t0
0 1 npoints i 1 .. npoints
∆t
Solve the system of ODEs using the adaptive Runge-Kutta method
Z Rkadapt x , t 0 , t f , npoints , D

Assign columns of the solution array to vectors for clarity


ti Zi , 0 Ti Zi , 1 T0 Zi , 2 Tm Zi , 3 errsumi Zi , 4
i i

85

T 80
i

T0
i
75
Tm
i

Tr 70

65
0 10 20 30 40 50 60
t
i
Page MC-28 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

e) Closed loop performance - Heater output limited

Inlet temperature: T is 60 Initial set point temperature: T r0 80

Tank dead time τd 1 Thermocouple time constant: τm 5

Calculate steady state heat input: qs WC p . T r0 T is

KC 5000 τI 2000000

Define the step increase in set point at time 10 using Mathcad if function.

Ti( t ) T is T r( t ) if t < 10 , T r0 , T r0 10

Define the limiting behavior of the heater using nested Mathcad if functions.

KC
q 0 T m, e, t qs K C. T r( t ) Tm .e
τI

q T m, e, t if q 0 T m , e , t < 0 , 0 , if q 0 T m , e , t > 2.6 . q s , 2.6 . q s , q 0 T m , e , t

Define the vector of functions representing the right hand side of the ODEs
WC p . T is x0 q x2 , x3 , t

ρVC p

τ d WC p . T is x0 q x2 , x3 , t
x0 x1 . .2
D( t , x ) 2 ρVC p τd

x1 x2

τm

T r( t ) x2

Initial conditions: T r0 Initial time: t0 0

T r0 Final time: tf 200


x
T r0 Time step: ∆t 0.1
tf t0
0 npoints 1 i 1 .. npoints
∆t
Page MC-29 MATHEMATICAL SOFTWARE PACKAGES IN CHEMICAL ENGINEERING

Solve the system of ODEs using the fixed interval Runge-Kutta method. The adaptive method was
too slow!
Z rkfixed x, t 0 , t f , npoints , D

Assign columns of the solution array to vectors for clarity


ti Zi , 0 Ti Zi , 1 T0 Zi , 2 Tm Zi , 3 errsumi Zi , 4
i i

100

95

Ti

90
T0
i

Tm
i
85
Tr t
i

80

75
0 20 40 60 80 100 120 140 160 180 200
t
i

Heater behavior with and without limits

8 104

4
6 10

0
4
q 0 T m , errsum , t 4 10
i i i

q T m , errsum i , ti
i
2 104
2.6 . q s

2 104
0 50 100 150 200
t
i

You might also like