# Chapter 17: Compressible Flow¶

## Example 17-1 ,Page No.826¶

In [5]:
#given data
V1=250.0;#velocity of aircraft in m/s
T1=255.07;#ambient air temperature in K
P1=54.05;#atmospheric pressure in kPa
h=5000.0;#altitude in m

#from Table A-2a
cp=1.005;#in kJ/kg-K
k=1.4;

#calculations
T01=T1+V1**2/(2*cp*1000);#factor of 1000 to convert kJ to J
P01=P1*(T01/T1)**(k/(k-1));
#given pressure ratio in compressor *
# T02 = T01*(P02/P01)^((k-1)/k)
T02 = T01*(8)**((k-1)/k);
win=cp*(T02-T01);
print'the stagnation pressure at the compressor inlet %f kPa'%round(P01,2);
print'the required compressor work per unit mass %f kJ/kg'%round(win,1)

the stagnation pressure at the compressor inlet 80.840000 kPa
the required compressor work per unit mass 233.400000 kJ/kg


## Example 17-2 ,Page No.829¶

In [7]:
from math import sqrt

#given data
V=200.0;#air velocity in m/s
T=30+273.0;#air temperature in K

#from Table A-2a
R=0.287;#in kJ/kg-K
k=1.4;

#calculations
c=sqrt(k*R*T*1000);#factor of 1000 to convert kJ to J
print'the speed of sound %i m/s'%round(c);
Ma=V/c;
print'the Mach number at the diffuser inlet is %f'%round(Ma,3)

the speed of sound 349 m/s
the Mach number at the diffuser inlet is 0.573000


## Example 17-3 ,Page No.829¶

In [10]:
from math import sqrt

#given data
T0=200+273.0;#intial temperature in K
P0=1400.0;#intial pressure in kPa
#stagnant temp. & pressure is same as inlet due to small inlet velocity
P=1200.0;#pressure corresponding to a pressure drop of 200 kPa
m=3.0;#mass flow rate in kg/s

#from Table A-2a
cp=0.846;#in kJ/kg-K
R=0.1889;#in kJ/kg-K
k=1.289;

#calculations
T=T0*(P/P0)**((k-1)/k);
V=sqrt(2*cp*(T0-T)*1000);#factor of 1000 to convert kJ to J
p=P/(R*T);
A=m/(p*V);
c=sqrt(k*R*T*1000);#factor of 1000 to convert kJ to J
Ma=V/c;
print'velocity %f m/s'%round(V,1);
print'density %f kg/m^3'%round(p,1);
print'flow area %f cm^2'%round((A*10000),1);
print'Mach number is %f'%round(Ma,3);

velocity 164.900000 m/s
density 13.900000 kg/m^3
flow area 13.100000 cm^2
Mach number is 0.494000


## Example 17-4 ,Page No.836¶

In [12]:
#given data
T0=200+273.0;#intial temperature in K
P0=1400.0;#intial pressure in kPa

#from Table A-2a
k=1.289;

#calculations
#Tc & Tr stands for critical temp and ratio respectively
#Pc & Pr stands for critical temp and ratio respectively
Tr=2/(k+1);
Pr=(2/(k+1))**(k/(k-1));
Tc=Tr*T0;
Pc=Pr*P0;
print'critical temperature %i K'%round(Tc);
print'critical pressure %i kPa'%round(Pc)

critical temperature 413 K
critical pressure 767 kPa


## Example 17-5 ,Page No.839¶

In [14]:
from math import sqrt

#given data
Vi=150.0;#air velocity in m/s
Ti=600+273.0;#air temperature in K
Pi=1.0;#air pressure in MPa
At=50.0/10000.0;#nozzle throat area in m^2

#from Table A-2a
R=0.287;#in kJ/kg-K
cp=1.005;#in kJ/kg-K
k=1.4;

#calculations
Toi=Ti+Vi**2/(2*cp*1000);#factor of 1000 to convert kJ to J
Poi=Pi*(Toi/Ti)**(k/(k-1));
#flow is isentropic
#stagnation temp. and pressure values remain constant
To=Toi;
Po=Poi;
#from Table 17–2
#The critical-pressure ratio is 0.5283

