Chapter 1: Fundamental Concepts and Definitions

Example 1, page no. 22

In [1]:
#Variable Declaration: 
h = 30*10**-2 #Manometer deflection of Mercury(in m):
d = 13550     #Density of mercury(in kg/m**3)
g = 9.78      #Acceleration due to gravity(in m/s**2):

#Calculations:
P = d*g*h     #Pressure difference(in Pa):

#Results:
print  "Pressure Difference: " ,round(P,2),"Pa"
Pressure Difference:  39755.7 Pa

Example 2, page no. 22

In [4]:
  
import math
#Variable Declaration: 
d = 30*10**-2 #Diameter of the vessel(in m):
g = 9.78 #Accelertion due to gravity(in m/s**2):

#Calculation:
p = 76*(10**-2)*13550*g #Atmospheric pressure(in Pa):
a = (round(math.pi,2)*d**2)/4 #Area:
F = p*a        #Effort required:

#Results:
print  "Effort required: ",round(F,2),"N"
Effort required:  7115.48 N

Example 3, page no. 22

In [5]:
#Variable Declaration: 
h = 30*10**-2 #Difference in mercury column(in m):
pa = 101 #Atmospheric Pressure(in kPa):
g = 9.78 #Acceleration due to gravity(in m/s**2):

#Calculation:
gp = 13550*g*h*10**-3 #Guage pressure(in kPa):
ap = gp+pa #Actual pressure:

#Results:
print  "Actual pressure of air : ",round(ap,2)," Kpa"
Actual pressure of air :  140.76  Kpa

Example 4, page no. 22

In [6]:
#Variable Declaration: 
h = 1    #Depth of tank(in m):
s = 0.8    #Specific gravity:
d = 1000    #Density of water(in kg/m**3):
g = 9.81    #Acceleration due to gravity(in m/s**2):

#Calculation:
dO = s*d    #Density of oil(in kg/m3):
gp = dO*g*h*10**-3   #Gauge pressure(in kPa):

#Results:
print  "Gauge pressure",gp,"KPa"
Gauge pressure 7.848 KPa

Example 5, page no. 23

In [7]:
#Variable Declaration: 
h = 76*10**-2 #Barometer Reading(in m):
d = 13.6*10**3 #Density of mercury(in kg/m**3):
g = 9.81       #Acceleration due to gravity(in m/s**2):

#Calculation:
h1 = 40*10**-2 #Difference of heights in gas barometer(in m):
pg = (d*g*h1+d*g*h)*10**-3 #Pressure of gas(in kPa):

#Results:
print  "Pressure of gas:",round(pg,2),"kPa"
Pressure of gas: 154.76 kPa

Example 6, page no. 23

In [8]:
#Variable Declaration: 
m = 1 #Mass of water(in kg):
h = 1000 #Altitude(in m):
c = 4.18*10**3 #Specific heat of water(in J/kg-K):
g = 9.81 #Acceleration due to gravity(in m/s**2):

#Calculation:
Q = m*g*h #Heat required for heating  =  Potential energy 
dT = Q/c

#Results
print  "The change in temperature:  ",round(dT,2),"ºC"
The change in temperature:   2.35 ºC

Example 7, page no. 24

In [9]:
#Variable Declaration: 
w = 100 #Weight of object at standard gravitational acceleration(in N):
g = 9.81 #Standard acceleration due to gravity(in m/s**2):
g1 = 8.5 #Gravitation acceleration at given location(in m/s**2):

#Calculation:
m = w/g #Mass of object(in kg):
s = m*g1 #Spring balance reading(in N):

#Results:
print  "The spring balance reading:",round(s,2),"N"
The spring balance reading: 86.65 N

Example 8, page no. 24

In [10]:
 
import math
#Variable Declaration: 
dia = 15*10**-2 #Diameter of cylinder(in m):
h = 12*10**-2 #Manometer difference in Hg column(in m):
d = 13.6*10**3 #Density of mercury(in kg/m**3):
g = 9.81 #Acceleration due to gravity(in m/s**2):

