In [1]:

```
# Example 11.1
from math import *
from __future__ import division
# Given
T1 = 273 + 15 # temperature in K
T2 = 273 + 90 # temperature in K
Cp = 0.24 # cp for air in kcal/kgK
# Solution
dh = Cp*(T2-T1) # enthalpy per kg of air
H = 10*dh # total enthallpy of 10 kg air
print "Total change in enthalpy for 10 kg air = ",round(H,0),"kcal"
```

In [3]:

```
# Example 11.2
from math import *
from __future__ import division
# Given
T1 = 273 + 15 # temperature in K
T2 = 273 + 90 # temperature in K
P1 = 40 + 101.3 # pressure in abs
P2 = 360 + 101.3 # presure in abs
Cv = 0.171 # Specific volume Coefficient of air
k = 1.4 # gas constant
# solution
dS = Cv*log((T2/T1)**k*(P2/P1)**(1-k))
S = 10*dS
print "Total change in enthalpy of 10 Kg of air =",round(S,3),"kcal/K"
```

In [4]:

```
# Example 11.3
from math import *
from __future__ import division
P1 = 10 # pressure in psia
P2 = 30 # pressure in psia
T1 = 460+110 # temperature in R
k =1.4 # gas constant
T2 = T1*(P2/P1)**((k-1)/k)
t2 = T2-460 # final temperature of air
print "Final temperature if air = ",round(t2,1),"F"
Cv = 0.157 # coefficient of air
W = Cv*(T2-T1) # work done per unit mass of oxygen
Tw = 10*W # total work done on 10 slugs
print "Total work done on 10 slugs = ",round(Tw,0),"Btu"
```

In [5]:

```
# Example 11.4
from math import *
from __future__ import division
# Given
# for water
S =1 # specific gravity
rho = S*1000 # density in kg/m**3
bta = 2.2*10**9 # Bulk modulus of elasticity
# ethly alcohol
S1 =0.79 # specific gravity
rho2 = S1*1000 # density in kg/m**3
bta2 = 1.21*10**9 # Bulk modulus of elasticity
# for air
k = 1.4 # gas constant for air
R = 287 # universal gas constant
T = 273+20 # temperature in K
# Solution
C1 = sqrt(bta/rho)
C2 = sqrt(bta2/rho2)
print "Speed of sound in water =",round(C1,0),"m/s"
print "Speed of sound in ethly alcohol =",round(C2,0),"m/s"
C3 = sqrt(k*R*T)
print "Speed of sound in Air =",round(C3,0),"m/s"
```

In [6]:

```
# Example 11.5
from math import *
from __future__ import division
# Given
P1 = 1.5 # pressure in psia
T1 = 40 + 460 # temperature in R
k = 1.4 # gas constant
R = 1716 # universal gas constant in ft.lb/slug R
V1 = 1500 # velocity in ft/s
# Solution
c1 = sqrt(k*R*T1)
M1 = V1/c1
M2 = sqrt((2+(k-1)*M1**2)/(2*k*M1**2-(k-1)))
print M2
P2 = P1*((1+k*M1**2)/(1+k*M2**2))
print "Pressure at downstream = ",round(P2,2),"psia"
T2 = T1*((1+0.5*(k-1)*M1**2)/(1+0.5*(k-1)*M2**2))
t2 = T2-460
print "Temperature at downstream = ",round(t2,1),"F"
V2 = M2*sqrt(k*R*t2)
print "Velocity downstream = ",round(V2,2),"ft/s"
```

In [ ]:

```
```