#Part a
Pb=0.7;
Pca=Pb/Po;
# Pca > 0.5283
#exit plane pressure is equal to the back pressure
Pt=Pb;
#from Table A–32
Mat=0.778;
#Tt/To = 0.892
Tt=0.892*To;
pt=Pt*1000/(R*Tt);#factor of 1000 to convert MPa to kPa
Vt=Mat*sqrt(k*R*Tt*1000);#factor of 1000 to convert kJ to J
ma=pt*At*Vt;
print'the mass flow rate through the nozzle when the back pressure is 0.7 MPa %f kg/s'%round(ma,2);

#Part b
Pb=0.4;
Pca=Pb/Po;
# Pca < 0.5283
#sonic conditions exists at the exit
Ma=1;
mb=At*(Po*1000)*(sqrt(k*1000/(R*To)))*(2/(k+1))**((k+1)/(2*(k-1)));#factor of 1000 to convert MPa to kPa and kJ to J
print'the mass flow rate through the nozzle when the back pressure is 0.4 MPa %f kg/s'%round(mb,2);

the mass flow rate through the nozzle when the back pressure is 0.7 MPa 6.770000 kg/s
the mass flow rate through the nozzle when the back pressure is 0.4 MPa 7.110000 kg/s


## Example 17-6 ,Page No.840¶

In [16]:
#given data
T1=400;#intial temperature in K
P1=100;#intial pressure in kPa
Ma1=0.3;#intial mach no
A21=0.8;#A2/A1 as flow area has been reduced by 20 percent

#assumption
k=1.4;

#from Table A–32
#at Ma1=0.3
#s stands for * symbol
A1s = 2.0351;#A1/As
T10 = 0.9823;#T1/T0
P10 = 0.9305;#P1/P0
A2s = A21*A1s;#A2/As
#at this value of A2/As
T20=0.9701;#T2/T0
P20=0.8993;#P2/P0
Ma2=0.391;

#calculations
T2=T1*T20/T10;
P2=P1*P20/P10;
print'Ma2 is %f'%round(Ma2,3);
print'T2 %i K is'%round(T2);
print'P2 %f kPa is'%round(P2,1)

Ma2 is 0.391000
T2 395 K is
P2 96.600000 kPa is


## Example 17-7 ,Page No.844¶

In [20]:
#given data
T0=800;#intial temperature in K
P0=1;#intial pressure in MPa
Vi=0;#negligible intial velcity
At=20;#throat area in cm^2
Mae=2;#exit Mach number

#from Table A-2a
R=0.287;#in kJ/kg-K
k=1.4;

#calculations

#part - a
# Mach no. at exit is 2 hence sonic conditions at throat
p0=P0*1000/(R*T0);#factor of 1000 to convert MPa to kPa
#from Table A-32 at Mat=1
#s stands for * symbol
Ps0 = 0.5283;#Ts/T0
Ts0 = 0.8333;#Ps/P0
ps0=0.6339;#ps/p0
Ps=Ps0*P0;
Ts=Ts0*T0;
ps=ps0*p0;
As=At;
Vs=sqrt(k*R*Ts*1000);#factor of 1000 to convert kJ to J
print('the throat conditions');
print'Presssure %f MPa'%round(Ps,4);
print'Temperature %f K'%round(Ts,1);
print'density %f kg/m^3'%round(ps,3);
print'area %f cm^2'%round(As);
print'velocity %f m/s'%round(Vs,1);

#part - b
#from Table A-32
#at Mae=2
Te0 = 0.5556;#Te/T0
Pe0 = 0.1278;#Pe/P0
pe0= 0.2300;#pe/p0
Ae0= 1.6875;#Ae/Ao
Pe=Pe0*P0;
Te=Te0*T0;
pe=pe0*p0;
Ae=Ae0*At;
Ve=Mae*sqrt(k*R*Te*1000);#factor of 1000 to convert kJ to J
print('the exit plane conditions, including the exit area');
print'Presssure %f MPa'%round(Pe,4);
print'Temperature %f K'%round(Te,1);
print'density %f kg/m^3'%round(pe,3);
print'area %f cm^2'%round(Ae,2);
print'velocity %f m/s'%round(Ve,1);
#part - c
m=ps*As*Vs/10000;#factor of 10000 to convert cm^2 to m^2
print'the mass flow rate through the nozzle %f kg/s'%round(m,2);

the throat conditions
Presssure 0.528300 MPa
Temperature 666.600000 K
density 2.761000 kg/m^3
area 20.000000 cm^2
velocity 517.500000 m/s
the exit plane conditions, including the exit area
Presssure 0.127800 MPa
Temperature 444.500000 K
density 1.002000 kg/m^3
area 33.750000 cm^2
velocity 845.200000 m/s
the mass flow rate through the nozzle 2.860000 kg/s


