# Chapter 8 : One dimentional high velocity gas flow¶

### Example 8.1 page no : 297¶

In [1]:
#Calculate the speed of sound in water amd steel at 20 C

# Variable
#for steel
K_steel=1.94*10**11                   #Pa
rho_steel=7800.                       #Kg.m^3

# Calculation and Result
c_steel=(K_steel/rho_steel)**0.5/1000     # Km/s
print "the speed of sound in steel at 20 C is %f km/s"%c_steel

#for water
K_water=3.14*10**5                     #lbf/in^2
rho_water=62.3                         #lbm/ft^3

#1 ft =12 in
#1 lbf.s^2 = 32.2 lbm.ft
c_water=(K_water/rho_water*144*32.2)**0.5      #ft/s
print "the speed of sound in water at 20 C is %f ft/s"%c_water

the speed of sound in steel at 20 C is 4.987163 km/s
the speed of sound in water at 20 C is 4834.259759 ft/s


### Example 8.2 page no : 300¶

In [2]:
#Calculate the speed of sound in air at 20 C

# Variable
R=10.73                           #lbf.ft^3/in^2/lbmol/R
#1 ft = 12 in
#1 lbf.s^2 = 32.2 lbm.ft
R1=(R*144*32.2)**0.5              #ft/s*(lbm/lbmol/R)^0.5
k=1.4                             #dimentionless
T=528.                            #R (Rankine temperature scale)
M=29.                             #lbm/lbmol

# Calculation
c=R1*(k*T/M)**0.5                 #ft/s

# Result
print "the speed of sound in air at 20 C is %d ft/s"%c

the speed of sound in air at 20 C is 1126 ft/s


### Example 8.3 page no : 302¶

In [3]:
#Calculate the temperature of the gas where is mach number is 2

# Variable
Ma=2.                        #dimentionless (Mach number)
k=1.4                        #dimentionless
T1=528.                      #R (Rankine temperature scale)

# Calculation
T2=T1/((Ma**2*(k-1)/2)+1)    #R (Rankine temperature scale)

# Result
print "The temperature of the gas when mach number is 2 is %d R"%T2

The temperature of the gas when mach number is 2 is 293 R


### Example 8.4 page no : 302¶

In [6]:
#Calculate the speed of sound in air at 20 C

# Variable
R=10.73                      #lbf.ft^3/(in^2.lbmol.R)

#1 ft = 12 in
##1 lbf.s^2 = 32.2 lbm.ft
R_root=(R*144*32.2)**0.5      #ft/s*(lbm/lbmol.R)^0.5
Ma=2                          #dimentionless (Mach number)
k=1.4                         #dimentionless
T=298.                        #R (Rankine temperature scale)
M=29.                         #lbm/lbmol

# Calculation
c=R_root*(k*T/M)**0.5         #ft/s
v=c*Ma                        #ft/s

# Result
print "%f"%c
print "The speed of sound in air at 20 C is %f ft/s"%v

846.023046
The speed of sound in air at 20 C is 1692.046093 ft/s


### Example 8.5 page no : 303¶

In [7]:
#Calculate the pressure and density at a pt where temperature ratio is 1.8 and initial pressure and density are given

# Variable
ratio_T=1.8         #dimentionless
P1=2.               #bar
k=1.4               #dimentionless

# Calculation
P2=P1/ratio_T**(k/(k-1))            #bar
rho1=2.39                           #Kg/m^3
rho2=rho1/ratio_T**(1/(k-1))        #Kg/m^3

# Result
print "The pressure where temperature ratio is 1.8 and initial pressure is 2 bar is %f bar"%P2
print "The density where temperature ratio is 1.8 and initial density is 2.39 Kg/m^3 is %f Kg/m^3"%rho2

The pressure where temperature ratio is 1.8 and initial pressure is 2 bar is 0.255609 bar
The density where temperature ratio is 1.8 and initial density is 2.39 Kg/m^3 is 0.549815 Kg/m^3


### Example 8.6 page no : 306¶

In [8]:
#Calculate the cross sectional area, pressure, temperature and mach number at a pt in duct where air velocity is 1400ft/s

# Variable
P1=30.                      #psia
T1=660.                     #R (Rankine temperature scale)
m=10.                       #lbm/s mass flow rate
v1=1400.                    #ft/s
R=4.98*10**4                #(ft^2/s^2)*(lbm/lbmol.R)^0.5
k=1.4                       #dimentionless
M=29.                       #lbm/lbmol

# Calculation and  Result
T2=T1-v1**2*((k-1)/k)*M/2/R       # R (Rankine temperature scale)
print "The temperature at the pt in the duct where air velocity is 1400 ft/s is %f R"%T2

c=223*(k*T2/M)**0.5               #ft/s
Ma=v1/c                           #dimentionless (Mach number)
print "The mach number at the pt in the duct where air velocity is 1400 ft/s is %f"%Ma

P2=P1/(T1/T2)**(k/(k-1))          #psia
print "The pressure at the pt in the duct where air velocity is 1400 ft/s is %f psia"%P2

#1 lbf.s^2 = 32.2 lbm.ft
A0=m/(P1*(M*k)**0.5*32.2/223/(T1)**0.5/((k-1)/2+1)**((k+1)/2/(k-1)))     #in^2
ratio_A=((Ma**2*(k-1)/2+1)/((k-1)/2+1))**((k+1)/2/(k-1))/Ma              #dimentionless
A=ratio_A*A0                     #in^2
print "The cross sectional at the pt in the duct where air velocity is 1400 ft/s is %f in^2"%A

The temperature at the pt in the duct where air velocity is 1400 ft/s is 496.947791 R
The mach number at the pt in the duct where air velocity is 1400 ft/s is 1.281748
The pressure at the pt in the duct where air velocity is 1400 ft/s is 11.112331 psia
The cross sectional at the pt in the duct where air velocity is 1400 ft/s is 17.029147 in^2


