import math
# Variables
V1 = 300.; #m/s
p1 = 78.; #kN/m**2
T1 = 313.; #K
p2 = 117.; #kN/m**2
R = 287.; #J/kg K
y = 1.4;
# Calculations
#Let r1 = p1/rho1
r1 = R*T1;
V2 = math.sqrt(2*(y/(y-1)*r1*(1-(p2/p1)**((y-1)/y)) + V1**2/2));
# Results
print ("Velocity of gas at section 2 = %.3f")% (V2), ("m/s")
# Variables
p1 = 35.; #kN/m**2
V1 = 30.; #m/s
T1 = 423.; #K
V2 = 150.; #m/s
R = 290.; #J/kg K
y = 1.4;
# Calculations
#Let r1 = p2/p1
r1 = R*T1;
p2 = p1*(1-((V2**2/2-V1**2/2)*(y-1)/y/r1))**(y/(y-1));
print ("pressure = %.3f")% (p2), ("kN/m**2")
T2 = T1*(p2/p1)**((y-1)/y);
t2 = T2-273;
print ("temperature = %.3f")% (t2), ("°C")
import math
# Variables
SG = 0.8;
rho_oil = 800.; #kg/m**3
K_oil = 1.5*10**9; #N/m**2; crude oil
K_Hg = 27*10.**9; #N/m**2; Mercury
rho_Hg = 13600.; #kg/m**3
# Calculations and Results
C_oil = math.sqrt(K_oil/rho_oil);
print ("Sonic velocity of crude oil = %.3f")% (C_oil), ("m/s")
C_Hg = math.sqrt(K_Hg/rho_Hg)
print ("Sonic velocity of Mercury = %.3f")% (C_Hg), ("m/s")
import math
# Variables
T = 228.; #K
M = 2.;
R = 287.; #Jkg K
y = 1.4;
# Calculations
C = math.sqrt(y*R*T);
V = M*C*3600./1000;
# Results
print ("Velocity of the plane = %.3f")% (V), ("km/h")
# Variables
a = 40*math.pi/180; #Mach angle in radians
y = 1.4;
R = 287.; #J/kg K
T = 288.; #K
# Calculations
C = math.sqrt(y*R*T);
V = C/math.sin(a);
# Results
print ("Velocity of bullet = %.3f")% (V), ("m/s")
import math
# Variables
p = 88.3; #kN/m**2
T = 271.; #K
M = 40.*math.pi/180;
y = 1.4;
R = 287.; #J/kg K
# Calculations
C = math.sqrt(y*R*T);
V = C/math.sin(M);
# Results
print ("Velocity of the projectile = %.3f")% (V), ("m/s")
import math
# Variables
h = 1800.; #m
T = 277.; #K
t = 4.; #s
y = 1.4;
R = 287.; #J/kg K
# Calculations
C = math.sqrt(y*R*T);
a = (math.cos(C/h*t));
V = C/math.sin(a)*3600/1000;
# Results
print ("Speed of the aircraft = %.3f")% (V), ("km/h")
import math
# Variables
R = 287.; #J/kg K
y = 1.4;
V0 = 1000.*1000/3600; #m/s
p0 = 78.5; #kN/m**2
T0 = 265.; #K
# Calculations and Results
C0 = math.sqrt(y*R*T0);
M0 = V0/C0;
ps = p0*(1+((y-1)/2*M0**2))**(y/(y-1));
print ("(i) Stagnation pressure = %.3f")%(ps), ("kN/m**2")
Ts = T0*(1+((y-1)/2*M0**2));
print ("(ii) Stagnation temperature = %.3f")% (Ts), ("K")
rho_s = ps*10**3/R/Ts;
print ("(iii) Stagnation density = %.3f")%(rho_s), ("kg/m**3")
import math
# Variables
V0 = 1000.*1000./3600; #m/s
T0 = 320.; #K
p_atm = 98.1; #kN/m**2
p = 9.81; #kN/m**2
p0 = 98.1-p;
R = 287.; #J/kg K
y = 1.4;
# Calculations and Results
C0 = math.sqrt(y*R*T0);
M0 = V0/C0;
ps = p0*(1+((y-1)/2*M0**2))**(y/(y-1));
print ("Stagnation pressure = %.3f")% (ps), ("kN/m**2")
Ts = T0*(1+((y-1)/2*M0**2));
print ("Stagnation temperature = %.1f")% (Ts), ("K")
rho_s = ps*10**3/R/Ts;
print ("Stagnation density = %.3f")% (rho_s), ("kg/m**3")
M = 0.8;
CF = 1+(M0**2./4)+((2-y)/24.*M0**4);
print ("Compressibility factor %.2f")% (CF)
#Note : Answers are slightly different because of rounding error.
import math
# Variables
R = 287.; #J/kg K
y = 1.4;
p0 = 220.*10**3; #N/m**2
T0 = 300.; #K
V0 = 200.; #m/s
# Calculations and Results
C0 = math.sqrt(y*R*T0);
rho_0 = p0/R/T0;
print ("Stagnation pressure = ")
print ("(i) Compressibility is neglected")
ps = (p0+rho_0*V0**2/2)/10**3;
print ("ps = %.3f")% (ps), ("kN/m**2")
print ("(ii) Compressibility is accounted for")
M0 = V0/C0;
ps = (p0+rho_0*V0**2/2*(1+M0**2./4+(2-y)/24*M0**4))/10**3;
print ("ps = %.3f")% (ps), ("kN/m**2")
import math
# Variables
p0 = 35.*10**3; #Pa
T0 = 235.; #K
ps = 65.4*10**3; #N/m**2
R0 = 8314.; #Nm/mole K
M = 28.;
# Calculations
R = R0/M;
rho_0 = p0/R/T0;
Va = math.sqrt(2*(ps-p0)/rho_0);
# Results
print ("Speed of the aircraft = %.3f")% (Va), ("m/s")
import math
# Variables
p0 = 30.*10**3; #N/m**2
V0 = 152.; #m/s
y = 1.4;
rho_0 = 1.224; #kg/m**3
ps = p0+rho_0*V0**2/2;
# Calculations
rho_0 = 0.454; #kg/m**3
V0 = math.sqrt(2*(ps-p0)/rho_0);
C0 = math.sqrt(y*p0/rho_0);
M = V0/C0;
ccf = (1+M**2/4); #Compressibility correction factor
V = V0/math.sqrt(ccf); #True speed of aircraft
# Results
print ("True speed of aircraft = %.3f")% (V), ("m/s")
import math
# Variables
M = 3.; #Mach number
d = 0.2; #m
p_nozzle = 7.85; #kN/m**2
T_nozzle = 200.; #K
y = 1.4;
# Calculations and Results
A = math.pi/4*d**2;
p_res = p_nozzle*(1+((y-1)/2*M**2))**(y/(y-1));
print ("Reservoir pressure = %.3f")% (p_res), ("kN/m**2")
T_res = T_nozzle*(1+((y-1)/2*M**2));
print ("Reservoir temperature = %.3f")% (T_res), ("K")
Ac = A*M/((2+(y-1)*M**2)/(y+1))**((y+1)/2/(y-1));
print ("Throat area (critical) = %.5f")% (Ac), ("m**2")
import math
# Variables
R = 287.; #J/kg K
y = 1.4;
p_atm = 100.; #kN/m**2
p1 = 284. + p_atm; #kN/m**2
T1 = 297.; #K
D = 0.02; #m
# Calculations
A2 = math.pi/4*D**2;
rho_1 = p1*10**3/R/T1;
m_max = 0.685*A2*math.sqrt(p1*10**3*rho_1);
# Results
print ("Maximum flow rate = %.3f")% (m_max), ("kg/s")
# Variables
R = 287.; #J/kg K
y = 1.4;
p1 = 2500.*10**3; #N/m**2
T1 = 293.; #K
p2 = 1750.*10**3; #N/m**2
# Calculations
rho_1 = p1/R/T1;
V2 = math.sqrt(2*y/(y-1)*p1/rho_1*(1-(p2/p1)**((y-1)/y)));
# Results
print ("Velocity of air = %.3f")% (V2),("m/s")
import math
# Variables
R = 287.; #J/kg K
y = 1.4;
p_atm = 10.**5; #N/m**2
T1 = 293. #K
D2 = 0.025; #m
p1 = 140.*10**3; #N/m**2
# Calculations and Results
A2 = math.pi/4*D2**2;
print ("(i) Mass rate of flow of air when pressure in the math.tank is 140 kN/m2 (abs.)")
rho_1 = p1/R/T1;
p2 = 10**5; #N/m**2
m = A2*math.sqrt(2*y/(y-1)*p1*rho_1*((p2/p1)**(2/y) - (p2/p1)**((y+1)/y)));
print ("m = %.3f")% (m), ("kg/s")
print ("(ii) Mass rate of flow of air when pressure in the math.tank is 300 kN/m2 (abs.)")
p1 = 300.*10**3; #N/m**2
p2 = 10.**5; #N/m**2
rho_1 = p1/R/T1;
print ("The pressure ratio p2/p1 being less than the critical ratio 0.528, the flow in the nozzle will be sonic");
m_max = 0.685*A2*math.sqrt(p1*rho_1);
print ("m_max = %.3f")% (m_max), ("kg/s")
import math
# Variables
p1 = 200.; #kN/m**2
V1 = 170.; #m/s
T1 = 473.; #K
A1 = 0.001; #m**2
R = 287.; #J/kg K
cp = 1000.; #J/kg K
y = 1.4;
# Calculations and Results
print ("(i) Stagnation temperature (Ts) and stagnation pressure (ps)")
Ts = T1+V1**2/2/cp;
print ("Ts = %.3f")% (Ts), ("K")
ps = p1*(Ts/T1)**(y/(y-1));
print ("ps = %.3f")% (ps), ("kN/m**2")
print ("(ii) Sonic velocity and Mach number at this section")
C1 = math.sqrt(y*R*T1);
print ("Sonic velocity = %.3f")% (C1), ("m/s")
M1 = V1/C1;
print ("Mach number = %.3f")% (M1)
print ("(iii) Velocity, Mach number and flow area at outlet section where pressure is 110 kN/m2")
p2 = 110.; #kN/m**2
M2 = math.sqrt(2/(y-1)*((ps/p2)**((y-1)/y) - 1));
print ("M2 = %.3f")% (M2)
T2 = Ts*(p2/ps)**((y-1)/y);
C2 = math.sqrt(y*R*T2);
V2 = M2*C2;
print ("V2 = %.3f")% (V2), ("m/s")
A2 = (p1*A1*V1*T2/T1/p2/V2)*10**6;
print ("A2 = %.3f")% (A2), ("mm**2")
print ("(iv) Pressure (pt), temperature (Tt), velocity (Vt), and flow area (At) at throat of the nozzle")
Mt = 1.;
Tt = Ts/(1+(y-1)/2*Mt**2);
print ("Tt = %.3f")% (Tt), ("K")
pt = ps*(Tt/Ts)**(y/(y-1));
print ("pt = %.3f")% (pt), ("kN/m**2")
Ct = math.sqrt(y*R*Tt);
Vt = Mt*Ct;
At = (p1*A1*V1*Tt/T1/pt/Vt)*10**6;
print ("At = %.3f")% (At), ("mm**2")
import math
# Variables
y = 1.4;
p1 = 26.5; #kN/m**2
rho_1 = 0.413; #kg/m**3
M1 = 2.;
R = 287.;
# Calculations and Results
M2 = math.sqrt(((y-1)*M1**2 + 2)/(2*y*M1**2 - (y-1)));
print ("Mach number M2 = %.3f")% (M2)
p2 = p1*(2*y*M1**2 - (y-1))/(y+1);
print ("p2 = %.3f")% (p2), ("kN/m**2")
rho_2 = rho_1*((y+1)*M1**2)/((y-1)*M1**2 + 2);
print ("density, rho_2 = %.3f")% (rho_2), ("kg/m**3")
T1 = p1*10**3/rho_1/R;
print ("T1 = %.3f")% (T1), ("K")
T2 = T1*((y-1)*M1**2 + 2)*(2*y*M1**2 - (y-1))/((y+1)**2*M1**2);
print ("T2 = %.3f")% (T2), ("K")
C1 = math.sqrt(y*R*T1);
V1 = M1*C1;
print ("V1 = %.3f")% (V1), ("m/s")
C2 = math.sqrt(y*R*T2);
V2 = M2*C2;
print ("V2 = %.3f")% (V2), ("m/s")
import math
# Variables
M1 = 1.5;
p1 = 170.; #kN/m**2
T1 = 296.; #K
y = 1.4;
# Calculations and Results
print ("(i) Pressure, temperature and Mach number downstream of the shock")
p2 = p1*(2*y*M1**2 - (y-1))/(y+1);
print ("p2 = %.3f")% (p2), ("kN/m**2")
T2 = T1*((y-1)*M1**2 + 2)*(2*y*M1**2 - (y-1))/(y+1)**2/M1**2;
print ("T2 = %.3f")% (T2), ("K")
M2 = math.sqrt(((y-1)*M1**2 + 2)/(2*y*M1**2 - (y-1)));
print ("M2 = %.3f")% (M2)
strength = p2/p1 - 1;
print ("Strength of stock = %.3f")% (strength)