Chapter 5: Single-Phase Systems

Example 5.1-1, page no. 190

In [1]:
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate

wtperct=0.5
Dwater=0.998 #g/cm^3
Dsulfuric=1.834 #g/cm^3


#Calculations and printing :

invPbar=wtperct/Dwater + (1-wtperct)/Dsulfuric
print '%s %.3f' %("Density calculated using volume additvity (g/cm^3) =",1/invPbar)
Pbar=wtperct*Dwater + (1-wtperct)*Dsulfuric
print '%s %.3f' %(" \n Density calculated using mass additivity (g/cm^3) =",Pbar)
raw_input('press enter key to exit')
Density calculated using volume additvity (g/cm^3) = 1.293
 
 Density calculated using mass additivity (g/cm^3) = 1.416
press enter key to exit
Out[1]:
''

Example 5.2-1, page no. 192

In [2]:
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate

T=23.0+273 #kelvin
P=3.0+14.7 #psi 
#conversion of pressure from psig to psi requires addition of 14.67 which is 1 atm
R=0.08206 #lt-atm
MN2=28.0 #molecular wt.
weight=100.0 #grams

#Calculations and printing :

n=weight/MN2 #mol
V=n*R*T*14.7/P #lt
print '%s %.3f' %("assuming ideal gas behaviour, volume (litres) = ",V)
Vcap=V/n
if(Vcap>5):
    print("ideal gas equation yields error less than 1 percent for diatomic gas")
else:
    print("ideal gas equation yields error greater than 1 percent for diatomic gases")

raw_input('press enter key to exit')
assuming ideal gas behaviour, volume (litres) =  72.046
ideal gas equation yields error less than 1 percent for diatomic gas
press enter key to exit
Out[2]:
''

Example 5.2-2, page no. 195

In [3]:
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate

T=360.0+273 #Kelvin
P=3.0 #atm
Vdot=1100.0 #kg/h
M=58.1 

#Calculations and printing :

ndot=Vdot/M #kmol/h
vdot=ndot*22.4*T/(273*P)
print '%s %.3f' %("The volumetric flow rate of the stream (m^3/h) = ",vdot)
raw_input('press enter key to exit')
The volumetric flow rate of the stream (m^3/h) =  327.781
press enter key to exit
Out[3]:
''

Example 5.2-3, page no. 195

In [4]:
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate

V1=10.0 #ft^3
T1=70.0+460 #R
P1=1.0 #atm
P2=2.5 #atm
T2=610.0+460 #R

#Calculations and printing :

V2=V1*P1*T2/(P2*T1)
print '%s %.3f' %("Volume in final state (ft^3) = ",V2)
raw_input('press enter key to exit')
Volume in final state (ft^3) =  8.075
press enter key to exit
Out[4]:
''

Example 5.2-4, page no. 196

In [5]:
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate

#all the calculations are done in R scale
T2=285.0+460 #R
T1=32.0+460 #R
P2=1.30 #atm
P1=1.0 #atm
V1dot=3.95*100000. #ft^3/h


#Calculations and printing :

#SCFH means ft^3(STP/h)
ndot=3.95*math.pow(10,5)/359.
print '%s %.3f' %(" Molar flowrate (lb-moles/hr) = ",ndot)
V2dot=V1dot*T2*P1/(T1*P2)
print '%s %.3E' %(" \n True volumetric flowrate (ft^3/h) = ",V2dot)
raw_input('press enter key to exit')
 Molar flowrate (lb-moles/hr) =  1100.279
 
 True volumetric flowrate (ft^3/h) =  4.601E+05
press enter key to exit
Out[5]:
''

Example 5.2-5, page no. 197

In [6]:
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate

flowinA=400.0 #L/min
flowinN=419.0 # m^3   STP /min
Pfinal=6.3 #gauge
Tfinal=325.0 # C
Pacetone=501.0 #mm of Hg
Dacetone=791.0  #g/L
Macetone=58.08  #g
T1=300.0 #k
P1=1238.0 #mm Hg original

#Calculations and printing :

