Chapter 11 : Properties of solutions

Example 11.1 Page No : 378

In [1]:
%matplotlib inline
import math 
from numpy import *
from matplotlib.pyplot import *


# Variables
antoine_const_benzene = [6.87987,1196.760,219.161]
antoine_const_toluene = [6.95087,1342.310,219.187]
t = 95.
P = 101.325

# Calculations
P1_s = 10**(antoine_const_benzene[0]-(antoine_const_benzene[1]/(t+antoine_const_benzene[2])))			 
P2_s = 10**(antoine_const_toluene[0]-(antoine_const_toluene[1]/(t+antoine_const_toluene[2])))			
x1 = linspace(0,1,10)
i = 0;			          #iteration parameter
n = len(x1);			 #iteration parameter
P_tot = zeros(10)
y1 = zeros(10)

while i<n :
    P_tot[i] = P2_s+((P1_s-P2_s)*x1[i])
    y1[i] = (x1[i]*P1_s)/(P_tot[i])	
    i = i+1;

#T-x-y diagram:
P = 760.
t1_s = ((antoine_const_benzene[1])/(antoine_const_benzene[0]-math.log10(P)))-antoine_const_benzene[2]
t2_s = ((antoine_const_toluene[1])/(antoine_const_toluene[0]-math.log10(P)))-antoine_const_toluene[2];
x1_initial = 0.0;
y1_initial = 0.0;
x1_final = 1.0;
y1_final = 1.0;

T = linspace(85,105,5)
k = 0;
l = len(T)
P1s = zeros(5)
P2s = zeros(5)
X1 = zeros(5)
Y1 = zeros(5)
while k<l:
    P1s[k] = 10**((antoine_const_benzene[0])-((antoine_const_benzene[1])/(T[k]+antoine_const_benzene[2])))
    P2s[k] = 10**((antoine_const_toluene[0])-((antoine_const_toluene[1])/(T[k]+antoine_const_toluene[2])))
    X1[k] = (P-P2s[k])/(P1s[k]-P2s[k]);	
    Y1[k] = (X1[k]*P1s[k])/P;			 # Calculations of mole fraction of Benzene in vapour phase (no unit) 
    k = k+1;

temp = zeros(l+2)
x1_benzene = zeros(l+2)
y1_benzene = zeros(l+2)
j = 0;

while j<l+2:
    if j == 0:
        temp[j] = t1_s;
        x1_benzene[j] = x1_final;
        y1_benzene[j] = y1_final;
    elif j == l+1:
        temp[j] = t2_s;
        x1_benzene[j] = x1_initial;
        y1_benzene[j] = y1_initial;
    else:
        temp[j] = T[j-1];
        x1_benzene[j] = X1[j-1];
        y1_benzene[j] = Y1[j-1];
    j = j+1;

# Results
print 'P-x-y results ';

for i in range( n):
      print 'x1 = %f \t y1 = %f\t P = %f Torr '%(x1[i],y1[i],P_tot[i]);

print 'T-x-y results  t = %f degree celsius\t P1_s = 760.0 Torr \t P2_s = -) Torr \t\t x1 = 1.0 \t y1 = 1.0 '%(t1_s);
for k in range(l):
    print 't = %f degree celsius\t P1_s = %f Torr \t P2_s = %f Torr \t x1 = %f \t y1 = %f '%(T[k],P1s[k],P2s[k],X1[k],Y1[k]);

print 't = %f degree celsius\t P1_s = -)Torr \t\t P2_s = 760.0 Torr \t x1 = 0.0 \t y1 = 0.0 '%(t2_s);
subplot(2,1,1)
plot(x1,P_tot,y1,P_tot)
suptitle('P-x-y diagram for benzene-toluene system at 95 degree celsius')
xlabel('x1,y1')
ylabel('P(Torr)')
subplot(2,1,2)
plot(x1_benzene,temp,y1_benzene,temp)
xlabel("x1,y1")
ylabel("t (degree celsius)")       
suptitle('T-x-y diagram for benzene-toluene sytem at 760 Torr')

