import math
#calculate The Hydrodynamic force on the vane and resultant force of angle
rho=1000.; ## kg/m^3
u1=36.; ## m/s
u2=30.; ## m/s
d=0.05; ## m
theta=60.; ## degrees
A=math.pi/4.*d**2.;
Q=A*u1;
F_x=rho*Q*(u2*(math.cos(theta/57.3)) - u1);
F_y=rho*Q*u2*math.sin(theta/57.3);
F=math.sqrt(F_x**2+F_y**2);
phi=math.atan((F_y/F_x));
print'%s %.1f %s'%("The Hydrodynamic force on the vane =",F,"N")
print'%s %.1f %s'%("This resultant force acts at angle of",phi*180/math.pi,"to the x-direction")
import math
#calculate The net horizontal force exerted by the water onthe bend and resultant force of angle
Q1=0.45; ## m**3/s
Q2=0.425; ## m**3/s
d1=0.6; ## m
d2=0.3; ## m
p1=1.4*10.**5.; ## Pa
rho=1000.; ## kg/m**3
theta=45/57.3; ## degrees
A1=math.pi/4*d1**2;
A2=math.pi/4*d2**2;
u1=Q1/A1;
u2=Q2/A2;
p2=p1+rho/2.*(u1**2-u2**2.);
F_x=rho*Q2*(u2*math.cos(theta)-u1)-p1*A1+p2*A2*math.cos(theta)
F_y=rho*Q2*(u2*math.sin(theta)-0)+p2*A2*math.sin(theta);
F=math.sqrt(F_x**2+F_y**2);
phi=math.atan(F_y/F_x);
print'%s %.1f %s'%("The net horizontal force exerted by the water onthe bend =",F,"N")
print'%s %.1f %s'%("This resultant force acts at angle of",phi*57.3,"to the x-direction")
import math
#calculate The thrust on the turbine and Power generated by the turbine
rho=1.2; ## kg/m**3
d=12.; ## m
u1=20.; ## m/s
u4=8.; ## m/s
A=math.pi/4.*d**2
F=rho*A*(u1+u4)/2.*(u1-u4);
print'%s %.3f %s'%("The thrust on the turbine = ",F,"N")
P=rho*A*(u1+u4)/2.*(u1**2/2.-u4**2/2.);
print'%s %.2f %s'%("Power generated by the turbine =",P,"W")
#in book it is converted into kw