import math
# Variables
v1_total = 7; # in m**3/min
v_s1 = 0.35; # in m**3/kg
v_s2 = 0.12; # in m**3/kg
p1 = 1; # in bar
p1 = p1 * 10**5; # in N/m**2
p2 = 6; # in bar
p2 = p2 * 10**5; # in N/m**2
D1 = 110; # in mm
D1 = D1 * 10**-3; # in m
D2 = 65; # in mm
D2 = D2 * 10**-3; # in m
# Calculations and Results
Af1 = math.pi/4*D1**2; # in m**2
Af2 = math.pi/4*D2**2; # in m**2
# v1_total = m1 * v_s1
m1 = v1_total / v_s1; #in kg/min
print "The mass flow rate of air in kg/min is :",m1
m2 = m1; # in kg/min
v2_total = m2 * v_s2; # in m**3/min
del_W_flow = (p2 * v2_total) - (p1 * v1_total); # in J/min
print "The change in the work flow in kJ/min is : ",del_W_flow*10**-3
v_f1 = v1_total/Af1; # in m/min
v_f2 = v2_total /Af2; #in m/min
del_v = v_f2 - v_f1; # in m/min
print "Change in velocity of the air flow in m/min is : %.2f"%del_v
# Variables
m = 2.; # in kg per min
m = m / 60; # in kg per sec
W = 20; # in kW
h1 = 1400; # in kJ/kg
h2 = 1300; # in kJ/kg
# Calculations
Q = (m * (h2 - h1)) + W; # in kJ/s
# Results
print "Rate of heat transfer to the water jacket in kJ/sec %.2f"%Q
# Variables
g= 9.81;
p1 = 3; # in Mpa
p2 = 10; # in kPa
T1 = 350; # in °C
T1 = T1 + 273; # in K
m = 1; # in kg per sec
v1 = 50; # in m per sec
v2 = 120; # in m per sec
z1 = 2; # in m
z2 = 5; # in m
C_p = 1.005; # in kJ per sec
Q = 5; # in kJ per sec
# Calculations and Results
Q = -(Q) * 10**3; # in J per sec
T2 = (p2 * T1)/p1; # in K
del_h = C_p * (T2-T1); # in kJ
del_h = del_h * 10**3; # in J
t = m * ( del_h +(v2**2-v1**2)/2 + (g * (z2 - z1))); # t is variable taken for calculation
W_s = Q - t; # in J per sec
W_s = W_s * 10**-6; # in MW
print "The power output of the turbine in MW is : %.3f"%W_s
# If kinetic and potential energy are ignored then
W_s2 = Q -(m * del_h); # in J per sec
W_s2 = W_s2 * 10**-6; # in MW
errorIntroduced= (abs(W_s)-abs(W_s2))/abs(W_s)*100; # in %
print "Total error introduced in %% is : %.1f"%errorIntroduced
# Variables
h1 = 246.6; # in kJ/kg
h2 = 198.55; # in kJ/kg
W = 0;
g= 9.8;
Q= -(105000); # in kJ per hr
# Calculations
# m * (h1 + ((v1***2)/(2*1000)) + ((g * z1)/1000)) + Q = m * (h2 + ((v2**2)/(2*1000)) + ((g * z2)/1000)) + W
# v1 and v2 is change in velocity is neglected and z2 = z1 + 10
m = Q/( (h2-h1) + ((g * 10)/1000) ); # kg per hr
# Results
print "Quantity of water circulated through the pipe in kg/hr is : %.2f"%m
import math
# Variables
#Given data
m=15.; # in kg/min
m= m/60; # in kg/sec
H1= 5; # in kJ/kg
H1= H1*10**3; # in J/kg
H2= 173; # in kJ/kg
H2= H2*10**3; # in J/kg
V1= 5; # in m/s
V2= 7.5; # in m/s
Q= 760; # in kJ/min
Q= Q*10**3/60; # in J/s
# Calculations and Results
# Formula (H1+V1**2/2)+(-Q)= (H2+V2**2/2)+W
W= (H1+V1**2/2)+(-Q)-(H2+V2**2/2); # in W/kg
W= W*10**-3; # in kW/kg
# The work done will be
W= m*W; # in kW
P= abs(W); # in kW
print "Power of the motor required to drive the compressor in kW is : %.2f"%P
# Part (b)
v1= 0.5; # in m**3/kg
v2= 0.15; # in m**3/kg
# A1/A2= rho2*V2/(rho1*V1) = v1*V2/(v2*V1)
ratioOFA1andA2= v1*V2/(v2*V1);
radioOFd1andd2= math.sqrt(ratioOFA1andA2);
print "Ratio of inlet pipe diameter to outlet pipe diameter is : %.2f"%radioOFd1andd2