show()
Populating the interactive namespace from numpy and matplotlib
P-x-y results 
x1 = 0.000000 	 y1 = 0.000000	 P = 477.025655 Torr 
x1 = 0.111111 	 y1 = 0.235600	 P = 554.713037 Torr 
x1 = 0.222222 	 y1 = 0.413315	 P = 632.400419 Torr 
x1 = 0.333333 	 y1 = 0.552144	 P = 710.087801 Torr 
x1 = 0.444444 	 y1 = 0.663592	 P = 787.775183 Torr 
x1 = 0.555556 	 y1 = 0.755031	 P = 865.462564 Torr 
x1 = 0.666667 	 y1 = 0.831407	 P = 943.149946 Torr 
x1 = 0.777778 	 y1 = 0.896158	 P = 1020.837328 Torr 
x1 = 0.888889 	 y1 = 0.951751	 P = 1098.524710 Torr 
x1 = 1.000000 	 y1 = 1.000000	 P = 1176.212092 Torr 
T-x-y results  t = 80.099595 degree celsius	 P1_s = 760.0 Torr 	 P2_s = -) Torr 		 x1 = 1.0 	 y1 = 1.0 
t = 85.000000 degree celsius	 P1_s = 881.542536 Torr 	 P2_s = 345.216082 Torr 	 x1 = 0.773380 	 y1 = 0.897062 
t = 90.000000 degree celsius	 P1_s = 1020.650885 Torr 	 P2_s = 406.866584 Torr 	 x1 = 0.575338 	 y1 = 0.772657 
t = 95.000000 degree celsius	 P1_s = 1176.212092 Torr 	 P2_s = 477.025655 Torr 	 x1 = 0.404719 	 y1 = 0.626363 
t = 100.000000 degree celsius	 P1_s = 1349.471568 Torr 	 P2_s = 556.502216 Torr 	 x1 = 0.256628 	 y1 = 0.455673 
t = 105.000000 degree celsius	 P1_s = 1541.703421 Torr 	 P2_s = 646.141534 Torr 	 x1 = 0.127136 	 y1 = 0.257903 
t = 110.614326 degree celsius	 P1_s = -)Torr 		 P2_s = 760.0 Torr 	 x1 = 0.0 	 y1 = 0.0 

Example 11.2 Page No : 384

In [10]:
# Variables
T = 95. 		    	 #temperature of the equimolar vapour mixture of benzene and toluene in degree celsius
y1 = 0.5	    		 #mole fraction of benzene in vapour phase (no unit)
y2 = 0.5    			 #mole fraction of toluene in vapour phase (no unit)
P1_s = 1176.21			 #saturation pressure of benzene at T, taken from Example 11.1 in Torr
P2_s = 477.03			 #saturation pressure of toluene at T, taken from Example 11.1 in Torr

# Calculations
P = 1./((y1/P1_s)+(y2/P2_s))
x1 = (y1*P)/P1_s;			 
x2 = 1-x1

# Results
print 'The composition of the liquid which is in equilibrium with the equimolar vapour mixture of\
 benzene and toluene at 95 degree celsius is  mole fraction of benzene\
  in liquid phase x1 = %f  mole fraction of toluene in liquid phase x2 = %f '%(x1,x2);
The composition of the liquid which is in equilibrium with the equimolar vapour mixture of benzene and toluene at 95 degree celsius is  mole fraction of benzene  in liquid phase x1 = 0.288542  mole fraction of toluene in liquid phase x2 = 0.711458 

Example 11.5 page no : 386

In [4]:
# Variables
n_pentaneA = 6.87632          # Antoine constants
n_hexaneA = 6.91058
n_heptanA = 6.89386
n_pentaneB = 1075.780 
n_hexaneB = 1189.640
n_heptanB = 1264.370
n_pentaneC = 233.205
n_hexaneC = 226.205
n_heptanC = 216.640
pressure = 90                 # pressure