#Calculation:
w = h*d*g*math.pi*dia**2/4 #Weight of piston(in N): pressure*area
m = w/g        #Mass of the piston(in kg):

#Results:
print  "Mass of the piston:",round(m,2),"Kg"
Mass of the piston: 28.84 Kg

Example 9, page no. 24

In [11]:
#Variable Declaration: 
Hab = 2*10**-2 #Height of water column in limb AB(in m):
Hcd = 10*10**-2 #Height of mercury column in limb CD(in m):
h = 76*10**-2 #Barometer reading for atmospheric pressure(in m):
dm = 13.6*10**3 #Density of mercury(in kg/m**3):
dw = 1000 #Density of water(in kg/m**3):
g = 9.81 #Acceleration due to gravity(in m/s**2):

#Calculation:
Patm = dm*h*g*10**-3  #Atmospheric pressure(in kPa):
Pab = dw*Hab*g*10**-3 #Pressure of water in column AB(in kPa):
Pcd = dm*Hcd*g*10**-3 #Pressure of mercury in column CD(in kPa):
Ps = Patm+Pcd-Pab     #Pressure of steam(in kPa):

#Results:
print  "Pressure of steam:",round(Ps,2),"KPa"
Pressure of steam: 114.54 KPa

Example 10, page no. 25

In [12]:
#Variable Declaration: 
Pa = 400 #Pressure in compartment A(in kPa):
Pb = 150 #Pressure in compartment B(in kPa):
h = 720*10**-3 #Reading of barometer(in m):
d = 13.6*10**3 #Density of mercury(in kg/m**3):
g = 9.81 #Acceleration due to gravity(in m/s**2):

#Calculation:
Patm = d*g*h*10**-3 #Atmospheric pressure from barometer reading(in kPa):
PaA = Pa+Patm #Absolute pressure in compartment A(in kPa):
PaB = Pb+Patm #Absolute pressure in compartment B(in kPa):

#Results:
print  "Absolute pressure in compartment A:",round(PaA,2),"KPa"
print  "Absolute pressure in compartment B:",round(PaB,2),"KPa"
Absolute pressure in compartment A: 496.06 KPa
Absolute pressure in compartment B: 246.06 KPa

Example 11, page no. 25

In [13]:
#Variable Declaration: 
Patm = 90 #Atmospheric pressure(in kPa):
dw = 1000 #Density of water(in kg/m**3):
doil = 850 #Density of oil(in kg/m**3):
dm = 13600 #Density of mercury(in kg/m**3):
h1 = 0.15 #Height of water column(in m):
h2 = 0.25 #Height of oil column(in m):
h3 = 0.40 #Height of mercury column(in m):
g = 9.81 #Acceleration due to gravity(in m/s**2):

#Calculation:
Pw = dw*g*h1*10**-3 #Pressure due to water column at reference line(in kPa):
Po = doil*g*h2*10**-3 #Pressure due to oil column at reference line(in kPa):
Pm = dm*g*h3*10**-3 #Pressure due to mercury column at reference line(in kPa):
Pa = Patm+Pm-Pw-Po #Pressure due to air(in kPa):

#Results:
print  "Air pressure:" ,round(Pa,2),"KPa"
Air pressure: 139.81 KPa

Example 12, page no. 26

In [14]:
#Variable Declaration: 
v = 750.0 #Velocity of the object(in m/s):
F = 4000.0 #Gravitational force acting on the body(in N):
g = 8.0  #Acceleration due to gravity(in m/s**2):

#Calculation:
m = F/g #Mass of the object(in kg):
KE = (m*v**2)/2 #Kinetic energy of the body(in J):

#Results:
print  "Kinetic energy:",round(KE/10**8,1),"x 10^8 J"
Kinetic energy: 1.4 x 10^8 J

