In [1]:

```
#pg 361
print('Example 12.1');
# aim : To determine the
# (a) throat area
# (b) exit area
# (c) Mach number at exit
from math import sqrt
# Given values
P1 = 3.5;# inlet pressure of air, [MN/m**2]
T1 = 273+500;# inlet temperature of air, [MN/m**2]
P2 = .7;# exit pressure, [MN/m**2]
m_dot = 1.3;# flow rate of air, [kg/s]
Gamma = 1.4;# heat capacity ratio
R = .287;# [kJ/kg K]
# solution
# given expansion may be considered to be adiabatic and to follow the law PV**Gamma=constant
# using ideal gas law
v1 = R*T1/P1*10**-3;# [m**3/kg]
Pt = P1*(2/(Gamma+1))**(Gamma/(Gamma-1));# critical pressure, [MN/m**2]
# velocity at throat is
Ct = sqrt(2*Gamma/(Gamma-1)*P1*10**6*v1*(1-(Pt/P1)**(((Gamma-1)/Gamma))));# [m/s]
vt = v1*(P1/Pt)**(1/Gamma);# [m**3/kg]
# using m_dot/At=Ct/vt
At = m_dot*vt/Ct*10**6;# throat area, [mm**2]
print ' (a) The throat area is (mm^2) = ',round(At)
# (b)
# at exit
C2 = sqrt(2*Gamma/(Gamma-1)*P1*10**6*v1*(1-(P2/P1)**(((Gamma-1)/Gamma))));# [m/s]
v2 = v1*(P1/P2)**(1/Gamma);# [m**3/kg]
A2 = m_dot*v2/C2*10**6;# exit area, [mm**2]
print ' (b) The exit area is (mm^2) = ',round(A2)
# (c)
M = C2/Ct;
print ' (c) The Mach number at exit is = ',round(M,2)
# End
```

In [1]:

```
#pg 362
print('Example 12.2');
# aim : To determine the increases in pressure, temperature and internal energy per kg of air
# Given values
T1 = 273.;# [K]
P1 = 140.;# [kN/m**2]
C1 = 900.;# [m/s]
C2 = 300.;# [m/s]
cp = 1.006;# [kJ/kg K]
cv =.717;# [kJ/kg K]
# solution
R = cp-cv;# [kJ/kg K]
Gamma = cp/cv;# heat capacity ratio
# for frictionless adiabatic flow, (C2**2-C1**2)/2=Gamma/(Gamma-1)*R*(T1-T2)
T2 =T1-((C2**2-C1**2)*(Gamma-1)/(2*Gamma*R))*10**-3; # [K]
T_inc = T2-T1;# increase in temperature [K]
P2 = P1*(T2/T1)**(Gamma/(Gamma-1));# [MN/m**2]
P_inc = (P2-P1)*10**-3;# increase in pressure,[MN/m**2]
U_inc = cv*(T2-T1);# Increase in internal energy per kg,[kJ/kg]
#results
print ' The increase in pressure is (MN/m^2) = ',round(P_inc,2)
print ' Increase in temperature is (K) = ',round(T_inc)
print ' Increase in internal energy is (kJ/kg) = ',round(U_inc)
print 'there is minor variation in result due to rounding off error'
# End
```

In [3]:

```
#pg 364
print('Example 12.3');
from math import sqrt
# aim : To determine the
# (a) throat and exit areas
# (b) degree of undercooling at exit
# Given values
P1 = 2.;# inlet pressure of air, [MN/m**2]
T1 = 273.+325;# inlet temperature of air, [MN/m**2]
P2 = .36;# exit pressure, [MN/m**2]
m_dot = 7.5;# flow rate of air, [kg/s]
n = 1.3;# polytropic index
# solution
# (a)
# using steam table
v1 = .132;# [m**3/kg]
# given expansion following law PV**n=constant
Pt = P1*(2/(n+1))**(n/(n-1));# critical pressure, [MN/m**2]
#velocity at throat is
Ct = sqrt(2*n/(n-1)*P1*10**6*v1*(1-(Pt/P1)**(((n-1)/n))));# [m/s]
vt = v1*(P1/Pt)**(1/n);# [m**3/kg]
# using m_dot/At=Ct/vt
At = m_dot*vt/Ct*10**6;# throat area, [mm**2]
print ' (a) The throat area is (mm^2) = ',round(At)
# at exit
C2 = sqrt(2*n/(n-1)*P1*10**6*v1*(1-(P2/P1)**(((n-1)/n))));# [m/s]
v2 = v1*(P1/P2)**(1/n);# [m**3/kg]
A2 = m_dot*v2/C2*10**6;# exit area, [mm**2]
print ' The exit area is (mm^2) = ',round(A2)
# (b)
T2 = T1*(P2/P1)**((n-1)/n);#outlet temperature, [K]
t2 = T2-273;#[C]
# at exit pressure saturation temperature is
ts = 139.9;# saturation temperature,[C]
Doc = ts-t2;# Degree of undercooling,[C]
print ' (b) The Degree of undercooling at exit is (C) = ',round(Doc,1)
print' There is some rounding mistake in the book so answer is not matching'
# End
```

In [4]:

```
#pg 365
print('Example 12.4');
from math import sqrt
# aim : To determine the
# (a) throat and exit velocities
# (b) throat and exit areas
# Given values
P1 = 2.2;# inlet pressure, [MN/m^2]
T1 = 273+260;# inlet temperature, [K]
P2 = .4;# exit pressure,[MN/m^2]
eff = .85;# efficiency of the nozzle after throat
m_dot = 11;# steam flow rate in the nozzle, [kg/s]
# solution
# (a)
# assuming steam is following same law as previous question 12.3
Pt = .546*P1;# critical pressure,[MN/m^2]
# from Fig. 12.6
h1 = 2940;# [kJ/kg]
ht = 2790;# [kJ/kg]
Ct = sqrt(2*(h1-ht)*10**3);# [m/s]
# again from Fig. 12.6
h2_prime = 2590;# [kJ/kg]
# using eff = (ht-h2)/(ht-h2_prime)
h2 = ht-eff*(ht-h2_prime); # [kJ/kg]
C2 = sqrt(2*(h1-h2)*10**3);# [m/s]
# (b)
# from chart
vt = .16;# [m^3/kg]
v2 = .44;# [m^3/kg]
# using m_dot*v=A*C
At = m_dot*vt/Ct*10**6;# throat area, [mm^2]
A2 = m_dot*v2/C2*10**6;# throat area, [mm^2]
#results
print ' (a) The throat velocity is (m/s) = ',round(Ct)
print ' The exit velocity is (m/s) = ',C2
print ' (b) The throat area is (mm^2) = ',round(At)
print ' The throat area is (mm^2) = ',A2
# End
```