### Example 8.7 page no : 307¶

In [9]:
#Calculate the cross sectional area, pressure, temperature and mach number at a pt in duct where air velocity is 1400ft/s

# Variable
P1=30.                          #psia
T1=660.                         #R (Rankine temperature scale)
ratio_T=0.83333                 #dimentionless
m=10.                           #lbm/s mass flow rate
v1=1400.                        #ft/s
R=4.98*10**4                    #(ft^2/s^2)*(lbm/lbmol.R)^0.5
k=1.4                           #dimentionless
M=29.                           #lbm/lbmol

# Calculation and  Result
T2=T1*ratio_T                   #R (Rankine temperature scale)
print "The temperature at the pt in the duct where air velocity is 1400 ft/s is %f R"%T2

c=223*(k*T2/M)**0.5             #ft/s
Ma=v1/c                         #dimentionless (Mach number)
print "The mach number at the pt in the duct where air velocity is 1400 ft/s is %f"%Ma

ratio_t=0.7528                  #dimentionless
ratio_P=0.3701                  #dimentionless
ratio_A=1.0587                  #dimentionless
T=T1*ratio_t                    #R (Rankine temperature scale)
print "T=%f"%T
P=P1*ratio_P#psia
print "P=%f"%P

The temperature at the pt in the duct where air velocity is 1400 ft/s is 549.997800 R
The mach number at the pt in the duct where air velocity is 1400 ft/s is 1.218366
T=496.848000
P=11.103000


### Example 8.8 page no : 308¶

In [5]:
#Calculate the cross sectional area, pressure, temperature and mach number at a pt in duct where air velocity is 1400ft/s

# Variable
P1=30.                        #psia
T1=660.                       #R (Rankine temperature scale)
m=10.                         #lbm/s mass flow rate
v1=4000.                      #ft/s
R=4.98*10**4                  #(ft^2/s^2)*(lbm/lbmol.R)^0.5
k=1.4                         #dimentionless
M=29.                         #lbm/lbmol

# Calculation and  Result
T2=T1-v1**2*((k-1)/k)*M/2./R           #R (Rankine temperature scale)
print "The temperature at the pt in the duct where air velocity is 1400 ft/s is %f R"%T2
T2 = -T2
c=223.*(k*T2/M)**0.5                   #ft/s
Ma=v1/c                               #dimentionless (Mach number)
P2=P1/(T1/T2)**(k/(k-1))              #psia

#1 lbf.s^2 = 32.2 lbm.ft
A0=m/(P1*(M*k)**0.5*32.2/223/(T1)**0.5/((k-1)/2+1)**((k+1)/2/(k-1)))          #in^2
ratio_A=((Ma**2*(k-1)/2+1)/((k-1)/2+1))**((k+1)/2/(k-1))/Ma                   #dimentionless
A=ratio_A*A0                          #in^2

The temperature at the pt in the duct where air velocity is 1400 ft/s is -671.038439 R


### Example 8.9 page no : 309¶

In [7]:
#Calculate the temperatures at different pts in a duct with different mach numbers

# Variable
#for mach number=0.5
ratio_T=0.9524                 #dimentionless
T1=293.15                      #K

# Calculation
T2=T1/ratio_T                  #K

# Result
print "The temperature at the pt in the duct where mach number is 0.5 is %f K"%T2
#for mach number 2
ratio_t=0.5556                 #dimentionless
t2=293.15                       #K
t1=t2*ratio_t                  #K
print "The temperature initially at the start of the nozzle is %f K"%t1

The temperature at the pt in the duct where mach number is 0.5 is 307.801344 K
The temperature initially at the start of the nozzle is 162.874140 K


### Example 8.12 page no : 324¶

In [13]:
#Calculate the reservoir temperature and the pressure of air around the aircraft

# Variable
gama=1.4                         #dimentionless
Ma=2.                            #dimentionless (Mach number)
To=273.15                        #K

# Calculation
Tr=To*(Ma**2*(gama-1)/2.+1)       # K
P1=50.                            #KPa
Pr=P1*(Tr/To)**(gama*5/2)         #KPa

# Result
print "the reservoir temperature of air around the aircraft is %f K"%Tr
print "The pressure of air around the aircraft is %f KPa"%Pr

the reservoir temperature of air around the aircraft is 491.670000 K
The pressure of air around the aircraft is 391.222453 KPa


### Example 8.13 page no : 325¶

In [14]:
#Calculate temperature and the velocity of air inside the shock wave

# Variable
#Let subscript y denote air inside the shock wave and x denote the air outside the shock wave
ratio_T=1.2309                 #dimentionless
Tx=528.                        #R (Rankine temperature scale)
My=0.7558                      #dimentionless
cy=1249.                       #ft/s

#Calculations
Ty=ratio_T*Tx                  #R (Rankine temperature scale)
Vy=My*cy                       #ft/s

#Results
print "temperature of air inside the shock wave is %f R"%Ty
print "the velocity of air inside the shock wave is %f ft/s"%Vy

temperature of air inside the shock wave is 649.915200 R
the velocity of air inside the shock wave is 943.994200 ft/s


### Example 8.14 page no : 328¶

In [15]:
#Calculate the ratio of area of throat to area of a certain point

# Variable
A_throat=1.             #in^2
A_exit=1.5              #in^2
ratio_A=2.2385          #dimentionless

# Calculation
ratio_A1=ratio_A*(A_throat/A_exit)         #dimentionless

# Result
print "the ratio of area of throat to area of a certain point is %f"%ratio_A1

the ratio of area of throat to area of a certain point is 1.492333