Example 13, page no. 26

In [15]:
#Variable Declaration: 
Cp = 2.286 #Specific heat at constant pressure(in kJ/kg-K):
Cv = 1.768 #Specific heat at constant volume(in kJ/kg-K):
Ru = 8.314 #Universal gas constant(in kJ/kg-K):

#Calculation:
R = Cp-Cv #Gas constant(in kJ/kg-K):
m = Ru/R #Molecular weight of gas(in kg/K mol):

#Results:
print  "Molecular weight of gas:" ,round(m,2),"Kg/K mol"
Molecular weight of gas: 16.05 Kg/K mol

Example 14, page no. 26

In [16]:
#Variable Declaration: 
p1 = 750*10**3 #Initial pressure(in Pa):
t1 = 600 #Initial temperature(in K):
v1 = 0.2 #Initial volume(in m**3):
p2 = 2*10**5 #Final pressure(in Pa):
v2 = 0.5 #Final volume(in m**3):

#Calculation:
t2 = p2*v2*t1/(p1*v1) #Final temperature(in K):

#Results:
print  "Final temperature:",t2,"K"
Final temperature: 400.0 K

Example 15, page no. 27

In [17]:
#Variable Declaration: 
p1 = 100 #Initial pressure(in kPa):
t1 = 300 #Initial temperature(in K):
v1 = 5   #Initial volume(in m**3):
p2 = 50  #Final pressure(in kPa):
t2 = 280 #Final temperature(in K):
v2 = 5 #Final volume(in m**3):
R = 287.0 #Gas constant for air(in J/kg-K):

#Calculation:
m1 = p1*v1/(R*t1)*10**3 #Initial mass(in kg):
m2 = p2*v2/(R*t2)*10**3 #Final mass(in kg):
dm = m1-m2 #Mass removed(in kg):
V = dm*R*t1/p1/1000 #Volume of this mass of air at initial states(in m**3):

#Results:
print  "Mass of air removed: ",round(dm,3),"Kg"
print  "Volume of air at initial states: ",round(V,2),"m^3"
Mass of air removed:  2.696 Kg
Volume of air at initial states:  2.32 m^3

Example 16, page no. 27

In [18]:
   
import math
#Variable Declaration: 
d = 1        #Diameter of the vessel(in m):
h = 4        #Height of the vessel(in m):
p1 = 100     #Initial pressure(in kPa):
t1 = 300     #Initial temperature(in K):
p2 = 125     #Final pressure(in kPa):
Cp = 14.307  #Cp of hydrogen(in kJ/kg-K):
Cv = 10.183  #Cv of volume(in kJ/kg-K):

#Calculation:
v = math.pi*d**2*h/4 #Volume of the vessel(in m**3):
t2 = p2*t1/p1  #Final temperature(in K):
R = Cp-Cv   #Gas constant for hydrogen:
m = round(p1*v/(R*t1),3) #Mass of hydrogen(in kg):
Q = m*Cv*(t2-t1) #Heat supplied at const. volume(in kJ):

#Results:
print  "Heat to be supplied: ",round(Q,2),"KJ"
Heat to be supplied:  193.99 KJ

Example 17, page no. 28

In [19]:
 
#Variable Declaration: 
v = 2+2 #Total volume(in m**3):
m1 = 20 #Mass of air in container 1(in kg):
m2 = 4 #Mass of air in container 2(in kg):
t = 300 #Temperature of the system(in K):
R = 287 #Gas constant for air(in J/kg-K):

#Calculation:
m = m1+m2 #Total mass after the valve is opened(in kg):
p = m*R*t/v*10**-3 #Final pressure(in kPa):

#Results:
print  "Final pressure: " ,p,"KPa"
Final pressure:  516.6 KPa

Example 18, page no. 28

