In [1]:

```
from __future__ import division
import math
#Initialization of Variable
V = 10 #ft/s
A = 0.06 #ft2
p = 1.94 #slug/ft3
#calculations:
Fax = -1*p*A*V**2
Fay = p*A*V**2
#Results
print "resultant force in x direction is", round(Fax,2),"(1-cos(theta)) lbf"
print "resultant force in y direction is", round(Fay,2),"sin(theta) lbf"
```

In [2]:

```
from __future__ import division
import math
# Initialization of Variable
p = 1.94 #slug/ft3
P1 = 30 #psi
V = 50 #ft/s
P2 = 24 #psi
A = 0.1 #ft2
theta = 180 #deg
#calcualtions:
#force in x dirn
Fax = 0
#mass flow rate
mdot = p*A*V
#force in y dirn
Fay = -2*mdot*V - (P1 + P2)*144*A
#Results
print "resultant force in x direction is", Fax,"lbf"
print "resultant force in y direction is", round(Fay,0),"lbf"
```

In [3]:

```
from __future__ import division
import math
# Initialization of Variable
D1 = 16 #mm
Q = 0.6 #lt/s
Wn = 1 #N
Ww = 0.03 #N
D2 = 5 #mm
P1 = 464 #kPa
P2 = 0 #kPa
p = 999 #kg/m3
#calculations:
#mass flow rate
mdot = p*Q/1000
#areas
A1 = math.pi*1E-6*(D1**2)/4
A2 = math.pi*1E-6*(D2**2)/4
#volumetric flow rate
V1 = Q*1E-3/A1
V2 = Q*1E-3/A2
Fa = mdot*(V1 - V2) + Wn + Ww + P1*1000*A1 - P2*A2
#Results
print "anchoring force is",round(Fa,1),"N"
```

In [4]:

```
from __future__ import division
import math
# Initialization of Variable
l = 6 #m
D = 0.1 #m
P1_r = 3 #m
P2_r = 0.5 #m
z1 = 0 #m
z2 = 2 #m
#calculations:
hL = P1_r - P2_r + z1 - z2
#Results
print "head loss in terms of height of water is", hL, "m"
```

In [5]:

```
from __future__ import division
import math
# Initialization of Variable
z1 = 100 #m
V2 = 6 #m/s
g = 9.81 #m/s2
r = 9.8E3 #N/m3
D = 1 #m
#calculations:
#Volumetric flow rate
Q = math.pi*D**2*V2/4
hL = 0 #no head loss
#turbine head
ht = z1 - (V2**2)/(2*g) - hL
#power output
Wtdot = r*Q*ht/1000
#Results
print "max power output is", round(Wtdot,0),"kW"
```

In [6]:

```
from __future__ import division
import math
# Initialization of Variable
Wpdot = 10 #hp
r = 62.4 #lbf/ft3
Q = 2 #ft3/s
z2 = 30 #ft
z1 = 0
#calculations:
#pump head
hp = Wpdot*550/(r*Q)
#head Loss
hL = z1 - z2 + hp
#on a power basis, the head loss
hLp = r*Q*hL/550
#Results
print "head loss is", round(hL,1),"ft or", round(hLp,2),"hp"
```

In [7]:

```
from __future__ import division
import math
# Initialization of Variable
A2 = 0.001 #m2
P1 = 1 #Mpa
P0 = 1 #Mpa
T1 = 360 #K
T0 = 360 #K
k = 1.4
Pb1 = 500 #kPa
Pb2 = 784 #kPa
V1 = 0
R = 8314/28.97 #J/kg-K
#calculations:
Pcr = 0.528*P0*1000
if Pb1 < Pcr:
M1 = 1
#exit Temp
T2 = T0/(1 + (k - 1)*M1**2/2)
#exit Velocity
V2 = M1*(k*R*T2)**0.5
#mass flow rate
mdot1 = Pcr*1000*A2*V2/(R*T2)
#Mach at 2
M2 = (2/(k - 1)*((P0*1E6/(Pb2*1E3))**((k-1)/k) - 1))**0.5
#exit Temp
T2 = T0/(1 + (k - 1)*M2**2/2)
#exit Velocity
V2 = M2*(k*R*T2)**0.5
#mass flow rate
mdot2 = Pb2*1000*A2*V2/(R*T2)
#Results
print "the mass flow rate and exit mach no at back pressure of 500 kPa are",round(mdot1,2),"kg/s and", M1
print "the mass flow rate and exit mach no at back pressure of 784 kPa are",round(mdot2,2),"kg/s and", round(M2,1)
```

