# Chapter12-Steady One Dimensional Compressible Flow¶

## Ex1-pg628¶

In [18]:
##Mach number at entry:
import math
M1=0.3;
##Temperature at entry(in K):
T1=335.;
##Pressure at entry(in kPa):
p1=650.;
##Area at entry(in m**2):
A1=0.001;
##Mach number at exit:
M2=0.8;
##/Value of k:
k=1.4;
##For the Mach no:0.3:
##T/T0:
t1=0.9823;
##p/p0:
P1=0.9395;
##d/d0:
den1=0.9564;
##A/A*:
a1=2.035;
##For the Mach no:0.8:
## T/T0:
t2=0.8865;
##p/p0:
P2=0.6560;
##d/d0:
den2=0.7400;
##A/A*:
a2=1.038;
##Gas Constant(in N-m/kg-K):
R=287.;
##pressure and area##

##Here the stagnation quantities are constant.
## Stagnation temperature(in K):
T0=T1*(1.+(k-1.)/2.*M1**2.)
##Stagnation pressure(in kPa):
p0=p1*((1.+(k-1.)/2.*M1**2.)**(k/(k-1.)))
##Finding T2/T1:
T=t2/t1
##Temperature at exit(in K):
T2=T*T1
##Finding p2/p1:
P=P2/P1
##Pressure at exit(in kPa):
p2=P2*p1
##Density of air at exit(in kg/m**3):
d2=p2*10**3./R/T2
##Velocity of air at exit(in m/sec):
V2=M2*math.sqrt(k*R*T2)
##Finding A2/A1:
a=a2/a1
##Area at exit(in m**2):
A2=a*A1
print ("RESULTS")
print'%s %.2f %s'% ("Stagnation temperature: ",T0," K")
print'%s %.2f %s'% ("Stagantion pressure: ",p0," kPa")
print'%s %.2f %s'% ("Temperature a exit ",T2," K")
print'%s %.2f %s'% ("Pressure at exit: ",p2," kpa")
print'%s %.2f %s'% ("Density of air at exit: ",d2," kg/m**3")
print'%s %.2f %s'% ("Velocity of air at exit: ",V2," m/sec")
print'%s %.5f %s'% ("Area at exit: ",A2," ")

RESULTS
Stagnation temperature:  341.03  K
Stagantion pressure:  691.88  kPa
Temperature a exit  302.33  K
Pressure at exit:  426.40  kpa
Density of air at exit:  4.91  kg/m**3
Velocity of air at exit:  278.83  m/sec
Area at exit:  0.00051


## Ex2-pg634¶

In [1]:
##Throat area of nozzle(in m**2):
import math
Ae=0.001;
##Back pressure of air(in kPa):
pb=591.;
##Stagnation pressure(in kPa):
p0=1000.;
##Stagnation temperature(in K):
T0=333.;
##Gas Constant(in N-m/kg-K):
R=287.;
##Value of k:
k=1.4;
##Mass flow##

##Checking for chocking:
c=pb/p0;
if(c<0.528):
print('choked')
else:
print('Not choked')
##Therefore pressure at exit = back pressure
pe=pb; ##Mach number at exit:
Me=(((p0/pe)**((k-1.)/k)-1.)*(2./(k-1.)))**0.5
##Temperature at exit(in K):
Te=T0/(1.+(k-1.)/2.*Me**2.)
##Velocity at exit(in m/sec):
Ve=Me*math.sqrt(k*R*Te)
##Density at exit(in kg/m**3):
de=pe*10**3./R/Te
##Mass flow rate of air(kg/sec):
m=de*Ve*Ae

print("RESULTS")
print '%s %.2f %s'%("Mach number at exit:",Me,"")
print '%s %.2f %s'%("Mass flow rate of air: ",m," kg/sec")


Not choked
RESULTS
Mach number at exit: 0.90
Mass flow rate of air:  2.20  kg/sec


## Ex3-pg636¶

In [2]:
import math
##Mach number at entry:
M1=0.52;
##Temperature at entry(in F):
T1=40.;
##Pressure at entry(in psia):
p1=60.;
##Area at entry(in ft**2):
A1=0.013;
##Back pressure(in psia):
pb=30.;
##Gas Consant(in ft-lbf/lbm-R)
R=53.3;
##Value of k:
k=1.4;
##mass and area##