# Calculations
logP1 = n_pentaneA - (n_pentaneB/(90 + n_pentaneC))
P1 = round(10**logP1 *133.322 /1000,1)
logP2 = n_hexaneA - (n_hexaneB/(90 + n_hexaneC))
P2 = round(10**logP2 *133.322 /1000,2)
logP3 = n_heptanA - (n_heptanB/(90 + n_heptanC))
P3 = round(10**logP3 *133.322 /1000,2)
P = 200
K1 = round(P1/P,3)
K2 = round(P2/P,2)
K3 = P3/P

# assume L/F = 0.4
L_F = 0.4
x1 = 0.3/(L_F + (1-L_F) * K1)
x2 = 0.3/(L_F + (1-L_F) * K2)
x3 = 0.4/(L_F + (1-L_F) * K3)
sum_x = x1+x2+x3

# assume L/F = 0.752
L_F = 0.752
x1 = 0.3/(L_F + (1-L_F) * K1)
x2 = 0.3/(L_F + (1-L_F) * K2)
x3 = 0.4/(L_F + (1-L_F) * K3)
sum_x = round(x1+x2+x3,1)           # which is equal to 1 

# Hence, L/F = 0.752 is correct
y1 = K1*x1
y2 = K2*x2
y3 = K3*x3

# Results
print "Hence, fraction vaporized, V/F = 1-(L-F) = %.3f"%(1-L_F)
print "Compositions of liquid and vapor leaving the flash unit are :"
print "x1 = %.4f   y1 = %.4f"%(x1,y1)
print "x2 = %.4f   y2 = %.4f"%(x2,y2)
print "x3 = %.4f   y3 = %.4f"%(x3,y3)
Hence, fraction vaporized, V/F = 1-(L-F) = 0.248
Compositions of liquid and vapor leaving the flash unit are :
x1 = 0.2246   y1 = 0.5285
x2 = 0.3045   y2 = 0.2863
x3 = 0.4709   y3 = 0.1851

Example 11.7 Page No : 397

In [2]:
import math
# Variables
T = 45.	    		 #temperature of the mixture in degree celsius
A = 2.230			 #van laar constant for the system at T (no unit)
B = 1.959			 #van laar constant for the system at T (no unit)
n1 = 30.    		 #mole percentage of nitromethane in the mixture ( in percentage)

# Calculations
n2 = 100-n1
x1 = n1/100
x2 = 1-x1
gaamma1 = math.exp(A/(1+((A/B)*(x1/x2)))**2)
gaamma2 = math.exp(B/(1+((B/A)*(x2/x1)))**2)

# Results
print 'The activity coefficients for the system using van laar equation is : gamma1 \
 = %f, gamma2 = %f \t '%( gaamma1,gaamma2);
The activity coefficients for the system using van laar equation is : gamma1  = 2.738343, gamma2 = 1.234443 	 

Example 11.8 Page No : 397

In [3]:
import math
# Variables
n_azeo = 44.8;			 #azeotropic composition given as mole percentage
Tb = 68.24;			 #boiling point of mixture in degree celsius
P = 760.;			 #pressure in Torr
P1_s = 506.;			 #saturation pressure of ethanol at Tb in Torr
P2_s = 517.;			 #saturation pressure of benzene at Tb in Torr
n1 = 10.;			 #mole percentage of ethanol in the mixture (in percentage)

# Calculations
x1 = n_azeo/100
x2 = 1-x1;		
gaamma1 = P/P1_s
gaamma2 = P/P2_s
A = math.log(gaamma1)*(1+((x2*math.log(gaamma2))/(x1*math.log(gaamma1))))**2
B = math.log(gaamma2)*(1+((x1*math.log(gaamma1))/(x2*math.log(gaamma2))))**2
x1 = n1/100
x2 = 1-x1;	
gaamma1 = math.exp(A/(1+((A/B)*(x1/x2)))**2)
gaamma2 = math.exp(B/(1+((B/A)*(x2/x1)))**2)

