Appendix E

Example 1

In [1]:
# -*- coding: utf8 -*-
from __future__ import division
#Example: 17.1
'''Air flows in a duct at a pressure of 150 kPa with a velocity of 200 m/s. The temperature
of the air is 300 K. Determine the isentropic stagnation pressure and temperature.'''

#Variable Declaration: 
T = 300					#Temperature of air in K
P = 150					#Pressure of air in kPa
v = 200					#velocity of air flow n m/s
Cp = 1.004				#specific heat at constant pressure in kJ/kg

#Calculations:
To = v**2/(2000*Cp)+T	#stagnation temperature in K
k = 1.4		       		#constant
Po = P*(To/T)**(k/(k-1))#stagnation pressure in kPa

#Results:
print 'Stagnation Temperature: ',round(To,1),'K'
print 'Stagnation Pressure:',round(Po,1),'KPa'
Stagnation Temperature:  319.9 K
Stagnation Pressure: 187.9 KPa

Example 3

In [2]:
# -*- coding: utf8 -*-
from __future__ import division
#Example: 17.3
'''A jet engine is being tested on a test stand (Fig. 17.5). The inlet area to the compressor is
0.2 m2, and air enters the compressor at 95 kPa, 100 m/s. The pressure of the atmosphere
is 100 kPa. The exit area of the engine is 0.1 m2, and the products of combustion leave the
exit plane at a pressure of 125 kPa and a velocity of 450 m/s. The air–fuel ratio is 50 kg
air/kg fuel, and the fuel enters with a low velocity. The rate of air flow entering the engine
is 20 kg/s. Determine the thrust, Rx, on the engine.'''

#Keys
#i = inlet
#e = exit

#Variable Declaration: 
#using momentum equation on control surface in x direction
me = 20.4		#mass exiting in kg
mi = 20			#mass entering in kg
ve = 450		#exit velocity in m/s
vi = 100		#exit velocity in m/s
Pi = 95			#Pressure at inlet in kPa
Pe = 125		#Pressure at exit in kPa
Po = 100		#surrounding pressure in kPa
Ai = 0.2		#inlet area in m**2
Ae = 0.1		#exit area in m**2

#Calculations:
Rx = (me*ve-mi*vi)/1000-(Pi-Po)*Ai+(Pe-Po)*Ae		#thrust in x direction in kN

#Results:
print 'Thrust acting in x direction: ',Rx,'KN' 
Thrust acting in x direction:  10.68 KN

Example 5

In [3]:
# -*- coding: utf8 -*-
from __future__ import division
from math import sqrt
#Example: 17.5
'''Determine the velocity of sound in air at 300 K and at 1000 K.'''

#Variable Declaration: 
k = 1.4			#constant
R = 0.287		#gas constant
#At 300K
T1 = 300		#K
T2 = 1000		#K

#Calculations:
c1 = sqrt(k*R*T1*1000)
c2 = sqrt(k*R*T2*1000)

#Results:
print 'Speed of sound at 300K: ',round(c1,1),'m/s'
print 'Speed of sound at 1000K: ',round(c2,1),'m/s'
Speed of sound at 300K:  347.2 m/s
Speed of sound at 1000K:  633.9 m/s

Example 6

In [4]:
# -*- coding: utf8 -*-
from __future__ import division
from math import sqrt
#Example: 17.6
'''A convergent nozzle has an exit area of 500 mm2. Air enters the nozzle with a stagnation
pressure of 1000 kPa and a stagnation temperature of 360 K. Determine the mass rate of
flow for back pressures of 800 kPa, 528 kPa, and 300 kPa, assuming isentropic flow'''

#Variable Declaration: 
k = 1.4				#constant
R = 0.287			#gas constant
To = 360			#stagnation Temperature in K 
P = 528				#stagnation pressure in kPa
A = 500*10**-6		#area in m**2
Me = 0.573			#Mach number
Pe = 800			#exit pressure in kPa

#Calculations:
T = To*0.8333		#Temperature of air in K, 0.8333 stagnation ratio from table
v = sqrt(k*R*T*1000)#velocity in m/s
d = P/(R*T)			#stagnation density in kg/m**3
ms = d*A*v			#mass flow rate in kg/s
Te = To*0.9381		#exit temperature in K, ratio from table
ce = sqrt(k*R*Te*1000)#exit velocity of sound in m/s
ve = Me*ce
de = Pe/R/Te
mse = de*A*ve

#Results:
print 'Mass flow rate at the throat section: ',round(ms,4),'Kg/s'
print 'Mass flow rate at the exit section: ',round(mse,4),'Kg/s'
Mass flow rate at the throat section:  1.0646 Kg/s
Mass flow rate at the exit section:  0.8711 Kg/s

Example 7