##Saturation pressure(in psia):
p0=p1*(1.+(k-1.)/2.*M1**2.)**(k/(k-1.))
##Checking for choking:
x=pb/p0;
if(x>0.528):
print('Not choked')
else:
print('choked')

##As there is choking:
Mt=1;
##Velocity at entry:
V1=M1*math.sqrt(k*R*(T1+460.)*32.2)
##Density at the entry(in lbm/ft**3):
d1=p1/(R*(T1+460.))*144.
##Mass flow rate(in lbm/sec):
m=d1*V1*A1
##Finding the valueof A1/A*;
A=1./M1*((1.+(k-1.)/2.*M1**2.)/(1.+(k-1.)/2.))**((k+1.)/(2.*(k-1.)))
##For choked flow, At=A*
At=A1/A
print("RESULTS")
print'%s %.2f %s'% ("Mach number at throat: ",Mt,"")
print'%s %.2f %s'% ("Mass flow rate: ",m," lbm/sec")
print'%s %.2f %s'% ("Area at throat: ",At," ft^2")

choked
RESULTS
Mach number at throat:  1.00
Mass flow rate:  2.40  lbm/sec
Area at throat:  0.01  ft^2


## Ex4-pg640¶

In [3]:
import math
##Stagnation temperature(in K):
T0=350.;
##Stagnation pressure(in kPa):
p0=1000.;
##Back Pressure(in kPa):
pb=954.;
##Mach number at throat:
Mt=0.68;
##Area at exit(in m**2):
Ae=0.001;
##Value of k:
k=1.4;
##Gas Constant(in N-m/kg-K):
R=287.;
##throat##

##Temperature at the throat(in K):
Tt=T0/(1.+(k-1.)/2.*Mt**2)
##Pressure at throat(in kPa):
pt=p0*(Tt/T0)**(k/(k-1.))
##Density at throat(in kg/m**3):
dt=pt*1000./R/Tt
##Velocity at the throat(in m/s):
Vt=Mt*math.sqrt(k*R*Tt)
##Value of At/A*:
Ax=1./Mt*((1.+(k-1.)/2.*Mt**2.)/(1.+(k-1.)/2.))**((k+1.)/(2.*(k-1.)))
##Stagnation properties are constant
##As a result pressure at exit,
pe=pb;
##The Mach number at the exit is therefore given by
Me=math.sqrt(((p0/pe)**((k-1.)/k)-1.)*2./(k-1.))
##Calculating the value of Ae/A*:
Ay=1./Me*((1.+(k-1.)/2.*Me**2.)/(1.+(k-1.)/2.))**((k+1.)/(2.*(k-1.)))
##Value of A*(in m**2):
A_star=Ae/Ay
##Area at throat(in m**2):
At=Ax*A_star
print ("RESULTS")
print'%s %.2f %s'% ("Temperature at the throat: ",Tt," K")
print'%s %.2f %s'% ("Pressure at throat: ",pt," kPa")
print'%s %.2f %s'% ("Density at throat: ",dt," kg/m^3")
print'%s %.2f %s'% ("Velocity at the throat: ",Vt," m/sec")
print'%s %.2f %s'% ("Mach number at the exit: ",Me,"")
print'%s %.2f %s'% ("Area at throat: ",At," m^2")

RESULTS
Temperature at the throat:  320.37  K
Pressure at throat:  733.76  kPa
Density at throat:  7.98  kg/m^3
Velocity at the throat:  243.97  m/sec
Mach number at the exit:  0.26
Area at throat:  0.00  m^2


## Ex5-pg641¶

In [22]:
import math
##Stagnation temperature(in K):
T0=350.;
##Stagnation pressure(in kPa)\
p0=1000.;
##Pressure at exit(in kPa)
pe=87.5;
##Back Pressure(in kPa):
pb=50.;
##Area at exit(in m**2):
Ae=0.001;
##Gas Constant(in N-m/kg-K)
R=287.;
##Value of k:
k=1.4;
##number and flow##

