You are on page 1of 64

Cutlip and Shacham: Problem Solving in Chemical and Biochemical Engineering

Chapter 2

Basic Principles and Calculations

Cheng-Liang Chen
PSE
LABORATORY
Department of Chemical Engineering
National TAIWAN University
Chen CL 1

Molar Volume and Compressibility Factor


from van der Waals Equation
Concepts Utilized: Use of the van der Waals equation of state to calculate
molar volume and compressibility factor for a gas.
Numerical Methods: Solution of a single nonlinear algebraic equation.

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
 a 
P + 2 (V − b) = RT
V 2 2 
27 R Tc RTc
a= , b =
64 Pc 8Pc

Where 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
Chen CL 2

temperature (405.5 K for ammonia), Pc = critical pressure (111.3 atm for


ammonia). Reduced pressure and the compressibility factor are defined as

P PV
Pr = Z=
Pc 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: P r = 1, 2, 4, 10, 20.

(c) How does the compressibility factor vary as a function of P r?

Solution:
A function of volume, f (V ), is defined and setting it to zero.
 a 
f (V ) = P + 2 (V − b) − RT
V

MATLAB has equation solvers such as fzero (in all versions) and fsolve (in the
optimization Toolbox). To use the solvers one must define f (V ) as a
Chen CL 3

MATLAB function. An example of a function is the following NLEfun(V). All


statements following % are ignored by MATLAB. The semi-colons prevent the
values from being printed while the program is being executed.

function P2_01A_CCL
% Section 2.1, Pages 15,16
clear, clc, format short g, format compact
disp(’For gaseous ammonia (Pc = 111.3 atm, Tc = 405.5 K) ’)
disp(’When P = 56 atm, T = 450.0 K ’)
disp(’Molar volumn by ideal gas law (L/g-mol) is ’)
Videal = (0.08206 * 450) / 56;
disp(Videal)
disp(’ ’)
disp(’Problem: find volume by Van Der Waals Eq. ’)
Vguess = input(’ Please enter initial guess: ’);
disp(’ ’)
disp(’Variable value at the initial estimate’);
disp([’Unknown=’ num2str(Vguess) ’Func.=’ num2str(NLEfun(Vguess))]);
Vsolv=fzero(@NLEfun,Vguess);
disp(’ ’)
disp(’ Variable values at the solution’);
disp([’Unknown=’ num2str(Vsolv) ’Function=’ num2str(NLEfun(Vsolv))]);
Chen CL 4

disp(’ ’)
disp(’ Compressibility factor Z = V(Van Dea Waals)/V(ideal) is ’);
Z = Vsolv / Videal;
disp(Z)
%
%- - - - - - - - - - - - - - - - - - - - - -
function fV = NLEfun(V);
P = 56;
R = .08206;
T = 450;
Tc = 405.5;
Pc = 111.3;
Pr = P / Pc;
a = 27 * R ^ 2 * Tc ^ 2 / Pc / 64;
b = R * Tc / (8 * Pc);
Z = P * V / (R * T);
fV = (P+a/(V^2))*(V-b)-(R*T);
Chen CL 5

For gaseous ammonia (Pc = 111.3 atm, Tc = 405.5 K)


When P = 56 atm, T = 450.0 K
Molar volume by ideal gas law (L/g-mol) is
0.65941

Problem: find volume by Van Der Waals Eq.


Please enter initial guess: 0.5

Variable value at the initial estimate


Unknown value = 0.5 Function Value = -3.2533

Variable values at the solution


Unknown value = 0.57489 Function Value = 0

Compressibility factor Z = V(Van Dea Waals)/V(ideal) is


0.87183
Chen CL 6
function P2_01B_CCL
% Section 2.1, Pages 15,16
clear, clc, format short g, format compact
repeat = 1;
while repeat
disp(’ ’)
disp(’For gaseous ammonia (Pc = 111.3 atm, Tc = 405.5 K) ’)
disp(’Problem: find volume by Van Der Waals Eq. at given Pr value’)
Pr = input(’ Please enter Pr value: ’);
disp(’At given Pr, and T = 450.0 K ’)
disp(’Molar volume by ideal gas law (L/g-mol) is ’)
Videal = (0.08206 * 450) / (111.3*Pr);
disp(Videal)
disp(’ ’)
Vguess = input(’ Enter initial guess of V(Pr; Van Der Waals):
disp(’ ’)
disp(’Variable value at the initial estimate’);
disp([’Unkn=’ num2str(Vguess) ’ Func=’ num2str(NLEfun(Vguess,Pr))]);
Vsolv = fzero(@(Vguess) NLEfun(Vguess,Pr),Vguess);
disp(’ ’)
disp(’ Variable values at the solution’);
disp([’ Unkn=’ num2str(Vsolv) ’ Func.=’ num2str(NLEfun(Vsolv,Pr))]);
Chen CL 7

disp(’ ’)
disp(’ Compressibility factor Z = V(Van Dea Waals)/V(ideal) ’);
Z = Vsolv / Videal;
disp(Z)
repeat = input(’\n\n Repeat the calculations: 0 (No), 1 (yes)) ? ’)
end
Chen CL 8

Molar Volume and Compressibility Factor


from Redlich-Kwong Equation

Concepts Utilized: Use of the Redlich-Kwong equation of state to calculate


molar volume and compressibility factor for a gas.

Numerical Methods: Solution of a single nonlinear algebraic equation.

Problem Statement:
The Redlich-Kwong equation of state is given by

RT a
P = − √
(V − b) V (V +!b) T
5/2
R 2 Tc
a = 0.42747
Pc
 
RTc
b = 0.08664
Pc