In [20]:
#Variable Declaration: 
m = 5 #Mass of gas(in kg):
v = 2 #Volume of the container(in m**3):
t = 300 #Temperature in the container(in K):
R = 8.314 #Universal gas constant(in kJ/kg-K):
a = 3628.5*10**2 #Vander-Waals Constant(from table):
b = 3.14*10**-2  #Vander-Waals Constant(from table):
mw = 44.01 #Molecular weight of CO2:

#Calculation:
Rp = R*10**3/mw #Gas constant for CO2(in j/kg-K):#Considering it as a perfect gas
pp = m*Rp*t/v #Pressure of the gas(in N/m**2):
v1 = v*mw/m #Molar specific volume(in m**3/kg.mol): #Considering it as a real gas:
pr = R*10**3*t/(v1-b)-a/(v1**2)	#Vanderwall eqn:

#Results:
print  "Pressure if considered perfect gas: " ,round(pp/10**5,3),"x 10^5 N/m^2"
print  "Pressure if considered real gas: ",round(pr/10**5,3),"x 10^5 N/m^2"
Pressure if considered perfect gas:  1.417 x 10^5 N/m^2
Pressure if considered real gas:  1.408 x 10^5 N/m^2

Example 19, page no. 30

In [21]:
#Variable Declaration: 
p = 17672 #Pressure of steam(in kPa):
t = 712 #Temperature of steam(in K):
Pc = 22.09*10**3 #Critical pressure(in kPa):
Tc = 647.3 #Critical temperature(in K):
Rs = 0.4615 #Gas constant for steam(in kJ/kg-K):

#Calculation:
vp = Rs*t/p #Specific volume(in m**3/kg) Considering perfect gas:
Rp = p/Pc #Reduced pressure: Considering real gas:
Rt = t/Tc #Reduced temperature:
Z = 0.785 #Value of compressibility factor(from chart for Rp & Rt):
vr = Z*vp #Specific volume(in m**3/kg):

#Results:
print  "Specific volume considering perfect gas: ",round(vp,4),"m**3/kg"
print  "Specific volume considering real gas: ",round(vr,4),"m**3/Kg"
Specific volume considering perfect gas:  0.0186 m**3/kg
Specific volume considering real gas:  0.0146 m**3/Kg

Example 20, page no. 30

In [22]:
  
import math

#Variable Declaration: 
d = 5.0         #Diameter of the balloon(in m):
p = 1.013*10**5 #Atmospheric pressure(in N/m**2):
t = 17+273      #Temperature of the surroundings(in K):
R = 8.314*10**3 #Universal gas constant(in J/kg-K):
mw = 2          #Molecular weight of hydrogen:
Ra = 287        #Gas constant for air(in J/kg-K):
th = 273+27     #Temperature of Hydrogen (in K):

#Calculation:
v = round(4.0/3.0*math.pi*(d/2)**3,2)   #Volume of the balloon(in m**3):
Rh = R/mw  #Gas constant for H2(in kJ/kg-K):
mh = p*v/(Rh*th)  #Mass of H2 in balloon(in kg):
vd = v       #Volume of air printlaced(in m**3):
ma = round(p*vd/(Ra*t),2)  #Mass of air printlaced(in kg):
L = ma-mh   #Load lifting capacity due to buoyant force(in kg):

#Results:
print  "Load lifting capacity: ",round(L,3),"Kg"
Load lifting capacity:  74.344 Kg

Example 21, page no. 31

In [24]:
  
import math as m
#Variable Declaration: 
v = 20 #Volume of vessel(in m**3):
q = 0.25 #Rate at which air is drawn(in m**3/min):
Pr = 4 #Initial pressure/final pressure (ratio):

#Calculation:
t = v/q*m.log(Pr) #Time required(in min):

#Results:
print  "Time required: ",round(t,1),"Minutes"
Time required:  110.9 Minutes

Example 22, page no. 32