## Example 17-9 ,Page No.850¶

In [22]:
from math import log,sqrt

#data from Ex - 17.7
m=2.86;
Ma1=2;
P01=1;
P1=0.1278;
T1=444.5;
p1=1.002;

#from Table A-2a
R=0.287;#in kJ/kg-K
cp=1.005;#in kJ/kg-K
k=1.4;

#calculations

#part - a
#from Table A-33 at Ma1=2.0
Ma2=0.5774;
P0201=0.7209;#P02/P01
P21=4.5;#P2/P1;
T21=1.6875;#T2/T1
p21=2.6667;#p2/p1
P02=P0201*P01;
P2=P21*P1;
T2=T21*T1;
p2=p21*p1;
print'the stagnation pressure %f MPa'%round(P02,3);
print'the static pressure %f MPa'%round(P2,3);
print'static temperature %f K'%round(T2);
print'static density %f kg/m^3'%round(p2,2);

#part - b
#s21 = s2 - s1
s21=cp*log(T2/T1)-R*log(P2/P1);
print'the entropy change across the shock %fkJ/kg-K'%round(s21,4);

#part - c
V2=Ma2*sqrt(k*R*T2*1000);#factor of 1000 to convert kJ to J
print'the exit velocity %f m/s'%round(V2);

#part - d
print('flow rate is not affected by presence of shock waves amd remains 2.86 kg/sec')

the stagnation pressure 0.721000 MPa
the static pressure 0.575000 MPa
static temperature 750.000000 K
static density 2.670000 kg/m^3
the entropy change across the shock 0.094200kJ/kg-K
the exit velocity 317.000000 m/s
flow rate is not affected by presence of shock waves amd remains 2.86 kg/sec


## Example 17-10 ,Page No.858¶

In [27]:
from math import sin,pi

#given data
#using protactor frpm Fig 17-36
u=19;#u stands for angle of the mach lines

#calculations
#by Eq. 17-47
#i.e u= asin(1/Ma)
print'The Mach number is %f'%round(Ma,2)

The Mach number is 3.070000


## Example 17-11 ,Page No.858¶

In [35]:
from math import sin,pi

#given data
Ma1=2;#Supersonic air mach no
P1=75;#Supersonic air at pressure in kPa
O=10*pi/180;#converting to radians & angle b/w shock wave and normal

#constants used
k=1.4;

#calcualtions
#with given values of Ma1 and O from Eq 17-46
#Weak shock
Ma1w=Ma1*sin(Bweak);
#Strong shock
Ma1s=Ma1*sin(Bstrong);
#from second part Eq 17-40
Ma2w=0.8032;
Ma2s=0.5794;
#pressure ratio = (2*k*Ma^2 - k + 1)/(k + 1 )
#Weak shock
P2w=P1*(2*k*Ma1w**2 - k + 1)/(k + 1 );
print'pressure for weak shock %i kPa'%round(P2w);
#Strong shock
P2s=P1*(2*k*Ma1s**2 - k + 1)/(k + 1 );
print'pressure for strong shock %i kPa'%round(P2s);
#Weak shock
Ma2=Ma2w/sin(Bweak-O);
print'Mach number downstream for weak shock is %f'%round(Ma2,2);
#Strong shock
Ma2=Ma2s/sin(Bstrong-O);
print'Mach number downstream for strong shock is %f'%round(Ma2,3);

pressure for weak shock 128 kPa
pressure for strong shock 333 kPa
Mach number downstream for weak shock is 1.640000
Mach number downstream for strong shock is 0.604000


# Example 17-12 ,Page No.859¶

In [37]:
from math import sqrt,pi,atan

#given data
Ma1=2;#Supersonic air mach no
P1=230;#Supersonic air pressure in kPa
O=10*pi/180;#converting to radians & O stands for angle of the mach lines

#constants used
k=1.4;

#calculations
#Eq. 17–49 for the upstream Prandtl–Meyer function
#Eq. 17–48 to calculate the downstream Prandtl–Meyer function
vMa2=O+vMa1;
#using equation solver as implict nature of Eq 17-49
Ma2=2.385;
print'downstream Mach number Ma2 is %f'%round(Ma2,3);
#P2 = (P2/P0)/(P1/P0) * P1
P2= (1 + (k-1)*Ma2**2/2 )**(-k/(k-1)) / (1 + (k-1)*Ma1**2/2 )**(-k/(k-1)) * P1;
print'downstream pressure %i kPa'%round(P2)

