# Chapter 8 : Physical Equilibria Among Phases¶

## Example 8.1 page : 293¶

In :

# Variables
def  func(C,phi):
return C+2-phi

# Calculations and results
print ("part a")
print "degrees of freedom  =  %d "%(func(2,2))
print ("part b")
print "degrees of freedom  =  %d "%(func(3,2))
print ("part c")
print "degrees of freedom  =  %d "%(func(3,3))

part a
degrees of freedom  =  2
part b
degrees of freedom  =  3
part c
degrees of freedom  =  2


## Example 8.2 page : 297¶

In :

# Variables
T = 95. 			#C
P = 1013. 			#kPa
Tc = 135. 			#C
Pc = 3648. 			#kPa
T0 = 273.1 			#C
D = 0.3
P0 = 1800. 			#kPa
D2 = 0.42

# Calculations
Zc = 0.283
Tr = (T+T0)/(Tc+T0)
Pr = P/Pc
phic = 0.88
phi2 = phic*10**(D*0.013)
Prd =  P0/Pc
phi3 = 0.78
phi4 =  phi3*10**(D2*0.013)
gl =  phi2*P/(phi3*P0)

# Results
print "equation is gl  =  %.3f *y/x"%(gl)

equation is gl  =  0.641 *y/x


## Example 8.3 page :300¶

In :
import math

# Variables
ye = 0.434
Pt = 40.25 			#kPa
xe = 0.616
Pe1 = 22.9 			#kPa
Pe2 = 29.6 			#kPa

# Calculations
ge =  ye*Pt/(xe*Pe1)
gb = (1-ye)*Pt/((1-xe)*Pe2)
E =  math.log10(ge) *(1+ (1-xe)*math.log(gb) /(xe*math.log(ge)))**2
B =  math.log10(gb) *(1+ xe/(1-xe) *math.log(ge) /math.log(gb))**2
xe2 = 0.4
xb2 = 0.6
lnge2 = E/(1+ E*xe2/(B*xb2))**2
lngb2 = B/(1+ B*xb2/(E*xe2))**2
ge2 = 10**(lnge2)
gb2 = 10**(lngb2)
Pt1 = ge2*Pe1
Pt2 = gb2*Pe2

# Results
print "Total pressure in case 1   =  %.2f kPa and in case 2  =  %.2f kPa"%(Pt1, Pt2 )

Total pressure in case 1   =  40.78 kPa and in case 2  =  40.93 kPa


## Example 8.4 page : 310¶

In :
from numpy.linalg import solve

# Variables
k4 = 1.8
k5 = 0.8

# Calculations
A = [[k4, k5],[1, 1]]
b = [,]
C = solve(A,b)
x4 = C
x5 = C
y4 = k4*x4
y5 = k5*x5

# Results
print "Vapor and liquid mole fractions of component 1  =  %.2f and %.2f respectively"%(y4,x4)
print " Vapor and liquid mole fractions of component 2  =  %.2f and %.2f respectively"%(y5,x5)

Vapor and liquid mole fractions of component 1  =  0.36 and 0.20 respectively
Vapor and liquid mole fractions of component 2  =  0.64 and 0.80 respectively


## Example 8.5 page : 312¶

In :
import math

# Variables
v1 = 81. 			#cm**3/gmol
v2 = 97. 			#cm**3/gmol
d1 = 9.2 			#(cal/cm**3)**0.5
d2 = 8.6 			#(cal/cm**3)**0.5
R = 1.987
T = 373.1 			#K

# Calculations
d = 0.5*(d1+d2)
lng1 = v1*(d1-d)**2 /(R*T)
lng2 = v2*(d2-d)**2 /(R*T)
g1 = math.exp(lng1)
g2 = math.exp(lng2)

# Results
print "Activity coeffecients of components are %.3f and %.3f respectively"%(g1,g2)

Activity coeffecients of components are 1.010 and 1.012 respectively


## Example 8.6 page : 319¶

In :