Solution:
Chen CL 9
function P2_02A_CCL
% Section 2.2, Page 19
clear, clc, format short g, format compact
disp(’For gaseous ammonia (Pc = 111.3 atm, Tc = 405.5 K) ’)
disp(’When P = 56 atm, T = 450.0 K ’)
disp(’Molar volume by ideal gas law (L/g-mol) is ’)
Videal = (0.08206 * 450) / 56;
disp(Videal)
disp(’ ’)
disp(’Problem: find volume by Redlich-Kwong Eq. ’)
Vguess = input(’ Please enter initial guess: ’);
disp(’ ’)
disp(’Variable value at the initial estimate’);
disp([’Unkn=’ num2str(Vguess) ’ Func.=’ num2str(NLEfun(Vguess))]);
Vsolv=fzero(@NLEfun,Vguess);
disp(’ ’)
disp(’ Variable values at the solution’);
disp([’Unkn=’ num2str(Vsolv) ’ Func.=’ num2str(NLEfun(Vsolv))]);
disp(’ ’)
disp(’ Compressibility factor Z = V(Redlich Kwong)/V(ideal) is ’);
Z = Vsolv / Videal;
disp(Z)
Chen CL 10

%
%- - - - - - - - - - - - - - - - - - - - - -
function fV = NLEfun(V);
P = 56;
R = .08206;
T = 450;
Tc = 405.5;
Pc = 111.3;
Pr = P / Pc;
a = 0.42747*R^2*Tc^(5/2)/Pc;
b = 0.08664* R * Tc / Pc;
Z = P * V / (R * T);
fV = (P + a/(V*(V+b)*sqrt(T)) )*(V-b)-(R*T);
Chen CL 11

For gaseous ammonia (Pc = 111.3 atm, Tc = 405.5 K)


When P = 56 atm, T = 450.0 K
Molar volume by ideal gas law (L/g-mol) is
0.65941

Problem: find volume by Redlich-Kwong Eq.


Please enter initial guess: 0.5

Variable value at the initial estimate


Unknown value = 0.5 Function Value = -3.0991

Variable values at the solution


Unknown value = 0.5698 Function Value = 0

Compressibility factor Z = V(Redlich Kwong)/V(ideal) is


