import math
# Given that
r_c = 3.5 # Compression ratio
n_c = 0.85 # Efficiency of compressor
p1 = 1 # Pressure in bar
t1 = 300 # Temperature in K
t3 = 310 # Temperature at the exit of the intercooler in K
r_c_ = 3.5 # Compression ratio for high pressure compressor
n_c_ = 0.85 # Efficiency of H.P. compressor
e = 0.8 # Effectiveness of regenerator
n_t = 0.88 # Efficiency of H.P. tubine
t6 = 1100 # Temperature in H.P. tubine in K
t8 = 1050 # Temperature at the entrance of L.P. turbine in K
n_t_ = 0.88 # Efficiency of L.P. turbine
Cp = 1.005 # Heat capacity of air in kJ/kgK
Cp_ = 1.15 # Heat capacity of gases in kJ/kgK
gama = 1.4 # Heat capacity ratio for air
gama_ = 1.33 # Heat capacity ratio for gases
print "\n Example 21.1\n"
p2 = r_c*p1
p4 = p2*r_c_
t2_s = t1*((r_c)**((gama-1)/gama))
t2 = t1+((t2_s-t1)/n_c)
t4_s = t3*((r_c_)**((gama-1)/gama))
t4 = t3+((t4_s-t3)/n_c_)
Wc = Cp*((t2-t1)+(t4-t3))
t7 = t6 - (Wc/Cp_)
t7_s = t6 - (t6-t7)/n_t
r_p = (t6/t7_s)**(gama_/(gama_-1))
p7 = p4/r_p
t9_s = t8/((p7/p1)**((gama_-1)/gama_))
t9 = t8-(t8-t9_s)*n_t_
Wt_LP = Cp_*(t8-t9)
W_T = Wt_LP+Wc
Rw = Wt_LP/W_T
Q1 = (Cp_*t6-Cp*t4)+Cp_*(t8-t7)
n_plant = Wt_LP/Q1
print "\n Power output = ",W_T ," kJ/kg,\n The overall efficiency = ",n_plant*100 ," percent"
#The answers given in the book have round off error
import math
# Given that
v_bm = 360 # Blade velocity at the mean diameter of a gas turbine stage in m/s
beta1 = 20 # Blade angle at inlet in degree
beta2 = 52 # Blade angle at exit in degree
r = 0.5 # Degree of reaction
Dm = 0.45 # Mean diameter of blade in m
h = 0.08 # Mean height of blade in m
print "\n Example 21.2\n"
v_f = v_bm/((math.tan(beta2))-math.tan(beta1))
r_r = (Dm/2)-h/2
r_t = Dm/2 +h/2
delta_v_wm = v_f*((math.tan(beta1))+(math.tan(beta2)))
v_br = v_bm*(r_r/(Dm/2))
delta_v_wr = delta_v_wm*v_bm/v_br
v_bt = (r_t/(Dm/2))*v_bm
v_w_1m = v_f*(math.tan(beta2))
v_w_1t = v_w_1m*(Dm/2)/r_t
delta_v_wt = v_f*((math.tan(beta1))+(math.tan(beta2)))*v_bm/v_bt
v_w_1r = v_w_1m*((Dm/2)/r_r)
alpha_1r = math.atan(v_w_1r/v_f)
alpha_2r = math.atan((delta_v_wr-v_w_1r)/v_f)
beta_1r = math.atan((v_w_1r-v_br)/v_f)
beta_2r = math.atan((v_br+v_f*(math.tan(alpha_2r)))/v_f)
alpha_1t = math.atan(v_w_1t/v_f)
alpha_2t = math.atan((delta_v_wt-v_w_1t)/v_f)
beta_1t = math.atan((v_w_1t-v_bt)/v_f)
beta_2t = math.atan((v_bt+(v_f*math.tan(alpha_2t)))/v_f)
Rt = v_f*((math.tan(beta_2t))-(math.tan(beta_1t)))/(2*v_bt)
Rr = v_f*((math.tan(beta_2r))-(math.tan(beta_1r)))/(2*v_br)
print "\n Flow velocity = ",v_f ," m/s,\n The blade angle at the root = ",alpha_1r ," degree,and at the tip = ",alpha_2r ," degree,\n The degree of reaction at the root = ",Rt*100 ," percent, and at the tip = ",Rr*100 ," percent"
import math
# Given that
p1 = 8 # Pressure of entrance in bar
t1 = 1125 # Temperature of entrance in K
p2 = 1.5 # Pressure of exit in bar
n = 11 # No of stages
Vf = 110 # Axial velocity of flow in m/s
n_p = 0.85 # Polytropic efficiency
Vb = 140 # Mean velocity in m/s
gama = 1.33 # Heat capacity ratio for gases
Cp = 1.15 # Heat capacity of gases in kJ/kgK
r = 0.5 # Fraction of reaction
print "\n Example 21.3\n"
t2 = t1*((p2/p1)**((gama-1)*n_p/gama))
t2_s = t1*((p2/p1)**((gama-1)/gama))
n_s = (t1-t2)/(t1-t2_s)
Wt = Cp*(t1-t2)
Wt_s = Wt/n
V_w1 = (((Wt_s*1000)/Vb) + Vb)/2
alpha1 = math.atan(Vf/V_w1)
alpha2 = alpha1
beta1 = math.atan(Vf/(V_w1-Vb))
h_s = Wt_s
t_s = h_s/Cp
t1_ = t1-t_s
t1_s = t1*((t1_/t1)**(gama/((gama-1)*n_p)))**((gama-1)/gama)
n_st = (t1-t1_)/(t1-t1_s)
print "\n The blade angle at the inlet = ",alpha1 ," degree,and at the exit = ",beta1 ," degree,\n The overall efficiency of the turbine = ",n_s*100 ," percent\n The stage efficiency = ",n_st*100 ," percent"
# The answers given in the book contain round off error.
import math
# Given that
v = 800.0 # Speed of aircraft in km/h
h = 10700.0 # Height of aircraft in m
p0 = 0.24 # Pressure in bar
t0 = -50.0 # Temperature in degree centigrade
r_p = 10.0 # Compressor pressure ratio
t03 = 1093.0 # Max cycle temperature in K
n_ed = 0.9 # Entry duct efficiency
n_c = 0.9 # Isentropic efficiency of compressure
p_ = 0.14 # Stagnation pressure loss in combustion chamber in bar
cv = 43.3 # Calorific value of fuel in MJ/kg
n_C = 0.98 # Combustion efficiency
n_t = 0.92 # Isentropic efficiency of turbine
n_m = 0.98 # Mechanical efficiency of drive
n_j = 0.92 # Jet pipe efficiency
a = 0.08 # Nozzle outlet area in m**2
Cp = 1.005 # Heat capacity of air in kJ/kgK
gama = 1.4 # Ratio of heat capacities for air
Cp_ = 1.15 # Heat capacity for gases in kJ/kgK
gama_ = 1.333 # Ratio of heat capacities for gases
print "\n Example 21.4\n"
KE = (1/2)*(v*5/18)**2
tr = KE/(1000*Cp)
t01 = tr + (273+t0)
t01_s = (t0+273)+(n_ed*(t01-(t0+273)))
p01 = p0*((t01_s/(t0+273))**(gama/(gama-1)))
t02_s = t01*((r_p)**((gama-1)/gama))
t02 = (t01) + (t02_s-t01)/n_c
p02 = p01*r_p
p03 = p02-p_
t04 = t03 - (Cp*(t02-t01)/(Cp_*n_m))
t04_s = t03-(t03-t04)/n_t
p04 = p03/((t03/t04_s)**(gama_/(gama_-1)))
p_cr = p04*((2/(gama_+1))**(gama_/(gama_-1)))
t05 = t04*(2/(gama_+1))
t05_s = t04-((t04-t05)/n_j)
p05 = p04/((t04/t05_s)**(gama_/(gama_-1)))
R = Cp_*(gama_-1)/gama_
v5 = R*t05/(p05*100)
Vj = math.sqrt(gama_*R*1000*t05)
m = a*Vj/v5
Mt = m*(Vj-v*(5/18))
Pt = (p05-p0)*a*10**5
Tt = Mt+Pt
Q1 = m*(t03-t02)*Cp_
m_f = Q1/(cv*1000*n_C)
m_sf = m_f*1000/Tt
print "\n Total thrust developed = ",Tt ," N,\n The specific fuel consumption = ",m_sf ," kg/kNs"
# The answers given in the book contain round off error.
import math
# Given that
v = 850.0 # Speed of turbojet in km/h
m = 50.0 # Air mass flow rate in kg/s
s = 200.0 # Entropy drop across the nozzle in kJ/kg
n_n = 0.9 # Nozzle efficiency
r = 80.0 # Air fuel ratio
cv = 40.0 # Heating value of fuel in MJ/kg
Cp = 1005.0 # Heat capacity of air in J/kgK
print "\n Example 21.5\n"
Vo = v*(5.0/18)
m_f = m/r
Ve = math.sqrt(2*Cp*s*n_n)
T = (m+m_f)*Ve-m*Vo
TP = T*Vo
PP = (1.0/2.0)*(m+m_f)*(Ve**2)-(1/2)*(m*Vo**2)
n_p = TP/PP
n_t = PP/(m_f*cv*1000000)
n = n_t*n_p
print "\n Propulsive power = ",PP*(10**-6) ," MW,\n Thrust power = ",TP*(10**-3) ," kW,\n Propulsive efficiency = ",n_p*100 ," percent\n Thermal efficiency = ",n_t*100 ," percent,\n Overall efficiency = ",n*100 ," percent "
import math
# Given that
p1 = 0.56 # Ambient pressure in bar
t1 = 260.0 # Ambient temperature in K
r_p = 6.0 # Pressure ratio of compressor
n_c = 0.85 # Efficiency of compressor
v = 360.0 # Speed of aircraft in km/h
d = 3.0 # Propeller diameter in m
n_p = 0.8 # Propeller efficiency
n_g = 0.95 # Gear reduction efficiency
r_e = 5.0 # Expansion ratio
n_t = 0.88 # Turbine efficiency
t3 = 1100.0 # Temperature at the entrance of turbine in K
n_n = 0.9 # Nozzle efficiency
cv = 40.0 # Calorific value in MJ/kg
print "\n Example 21.6\n"
gama = 1.4 # Heat capacities ratio for air
Vo = v*(5.0/18)
p2 = p1*r_p
t2_s = t1*((r_p)**(0.286))
t2 = t1+((t2_s-t1)/n_c)
Cp = 1.005 # The value of heat capacity of air as given in the book in kJ/kgK
Wc = Cp*(t2-t1)
m_f = (t3-t2)/((cv*1000/Cp)-t3)
m_a = 1.0/m_f
p3=p2
p4 = p3/r_e
t4_s = t3/((r_e)**(0.286))
t4 = t3-((t3-t4_s)*n_t)
Wt = (1+m_f)*(t3-t4)*Cp
Pp = Wt-Wc
p5 = p1
t5_s = t4/((p4/p5)**((gama-1)/gama))
Vj = math.sqrt(2*Cp*1000*(t4-t5_s)*n_n)
Ft = (1+m_f)*Vj-1*Vo
V = Vo/n_p
V4 = 2*V-Vo
Q = (math.pi/4)*(d**2)*V
Pt = (1/2.0)*(p1*(10**5)/(287*t1))*Q*((V4**2)-(Vo**2))/1000
PT = Pt/n_g
ma_c = PT/Pp
Fp = Pt*n_p/V
print "\n Air-fuel ratio = ",m_a ,",\n Thrust power of the propeller = ",Pt ," kJ/s ,\n Thrust by the propeller = ",Fp ," kN,\n Mass flow rate of air flowing through the compressor = ",ma_c ," kg/s,"
# The answers are given in the book contain calculation error.
import math
from scipy import integrate
# Given that
m = 15000.0 # Initial mass of rocket in kg
m_b = 125.0 # Burning rate of propellent in kg/s
v = 2000.0 # Relative velocity of gases with respect to the rocket in m/s
T = 70.0 # Time in second
print "\n Example 21.7\n"
V = (-v*math.log(1-(m_b*T/m)))-(9.81*T)
h1,err = integrate.quad(lambda t:-v*math.log(1-(m_b*t/m))-9.81*t,0,T)
h2 = (V**2)/(2*9.81)
hmax = h2 + h1
print "\n Velocity attain by the rocket in 70 seconds = ",V ," m/s ,\n The maximum height that the rocket will attain = ",hmax*0.001 ," km"
import math
# Given that
Pc = 2.4 # Pressure in combustion chamber in MPa
Tc = 3170 # Temperature in combustion chamber in K
Pj = 55 # Atomospheric pressure in kPa
Pe = 85 # Pressure at the exit of nozzle in kPa
At = 0.06 # Area at the nozzle throat in m**2
n_n = 0.91 # Nozzle efficiency
Cd = 0.98 # Cofficient of discharge
gama = 1.25 # Heat capacities ratio for gases
R = 0.693 # Value of gas constant in kJ/kgK
theta = 12 # Half angle of divergence in degree
print "\n Example 21.8\n"
Vj = math.sqrt((2*gama*R*1000*Tc/(gama-1))*(1-(Pj/(Pc*1000))**((gama-1)/gama)))
Vj_act = ((1+math.cos(12))/2)*Vj*math.sqrt(n_n)
m = At*Pc*(10**6)*((gama/(R*1000*Tc))*(2/(gama+1))**((gama+1)/(gama-1)))**(1.0/2)
m_act = Cd*m
Ae = m/(Pe*Vj)
Ft = m*Vj+Ae*(Pe-Pj)*1000
SIm = Ft/m_act
print "\n Thrust produced = ",Ft*0.001 ," kN,\n Specific impulse = ",SIm ," Ns/kg"
# The answers are given in the book contain claculation error.