import math
P1 = 0.18 # Diffuser static pressure in MPa
R = 0.287 # Gas constant
T1 = 37 # Static temperature
P0 = 0.1# Atmospheric pressure in MPa
A1 = 0.11 # intake area in m**2
V1 = 267 # Inlet velocity in m/s
w = (P1*1e3/(R*(T1+273)))*A1*V1 # mass flow rate
g = 1.4 # Heat capacity ratio
c1 = math.sqrt(g*R*(T1+273)*1000) # velocity
M1 = V1/c1 # Mach number
A1A_ = 1.0570 # A1/A* A* = A_
P1P01 = 0.68207 # pressure ratio
T1T01 = 0.89644# Temperature ratio
F1F_ = 1.0284# Impulse function ratio
A2A1 = 0.44/0.11 # Area ratio
A2A_ = A2A1*A1A_# Area ratio
M2 = 0.135 # Mach number
P2P02 = 0.987 # Pressure ratio
T2T02 = 0.996 # Temperature ratio
F2F_ = 3.46# Impulse function ratio
P2P1 = P2P02/P1P01 # Pressure ratio
T2T1 = T2T02/T1T01# Temperature ratio
F2F1 = F2F_/F1F_ # Impulse function ratio
P2 = P2P1*P1 # Outlet pressure
T2 = T2T1*(T1+273) # Outlet temperature
A2 = A2A1*A1 # Exit area
F1 = P1*A1*(1+g*M1**2) # Impulse function
F2 = F2F1*F1 # Impulse function
Tint = F2-F1 # Internal thrust
Text = P0*(A2-A1) # External thrust
NT = Tint - Text # Net thrust
print "\n Example 17.2 \n"
print "\n Mass flow rate of air through diffuser is ",w ," Kg/s"
print "\n Mach number of leaving air is ",M2
print "\n Temperature of leaving air is ",T2-273 ," degree celcius"
print "\n Pressure of leaving air is ",P2 ," MPa "
print "\n Net thrust is ",NT*1e3 ," kN"
#The answers vary due to round off error
import math
M2 = 2.197 # Mach number
P2P0 = 0.0939 # pressure ratio
T2T0 = 0.5089 # Temperature ratio
P0 = 1 # Stagnation pressure in MPa
T0 = 360 # Stagnation temperature in K
g = 1.4 # Heat capacity ratio
R = 0.287 # Gas constant
P2 = P2P0*P0*1e3 # Static Pressure
T2 = T2T0*T0 # Static temperature
c2 = math.sqrt(g*R*T2*1000)
V2 = c2*M2 #velocity at the exit from the nozzle
# for air
P_P0 = 0.528 # pressure ratio
T_T0 = 0.833 # Temperature ratio
P_ = P_P0*P0*1e3 # Static Pressure
T_ = T_T0*T0 #Static temperature
rho_ = P_/(R*T_) # density
V_ = math.sqrt(g*R*T_*1000) # Velocity at the exit from the nozzle
At = 500e-06 # throat area
w = At*V_*rho_# Maximum flow rate of air
print "\n Example 17.3\n"
print "\n When divergent section act as a nozzle"
print "\n Maximum flow rate of air is ",w ," kg/s"
print "\n Static temperature is ",T2 ," K"
print "\n Static Pressure is ",P2 ," kPa"
print "\n Velocity at the exit from the nozzle is ",V2 ," m/s"
#The answers vary due to round off error
# Part (b)
Mb = 0.308 # Mach number
P2P0b = 0.936 # Pressure ratio
T2T0b = 0.9812 # Temperature ratio
P2b = P2P0b*P0*1e3#Static Pressure
T2b = T2T0b*T0 # Static temperature
c2b = math.sqrt(g*R*T2b*1000) # Velocity
V2b = c2b*Mb #Velocity at the exit from the nozzle
print "\n\n When divergent section act as a diffuser"
print "\n Maximum flow rate of air is ",w ," kg/s"
print "\n Static temperature is ",T2b ," K"
print "\n Static Pressure is ",P2b ," kPa"
print "\n Velocity at the exit from the nozzle is ",V2b ," m/s"
import math
Px = 16.0 # pressure in kPa
Poy = 70.0 #pressure in kPa
Mx = 1.735 # Mach number
Pyx = 3.34 # Pressure ratio
rho_yx = 2.25 # Density ratio
Tyx = 1.483 # Temperature ratio
Poyox = 0.84 # pressure ratio
My = 0.631 # Mach number
g = 1.4 # Ratio of heat capacities
Tox = 573.0 # stagnation temperature in K
Toy = Tox # temperature equivalence
Tx = Tox/(1+((g-1)/2.0)*Mx**2) # temperature at x
Ty = Tyx*Tx # temperature at y
Pox = Poy/Poyox # total pressure
# From table
Mx = 1.735
print "\n Example 17.4\n"
print "\n Mach number of the tunnel is ",Mx
import math
Ax = 18.75 # cross sectional area in divergent part in m**2
A_ = 12.50 # throat area in m**2
AA_ = 1.5 # Area ratio
Pxox = 0.159 # pressure ratio from table
R = 0.287 # Gas constant
Pox = 0.21e03 # pressure in kPa
Px = Pxox*Pox # pressure calculation
# from the gas table on normal shock
Mx = 1.86
My = 0.604
Pyx = 3.87
Poyx = 4.95
Poyox = 0.786
Py = Pyx*Px
Poy = Poyx*Px
My = 0.604
Ay_ = 1.183
A2 = 25
Ay = 18.75
A2_ = (A2/Ay)*Ay_
# From isentropic table
M2 = 0.402
P2oy = 0.895
P2 = P2oy*Poy
syx = -R*math.log(Poy/Pox) # sy-sx
print "\n Example 17.5\n"
print "\n Exit Mach number is ",M2
print "\n Exit pressure is ",P2 ," kPa"
print "\n Exit Stagnation pressure is ",Pox-Poy ," kPa"
print "\n Entropy increase is ",syx ," kJ/kg K"
#The answers vary due to round off error