#Calulate the final velocity of duck after being hit by a bullet
# Variables
m_duck=3. #lbm
v_duck=-15. #ft/s due west
m_bullet=0.05 #lbm
v_bullet=1000. #ft/s due east
# Calculation
#total initial momentum = final momentum
v_sys=((m_duck*v_duck)+(m_bullet*v_bullet))/(m_duck+m_bullet)#ft/s
# Result
print "The final velocity of the duck is %f ft/s"%v_sys
#calculate the force required to hold of water from a hoze
# Variables
rho=998.2 #Kg/m^3
q=0.01 #m^3/s
v_initial=30. #m/s
v_final=0. #m/s
# Calculation
F=q*rho*(v_final-v_initial) #N
# Result
print "The force required to hold of water from a hoze %f N"%F
#calculate the force required to hold of water from a hoze
# Variables
rho=998.2 #Kg/m^3
q=0.01 #m^3/s
v_initial=30. #m/s
v_final=-15. #m/s
# Calculation
F=q*rho*(v_final-v_initial) #N
# Result
print "The force required to hold of water from a hoze %f N"%F
#Calculate the force exerted on the flange when the valve of the nozzle is closed
# Variables
#Let the gauge pressure be denoted by Pg
Pg=100. #lbf/in^2
A=10. #in^2
# Calculation
#F_bolts = -F_liq-F_atm
#F_bolts = -(Pg + P_atm)A - (-P_atm.A)
#F_bolts = -Pg.A
F_bolts=-Pg*A
# Result
print "The force exerted on the flange when the valve of the nozzle is closed is %d lbf"%F_bolts
#Calculate the force exerted on the flange
# Variables
dP=100. #lbf/in^2
A_out=1. #in^2
rho=62.3 #lbm/ft^3
ratio_A=0.1 #dimentionless
# Calculation
#1 ft = 12 in
#1 lbf.s^2 = 32.2 lbm.ft
v_out=(2*dP/rho/(1-ratio_A**2)*32.2*144)**0.5 #ft/s
v_in=12.3 #ft/s
m=rho*A_out*v_out/144. #lbm/s
F=m*(v_out-v_in)/32.2 #lbf
# Result
print "The force exerted on the flange is %f lbf"%F
#Calculate the support forces in x and y direction in a 90 degree bend tube
# Variables
p1=200. #KPa
A=0.1 #m^2
m=500. #Kg/s
rho=998.2 #Kg/m^3
q=m/rho #m^3/s
v=q/A #m/s
Vx_initial=v #m/s
Vx_final=0. #m/s
Vy_initial=0. #m/s
Vy_final=-v #m/s
# Calculation and Result
neg_Fx=m*(Vx_final-Vx_initial)-p1*1000*A #N
Fx = neg_Fx
print "The support force in the x direction is %f N"%Fx
neg_Fy=m*(Vy_final-Vy_initial)-p1*1000*A#N
Fy = neg_Fy
print "The support force in the y direction is %f N"%Fy
#Calculate the thrust on a rocket
# Variables
m=1000. #Kg/s
v_out=-3000. #m/s its in the negative y direction
v_in=0. #m/s
A=7. #m^2
P=35000. #Pa
# Calculation
F_thrust=(-m*(v_out-v_in)+P*A)/1000000.0 #MN
# Result
print "The thrust on the rocket is %f MN"%F_thrust
#Calculate the specific impulse for a rocket
# Variables
Vy_exh=-3000. #m/s in negative y direction
# Calculation
Isp=-Vy_exh/1000.0 #KN.s/Kg
# Result
print "The specific impulse on the rocket is %d KN.s/Kg"%Isp
#Calculate the Mass air flow rate required by a jet engine
# Variables
F_thrust=20000. #lbf
Vx_out=1350.0 #ft/s
Vx_in=0. #ft/s
# Calculation
#1 lbf.s^2 = 32.2 lbm.ft
m=F_thrust/(Vx_out-Vx_in)*32.2 #lbm/s
# Result
print "The mass air flow rate required by a jet engine is %d lbm/s"%m
#Calculate the final velocity of a rocket after launch
import math
# Variables
Isp=430. #lbf.s/lbm specific impulse
#1 lbf.s^2 = 32.2 lbm.ft
Vrel_out=-Isp*32.2 #ft/s
ratio_m=0.1 #dimentionless (ratio of final mass to initial mass)
# Calculation
v_final=Vrel_out*math.log(ratio_m) #ft/s
# Result
print "The velocity of the rocket after launch is %d ft/s"%v_final
#Calculate the velocity and height of flow in an open channel
# Variables
v1=4. #ft/s
g=32.2 #ft/s^2
z1=0.0005 #ft
Fr=v1**2/(g*z1) #dimentionless (Fraude number)
ratio_z=-0.5+(0.25+2*Fr)**0.5 #dimentionless
# Calculation
#ratio_z = z2/z1
z2=ratio_z*z1 #ft
#print "The height of flow in open channel is %f ft"%z2
v2=v1/(ratio_z) #ft/s
# Result
print "The velocity of flow in open channel is %f ft/s"%v2
#calculate the verticle downward velocity of air hitting an aircraft wing
# Variables
l=15. #m length of wing
b=3. #m thickness of wing
A=l*b #m^2 area of the colliding surface of the wing
rho_air=1.21 #Kg/m^3
Vx=50. #m/s
m=rho_air*A*Vx #Kg/s
Fy=9810. #N Weight of the aircraft
# Calculation
Vy=Fy/m #m/s
# Result
print "The verticle downward velocity of air hitting the aircraft wing is %f m/s"%Vy
#Calculate the ratio of the total weight of the aircraft to the weight of engine
# Variables
#Let ratio of weight to thrust be denoted by r1
#Let ratio of thrust to the engine weight be denoted by r2
r1=10. #dimentionless
r2=2. #dimentionless
# Calculation
#weight/engine wt = (weight/thrust)*(thrust/engine wt)
#let ratio of total wt to engine wt be denoted by r3
r3=r1*r2 #dimentionless
# Result
print "The ratio of the total weight of the aircraft to the weight of engine is %d"%r3
#Calculate the torque exerted on the rotor in a centrifugal pump
import math
# Variables
q=100. #gal/min
rho=8.33 #lbm/gal
m=rho*q #lbm/min
f=1800. #rev/min frequency of impeller
omega=2*(math.pi)*f #rad/min
r_in=1/12.0 #ft
r_out=6/12.0 #ft
# Calculation
#1 min = 60 sec
#1 lbf.s^2 = 32.2 lbm.ft
tou=m*omega*(r_out**2-r_in**2)/32.2/3600. #lbf.ft
# Result
print "The torque exerted on the rotor is %f lbf.ft"%tou