In [26]:
#Variable Declaration: 
M = 5.0 #Total mass of system of gas(in kg):
n = 0.80 #Compostion of Nitrogen:
o = 0.18 #Compostion of Oxygen:
c = 0.02 #Composition of Carbon dioxide:
ro = 1.4 #Compression ratio for Oxygen:
rn = 1.4 #Compression ratio for Nitrogen:
rc = 1.3 #Compression ratio for Carbon dioxide:
R = 8314.0 #Universal gas constant(in J/kg-K):
mwn = 28.0 #Molecular weight of Nitrogen:
mwo = 32.0 #Molecular weight of Oxygen:
mwc = 44.0 #Molecular weight of Carbon dioxide:

#Calculation:
Rn = round(R/mwn,1) #Gas constant for Nitrogen(in J/kg-K):
Ro = round(R/mwo,1) #Gas constant for Oxygen(in J/kg-K):
Rc = round(R/mwc,1) #Gas constant for Carbon dioxide(in J/kg-K):
Rm = round(n*Rn+o*Ro+c*Rc,2) #Gas constant for mixture(in J/kg-K):
Cpn = round((rn/(rn-1))*Rn,3) #Specific heat at constant pressure for Nitrogen(in kJ/kg-K):
Cpo = round((ro/(ro-1))*Ro,3) #Specific heat at constant pressure for Oxygen(in kJ/kg-K):
Cpc = round(rc/(rc-1)*Rc,3) #Specific heat at constant pressure for Carbon dioxide(in kJ/kg-K):
Cpm = round(n*Cpn+o*Cpo+c*Cpc,3) #Specific heat at constant pressure for the mixture(in kJ/kg-K):
nn = n*M/mwn #Number of moles of Nitrogen:
no = o*M/mwo #Number of moles of Oxygen:
nc = c*M/mwc #Number of moles of Carbon dioxide:
nt = nn+no+nc #Total number of moles:
xn = nn/nt #Mole fraction of Nitrogen:
xo = no/nt #Mole fraction of Oxygen:
xc = nc/nt #Mole fraction of Carbon dioxide:
mwm = xn*mwn+xo*mwo+xc*mwc #Molecular weight of the mixture

#Results:
print "Gas constant for Nitrogen: ",round(Rn,1),"J/Kg-K"
print "Gas constant for Oxygen: ",round(Ro,1),"J/Kg-K"
print "Gas constant for Carbon Diaoxide: ",round(Rc,1),"J/Kg-K"
print "Gas constant for Mixture: ",round(Rm,2),"J/Kg-K"
print "Specific heat at constant pressure for Nitrogen: ",round(Cpn/10**3,3),"kJ/kg-K"
print "Specific heat at constant pressure for Oxygen: ",round(Cpo/10**3,3),"kJ/kg-K"
print "Specific heat at constant pressure for Carbon Diaoxide: ",round(Cpc/10**3,3),"kJ/kg-K"
print "Specific heat at constant pressure for Mixture: ",round(Cpm/10**3,3),"kJ/kg-K"
print "The molecular weight of the mixture: " ,round(mwm,2),"Kg/Kmol"
Gas constant for Nitrogen:  296.9 J/Kg-K
Gas constant for Oxygen:  259.8 J/Kg-K
Gas constant for Carbon Diaoxide:  189.0 J/Kg-K
Gas constant for Mixture:  288.06 J/Kg-K
Specific heat at constant pressure for Nitrogen:  1.039 kJ/kg-K
Specific heat at constant pressure for Oxygen:  0.909 kJ/kg-K
Specific heat at constant pressure for Carbon Diaoxide:  0.819 kJ/kg-K
Specific heat at constant pressure for Mixture:  1.011 kJ/kg-K
The molecular weight of the mixture:  28.86 Kg/Kmol

Example 23, page no. 34