# Results
print 'The van Laar constants for the system are : A = %f \t B = %f '%(A,B)
print 'The activity coefficients for the system using van laar equation are\
 : gamma1 = %f \t gamma2 = %f \t '%( gaamma1,gaamma2);
The van Laar constants for the system are : A = 1.910203 	 B = 1.328457 
The activity coefficients for the system using van laar equation are : gamma1 = 4.137783 	 gamma2 = 1.025531 	 

Example 11.9 Page No : 399

In [18]:
import math
# Variables

T = 45.     			 #temperature of the system in degree celsius
A_12 = 0.1156;			 #Wilson's parameter for the system at T (no unit)
A_21 = 0.2879;			 #Wilson's parameter for the system at T (no unit)
x1 = 0.3;	    		 #mole fraction of nitromethane in the liquid mixture (no unit)

# Calculations
x2 = 1-x1
ln_gaamma1 = -math.log(x1+(A_12*x2))+(x2*((A_12/(x1+(A_12*x2)))-(A_21/((A_21*x1)+x2))));			
gaamma1 = math.exp(ln_gaamma1)
ln_gaamma2 = -math.log(x2+(A_21*x1))-(x1*((A_12/(x1+(A_12*x2)))-(A_21/((A_21*x1)+x2))));			 # Calculations of ln(activity coefficient) using Eq.(11.90) (no unit)
gaamma2 = math.exp(ln_gaamma2)

# Results
print 'The activity coefficients for the system using Wilsons parameters are : gamma1 = %f \
 \t gamma2 = %f \t '%( gaamma1,gaamma2);
The activity coefficients for the system using Wilsons parameters are : gamma1 = 2.512605  	 gamma2 = 1.295788 	 

Example 11.10 Page No : 401

In [2]:
import math
# Variables
T = 345.			 #temperature of the mixture in K
x1 = 0.8			 #mole fraction of ethanol in the liquid phase (no unit)

nu_ki = [1,1,1,6]			 #number of groups of type: CH3, CH2, OH and ACH respectively (no unit)
R_k = [0.9011,0.6744,1.0000,0.5313];			 #Group volume parameter for CH3, CH2, OH and ACH respectively (no unit)
Q_k = [0.848,0.540,1.200,0.400];			 #Area parameter for CH3, CH2, OH and ACH respectively (no unit)
R = 8.314;			        #universal gas constant in J/molK
u12_u22 = -241.2287;		#UNIQUAC parameter for the system in J/molK
u21_u11 = 2799.5827;		#UNIQUAC parameter for the system in J/molK
z = 10.     			 #co-ordination number usually taken as 10 (no unit)

# Calculations
x2 = 1-x1
r1 = (nu_ki[0]*R_k[0])+(nu_ki[1]*R_k[1])+(nu_ki[2]*R_k[2]);			 
r2 = (nu_ki[3]*R_k[3])
phi1 = (x1*r1)/((x1*r1)+(x2*r2));			 
phi2 = (x2*r2)/((x2*r2)+(x1*r1));			 
q1 = (nu_ki[0]*Q_k[0])+(nu_ki[1]*Q_k[1])+(nu_ki[2]*Q_k[2])			 
q2 = (nu_ki[3]*Q_k[3])			
theta1 = (x1*q1)/((x1*q1)+(x2*q2))
theta2 = (x2*q2)/((x1*q1)+(x2*q2))
l1 = ((z/2)*(r1-q1))-(r1-1);		
l2 = ((z/2)*(r2-q2))-(r2-1);		
tau_12 = math.exp(-(u12_u22)/(R*T));		
tau_21 = math.exp(-(u21_u11)/(R*T));		
tau_11 = 1.0;			 
tau_22 = 1.0;			 

