# Chapter 5 : Properties of Real Gases¶

## Example 5.1 page no: 109¶

In :
# variables
V = 0.6                         #m**3 vessel
T = 473.                        #K temperature
N = 1. * 10 ** 3                 #mol
R = 8.314                       #Pa * m**3/molK

# Calculation
P = N * R * T / (V * 10**5)

# Result
print "(a)Pressure calculated using ideal gas equation = %.2f bar"%P
a = 0.4233                      #N * m**4 / mol**2
b = 3.73 * 10**-5               #m**3/mol
P1 = (R*T/(V/N - b)-a/(V/N)**2)/10**5
print "(a)Pressure calculated using van der waals equation = %.2f bar"%P1

(a)Pressure calculated using ideal gas equation = 65.54 bar
(a)Pressure calculated using van der waals equation = 58.13 bar


## Example 5.2 pageno : 110¶

In :
# variables
P = 10.**7                              #Pa
T = 500.                                #K molar volume
R = 8.314                               #Pa * L / mol K
N = 1000.

# Calculation
V = N * R * T / ( P * 1000)

# Result
print "(a)Volume of CO2 calculated using ideal gas equation = %.4e m**3"%V

(a)Volume of CO2 calculated using ideal gas equation = 4.1570e-04 m**3


## Example 5.3 pageno : 111¶

In :
# variables
V = 0.6 * 10**-3                        #m**3
T = 473.                                #K vellel of volume
Tc = 405.5                              #K temperature
Pc = 112.8 * 10 ** 5                    #Pa pressure
R = 8.314

# Calculation
a = 0.4278 * (R**2) * (Tc ** 2.5)/Pc
b = 0.0867 * R * Tc / Pc
P1 = (R*T/(V - b) - a/((T**0.5)*V*(V + b)))/10**5

# Result
print "Pressure developed by gas = %.2f bar"%P1

Pressure developed by gas = 57.87 bar


## Example 5.4 pageno : 112¶

In :
# variables
P = 10.**6                              #Pa
T = 373.                                #K molar volume
Tc = 405.5                              #K temperature
Pc = 112.8 * 10 ** 5                    #Pa pressure
R = 8.314

# Calculation
a = 0.4278 * (R**2) * (Tc ** 2.5)/Pc
b = 0.0867 * R * Tc / Pc
#P1 = (R*T/(V - b) - a/((T**0.5)*V*(V + b)))/10**5
#10**6=((8.314*373)/(V-2.59*10**-5))-8.68/((373**0.5)*V*(V+2.59*10**-5)
#solving this we get,
V = 3.0 * 10**-3                        #m**3/mol

# Result
print "molar volume of gas = %.e m**3/mol"%V

molar volume of gas = 3e-03 m**3/mol


## Example 5.5 pageno : 112¶

In :
# variables
B = -2.19 * 10**-4                  #m**3/mol virial coefficients
C = -1.73 * 10**-8                  #m**6/mol**2
P = 10.                             #bar molar volume
T = 500.                            #K

# Calculation
#virial equation is given as, Z = PV/RT = 1 + B/V + C/V**2
#V = (RT/P)*(1 + B/V + C/V**2)
# now by assuming different values for V on RHS and checking for corresponding V on LHS, we have to assume such value of V on RHS by which we get the same value for LHS V
#by trial and error we get,
V = 3.92 * 10**-3                   #m**3

# Result
print "Molar volume of methanol = %.3e m**3"%V

Molar volume of methanol = 3.920e-03 m**3


## Example 5.6 pageno : 120¶

In :
# variables
T = 510.                        #K molar volume
P = 26.6                        #bar
Tc = 425.2                      #K temperature
Pc = 38.                        #bar pressure
Zc = 0.274                      # compressibility factor
R = 8.314

# Calculation
Pr = P / Pc
Tr = T / Tc

# Result
print "Pr = ",Pr
print "Tr = %.2f"%Tr

#From fig. 5.4 and 5.5 from the text book
Z = 0.865
D = 0.15
Z1 = Z + D * ( Zc - 0.27)
V = R * T * Z1 / (P * 10**5)
print "Molar volume of n-butane = %.4e m**3/mol"%V

Pr =  0.7
Tr = 1.20
Molar volume of n-butane = 1.3798e-03 m**3/mol


## Example 5.7 pageno : 120¶

In :
# variables
T = 510.                    #K molar volumes
P = 26.6                    #bar
Tc = 425.2                  #K temperature
Pc = 38.                    #bar pressure
w = 0.193                   # acentric factor
R = 8.314

# Calculation
Pr = P / Pc
Tr = T / Tc

# Result
print "Pr = ",Pr
print "Tr = %.2f"%Tr

#From fig. 5.6 and 5.7 from the text book
Z0 = 0.855
Z1 = 0.042
Z = Z0 + w*Z1
print "Z = %.4f"%Z
V = R * T * Z / (P * 10**5)

print "Molar volume of n-butane = %.4e m**3/mol"%V