0.86411
Chen CL 12
function P2_02B_CCL
% Section 2.2, Page 19
clear, clc, format short g, format compact
repeat = 1;
while repeat
disp(’ ’)
disp(’For gaseous ammonia (Pc = 111.3 atm, Tc = 405.5 K) ’)
disp(’Problem: find volume by Redlich Kwong Eq. at given Pr value’)
Pr = input(’ Please enter Pr value: ’);
disp(’At given Pr, and T = 450.0 K ’)
disp(’Molar volume by ideal gas law (L/g-mol) is ’)
Videal = (0.08206 * 450) / (111.3*Pr);
disp(Videal)
disp(’ ’)
Vguess = input(’ Enter initial guess of V(Pr; Van Der Waals):
disp(’ ’)
disp(’Variable value at the initial estimate’);
disp([’Unkn=’ num2str(Vguess) ’ Func.= ’ num2str(NLEfun(Vguess,Pr))]
Vsolv = fzero(@(Vguess) NLEfun(Vguess,Pr),Vguess);
disp(’ ’)
disp(’ Variable values at the solution’);
disp([’ Unkn=’ num2str(Vsolv) ’ Func.=’ num2str(NLEfun(Vsolv,Pr))])
Chen CL 13

disp(’ ’)
disp(’ Compressibility factor Z = V(Redlich Kwong)/V(ideal) ’);
Z = Vsolv / Videal;
disp(Z)
repeat = input(’\n\n Repeat the calculations: 0 (No), 1 (yes))? ’);
end
Chen CL 14

Stoichiometric Calculations for Biological Reactions


Concepts Utilized: Use of elemental balances to calculate the stoichiometric
coefficients using respiratory quotient, RQ, in general biological reactions.
Numerical Methods: Solution of a system of linear equations.

Problem Statement:
A simplified biological conversion reaction can be written for a carbohydrate
reacting with oxygen and ammonia to form cellular material and only water and
carbon dioxide products as

CHmOn + aO2 + bN H3 → cCHαOβ Nδ + dH2O + eCO2 (2-10)

Thus the reactant carbohydrate and the product of cellular material contain only
one gram atom of carbon. When complete elemental analyses of the carbohydrate
reactant and the cellular product are known, the elemental balances can be
written as
Carbon Balance: 1 = c+e
Hydrogen Balance: m + 3b = cα + 2d
Oxygen Balance: n + 2a = cβ + d + 2e
Nitrogen Balance: b = cδ
Chen CL 15

This is a system of four linear equations with five unknowns and may be
completely defined adding an additional relationship between the unknowns.
The respiratory quotient, RQ, is defined as

e
RQ =
a

and this equation can be added to the above system equations.

(a) Glucose substrate, C6H1206, reacts with oxygen and ammonia to form a bacteria,
CH2O0.27N0.25, water, and carbon dioxide with a respiratory quotient of 1.5.
What are the stoichiometric coefficients for this reaction when it is written in
the form of Equation (2-10)?

(b) Repeat the calculations for part (a) with a respiratory quotient of 2.0.

(c) Repeat the calculations of part (a) when benzoic acid substrate, C6H5COOH,
forms the same bacteria under anaerobic conditions where there is no gaseous
oxygen present.
Chen CL 16

Solution:
It is first necessary to express glucose in the form of Equation (2-10) as C1H2O1.
The respiratory quotient can be written as

1.5a = e

The problem then become a system of linear equations, where m = 2, n = 1,


α = 2, β = 0.27, and δ = 0.25 as shown below.

c+e=1
3b − 2c − 2d = −2
2a − 0.27c − d − 2e = −1
b − 0.25c = 0
1.5a − e = 0
Chen CL 17
function P2_03A_CCL
clear, clc, format short g, format compact
A=[0 0 1 0 1
0 3 -2 -2 0
x =
2 0 -.27 -1 -2
0.23165 (= a)
0 1 -.25 0 0
0.16313 (= b)
1.5 0 0 0 -1];
0.65253 (= c)
b=[ 1
0.59217 (= d)
-2
0.34747 (= e)
-1
0
0];
x = inv(A)*b
Chen CL 18

Steady-State Material Balances


on A Separation Train

Concepts Utilized:
Material balances on a steady-state
process with no recycle.
Numerical Methods:
Solution of simultaneous linear equations.
Problem Statement:
Paraxylene, styrene, toluene, and benzene
are to be separated with the array of
distillation columns shown in below.
(a) Calculate the molar flow rates of D1,
D2, B1, and B2.

(b) Reduce the original feed flow rate to the first column in turn for each one of the
components by first 1%, then 2%, and calculate the corresponding flow rates of
D1, B1, D2, and B2. Explain your results.

(c) Determine molar flow rates and compositions of streams B and D for part (a).
Chen CL 19

Solution:
Material balances on individual components yield

Xylene: 0.07D1 + 0.18B1 + 0.15D2 + 0.24B2 = 0.15 × 70


Styrene: 0.04D1 + 0.24B1 + 0.10D2 + 0.65B2 = 0.25 × 70
Toluene: 0.54D1 + 0.42B1 + 0.54D2 + 0.l0B2 = 0.40 × 70
Benzene: 0.35D1 + 0.16B1 + 0.21D2 + 0.01B2 = 0.20 × 70

function P2_04A_CCL
clear, clc, format short g, format compact
A=[.07 .18 .15 .24 x =
.04 .24 .1 .65 26.25
.54 .42 .54 .1 17.5
.35 .16 .21 .01]; 8.75
b=[10.5 17.5
17.5
28
14];
x = inv(A)*b
Chen CL 20

Fitting Models by Least Squares

inputs = xi1, xi2, · · · , xip output = yi, i = 1, . . . , n


(y1 ; x11, x12, · · · , x1p) (1st observation data)
(y2 ; x21, x22, · · · , x2p) (2nd observation data)
.. ..
(yn ; xn1, xn2, · · · , xnp) (nth observation data)

y = β1x1 + β2x2 + · · · + βpxp (linear model)


⇒ y1 = β1x11 + β2x12 + · · · + βpx1p + 1
y2 = β1x21 + β2x22 + · · · + βpx2p + 2
.. ..
yn = β1xn1 + β2xn2 + · · · + βpxnp + |{z}
|{z} n
| {z }
nth obs nth model output, ŷn error
Chen CL 21

Fitting Models by Least Squares


 2
n
X n
X p
X
f = i2 = y i − βj xij  (SSE)
i=1 i=1 j=1

Q: find β1, · · · , βp to minimize SSE ?



∂f ∂f ∂f
∂β1 = 0 ∂β 2
= 0 · · · ∂βp =0
β∗=β̂∗ β∗=β̂∗ β∗=β̂∗
n
X n
X n
X n
X
yixi1 = β̂1 xi1xi1 + β̂2 xi1xi2 + · · · + β̂p xi1xip
i=1 i=1 i=1 i=1
Xn Xn Xn Xn
yixi2 = β̂1 xi2xi1 + β̂2 xi2xi2 + · · · + β̂p xi2xip
i=1 i=1 i=1 i=1
.. .. ..
n
X n
X n
X n
X
yixip = β̂1 xipxi1 + β̂2 xipxi2 + · · · + β̂p xipxip
i=1 i=1 i=1 i=1
Chen CL 22

Fitting Models by Leastn Squares


X
⇒ Q: how to find β̂1, · · · , β̂p? (to minimize i2 = T )
i=1
      
y1 x11 x12 · · · x1p β1 1
      
 21 x22 · · ·
y  x x2p  β2
    
 2  2
  =  +
 ..   .. .. .. ..   ..   .. 
   
      
yn xn1 xn2 · · · xnp βp n
| {z } | {z } | {z }
obs.s model outputs error

Y = X β̂ + 
T T
f =   = (Y − Xβ) (Y − Xβ) (SSE)
∂f T T
= X Y − X X β̂ = 0
∂β β ˆ

β̂ = (X T X)−1X T Y
Chen CL 23

Fitting Polynomials by Least Squares


y = β0 + β1x + β2x2 + · · · + βpxp (polynomial)
 
    β
 0
 
y1 1 x1 x21 · · · xp1 1
β1
       
y 
 2
1 x x2
2 2 · · · xp2     
2
  =  β2 + 
 
 ..   .. .. .. ..  .. 
    
 .
    .  
yn 1 xn x2n · · · xpn   n
| {z } βp | {z }
obs.s | {z } error
model outputs

Y = X β̂ + 
T T
f =   = (Y − Xβ) (Y − Xβ) (SSE)
∂f T T
= X Y − X X β̂ = 0
∂β β ˆ

β̂ = (X T X)−1X T Y
Chen CL 24

Fitting Polynomials and correlation Equations


to Vapor Pressure Data

Vapor Pressure of Benzene (Ambrose)


Concepts Utilized:
Use of polynomials, the Clapeyron Temp. Pressure Temp Pressure
equation, and the Riedel equation (K) (Pa) (K) (Pa)
to correlate vapor pressure versus 290.08 8634.0 353.47 102040.0
temperature data. 302.39 15388.0 356.19 110850.0
Numerical Methods:
311.19 22484.0 358.87 120140.0
Regression of polynomials of various
degrees and linear regression of 318.69 30464.0 362.29 132780.0
correlation equations with variable 325.1 38953.0 365.23 144530.0
transformations. 330.54 47571.0 367.90 155800.0
Problem Statement:
334.89 55511.0 370.53 167600.0
The following table presents data of
vapor pressure versus temperature for 338.94 63815.0 373.15 180060.0
benzene. Some design calculations 342.95 72985.0 375.84 193530.0
require these data to be correlated 346.24 81275.0 378.52 207940.0
accurately by algebraic equations.
349.91 91346.0 381.32 223440.0
Chen CL 25

A simple polynomial is often used as an empirical correlation equation. This can


be written in general form as

P (x) = a0 + a1x + a2x2 + . . . + anxn

where a0, . . . , an are parameters, also called coefficients, to be determined by


regression and n is the degree of the polynomial. Typically the degree of the
polynomial is selected that gives the best data correlation when using a
least-squares objective function.

The Clapeyron equation is given by

B
log(P ) = A +
T

where T is the absolute temperature in K and both A and B are the parameters
of the equation that are typically determined by regression.

The Riedel equation has the form

B
log(P ) = A + + C log(T ) + DT β
T
Chen CL 26

where T is the absolute temperature in K and A, B, C, and D are parameters


determined by regression. β in the above equation is an integer exponent that is
typically set to a value of 2.

(a) Correlate the data with polynomials of different degrees by assuming that the
absolute temperature in K is the independent variab and P in Pa is the dependent
variable. Determine the degree of polynomial fits the data best.

(b) Correlate the data using the Clapeyron equation.

(c) Correlate the data using the Riedel equation.

(d) Discuss which of the preceding correlations best represents the given data set.

Solution:
To obtain the polynomials that represent the data of P (dependent variable)
versus data of T K (independent variable).

P(calc) = a0 + a1T K + a2T K 2 + a3T K 3 + a4T K 4


Chen CL 27

The least squares objective function:

N
X 2
P(obs) − P(calc)
i=1

The variance: 2
N
2
X P(obs) − P(calc)
σ =
i=1
N − (n + 1)

function P2_05A_CCL
clear, clc,format short g, format compact
prob_title = ([’ VP Correlation for Benzene’]);
ind_var_name= [’\bf Temp. (K)’];
dep_var_name= [’\bf Vapor Pressure (Pa) ’];
xyData=[ 290.08 8634.0
302.39 15388.0
311.19 22484.0
318.69 30464.0
325.1 38953.0
330.54 47571.0
334.89 55511.0
Chen CL 28
338.94 63815.0
342.95 72985.0
346.24 81275.0
349.91 91346.0
353.47 102040.0
356.19 110850.0
358.87 120140.0
362.29 132780.0
365.23 144530.0
367.9 155800.0
370.53 167600.0
373.15 180060.0
375.84 193530.0
378.52 207940.0
381.32 223440.0];
x = xyData(:,1);
y = xyData(:,2);
[m,n] = size(x);
freeparm=input(’ Input 1 if there is a free parameter, 0 otherwise ’
degree =input(’ Enter the degree of the polynomial ’);
[Beta, ycal, ConfInt, Var, R2, n] = PolyReg(x,y,degree,freeparm);
disp([’ Results,’ prob_title]);
Chen CL 29

Res=[];
for i=0:n-1
if freeparm==0; ii=i+1; else ii=i; end
Res=[Res; ii Beta(i+1) ConfInt(i+1)];
end
disp(’ Parameter No. Beta Conf_int’);
disp(Res);
disp([’ Variance ’, num2str(Var)]);
disp([’ Correlation Coefficient ’, num2str(R2)]);
%
%Plot of experimental and calculated data
%
for i=1:m
index(i)=i;
end
subplot(2,1,1)
plot(x,ycal, ’r-’,x,y,’b+’,’LineWidth’,2)
% plot(index,ycal, ’r-’,index,y,’b+’,’LineWidth’,2)
set(gca,’FontSize’,14,’Linewidth’,2)
title([’\bf Cal./Exp. data ’ prob_title],’FontSize’,12)
xlabel([’\bf Exp. Temperature’],’FontSize’,14)
% xlabel([’\bf Point No.’],’FontSize’,14)
Chen CL 30

ylabel([dep_var_name],’FontSize’,14)
%pause
subplot(2,1,2)
plot(y,y-ycal,’*’,’LineWidth’,2) % residual plot
set(gca,’FontSize’,14,’Linewidth’,2)
title([’\bf Residual plot, ’ prob_title],’FontSize’,12)
xlabel([dep_var_name ’\bf (measured)’],’FontSize’,14)
ylabel(’\bf Residual’,’FontSize’,14)
%pause
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [Beta,ycal,ConfInt,Var,R2,n]=PolyReg(x,y,degree,freeparm)
tdistr95=[12.7062 4.3027 3.1824 2.7764 2.5706 2.4469 2.3646 2.306...
2.2622 2.2281 2.2010 2.1788 2.1604 2.1448 2.1315 2.1199...
2.1098 2.1009 2.0930 2.0860 2.0796 2.0739 2.0687 2.0639...
2.0595 2.0555 2.0518 2.0484 2.0452 2.0423 2.0395 2.0369...
2.0345 2.0322 2.0301 2.0281 2.0262 2.0244 2.0227 2.0211...
2.0195 2.0181 2.0167 2.0154 2.0141]; % 95 % prob t-distr. v
if freeparm==1
n=degree+1;
else
n=degree;
Chen CL 31
end
m=size(x,1);
for i=1:m
for j=1:n
if freeparm==1
p=j-1;
else
p=j;
end
X(i,j)=x(i)^p; %Calculate powers of the independent variable and put t
end
end
Beta=X\y; % Solve X’Beta = Y using QR decomposition
ycal=X*Beta; % Calculated dependent variable values
Var=sum((y-ycal)’*(y-ycal))/(m-n); % variance
if (m-n)>45
t=2.07824-0.0017893*(m-n)+0.000008089*(m-n)^2;
else
t=tdistr95(m-n);
end
A=X’*X;
Ainv=A\eye(size(A)); %Calculate the inverse of the X’X matrix
Chen CL 32
for i=1:n
ConfInt(i,1)=t*sqrt(Var*Ainv(i,i)); %confidence intervals
end
ymean=mean(y);
R2=(ycal-ymean)’*(ycal-ymean)/((y-ymean)’*(y-ymean));%linear corre

Input 1 if there is a free parameter, 0 otherwise 1


Enter the degree of the polynomial 3
Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 9.249753e-023.
> In P2_05A_CCL>PolyReg at 99
In P2_05A_CCL at 33
Results, VP Correlation for Benzene
Parameter No. Beta Conf_int
0 -4.2472e+006 2.0326e+005
1 44001 1820.2
2 -153.46 5.414
3 0.18046 0.0053493
Variance 36161.6487
Correlation Coefficient 0.99999
Chen CL 33
Chen CL 34

Mean Heat Capacity of n-Propane


Concepts Utilized:
Calculation of mean heat capacity from Heat Capacity of Gaseous Propane
heat capacity versus temperature data. Temp. Cp Cp
No. (K) kJ/kg-mol·K kJ/kg-mol·K
Numerical Methods: 1 50. 34.16
Regression of polynomials of various 2 100. 41.30
degrees to data and integration of fitted 3 150. 48.79
4 200. 56.07
polynomials between definite limits. 5 273.15 68.74
Problem Statement: 6 300. 73.93
7 400. 94.01
The mean heat capacity (C p) between 8 500. 112.59
two temperatures Tref and T can be 9 600. 128.70
calculated by 10 700. 142.67
Z T 11 800. 154.77
. 12 900. 163.35
Cp = CpdT (T − Tref) 13 1000. 174.60
Tref 14 1100. 182.67
15 1200. 189.74
Use the data in Table to complete the 16 1300. 195.85
empty boxes in the column for the mean 17 1400. 201.21
18 1500. 205.89
heat capacity of n-propane. Use 25oC
(298.15K) as Tref.

Solution:
Chen CL 35
function P2_07A 1200 189.74
clear, clc,format short g, 1300 195.85
format compact 1400 201.21
xyData=[ 50 34.16 1500 205.89];
100 41.3 T_K = xyData(:,1);
150 48.79 Cp = xyData(:,2);
200 56.07 Tref = 298.15;
273.15 68.74 Cpref= spline(T_K,Cp,Tref);
300 73.93 T_K = [Tref;T_K(6:end)];
400 94.01 Cp = [Cpref; Cp(6:end)];
500 112.59 Cpav = cumtrapz(T_K,Cp);
600 128.7 for i=2:14
700 142.67 Cpav(i)=Cpav(i)/(T_K(i)-Tref);
800 154.77 end
900 163.35 disp(’Temp.(K) Cpav (kJ/kg-mol-K)’);
1000 174.6 disp([T_K(2:end) Cpav(2:end)])
1100 182.67
Chen CL 36

Temp. (K) Cpav (kJ/kg-mol-K)


300 73.748
400 83.784
500 93.453
600 102.46
700 110.73
800 118.3
900 125.07
1000 131.33
1100 137.23
1200 142.66
1300 147.66
1400 152.28
1500 156.54
Chen CL 37

Gas Volume Calculations


Using Various Equations of State

Concepts Utilized: Gas volume calculations using the ideal gas, van der Waals,
Soave-Redlich-Kwong, Peng-Robinson, and Beattie-Bridgeman equations of state.

Numerical Methods: Solution of a single nonlinear algebraic equation.

Problem Statement:
It is proposed to use a steel tank to store carbon dioxide at 300 K. The tank is 2.5
m3 in volume, and the maximum pressure it can safely withstand is 100 atm.

(a) Determine the maximum number of moles of CO2 that can be stored in the
tank using the equations of state which are discussed in the text that follows.

(b) Assuming that the Beattie-Bridgeman equation is the most accurate, what is
the percent error in the calculated number of moles using the other correlations?

(c) Repeat (b) for different values of Tr (T /Tc) and Pr (P/Pc). How do the
accuracies of the different correlations change with Tr and Pr ?
Chen CL 38

Ideal Gas P V= RT
RT αa
Soave-Redlich-Kwong P = −
(V − b)  V (V + b)
2 2
 
R T
a = 0.42747 Pc c b = 0.08664 RT
Pc
c

h p i2
α = 1 + m(l − T /T c)
m = 0.48508 + 1.55171ω − 0.1561ω 2
Tc = 304.2 K,) Pc = 72.9 atm for CO2)
ω = the acentric factor (0.225 for CO2)
RT a(T )
Peng-Robinson P = −
(V − b)  V (V + b) + b(V − b) 
R2 Tc2