In [27]:
#Variable Declaration: 
o = 0.18 #Composition of Oxygen:
n = 0.75 #Composition of Nitrogen:
c = 0.07 #Composition of Carbon dioxide:
p = 0.5  #Pressure of mixture(in MPa):
t = 107+273 #Temperature of the mixture(in K):
m = 5   #Total mass of the mixture(in kg):
mwn = 28 #Molecular weight of Nitrogen:
mwo = 32 #Molecular weight of Oxygen:
mwc = 44 #Molecular weight of Carbon dioxide:
v = 1    #Total values of mixture(assume):

#Calculation:
xvo = o/v #Mole fraction of Oxygen(by volume):
xvn = n/v #Mole fraction of Nitrogen(by volume):
xvc = c/v#Mole fraction of Carbon dioxide(by volume):
mwm = o*mwo+n*mwn+c*mwc      #Molecular weight of the mixture(in kg/kmol):
xmn = n*mwn/mwm#Mole fraction of Nitrogen(by mass):
xmo = o*mwo/mwm#Mole fraction of Oxygen(by mass):
xmc = c*mwc/mwm#Mole fraction of Carbon dioxide(by mass):
po = o*p#Partial pressure of Oxygen:
pn = n*p#Partial pressure of Nitrogen:
pc = c*p#Partial pressure of Carbon dioxide:

#Results:
print  "Mole fraction of Oxygen by mass: ",round(xmo,3)
print  "Mole fraction of Nitrogen by mass: ",round(xmn,3)
print  "Mole fraction of Carbon dioxide by mass: ",round(xmc,3)
print  "Partial pressure of Oxygen: ",round(po,2),"MPa"
print  "Partial pressure of Nitrogen: ",round(pn,3),"MPa"
print  "Partial pressure of Carbon dioxide: ",round(pc,3),"MPa"
Mole fraction of Oxygen by mass:  0.193
Mole fraction of Nitrogen by mass:  0.704
Mole fraction of Carbon dioxide by mass:  0.103
Partial pressure of Oxygen:  0.09 MPa
Partial pressure of Nitrogen:  0.375 MPa
Partial pressure of Carbon dioxide:  0.035 MPa

Example 24, page no. 34

In [28]:
#Variable Declaration: 
V = 3.0 #Volume of gas in 1 chamber(in m**3):
pn = 800.0  #Partial pressure of Nitrogen(in kPa):
pc = 400.0      #Partial pressure of Carbon dioxide(in kPa):
tn = 480.0   #Temperature of Nitrogen(in K):
tc = 390.0   #Temperature of Carbon dioxide(in K):
rn = 1.4  #Compression ratio for Nitrogen:
rc = 1.3   #Compression ratio for Carbon dioxide:
R = 8314.0   #Universal gas constant(in J/kg-K):
mwn = 28.0   #Molecular weight of Nitrogen:
mwc = 44.0  #Molecular weight of Carbon dioxide:

#Calculation:
nn = pn*V/(R*tn)   #Moles of Nitrogen:
nc = pc*V/(R*tc)   #Moles of Carbon dioxide:
nt = round(nn+nc,6)   #Total no of moles:
cvn = (R/mwn)/(rn-1)    #Specific heat for Nitrogen at constant volume(in J/kg-K):
cvc = (R/mwc)/(rc-1)   #Specific heat for Carbon dioxide at constant volume(in J/kg-K):
mn = nn*mwn   #Mass of Nitrogen(in kg):
mc = nc*mwc  #Mass of Carbon dioxide(in kg):
t = (mn*cvn*tn+mc*cvc*tc)/(mn*cvn+mc*cvc)   #Equilibrium temperature of the mixture(in K):
p = nt*R*round(t,1)/(V+V)   #Equilibrium pressure of the mixture(kPa):

#Results:
print "Equilibrium temperature: ",round(t,1),"K"
print "Equilibrium pressure: ",round(p,3),"KPa"
Equilibrium temperature:  439.4 K
Equilibrium pressure:  591.205 KPa

Example 25, page no. 35

