Professional Documents
Culture Documents
AND MATLAB
Housam Binous
*
Chemical engineering Department
King Fahd University, Petroleum and Minerals,
Dhahran, Saudi Arabia
ABSTRACT
The Author presents a teaching technique used successfully in an undergraduate
course to seniors at The National Institute of Applied Sciences and Technology (INSAT)
in Tunis, Tunisia. The present paper details the computational aspects needed to obtain
residue curves (RCs) for a binary and various ternary systems using Mathematica
and
MATLAB, which are taught in Tunisia. The first mixture studied is composed of
ethanol isopropanol. A ternary ideal mixture composed of benzene toluene p-xylene
is treated next. A non- ideal ternary mixture (ethanol water ethylene glycol), using the
Wilson model to predict liquid-phase activity coefficients, is also presented. Finally, a
case, where both high pressure effect and deviation from ideal behavior in the liquid
phase must be considered, using the Soave - Redlich - Kwong (SRK) equation of state
(EOS) and the Wilson model, respectively, is studied. This final mixture contains
acetone, chloroform and methanol. All problems are solved using the built-in
Mathematica
and MATLAB.
Keywords: Residue Curve, distillation, Mathematica
, MATLAB.
* binoushousam@yahoo.com
In: Computer Simulations
Editors: Boris Nemanjic and Navenka Svetozar
ISBN: 978-1-62257-580-0
c 2013 Nova Science Publishers, Inc.
Theexclusivelicensefor this PDF is limited to personal websiteuseonly. No part of this digital document
may bereproduced, stored in aretrieval systemor transmitted commercially in any formor by any means.
Thepublisher has taken reasonablecarein thepreparation of this digital document, but makes no expressed
or implied warranty of any kind and assumes no responsibility for any errors or omissions. No liability is
assumed for incidental or consequential damages in connection with or arising out of information contained
herein. This digital document is sold with theclear understanding that thepublisher is not engaged in
rendering legal, medical or any other professional services.
Housam Binous 162
NOMENCLATURE
P : total pressure (bar)
P
c,i
: critical pressure (bar)
P
r,i
: reduced pressure
for i=1 to N
c
(1)
where
and
are the liquid mole fraction of component i in the still and the equilibrium
vapor mole fraction. is the warped time defined by: =
0
1
1
0
+
1
2
1+ 1+
1 1+ 1+1
0
1
0
1+ 1+1
. (3)
This equation is obtained by using Equations (1) and (2), the method of partial fractions
and separation of variables.
Housam Binous 164
It is clear from Equation (1) that good vapor-liquid equilibrium prediction will be
necessary in order to compute RCs. The next section presents extensive details about this
important matter, which is ubiquitous in chemical separation science.
Figure 2. Batch dstillation still.
VAPOR-LIQUID EQUILIBRIUM PREDICTION
Vapor pressure, a function of temperature only, is given by empirical equations such as
the Antoine equation:
+
, (4)
and the Modified Antoine equation:
+
+
, (5)
where
and
, (6)
where
is the gas-phase fugacity coefficient always obtained from an EOS such as the
Soave-Redlich-Kwong equation of state and
=1
+1
=1
=1
(7)
In Equation (7),
and
and
. (8)
The fugacity coefficient in the gas-phase is given by the following equation (Sandler,
1999 and Soave 1972):
= 1
0.5
0.5
(9)
In Equation (9), Z is the compressibility factor, which is a solution of the cubic equation
(Sandler, 1999 and Soave 1972):
2
+
2
= 0 (10)
Constants
) and temperature
(
), where
and
are the critical pressure and temperature, and the acentric factor, .
For pure species, one can use the following definitions (Sandler, 1999 and Soave 1972):
= 0.42747
2
,
with
= 1 +1
0.5
2
and = 0.480 +1.574
0.176
2
, and
=
0.08664
.
Mixing rules for vapor mixtures can be written as follows:
=
=1
=1
,
where
= (1
2
, and =
=1
. Values of the binary interaction
parameters,
+
2
2
+
3
3
. (11)
Housam Binous 168
The code uses the new built-in Mathematica
command, LocatorPane, to get the
coordinates of the computers mouse when user clicks the left button of the mouse:
[[, ( = {#[[1]], [1 #[[1]], #[[2]]]})],
A small mathematical trick (in the command: [1 #[[1]], #[[2]]]) avoid having
mole fractions that are either negative or above 100%. An initial stills composition is
assigned these particular mouse coordinates. The code then integrates the system of DAEs for
this initial composition and draws the RC passing by this user-specified point.
The MATLAB
code operates in a similar manner and uses the built-in MATLAB
command, ginput, in order to determine the initial stills composition, which corresponds to
the position of the computers mouse when the user clicks the left button of the mouse.
RC COMPUTATION FOR ETHANOL WATER ETHYLENE
GLYCOL MIXTURE
The tables 2, 3 and 4 give the modified Antoines constants and the data for the Wilson
model.
Table 2. Antoines constants for the water ethanol ethylene glycol mixture
(with F=2 and C=0).
A B D E
Water 65.9278 -7227.53 -7.17695 4.0313 e-6
Ethanol 86.4860 -7931.10 -10.2498 6.38949 e-6
Ethylene
glycol
57.9410 -8860.70 -5.71660 3.10800 e-6
Table 3. binary interaction parameters
for the water ethanol ethylene glycol mixture.
Water Ethanol Ethylene glycol
Water 0 276.75570 266.4848
Ethanol 975.48590 0 1539.411
Ethylene glycol 1043.84800 -129.2041 0
Table 4. molar volumes for the water ethanol ethylene glycol mixture.
Water 18.1
Ethanol 58.7
Ethylene glycol 55.9
Computation of Residue Curves Using Mathematica and MATLAB 169
Figure 5. RC for the water ethanol ethylene glycol mixture at 1 atm using Mathematica
.
Figure 6. Extractive distillation scheme for anhydrous ethanol production.
From the RCs (see Figure 5), it is clear that there is no distillation boundary since all RCs
start from the binary azeotrope (ethanol-water with 88% ethanol mole fraction) and end-up at
the ethylene glycol corner. Thus, the unique azeotrope is an unstable node; ethylene glycol is
0.0 0.2 0.4 0.6 0.8 1.0
water 0.0
0.2
0.4
0.6
0.8
1.0
ethanol
ethylene glycol
A
Housam Binous 170
a stable node and both ethanol and water are saddle point. Again, one can drag and place the
Locator at any position inside the triangle and the corresponding RC will be plotted
instantaneously.
Ethylene glycol can serve as an entrainer in order to perform extractive distillation (see
Figure 6) and obtain anhydrous ethanol. This can represent a good alternative to the well-
known three columns Kubierschky system using heteroazeotropic distillation and
cyclohexane as an entrainer.
RC COMPUTATIONS FOR THE HIGH PRESSURE CASE
Figure 7 shows a RC for the ternary system chloroform acetone methanol at P=10
atm. The tables 8, 9 and 10 give the modified Antoines constants and the data for the Wilson
model.
Table 8. Antoines constants for the chloroform acetone methanol mixture
(with F=2 and C=0)
A B D E
Chloroform 73.7 -6055.6 -8.9189 7.74407 e-6
Acetone 71.3 -5952. -8.531 7.82393 e-6
Methanol 59.83 -6282.8 -6.378 4.61746 e-6
Figure 7. RC for the chloroform acetone methanol mixture at 10 atm using Mathematica
.
0.0 0.2 0.4 0.6 0.8 1.0
chloroform 0.0
0.2
0.4
0.6
0.8
1.0
acetone
methanol A
1
A
2
A
3
A
4
Computation of Residue Curves Using Mathematica and MATLAB 171
Table 9. binary interaction parameters for the chloroform acetone methanol mixture
Chloroform Acetone Methanol
Chloroform 0 116.1171 1694.0240
Acetone -506.8518 0 551.4545
Methanol -361.7944 -124.932 0
Table 10. molar volumes for the chloroform acetone methanol mixture
Chloroform 80.7
Acetone 74.0
Methanol 40.7
The critical temperature and pressure and the acentric factor are given in Table 11.
Table 11. Critical temperature and pressure and the acentric factor for the
chloroform acetone methanol mixture.
(C)
(kPa)
Chloroform 263.2 5370 0.21796
Acetone 235.0 4700 0.30399
Methanol 239.4 7376 0.55699
Table 12. All azeotropes of the chloroform acetone methanol mixture at 10 atm.
Chloro-form acetone methanol bubble-point
: Chloroform-Acetone-
Methanol (saddle point)
6.66 % 29.17 % 64.17 % 402.35 K
: Chloroform-Methanol
(unstable node)
45.54 % 0 % 54.46 % 398.758 K
: Chloroform-Acetone
(stable node)
70.90 % 29.10 % 0 % 422.867 K
: Acetone-Methanol
(unstable node)
0 % 42.75 % 57.25 % 402.105 K
The compositions of the azeotropes and their corresponding bubble-temperature, at a
pressure equal to 10 atm, are given in Table 12. The three binary azeotropes are obtained as a
result of the RCM calculation. For the ternary azeotrope, accurate composition and bubble-
temperature computation required a separate calculation using the built-in command of
Mathematica
2
+
2
== 0,
0 ==
. 1
, 10 == 1, 20 == 2,
30 == 1 1 2,
0 == /. 1, 10 == 1/. 1, 20 == 2/. 1,
3[0] == (3/. 1)}, {1, 2, 3, , , 1, 2, 3}, {, 100,100}]
TEACHING DISTILLATION AND RCMS TO SENIOR
STUDENTS AT INSAT
Dr. Housam Binous started teaching RCM calculation at INSAT in 2002. A derivation of
Equations 1 and 3 is presented in the first lecture. VLE prediction is taught in a two-hour
separate lecture. Next, the author moves on to the application of RCMs in order to understand
complex distillation problems such as azeotropic, extractive and heteroazeotropic distillation
of ternary systems where one of the component is an entrainer. A brief discussion of entrainer
selection criteria is given too. In addition, separation of partially miscible mixtures such as the
n-butanol-water mixture using distillation column and decanters is presented. Finally, the
author usually ends this part of his course with a brief presentation of pressure swing
distillation and heat-integrated distillation columns. Since 2006, a four-hour computer
laboratory gives students hand-on experience on VLE data computation and RCMs
calculations using Mathematica
and ASPEN
, allow the
determination of RCM, it is useful to know how such computations are performed and how to
interpret the results that are obtained. All Mathematica
10
2
2
2+
; 3
10
3
3
3+
; 1
=
11
;
2[_] =
22
; 3[_] =
33
;
(* Solving the system of DAEs *)
[1 = [[{1
[] == 1[] 1[],
2
[] == 2[] 2[],
3
== 3 3,
11 + 22 + 33 == 0, 0 == 380,
1[0] == [[1]], 2[0] == [[2]], 3[0] == 1 [[1]] [[2]]}, {1, 2, 3, }, {, 0,10}]];
2 = [[{1
[] == 1[] 1[],
2
[] == 2[] 2[],
3
== 3 3,
11 +22 + 33 == 0,
0 == 380, 10 == 1, 20 == 2,
3[0] == 1 [[1]] [[2]]}, {1, 2, 3, }, {, 0,10}]];
(* Position of the Locator*)
[[, ( = {#[[1]], [1 #[[1]], #[[2]]]})],
(* Plotting the results *)
[[{[{1[], 2[]}/. 1],
[{1[], 2[]}/. 2]}, {, 0,10},
{{[0.005], }, {[0.005], }},
0,1, 0,1, benzene,p-xylene,
toluene, 0.1, 0.05, 1,0, 1,0, 0,1,
450,450, 40,40, 25,18,
]], {{0,0}, {1,1}}]]],
{{, {0.2,0.2}}, {0,0}, {.5, .5}, },
{{1,6}}]
Computation of Residue Curves Using Mathematica and MATLAB 175
APPENDIX 2. MATLAB CODE
h=figure(1);
line([0 1],[1 0])
axis([0 1 0 1])
hold on
button = questdlg('do you want to draw a residue curve',...
'','yes','no','yes');
while (button(1)=='y')
% determination of the position of the mouse
[x y]=ginput(1);
if x<0
x=max(x,0);
end;
if y<0
y=max(0,y);
end;
if y+x>1
y=min(1-x,y);
end;
% Solving the system of DAEs
opts = odeset('Mass','M','MassSingular','yes');
[t X]=ode15s('RCM1',[0 10],[x y 1-x-y 350],opts);
% plotting the residu curve
plot(X(:,1),X(:,2),'r')
[t X]=ode15s('RCM2',[0 10],[x y 1-x-y 350],opts);
plot(X(:,1),X(:,2),'r')
button = questdlg('do you want to draw a residue curve','',...
'yes','no','yes');
APPENDIX 2. MATLAB CODE
(Continued)
end
close(h)
function xdot=RCM1(t,x,flag)
if isempty(flag),
Housam Binous 176
T=x(4);
% Total Pressure
P=760;
% Antoine constants
A1=6.87987;B1=1196.76;C1=219.161;
A2=6.99053;B2=1453.43;C2=215.310;
A3=6.95087;B3=1342.31;C3=219.187;
% Antoine Equation
PS1=10^(A1-B1/(C1+T));
PS2=10^(A2-B2/(C2+T));
PS3=10^(A3-B3/(C3+T));
% Raoults Law
y1=PS1*x(1)/P;
y2=PS2*x(2)/P;
y3=PS3*x(3)/P;
% System of DAEs
xdot(1)=x(1)-y1;
xdot(2)=x(2)-y2;
xdot(3)=x(3)-y3;
xdot(4)=y1+y2+y3-1;
xdot = xdot'; % xdot must be a column vector
else
% Return M
M = zeros(4,4);
M(1,1) = 1;
M(2,2) = 1;
M(3,3) = 1;
xdot = M;
end