RTc
a = 0.45724 Pc α(T ) b = 0.0778 Pc
h p i2
α = 1 + k(l − T /T c)
k = 0.37464 + 1.54226ω − 0.26992ω 2
RT β γ δ
Beattie-Bridgeman P = + 2+ 3+ 4
V V V V
Rc
β = RT B0 − A0 − 2
T
RcB0 RcB0b
γ = RT B0b + A0a − δ =
T2 T2
Chen CL 39

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


c = 66.0 × 104.

Solution:
One solution to this problem is to find the volume of 1 mole of CO2 at the
specified temperature and pressure for each equation of state and then calculate
the moles in the 2.5 m3 volume of the tank. The first equation of state (ideal) can
be solved directly. In order to be consistent with the rest of the equations, this
one can be rewritten as an implicit expression

f (V ) = P V − RT
Chen CL 40
function P2_09A1
clear, clc, format short g, format compact
xguess = 0.505 ;
disp(’Variable values at the initial estimate’);
disp([’ Unkn’ num2str(xguess) ’ Func.’ num2str(NLEfun(xguess))]);
xsolv=fzero(@NLEfun,xguess);
disp(’ Variable values at the solution’);
disp([’ Unkn’ num2str(xsolv) ’ Func.’ num2str(NLEfun(xsolv))]);
%- - - - - - - - - - - - - - - - - - - - - -
function fV = NLEfun(V);
P = 100; Variable values at the initial estimate
R = .08206; Unknown value 0.505 Function Value 25
T = 300; Variable values at the solution
nmoles = 2.5 * 1000 / V; Unknown value 0.24618 Function Value
fV = P * V - (R * T);
Chen CL 41
function P2_09A2
clear, clc, format short g, format compact
xguess = 0.505 ;
disp(’Variable values at the initial estimate’);
disp([’ Unkn’ num2str(xguess) ’ Func.’ num2str(NLEfun(xguess))]);
xsolv=fzero(@NLEfun,xguess);
disp(’ Variable values at the solution’);
disp([’ Unkn’ num2str(xsolv) ’ Func.’ num2str(NLEfun(xsolv))]);
%- - - - - - - - - - - - - - - - - - - - - -
function fV = NLEfun(V);
P = 100; Variable values at the initial estimate
R = .08206; Unknown value 0.505 Function Value 28
T = 300; Variable values at the solution
nmoles = 2.5 * 1000 / V; Unknown value 0.079572 Function Value
Tc = 304.2;
Pc = 72.9;
a = 27 * R ^ 2 * Tc ^ 2 / (Pc * 64);
b = R * Tc / (8 * Pc);
fV = (P + a / (V * V)) * (V - b) - (R * T);
Chen CL 42

