#Calculate the increase in temperature due to falling water of waterfall
# Variables
g=9.81; #m/s^2 acc. due to gravity
dz=100.; #m Height of waterfall
# Calculation
du=g*dz; #J/kg Change in internal energy
Cv=4184.0; #J/kg/K;
dT=du/Cv #K Change in temperature
# Result
print "Change in temperature is %f K or degree centigrade"%dT
#calculate velocity of air coming out from the nozzle
# Variables
T=528. #R Rankine scale
R=10.73; #psi.ft^3/R/lbmol universal gas constant
p=14.71 #psi
p_atm=14.7; #psi
M=29.; #lbm/lbmol
# Calculation
#considering the velocity at the start of the nozzle is negligible
v=((2*R*T/p/M)*(p-p_atm)*(144*32.2))**0.5; #ft/s
# Result
print "Velocity of the air flowing out of the pipe %f ft/s"%v
#Calculate the velocity of water flowing out of a nozzle at the bottom of a tank
# Variables
g=32.2; #ft/s^2
h=30.; #ft height tank
# Calculation
#considering the velocityof water at the top of the tank is negligible
v=(2*g*h)**0.5; #ft/s
# Result
print "The velocity of the water flowing out through the nozzle is %f ft/s"%v
#calculate velocity of water flowing out of nozzle
# Variables
A_nozzle=1.0 #ft^2
A_tank=4.0 #ft^2
g=32.2 #ft/s^2
h=30. #ft
# Calculation
v=(2*g*h/(1-(A_nozzle/A_tank)**2))**0.5 #ft/s
# Result
print "The velocity of water flowing out of nozzle is %f ft/s"%v
#calculate the velocity of water flowing out of a nozzle
# Variables
g=32.2 #ft/s^2
h=30. #ft
M_air=29. #dimentionless (molecular weight)
M_CO2=44. #dimentionless (molecular weight)
# Calculation
v=(2*g*h*(1-(M_air/M_CO2)))**0.5 #ft/s
# Result
print "The velocity of water flowing out of nozzle is %f ft/s"%v
#calculate velocity of sailboat using pitot tube
# Variables
h=1. #m height of water above the water level
g=9.81 #m/s^2
# Calculation
v=(2*g*h)**0.5 #m/s
# Result
print "The velocity of sailboat is %f m/s"%v
#Calculate velocity of air flowing through an air duct
# Variables
dP=0.05 #psi or lbf/in^2
rho_air=0.075 #lbm/ft^3
#1ft = 12in
#1 lbf.s^2 = 32.2 lbm.ft
# Calculation
v=(2*dP*144*32.2/rho_air)**0.5 #ft/s
# Result
print "The velocity of air in the air duct is %f ft/s"%v
#calculate volumetric flow rate using a venturi-meter
import math
# Variables
dP=1. #psi
rho_water=62.3 #lbm/ft^3
d1=1. #ft area at pt 1 in venturimeter
A1=(math.pi)*d1**2/4.0 #ft^2
d2=0.5 #ft
A2=(math.pi)*d2**2/4.0 #ft^2
#1ft = 12in
# Calculation
#1 lbf.s^2 = 32.2 lbm.ft
v=((2*dP*144*32.2/rho_water)/(1-(A2/A1)**2))**0.5 #ft/s
q=v*A2 #ft^3/s
# Result
print "The velocity of the water flowing through venturimeter is %f ft/s"%v
print "The volumetric flow rate of water is %f ft^3/s"%q
#calculate actual volumetric flow rate using a venturi-meter
import math
# Variables
dP=1. #psi
rho_water=62.3 #lbm/ft^3
d1=1. #ft area at pt 1 in venturimeter
A1=(math.pi)*d1**2/4 #ft^2
d2=0.5 #ft
A2=(math.pi)*d2**2/4 #ft^2
#1ft = 12in
# Calculation
#1 lbf.s^2 = 32.2 lbm.ft
v_th=((2*dP*144*32.2/rho_water)/(1-(A2/A1)**2))**0.5 #ft/s
Cv=0.984 #dimentionless
v_act=Cv*v_th #ft/s actual velocity
q=v_act*A2 #ft^3/s
# Result
print "The velocity of the water flowing through venturimeter is %f ft/s"%v_act
print "The volumetric flow rate of water is %f ft^3/s"%q
#Calculate the pressure difference in a pipe
import math
# Variables
v1=1. #m/s
d1=0.4 #m
A1=(math.pi)*d1**2/4 #m^2
d2=0.2 #m
A2=(math.pi)*d2**2/4 #m^2
v2=A1*v1/A2 #m/s
Cv=0.62 #dimentionless
rho_water=998.2 #kg/m^3
# Calculation
dP=(rho_water*v2**2/2/Cv**2)*(1-(A2/A1)**2)/1000. #KPa
# Result
print "The pressure difference in the pipe is %f KPa"%dP
#Calculate the flow rate of helium with rotameter caliberated with nitogen
# Variables
M_N2=28. #dimentionless
M_He=4. #dimentionless
#Density is proportional to molecular weight
q_N2=100. #cm^3/min
# Calculation
q_He=q_N2*(M_N2/M_He)**0.5 #cm^3/min
# Result
print "The flow rate of Helium is %f cm^3/min"%q_He
#Calculate the absolute pressure at the top of a inverted manometer tube
# Variables
p_atm=14.7 #lbf/in^2
g=32.2 #ft/s^2
#one end of the inverted manometer is immersed in a tank and the other end is open to atmosphere 10 ft below tank level
#pt 1 is at tank water level, pt 2 is at top of inverted manometer and pt3 is at the other end of manometer
dh=10. #ft
v3=(2*g*dh)**0.5 #ft/s
p1=p_atm #lbf/in^2
rho_water=62.3 #lbm/ft^3
#Difference of height between pt 1 and pt 2 is 40 ft
dh1=40. #dft
# Calculation
p2=p1-(rho_water*v3**2/2/32.2/144)-(rho_water*g*dh1)/32.2/144 #lbf/in^2
# Result
print "The absolute pressure at the top of the inverted manometer is %f lbf/in^2"%p2
#Calculate pressure at the throat in a venturimeter
# Variables
dP=10. #psi or lbf/in^2
rho_water=62.3 #lbm/ft^3
#1ft = 12in
# Calculation and Result
#1 lbf.s^2 = 32.2 lbm.ft
v3=(2*dP*144*32.2/rho_water)**0.5 #ft/s
print "The velocity of water after the throat is %f ft/s"%v3
ratio_A=0.5 #dimentionless (ratio of throat area to pipe area)
v2=v3/ratio_A #ft/s
print "The velocity of water at the throat is %f ft/s"%v2
P1=24.7 #psia
rho_water=62.3 #lbm/ft^3
P2=P1-(rho_water)*v2**2/32.2/144/2 #psia
print "The pressure of water at the throat is %f psia"%P2