Chapter 6 : Multi component Phase Equillibrium

Example 6.3 Page No : 330

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


# Variables
slop = -4222.1 ;
R = 8.314 ;

# Calculations
del_h_vap = -R * slop * 10**-3 ;
%matplotlib inline

def f(x):
    return -4222.1 * x + 17.556

xdata = linspace(0.0032,0.004,8) ;
ydata = f(xdata) ;
plot(xdata,ydata) ;
xlabel("1/T[k**-1]")
ylabel("Ln(Psat[kPa])")
suptitle("least-squares linear fit")
show()

# Results
print "Enthalpy of vapourisation of GaCH3)3 = %.1f kJ/mol"%(del_h_vap) ;
Populating the interactive namespace from numpy and matplotlib
WARNING: pylab import has clobbered these variables: ['draw_if_interactive', 'new_figure_manager']
`%pylab --no-import-all` prevents importing * from pylab and numpy
Enthalpy of vapourisation of GaCH3)3 = 35.1 kJ/mol

Example 6.5 pageno : 332

In [8]:
# variables
MWni = 58.69           #g/mol
Psni = 8900            # kg/m**3 
Sni = 1.75             # J/m**2  surface tension of solid Ni
deltaHfus = -17.48      # kJ/mol
Tm = 1728               #K
R = 2*10**-9


# calculations
Uni = MWni/(Psni*1000)
T = Tm*(1+((2*Uni*Sni)/(deltaHfus*R)))

# results
print "molar density of the solid  %.1e m**3/mol" %Uni
print "T = %.f K"%T
# incorrect answer in textbook
molar density of the solid  6.6e-06 m**3/mol
T = -1139085 K

Example 6.8 Page No : 347

In [2]:
%matplotlib inline

from numpy import zeros
from matplotlib.pylab import *

# Variables
MW1 = 119.5 ;
MW2 = 58 ;
A = [0,4.77,9.83,14.31,19.38,23.27,25.53,25.07,21.55,13.56,0] ;
B = [0,.1 , .2 , .3 ,.4 ,.5 ,.6 ,.7 ,.8 ,.9,1] ;

C = zeros(11)
D = zeros(11)
# Calculations
print "    For weight percent  %.3f    del_h_mix = %.1f J/mol"%(C[0],D[0])
for i in range(1,11):
    x1 = (B[i] / MW1) / (B[i]/MW1 + (1 - B[i]) / MW2) ;
    x2 = 1 - x1 ;
    MW = x1 * MW1 + x2 * MW2 ;
    del_h_mix = - 1*(A[i]) * MW ;
    C[i] = del_h_mix ;
    D[i] = x1 ;
    print "    For weight percent  %.3f    del_h_mix = %.1f J/mol"%(x1,del_h_mix)

xdata = D ;
ydata = C ;
plot(xdata ,ydata) ;
xlabel("xCHCI3")
ylabel("delta Hmix[J/mol]")
Populating the interactive namespace from numpy and matplotlib
    For weight percent  0.000    del_h_mix = 0.0 J/mol
    For weight percent  0.051    del_h_mix = -291.7 J/mol
    For weight percent  0.108    del_h_mix = -635.6 J/mol
    For weight percent  0.172    del_h_mix = -981.5 J/mol
    For weight percent  0.244    del_h_mix = -1415.4 J/mol
    For weight percent  0.327    del_h_mix = -1817.3 J/mol
    For weight percent  0.421    del_h_mix = -2142.2 J/mol
    For weight percent  0.531    del_h_mix = -2272.9 J/mol
    For weight percent  0.660    del_h_mix = -2124.7 J/mol
    For weight percent  0.814    del_h_mix = -1465.1 J/mol
    For weight percent  1.000    del_h_mix = 0.0 J/mol
WARNING: pylab import has clobbered these variables: ['f']
`%pylab --no-import-all` prevents importing * from pylab and numpy
Out[2]:
<matplotlib.text.Text at 0x361ce50>

Example 6.9, Page 349

In [2]:
from sympy.solvers import solve
from sympy import Symbol

#Variables
cp1 = 27.5    #J/mol-K
cp2 = 25      #J/mol-K
cp3 = 20      #J/mol-K
T1 = 4+273    #K

#Calculations
#Since only species 2 and 3 are involved,
deltaH1_unmix = -160  #J
deltaH11_mix = 1100    #J

deltaH_mix = deltaH1_unmix+deltaH11_mix    #J
T2 = Symbol('T2')
Tf = solve(deltaH_mix+235*(T2-T1))

#Result
print "The final temperature is",Tf,"K"
The final temperature is [273] K

Example 6.10 Page No : 353

In [4]:
# Variables
A = [-32669,-31840,-28727,-26978,-24301,-20083,-13113] ;
B = [20 ,10 ,5 ,4 ,3 ,2 ,1] ;

# Calculations and Results
C = zeros(7)
D = zeros(7)

for i in range(7):
    del_h_mix = A[i] / (1. + B[i]) ;
    C[i] = del_h_mix ;
    D[i] = 1. / (1 + B[i]) ;
    print "For mole fraction %.3f   the entropy of mixing is %.0f J/mol"%(D[i],C[i])