Bubble Point Calculation


for An Ideal Binary Mixture
Concepts Utilized: Calculation of bubble point in an ideal binary mixture.

Numerical Methods: Solution of a single nonlinear algebraic equation.

Problem Statement:

(a) Calculate the bubble point temperature and equilibrium composition associated
with a liquid mixture of 10 mol% n-pentane and 90 mol% n-hexane at 1 atm.

(b) Repeat the calculations for liquid mixtures containing 0 mol% up to 100 mol%
of n-pentane.

(c) Plot the bubble point temperature and mol% of n-pentane in the vapor phase
as a function of the mol% in the liquid phase.

The vapor pressure of n-pentane, PA? , in mm Hg can be calculated from the


Antoine equation:
? 1064.63
log(PA) = 6.85221 −
T + 232.0
Chen CL 43

where T is the temperature in oC. The vapor pressure of n-hexane, PB? , in mm Hg


can be calculated from the Antoine equation:

1171.53
log(PB? ) = 6.87776 −
T + 224.366

Solution:
At the bubble point, the sum of the partial vapor pressures of the components
must equal the total pressure, which in this case is 1 atm or 760 mm of Hg.
Denoting xA as the mole fraction of n-pentane in the liquid mixture and xB as the
mole fraction of n-hexane, the nonlinear equation to be solved for the bubble point
temperature is given by

