import math
#Input data
do1 = 1.12 #Density of air i reservoir in kg/m**3
ao1 = 500 #Velocity of sound in reservoir in m/s
d = 0.01 #Throat diameter in m
k = 1.4 #Adiabatic Consmath.tant
R = 287 #Specific gas consmath.tant in J/kg-K
#Calculation
To1 = ao1**2/(k*R) #Stagnation temperature in K
Po1 = do1*R*To1 #Stagnation pressure in Pa
p1 = 0.528 #Ratio of critical pressure to Stagnation pressure from gas tables @M = 1
Pt = (Po1*p1)*10**-5 #Throat pressure in bar
t1 = 0.834 #Ratio of critical temperature to Stagnation temperature from gas tables @M = 1
Tt = To1*t1 #critical temperature in K
d_t = (Pt*10**5)/(R*Tt) #Density of air at throat in kg/m**3
a_t = math.sqrt(k*R*Tt) #Sound velocity at throat in m/s
Ct = a_t #Air velocity t throat in m/s, Since M = 1
A_t = math.pi*d**2/4 #Throat area in m**2
m = d_t*A_t*Ct #Maximum mass flow rate in kg/s
#Output
print 'A)Maximum mass flow rate is %3.5f kg/s \
\nB)Pressure and temperarature at the throat are %3.3f bar and %3.4f K'%(m,Pt,Tt)
import math
#Input data
P1 = 2. #Intial pressure in bar
C1 = 170. #Initial velocity of air in m/s
T1 = 473. #Intial temperature in K
A1 = 1000. #Inlet area in mm**2
P2 = 0.95 #Exit pressure in bar
k = 1.4 #Adiabatic Consmath.tant
R = 287. #Specific gas consmath.tant in J/kg-K
#Calculation
a_1 = math.sqrt(k*R*T1) #Velocity of sound at inlet in m/s
M1 = C1/a_1 #Inlet mach number
t1 = 0.970 #Ratio of inlet temperature to Stagnation temperature from gas tables @M = 1
To1 = T1/t1 #Stagnation temperature in K
p1 = 0.900 #Ratio of inlet pressure to Stagnation pressure from gas tables @M = 1
Po1 = P1/p1 #Stagnation pressure in bar
a1 = 1.623 #Ratio of inlet area to critical area from isentropic gas tables @M = 1
At = A1/a1 #critical area in mm**2
p2 = 0.528 #Pressure ratio at critical state from isentropic gas tables @M = 1
Pt = Po1*p2 #Throat pressure in bar
t2 = 0.834 #Temperature ratio at critical state from isentropic gas tables @M = 1
Tt = To1*t2 #Throat temperature in K
a_t = math.sqrt(k*R*Tt) #Velocity of sound at throat in m/s
C_t = a_t #Critical velocity of air in m/s
p3 = P2/Po1 #Pressure ratio at exit
M2 = 1.17 #Mach number at exit from isentropic gas tables @p3
t3 = 0.785 #Temperature ratio at exit from isentropic gas tables @M2
T2 = To1*t3 #Exit temperature in K
a3 = 1.022 #Area ratio at exit from isentropic gas tables @M2
A2 = At*a3 #Exit area in mm**2, wrong answer in textbook
C2 = M2*math.sqrt(k*R*T2) #Exit velocity in m/s
#Output
print 'A)Stagnation temperature and pressure are %3.2f K and %3.3f bar \
\nB)Sonic velocity and mach number at entry are %3.2f m/s and %3.2f \
\nC)Velocity, Mach number and flow area at outlet section are %3.2f m/s, %3.2f and %3.2f mm**2 \
\nD)Pressure, area at throat of the nozzle are %3.5f bar and %3.3f mm**2'%(To1,Po1,a_1,M1,C2,M2,A2,Pt,At)
import math
#Input data
Po1 = 10. #Stagnation pressure in bar
To1 = 798. #Stagnation temperature in K
Pt = 7.6 #Throat pressure in bar
m = 1.5 #Mass flow rate in kg/s
k = 1.4 #Adiabatic Consmath.tant
R = 287. #Specific gas consmath.tant in J/kg-K
Cp = 1005. #Specific heat capacity at consmath.tant pressure in J/kg-K
#Calculation
p1 = 0.528 #Ratio of critical pressure to Stagnation pressure from isentropic gas tables @M = 1,k = 1.4
Pc = p1*Po1 #Critical pressure in bar
P2 = Pt #Exit pressure in bar, Since Pc<P2
p2 = P2/Po1 #Pressure ratio
M2 = 0.64 #Exit mach number from isentropic gas tables @p2
t1 = 0.924 #Ratio of exit temperature to Stagnation temperature from isentropic gas tables @M2
T2 = t1*To1 #exit temperature in K
C2 = math.sqrt(k*R*T2)*M2 #Exit velocity in m/s
C_max = math.sqrt(2*Cp*To1) #Maximum possible velocity in m/s
d2 = (P2*10**5)/(R*T2) #Density at exit in kg/m**3
At = (m/(d2*C2))*10**6 #Throat area in mm**2
#Output
print 'A)At the nozzle throat/exit: \
\nPressure is %3.2f bar \
\nTemperature is %3.2f K \
\nVelocity is %3.2f m/s \
\nB)Maximum possible velocity is %3.2f m/s \
\nC)Type of the nozzle is a convergent nozzle and its throat area is %3.3f mm**2'%(P2,T2,C2,C_max,At)
import math
#Input data
Po1 = 3.344 #Stagnation pressure in bar
To1 = 900. #Stagnation temperature in K
P2 = 1.05 #Exit pressure in bar
k = 1.4 #Adiabatic Consmath.tant
R = 287. #Specific gas consmath.tant in J/kg-K
Cp = 1005. #Specific heat capacity at consmath.tant pressure in J/kg-K
#Calculation
p1 = P2/Po1 #Pressure ratio
M2 = 1.40 #Exit mach number from gas tables @p1,k = 1.4
t1 = 0.718 #Ratio of exit temperature to Stagnation temperature from isentropic gas tables @M2,k = 1.4
T2 = To1*t1 #exit temperature in K
C2 = math.sqrt(k*R*T2)*M2 #Exit velocity in m/s
d2 = (P2*10**5)/(R*T2) #Density at exit in kg/m**3
a1 = 1.115 #Ratio of exit area to critical area from isentropic gas tables @M2
M_2 = 0.6733 #Exit mach number when it acts as diffuser
t2 = 0.91633 #Ratio of exit temperature to Stagnation temperature from isentropic gas tables @M2
T_2 = t2*To1 #exit temperature in K
C_2 = math.sqrt(k*R*T_2)*M_2 #Exit velocity in m/s
p2 = 0.738 #Ratio of exit pressure to Stagnation pressure from isentropic gas tables @M2
P_2 = Po1*p2 #exit pressure in bar
d_2 = (P_2*10**5)/(R*T_2) #Density at exit in kg/m**3
#Output
print 'A)At exit: \nTemperaure is %3i K \
\nVelocity is %3.2f m/s \
\nDensity is %3.3f kg/m**3 \
\nB)At diffuser: Temperaure is %3.3f K \
\nVelocity is %3.3f m/s \
\nDensity is %3.4f kg/m**3 \
\nPressure is %3.4f bar'%(T2,C2,d2,T_2,C_2,d_2,P_2)
import math
#Input data
Po1 = 8 #Stagnation pressure in bar
To1 = 273+15 #Stagnation temperature in K
At = 25 #Throat area in cm**2
A2 = 100 #Exit area in cm**2
k = 1.4 #Adiabatic Consmath.tant
R = 287 #Specific gas consmath.tant in J/kg-K
#Calculation
a1 = A2/At #Area ratio
M2 = 2.94 #Exit mach number from gas tables @a1,k = 1.4
p1 = 0.0298 #Ratio of exit pressure to Stagnation pressure from isentropic gas tables @M2,k = 1.4
P2 = Po1*p1 #exit pressure in bar
M_2 = 0.146 #Exit mach number when it acts as diffuser
p2 = 0.9847 #Ratio of exit pressure to Stagnation pressure from isentropic gas tables @M2
P_2 = Po1*p2 #exit pressure in bar
p3 = 0.528 #Ratio of critical pressure to Stagnation pressure from isentropic gas tables @M = 1,k = 1.4
Pc = (Po1*p3) #Critical pressure in bar
t1 = 0.834 #Ratio of critical temperature to Stagnation temperature from isentropic gas tables @M = 1,k = 1.4
Tt = To1*t1 #critical temperature in K
d_t = (Pc*10**5)/(R*Tt) #Density at critical state in kg/m**3
a_t = math.sqrt(k*R*Tt) #Velocity of sound at critical state in m/s
Ct = a_t #Velocity of air at critical state in m/s
m = d_t*At*Ct*10**-4 #Mass flow rate in kg/s
#Output
print 'A)Maximum mass flow rate is %3.3f kg/s \
\n\
\nB)As nozzle: \
\nPressure is %3.4f bar \
\nMach number is %3.2f \
\nAs diffuser: \
\nPressure is %3.4f bar \
\nMach number is %3.3f'%(m,P2,M2,P_2,M_2)
import math
#Input data
D1 = 15 #Entry diameter in cm
D2 = 30 #Exit diamater in cm
P1 = 0.96 #Inlet pressure in bar
T1 = 340 #Inlet temperature in K
C1 = 185 #INlet velocity in m/s
k = 1.4 #Adiabatic Consmath.tant
R = 287 #Specific gas consmath.tant in J/kg-K
#Calculation
A1 = math.pi*D1**2/4 #Entry area in cm**2
A2 = math.pi*D2**2/4 #Exit area in cm**2
a_1 = math.sqrt(k*R*T1) #Sound velocity in m/s
M1 = C1/a_1 #Inlet mach number
p1 = 0.843 #Ratio of inlet pressure to Stagnation pressure from gas tables @M1,k = 1.4
Po1 = P1/p1 #Stagnation pressure in bar
t1 = 0.952 #Ratio of inlet temperature to Stagnation temperature from gas tables @M1,k = 1.4
To1 = T1/t1 #Stagnation temperature in K
a1 = 1.34 #Ratio of inlet area to critical area from isentropic gas tables @M1,k = 1.4
At = A1/a1 #critical area in cm**2
a2 = A2/At #Area ratio
M2 = 0.1088 #Exit mach number from gas tables @a2,k = 1.4
p2 = 0.992 #Ratio of exit pressure to Stagnation pressure from isentropic gas tables @M2,k = 1.4
P2 = Po1*p2 #exit pressure in bar
t2 = 0.9976 #Ratio of exit temperature to Stagnation temperature from isentropic gas tables @M2,k = 1.4
T2 = To1*t2 #exit temperature in K
C2 = math.sqrt(k*R*T2)*M2 #Exit velocity in m/s
F1 = P1*10**5*A1*10**-4*(1+(k*(M1**2))) #Force exerted at entry in kN
F2 = P2*10**5*A2*10**-4*(1+(k*(M2**2))) #Force exerted at exit in kN
F = (F2-F1)*10**-3 #Force exerted on the diffuser walls in kN, wrong answer in textbook
#Output
print 'A)Exit pressure is %3.3f bar \
\n\
\nB)Exit velocity is %3.2f m/s \
\n\
\nC)Force exerted on the diffuser walls is %3.3f kN'%(P2,C2,F)
import math
#Input data
M1 = 3.6 #Inlet mach number
M2 = 2 #Exit mach number
m = 15 #Mass flow rate in kg/s
P1 = 1.05 #Inlet pressure in bar
T1 = 313 #Inlet temperature in K
k = 1.4 #Adiabatic Consmath.tant
R = 287 #Specific gas consmath.tant in J/kg-K
#Calculation
p1 = 11.38*10**-3 #Ratio of inlet pressure to Stagnation pressure from gas tables @M1,k = 1.4
Po = P1/p1 #Stagnation pressure in bar
t1 = 0.278 #Ratio of inlet temperature to Stagnation temperature from gas tables @M1,k = 1.4
To = T1/t1 #Stagnation temperature in K
C1 = math.sqrt(k*R*T1)*M1 #Inlet velocity in m/s
d1 = (P1*10**5)/(R*T1) #Density at inlet in kg/s, P1 in Pa
A1 = (m/(d1*C1))*10**4 #Inlet area in cm**2
p2 = 0.128 #Ratio of exit pressure to Stagnation pressure from isentropic gas tables @M2,k = 1.4
P2 = Po*p2 #exit pressure in bar
t2 = 0.555 #Ratio of exit temperature to Stagnation temperature from isentropic gas tables @M2,k = 1.4
T2 = To*t2 #exit temperature in K
C2 = math.sqrt(k*R*T2)*M2 #Exit velocity in m/s
d2 = (P2*10**5)/(R*T2) #Density at exit in kg/s
A2 = (m/(d2*C2))*10**4 #Exit area in cm**2
#Output
print 'A)At Inlet: \
\nArea is %3.1f cm**2 \
\nTotal pressure %3.2f bar \
\nTotal temperature is %3.1f K \
\nB)At Exit: \
\nArea is %3.1f cm**2 \
\nTotal pressure %3.2f bar \
\nTotal temperature is %3.2f K \
\nStatic temperature is %3.2f K \
\nStatic pressure is %3.2f bar'%(A1,Po,To,A2,Po,To,T2,P2)
import math
#Input data
Po = 6.91 #Stagnation pressure in bar
To = 325+273 #Stagnation temperature in K
P2 = 0.98 #exit pressure in bar
m = 3600/3600 #Mass flow rate in kg/s
k = 1.4 #Adiabatic Consmath.tant
R = 287 #Specific gas consmath.tant in J/kg-K
Cp = 1005 #Specific heat capacity at consmath.tant pressure in J/kg-K
#Calculation
p1 = 0.528 #Ratio of critical pressure to Stagnation pressure from gas tables @M = 1
Pt = Po*p1 #critical pressure in bar
t1 = 0.834 #Ratio of critical temperature to Stagnation temperature from gas tables @M = 1
Tt = To*t1 #critical temperature in K
at = math.sqrt(k*R*Tt) #Sound velocity at throat in m/s
Ct = at #Air velocity t throat in m/s, Since M = 1
dt = (Pt*10**5)/(R*Tt) #Density of air at throat in kg/m**3, Pt in Pa
At = (m/(dt*Ct))*10**4 #Throat area in m**2 x10**-4
p2 = P2/Po #Pressure ratio
M2 = 1.93 #Exit mach number from gas tables @p2,k = 1.4
t2 = 0.573 #Ratio of exit temperature to Stagnation temperature from isentropic gas tables @M2,k = 1.4
T2 = To*t2 #exit temperature in K
a2 = 1.593 #Ratio of exit area to critical area from isentropic gas tables @M2,k = 1.4
A2 = a2*At #Exit area in m**2, At in m**2 x10**-4
C_max = math.sqrt(2*Cp*To) #Maximum possible velocity in m/s
#Output
print 'A)At throat: \
\nArea is %3.2fx10**-4 m**2 \
\nPressure is %3.2f bar \
\nVelocity is %3.1f m/s \
\nB)At Exit: \
\nArea is %3.3fx10**-4 m**2 \
\nMach number is %3.2f \
\nC)Maximum possible velocity is %3.2f m/s'%(At,Pt,Ct,A2,M2,C_max)
import math
#Input data
P1 = 2.45 #Inlet pressure in bar
T1 = 26.5+273 #Inlet temperature in K
M1 = 1.4 #Inlet mach number
M2 = 2.5 #Exit mach number
k = 1.3 #Adiabatic Consmath.tant
R = 469 #Specific gas consmath.tant in J/kg-K
#Calculation
t1 = 0.773 #Ratio of inlet temperature to Stagnation temperature from gas tables @M1,k = 1.3
To = T1/t1 #Stagnation temperature in K
t2 = 0.516 #Ratio of exit temperature to Stagnation temperature from isentropic gas tables @M2,k = 1.3
T2 = To*t2 #exit temperature in K
C2 = math.sqrt(k*R*T2)*M2 #Exit velocity in m/s
a1 = math.sqrt(k*R*T1) #Sound velocity at inlet in m/s
G = (P1*10**5*a1*M1)/(R*T1) #)Flow rate per square meter of the inlet cross section in kg/s-m**2
#Output
print 'A)Stagnation temperature is %3.2f K \
\nB)At Exit: \
\nTemperature is %3.3f K \
\nVelocity is %3.2f m/s \
\nC)Flow rate per square meter of the inlet cross section is %3.2f kg/s-m**2'%(To,T2,C2,G)
import math
#Input data
Po = 1000 #Stagnation pressure in kPa
To = 800 #Stagnation temperature in K
k = 1.4 #Adiabatic Consmath.tant
M2 = 2 #Exit mach number
At = 20 #Throat area in cm**2
R = 287 #Specific gas consmath.tant in J/kg-K
#Calculation
t1 = 0.834 #Ratio of critical temperature to Stagnation temperature from isentropic gas tables @M = 1,k = 1.4
Tt = To*t1 #critical temperature in K
at = math.sqrt(k*R*Tt) #Velocity of sound at critical state in m/s
Ct = at #Velocity of air at critical state in m/s, Since M = 1
p1 = 0.528 #Ratio of critical pressure to Stagnation pressure from isentropic gas tables @M = 1,k = 1.4
Pt = Po*p1 #Critical pressure in bar
dt = (Pt*10**3)/(R*Tt) #Density at critical state in kg/m**3, Pt in Pa
m = dt*At*10**-4*Ct #Mass flow rate in kg/s, At in m**2
p2 = 0.128 #Ratio of exit pressure to Stagnation pressure from isentropic gas tables @M2,k = 1.4
P2 = Po*p2 #exit pressure in kPa
t2 = 0.555 #Ratio of exit temperature to Stagnation temperature from isentropic gas tables @M2,k = 1.4
T2 = To*t2 #exit temperature in K
a2 = 1.687 #Ratio of exit area to critical area from isentropic gas tables @M2,k = 1.4
A2 = At*a2 #Exit area in cm**2
C2 = math.sqrt(k*R*T2)*M2 #Exit velocity in m/s
d2 = P2*10**3/(R*T2) #Density at exit in kg/m**3, P2 in Pa
#Output
print 'A)At throat: \
\nTemperature is %3.1f K \
\nVelocity is %3.2f m/s \
\nPressure is %3i kPa \
\nB)At Exit: \
\nTemperature is %3i K \
\nPressure is %3i kPa \
\nArea is %3.2f m**2 \
\nMass flow rate is %3.4f kg/s'%(Tt,Ct,Pt,T2,P2,A2,m)
import math
#Input data
M2 = 2 #Exit mach number
At = 1000 #Throat area in cm**2
Po = 0.69 #Stagnation pressure in bar
To = 310 #Stagnation temperature in K
k = 1.4 #Adiabatic Consmath.tant
R = 287 #Specific gas consmath.tant in J/kg-K
Cp = 1.005 #Specific heat capacity at consmath.tant pressure in kJ/kg-K
#Calculation
t1 = 0.834 #Ratio of critical temperature to Stagnation temperature from isentropic gas tables @M = 1,k = 1.4
Tt = To*t1 #critical temperature in K
at = math.sqrt(k*R*Tt) #Velocity of sound at critical state in m/s
Ct = at #Velocity of air at critical state in m/s, Since M = 1
p1 = 0.528 #Ratio of critical pressure to Stagnation pressure from isentropic gas tables @M = 1,k = 1.4
Pt = Po*p1 #Critical pressure in bar
dt = (Pt*10**5)/(R*Tt) #Density at critical state in kg/m**3, Pt in Pa
m = dt*At*10**-4*Ct #Mass flow rate in kg/s, At in m**2
p2 = 0.128 #Ratio of exit pressure to Stagnation pressure from isentropic gas tables @M2,k = 1.4
P2 = Po*p2 #exit pressure in bar
t2 = 0.555 #Ratio of exit temperature to Stagnation temperature from isentropic gas tables @M2,k = 1.4
T2 = To*t2 #exit temperature in K
C2 = math.sqrt(k*R*T2)*M2 #Exit velocity in m/s
d2 = (P2*10**5)/(R*T2) #Density at exit in kg/m**3, P2 in Pa
A2 = (m/(d2*C2))*10**4 #Exit area in cm**2
P = m*Cp*(To-T2) #Power required to drive the compressor in kW
#Output
print 'A)At throat: \
\nTemperature is %3.2f K \
\nVelocity is %3.2f m/s \
\nPressure is %3.3f bar \
\nAt Test section: Temperature is %3.2f K \
\nVelocity is %3.3f m/s \
\nPressure is %3.3f bar \
\nB)Area of cross section at test section is %3i cm**2 \
\nC)Mass flow rate is %3.3f kg/s \
\nD)Power required to drive the compressor is %3.2f kW'%(Tt,Ct,Pt,T2,C2,P2,A2,m,P)
# note : rounding off error.
import math
#Input data
Po = 10. #Stagnation pressure in bar
To = 100.+273 #Stagnation temperature in K
m = 15. #mass flow rate in kg/s
P2s = 1. #Back pressure in isentropic state in bar
eff = 0.95 #efficiency of diverging nozzle
k = 1.4 #Adiabatic Consmath.tant
R = 287. #Specific gas consmath.tant in J/kg-K
Cp = 1005. #Specific heat capacity at consmath.tant pressure in J/kg-K
#Calculation
#case I: isentropic
t1 = 0.834 #Ratio of critical temperature to Stagnation temperature from isentropic gas tables @M = 1,k = 1.4
Tt = To*t1 #critical temperature in K
at = math.sqrt(k*R*Tt) #Velocity of sound at critical state in m/s
Ct = at #Velocity of air at critical state in m/s, Since M = 1
p1 = 0.528 #Ratio of critical pressure to Stagnation pressure from isentropic gas tables @M = 1,k = 1.4
Pt = Po*p1 #Critical pressure in bar
dt = (Pt*10**5)/(R*Tt) #Density at critical state in kg/m**3, Pt in Pa
At = (m/(dt*Ct))*10**4 #Throat area in cm**2
p2 = P2s/Po #Pressure ratio
M2s = 2.15 #Exit mach number from gas tables (isentropic state) @p2,k = 1.4
t2 = 0.519 #Ratio of exit temperature to Stagnation temperature from isentropic gas tables @M2s,k = 1.4
T2s = t2*To #exit temperature in K
a2s = math.sqrt(k*R*T2s) #Velocity of sound at exit in m/s
C2s = M2s*a2s #Exit air velocity in m/s
d2s = (P2s*10**5)/(R*T2s) #Density at exit in kg/m**3, P2 in Pa
A2s = (m/(d2s*C2s))*10**4 #Exit area in cm**2
#case II: isentropic upto throat
T2 = To-(eff*(To-T2s)) #Exit tempareture in K
C2 = math.sqrt(2*Cp*(To-T2)) #Exit air velocity in m/s
P2 = P2s #Exit pressure in bar, Since it is diffuser
d2 = (P2*10**5)/(R*T2) #Density at exit in kg/m**3, P2 in Pa
A2 = (m/(d2*C2))*10**4 #Exit area in cm**2
#Output
print 'A)The nozzle cross section at throat in both cases is %3.2f cm**2 \
\nB)The nozzle cross section at exit in case I is %3.3f cm**2 and in case II is %3.2f cm**2'%(At,A2s,A2)
# note : rounding off error.
import math
#Input data
Po = 600. #Stagnation pressure in kPa
To = 40.+273 #Stagnation temperature in K
P2 = 100. #exit pressure in kPa
k = 1.4 #Adiabatic Consmath.tant
R = 287. #Specific gas consmath.tant in J/kg-K
#Calculation
p1 = P2/Po #pressure ratio
M2 = 1.82 #Exit mach number from gas tables @p2,k = 1.4
ar = 1.461 #Ratio of nozzle exit area to nozzle throat area from gas tables @M2
t1 = 0.602 #Ratio of exit temperature to Stagnation temperature from isentropic gas tables @M2,k = 1.4
T2 = To*t1 #exit temperature in K
C2 = math.sqrt(k*R*T2)*M2 #Exit air velocity in m/s
p2 = 3.698 #Ratio of static pressures after shock to before shock from normal shock gas tables @M2
Py = p2*P2 #The back pressure at which normal shock acts at the exit plane of the nozzle in kPa
#Output
print 'A)Ratio of nozzle exit area to nozzle throat area is %3.3f \
\nB)The discharge velocity from nozzle is %3.2f m/s \
\nC)The back pressure at which normal shock acts at the exit plane of the nozzle is %3.1f kPa'%(ar,C2,Py)
import math
#Input data
ar = 2. #Ratio of nozzle exit area to nozzle throat area
Po = 700. #Stagnation pressure in kPa
P2 = 400. #exit pressure in kPa
#Calculation
p1 = 0.528 #Ratio of critical pressure to Stagnation pressure from gas tables @M = 1
Pt = Po*p1 #critical pressure in bar
p2 = P2/Po #Pressure ratio
M2 = 0.93 #Exit mach number from gas tables @p2,k = 1.4
#Output
print 'Since pressure decreases from %3i kPa to %3.1f kPa from inlet to throat, \
\nit acts as nozzle Since exit pressure %3i kPa is above critical pressure %3.1f kPa, \
\nit acts as diffuser with M = %3.2f Hence the duct acts as Venturi'%(Po,Pt,P2,Pt,M2)
import math
#Input data
A1 = 0.15 #Inlet area in m**2
C1 = 240 #Inlet velocity in m/s
T1 = 300 #Inlet temperature in K
P1 = 0.7 #Inlet pressure in bar
C2 = 120 #Exit velocity in m/s
k = 1.4 #Adiabatic Consmath.tant
R = 287 #Specific gas consmath.tant in J/kg-K
Cp = 1005 #Specific heat capacity at consmath.tant pressure in J/kg-K
#Calculations
a1 = math.sqrt(k*R*T1) #Velocity of sound at inlet in m/s
M1 = C1/a1 #Inlet mach number
d1 = (P1*10**5)/(R*T1) #Density at inlet in kg/s, P1 in Pa
m = d1*A1*C1 #Mass flow rate in kg/s
t1 = 0.913 #Ratio of inlet temperature to Stagnation temperature from gas tables @M1,k = 1.4
To = T1/t1 #Stagnation temperature in K
p1 = 0.727 #Ratio of inlet pressure to Stagnation pressure from gas tables @M1,k = 1.4
Po = P1/p1 #Stagnation pressure in bar
T2 = To-(C2**2/(2*Cp)) #Exit temperature in K
t2 = T2/To #Temperature ratio
M2 = 0.33 #Exit mach number from gas tables @t2,k = 1.4
p2 = 0.927 #Ratio of exit pressure to Stagnation pressure from isentropic gas tables @M2,k = 1.4
P2 = Po*p2 #exit pressure in bar
d2 = (P2*10**5)/(R*T2) #Density at exit in kg/s, P2 in Pa
A2 = (m/(d2*C2)) #Exit area in m**2
ds = 0 #Entropy change in kJ/kg-K, math.since process is isentropic
#Output
print 'A)Mass flow rate is %3.3f kg/s \
\nB)Stagnation pressure at exit is %3.4f bar \
\nC)Stagnation Temperature at exit is %3.3f K \
\nD)Static exit pressure is %3.3f bar \
\nE)Entropy change is %3i kJ/kg-K \
\nF)Exit area is %3.3f m**2'%(m,Po,To,P2,ds,A2)
import math
#Input data
A2 = 645. #Exit area in mm**2
M2 = 2. #Exit mach number
P2 = 1. #exit pressure in bar
T2 = 185. #Exit temperature in K
k = 1.4 #Adiabatic Consmath.tant
R = 287. #Specific gas consmath.tant in J/kg-K
#Calculation
t1 = 0.555 #Ratio of exit temperature to Stagnation temperature from gas tables @M2,k = 1.4
To = T2/t1 #Stagnation temperature in K
p1 = 0.128 #Ratio of exit pressure to Stagnation pressure from isentropic gas tables @M2,k = 1.4
Po = P2/p1 #Stagnation pressure in bar
a1 = 1.687 #Ratio of exit area to critical area from isentropic gas tables @M2,k = 1.4
At = A2/a1 #Critical area in mm**2
d2 = (P2*10**5)/(R*T2) #Density at exit in kg/s, P2 in Pa
C2 = math.sqrt(k*R*T2)*M2 #Exit air velocity in m/s
m = d2*A2*C2*10**-6 #Mass flow rate in kg/s, A2 in m**2
#Output
print 'A)Throat area is %3.2f mm**2 \
\nB)Reservoir pressure is %3.4f bar \
\nC)Reservoir temperature is %3.2f K \
\nD)Mass flow rate is %3.4f kg/s'%(At,Po,To,m)
import math
#Input data
Po = 20. #Stagnation pressure in kPa
To = 1000. #Stagnation temperature in K
P2 = 3. #exit pressure in bar
A2 = 100. #Exit area in cm**2
k = 1.4 #Adiabatic Consmath.tant
R = 287. #Specific gas consmath.tant in J/kg-K
Cp = 1005. #Specific heat capacity at consmath.tant pressure in J/kg-K
#Calculations
p1 = P2/Po #Pressure ratio
M2 = 1.9 #Exit mach number from gas tables @p1,k = 1.4
t1 = 0.581 #Ratio of exit temperature to Stagnation temperature from isentropic gas tables @M2,k = 1.4
T2 = To*t1 #exit temperature in K
C2 = M2*math.sqrt(k*R*T2) #Exit velocity in m/s
a1 = 1.555 #Ratio of exit area to critical area from isentropic gas tables @M2,k = 1.4
At = A2/a1 #critical area in cm**2
p1 = 0.528 #Ratio of critical pressure to Stagnation pressure from gas tables @M = 1
Pt = Po*p1 #critical pressure in bar
t1 = 0.834 #Ratio of critical temperature to Stagnation temperature from gas tables @M = 1
Tt = To*t1 #critical temperature in K
at = math.sqrt(k*R*Tt) #Sound velocity at throat in m/s
Ct = at #Air velocity t throat in m/s, Since M = 1
dt = (Pt*10**5)/(R*Tt) #Density of air at throat in kg/m**3, Pt in Pa
m = dt*At*10**-4*Ct #Mass flow rate in kg/s, At in m**2
C_max = math.sqrt(2*Cp*To) #Maximum possible velocity in m/s
cr = C2/C_max #Ratio of velocities
#Output
print 'A)At Throat: \
\nArea is %3.2f cm**2 \
\nPressure is %3.2f bar \
\nTemperature is %3i K \
\nB)Exit velocity is %3.4f times C_max in m/s \
\nC)Mass flow rate is %3.2f kg/s'%(At,Pt,Tt,cr,m)
import math
#Input data
Po = 7. #Stagnation pressure in bar
To = 100.+273 #Stagnation temperature in K
At = 12. #Critical area in cm**2
A2 = 25.166 #Exit area in cm**2
k = 1.4 #Adiabatic Consmath.tant
R = 287. #Specific gas consmath.tant in J/kg-K
#Calculation
a1 = A2/At #Ratio of areas
#subsonic
M2 = 0.29 #Exit mach number from gas tables @a1,k = 1.4
p1 = 0.943 #Ratio of exit pressure to Stagnation pressure from isentropic gas tables @M2,k = 1.4
P2 = Po*p1 #exit pressure in bar
t1 = 0.983 #Ratio of exit temperature to Stagnation temperature from gas tables @M2,k = 1.4
T2 = To*t1 #Exit temperature in K
C2 = M2*math.sqrt(k*R*T2) #Exit air velocity in m/s
#supersonic
M_2 = 2.25 #Exit mach number from gas tables @a1,k = 1.4
p2 = 0.0865 #Ratio of exit pressure to Stagnation pressure from isentropic gas tables @M2,k = 1.4
P_2 = Po*p2 #exit pressure in bar
t2 = 0.497 #Ratio of exit temperature to Stagnation temperature from gas tables @M2,k = 1.4
T_2 = To*t2 #Exit temperature in K
C_2 = M_2*math.sqrt(k*R*T_2) #Exit air velocity in m/s
d2 = (P2*10**5)/(R*T2) #Density at exit in kg/s, P2 in Pa
m = d2*A2*10**-4*C2 #Mass flow rate in kg/s, A2 in m**2
#Output
print 'A)Maximum mass flow rate is %3.3f kg/s \
\nB)Subsonic exit condition: \
\nTemperature is %3.3f K \
\nVelocity is %3.2f m/s \
\nPressure is %3.3f bar \
\nMach number is %3.2f \
\nSupersonic exit condition: \
\nTemperature is %3.3f K \
\nVelocity is %3.2f m/s \
\nPressure is %3.4f bar \
\nMach number is %3.2f'%(m,T2,C2,P2,M2,T_2,C_2,P_2,M_2)
import math
#Input data
T1 = 335. #Inlet temperature in K
P1 = 655. #Inlet pressure in kPa
C1 = 150. #Inlet velocity in m/s
P2 = 138. #Exit pressure in kPa
T2 = 222. #Exit temperature in K
m = 9. #Mass flow rate in kg/s
Mol = 32. #Molar mass of oxygen in kg/mol
Ri = 8314. #Ideal gas consmath.tant in J/kg-k
k = 1.4 #Adiabatic Consmath.tant
Cp = 915. #Specific heat capacity at consmath.tant pressure in J/kg-K
#Calculation
R = Ri/Mol #Specific gas consmath.tant in J/kg-K
a1 = math.sqrt(k*R*T1) #Sound velocity at inlet in m/s
M1 = C1/a1 #Inlet mach number
t1 = 0.964 #Ratio of inlet temperature to Stagnation temperature from gas tables @M1,k = 1.4
To1 = T1/t1 #Stagnation temperature at inlet in K
p1 = 0.881 #Ratio of inlet pressure to Stagnation pressure at entry from gas tables @M1,k = 1.4
Po1 = P1/p1 #Stagnation pressure at entry in kPa
t2 = 0.834 #Ratio of critical temperature to Stagnation temperature from gas tables @M = 1
Tt = To1*t2 #critical temperature in K
C2 = math.sqrt(C1**2+(2*Cp*(T1-T2))) #Exit velocity in m/s,
a2 = math.sqrt(k*R*T2) #Sound velocity at exit in m/s
M2 = C2/a2 #Exit mach number
p2 = 0.208 #Ratio of exit pressure to Stagnation pressure at exit from isentropic gas tables @M2,k = 1.4
Po2 = P2/p2 #Stagnation pressure at exit in kPa
SPC = (Po1-Po2) #Change in the stagnation pressure between inlet and exit in kPa
ds = R*math.log(Po1/Po2) #Change in entropy in J/kg-K
T2s = T1*((P2/P1)**((k-1)/k)) #Exit temperature at isentropic state in K
eff = ((T1-T2)/(T1-T2s))*100 #Nozzle efficiency in percent
#Output
print 'A)Exit mach number is %3.2f \
\nB)Change in the stagnation pressure between inlet and exit is %3.2f kPa \
\nC)Change in entropy is %3.3f J/kg-K \
\nD)Static temperature at throat is %3.1f K \
\nE)Nozzle efficiency is %3.2f percent'%(M2,SPC,ds,Tt,eff)
# note : rounding off error.
import math
#Input data
C1 = 200. #Inlet velocity in m/s
Po1 = 400. #Stagnation pressure at entry in kPa
To1 = 500. #Stagnation temperature at inlet in K
C2 = 100. #Exit velocity in m/s
eff = 0.9 #Nozzle efficiency
k = 1.4 #Adiabatic Consmath.tant
Cp = 1005. #Specific heat capacity at consmath.tant pressure in J/kg-K
#Calculation
T1 = To1-(C1**2/(2*Cp)) #Inlet temperature in K
t1 = T1/To1 #Temperature ratio
P1 = Po1*t1**(k/(k-1)) #Inlet pressure in kPa
To2s = (eff*(To1-T1))+T1 #Exit Stagnation temperature at isentropic state in K
To2 = To2s #Exit Stagnation temperature in K, Since adiabatic
T2 = To2-(C2**2/(2*Cp)) #Exit temperature in K
t2 = To2s/T1 #Temperature ratio
Po2 = P1*t2**(k/(k-1)) #Stagnation pressure at exit in kPa
t3 = T2/To2 #Temperature ratio
P2 = Po2*t3**(k/(k-1)) #Exit pressure in kPa
Cpr = (P2-P1)/(Po1-P1) #Pressure raise coefficient
ar = (P1*T2*C1)/(P2*T1*C2) #Ratio of exit to inlet area
#Output
print 'A)Pressure raise coefficient is %3.3f \
\nB)Ratio of exit to inlet area is %3.3f'%(Cpr,ar)
import math
#Input data
Po1 = 4.9 #Stagnation pressure at entry in bar
P2 = 1.4 #Exit pressure in bar
To = 810 #Stagnation temperature in K
m = 1 #Mass flow rate in kg/s
eff = 0.9 #Nozzle efficiency
k = 1.4 #Adiabatic Consmath.tant
R = 287 #Specific gas consmath.tant in J/kg-K
Cp = 1005 #Specific heat capacity at consmath.tant pressure in J/kg-K
#Calculations
t1 = 0.834 #Ratio of critical temperature to Stagnation temperature from gas tables @M = 1
Tt = To*t1 #critical temperature in K
at = math.sqrt(k*R*Tt) #Sound velocity at critical state in m/s
Ct = at #Air velocity t throat in m/s, Since M = 1
p1 = 0.528 #Ratio of critical pressure to Stagnation pressure from gas tables @M = 1
Pt = Po1*p1 #critical pressure in bar
dt = (Pt*10**5)/(R*Tt) #Density of air at throat in kg/m**3, Pt in Pa
At = (m/(dt*Ct))*10**4 #Throat area in cm**2
p2 = P2/Po1 #Pressure ratio
T2s = To*p2**((k-1)/k) #Exit temperature in K (at isentropic state)
T2 = To-(eff*(To-T2s)) #Exit temperature in K
d2 = (P2*10**5)/(R*T2) #Density at exit in kg/m**3, P2 in Pa
C2 = math.sqrt(2*Cp*(To-T2)) #Exit air velocity in m/s
A2 = (m/(d2*C2))*10**4 #Exit area in cm**2
a2 = math.sqrt(k*R*T2) #Sound velocity at exit in m/s
M2 = C2/a2 #Exit mach number
p3 = 0.332 #Static to stagnation pressure ratio at exit from isentropic gas tables @M2,k = 1.4
Po2 = P2/p3 #stagnation pressure in bar
TPL = Po1-Po2 #Loss in total pressure is %3.3f bar
ds = R*math.log(Po1/Po2) #Increase in entropy in kJ/kg-K
#Output
print 'A)Throat and exit area are %3.2f cm**2 and %3.3f cm**2 \
\nB)Exit mach number is %3.2f \
\nC)Loss in total pressure is %3.3f bar \
\nD)Increase in entropy is %3.2f kJ/kg-K'%(At,A2,M2,TPL,ds)
import math
#Input data
Po = 3.5 #Stagnation pressure in bar
To = 425.+273 #Stagnation temperature in K
P2 = 0.97 #Exit pressure in bar
m = 18. #Mass flow rate in kg/s
Kd = 0.99 #Coefficient of discharge
eff = 0.94 #Nozzle efficiency
k = 1.33 #Adiabatic Consmath.tant
Cp = 1110. #Specific heat capacity at consmath.tant pressure in J/kg-K
#Calculations
Pt = Po*(2/(k+1))**(k/(k-1)) #critical pressure in bar
Tt = To*(2/(k+1)) #critical temperature in K
R = Cp/(k/(k-1)) #Specific gas consmath.tant in J/kg-K
m_s = m/Kd #Isentropic mass
at = math.sqrt(k*R*Tt) #Sound velocity at throat in m/s
Ct = at #Air velocity t throat in m/s, Since M = 1
dt = (Pt*10**5)/(R*Tt) #Density of air at throat in kg/m**3, Pt in Pa
At = (m_s/(dt*Ct))*10**4 #Throat area in cm**2
p2 = P2/Po #Pressure ratio
T2s = To*p2**(1/(k/(k-1))) #Exit temperature in K (at isentropic state)
T2 = To-(eff*(To-T2s)) #Exit temperature in K
d2 = (P2*10**5)/(R*T2) #Density at exit in kg/m**3, P2 in Pa
C2 = math.sqrt(2*Cp*(To-T2)) #Exit air velocity in m/s
A2 = (m_s/(d2*C2))*10**4 #Exit area in cm**2
#Output
print 'Throat area and Exit area of nozzle are %3.1f cm**2 and %3.1f cm**2'%(At,A2)
# note : rounding off error.