For mole fraction 0.048   the entropy of mixing is -1556 J/mol
For mole fraction 0.091   the entropy of mixing is -2895 J/mol
For mole fraction 0.167   the entropy of mixing is -4788 J/mol
For mole fraction 0.200   the entropy of mixing is -5396 J/mol
For mole fraction 0.250   the entropy of mixing is -6075 J/mol
For mole fraction 0.333   the entropy of mixing is -6694 J/mol
For mole fraction 0.500   the entropy of mixing is -6556 J/mol

Example 6.12 Page No : 359

In [28]:
# Variables
x1 = 0.3 ;
x2 = 1- x1 ;
B11 = -910. ;
B22 = -1330. ;
B12 = -2005. ;
T = 333. ; 			#[K]
P = 10. * 10**5 ;
R = 8.314 ;

# Calculations and Results
v1 = round(R * T /P * 10**6 + B11,-1) ;			#....E6.9A
print "     v1 = %g cm**3/mol"%(v1)

V_bar_1 = (R * T / P) * 10**6+ (x1**2 + 2 * x1 * x2) *3.12 * B11 +  x2**2 * B12  - x2**2 * B22 ;			#.....E6.9B
print "     V_bar_1 = %.f cm**3/mol"%(V_bar_1) ;

del_v_mix = x1 * x2 * (2 * B12 - B11 - B22) ;			#.....E6.9C
print "     del_v = %.f cm**3/mol"%(del_v_mix);

# Note : answer are slightly different because of rounding error.
     v1 = 1860 cm**3/mol
     V_bar_1 = 990 cm**3/mol
     del_v = -372 cm**3/mol

Example 6.13 Page No : 360

In [3]:
from numpy import zeros
from matplotlib.pyplot import *

# Variables
h_H2SO4 = 1.596 ; 			#[kJ/mol]
h_H2O = 1.591 ; 			#[kJ/mol]
C1 = -74.40 ;
C2 = 0.561 ;
A = [0 ,0.1 , 0.2 ,0.3 ,0.4 ,0.5 ,0.6 ,0.7 ,0.8 ,0.9 ,1] ;
B = [1 ,0.9 ,0.8 ,0.7 ,0.6 ,0.5 ,0.4 ,0.3 ,0.2 ,0.1 ,0] ;

# Calculations
y_data_1 = zeros(11)
y_data_2 = zeros(11)
x_data = zeros(11)
for i in range(11):
    H_bar_H2SO4 = h_H2SO4 + C1 * B[i]**2 - 2 * C2 * C1 * A[i] * B[i]**2 ;
    H_bar_H2O = h_H2O + C1 * A[i]**2 -C2 * C1 * A[i]**2 * (1 - 2 * B[i]) ;
    y_data_1[i] =  H_bar_H2SO4 ;
    y_data_2[i] =  H_bar_H2O ;
    x_data[i] = A[i] ;

plot(x_data,y_data_1) ;
plot(x_data,y_data_2) ;
xlabel("xH2SO4")
ylabel("Partial molar enthalpy (J/mol)")
#suptitle("Partial molar enthalpies of water and sulfuric acid at 21°C.")
m = y_data_1[5]  ;
s = y_data_2[5]  ;
print "For equimolar mixture del_H_H2SO4 = %.1f kJ/mol   del_H_H2O = %.1f kJ/mol"%(m,s);
show()
For equimolar mixture del_H_H2SO4 = -6.6 kJ/mol   del_H_H2O = -17.0 kJ/mol

Example 6.16 Page No : 365

In [5]:
%matplotlib inline

from matplotlib.pyplot import *

# Variables
C1 = 1.596 ;
C2 = 1.591 ;
C3 = -74.40 ;
C4 = -0.561 ;
A = [ 0 ,0.1 ,0.2 ,0.3 ,0.4 ,0.5 ,0.6 ,0.7 ,0.8 ,0.9 ,1] ;
m = (-C1 + C2 + C3 * ( C4 * 0.25)) * 1000 ;

# Calculations
C = zeros(11)
for i in range(11):
    x_H2O = A[i] ;
    x_H2SO4 = 1- x_H2O ;
    h = C1 * x_H2SO4 + C2 * x_H2O + C3 * x_H2SO4 * x_H2O *(1 + C4 * x_H2SO4) ;
    C[i] = h * 10**3;

y1 = C[5]

def f613(x):
    return -m * (x - 0.5 ) + y1 ;

F = zeros(11)
for i in range(11):
    F[i] = f613(A[i]) ;

# Results
plot(A,C);
plot(A,F)
plot(0.5,-12000,"go")
xlabel("XH2O")
ylabel("h(J/mol)")
suptitle("Graphical determination of values for the partial molar enthalpies of sulfuric acid and water")

print "The partial molar property can be obtained by drawing tangent at mole fraction 0.5 ."

show()
Populating the interactive namespace from numpy and matplotlib
The partial molar property can be obtained by drawing tangent at mole fraction 0.5 .
WARNING: pylab import has clobbered these variables: ['draw_if_interactive']
`%pylab --no-import-all` prevents importing * from pylab and numpy