import math
# Variables
T = 30.; #[degC] - temperature
d = 8.265*10**-4; #[m] - diameter of the capillary viscometer
deltapbyL = -0.9364; #[psi/ft] - pressure drop per unit length
# Calculations
deltapbyL = deltapbyL*(2.2631*10**4); #[kg/m**2*sec**2] - pressure drop per unit length
Q = 28.36*(10**-6)*(1./60);
p = (0.88412-(0.92248*10**-3)*T)*10**3; #[kg/m**3] - density
s = (math.pi*(d**2))/4.;
U = Q/s;
tauw = (d/4.)*(-deltapbyL);
shearrate = (8*U)/d;
mu = tauw/(shearrate);
# Results
print " The viscosity is mu = %.3ef kg/m*sec = %.4f cP"%(mu,mu*10**3);
print " Finally, it is important to check the reynolds number to make sure the above equation applies"
Nre = (d*U*p)/(mu);
print " Nre = %d"%Nre
print " The flow is well within the laminar region and therefore the above equation applies";
# Variables
Nreold = 1214.;
Uold = 0.8810;
Nre = 13700.;
U = Uold*(Nre/Nreold);
Lbyd = 744.;
T = 30.;
# Calculations
# umsing the newton raphson method to calculate the value of f from the equation - 1/(f**(1/2)) = 4*math.log(Nre*(f**(1/2)))-0.4
f = 0.007119;
p = (0.88412-(0.92248*10**-3)*T)*10**3; #[kg/m**3] - density
tauw = (1./2)*p*(U**2)*f;
deltap = tauw*(4.)*(Lbyd);
d = 0.03254/12; #[ft]
L = Lbyd*d;
# Results
print " Pressure drop is -deltap = %.3e N/m**2 = %.1f kpa = 130 psi"%(deltap,deltap*10**-3);
print " A pressure drop of 130 psi on a tube of length of %.3f ft is high and \
\nshows the impracticality of flows at high reynolds number in smaller tubes"%(L);
# Answer may vary because of rounding error.
# Variables
u = 1./60; #[m/sec] - velocity
p = 1000.; #[kg/m**3] - density
mu = 1*10.**-3; #[kg/m*sec] - vismath.cosity
d = 6*10.**-2; #[m] - insid_e diameter of tube
L = 300.; #[m] - length of the tube
# Calculations
Nre = (d*u*p)/(mu);
f = 16./Nre;
deltap = (4.*f)*(L/d)*((p*(u**2))/2.);
# Results
print "Nre = ",Nre,"therefore the flow is laminar"
print "f = " , f
print "Pressure drop -delta P = %.2f N/m**2 = %.4f kPa = %.3e psi"%(deltap,deltap*10**-3,deltap*1.453*10**-4);
from numpy import *
# Variables
# given
d = 6.*10**-2; #[m] - insid_e diameter of tube
p = 1000.; #[kg/m**3] - density
# for smooth pipe
Nre = array([10**4, 10**5]);
f = array([0.0076, 0.0045]);
mu = 10.**-3; #[kg/m**2*s]
U = (Nre*mu)/(d*p);
L = 300.; #[m] - length of the tube
# Calculations
deltap = zeros(2)
for i in range(2):
deltap[i] = (4*f[i])*(L/d)*((p*(U[i]**2))/2.);
# Results
print "for smooth pipe"
print " Nre f -deltap";
print " %6.0f %6.4f %6.3f"%(Nre[0],f[0],deltap[0])
print " %6.0f %6.4f %6.3f"%(Nre[1],f[1],deltap[1])
# for commercial steel
Nre = array([10**4, 10**5]);
f = array([0.008 ,0.0053]);
U = (Nre*mu)/(d*p);
L = 300.; #[m] - length of the tube
for i in range(2):
deltap[i] = (4*f[i])*(L/d)*((p*(U[i]**2))/2);
print "\nfor commercial steel pipe"
print " Nre f -deltap";
print " %6.0f %6.4f %6.3f"%(Nre[0],f[0],deltap[0])
print " %6.0f %6.4f %6.3f"%(Nre[1],f[1],deltap[1])
# for cast iron pipe
Nre = array([10**4 ,10**5]);
f = array([0.009 ,0.0073]);
U = (Nre*mu)/(d*p);
L = 300.; #[m] - length of the tube
for i in range(2):
deltap[i] = (4*f[i])*(L/d)*((p*(U[i]**2))/2);
print "\nfor cast iron pipe"
print " Nre f -deltap";
print " %6.0f %6.4f %6.3f"%(Nre[0],f[0],deltap[0])
print " %6.0f %6.4f %6.3f"%(Nre[1],f[1],deltap[1])
# Variables
L = 300.; #[m] - length of pipe
d = 0.06; #[m] - insid_e diameter
deltap = 147.*10**3; #[Pa] - pressure the pump can supply
ebyd = 0.000762; # relative roughness
p = 1000.; #[kg/m**3] - density
mu = 1.*10**-3; #[kg/m*sec] - viscosity
tauw = (d*(deltap))/(4.*L);
# using the hit and trial method for estimation of flow velocity
# Calculations
# let
f = 0.005;
U = ((2*tauw)/(p*f))**(1./2);
Nre = (d*U*p)/mu;
# from the graph value of f at the above calculated reynolds no. and the given relative roughness(e/d)
f = 0.0054;
U = ((2*tauw)/(p*f))**(1./2);
Nre = (d*U*p)/mu;
# from the graph value of f at the above calculated reynolds no. and the given relative roughness(e/d)
f = 0.0053;
U = ((2*tauw)/(p*f))**(1./2);
Nre = (d*U*p)/mu;
# from the graph value of f at the above calculated reynolds no. and the given relative roughness(e/d)
f = 0.0053;
# At this point the value of f is deemed unchanged from the last iteration .Hence, the values obtained after the third iteration are the converged values
# Results
print " The maximum flow velocity is U = %f m/sec"%(U);
# Answer may vary because of rounding error.
# Variables
L = 300.; #[m] - length of pipe
d = 0.06; #[m] - insid_e diameter
deltap = 147.*10**3; #[Pa] - pressure the pump can supply
ebyd = 0.000762; # relative roughness
p = 1000.; #[kg/m**3] - density
# Calculations
mu = 1*10**-3; #[kg/m*sec] - viscosity
Nvk = ((d*p)/mu)*((d*(deltap))/(2*L*p))**(1./2);
# From the fig at given von karman no and relative roughness the value of f is-
f = 0.0055;
Nre = Nvk/(f**(1./2))
U = (Nre*mu)/(d*p);
# Results
print "von karman no. %.0f"%Nvk
print " Average velocity = %.2f m/sec"%(U);
# Variables
L = 300.; #[m] - length of pipe
d = 0.06; #[m] - insid_e diameter
p = 1000.; #[kg/m**3] - density
mu = 1.*10**-3; #[kg/m*sec] - viscosity
# Calculations
Nre = array([10.**4, 10.**5]);
U = (Nre*mu)/(d*p);
velocityhead = (U**2)/2.;
N = (L/d)/45.; # no of velocity heads
deltap = p*N*(velocityhead);
# Results
for i in range(2):
print "Nre = ",Nre[i]
print " velocity head = %.5f m**2/sec**2"%(velocityhead[i]);
print " -deltap = %.3f kPa = %.3f psi"%(deltap[i]*10**-3,deltap[i]*1.453*10**-4);
# Variables
mu = 6.72*10**-4; #[lb/ft*sec] - viscosity
p = 62.4; #[lb/ft**3] - density
S = 0.03322; #[ft**2] - flow area
d = 0.206; #[ft]
e = 1.5*10**-4; # absolute roughness for steel pipe
ebyd = e/d;
Nre = 10.**5;
# friction factor as read from fig in book for the given reynolds no. and relative roughness is-
f = 0.0053;
U = (Nre*mu)/(p*d);
Q = U*S;
gc = 32.174;
# Calculations
# (a) equivalent length method
deltapbyL = f*(4/d)*(p*(U**2))*(1/(2*gc))*(6.93*10**-3);
# using L = Lpipe+Lfittings+Lloss;
Lfittings = 2342.1*d;
kc = 0.50; # due to contraction loss
ke = 1.; # due to enlargement loss
Lloss = (kc+ke)*(1./(4*f))*d;
Lpipe = 137.;
L = Lpipe+Lfittings+Lloss;
deltap = deltapbyL*L;
patm = 14.696; #[psi] - atmospheric pressure
p1 = patm+deltap;
print " a)The inlet pressure is p1 = %.1f psi"%(p1);
# (b) loss coefficient method
# using the equation deltap/p = -(Fpipe+Ffittings+Floss)
L = 137.;
kfittings = 52.39;
sigmaF = ((4.*f*(L/d))+kc+ke+kfittings)*((U**2)/(2*gc));
deltap = (p*sigmaF)/(144.);
p1 = patm+deltap;
# Results
print " b)The inlet pressure is p1 = %.1f psi"%(p1);
print " Computation of the pressure drop by the loss coefficient method differs from the equivalent length \
\nmethod by less than 1 psi";
# Variables
L1 = 50.; #[m] - length of first pipe
L2 = 150.; #[m] - length of second pipe
L3 = 100.; #[m] - length of third pipe
d1 = 0.04; #[m] - diameter of first pipe
d2 = 0.06; #[m] - diameter of second pipe
d3 = 0.08; #[m] - diameter of third pipe
deltap = -1.47*10**5; #[kg/m*sec] - pressure drop
mu = 1*10.**-3; #[kg/m*sec] - viscosity
p = 1000.; #[kg/m**3] - density
# Calculation and Results
# for branch 1
S = (math.pi*(d1**2))/4;
Nvk = ((d1*p)/mu)*(-(d1*deltap)/(2*L1*p))**(1./2);
f = (1./(4*math.log10(Nvk)-0.4))**2;
U = (((-deltap)/p)*(d1/L1)*(2./4)*(1./f))**(1./2);
w1 = p*U*S;
print " For first branch w1 = %.2f kg/sec"%(w1);
# for branch 2
S = (math.pi*(d2**2))/4;
Nvk = ((d2*p)/mu)*(-(d2*deltap)/(2*L2*p))**(1./2);
f = (1./(4*math.log10(Nvk)-0.4))**2;
U = (((-deltap)/p)*(d2/L2)*(2./4)*(1./f))**(1./2);
w2 = p*U*S;
print " For second branch w2 = %.2f kg/sec"%(w2);
# for branch 3
S = (math.pi*(d3**2))/4;
Nvk = ((d3*p)/mu)*(-(d3*deltap)/(2*L3*p))**(1./2);
f = (1./(4*math.log10(Nvk)-0.4))**2;
U = (((-deltap)/p)*(d3/L3)*(2./4)*(1./f))**(1./2);
w3 = p*U*S;
print " For third branch w3 = %.2f kg/sec"%(w3);
# total flow rate w = w1+w2+w3
w = w1+w2+w3;
print " total flow rate is w = %.1f kg/sec"%(w);
# Variables
sp = 1.1;
p = sp*62.4; #[lb/ft**3] - density
mu = 2*6.72*10**-4; #[lb/ft*sec] - viscosity
Q = 400.; #[gpm] - volumetric flow rate
e = 1.5*10**4; #roughness of steel pipe
gc = 32.174;
kexit = 1.;
kentrance = 0.5;
# Calculations
# 4 in schedule pipe
d = 4.026/12; #[ft]
U4 = Q/39.6; #[ft/sec]
Lgv = 13.08;
Lglv = 114.1;
Le = 40.26;
Lpipe_4 = 22.;
Lfittings_4 = Lgv+Lglv+Le;
Lloss = 0;
L_4 = Lpipe_4+Lfittings_4+Lloss;
Nre_4 = (d*U4*p)/mu;
f = 0.00475;
Fpipe_4 = ((4*f*L_4)/d)*(U4**2)*(1/(2*gc));
Floss_4 = ((kentrance+0)*(U4**2))/(2*gc);
# 5 in schedule pipe
d = 5.047/12;
U5 = Q/62.3;
Lgv = 10.94;
Le = 75.71;
Lpipe_5 = 100.;
Lfittings_5 = Lgv+Le;
Lloss = 0.;
L_5 = Lpipe_5+Lfittings_5+Lloss;
Nre = (d*U5*p)/mu;
f = 0.00470;
Fpipe_5 = ((4*f*L_5)/d)*(U5**2)*(1./(2*gc));
Floss_5 = ((kexit+0)*(U5**2))/(2*gc);
# 6 in schedule pipe
d = 6.065/12;
U6 = Q/90.;
Lgv = 6.570;
Le = 30.36;
Lpipe_6 = 4.;
Lfittings_6 = Lgv+Le;
Lloss = 0.;
L_6 = Lpipe_6+Lfittings_6+Lloss;
Nre = (d*U6*p)/mu;
f = 0.00487;
Fpipe_6 = ((4*f*L_6)/d)*(U6**2)*(1./(2*gc));
kc = 0.50;
Floss_6 = kc*((U6**2)/(2*gc));
Ffittings = 0.;
deltap_6 = p*(Fpipe_6+Ffittings+Floss_6);
# 3/4 in 18 gauge tube
d = 0.652112/12;
L_3by4 = 15.;
U_3by4 = (Q*0.962)/100.;
Floss_3by4 = 100.*(kexit+kentrance)*((U_3by4**2.)/2.);
Nre = d*U_3by4*p*(1./mu);
f = 0.08*((Nre)**(-1./4))+0.012*((d)**(1./2));
deltap_3by4 = ((4*f*p*L_3by4)/d)*((U_3by4**2)/(2*gc));
Fpipe_3by4 = 100.*((4.*f*L_3by4)/d)*((U_3by4**2.)/(2.*gc));
deltap_spraysystem = 25.; #[psi]
Fspraysystem = (deltap_spraysystem/p)*(144.);
delta_p = (p*(kexit+kentrance))*((U_3by4**2.)/(2.*gc))
Fpipe = Fpipe_4+Fpipe_5+Fpipe_6;
Floss = Floss_4+Floss_5+Floss_6+Floss_3by4;
ws = 0. + (((15.**2)-0)/(2*gc))+38.9+382.5;
w = (Q*p)/(7.48);
Ws = (ws*w)/(33000.);
efficiency = 0.6;
Ws_actual = Ws/efficiency
# Results
print " The power supplied to the pump is %.1f hp"%(Ws_actual);
# Variables
kexit = 1.;
kentrance = 0.5;
Q = 400.; #[gpm] - volumetric flow rate
gc = 32.174;
# for 4 inch pipe
d = 4.026; #[inch]
L = 22.; #[ft]
Lbyd = (L*12)/(d);
# Calculation and Results
# adding the contributions due to fittings
Lbyd = Lbyd+3*13+340+4*30;
N = Lbyd/45.;
N = N+kentrance+0;
U4 = Q/39.6; #[ft/sec]
Fpipe_4 = (N*(U4**2))/(2*gc);
print " F4 in.pipes = %.2f ft*lbf/lbm"%(Fpipe_4);
# for 5 inch pipe
L = 100.; #[ft]
d = 5.047; #[inch]
Lbyd = (L*12.)/(d);
# valves contributes 26 diameters and six elbows contribute 30 diameters ecah;therefore
Lbyd = Lbyd+26+6*30;
N = Lbyd/45.; # no. of velocity heads
N = N+kexit+kentrance;
U5 = Q/62.3;
Fpipe_5 = (N*(U5**2))/(2*gc);
print " F5 in.pipes = %.2f ft*lbf/lbm"%(Fpipe_5);
# for 6 inch pipe
d = 6.065; #[inch]
L = 5.; #[ft]
Lbyd = (L*12.)/(d);
# adding the contributions due to fittings
Lbyd = Lbyd+1*13+2*30;
N = Lbyd/45;
N = N+0+kentrance;
U6 = Q/90.;
Fpipe_6 = (N*(U6**2))/(2*gc);
print " F6 in.pipes = %.3f ft*lbf/lbm"%(Fpipe_6);
F_largepipes = Fpipe_4+Fpipe_5+Fpipe_6;
print " Flarge pipes = %.2f ft*lbf/lbm"%(F_largepipes);
# Variables
l = 0.09238;
rh = 0.1624*l;
L = 300.;
de = 4.*rh;
p = 1000.; #[kg/m**3]
mu = 10.**-3; #[kg/m*sec]
Uavg = 1.667;
# Calculations
Nre = (de*Uavg*p)/mu;
f = 0.0053;
deltap = ((4.*f*L)/de)*(p*(Uavg**2)*(1./2));
# Results
print " Pressure drop -deltap = %.3e kg/m*s = %.3e N/m**2 = %.1f kPa"%(deltap,deltap,deltap*10**-3);
# Variables
Q = 400.; #[gpm]
p = 1.1*62.4; #[lbm/ft**3]
mu = 2.*(6.72*10**-4); #[lb/ft*sec]
e = 1.5*10**4;
# Calculations
# 4 inch schedule pipe
d = 0.3355;
S = (math.pi*(d**2))/4;
U4 = Q/39.6;
ebyd = e/d;
w = 3671./60;
pm = 13.45*62.4;
g = 32.1;
gc = 32.174;
deltaz = 2.5;
deltap = (g/gc)*(pm-p)*(deltaz);
betaa = ((1.)/(1.+((2*p*gc)*(deltap))*(((0.61*S)/w)**2)))**(1./4);
d2 = betaa*d;
Nre2 = (4*w)/(math.pi*d2*mu);
a = (1./30)*4.026;
b = (1./4)*(2.013-1.21);
c = (1./8)*(2.42);
if a<b :
if a<c :
opt = a;
else:
opt = c;
else:
if b<c:
opt = b;
else:
opt = c;
# Results
print " The pertinent orifice details are orifice diameter = %.3f in corner taps, \
\n square edge orifice plate not over %.3f in thick"%(d2*12,opt);
# Variables
Q = 400.; #[gpm]
p = 1.1*62.4; #[lbm/ft**3]
mu = 2*(6.72*10**-4); #[lb/ft*sec]
e = 1.5*10**4;
# Calculations
# 4 inch schedule pipe
d = 0.3355;
S = (math.pi*(d**2))/4;
U4 = Q/39.6;
ebyd = e/d;
w = 3671./60;
pm = 13.45*62.4;
g = 32.1;
gc = 32.174;
Nre = (d*U4*p)/mu;
if Nre>10**4:
c = 0.98;
deltaz = 2.5;
deltap = (g/gc)*(pm-p)*(deltaz);
betaa = ((1.)/(1+((2*p*gc)*(deltap))*(((c*S)/w)**2)))**(1./4);
d2 = betaa*d;
# Results
print " The pertinentr details of the venturi design are Throat diameter = %.2f inch \
\n Approach angle = 25 Divergence angle = 7"%(d2*12);
# Variables
Uzmax = 3.455; #[ft/sec]
m = 32;
a1 = -0.3527;
a2 = -0.6473;
rbyro = 0.880;
# Calculations
UzbyUzmax = 1+a1*(rbyro**2)+a2*(rbyro**(2*m));
Uz = Uzmax*(UzbyUzmax);
Uzavg = (4./9)*Uzmax+(5./18)*(Uz+Uz);
# Results
print " the average velocity is Uzavg = %.2f ft/sec \
\n Thus, in this Example there is an inherent error of 5.5 percent, even before any experimental errors are introduced"%(Uzavg);