f (Tbp) = xAPA? + xB PB? − 760

At the solution, f (Tbp) should become very small, f (Tbp) ≈ 0.

The vapor phase mole fraction of n-pentane, yA, and the mole fraction of
n-hexane, yB , can be calculated from Raoult’s law given by the equations

yA = xAPA? /760 yB = xB PB? /760


Chen CL 44

It is important to note that the bubble point can also be considered as the
temperature at which the individual mole fractions in the gas phase sum to 1.0 for
the given liquid phase composition. Thus this problem can alternately be solved
by solving the nonlinear equation given next as an alternate.

f (Tbp) = yA + yB − 1
Chen CL 45
function P2_10A
clear, clc, format short g, format compact
xguess = 49.5 ;
disp(’Variable values at the initial estimate’);
disp([’ Unkn’ num2str(xguess) ’ Func.’ num2str(NLEfun(xguess))]);
xsolv=fzero(@NLEfun,xguess);
disp(’ Variable values at the solution’);
disp([’ Unkn’ num2str(xsolv) ’ Func.’ num2str(NLEfun(xsolv))]);
%- - - - - - - - - - - - - - - - - - - - - -
function fTbp = NLEfun(Tbp);
xA = .1;
PA = 10 ^ (6.85221 - (1064.63 / (Tbp + 232)));
PB = 10 ^ (6.87776 - (1171.53 / (224.366 + Tbp)));
xB = 1 - xA; Variable values at the initial estimate
yA = xA * PA / 760; Unknown value 49.5 Function Value -28
yB = xB * PB / 760; Variable values at the solution
fTbp = xA * PA + xB * PB - 760;Unknown value 63.6645 Function Value
Chen CL 46

Adiabatic Flame Temperature in Combustion

Concepts Utilized: Material and energy balances on an adiabatic system and


calculation of adiabatic flame temperature.

Numerical Methods: Solution of a single nonlinear algebraic equation and use


of logical variable during solution.

Problem Statement:
When natural gas is burned with air, the maximum temperature that can be
reached (theoretically) is the adiabatic flame temperature (AFT). This
temperature depends mainly on the composition of the natural gas and the
amount of air used in the burner. Natural gas consists mainly of methane, ethane,
and nitrogen. The composition is different for natural gas found in various
locations. Determine the AFT for the following conditions, and plot the AFT as a
function of mol% CH4 and the stoichiometric molar air to fuel ratio. The
composition of natural gas is given below. The air-to-fuel ratios vary between 0.5
to 2.0. it can be assumed that the air and natural gas enter the burner at room
temperature and atmospheric pressure. What composition and air-to-fuel ratio
Chen CL 47

leads to the highest AFT?

Composition of Natural Gas:


CH4 65 ∼ 95 mol%
C2H6 3 ∼ 33 mol%
N2 2 mol%

The molar heat capacity of the reactants and the combustion products can be
calculated from the equation

Cp? = α + βT + γT 2

where T is in K and Cp? is in cal/g-mol·K. The constants of this equation for the
different components are shown in Table as given by Smith and Van Ness. The
heat of combustion is −212798 cal/g-mol for CH4 and −72820 cal/g-mol for
C2H6, as reported by Henley. Assume that both the air and the natural gas enter
at the temperature of 298 K and that the N2 content of the natural gas is always
2.0 mol%. Air is 21 mol%O2.
Chen CL 48

