# Chapter 3: The Standard Atmosphere¶

## Example 3.1¶

In :
# -*- coding: utf8 -*-
from __future__ import division
#Example: 3.1
''' Determine the phase for each of the following water states using the tables in Appendix
B and indicate the relative position in the P–v, T–v, and P–T diagrams. '''

print 'Theoretical question';

Theoretical question


## Example 3.2¶

In :
# -*- coding: utf8 -*-
from __future__ import division
#Example: 3.2
'''Determine the phase for each of the following states using the tables in Appendix B and
indicate the relative position in the P–v, T–v, and P–T diagrams, as in Figs. 3.11 and
3.12.'''

print 'Theoretical question';

Theoretical question


## Example 3.3¶

In :
# -*- coding: utf8 -*-
from __future__ import division
#Example: 3.3
'''Determine the temperature and quality (if defined) for water at a pressure of 300 kPa and
at each of these specific volumes:
a. 0.5 m3/kg
b. 1.0 m3/kg'''

print 'Theoretical question';

Theoretical question


## Example 3.4¶

In :
# -*- coding: utf8 -*-
from __future__ import division
#Example: 3.4
'''A closed vessel contains 0.1 m3 of saturated liquid and 0.9 m3 of saturated vapor R-134a
in equilibrium at 30◦C. Determine the percent vapor on a mass basis.'''

#Variable Declaration:
vliq = 0.1 		#Volume of saturated liquid in m**3
vf = 0.000843 	#in m**3/kg
vvap = 0.9 		#Volume of saturated vapor R-134a in equilbrium
vg = 0.02671 	#in m**3/kg

#Calculation:
mliq = vliq/vf 	#Mass of liquid in kg
mvap = vvap/vg 	#Mass of vapor in kg
m = mliq+mvap 	#Total mass in kg
x = mvap/m 		#Percentage of vapor on mass basis

#Result:
print 'Vapor on mass basis:',round(x*100,2),'%'

Vapor on mass basis: 22.12 %


## Example 3.5¶

In :
# -*- coding: utf8 -*-
from __future__ import division
#Example: 3.5
'''A rigid vessel contains saturated ammonia vapor at 20◦C. Heat is transferred to the system
until the temperature reaches 40◦C. What is the final pressure?'''

#Variable Declaration:
v1 = 0.14922 	#specific volume of sautrated ammonia in m**3/kg
P2 = 945 		#final pressure in kPa

#Calculation:
v2 = v1 		#in m**3/kg

print 'Final pressure is(by interpolation):',P2,'KPa'

Final pressure is(by interpolation): 945 KPa


## Example 3.6¶

In :
# -*- coding: utf8 -*-
from __future__ import division
#Example: 3.6
'''Determine the missing property of P–v–T and x if applicable for the following states.
a. Nitrogen: −53.2◦C, 600 kPa
b. Nitrogen: 100 K, 0.008 m3/kg'''

#Variable Declaration:
T1 = 273-53.2 	#Given temperature in K
P1 = 600 		#Given pressure in kPa
T2 = 100 		#Given temp. in K
v2 = 0.008 		#Given specific volume in m**3/kg
vf = 0.001452 	#in m**3/kg
vg = 0.0312 	#in m**3/kg
Psat = 779.2 	#Saturation pressure in kPa

#Calculation:
vfg = vg-vf 	#in m**3/kg
x = (v2-vf)/vfg 	#Quality

#Result:
print "Pressure is: ",round(Psat,2),"Kpa"
print "Quality is: ",round(x,4)

Pressure is:  779.2 Kpa
Quality is:  0.2201


## Example 3.7¶

In :
# -*- coding: utf8 -*-
from __future__ import division
#Example: 3.7
'''Determine the pressure for water at 200◦C with v = 0.4 m3/kg.'''

#Variable Declaration:
vg = 0.12736 	#Specific volume in m**3/kg for water at 200C
v = 0.4 		#Specific volume in m**3/kg
P1 = 500 		#in kPa
v1 = 0.42492 	#Specific volume at P1 in m**3/kg
P2 = 600 		#in kPa
v2 = 0.35202 	#Specific volume at P2 in m**3/kg

#Calculation:
P = P1+(P2-P1)*(v-v1)/(v2-v1) #Calculating pressure by interplotation

#Result:
print 'Pressure of water:',round(P,1),'KPa'

Pressure of water: 534.2 KPa


## Example 3.8¶

In :
# -*- coding: utf8 -*-
from __future__ import division
#Example: 3.8
'''What is the mass of air contained in a room 6 m × 10 m × 4 m if the pressure is 100 kPa
and the temperature is 25◦C?'''

#Variable Declaration:
P = 100 		#Pressure in kPa
V = 6*10*4 		#Volume of room in m**3
R = 0.287 		#in kN-m/kg-K
T = 25 		#Temperature in Celsius

#Calculation:
m = P*V/(R*(T+273.2)) 	#Mass of air contained in room

#Result:
print "Mass of air contained in room is:",round(m,2),"Kg"