downstream Mach number Ma2 is 2.385000
downstream pressure 126 kPa


## Example 17-15 ,Page No.868¶

In [41]:
from math import pi,sqrt

#given data
P1=480.0;#intial pressure in kPa
T1=550.0;#intial temperature in K
V1=80.0;#intial velocity in m/s
d1=15.0/100.0;#diameter in m
AF=40.0;#air to fuel ratio
HV=40000.0;#heating value in kJ/kg

#from Table A-2a
R=0.287;#in kJ/kg-K
cp=1.005;#in kJ/kg-K
k=1.4;

#calculations
p1=P1/(R*T1);
A1=pi*d1**2/4;
mair=p1*A1*V1;
mfuel=mair/AF;
Q=mfuel*HV;
q=Q/mair;
T01=T1+V1**2/(2*cp);
c1=sqrt(k*R*T1*1000);#factor of 1000 to convert kJ to J
Ma1=V1/c1;
#exit stagnation energy equation q= Cp (T02 - T01)
T02=T01+q/cp;
#from Table A–34
#at Ma1
#s stands for * symbol
T0s=0.1291;#T0/Ts
Ts0=T01/T0s;
T2s=T02/Ts0;#T02/T*0
#from Table A–34 at this ratio
Ma2=0.3142;
#Rayleigh flow relations corresponding to the inlet and exit Mach no
#at Ma1
T1s=0.1541;#T1/Ts
P1s=2.3065;#P1/Ps
V1s=0.0668;#V1/Vs
#at Ma2
T2s=0.4389;#T2/Ts
P2s=2.1086;#P2/Ps
V2s=0.2082;#V2/Vs
T2=T2s/T1s*T1;
P2=P2s/P1s*P1;
V2=V2s/V1s*V1;
print'Mach Number at exit is %f'%round(Ma2,4);
print'Presssure %i MPa'%round(P2);
print'Temperature %i K'%round(T2);
print'velocity %i m/s'%round(V2);

Mach Number at exit is 0.314200
Presssure 439 MPa
Temperature 1566 K
velocity 249 m/s


## Example 17-16 ,Page No.870¶

In [44]:
from math import sqrt

#given data
P01=2000;#entry pressure in kPa
T1=400;#entry temperature in C
V1=0;#negligible velocity at entry
nN=0.93;#overall nozzle efficiency
m=2.5;#mass flow rate in kg/s
P2=300;#exit pressure in kPa

#calculations

#part - a
P201=P2/P01;
#critical pressure ratio at this values is 0.546
Pt=0.546*P01;
#at inlet
h1=3248.4;
h01=h1;
s1=7.1292;
#at throat
st=s1;
ht=3076.8;
vt=0.24196;
Vt=sqrt(2*(h01-ht)*1000);#factor of 1000 to convert kJ to J
At=m*vt/Vt;
#at state 2s
s2s=s1;
h2s=2783.6;
#nN = (h01 - h2)/ (h01 - h2s)
h2=h01-nN*(h01-h2s);
#at P2 and h2
v2=0.67723;
s2=7.2019;
V2=sqrt(2*(h01-h2)*1000);#factor of 1000 to convert kJ to J
A2=m*v2/V2;
print'throat area %f cm^2'%round((At*10000),2);
print'exit area %f cm^2'%round((A2*10000),2);

#part - b
# at st=7.1292
#pressures of 1.115 and 1.065 MPa
#c calculated using tables
c=sqrt((1115-1065)/(1/0.23776 - 1/0.24633)*1000);#factor of 1000 to convert kPa to Pa
Ma=Vt/c;
print'the Mach number at the throat is %f'%round(Ma,2);
# at s2=7.2019
#pressures of 325 and 275 kPa
c=sqrt((325-276)/(1/0.63596 - 1/0.72245)*1000);#factor of 1000 to convert kPa to Pa
Ma=V2/c;
print'the Mach number at the nozzle exit is %f'%round(Ma,2)

throat area 10.330000 cm^2
exit area 18.210000 cm^2
the Mach number at the throat is 1.000000
the Mach number at the nozzle exit is 1.820000