11 Basic Principles and Calculations
11 Basic Principles and Calculations
Chapter 2
Cheng-Liang Chen
PSE
LABORATORY
Department of Chemical Engineering
National TAIWAN University
Chen CL 1
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
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.
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
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
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
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
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
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
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
(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
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
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
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
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
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
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.
B
log(P ) = A + + C log(T ) + DT β
T
Chen CL 26
(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.
(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).
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
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
Concepts Utilized: Gas volume calculations using the ideal gas, van der Waals,
Soave-Redlich-Kwong, Peng-Robinson, and Beattie-Bridgeman equations of state.
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
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
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.
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
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
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
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
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
Solution:
The stoichiometric equations are
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
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 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;
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.
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
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
S = Yfuncvec(2);
SaltPC = 100 * S / M;
dMdt = 10;
dSdt = 2 - (10 * S / M);
dYfuncvecdt = [dMdt; dSdt];
Chen CL 57
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.
(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:
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
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