In [29]:
#Variable Declaration: 
mh = 2 #Mass of hydrogen taken(in kg):
mhe = 3 #Mass of helium taken(in kg):
Ch = 11.23 #Specific heat at constant pressure for hydrogen(in kJ/kg-K):
Che = 5.193 #Specific heat at constant pressure for helium(in kJ/kg-K):

#Calculation:
mt = mh+mhe #Total mass of the mixture(in kg):
Cm = (Ch*mh+Che*mhe)/mt #Specific heat at constant pressure for the mixture(in kJ/kg-K):

#Results:
print  "Specific heat at constant pressure for the mixture: ",round(Cm,3),"KJ/Kg-K"
Specific heat at constant pressure for the mixture:  7.608 KJ/Kg-K

Example 26, page no. 36

In [31]:
#Variable Declaration: 
mh = 18         #Mass of Hydrogen(in kg):
mn = 10        #Mass of Nitrogen(in kg):
mc = 2       #Mass of Carbon dioxide(in kg):
t1 = 27+273.15    #Initial temperature(in K):
t2 = 2*t1   #Final temperature(in K):
R = 8.314    #Universal gas constant(in kJ/kg-K):
mwh = 2   #Molecular weight of Hydrogen:
mwn = 28 #Molecular weight of Nitrogen:
mwc = 44 #Molecular weight of Carbon dioxide:
p1 = 101.325 #Initial pressure of the gases(in kPa)

#Calculation:
Rh = R/mwh #Gas constant for Hydrogen(in kJ/kg-K):
Rn = R/mwn #Gas constant for Nitrogen(in kJ/kg-K):
Rc = R/mwc #Gas constant for Carbon dioxide(in kJ/kg-K):
Rm = (mh*Rh+mn*Rn+mc*Rc)/(mh+mn+mc) #Gas constant for the mixture(in kJ/kg-K):
V = (mh+mn+mc)*Rm*t1/p1 #Capacity of the vessel(in m**3):
p2 = p1*t2/t1 #Final pressure of the mixture(in kPa):

#Results:
print  "Volume of the vessel: ",round(V,2),"m**3"
print  "Final pressure of the mixture",round(p2,2),"KPa"
Volume of the vessel:  231.57 m**3
Final pressure of the mixture 202.65 KPa

Example 27, page no. 37

In [33]:
  
import math as m
#Variable Declaration: 
t1 = 27+273.15 #Temperature of entering air(in K):
t2 = 500 #Temperature to which it gets heated up to(in K):

#Calculation:
R = m.sqrt(t2/t1) #Ratio of exit to inlet diameter:

#Results:
print  "Ratio of exit to inlet diameter: ",round(R,2)
Ratio of exit to inlet diameter:  1.29

Example 28, page no. 37

In [34]:
#Variable Declaration: 
v = 2.0 #Volume of vessel(in m**3):
R = 8.314 #Univeresal gas constant(in kJ/kg-K):
mwh = 2.0 #Molecular weight of hydrogen:

#Calculation:
p1 = 76/76*101.325 #Atmospheric pressure(in kPa):
t1 = 27+273.15 #Temperature of gas(in K):
t2 = t1
dp = 70.0/76*101.325 #Pressure difference(in kPa):
t3 = 10+273.15 #Temperature after cooling(in case 2)(in K):
Rh = R/mwh #Gas constant of hydrogen(in kJ/kg-K): #Case 1:
p2 = p1-dp #Final pressure of hydrogen(in kPa):
m = (p1-p2)*v/(Rh*t1) #Mass pumped out(in kg):
p3 = (t3/t2)*p2 #Pressure after cooling(in kPa): #Case 2:(temperature reduces till 10 degrees isochorically)

#Results:
print  "Mass pumped out: ",round(m,2),"Kg"
print  "Final pressure fter cooling: ",round(p3,3),"KPa"
Mass pumped out:  0.15 Kg
Final pressure fter cooling:  7.546 KPa