import math
# variables
G = 10.; #cfs
d1 = 12.; #in
d2 = 8.; #in
p1 = 10.; #psi
V = 3.; #cuft
theta = 60.; #degrees
p2 = 3.43; # psi
w = 187.; #lb
# calculations
V1 = G/(0.25*math.pi*(d1/12)**2);
V2 = G/(0.25*math.pi*(d2/12)**2);
F1 = 0.25*math.pi*(d1**2)*p1;
F2 = 0.25*math.pi*d2**2 *p2;
Fx = F1+F2*math.cos(theta*math.pi/180) - G*1.935*(-V2*math.cos(theta*math.pi/180) - V1);
Fz = F2*math.sin(theta*math.pi/180) + w + G*1.935*(V2*math.sin(theta*math.pi/180));
F = round(math.sqrt(Fx**2 + Fz**2),-1);
alpha = (180/math.pi)*math.atan(Fz/Fx);
# results
print 'The force on the bend = %d lb at %d degrees with the horizontal'%(F,alpha);
import math
# variables
l1 = 5.; #ft
l2 = 2.; #ft
# calculations
V1 = round(math.sqrt(2*32.2*(l2-l1)/(1-(l1/l2)**2)),2);
V2 = round((l1/l2)*V1,1);
q = round(l1*V1,1);
F1 = 62.4*(l1**2)/2;
F2 = 62.4*(l2**2)/2;
Fx = F1-F2-q*1.935*(V2-V1);
# results
print 'Force = %d lb and direction is in downstream direction'%(Fx);
#answer differs due to incorrect value of F2 in textbook
import math
# variables
d = 2.; #ft
Q = 40.; #cfs/ft
# calculations
V1 = Q/d;
y1 = d;
K1 = V1**2 /(32.2*y1);
y2 = (-1 +math.sqrt(1+8*K1));
V2 = Q/y2 ;
delta = d + (V1**2 /(2*32.2)) - y2 - (V2**2 /(2*32.2));
hp = Q*62.4*delta/550.;
# results
print 'y2 = %.2f ft, delta = %.2f ft, Horsepower dissipated = %.1f hp'%(y2,delta,hp);
#incorrect answer given in textbook
import math
# variables
y1 = 2.; #ft
V1 = 20.; #fps
beta = 40.; #degrees
# calculations
K1 = (V1**2)/(32.2*y1);
y2 = (-1 + math.sqrt(1+8*K1*(math.sin(beta*math.pi/180))**2));
k = (y1/y2)*V1*math.sin(beta*math.pi/180);
del_angle = (180/math.pi)*math.tan(math.sqrt((math.tan(beta*math.pi/180)) *(1+2*k**2 /(32.2*y2))/(1+2*K1*(math.sin(beta*math.pi/180))**2)));
theta = beta-del_angle;
# results
print 'The required wedge angle = %.d degrees'%(2*theta);
#rounding-off errors in the answer given in textbook
import math
# variables
p1 = 14.7; #psia
V1 = 1732.; #pfs
a1 = 862.; #fps
# calculations
M1 = round(V1/a1,2);
M2 = (math.sqrt((1+(0.4*M1**2)/2)/(1.4*M1**2 - (0.4/2))));
p2 = p1*(1+2*(1.4/2.4)*(M1**2 -1));
V2 = V1*((2+0.4*M1**2)/(2.4*M1**2));
a2 = V2/M2;
T2 = a2**2/(1.4*32.2*53.3);
T1 = a1**2/(1.4*32.2*53.3);
del_T = T2-T1;
# results
print 'p2 = %.1f psia, V2 = %d fps, a2 = %d fps, T2 = %d degreeR'%(p2,V2,a2,T2);
print 'Rise of temperature = %d degreeF'%(del_T);
#Answer differs due to rounding-off errors in M2
import math
# variables
p1 = 14.7; # psia
v1 = 1732.; # fps
a1 = 862.; # fps
beta = 40.; # degrees
# calculations
M1 = round(v1/a1,2);
T1 = round(a1**2 /(1.4*32.2*53.3),-1);
p2 = round(p1*(1 + 2*(1.4/2.4)*(M1**2 *(math.sin(beta*math.pi/180))**2 -1)));
beta_theta = math.degrees(math.atan(math.tan(math.radians(beta)) * (0.4*(M1*math.sin(math.radians(beta)))**2 +2)/(2.4*(M1*math.sin(math.radians(beta)))**2)))
theta = round(beta - beta_theta,1)
M2 = round(math.sqrt((1/math.sin((beta-theta)*math.pi/180)**2) *(1 + (0.4/2)*((M1*math.sin(beta*math.pi/180))**2) )/((1.4*(M1*math.sin(beta*math.pi/180))**2) -(0.4/2))),2)
v2 = v1*math.cos(beta*math.pi/180)/math.cos((29.3)*math.pi/180);
a2 = v2/M2;
T2 = a2**2 /(1.4*32.2*53.3);
# results
print 'Angle required = %.1f degrees, p2 = %.1f psia, v2 = %d fps, a2 = %.f fps, T2 = %.1f degreeR'%(theta,p2,v2,round(a2,-1),T2);
# note : answers differ due to rounding off error
import math
# variables
F = 1000; #lb
H = 30000; #ft
v1 = 500.; #fps
v2 = 4000.; #fps
p2 = 5; #psia
A2 = 1; #sqft
p1 = 4.37; #psia
# calculations
G_a = (F - (p2-p1)*A2*144)*32.2/(v2-v1);
# results
print 'Ga = %.1f lb/sec'%(G_a);
import math
# variables
gam = 0.0765; # lb/cuft
V1 = 293.; #fps
hp = 1500.;
h = 10.; #ft
V4 = 338.; #fps
# calculations
V = 0.5*(V1+V4);
Q = hp*550/((V4-V1)*V*gam/32.2);
d1 = math.sqrt(Q/(V1*0.25*math.pi));
d4 = math.sqrt(Q/(V4*0.25*math.pi));
F = Q*(gam/32.2)*(V4-V1);
eta = V1/V;
# results
print 'V4 = %d fps, V = %.1f fps, d1 = %.1f ft, d4 = %.2f ft, F = %d lb, efficiency = %.1f percentage'%(V4,V,d1,d4,F,eta*100);
#answer differs due to rounding-off errors
import math
# variables
D = 6.; #ft
d = 2.; #in
V1 = 200.; #fps
rpm = 250.;
theta = 150.; #degrees
# calculations
u = (rpm/60)*2*math.pi*0.5*D;
v1 = V1-u;
v2 = v1;
V_2x = v1*math.cos(theta*math.pi/180) + u;
V_2y = v2*math.sin(theta*math.pi/180);
V2 = math.sqrt(V_2x**2 + V_2y**2);
Q = 0.25*math.pi*(d/12)**2 *V1;
F_x = Q*1.935*(V_2x-V1);
P = F_x*u/550;
# results
print 'The working component of force on fluid = %d lb, P = %.f hp'%(F_x,-P);
#answer differs due to rounding-off errors
import math
# variables
P = 100.; #hp
V = 75.; #fps
V1 = 150.; #fps
d = 2.; #in
alpha1 = 60.; #degrees
# calculations
Q = round(0.25*math.pi*(d/12)**2 *V1,2);
F_y = round(550*P/V);
V2 = math.sqrt(V1**2 - P*550/(Q*1.935/2));
alpha2 = (180/math.pi)*math.asin((V1*math.sin(alpha1*math.pi/180) - (F_y/(Q*1.935)))/V2);
beta1 = 90 - (180/math.pi)*math.atan((V1*math.sin(alpha1*math.pi/180) - V)/(V1*math.cos(alpha1*math.pi/180)));
beta2 = 90 + (180/math.pi)*math.atan((V-V2*math.sin(alpha2*math.pi/180))/(V1*math.cos(alpha1*math.pi/180)));
# results
print 'Beta1 = %.f degrees, Beta2 = %.f degrees'%(beta1,round(beta2,-1));
# note : answer differs due to rounding off error
import math
# variables
r1 = 5.; #ft
r2 = 3.5; #ft
beta1 = 60.; #degrees
beta2 = 150.; #degrees
t = 1.; #ft
alpha1 = 15.; #degree
Q = 333.; #cfs
gam = 0.434;
# calculations
V_r1 = round(Q/(2*math.pi*r1),1);
V_r2 = round(Q/(2*math.pi*r2),2);
V_t1 = round(V_r1*(1/math.tan(alpha1*math.pi/180)),1);
u1 = round(V_t1 - V_r1*math.tan((90-beta1)*math.pi/180),1);
omega = round(u1/r1,1);
u2 = round(omega*r2,1);
V_t2 = round(u2 - V_r2*(1/math.tan((90-beta1)*math.pi/180)),1);
T = Q*1.935*(V_t1*r1 - (V_t2*r2));
hp = T*omega/550;
E_T = hp*550/(Q*62.4);
V1 = math.sqrt(V_r1**2 + V_t1**2);
V2 = math.sqrt(V_r2**2 + V_t2**2);
del_p = E_T*gam + (gam/(2*32.2))*(V2**2 - V1**2);
# results
print 'V1 = %.1f fps, V2 = %.1f fps, T = %d ft-lb, hp = %d lb, E_T = %.1f ft-lb/lb, p1-p2 = %.1f psi'%(V1,V2,T,hp,E_T,del_p);
#incorrect answer given in textbook
import math
# variables
r1 = 3.; #in
r2 = 10.; #in
beta1 = 120.; #degrees
beta2 = 135.; #degrees
t = 1.; #in
Q = 4.; #cfs
gam = 0.434;
# calculations
V1 = Q*144/(2*math.pi*r1);
V_r1 = V1;
V_r2 = Q*144/(2*math.pi*r2);
u1 = V1*math.tan((beta1-90)*math.pi/180);
omega = u1/(r1/12);
u2 = omega*(r2/12);
V_t2 = u2 - V_r2/math.tan((180-beta2)*math.pi/180);
T = Q*1.935*(V_t2*(r2/12));
P = T*omega/547.561; #hp
E_P = P*550/(Q*62.4);
V2 = math.sqrt(V_r2**2 + V_t2**2);
del_p = E_P*gam + (gam/(2*32.2))*(V1**2 - V2**2);
# results
print 'Rotational speed = %.1f rad/sec '%(omega)
print ' T = %d ft-lb, P = %.1f hp'%(T,P);
print ' The energy given to each pound of water = %d ft'%(E_P);
print ' The pressure rise = %.1f psi'%(del_p);