ln_gaamma1_c = math.log(phi1/x1)+((z/2)*q1*math.log(theta1/phi1))+l1-((phi1/x1)*((x1*l1)+(x2*l2)));
ln_gaamma2_c = math.log(phi2/x2)+((z/2)*q2*math.log(theta2/phi2))+l2-((phi2/x2)*((x1*l1)+(x2*l2)));
ln_gaamma1_r = q1*(1-math.log((theta1*tau_11)+(theta2*tau_21))-(((theta1*tau_11)/((theta1*tau_11)+(theta2*tau_21)))+((theta2*tau_12)/((theta1*tau_12)+(theta2*tau_22)))));
ln_gaamma2_r = q2*(1-math.log((theta1*tau_12)+(theta2*tau_22))-(((theta1*tau_21)/((theta1*tau_11)+(theta2*tau_21)))+((theta2*tau_22)/((theta1*tau_12)+(theta2*tau_22)))));
ln_gaamma1 = ln_gaamma1_c+ln_gaamma1_r
ln_gaamma2 = ln_gaamma2_c+ln_gaamma2_r
gaamma1 = math.exp(ln_gaamma1);			 
gaamma2 = math.exp(ln_gaamma2);			 

# Results
print 'The activity coefficients for the system using the UNIQUAC equation are : gamma1 \
 = %f \t gamma2 = %f \t '%( gaamma1,gaamma2);
The activity coefficients for the system using the UNIQUAC equation are : gamma1  = 1.060567 	 gamma2 = 3.679066 	 

Example 11.11 Page No : 405

In [4]:
import math
# Variables
T = 307.			 #temperature of the mixture in K
x1 = 0.3			 #mole fraction of acetone in the liquid phase (no unit)

nu_ki = [1.,1.,2.,3.]
R_k = [0.9011,1.6724,0.6744]
Q_k = [0.848,1.488,0.540];			 
a_19 = 476.40;			 #group interaction parameter for the system in K
a_91 = 26.760;			 #group interaction parameter for the system in K
z = 10.     			 #co-ordination number usually taken as 10 (no unit)

