#(a)Find the exit area of a reversible nozzle to pass 1 lb/sec of steam if the
#inlet state of steam is 100 psia, 500F and 100 fps velocity and the exit pressure
#is 10 psia. (b) Will the nozzle be convering or divering and if the latter, what
#will be the throat area?
import math
#initialisation of variables
h1=1279.1 #Btu/lb
s1=1.7085 #Btu/lb R
p1= 100 #psia
p2=10 #psia
h2=1091.7 #Btu/lb
s2=s1
V1=100 #fps
v2=36.41 #cu ft/lb
w=1 #lb/sec
#Calculations
a2=w*v2/(math.sqrt(V1*V1 + 2*24956.243*(h1-h2))) #Exit area
print '%s %.5f' %('Exit area (sq. ft) = ',a2)
pt=0.55*p1 #Thorat pressure
ht=1221.5 #Btu/lb
vt=8.841 #cu ft/lb
at=w*vt/(math.sqrt(V1*V1 + 2*24956.243*(h1-ht))) #Exit area in case 2
print '%s %.5f' %('\n Exit area in case 2 (sq. ft) = ',at)
raw_input('press enter key to exit')
#Find the throat and exit areas for a nozzle to pass 10000 of steam from an initial
#state of 250 psia, 500F to a final pressure 1 psia, vel coeff. 0.949 and the
#discharge coeff. is unity. Find the exit jet velocity
#initialisation of variables
import math
w=10000. #lb/hr
p0=250. #psia
T1=500. #F
Pf=1. #psia
vc=0.949
dc=1
h0=1263.4 #btu/lb
s0=1.5949 #btu/lb R
v2=276. #cu ft/lb
#Calculations
pt=0.55*p0 #Throat pressure
print '%s' %('from tables')
hts=1208.2 #btu/lb
vts=3.415 #cu ft/lb
h2s=891. #btu/lb
Vts=math.sqrt(2*32.174*778*(h0-hts)) #Throat velocity
w=w/3600. #lb/sec
cw=1
at=w*vts/(cw*Vts) #Throat area
print '%s %.5f' %('Throat area (ft^2) = ',at)
V2=math.sqrt(2*32.174*778*(h0-h2s)) #Exit velocity
eta=0.9
h2=h0-eta*(h0-h2s) #Enthalpy
a2s=w*v2/(cw*V2) #Exit area
print '%s %.5f' %('\n Exit area (ft^2) = ',a2s)
at=at/0.98
print '%s %.5f' %('\n Final throat area (ft^2)= ',at)
raw_input('press enter key to exit')
#Find the exit velocity and the throat and exit areas for a nozzle to pass
#1 lb/sec of air from an inlet state of 150 psia, 340 F, negligible velocity,
#to an exhaust pressure of 15 psia if the nozzle efficiency is 88% and Cd=1?
import math
#initialisation of variables
k=1.4
ptbyp0=0.53
T0=800. #R
cp=778.
R=0.0425864
P0=150. #psia
Pt=15. #psia
w=1. #lb/sec
cw=1.0043782
#Calculations
Pt2=ptbyp0*Pt #Pressure
Tts=T0*math.pow((ptbyp0),((k-1)/k)) #Temperature
Vts=math.sqrt(2*32.174*cp*0.24*(T0-Tts)) #exit velocity
print '%s %.2f' %('Exit velocity case 1 (fps) = ',Vts)
vts=3.12 #cu ft/lb
at=w*vts/(cw*Vts) #Throat area
print '%s %.5f' %('\n Throat Area (ft^2) = ', at)
T2s=T0*math.pow((Pt/P0),((k-1)/k)) #Final temperature
eta=0.88
T2=T0-eta*(T0-T2s) #Temperature
V2=math.sqrt(2*32.5*cp*0.24*(T0-T2)) #Exit velocity
print '%s %.2f' %('\n Exit velocity (fps) = ', V2)
v2=11.4 #cu ft/lb
a2=w*v2/V2
print '%s %.5f' %('\n Exit area (ft^2) = ',a2)
raw_input('press enter key to exit')