In [5]:
# -*- coding: utf8 -*-
from __future__ import division
from math import sqrt
#Example: 17.7
'''A converging-diverging nozzle has an exit area to throat area ratio of 2. Air enters this
nozzle with a stagnation pressure of 1000 kPa and a stagnation temperature of 360 K. The
throat area is 500 mm2. Determine the mass rate of flow, exit pressure, exit temperature,
exit Mach number, and exit velocity for the following conditions:
a. Sonic velocity at the throat, diverging section acting as a nozzle.
(Corresponds to point d in Fig. 17.13.)
b. Sonic velocity at the throat, diverging section acting as a diffuser.
(Corresponds to point c in Fig. 17.13.)'''

#Variable Declaration: 
Po = 1000		      	#stagnation pressure in kPa
To = 360		      	#stagnation temperature in K
#when diverging section acting as nozzle
Pe1 = 0.0939*Po			#exit pressure of air in kPa
Te1 = 0.5089*To			#exit temperature in K
k = 1.4		      		#constant
R = 0.287		      	#gas constant for air
Me = 2.197		      	#mach number from table
#when diverging section act as diffuser
Me2 = 0.308
Pe2 = 0.0936*Po		#exit pressure of air in kPa
Te2 = 0.9812*To		#exit temperature in K

#Calculations:
ce = sqrt(k*R*Te1*1000)	#velocity of sound in exit section in m/s
ve1 = Me*ce				#velocity of air at exit section in m/s
ce = sqrt(k*R*Te2*1000)		#velocity of sound in exit section in m/s
ve2 = Me2*ce

#Results:
print '__When diverging section act as a nozzle__'
print 'Exit pressure: ',round(Pe1,1),"Kpa"
print 'Exit Temperature: ',round(Te1,1),"K"
print 'Exit velocity: ',round(ve1,1),"m/s"
print '__When diverging section act as a diffuser__'
print 'Exit pressure: ',round(Pe2,1),"Kpa"
print 'Exit Temperature: ',round(Te2,1),"K"
print 'Exit velocity: ',round(ve2,1),"m/s"
__When diverging section act as a nozzle__
Exit pressure:  93.9 Kpa
Exit Temperature:  183.2 K
Exit velocity:  596.1 m/s
__When diverging section act as a diffuser__
Exit pressure:  93.6 Kpa
Exit Temperature:  353.2 K
Exit velocity:  116.0 m/s

Example 8

In [6]:
# -*- coding: utf8 -*-
from __future__ import division
#Example: 17.8
'''Consider the convergent-divergent nozzle of Example 17.7, in which the diverging section
acts as a supersonic nozzle (Fig. 17.16). Assume that a normal shock stands in the exit
plane of the nozzle. Determine the static pressure and temperature and the stagnation
pressure just downstream of the normal shock.'''

#Variable Declaration:
Px = 93.9 			#Static Pressure in Upstream(Kpa)
Tx = 183.2 			#Static Temperature in Upstream(K)
Pox = 1000			#Total Pressure in Upstream(Kpa)
Mx = 2.197			#X-direction Mach No (Using table A.13)
My = 0.547			#Y-direction Mach No (Using table A.13)
rP = 5.46			#Py/Px (Using table A.13)
rT = 1.854			#Ty/Tx (Using table A.13)
rPo = 0.63			#Poy/Pox (Using table A.13)

#Calculations:
Py = rP*Px
Ty = rT*Tx
Poy = rPo*Pox

#Results:
print 'Static Pressure in downstream: ',round(Py,1),'Kpa'
print 'Static Temperature in downstream: ',round(Ty,1),'K'
print 'Stagnation Pressure in downstream: ',round(Poy,1),'Kpa'
Static Pressure in downstream:  512.7 Kpa
Static Temperature in downstream:  339.7 K
Stagnation Pressure in downstream:  630.0 Kpa

Example 9

In [7]:
# -*- coding: utf8 -*-
from __future__ import division
#Example: 17.9
'''Consider the convergent-divergent nozzle of Examples 17.7 and 17.8. Assume that there
is a normal shock wave standing at the point where M = 1.5. Determine the exit-plane
pressure, temperature, and Mach number. Assume isentropic flow except for the normal
shock (Fig. 17.18).'''

#Key
#x = inlet
#y = exit

#Variable Declaration: 
Mx = 1.5				#mach number for inlet
My = 0.7011				#mach number for exit
Px = 272.4				#inlet pressure in kPa
Tx = 248.3				#inlet temperature in K
Pox = 1000				#stagnation pressure for inlet

#Calculations:
Py = 2.4583*Px			#Exit Pressure in kPa
Ty = 1.320*Tx			#Exit temperature in K
Poy = 0.9298*Pox		#Exit pressure in kPa

#Results:
print 'Exit pressure: ',round(Py,1),"Kpa"
print 'Exit temperature: ',round(Ty,1),"K"
print 'Exit stagnation pressure: ',round(Poy,1),"Kpa"
Exit pressure:  669.6 Kpa
Exit temperature:  327.8 K
Exit stagnation pressure:  929.8 Kpa