##Mach number at the exit:
Me=math.sqrt(((p0/pe)**((k-1.)/k)-1.)*2./(k-1.))
##Temperature at exit(in K):
Te=T0/(1.+(k-1.)/2.*Me**2.)
##Mass flow rate(in kg/s):
m=pe*1000.*Me*math.sqrt(k/R/Te)*Ae
print ("RESULTS")
print'%s %.2f %s'% ("Mach number at the exit: ",Me," ")
print'%s %.2f %s'% ("Mass flow rate: ",m," kg/sec")

RESULTS
Mach number at the exit:  2.24
Mass flow rate:  1.04  kg/sec


## Ex6-pg647¶

In [5]:
import math
##Diameter of pipe(in m):
D=7.16*10**-3;
##Stagnation pressure(in kPa):
p0=101.;
##Stagnation temperature(in K):
T0=296.;
##Pressure at section 1(in kPa):
p1=98.5;
##Temperature at section 2(in K):
T2=287.;
##Gas constant(in N-m/kg-K):
R=287.;
##Value of k:
k=1.4;
##mass and volume##

##Mach umber at section 1:
M1=math.sqrt((2./(k-1.)*((p0/p1)**((k-1.)/k)-1.)))
##Temperature at section 1(in K):
T1=T0/(1.+(k-1.)/2.*M1**2)
##Density at section 1(in kg/m**3):
d1=p1*1000./R/T1
##Velocity at section1(in m/sec):
V1=M1*math.sqrt(k*R*T1)
##Area at section 1(in m**2):
A1=math.pi/4.*D**2.
##Mass flow rate(in kg/sec):
m=d1*A1*V1
##Mach number at section 2:
M2=math.sqrt((2./(k-1.))*((T0/T2)-1.))
##Velocity at section 2(in m/sec):
V2=M2*math.sqrt(k*R*T2)
##Density at section 2(in kg/m**3):
d2=d1*V1/V2
##Pressure at section 2(in kPa):
p2=d2/1000.*R*T2
##Stagnation pressure at section 2(in kPa):
p02=p2*(1.+(k-1.)/2.*M2**2.)**(k/(k-1.))
##Force exerted on control volume by duct wall(in N):
F=(p2-p1)*1000.*A1+m*(V2-V1)
print ("RESULTS")
print'%s %.4f %s'% ("Mass flow rate: ",m," kg/sec")
print'%s %.2f %s'% ("Local isentropic stagnation pressure at section 2:",p02," kPa")
print'%s %.2f %s'% ("Force exerted on control volume by duct wall:",F," N")

RESULTS
Mass flow rate:  0.0031  kg/sec
Local isentropic stagnation pressure at section 2: 51.92  kPa
Force exerted on control volume by duct wall: -1.88  N


## Ex7-pg655¶

In [23]:
import math
##Stagnation temperature(in K):
T0=296.;
##Stagnation pressure(in mm of Hg):
p0=760.;
##Gauge pressure at section 1(in mm of Hg):
p1=-18.9;
##Gauge pressure at section2(in mm of Hg):
p2=-412.;
##Mach number at 3:
M3=1.;
##Gas constant:
R=287.;
##Density of mercury(kg/m**3):
dHg=13500.;
##Acceleration due to gravity(in m/sec**2):
g=9.8;
##Friction factor:
f=0.0235;
##Diameter of tube(in m):
D=7.16*10**-3;
##Value of k:
k=1.4;
##length##

##Mach number at section 1:
M1= math.sqrt(2./(k-1.)*((p0/(p0+p1))**((k-1.)/k)-1.))
##Temperature at section 1(in K):
T1=T0/(1.+(k-1.)/2.*(M1)**2.)
V1=M1*math.sqrt(k*R*T1)
##Pressure at section 1(in kPa):
p1=g*dHg*(760.-18.9)*10**-3
##Density at section 1(in kg/m**3):
d1=p1/R/T1
##At M1=0.190,
##(p/p*)1:
P1=5.745
## (fLmax/Dh)1:
F1=16.38
##Value of L13(in m):
L13=F1*D/f
##Value of (p/p*)2:
P2=p2/p1*P1
##For this value, Value of M2 is obtained as 0.4
M2=0.4;
##For M=0.4, fLmX/D=2.309
F2=2.309
##Value of L23(in m):
L23=F2*D/f
##Length of duct between section 1 and 2(in m):
L12=L13-L23
print("RESULTS")
print'%s %.2f %s'% ("Length of duct required for choking from section 1: ",L13," m")
print'%s %.2f %s'% ("Mach number section 2: ",M2," ")
print'%s %.2f %s'% ("Length of duct between section 1 and 2: ",L12," m",)

