Chapter 1. Fundamental Concepts of Thermodynamics

Example Problem 1.1, Page Number 7

In [1]:
#Variable Declaration
Pi = 3.21e5             #Recommended tyre pressure, Pa
Ti = -5.00              #Initial Tyre temperature, °C
Tf = 28.00              #Final Tyre temperature, °C

#Calculations
Ti = 273.16 + Ti
Tf = 273.16 + Tf
pf = Pi*Tf/Ti           #Final tyre pressure, Pa

#Results
print 'Final Tyre pressure is %6.2e Pa'%pf
Final Tyre pressure is 3.61e+05 Pa

Example 1.2, Page Number 8

In [10]:
#Variable Declaration
phe = 1.5          #Pressure in Helium chamber, bar
vhe = 2.0          #Volume of Helium chamber, L
pne = 2.5          #Pressure in Neon chamber, bar
vne = 3.0          #Volume of Neon chamber, L
pxe = 1.0          #Pressure in Xenon chamber, bar
vxe = 1.0          #Volume of Xenon chamber, L
R = 8.314e-2       #Ideal Gas Constant, L.bar/(mol.K)
T = 298            #Temperature of Gas, K
#Calculations

nhe = phe*vhe/(R*T)            #Number of moles of Helium, mol
nne = pne*vne/(R*T)            #Number of moles of Neon, mol
nxe = pxe*vxe/(R*T)            #Number of moles of Xenon, mol
n = nhe + nne + nxe            #Total number of moles, mol
V = vhe + vne + vxe            #Total volume of system, L
xhe = nhe/n
xne = nne/n
xxe = nxe/n
P = n*R*T/(V)
phe = P*xhe              #Partial pressure of Helium, bar
pne = P*xne              #Partial pressure of Neon, bar
pxe = P*xxe              #Partial pressure of Xenon, bar

#Results
print 'Moles of He=%4.3f, Ne=%4.3f and, Xe=%4.3f in mol'%(nhe,nne,nxe) 
print 'Mole fraction of xHe=%4.3f, xNe=%4.3f and, xXe=%4.3f'%(xhe,xne,xxe)
print 'Final pressure is %4.3f bar'%P
print 'Partial pressure of pHe=%4.3f, pNe=%4.3f and, pXe=%4.3f in bar'%(phe,pne,pxe)
Moles of He=0.121, Ne=0.303 and, Xe=0.040 in mol
Mole fraction of xHe=0.261, xNe=0.652 and, xXe=0.087
Final pressure is 1.917 bar
Partial pressure of pHe=0.500, pNe=1.250 and, pXe=0.167 in bar

Example 1.4, Page Number 10

In [1]:
#Variable Declaration
T = 300.0               #Nitrogen temperature, K
v1 = 250.00             #Molar volume, L
v2 = 0.1                #Molar volume, L
a = 1.37                #Van der Waals parameter a, bar.dm6/mol2 
b = 0.0387              #Van der Waals parameter b, dm3/mol
R = 8.314e-2            #Ideal Gas Constant, L.bar/(mol.K)
n = 1.
#Calculations

p1 = n*R*T/v1           
p2 = n*R*T/v2
pv1 = n*R*T/(v1-n*b)- n**2*a/v1**2
pv2 = n*R*T/(v2-n*b)- n**2*a/v2**2

#Results
print 'Pressure from ideal gas law = %4.2e bar nad from Van der Waals equation = %4.2e bar '%(p1, pv1)
print 'Pressure from ideal gas law = %4.1f bar nad from Van der Waals equation = %4.1f bar '%(p2, pv2)
Pressure from ideal gas law = 9.98e-02 bar nad from Van der Waals equation = 9.98e-02 bar 
Pressure from ideal gas law = 249.4 bar nad from Van der Waals equation = 269.9 bar