# Variables
xe = 0.3
xe2 = 0.9
Pe0 = 810.
Pa0 = 470.
ge = 1.85
ge2 = 1.05
ga = 1.15
ga2 = 3.
Pt = 820. 			#mm
Pt2 = 900. 			#mm

# Calculations
ye = ge*xe*Pe0/Pt
ya = ga*(1-xe)*Pa0/Pt
yt = ye+ya
ye2 = ye/yt
ya2 = ya/yt
ye3 = ge2*xe2*Pe0/Pt2
ya3 = ga2*(1-xe2)*Pa0/Pt2
yt2 = ye+ya
ye4 = ye3/yt2
ya4 = ya3/yt2

# Results
print "In case 1, ye  =  %.3f and ya  =  %.3f"%(ye2,ya2)
print " In case 1, ye  =  %.3f and ya  =  %.3f"%(ye4,ya4)
print ('The calculations of ya in case 1 in textbook is wrong. please use a calculator')

In case 1, ye  =  0.543 and ya  =  0.457
In case 1, ye  =  0.842 and ya  =  0.155
The calculations of ya in case 1 in textbook is wrong. please use a calculator


## Example 8.7 page : 326¶

In :

# Variables
m1 = 121.
m2 = 18.
p1 = 0.0042
p2 = 0.0858

# Calculations
massfrac =  (p1*m1)/(p1*m1+p2*m2)

# Results
print "mass fractions of DMA and water are %.3f and %.3f respectively"%(massfrac,1-massfrac)

mass fractions of DMA and water are 0.248 and 0.752 respectively


## Example 8.9 page : 335¶

In :
from numpy import array

# Variables
FR = 25.
FE = 19.
bf = 130. 			#kg
af = 85. 			#kg

# Calculations
law = FR/FE
x1 = 45./150
x2 = 65./150
ER = 18.5/6
e = array([0.5, 0.1, 0.9])
r = array([0.28, 0.96, 0.04])
et = sum(e)
rt = sum(r)
ett = e/et
rtt = r/rt

# Results
print "the compositions of raffinate are ",
print (rtt)
print "the compositions of extract are",
print (ett)

the compositions of raffinate are  [ 0.21875  0.75     0.03125]
the compositions of extract are [ 0.33333333  0.06666667  0.6       ]


## Example 8.10 page : 342¶

In :

# Variables
v1 = 0.1316
v2 = 0.2941
x1 = 0.5
x2 = 0.2
x3 = 0.8
d1 = 14.87
d2 = 16.34

# Calculations and results
vm = x1*(v1+v2)
phi1 = x1*v1/vm
phi2 = (1-x1)*v2/vm
Hl1 = vm*phi1*phi2*(d1-d2)**2 *10**3
print ("case 1")
print "enthalpy  =  %.1f kJ/mol"%(Hl1)

case 1
enthalpy  =  98.2 kJ/mol


## Example 8.10b page : 343¶

In :
import math

# Variables
v1 = 0.1316
v2 = 0.2941
x1 = 0.5
x2 = 0.2
x3 = 0.8
d1 = 14.87
d2 = 16.34

# Calculations and results
vm = (1-x2)*v1+x2*v2
phi1 = (1-x2)*v1/vm
phi2 = (x2)*v2/vm
Hl2 = vm*phi1*phi2*(d1-d2)**2 *10**3
print ("case 2")
print "enthalpy  =  %.1f kJ/mol"%(Hl2)

case 2
enthalpy  =  81.5 kJ/mol


## Example 8.10c page : 343¶

In :
import math

# Variables
v1 = 0.1316
v2 = 0.2941
x1 = 0.5
x2 = 0.2
x3 = 0.8
d1 = 14.87
d2 = 16.34

# Calculations and results
vm = (1-x3)*v1+x3*v2
phi1 = (1-x3)*v1/vm
phi2 = (x3)*v2/vm
Hl3 = vm*phi1*phi2*(d1-d2)**2 *10**3
print ("case 3")
print "enthalpy  =  %.1f kJ/mol"%(Hl3)

case 3
enthalpy  =  51.2 kJ/mol