In [8]:

```
from __future__ import division
import math
# Initialization of Variable
A2 = 2.4 #in2
P1 = 100 #lbf/in2
P0 = 100 #lbf/in2
T1 = 500 #degR
T0 = 500 #degR
At = 1 #in2
k = 1.4
V1 = 0
R = 1548/28.97 #ft.lbf/lb-degR
#calculations:
#a)
#mach at throat
Mta = 0.7
#From Table 12.2
#At/A* = At_As
At_Asa = 1.09437
A2_Asa = A2*At_Asa/At
#from Table 12.2
M2a = 0.24
T2_T0a = 0.988
P2_P0a = 0.959
T2a = T0*T2_T0a
P2a = P0*P2_P0a
#velocity at exit
V2a = M2a*(k*R*T2a*32.2)**0.5
#mass flow rate
mdota = P2a*A2*V2a/(R*T2a)
#b)
#from Table 12.2
M2b = 0.26
T2_T0b = 0.986
P2_P0b = 0.953
T2b = T0*T2_T0b
P2b = P0*P2_P0b
#velocity at exit
V2b = M2b*(k*R*T2b*32.2)**0.5
#mass flow rate
mdotb = P2b*A2*V2b/(R*T2b)
#c)
#from Table 12.2
M2c = 2.4
P2_P0c = 0.0684
P2c = P0*P2_P0c
#mass flow rate (nozzle is choked same as b)
mdotc = mdotb
#d)
#from Table 12.2
Mxd = 2.4
Pxd = 6.84 #lbf/in2
Myd = 0.52
M2d = Myd
Pyd = 6.5533*Pxd
P2d = Pyd
#mass flow rate (nozzle is choked same as b)
mdotd = mdotb
#e)
Ax = 2 #in2
Axs = At
#from table 12.2
Ax_Axs = 2 #Ax/Ax*
Mxe = 2.2
#Poy/Pox
Poy_Pox = 0.62812
#A2/Ay*
A2_Ays = (A2/Axs)*Poy_Pox
M2e = 0.43
#P2/Poy
P2_Poy = 0.88
Pox = P0
P2e = P2_Poy*Poy_Pox*Pox
#mass flow rate (nozzle is choked same as b)
mdote = mdotb
#Results
print "a)the mass flow rate is",round(mdota,2),"lb/s or", round(mdota/32.1740,4),"slug/s, exit pressure is",round(P2a,1),"lbf/in2 and exit mach number is",M2a
print "b)the mass flow rate is",round(mdotb,2),"lb/s or", round(mdotb/32.1740,4),"slug/s, exit pressure is",round(P2b,1),"lbf/in2 and exit mach number is",M2b
print "c)the mass flow rate is",round(mdotc,2),"lb/s or", round(mdotc/32.1740,4),"slug/s, exit pressure is",round(P2c,2),"lbf/in2 and exit mach number is",M2c
print "d)the mass flow rate is",round(mdotd,2),"lb/s or", round(mdotd/32.1740,4),"slug/s, exit pressure is",round(P2d,2),"lbf/in2 and exit mach number is",M2d
print "e)the mass flow rate is",round(mdote,2),"lb/s or", round(mdote/32.1740,4),"slug/s, exit pressure is",round(P2e,1),"lbf/in2 and exit mach number is",M2e
```