Molar Heat Capacity of Gases


α β × 103 γ × 106
CH4 3.381 18.044 -4.30
C2H6 2.247 38.201 -11.049
CO2 6.214 10.396 -3.545
H2 O 7.256 2.298 0.283
O2 6.148 3.102 -0.923
N2 6.524 1.25 -0.001

Solution:
The stoichiometric equations are

CH4 + 2O2 −→ CO2 + 2H2O


C2H6 + 72 O2 −→ 2CO2 + 3H2O

The actual to theoretical molar air-to-fuel ratio can be denoted by x with the inlet
mole fractions of CH4 and C2H6 denoted by y and z, respectively. For 1 mol of
natural gas, there would be 0.02 mol N2, y mol CH4, and z mol C2H6.
Therefore, the total moles of air required to react completely with the 1 mol of
Chen CL 49

natural gas would be given by (2y + [7/2]z)/0.21. Material balances for the
different compounds using a 1 mol natural gas basis are shown in Table for both
fuel-rich (x < 1) and fuel-lean (x > 1) situations.
Material Balance on the Reacting Species
Moles in the product (x < 1) Moles in the product (x < 1)
Expression For y = 0.75 Expression For y = 0.75
CH4 y(1 − x) 0.75(1 − x) 0 0
C2H6 z(1 − x) 0.23(1 − x) 0 0
CO2 (y + 2z)x 1.21x y + 2z 1.21
H2 O (2y + 3z)x 2.19x 2y + 3z 2.19
7

O2 0 0 2y + 2 z (x − 1) 2.305(x − 1)
7 7
 
N2 0.02 + 3.76x 2y + 2z 0.02 + 8.67x 0.02 + 3.76x 2y + 2z 0.02 + 8.67x
Since both the gas and the air enter at 298 K, this temperature can be used as a
reference for enthalpy calculations. The enthalpy change for the product gases
from T = 298 K up to the adiabatic flame temperature Tf can be calculated from
Chen CL 50

the following expression:

6 6 6
X 1X 1 X
∆HP = αini(Tf − 298) + βini(Tf2 − 2982) + γini(Tf3 − 2983)
i=1
2 i=1 3 i=1

where ∆HP is the enthalpy change per mole of natural gas fed, and ni is the
number of moles of the different compounds, as shown in the above Table.

For x < 1 the general energy balance can be written as

f (Tf ) = −212798xy − 372820xz + ∆HP = 0

For x > 1 the same equation can be used with the value x =1.

function P2_13
clear, clc, format short g, format compact
xguess = 2000. ;
disp(’Variable values at the initial estimate’);
disp([’ Unkn’ num2str(xguess) ’ Func.’ num2str(NLEfun(xguess))]);
xsolv=fzero(@NLEfun,xguess);
disp(’ Variable values at the solution’);
disp([’ Unkn’ num2str(xsolv) ’ Func.’ num2str(NLEfun(xsolv))]);
Chen CL 51

%- - - - - - - - - - - - - - - - - - - - - -
function fT = NLEfun(T);
y = .75;
x = .5;
z = 1 - y - .02;
if (x < 1)
CH4 = y * (1 - x);
else
CH4 = 0;
end
if (x < 1)
C2H6 = z * (1 - x);
else
C2H6 = 0;
end
if (x < 1)
CO2 = (y + 2 * z) * x;
else
CO2 = y + 2 * z;
end
if (x < 1)
H2O = (2 * y + 3 * z) * x;
Chen CL 52
else
H2O = 2 * y + 3 * z;
end
N2 = .02 + 3.76 * (2 * y + 7 * z / 2) * x;
alp = 3.381*CH4+2.247*C2H6+6.214*CO2+7.256*H2O+6.524*N2;
bet = 18.044*CH4+38.201*C2H6+10.396*CO2+2.298*H2O+1.25*N2;
gam = -4.3*CH4-(11.049*C2H6)-(3.545*CO2)+.283*H2O-(.001*N2);
H0 = alp*298+bet*.001*298*298 / 2+gam*10 ^ -6*298 ^ 3 / 3;
Hf = alp*T+bet*.001*T ^ 2 / 2+gam*.000001*T ^ 3 / 3;
fT = 212798*y*x+372820*z*x+H0 - Hf;

Variable values at the initial estimate


Unknown value 2000 Function Value 14679.6191
Variable values at the solution
Unknown value 2197.9949 Function Value 1.35e-011
Chen CL 53

Usteady-State Mixing in A Tank

Concepts Utilized: Unsteady-state material balances.

Numerical Methods: Solution of simultaneous ordinary differential equations.

Problem Statement:
A large tank is used for removing a small amount of settling solid particles
(impurities) from brine in a steady-state process. Normally, a single input stream
of brine (20% salt by weight) is pumped into the tank at the rate of 10 kg/min
and a single output stream is pumped from the tank at the same flow rate.
Normal operation keeps the level constant with the total mass in the tank at 1000
kg which is well below the maximum tank capacity.

At a particular time (t = 0) an operator accidentally opens a valve, which causes


pure water to flow continuously into the tank at the rate of 10 kg/min (in
addition to the brine feed), and the level in the tank begins to rise.

Determine the amount of both water and salt in the tank as a function of time
during the first hour after the pure water valve has been opened. Assume that the
outlet flow rate from the tank does not change and the contents of the tank are
well mixed at all times.
Chen CL 54

Solution:
A mass balance on the total mass in the tank yields

Accumulation = Input − Output


dM
= 10 + 10 − 10 = 10
dt

where M is the mass in kg. A mass balance on the salt in the tank yields
   
dS S S
= 10(0.2) − 10 = 2 − 10
dt M M