# Calculations
x2 = 1-x1;			 # Calculations of mole fraction of benzene in liquid phase (no unit)
r1 = (nu_ki[0]*R_k[0])+(nu_ki[1]*R_k[1])
r2 = (nu_ki[2]*R_k[0])+(nu_ki[3]*R_k[2])
phi1 = (x1*r1)/((x1*r1)+(x2*r2))
phi2 = (x2*r2)/((x2*r2)+(x1*r1))
q1 = (nu_ki[0]*Q_k[0])+(nu_ki[1]*Q_k[1])			
q2 = (nu_ki[2]*Q_k[0])+(nu_ki[3]*Q_k[2])
theta1 = (x1*q1)/((x1*q1)+(x2*q2));
theta2 = (x2*q2)/((x1*q1)+(x2*q2));
l1 = ((z/2)*(r1-q1))-(r1-1);		
l2 = ((z/2)*(r2-q2))-(r2-1);		
ln_gaamma1_c = math.log(phi1/x1)+((z/2)*q1*math.log(theta1/phi1))+l1-((phi1/x1)*((x1*l1)+(x2*l2)));
ln_gaamma2_c = math.log(phi2/x2)+((z/2)*q2*math.log(theta2/phi2))+l2-((phi2/x2)*((x1*l1)+(x2*l2)));
a_11 = 0.
a_99 = 0.
psi_19 = math.exp(-(a_19)/(T));			
psi_91 = math.exp(-(a_91)/(T));			
psi_11 = 1.;			 
psi_99 = 1.;			 
x1_1 = nu_ki[0]/(nu_ki[0]+nu_ki[1]);			
x1_18 = nu_ki[1]/(nu_ki[0]+nu_ki[1]);		
theta1_1 = (Q_k[0]*x1_1)/((Q_k[0]*x1_1)+(Q_k[1]*x1_18))
theta1_18 = (Q_k[1]*x1_18)/((Q_k[1]*x1_18)+(Q_k[0]*x1_1))
ln_tau1_1 = Q_k[0]*(1-math.log((theta1_1*psi_11)+(theta1_18*psi_91))-(((theta1_1*psi_11)/((theta1_1*psi_11)+(theta1_18*psi_91)))+((theta1_18*psi_19)/((theta1_1*psi_19)+(theta1_18*psi_11)))));
ln_tau1_18 = Q_k[1]*(1-math.log((theta1_1*psi_19)+(theta1_18*psi_99))-(((theta1_1*psi_91)/((theta1_1*psi_99)+(theta1_18*psi_91)))+((theta1_18*psi_99)/((theta1_1*psi_19)+(theta1_18*psi_99)))));
x2_1 = nu_ki[2]/(nu_ki[2]+nu_ki[3]);			 
x2_2 = nu_ki[3]/(nu_ki[2]+nu_ki[3]);			 
ln_tau2_1 = 0;
ln_tau2_2 = 0;
x_1 = ((x1*nu_ki[0])+(x2*nu_ki[2]))/((((x1*nu_ki[0])+(x1*nu_ki[1])))+((x2*nu_ki[2])+(x2*nu_ki[3])));
x_2 = ((x2*nu_ki[3]))/((((x1*nu_ki[0])+(x1*nu_ki[1])))+((x2*nu_ki[2])+(x2*nu_ki[3])));
x_18 = ((x1*nu_ki[1]))/((((x1*nu_ki[0])+(x1*nu_ki[1])))+((x2*nu_ki[2])+(x2*nu_ki[3])));
theta_1 = (Q_k[0]*x_1)/((Q_k[0]*x_1)+(Q_k[1]*x_18)+(Q_k[2]*x_2));			
theta_2 = (Q_k[2]*x_2)/((Q_k[0]*x_1)+(Q_k[1]*x_18)+(Q_k[2]*x_2));			
theta_18 = (Q_k[1]*x_18)/((Q_k[0]*x_1)+(Q_k[1]*x_18)+(Q_k[2]*x_2));			
ln_tau_1 = Q_k[0]*(1-math.log((theta_1*psi_11)+(theta_2*psi_11)+(theta_18*psi_91))-((((theta_1*psi_11)+(theta_2*psi_11))/((((theta_1*psi_11)+(theta_2*psi_11))+(theta_18*psi_91)))+((theta_18*psi_19)/((theta_1*psi_19)+(theta_2*psi_19)+(theta_18*psi_11))))));
ln_tau_2 = Q_k[2]*(1-math.log((theta_1*psi_11)+(theta_2*psi_11)+(theta_18*psi_91))-((((theta_1*psi_11)+(theta_2*psi_11))/((((theta_1*psi_11)+(theta_2*psi_11))+(theta_18*psi_91)))+((theta_18*psi_19)/((theta_1*psi_19)+(theta_2*psi_19)+(theta_18*psi_11))))));
ln_tau_18 = Q_k[1]*(1-math.log((theta_1*psi_19)+(theta_2*psi_19)+(theta_18*psi_99))-(((((theta_1+theta_2)*psi_91)/((theta_1*psi_11)+(theta_2*psi_11)+(theta_18*psi_91)))+((theta_18*psi_99)/((theta_1*psi_19)+(theta_2*psi_19)+(theta_18*psi_11))))));
ln_gaamma1_r = (nu_ki[0]*(ln_tau_1-ln_tau1_1))+(nu_ki[1]*(ln_tau_18-ln_tau1_18));
ln_gaamma2_r = (nu_ki[2]*(ln_tau_1-ln_tau2_1))+(nu_ki[3]*(ln_tau_2-ln_tau2_2));
ln_gaamma1 = ln_gaamma1_c+ln_gaamma1_r
ln_gaamma2 = ln_gaamma2_c+ln_gaamma2_r
gaamma1 = math.exp(ln_gaamma1);			
gaamma2 = math.exp(ln_gaamma2);			

# Results
print 'The activity coefficients for the system using the UNIFAC method are\
 : gamma1 = %f \t gamma2 = %f \t '%( gaamma1,gaamma2);
The activity coefficients for the system using the UNIFAC method are : gamma1 = 2.149891 	 gamma2 = 1.191192