import math
#Initialization of variables
g = 9.81 #kN/m**3
V2 = 12. #velocity - m/s
V3 = 12. #m/s
A2 = 10.**2
A1 = 15.**2
A3 = 7.5**2
t1 = 15.
t2 = 30.
#calculations
V1 = (A2*V2 + A3*V3)/A1
Q1 = round(math.pi /4 *A1*10**-4 *V1,3)
Q2 = round(math.pi /4 *A2*10**-4 *V2,3)
Q3 = round(math.pi /4 *A3*10**-4 *V3,3)
P1g = round(V3**2 /(2*g) - V1**2 /(2*g),2)
P1 = round(P1g*g,1)
rho = 10**3
V2x = V2*math.cos(math.radians(t1))
V3x = V3*math.cos(math.radians(t2))
V1x = V1
Fx = -P1*A1*10**-4 + (rho*Q2*V2x + rho*Q3*V3x - rho*Q1*V1x)
Fx = Fx*10**-3
V2y = V2*math.sin(math.radians(t1))
V3y = -V3*math.sin(math.radians(t2))
V1y = 0
Fy = rho*Q2*V2y +rho*Q3*V3y -rho*Q1*V1y
Fy = Fy*10**-3
Fnlx = 0.659 - Fx
#Results
print "Force in x directio = %.3f kN"%(Fx)
print " Force in y direction = %.3f kN"%(Fy)
print "(Fl/n)x = %.3f kN"%Fnlx
print "(Fl/n)y = %.3f kN"%-Fy
# rounding off error
#Initialization of variables
V1x = 100. #ft/sec
V2x = 0.866*95
V1y = 0.
V2y = .5*95
A1 = 0.0218 #ft**2
#calculations
Q = A1*V1x
rho = 1.94
Fx = rho*Q*(V2x-V1x)
Fxr = -Fx
Fy = rho*Q*(V2y-V1y)
#Results
print "Horizontal force on the blade = %.1f lb"%(Fxr)
print " Vertical force on the blade = %.f lb"%(Fy)
import math
#Initialization of variables
v2 = 36. #fps
beta = 150. #degrees
u = 60. #velocity - fps
rho = 1.94
Qd = 0.0218
V1 = 100. #fps
gam = 62.4
g = 32.2
#calculations
v2s = v2*math.sin(math.radians(beta))
v2c = u+v2*math.cos(math.radians(beta))
V2 = 34. #fps
alpha = 32 #degrees
Fx = rho*Qd*(v2c-V1)*(V1-u)
Fy = -rho*Qd*(V1-u)*v2s
Fx2 = rho*Qd*V1*(v2c-V1)
HPin = gam*Qd*V1*(V1**2 /(2*g))/550
HPout = gam*Qd*V1*(V2**2 /(2*g))/550
HPtransfer = -Fx2*u/550
HPfl = HPin-HPout-HPtransfer
#Results
print "Force exerted by water on the vane = %d lb"%(Fx2)
print " Friction loss = %.1f hp "%(HPfl)
# rounding off error
import math
#Initialization of variables
z1 = 35. #ft
z3 = 20. #ft
P1 = 30. #psi
g = 32.2
z2 = 10. #ft
d2 = 4. #in
rho = 1.94
be = 20. #degrees
W = 150. #lb
#calculations
V3 = math.sqrt(2*g*(P1*144/55 + z1-z3))
Q = 3.81 #cfs
V2 = 43.6 #fps
P2 = round(55*(z3+ V3**2/(2*g) - z2 - V2**2/(2*g))/144,1)
Fx = round(P2*math.pi/4 *d2**2 - rho*55/62.4 *Q*(V3*math.cos(math.radians(be)) - V2) )
Fy = rho*55/62.4 *Q*(V3*math.sin(math.radians(be)) ) + W
Fres = math.sqrt(Fx**2 + Fy**2)
Fsx = rho*Q*55/62.4*(V3*math.cos(math.radians(be)) )
#calculations
print " resultant force = %.f lb"%(Fy)
print " horizontal component of force = %d lb"%(Fsx)
import math
#Initialization of variables
omega = 300. #rpm
r1 = 1.6 #ft
Q = 120. #cfs
z = 0.8 #ft
beta1 = 80. #degrees
r2 = 1. #ft
rho = 1.94
g = 32.2
gam = 62.4
#calculations
print ("part a")
u1 = round((2*math.pi/60)*omega*r1,1)
Vr1 = round(Q/(2*math.pi*r1*z),2)
v1 = round(Vr1/math.sin(math.radians(beta1)),2)
v2c = round(v1*math.cos(math.radians(beta1)),1)
V1c = round(u1+v2c,1)
u2 = round((2*math.pi/60)*omega*r2,1)
Vr2 = round(Vr1*(r1/r2),1)
beta2 = Vr2/u2
beta = 37.2
print "required Blade angle = %.1f degrees"%(180-beta)
print ("part b")
T = round(rho*Q*(r1*V1c),-2)
power = round(T*u2,-3)
print "Torque exerted = %d ft lb/s"%(power)
print ("part c")
h2 = round(u1*V1c/g,1)
Power = round(gam*Q*h2,-3)
print "Torque exerted = %d ft lb/s"%(Power)
import math
#Initialization of variables
V1 = 150.*44/30
Q = 20000./2
d = 6.5 #diameter - ft
rho = 0.072
#calculations
A = math.pi/4 *(d)**2
V = int(Q/A)
dV = 2*(V-V1)
Ft = round(rho/32.2 *Q*2*dV,-1)
eta = round(1/(1+ dV/(2*V1)),2)
dP = Ft/2 /(math.pi/4) /d**2
hpp = Q*dP/550
#Results
print "pressure rise = %d psf"%(dP)
print " horsepower input = %d hp "%(round(hpp,-1))
#Initialization of variables
V1 = 8.02 #fps
V2 = 16.04 #fps
Q = 481. #cfs
rho = 1.94
A = 10*6
d = 3.
#calculations
Fx = 62.4*d*A - 62.4*d/2 *A/2 - rho*Q*(V2-V1)
V1m = 2.56 #m/s
V2m = 5.12 #m/s
Qm = 15.4 #m**2/s
dm = 1
Am = 2*3
rhom = 1
Fxm = 9.81*dm*Am - 9.81*dm/2 *Am/2 - rhom*Qm*(V2m-V1m)
#Results
print "Force in x- direction = %d lb"%(Fx)
print "Force in x- direction = %.1f kN"%(Fxm)