# note : answer may vary because of rounding error.

Pr =  0.7
Tr = 1.20
Z = 0.8631
Molar volume of n-butane = 1.3758e-03 m**3/mol


## Example 5.8 pageno : 122¶

In :
from numpy import *
# variables
P = 6000.                               #kPa ethane
T = 325.                                #K ethane
xn2 = 0.4                               # gas mixture
xethane = 0.6
an2 = 0.1365                            #N m**4 / mol**2 nitrogen

# Calculation
bn2 = 3.86 * 10**-5                     #m**3/mol
aethane = 0.557                         #N m**4 / mol**2
bethane = 6.51 * 10**-5                 #m**3/mol
Pcn2 = 3394.                            #kPa
Tcn2 = 126.2                            #K
Pcethane = 4880.                        #kPa
Tcethane = 305.4                        #K
R = 8.314

# Result
V = R * T / (P*1000)
print "(a)Molar volume by ideal gas equation = %.3e m**3/mol"%V

a = (xn2 * (an2**0.5) + xethane * (aethane**0.5))**2
b = (xn2*bn2 + xethane*bethane)
#substituting the above values in van der waals equation, and solving, we get
#V^3 - 5.0484*10^-4V^2+5.9117*10^-8V-3.2214*10^-12=0
#Using co-efficients from the above equation,
coeff = [1, -5.0484e-4, 5.9117e-8, -3.2217e-12]
x = roots(coeff)
y = x
print "(b)Molar volume by van der waals equation =",round((y.real)/1e-4,3),"*10^-4 m**3/mol"

Prin2 = P/Pcn2
Trin2 = T/Tcn2
Priethane = P/Pcethane
Triethane = T/Tcethane
# using compressibilty chart,
Zn2 = 1
Zethane = 0.42
Z = xn2 * Zn2 + xethane * Zethane
V2 = Z * R * T / P * (10**-3)
print "(c)Molar volume based on compressibilty factor = %.2e m**3/mol"%V2

Pri1n2 = xn2*P/Pcn2
Tri1n2 = T/Tcn2
Pri1ethane = xethane*P/Pcethane
Tri1ethane = T/Tcethane
# using compressibilty chart,
Zn21 = 1.
Zethane1 = 0.76
Z1 = xn2 * Zn21 + xethane * Zethane1
V3 = (Z1 * R * T / P ) * (10**-3)
print "(c)Molar volume based on daltons law = %.3e m**3/mol"%V3

Tc = xn2 * Tcn2 + xethane * Tcethane
Pc = xn2 * Pcn2 + xethane * Pcethane
Zc = 0.83
V4 = Zc * R *T / P * (10**-3)
print "(d)Molar volume by kays method = %.3e m**3/mol"%V4

(a)Molar volume by ideal gas equation = 4.503e-04 m**3/mol
(b)Molar volume by van der waals equation = 3.68 *10^-4 m**3/mol
(c)Molar volume based on compressibilty factor = 2.94e-04 m**3/mol
(c)Molar volume based on daltons law = 3.855e-04 m**3/mol
(d)Molar volume by kays method = 3.738e-04 m**3/mol


## Example 5.9 page no : 124¶

In :
# variables
P1 = 40.                            #% ( nitrogen )
P2 = 60.                            #% ( ethane )
T = 325.                            #K ethane

# Calculation
V = 4.5 * 10**-4                    #m**3/mol
a1 = 0.1365                         #N*m**4/mol**2
b1 = 3.86 * 10 ** -5                #m**3/mol
a2 = 0.557                          #N*m**4/mol**2
b2 = 6.51 * 10 ** -5                #m**3/mol
Pc1 = 3394.                         #kPa
Tc1 = 126.1                         #K
Pc2 = 4880.                         #kPa
Tc2 = 305.4                         #K
R = 8.314
Pideal = R * T / (V * 1000)         #kPa

# Result
print "(a)Pressure of Gas by the ideal gas equation = %.f kPa"%Pideal
y1 = P1/100.
y2 = P2/100.
a = (y1 * (a1**(1./2)) + y2 * (a2**(1./2)))**2
b = y1 * b1 + y2 * b2
Pv = ((R * T / (V - b)) - a / (V**2))/1000
print "(b)Pressure of Gas by Van der waals equation = %.f kPa"%Pv
Tc = y1*Tc1 + y2*Tc2
Pc = y1*Pc1 + y2*Pc2
Vc = R * Tc / Pc                    #Pseudo critical ideal volume
Vr = V / Vc                         #Pseudo reduced ideal volume
Tr = T / Tc                         #Pseudo reduced temperature

#From fig 5.3, we get Pr = 1.2
Pr = 1.2
Pk = Pr * Pc
print "(c)Pressure of Gas by the Kays method = %.f kPa"%Pk

(a)Pressure of Gas by the ideal gas equation = 6005 kPa
(b)Pressure of Gas by Van der waals equation = 5080 kPa
(c)Pressure of Gas by the Kays method = 5143 kPa