Mass of air contained in room is: 280.43 Kg


## Example 3.9¶

In :
# -*- coding: utf8 -*-
from __future__ import division
#Example: 3.9
'''A tank has a volume of 0.5 m3 and contains 10 kg of an ideal gas having a molecular mass
of 24. The temperature is 25◦C. What is the pressure?'''

#Variable Declaration:
V = 0.5 		#Volumr of tank in m**3
m = 10 		#Mass of ideal gas in kg
T = 25 		#Temperature of tank in Celsius
M = 24 		#Molecular mass of gas in kg/kmol
Ru = 8.3145 	#Vniversal gas constant in kN-m/kmol-K

#Calculation:
R = Ru/M 		#Gas constant for given ideal gas in kN-m/kg-K
P = m*R*(T+273.2)/V#Pressure inside tank

#Result:
print "Pressure inside tank is: ",round(P),"KPa"

Pressure inside tank is:  2066.0 KPa


## Example 3.10¶

In :
# -*- coding: utf8 -*-
from __future__ import division
#Example: 3.10
'''A gas bell is submerged in liquid water, with its mass counterbalanced with rope and
pulleys, as shown in Fig. 3.20. The pressure inside is measured carefully to be 105 kPa,
and the temperature is 21◦C. A volume increase is measured to be 0.75 m3 over a period
of 185 s. What is the volume flow rate and the mass flow rate of the flow into the bell,
assuming it is carbon dioxide gas?'''

#Variable Declaration:
dt = 185 		#Time period in seconds over which there is incrrease in volume
dV = 0.75 		#Increase in volume in 0.75 in m**3
P = 105 		#Pressure inside gas bell kPa
T = 21 		#Temperature in celsius
R = 0.1889 		#Ideal gas constant in kJ/kg-K

#Calculation:
V = dV/dt 		#Volume flow rate in m**3/s
m = P*V/(R*(T+273.15))#Mass flow rate of the flow in kg/s

#Result:
print "Volume flow rate is: ",round(V,6),"m**3/s"
print "Mass flow rate is: ",round(m,5),"Kg/s"

Volume flow rate is:  0.004054 m**3/s
Mass flow rate is:  0.00766 Kg/s


## Example 3.12¶

In :
# -*- coding: utf8 -*-
from __future__ import division
#Example: 3.12
'''Determine the specific volume for R-134a at 100◦C, 3.0 MPa for the following models:'''

#Variable Declaration:
T = 100 		#Given temp.in 100 celsius
P = 3 		#Given pressure in MPa
v1 = 0.0065 	#Specific volume in m**3/kg using table
M = 102.3 		#Molecular mass in kg
R = 8.3145 		#in kJ/K
Tr = 373.2/374.2 	#Reduced temperature using generalized chart
Pr = 3/4.06 	#Reduced pressure using generalized chart
Z = 0.67 		#Compressibility factor

#Calculation:
Ru = R/M 		#in kJ/K-kg
v2 = Ru*(T+273)/(P*1000)#Specific volume assuming R-134a to be ideal gas in m**3/kg
v3 = Z*v2 		#Specific volume using generalized chart in m**3/kg

#Result:
print "Specific volume for R-134a using R-134a tables is: ",round(v1,5),"m**3/kg"
print "Specific volume for R-134a using R-134a the ideal gas laws is:",round(v2,5),"m**3/kg"
print "Specific volume for R-134a using the generalized chart is: ",round(v3,5),"m**3/kg"

Specific volume for R-134a using R-134a tables is:  0.0065 m**3/kg
Specific volume for R-134a using R-134a the ideal gas laws is: 0.01011 m**3/kg
Specific volume for R-134a using the generalized chart is:  0.00677 m**3/kg


## Example 3.13¶

In :
# -*- coding: utf8 -*-
from __future__ import division
#Example: 3.13
'''Propane in a steel bottle of volume 0.1 m3 has a quality of 10% at a temperature of 15◦C.
Use the generalized compressibility chart to estimate the total propane mass and to find
the pressure.'''

#Variable Declaration:
Pc = 4250 		#Critical pressure of propane in kPa
Tc = 369.8 		#Critical temperature in K
T = 15 		#Temperature of propane in celsius
Prsat = 0.2 	#Reduced pressure
x = 0.1 		#Given quality
Zf = 0.035 		#from graph
Zg = 0.83 		#from graph
V = 0.1 		#Volume of steel bottle in m**3
R = 0.1887 		#in kPa-m**3/kg-K

#Calculation:
Tr = T/Tc 		#Reduced temperature
P = Prsat*Pc 	#Pressure in kPa
Z = (1-x)*Zf+x*Zg #Overall compressibility factor
m = P*V/(Z*R*(T+273))#Total propane mass in kg

#Result:
print "Pressure is P:",round(P,2),"KPa"
print "Total propane mass is: ",round(m,2),"Kg"

Pressure is P: 850.0 KPa
Total propane mass is:  13.66 Kg