Chapter 7 : Fugacity Ideal Solutions Activity Activity Coefficient

Example 7.1 Page: 134

In [3]:
import math 
from scipy.integrate import quad 


T = 220+459.67          #[R] Temperature in Rankine
P = 500.                #[psia] Pressure
R = 10.73               #[(psi*ft**(3)/(lbmol*R))] Gas consmath.tant


a = 4.256           #[ft**(3)/lbmol]

def f6(p): 
	 return a*p**(0)

I =  quad(f6,0,P)[0]


f = P*math.exp((-1/(R*T))*I)            #[psia]

print "Fugacity of propane gas at the given condition is %.0f psia"%(round(f,1))
Fugacity of propane gas at the given condition is 374 psia

Example 7.2 Page: 138

In [12]:
import math 

T = 100. + 460          #[R] Temperature of the system in Rankine
P = 1.                  # [psia]
R = 10.73               #[(psi*ft**(3)/(lbmol*R))] Gas consmath.tant

v = 0.016136*18         #[ft**(3)/lbmol]
z = round((P*v)/(R*T),5)

a = int(((R*T)/P))*(1-z)     #[ft**(3)/lbmol]

print " Compresssibility factor the liquid water at the given condition is %.5f "%(z)
print "Volume residual for the liquid water at the given condition is     %0.1f cubic feet/lbmol"%(a)
 Compresssibility factor the liquid water at the given condition is 0.00005 
Volume residual for the liquid water at the given condition is     6007.7 cubic feet/lbmol

Example 7.3 Page: 138

In [10]:
import math 
from scipy.integrate import quad 

T = 100+460.            #[R] Temperature
P = 1000.               #[psia] Pressure
R = 10.73               #[(psi*ft**(3)/(lbmol*R))] Gas consmath.tant

f_b = 0.95              #[psia]
f_c = f_b               #[psia]
v = 0.016136*18         #[ft**(3)/lbmol]

P_d = 1000.             #[psia]
P_c = 1.                #[psia]

def f4(p): 
	 return p**(0)

f_d = f_c*math.exp((v/(R*T))* (quad(f4,P_c,P_d))[0])

print "Fugacity of the pure liquid water at the given condition is %0.1f psia"%(f_d)
Fugacity of the pure liquid water at the given condition is 1.0 psia

Example 7.4 Page: 145

In [3]:
import math 

T = 78.15           #[C]
P = 1.0             #[atm]
p_a_0 = 0.993       #[atm] Pure ethanol vapor pressure at 78.15C
p_b_0 = 0.434       #[atm] Pure water vapor pressure at 78.15C

x_a = 0.8943        # Amount of ethanol in the liquid phase 
x_b = 0.1057        # Amount of water in liquid phase 

y_a = x_a           # Amount of ethanol in vapor phase 
y_b = x_b           # Amount of water in the vapor phase 



Y_a_1 = 1.0
Y_b_1 = 1.0

Y_a_2 = ((y_a*P)/(x_a*p_a_0))
Y_b_2 = ((y_b*P)/(x_b*p_b_0))

f_a_1 = (y_a*Y_a_1*P)           #[atm]
f_b_1 = (y_b*Y_b_1*P)           #[atm]
f_a_2 = f_a_1                   #[atm]
f_b_2 = f_b_1                   #[atm]

f_a_1_0 = P                     #[atm]
f_b_1_0 = P                     #[atm]

f_a_2_0 = p_a_0                 #[atm]
f_b_2_0 = p_b_0                 #[atm]

print " The results are summarized in the following table: \n\tPhase\t\t\t\t Etahnol(i=a)\t\t\t\t Water,i=b"
print " \tVAPOR PHASE 1"
print "  \t  f_i_1 atm   \t\t\t %.4f \t\t\t\t %.4f"%(f_a_1,f_b_1)
print "  \t  f_i_1_0 atm \t\t\t %.4f \t\t\t\t %.4f"%(f_a_1,f_b_1)
print "  \t  Y_i_1 assumed  \t\t %f \t\t\t\t %f"%(Y_a_1,Y_b_1)
print " \tLIQUID PHASE 2"
print "  \t  f_i_2 atm   \t\t\t %.4f \t\t\t\t %.4f"%(f_a_2,f_b_2)
print "  \t  f_i_2_0 atm \t\t\t %.4f \t\t\t\t %.4f"%(f_a_2,f_b_2)
print "  \t  Y_i_2assumed  \t\t %.4f \t\t\t\t %.4f"%(Y_a_2,Y_b_2)
 The results are summarized in the following table: 
	Phase				 Etahnol(i=a)				 Water,i=b
 	VAPOR PHASE 1
  	  f_i_1 atm   			 0.8943 				 0.1057
  	  f_i_1_0 atm 			 0.8943 				 0.1057
  	  Y_i_1 assumed  		 1.000000 				 1.000000
 	LIQUID PHASE 2
  	  f_i_2 atm   			 0.8943 				 0.1057
  	  f_i_2_0 atm 			 0.8943 				 0.1057
  	  Y_i_2assumed  		 1.0070 				 2.3041

Example 7.5 Page: 149

In [4]:
import math 

T = 220+460.            #[R] Temperature in rankine
P = 1000.               #[psia] Pressure
y_methane = 0.784       # Mol fraction of methane in the given mixture
y_butane = (1-y_methane)       # Mol fraction of n-bumath.tane in the given mixture
R = 10.73               #[(psia*ft**(3)/(lbmol*R))] gas consmath.tant


Im = 290.               #[ft**(3)/lbmol]

Jm = math.exp((-1/(R*T))*Im)

f_methane = Jm*P*y_methane          #[psia] fugacity of methane

Ib = 5859.                          #[ft**(3)/lbmol]
Jb = math.exp((-1/(R*T))*Ib)
f_butane = Jb*P*y_butane          #[psia] fugacity of bumath.tane

print " Fugacity of the methane in the gaseous mixture is %0.0f psia"%(f_methane)
print " Fugacity of the butane in the gaseous mixture is  %0.1f psia"%(f_butane)
 Fugacity of the methane in the gaseous mixture is 753 psia
 Fugacity of the butane in the gaseous mixture is  96.8 psia

Example 7.6 Page: 153

In [13]:
import math 

T = 220+460.            #[R] Temperature in rankine
P = 1000.               #[psia] Pressure
x_methane = 0.784       # Mol fraction of methane in the given mixture
x_bumath_tane = (1-x_methane)       # Mol fraction of n-bumath_tane in the given mixture

v_i_into_Y_i = 0.961
phi_cap_i = 0.961

v_i = 0.954
phi_i = v_i
Y_i = phi_cap_i/v_i

print " The value of v_i is %f"%(v_i)
print " The value of Y_i is %f"%(Y_i)
print " The value of phi_cap_i is %f"%(phi_cap_i)
 The value of v_i is 0.954000
 The value of Y_i is 1.007338
 The value of phi_cap_i is 0.961000

Example 7.7 Page: 154

In [14]:
import math 

T_r = 0.889
P_r = 1.815

f_f = -0.48553

v = math.exp((P_r/T_r)*f_f)
phi = v

print " The value of v=phi for n-bumath.tane at given condition is %f"%(v)
 The value of v=phi for n-bumath.tane at given condition is 0.371106
In [ ]: