import math
# variables
d = 6.; #inches
v = 15.; #fps
l = 100.; #ft
h_L = 17.5; #ft
# calculations
f = round(h_L*(d/(12*l))*(2*32.2/v**2),3);
V_f = v*math.sqrt(f/8.);
# results
print 'The friction velocity = %.2f fps'%(V_f);
#incorrect answer in textbook
import math
# variables
T = 100.; # degreeF
d = 3.; # inches
Re = 80000.; # Reynolds number
e = 0.006; # inches
l = 1000.; #feet
f1 = 0.021; #friction factor
nu = 0.729*10**-5; # sqft/sec
# calculations
V = Re*nu/0.25;
h_L1 = f1*(l/0.25)*(V**2 /(2*32.2));
f = 0.316/Re**0.25;
h_L = (f/f1)*h_L1;
# results
print 'Head loss expected = %.1f ft and head loss expected if the pipe were smooth = %.2f ft'%(h_L1,h_L);
import math
# variables
T = 100.; #degreeF
d = 3.; # inches
Re = 80000.; # Reynolds number
e = 0.006; #inches
l = 1000.; #ft
f = 0.0255; #friction factor
V = 2.33; #fps
# calculations
h_L = f*(l/0.25)*(V**2 /(2*32.2));
# results
print 'Head loss expected = %.1f ft'%(h_L);
import math
# variables
Q = 100.; #gallons per minute
sg = 0.90;
nu = 0.0012; # lb-sec/sqft
d = 3.; # in
l = 1000.; #ft
r = 1.; #in
V = 4.53; #fps
# calculations
Re = V*(d/12)*sg*1.935/nu;
h_L = (64/Re)*(12*l/d)*(V**2 /(2*32.2));
v = 2*V*(1 - (2/d)**2);
tau = 62.4*sg*h_L/(2*l*12);
# results
print 'v = %.2f fps, h_L = %.1f ft of oil and tau = %.3f psf'%(v,h_L,tau);
import math
# variables
# assume
v_vc = 0.80
V = 8.35 #fps
R = 737000
f = 0.019 # from fig.
# calculations
V_Vc = 1./(1+ 4.07* math.sqrt(f/8))
Q = math.pi * V/4
# results
print "V/Vc = %.3f"%V_Vc
print "Q = %.2f cfs"%Q
import math
# variables
Q = 90.; # gallons per minute
T = 68.; #degreeF
d = 3.; # in
l = 3000.; #ft
r = 1.; # in
f = 0.018;
# calculations
V = Q/(60*7.48*0.25*math.pi*(d/12)**2);
Re = V*(d/12)*1.935/(0.000021);
h_L = f*(l/0.25)*(V**2 /(2*32.2));
tau_0 = f*1.935*V**2 /8;
tau1 = 2*tau_0/d;
v_c = V*(1+4.07*math.sqrt(f/8));
v_ = math.sqrt(tau_0/1.935);
v1 = v_*(5.50+5.75*math.log10(v_*(r/(2*12))/0.00001085));
v1_ = v_c-v_*5.75*math.log10(0.5*d/(r/2));
delta = d*32.8/(Re*math.sqrt(f));
# results
print 'Head lost = %.1f ft of water \
\nWall shear stress = %.3f psf \
\nthe center velocity = %.2f fps \
\nshearing stress = %.3f psf \
\nv1 = %.2f fps \
\ndelta = %.4f in.'%(h_L,tau_0,v_c,tau1,v1_,delta);
import math
# variables
d = 12.; # in
v = 10.; #fps
e = 2.; #in
k = 0.002; #relative roughness
l = 1000.; #ft
# calculations
f = (1/(1.14+2*math.log10(1/k)))**2;
v_c = v*(1+4.07*math.sqrt(f/8));
tau_0 = f*1.935*v**2 /8;
v2 = v_c - tau_0*5.75*math.log10(0.5*d/e);
v2_ = 8.48*tau_0 + tau_0*5.75*math.log10(e/(12*k));
h_L = f*(l)*v**2 /(2*32.2);
# results
print 'f = %.4f, v_c = %.2f fps, v2 = %.1f fps and h_L = %.1f ft of water'%(f,v_c,v2_,h_L);
#there are small errors in the answer given in textbook
import math
# variables
V = 4.08; # fps
Re = 93800.; #Reynolds number
r = 1.; #in
m = 1./7;
R = 3.; #in
# calculations
f = 0.316/(Re**0.25);
v_c = V/(2/((m+1)*(m+2)));
v1 = v_c*(r/R)**(1./7);
tau_0 = f*1.935*V**2 /8;
# results
print 'f = %.3f, v_c = %.2f fps, v1 = %.2f fps and wall shear = %.3f ps'%(f,v_c,v1,tau_0);
import math
# variables
p = 14.7; #psia
T = 60.; # degreeF
l = 2000.; #ft
b = 18.; #in
h = 12.; # in
v = 10.; # fps
# calculations
R_h = (b*h)/(2*12*(b+h));
Re = v*4*R_h*0.0763/(32.2*0.000000375);
f = 0.019;
h_L = f*(l/(4*R_h))*v**2 /(2*32.2);
del_p = 0.0763*h_L;
# results
print 'loss of head = %.1f ft of air and the pressure drop = %.2f psf = %.3f psi'%(h_L,del_p,del_p*0.0069);
import math
# variables
Q = 90.; #gpm
d = 3.; #in
l = 3000.; #ft
# calculations
V = Q/(60*7.48*0.25*math.pi*(d/12)**2);
R_h = (d/12)/4;
C_hw = 140;
S = (V/(1.318*140*R_h**0.63))**(1/0.54);
h_L = S*l;
# results
print 'The loss of head = %.1f ft of water'%(h_L);
from sympy import *
import math
# variables
G = 40.; # lb/min
d = 3.; # in
T = 100.; # degreeF
p = 50.; # psia
l = 2000.; #ft
# calculations
Re = ((G/60)*(d/12))/(0.0491*32.2*4*10**-7);
f = 0.015;
gam1 = p*(144/(53.3*(T+460)));
V1 = (G/60)/(gam1*0.0491);
a = math.sqrt(1.4*32.2*53.3*(T+460));
M1 = V1/a;
M2_limit = math.sqrt(1/1.4);
l = (((1-(M1/M2_limit)**2)/(1.4*M1**2)) - 2*math.log(M2_limit/M1))*(0.25/0.015);
p2 = 38.9; #psia, from trial and error method
#p2 = Symbol('p2')
#ans = solve((G/60)**2 * 53.3*560/(32.2 * 0.0491**2) * (2*log(p/p2) + gam1*l/0.25) - (144**2 * (p**2 - p2**2)))
# results
print 'p2 = %.1f psia'%(p2);
import math
# variables
d = 12.; # in
D = 24.; #in
theta = 20.; #degrees
G = 10.; #cfs
p = 20.; #psi
# calculations
V12 = G/(0.25*math.pi);
V24 = V12/4;
K_L = 0.43;
p24 = ((p*144/62.4) + (V12**2 /(2*32.2)) - ((V24**2)/(2*32.2)) - K_L*(V12-V24)**2 /(2*32.2))/2.314;
# results
print 'Pressure in the larger pipe = %.1f psi'%(p24);
import math
# variables
d = 12.; # in
l = 1000.; #ft
h1 = 200.; #elevation
h2 = 250.; #elevation
T = 50.; #degreeF
f1 = 0.030;
# calculations
V1 = math.sqrt((h2-h1)*2*32.2/(0.5+f1*l +1));
R1 = V1/0.00000141;
f2 = 0.019;
V2 = math.sqrt((h2-h1)*2*32.2/(0.5+f2*l +1));
R2 = V1/0.00000141;
Q = 0.25*math.pi*(d/12)**2 *V2;
# results
print 'Velocity = %.1f fps \
\nflow rate = %.1f cfs'%(V2,Q);
#there is a minute error in the answer given in textbook
import math
# variables
l = 200.; #ft
Q = 0.1; #cfs
del_h = 5.; #ft
T = 50.; #degreeF
d = 0.187; #ft
# calculations
V = Q/(0.25*math.pi*d**2);
R = V*d/0.0000141;
f = (del_h*2*32.2/V**2 -(1+0.5))*(d/l);
# results
print 'Required diameter of the pipe = %.2f in.'%(d*12);
import math
# variables
Q = 2.5; #cfs
T = 50.; #degreeF
d1 = 8.; #in
d2 = 6.; #in
l1 = 1000.; #ft
l2 = 2000.; #ft
# calculations
V8 = Q/(0.25*math.pi*(d1/12)**2);
V6 = Q/(0.25*math.pi*(d2/12)**2);
R8 = V8*0.667/0.0000141;
f8 = 0.020;
R6 = V6*0.5/0.0000141;
f6 = 0.019;
h_L8 = f8*(l1/0.667)*(V8**2 /(2*32.2));
h_L6 = f6*(l2/0.5)*(V6**2 /(2*32.2));
Ep = 100+h_L8+h_L6;
n = Q*62.4*(Ep)/550;
V8 = math.sqrt((30/f8)*2*32.2/(l1/0.667));
Q_max = V8*0.25*math.pi*(d1/12)**2;
# results
print 'Maximum reliable flow that can be pumped = %.1f cfs'%(Q_max);
import math
# variables
Q = 5.; #cfs
d = 12.; #in
l = 5000.; #ft
h = 70.; #ft
L = 2000.; #ft
# calculations
K = (h/Q**1.85);
a = (L/l)*K;
b = ((l-L)/l)*K;
Q_ = (h/((b+a*(0.5**(1.85)))))**(1/1.85);
Q_A = Q_/2;
Q_B = Q_/2;
del1 = Q_-Q; #gain capcaity
percent = (del1/Q)*100; #gain percentage
# results
print 'The gain of capacity by looping the pipe is %.1f cfs or %d percentage'%(del1,percent);