# Chapter 3 : The Simplest Phase Equilibrium Examples and Some Simple Estimating Rules¶

### Example 3.1 Page: 52¶

In :
import math

T = 20.         #[C]
P = 1.          #[atm]

x_N2 = 0
x_O2 = 0
x_water = 1-x_N2-x_O2
p_water = 0.023     #[atm]
y_water = x_water*p_water/P

print "The mole fraction of water vapour in air in equilibrium with water is %f"%(y_water)

The mole fraction of water vapour in air in equilibrium with water is 0.023000


### Example 3.2 Page: 53¶

In :
import math

T = 20.         #[C]
P = 1.          #[atm]
y_water = 0.023
y = 1-y_water
y_O2 = y*0.21
H_O2 = 40100        #[atm]
x_O2 = y_O2*P/H_O2
y_N2 = y*0.79
H_N2 = 80400.       #[atm]

x_N2 = y_N2*P/H_N2
c = x_O2*998.2/18   #[(mole O2)/(L solution)]
V = c*24.06         #[(L O2, STP)/(L solution)]
V = V*1000          #[(ml O2, STP)/(L solution)]

print "Concentration of oxygen dissolved in water at equilibrium is %f mL O2, STP)/L solution)"%(V)

Concentration of oxygen dissolved in water at equilibrium is 6.826690 mL O2, STP)/L solution)


### Example 3.3 Page: 52¶

In :
import math
from numpy import *

P = 1.0             #[atm]
p_w = 0.023         #[atm] Vapor pressure of pure water
H_o = 40100         #[atm] Vapor pressure of pure oxygen
H_n = 80400.        #[atm] Vapor pressure of pure nitrogen

A = matrix([[0.023, 0, 0, -1, 0, 0],[0, 40100, 0, 0, -1, 0],[0, 0 ,80400, 0, 0, -1],[0, 0, 0, 1, 1 ,1],[1 ,1, 1, 0, 0 ,0],[0, 0, 0, 0, 0.79, -0.21]]);
B = matrix([,,,,,])
X = linalg.inv(A)
X = X * B

print " The composition in liquid and vapor phase are summarized in the following table:"
print "    y_water       \t %f"%(X)
print "    y_oxygen      \t %f"%(X)
print "    y_nitrogen    \t %f"%(X)
print "    x_water       \t %f"%(X)
print "    x_oxygen      \t %e"%(X)
print "    x_nitrogen    \t %e"%(X)

 The composition in liquid and vapor phase are summarized in the following table:
y_water       	 0.023000
y_oxygen      	 0.205170
y_nitrogen    	 0.771830
x_water       	 0.999985
x_oxygen      	 5.116461e-06
x_nitrogen    	 9.599879e-06


### Example 3.4 Page: 57¶

In :
import math

T = 20.         #[C]
x_b = 0.80
x_t = 0.20
A_b = 6.90565
B_b = 1211.033
C_b = 220.79

p_b = 10**(A_b-B_b/(T+C_b))
A_t = 6.95334
B_t = 1343.943
C_t = 219.337
p_t = 10**(A_t-B_t/(T+C_t))
p_1 = x_b*p_b
p_2 = x_t*p_t
y = 1.00        # y =(y_b+y_t) sum of the mole fractions of the benzene and toluene in the gaseous phase
P = (p_1+p_2)/y
y_b = x_b*p_b/P
y_t = x_t*p_t/P

print " Vapour pressure of the mixture in the gaseous phase is %f torr"%(P)
print " Mole fraction of the benzene in the vapour phase is    %f"%(y_b)
print " Mole fraction of the toluene in the vapour phase is    %f"%(y_t)

 Vapour pressure of the mixture in the gaseous phase is 64.518358 torr
Mole fraction of the benzene in the vapour phase is    0.932483
Mole fraction of the toluene in the vapour phase is    0.067517


### Example 3.5 Page: 57¶

In :
import math

T = 20.             #[C]
x_benzene = 1.00
p_i = 75.2          #[torr] vapour pressure of the benzene
P = 760.            #[torr] Pressure of the atmosphere

y_benzene = (x_benzene*p_i)/P

print " Mole fraction of the benzene in air that is saturated with benzene is %0.1f"%(y_benzene)

 Mole fraction of the benzene in air that is saturated with benzene is 0.1


### Example 3.6 Page: 58¶

In :
import math

P = 760.            #[mm Hg]
x_b = 0.8           # Mole fraction of benzene in liquid phase
x_t = 0.2           # Mole fraction of toluene in liquid phase

A_b = 6.90565
B_b = 1211.003
C_b = 220.79

A_t = 6.95334
B_t = 1343.943
C_t = 219.337
T = 82.              #[C]
err = 1.

while err > 10**(-3):
p_b = 10**(6.90565 - 1211.003/(T + 220.79))
p_t = 10**(6.95334 - 1343.943/(T + 219.337))
y_b = x_b*p_b/P
y_t = x_t*p_t/P
err = abs((y_b + y_t) - 1)
T = T + 0.01

print " The temperature at which the given benzene-toluene mixture will have vapor pressure of 1 atm is %0.3f deg C"%(T)

 The temperature at which the given benzene-toluene mixture will have vapor pressure of 1 atm is 84.360 deg C


### Example 3.7 Page: 60¶

In :
from numpy import *
import math

V = 0.25            #[L] Volume of water
T_1 = 0.            #[C] Initial temperature of water
T_2 = 20.           #[C] Final temperature of water

x_o = 5.12*10**(-6)         # mole fraction of oxygen
x_n = 9.598*10**(-6)        # mole fraction of nitrogen

H_o = 2.55*10**(4)      #[atm]
H_n = 5.29*10**(4)      #[atm]

p_w = 0.006             #[atm]

A = matrix([[0.006, 0, 0, -1, 0, 0],[0, 25500, 0, 0, -1, 0],[0, 0 ,52900, 0, 0, -1],[0, 0, 0, 1, 1, 1],[1, 1, 1, 0, 0, 0],[0, 0, 0, 0, 0.79, -0.21]])
B = matrix([,,,,,])
X = linalg.inv(A)
X = X*B

M_o_rej = V*( X - x_o )/0.018        #[mole] oxygen
V_o = M_o_rej*24200                     #[ml] oxygen

M_n_rej = V*( X - x_n )/0.018        #[mole] nitrogen
V_n = M_n_rej*24200                     #[ml]

print " At equilibrium at 20 deg C the rejected amount of oxygen will be   %0.2f ml"%(V_o)
print " At equilibrium at 20 deg C the rejected amount of nitrogen will be %0.2f ml"%(V_n)
print " And total amount of the air rejected from the water will be        %0.2f ml"%(V_o + V_n)

 At equilibrium at 20 deg C the rejected amount of oxygen will be   1.03 ml
At equilibrium at 20 deg C the rejected amount of nitrogen will be 1.76 ml
And total amount of the air rejected from the water will be        2.79 ml


### Example 3.8 Page: 61¶

In :
import math

P_1 = 5.                #[atm]
y_n = 0.79              # Mole fraction of nitrogen in atmosphere
P_2 = 1.0               #[atm]
M = 55.                 #[kg] Mass of the diver
x_w = 0.75              # Fraction of water in human body
T = 37                  #[C] Body temperature of the diver

H_n = 10.05*10**(4)     # [atm]

M_rej = (M*1000*x_w/18)*( P_1*y_n/H_n - P_2*y_n/H_n)        #[mol]

V_n = M_rej*24.2            #[L]

print " Amount of rejected nitrogen will be %0.2f Litre"%(V_n)

 Amount of rejected nitrogen will be 1.74 Litre

In [ ]: