import math
#calcualte inlet velocity and the exit double mach number and nozzle torque per unit mass flow rate
Tt1=1800.
M1=0.55
alfa1=0.
gm=1.33
Cp=1157.
alfa2=60.
T1=Tt1/(1.+(gm-1)*M1**2/2.)
a1=((gm-1.)*Cp*T1)**(1/2.)
C1=a1*M1
C2=C1/math.cos(alfa2/57.3)
Tt2=Tt1
T2=Tt2-C2**2/(2*Cp)
a2=((gm-1)*Cp*T2)**(1/2)
M2=C2/a2
Ct2=C1*math.tan(alfa2/57.3)
r=0.35
t=0-r*Ct2
print"%s %.4f %s"%("(a)Inlet velocity C1 in m/s :",C1,"")
print"%s %.4f %s"%("(b)The exit absolute Mach no. M2 :",M2,"")
print"%s %.4f %s"%("(c)Nozzle torque per unit mass flow rate for r1=r2=0.35m :",t,"")
import math
#calculate the nozzle exit flow angle
print("Example 9.2")
M2=1.0 ##i.e choked
Tt2=1800.
gm=1.33
C1=445.
Cp=1157.
T2=Tt2/(1.+(gm-1.)*M2**2/2.)
a2=((gm-1.)*Cp*T2)**(1/2.)
M2=1
C2=M2*a2
alfa2=math.acos(C1/C2)*180/math.pi
print"%s %.4f %s"%("Nozzle exit flow angle if M2=1 in degrees:",alfa2,"")
import math
#calculate axial velocity and rotor velocity and degree of reaction at this radius
C1=411.
alfa2=60.
C2=800.
W2=450.
alfa3=13.
C3=411.
Cz2=C2*math.cos(60/57.3)
Cz3=C3*math.cos(13/57.3)
Ct2m=Cz3*math.tan(60/57.3)
Wt2m=(450.**2.-400**2.)**(1/2.)
Um=Ct2m-Wt2m
Ct3=C3*math.sin(13/57.3)
Rm=1-(Ct2m+Ct3)/(2.*Um)
print"%s %.4f %s"%("(a)The axial velocities up- and downstream of the rotor in m/s:",Cz2,"c")
print'%.4f'%(Cz3)
print"%s %.4f %s"%("(b)The rotor velocity Um in m/s:",Um,"")
print"%s %.4f %s"%("(c)The degree of reaction at this radius :",Rm,"")
import math
#calculate the loss of turbine efficiency due to tip clearance
Cd=0.5
bm=-20.
r=1.25
phi=0.5
chi=1.
t=0.02
De=Cd*t*r*(1-(chi/phi)*math.tan(bm/57.3))**(1/2.)
print"%s %.4f %s"%("Loss of the turbine efficiency (eta0 times) :",De,"")
import math
#calculate gas static temperature and adibatic wall temperature on the nozzle for a turbulent boundary layer
Tt=1700. ##total gas temp at exit
gm=1.33 ##gamma
Cp=1157. ##in J/kg.K
M2=1. ##local gas Mach no.
Pr=0.71 ## Prandtl no.
W2=455. ## gas speed relative to rotor
Tg=Tt/(1.+(gm-1)*(M2**2)/2.)
print"%s %.3f %s "%("The gas static temperature Tg in K:",Tg,"")
a2=((gm-1)*Cp*Tg)**(1/2.)
C2=a2
r=Pr**(1/3.)
Taw=Tg+Pr**(1/3.)*C2**2./(Cp)
print"%s %.3f %s "%("The adiabatic wall temperatue Taw on the nozzle for a turbulent boundary layer in K:",Taw,"")
Ttr=Tg+(W2**2)/(2*Cp)
Tawl=Tg+Pr**(1/2)*C2**2/(Cp)
print"%s %.3f %s "%("The adiabatic wall temperature on the nozzle for a laminar boundary layer in K: ",Tawl,"")
print"%s %.3f %s "%("The rotor temperature of the gas on the rotor in K:",Ttr,"")
import math
#calculate cooling fraction
T0=288. ##in K
p0=100. ##in kPa
Tt3=800. ##in K
gm=1.4
Cpc=1.0045 ##kJ/Kg.K
pc=25.
ec=0.9
Tt4=2000. ##in K
gmc=1.33
Cpg=1.188 ##kJ/Kg.K
Stg=0.005 ##Gas-side Stanton no.
Taw=2000. ##in K
ptg=2.5 ##in Mpa
Tawd=1200. ## desired temp. in K
d=2. ##thickness of internally cooled wall in mm
bms=2. ##blade mean solidity in HPT
kw=14.9 ##in W/m.K
Twc=870. ##in K
S=1/2. ##S=Stc/Stg
e=(Cpc/Cpg)*S*(Twc-Tt3)/(Tt4-Tawd)
print"%s %.4f %s"%("Cooling fraction :",e,"")