print("All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
n2cap=flowinA*Dacetone/Macetone
print '%s %.3f' %(" \n Molar flowrate of Acetone (mol Acetone/min) = ",n2cap)
P=Pfinal*760 + 763
y4=Pacetone/P
print '%s %.3f' %(" \n Mole fraction of Acetone in the final flow (mol Acetone/mol) = ",y4)
print '%s %.3f' %(" \n Mole fraction of Nitrogen in the final flow (mol Nitrogen/mol) = ",1-y4)
n3cap=flowinN/0.0224
n4cap=n2cap/y4
print("By using Overall Molar balance,")
n1cap=n4cap-n2cap-n3cap
V1cap=n1cap*0.0224*T1*760/(1*273*P1)
print '%s %.3f' %("Volumetric Flowrate of Nitrogen (Nitrogen/min) = ",V1cap)
raw_input('press enter key to exit')
All the values in the textbook are Approximated hence the values in this code differ from those of Textbook
 
 Molar flowrate of Acetone (mol Acetone/min) =  5447.658
 
 Mole fraction of Acetone in the final flow (mol Acetone/mol) =  0.090
 
 Mole fraction of Nitrogen in the final flow (mol Nitrogen/mol) =  0.910
By using Overall Molar balance,
Volumetric Flowrate of Nitrogen (Nitrogen/min) =  547.119
press enter key to exit
Out[6]:
''

Example 5.3-1, page no. 202

In [7]:
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate

T= -150.8 + 273.2  #k
Vcap= 3./2. #L/mol
Tc=126.2 #k
Pc=33.5 #atm
w=0.040

#Calculations and printing :

print("All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
Pideal=0.08206*T/Vcap
print '%s %.3f' %(" \n The value of pressure as per Ideal gas equation (atm) = ",Pideal)
Tr=T/Tc
B0=0.083 - (0.422/math.pow(Tr,1.6))
B1=0.139 - (0.172/math.pow(Tr,4.2))
B=0.08206*Tc*(B0+w*B1)/Pc
Pvirial=0.08206*T*(1+ B/Vcap)/Vcap
print '%s %.3f' %("\n The value of pressure as per Virial gas equation (atm) = ",Pvirial)
e=(Pideal-Pvirial)*100/Pvirial
print '%s %.3f' %(" \n Percentage error due to Ideal gas Equation =",e)
raw_input('press enter key to exit')
All the values in the textbook are Approximated hence the values in this code differ from those of Textbook
 
 The value of pressure as per Ideal gas equation (atm) =  6.696

 The value of pressure as per Virial gas equation (atm) =  6.196
 
 Percentage error due to Ideal gas Equation = 8.072
press enter key to exit
Out[7]:
''

Example 5.3-2, page no. 203

In [9]:
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate

V=2.5 #m^3
n=1.00 #Kmol
T= 300 #K
Tc=304.2 #K
Pc=72.9 #atm
w=0.225
R=0.08206

#Calculations and printing :

print("All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
Vcap=V/n
a=0.42747*math.pow(R*Tc,2) /Pc
b=0.08664*R*Tc/Pc
m=0.48508+ 1.5171*w -0.1561*w*w
Tr=T/Tc
alpha=math.pow(1+ m*(1-math.sqrt(Tr)),2)
P=(R*T/(Vcap-b))-(alpha*a/(Vcap*(Vcap+b)))
print '%s %.3f' %(" \n Pressure of gas calculated using SRK equation (atm) = ",P)
raw_input('press enter key to exit')
All the values in the textbook are Approximated hence the values in this code differ from those of Textbook
 
 Pressure of gas calculated using SRK equation (atm) =  9.381
press enter key to exit
Out[9]:
''

Example 5.4-1, page no. 206

In [10]:
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate

Vcap=50.0 #M^3/hr
P=40.0 #bar
T=300.0 #K
R=8.314
M=16.04 #kg/kmol

#Calculations and printing :

print("All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
z=0.934
print '%s %.3f' %(" \n From the Table, z= ",z)
ncap=P*Vcap*101.325/(z*R*T*1.01325)
mcap=ncap*M
print '%s %.3f' %(" \n Mass flow rate of Methane (Kg/hr) = ",mcap)
raw_input('press enter key to exit')
All the values in the textbook are Approximated hence the values in this code differ from those of Textbook
 
 From the Table, z=  0.934
 
 Mass flow rate of Methane (Kg/hr) =  1377.071
press enter key to exit
Out[10]:
''

Example 5.4-2, page no. 209

In [11]:
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate

n=100.0 #gm-moles
V=5.0 #ltr
T= -20.6 + 273.2 #K
Tc=126.2 #K
Pc=33.5 #atm
R=0.08206

#Calculations and printing :

print("All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
Tr=T/Tc
Vrideal=V*Pc/(n*R*Tc)
print '%s %.3f' %(" \n Tr= ",Tr)
print '%s %.3f' %("\n Vrideal=",Vrideal)
z=1.77
print '%s %.3f' %("\n From the graphs, z=",z)
P=z*R*T*n/V
Pr=P/Pc
print '%s %.3f' %(" \n Pr= ",Pr)
print '%s %.3f' %(" \n Pressure in the cylinder (atm) = ",P)
raw_input('press enter key to exit')
All the values in the textbook are Approximated hence the values in this code differ from those of Textbook
 
 Tr=  2.002

 Vrideal= 0.162

 From the graphs, z= 1.770
 
 Pr=  21.904
 
 Pressure in the cylinder (atm) =  733.784
press enter key to exit
Out[11]:
''

Example 5.4-3, page no. 212

In [ ]:
#Initialization of variables
import math
import numpy
from numpy import linalg
import scipy
from scipy import integrate

yN2=0.25
yH2=1.0-yN2
P=800.0 #atm
T= -70+273.2 #K
TcH2=33.0 #K
TcN2=126.2 #K
PcH2=12.8 #atm
PcN2=33.5 #atm
R=0.0083
#Calculations and printing :

print("All the values in the textbook are Approximated hence the values in this code differ from those of Textbook")
print("Applying newton corrections for Hydrogen,")
TcaH2=TcH2+8.
PcaH2=PcH2+8.
Tcbar=yH2*TcaH2 + yN2*TcN2
Pcbar=yH2*PcaH2 + yN2*PcN2
Trbar=T/Tcbar
Prbar=P/Pcbar
print '%s %.3f' %(" \n Trbar = ",Trbar)
print '%s %.3f' %(" \n Prbar = ",Prbar)
Zm=1.86
print '%s %.4f' %(" \n From the graph, Zm = ",Zm)
Vcap=Zm*R*T/P
print '%s %.5f' %(" \n Specific Volume of Mixture (L/mol) = ",Vcap)
raw_input('press enter key to exit')
All the values in the textbook are Approximated hence the values in this code differ from those of Textbook
Applying newton corrections for Hydrogen,
 
 Trbar =  3.262
 
 Prbar =  33.368
 
 From the graph, Zm =  1.8600
 
 Specific Volume of Mixture (L/mol) =  0.00392