RESULTS
Length of duct required for choking from section 1:  4.99  m
Mach number section 2:  0.40
Length of duct between section 1 and 2:  4.29  m


## Ex8-pg662¶

In [24]:
import math
##Temperature at section 1(in R):
T1=600.;
##Pressure at section 1(in psia):
p1=20.;
##Pressure at section 2(in psia):
p2=10.;
##Velocity at section 1(in ft/s):
V1=360.;
##Cross-sectional area of the duct(in ft**2):
A=0.25;
##Gas Constant(in ft-lbf/lbm-R):
R=53.3;
##Value of k:
k=1.4;
##Specific heat at constant presure(in Btu/lbm-R):
Cp=0.24;
##Specific heat at constant volume(in Btu/lbm-R):
Cv=0.171;

##velocity and entropy##

##Density at section 1(in lbm/ft**3):
d1=p1*144./R/T1
##Velocity at section 2(in ft/sec):
V2=(p1-p2)*144./d1/V1*32.2+V1
##Density at section 2(in lbm/ft3):
d2=d1*V1/V2
##Temperature at section 2(in R):
T2=p2/d2/R*144.
##Mach number at section 2:
M2=V2/math.sqrt(k*R*32.16*T2)
##Stagnation Temperature at section 2(in R):
T02=T2*(1.+(k-1.)/2.*M2**2.)
##Stagnation pressure at section 2 (in psia):
p02=p2*(T02/T2)**(k/(k-1.))
##Mach Number at section 1:
M1=V1/math.sqrt(k*R*32.16*T1)
##Stagnation temperature at section 1(in R):
T01=T1*(1.+(k-1.)/2.*M1**2.)
E=Cp*(T02-T01)
##Change in entropy(in Btu/(lbm-R)):
dS=Cp*math.log(T2/T1)-(Cp-Cv)*math.log(p2/p1)
print("RESULTS")
print'%s %.2f %s'% ("Velocity at section 2: ",V2," ft/sec")
print'%s %.2f %s'% ("Density at section 2: ",d2," lbm/ft^3")
print'%s %.2f %s'% ("Temperature at section 2: ",T2," R")
print'%s %.2f %s'% ("Stagnation Temperature at section 2: ",T02," R")
print'%s %.2f %s'% ("Stagnation pressure at section 2: ",p02," psia")
print'%s %.2f %s'% ("Energy added: ",E," Btu/lbm")
print'%s %.2f %s'% ("Change in entropy: ",dS," Btu/(lbm-R)")

RESULTS
Velocity at section 2:  1790.22  ft/sec
Density at section 2:  0.02  lbm/ft^3
Temperature at section 2:  1491.85  R
Stagnation Temperature at section 2:  1758.94  R
Stagnation pressure at section 2:  17.80  psia
Change in entropy:  0.27  Btu/(lbm-R)


## Ex9-pg666¶

In [4]:
##Temperature at section 1(in K):
import math
T1=333.;
##Pressure at section 1(in kPa):
p1=135.;
##Velocity at section 1(in m/sec):
V1=732.;
##Mach number at section 2:
M2=1.2;
##Gas constant(in N-m/kg-K):
R=287.;
##Value of k:
k=1.4;
##Specific heat at constant presure(in N-m/kg-K):
Cp=1.;
##Temperature and entropy##

