Gamma PhiFormulationVersion2

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

% Gamma-Phi Scheme

% NRTL and Virial Truncated to Two


% Acetone(1)/Water(2) mixture
% T = 65oC, Pxy Diagram
clc
clear
T = 65 + 273.15; %temperature K
R = 83.14; %cm3 bar mol-1 K-1
%Antoine Equation
A1 = 14.3145;
B1 = 2756.22;
C1 = 228.060;
P1sat = exp(A1 - B1./((T-273.15) + C1) ); %for acetone
A2 = 16.3872;
B2 = 3885.7;
C2 = 230.170;
P2sat = exp(A2 - B2./((T-273.15) + C2) ); %for water
%acetone
omega_1 = 0.307; % accentric factor for acetone
Tc1 = 508.2; %critical temp for acetone
Tr1 = T./Tc1; %critical temp for acetone
B0_1 = 0.083-0.422./((Tr1).^1.6);
B1_1 = 0.139-0.172./((Tr1).^4.2);
Pc1 = 47.01; %bar
Zc1 = 0.233;
Vc1 = 209; %cm^3 mol-1
B_hat1 = B0_1 + omega_1.*B1_1;
B11 = B_hat1.*Tc1.*R./Pc1 ;
%water
omega_2 = 0.345; % accentric factor for water
Tc2 = 647.1; %K
Tr2 = T./Tc2; %critical temp for water
B0_2 = 0.083-0.422./((Tr2).^1.6);
B1_2 = 0.139-0.172./((Tr2).^4.2);
Pc2 = 220.55; %bar
Zc2 = 0.229;
Vc2 = 145; %cm^3 mol-1
B_hat2 = B0_2 + omega_2.*B1_2;
B22 = B_hat2.*Tc2.*R./Pc2 ;
%acetone-water mixture
omega_12 = 0.5.*(omega_1 + omega_2); % accentric factor for mixture
Tc12 = (Tc1.*Tc2).^0.5; %K
Tr12 = T./Tc12; %critical temp for mixture
B0_12 = 0.083-0.422./((Tr12).^1.6);
B1_12 = 0.139-0.172./((Tr12).^4.2);
Zc12 = 0.5.*(Zc1 + Zc2);
Vc12 = ( 0.5.*(Vc1.^(1/3) + Vc2.^(1/3)) ).^3; %cm^3 mol-1
Pc12 = Zc12.*R.*Tc12./Vc12; %bar
B_hat12 = B0_12 + omega_12.*B1_12;
B12 = B_hat12.*Tc12.*R./Pc12 ;

delta_12 = 2.*B12 - B11 - B22;


%%%%%%%%%%%%%%% GAMMA-PHI SCHEME %%%%%%%%%%%%%%%%%%%%
T = 65 + 273.15; %K
PHI_OLD1 = 1;
PHI_OLD2 = 1;
Pgraph = [];
y1graph = [];
for x1 = 0:0.01:1
%%%%%%%%%%%%%%%%%%%% GAMMA CALCULATION (NRTL) %%%%%%%%%%%%%%%%%%%%%%
b_12= 631.05 ;%cal/mol
b_21= 1197.41 ;%cal/mol
alpha= 0.5343;
%%from Table in page 474
Tau_12= b_12/(R*T);
Tau_21= b_21/(R*T);
G_12= exp(-alpha*Tau_12);
G_21= exp(-alpha*Tau_21);
gamma1= exp(((1-x1)^2)*((Tau_21*((G_21/(x1+(1-x1)*G_21))^2)) + ((G_12*Tau_12)/(
((1-x1)+x1*G_12)^2))));
gamma2= exp(((x1)^2)*((Tau_12*((G_12/((1-x1)+(x1)*G_12))^2)) + ((G_21*Tau_21)/(
((x1)+(1-x1)*G_21)^2))));
%%%%%%%%%%%%%%% GAMMA-PHI SCHEME (BUBL P CALC) %%%%%%%%%%%%%%%%%%%%
check = 10;
while check ~= 1
P = x1.*gamma1.*P1sat./PHI_OLD1 + (1-x1).*gamma2.*P2sat./PHI_OLD2 ; %Calcula
tion of guess P
y1_old = x1.*gamma1.*P1sat./( PHI_OLD1.*P); %calculation for y1
PHI_1 = exp( (B11.*(P - P1sat) + P.*( (1-y1_old).^2 ).*delta_12)./(R.*T));
PHI_2 = exp( (B22.*(P - P2sat) + P.*( (y1_old).^2 ).*delta_12)./(R.*T));
P_new = x1.*gamma1.*P1sat./PHI_1 + (1-x1).*gamma2.*P2sat./PHI_2 ; %Calculati
on of new P
if abs(P-P_new) < 0.001
check = 1;
Pgraph(end+1) = P_new;
y1graph(end+1) = y1_old;
else
check = 10;
PHI_OLD1 = PHI_1;
PHI_OLD2 = PHI_2;
end
end
end
fprintf('
Table of Values \n');
fprintf('
P
x1
y1 \n');
MATRIX=[ Pgraph; 0:0.01:1; y1graph;];
disp(MATRIX');

plot(y1graph,Pgraph, 0:0.01:1,Pgraph)
xlabel('X1,Y1');
ylabel('Pressure in kPa');
title('Pxy diagram for acetone(1)/water(2) system at 65 degC ');
legend('P-X1','P-Y1');

You might also like