where S is the weight of salt in the tank in kg. Note that S/M represents the
mass fraction of salt that is leaving the tank at any time t. This is also the mass
fraction of salt within the tank since the tank is well mixed. Thus both M and S
are functions of time for this problem. At t = 0, the initial conditions are that
M = 1000 kg and S = 200 since the brine contains 20% salt by mass.

function P2_14_CCL
clear, clc, format short g, format compact
tspan = [0 60.]; % Range for the independent variable
y0 = [1000.; 200.]; % Initial values for the dependent variables
Chen CL 55

disp(’ Variable values at the initial point ’);


disp([’ t = ’ num2str(tspan(1))]);
disp(’ y dy/dt ’);
disp([y0 ODEfun(tspan(1),y0)]);
[t,y]=ode45(@ODEfun,tspan,y0);
for i=1:size(y,2)
disp([’ Solution for dependent variable y’ int2str(i)]);
disp([’ t y’ int2str(i)]);
disp([t y(:,i)]);
plot(t,y(:,i),’LineWidth’,2);
set(gca,’FontSize’,14,’Linewidth’,2)
title([’\bf Plot of dependent variable y’ int2str(i)],’FontSize’,1
xlabel(’\bf Independent variable (t)’,’FontSize’,14);
ylabel([’\bf Dependent variable y’ int2str(i)],’FontSize’,14);
if i < size(y,2)
disp(’* Pause **** Please press any key to continue ... ’)
pause
end
end
%- - - - - - - - - - - - - - - - - - - - - -
function dYfuncvecdt = ODEfun(t,Yfuncvec);
M = Yfuncvec(1);
Chen CL 56

S = Yfuncvec(2);
SaltPC = 100 * S / M;
dMdt = 10;
dSdt = 2 - (10 * S / M);
dYfuncvecdt = [dMdt; dSdt];
Chen CL 57

Heat Exchange in A Series of Tanks

Concepts Utilized: Unsteady-state energy balances and dynamic response of


well-mixed heated tanks in series.
Numerical Methods: Solution of simultaneous first order ordinary differential
equations.
Problem Statement:

Three tanks in sequence are used to preheat a multicomponent oil solution before
it is fed to a distillation column for separation. Each tank is initially filled with
1000 kg of oil at 20oC. Saturated steam at a temperature of 250oC 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 20oC. The tanks are well
mixed so that the temperature inside the tanks is uniform, and the outlet stream
Chen CL 58

temperature is the temperature within the tank. The heat capacity, Cp , of the oil
is 2.0 kJ/kg·oC. For a particular tank, the rate at which heat is transferred to the
oil from the steam coil is given by the expression

Q = U A(Tsteam − T )

where U A is the product of the heat transfer coefficient and the area of the coil.

U A = 10kJ/minoC for each tank


T = temperature of the oil in the tank in oC
Q = rate of heat transferred in kJ/min

(a) 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?

(b) After operation at steady state, the oil feed is stopped for three hours. What are
the highest temperatures that the oil in each tank will reach during this period?

(c) After three hours the oil feed is restored. How long will it take to achieve 101%
of steady state value for T3? Will all steady-state temperatures be the same as
before in part (a)?
Chen CL 59

Solution:

Energy balances should 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


dT1
M Cp = W CpT0 + U A(Tsteam − T1) − W CpT1
dt

Note that the unsteady-state mass balance is not needed for tank 1 or any other
tanks since the mass in each tank does not change with time. The preceding
differential equation can be rearranged and explicitly solved for the derivative,
Chen CL 60

which is the usual format for numerical solution

dT1 .
= [W Cp(T0 − T1) + U A(Tsteam − T1)] M Cp
dt
dT2 .
Similarly, = [W Cp(T1 − T2) + U A(Tsteam − T2)] M Cp
dt
dT3 .
= [W Cp(T2 − T3) + U A(Tsteam − T3)] M Cp
dt

function P2_16A_CCL
clear, clc, format short g, format compact
tspan = [0 200.]; % Range for the independent variable
y0 = [20.; 20.; 20.]; % Initial values for the dependent variables
disp(’ Variable values at the initial point ’);
disp([’ t = ’ num2str(tspan(1))]);
disp(’ y dy/dt ’);
disp([y0 ODEfun(tspan(1),y0)]);
[t,y]=ode45(@ODEfun,tspan,y0);
for i=1:size(y,2)
disp([’ Solution for dependent variable y’ int2str(i)]);
disp([’ t y’ int2str(i)]);
disp([t y(:,i)]);
Chen CL 61

plot(t,y(:,i),’LineWidth’,2);
set(gca,’FontSize’,14,’Linewidth’,2)
title([’\bf Plot of dependent variable y’ int2str(i)],’FontSize’,1
xlabel(’\bf Independent variable (t)’,’FontSize’,14);
ylabel([’\bf Dependent variable y’ int2str(i)],’FontSize’,14);
if i < size(y,2)
disp(’* Pause **** Please press any key to continue ... ’)
pause
end
end
%- - - - - - - - - - - - - - - - - - - - - -
function dYfuncvecdt = ODEfun(t,Yfuncvec);
T1 = Yfuncvec(1);
T2 = Yfuncvec(2);
T3 = Yfuncvec(3);
W = 100;
Cp = 2;
T0 = 20;
UA = 10;
Tsteam = 250;
M = 1000;
dT1dt = (W * Cp * (T0 - T1) + UA * (Tsteam - T1)) / (M * Cp);
Chen CL 62

dT2dt = (W * Cp * (T1 - T2) + UA * (Tsteam - T2)) / (M * Cp);


dT3dt = (W * Cp * (T2 - T3) + UA * (Tsteam - T3)) / (M * Cp);
dYfuncvecdt = [dT1dt; dT2dt; dT3dt];
Chen CL 63

Thank You for Your Attention


Questions Are Welcome