##Mach nuber at section 1:
M1=V1/math.sqrt(k*R*T1)
##For these value of M1 and M2,the following values are obtained:
##(To/T0*)1:
t01=0.7934;
##(T0/T0*)2:
t02=0.9787;
##(p0/p0*)1:
P01=1.503;
##(p0/p0*)2:
P02=1.019;
##(T/T*)1:
t1=0.5289;
##(T/T*)2:
t2=0.9119;
##(p/p*)1:
P1=0.3636;
##(p/p*)2:
P2=0.7958;
##(V/V*)1:
v1=1.455;
##(V/V*)2:
v2=1.146;
##Value of T2/T1:
t=t2/t1
##Temperature at section 2(in K):
T2=t*T1
##Value of p2/p1:
p=P2/P1
##Pressure at section 2(in kPa):
p2=p*p1
##Value of V2/V1:
v=v2/v1
##Velocity at section 2(in m/sec):
V2=v*V1
##Density at section 2(in kg/m**3):
d2=p2*1000./R/T2
##At M1, T/T0=0.5556
T01=T1/0.5556
##At M2, T/T0=0.7764
T02=T2/0.7764
E=Cp*(T02-T01)
##Change in entropy(kJ/kg-K):
dS=Cp*math.log(T2/T1)-R*math.log(p2/p1)/1000.
print("RESULTS")
print'%s %.2f %s'% ("Temperature at section 2: ",T2," K")
print'%s %.2f %s'% ("Pressure at section 2:",p2," kPa")
print'%s %.2f %s'% ("Velocity at section 2: ",V2," m/sec")
print'%s %.2f %s'% ("Density at section 2: ",d2," kg/m^3")
print'%s %.2f %s'% ("Stagnation temperature at section 2: ",T02," K")
print'%s %.2f %s'% ("Heat added: ",E," kJ/kg")
print'%s %.2f %s'% ("Change in entropy: ",dS," kJ/kg")

RESULTS
Temperature at section 2:  574.14  K
Pressure at section 2: 295.47  kPa
Velocity at section 2:  576.54  m/sec
Density at section 2:  1.79  kg/m^3
Stagnation temperature at section 2:  739.49  K
Change in entropy:  0.32  kJ/kg


## Ex10-pg676¶

In [5]:
import math
##Temperature at section 1(in K):
T1=278.;
##Pressure at section 1(in kPa):
p1=65.;
##Velocity at section 1(in m/sec):
V1=668.;
##Value of gas constant(in N-m/kg-K):
R=287.;
##Value of k:
k=1.4;
##Temperature##
##Density at section 1(in kg/m**3):
d1=p1*1000./R/T1
##Mach number at section 1:
M1=V1/math.sqrt(k*R*T1)
##Stagnation temperature at section 1(in K):
T01=T1*(1.+(k-1.)/2.*M1**2.)
##Stagnation pressure at section 1(in kPa):
p01=p1*(1.+(k-1.)/2.*M1**2.)**(k/(k-1.))
##The following values are obtained from the appendix:
##po2/p01:
p0=0.7209;
##T2/T1:
T=1.687;
##p2/p1:
p=4.5;
##V2/V1:
V=0.3750;
##Temperature at section 2 (in K):
T2=T*T1
##Pressure at section 2(in kPa):
p2=p*p1
##Velocity at section 2(in m/sec):
V2=V*V1
##Density at section 2 (in kg/m**3):
d2=p2*1000./R/T2
##Stagnation pressure at section 2(in kPa):
p02=p0*p01
##Stagnation temperature at section 2(in K):
T02=T01;
##Change in entropy(in kJ/(kg-K)):
dS=-R/1000.*math.log(p0)
print ("RESULTS")
print'%s %.2f %s'% ("Temperature at section 2 : ",T2," K")
print'%s %.2f %s'% ("Pressure at section 2: ",p2," kPa")
print'%s %.2f %s'% ("Velocity at section 2: ",V2," m/sec")
print'%s %.2f %s'% ("Density at section 2 : ",d2," kg/m^3")
print'%s %.2f %s'% ("Stagnation pressure at section 2: ",p02," kPa")
print'%s %.2f %s'% ("Change in entropy: ",dS," kg-K")
print'%s %.2f %s'% ("Stagnation temperature at section 2: ",T02," K")

RESULTS
Temperature at section 2 :  468.99  K
Pressure at section 2:  292.50  kPa
Velocity at section 2:  250.50  m/sec
Density at section 2 :  2.17  kg/m^3
Stagnation pressure at section 2:  365.91  kPa
Change in entropy:  0.09  kg-K
Stagnation temperature at section 2:  500.11  K