#Variable declaration
sap=1.25 #Sulphuric acid pumped
d=25e-3 #Diameter of pipe
l=30 #length of pipe
meu=25e-3 #Viscosity of acid
rho_a=1840 #Density of acid
#Calculation
import math
Re=4*sap/(math.pi*meu*d)
u=sap/(rho_a*math.pi/4*d**2)
#calculating pressure drop from the energy balance equation and equation 3.19
Dp=rho_a*((0.5+4*0.006*30/0.025)*u**2+9.81*12)
#Result
print"\n Pressure drop =",round((Dp/10**3)),"kN/m**2"
#Variable declaration
d=50e-3 #Diameter of pipe
l=100.0 #length of pipe
e=0.013 #Roughness of pipe
DPf=50e3 #Maximum pressure drop
rho=1000.0 #density of water
meu=1e-3 #viscosity of water
#Calculatiom
phi_re2=(DPf)*d**3*rho/(4*l*meu**2)
e_d=e/(d*1e3)
Re=7.9e4
u=Re*meu/(rho*d)
#Result
print"The maximum allowable velocity is =",round(u,1),"m/s"
#Variable declaration
Dia_tank=5 #Diameter of the tank
len_pipe=100.0 #Length of pipe
dia_pipe=225e-3 #Diameter of pipe
#Calculation
X=.0020
def f(D):
return(111.5*(1+(3552*X))**0.5*D**-0.5)
from scipy.integrate import quad
t=quad(f,0.3,3)
print"The time taken for the level to fall is therefore about %d"%t[0],"s or %.1f"%(t[0]/60.0),"min"
#Variable declaration
d1=0.3 #diameter of pipe from junction A to D or B to D
l1=1.5e3 #length of pipe from junction A to D or B to D
d2=0.5 # diameter of pipe from junction D to C
l2=0.75e3 # length of pipe from junction D to C
h_A=10 # height of tank A above C
h_B=h_A+6 # height of tank A above C
rho=870 # density of liquid
Meu_l=0.7e-3 # viscosity of liquid
#Calculation
import math
import sympy
import numpy as np
x=Symbol('x')
u2=sympy.solve(x**4-(7.38*x**2)+13.57)
u1=(np.square(u2)-1.47)**0.5
u3=(u1+u2)/2.78
#taking the positive values and which satisfy equation 7
U1=u1[2]
U2=u2[2]
U3=u3[2]
Q=math.pi/4*d2**2*U3
#Result
print"\n The volumetric flow rate =%.2f"%Q,"m**3/s"
#Variable declaration
r=50.0
#Calculation
from scipy.optimize import fsolve
a=Symbol('a')
def f(a):
return(105*a**(8.0/7.0)-56*a**(15.0/7.0)-24.5)
p=fsolve(f,0.5)
y=p[0]*r
#Result
print"a =",round(p[0],2)
print"y =",round(y,1),"mm"
#Variable declaration
Q=7.2 #Water flow rate
d1=40e-3 #initial pipe diameter
d2=50e-3 #diameter of pipe after enlargement
g=9.81
#Calculation
import math
u1=(Q/3600.0)/(math.pi/4*d1**2) #Velocity in 40 mm pipe
u2=(Q/3600.0)/(math.pi/4*d2**2) #Velocity in 50 mm pipe
# The head lost is given by equation 3.77 as:
hf=(u1-u2)**2.0/(2.0*g)
#Result
print"Head lost =",round(hf*1e3,1),"mm of water"
#Variable declaration
Q_h=2.27 # flow rate of water in m**3/h
T=320 #Temperature of water to be pumped
id=40e-3 #internal diameter of pipe
l_h=150.0 #length of pipe horizontally
l_v=10.0 #length of pipe vertically
e=0.2e-3
g=9.81
rho=1000.0
#Calculation
rel_rough=e/id #Relative roughness
meu=0.65e-3 #Viscosity at 320 K
Q_s=Q_h/3600.0 #flow rate of water in m**3/s
area=math.pi/4*id**2 # Area for flow
u=Q_s/area #Velocity
Re=(id*u*rho)/meu
#X=R/(rho*u**2)=0.004 (from Figure 3.7)
X=.004
equi_len=l_h+l_v+(260*id) # Equivalent length of pipe
hf=4*X*equi_len*u**2/(id*g)
tot_head=hf+1.5+10 # Total head to be developed
mass_thr=Q_s*rho #Mass throughput
power_reqd=(mass_thr*tot_head*g)/0.60
#Result
print"Power required =%.1f"%power_reqd,"W =%.3f"%(power_reqd*1e-3),"kW"
#Variable declaration
d=0.15 # diameter of pipe
g=9.81
phi=.0045
#Calculation
import sympy
import math
x=Symbol('x')
u=sympy.solve((7.6+4*phi*(105/.15))*x**2/(2*g)-10)
rate_dis=u[1]*math.pi*d**2/4
#Result
print"\n Rate of discharge =%.d"%(rate_dis*1e3),"kg/s"
#Variable declaration
u1=1.5 # velocity
D1=75e-3 #depth
g=9.81
#Calculation
#The depth of fluid in the channel after the jump is given by:
D2=0.5*(-D1+(D1**2+(8*u1**2*D1/g)**0.5)) #equation 3.113
#If the channel is of uniform cross-sectional area, then:
u2=u1*D1/D2
#Result
print"\n The velocity of fluid in the channel after the jump is =",round(u2,2),"m/s"
#Variable declaration
k=10
n=0.2
Ucl=1 # centre line velocity
l=200 # length of pipe
r=.02 # radius of pipe
dux_dy_1=10
dux_dy_2=50
Ry_1=k*dux_dy_1**0.2
Ry_2=k*dux_dy_2**0.2
#Calculation
#Using the Bingham-plastic model (equation 3.125):
import numpy as np
A=np.array([[1,10],[1,50]])
B=np.array([15.85,21.87])
C=np.linalg.inv(A)*B
Ry=C[0]
Meu_p=C[1]
# Using Equation 3.131
DP=2*k*l*Ucl**n*((n+1)/n)**n*r**(-n-1)
# For a Bingham-plastic fluid:
# The centre line velocity is given by equation 3.145:
X=(l*2*Ry)/(r*DP)
Up=(DP*r**2*(2-4*X+2*X**2))/(8*Meu_p*l)
#Result
print"Plastic viscosity (Meu_p) =",C[1][0]+C[1][1],"N s/m**2"
print"\nYeild stress (Ry) =",C[0][0]+C[0][1],"N s/m**2"
print"\nPressure drop (Bingham plastic model)=%.2e"%DP,"N/m**2"
print"\ncentre line velocity (Bingham plastic model) = ",round(Up[0]+Up[1],2),"m/s (APPROX taken in book)"
#Variable declaration
Meu=0.1 # Viscosity of liquid
d=25e-3 # Diameter of pipe
l=20.0 # length of pipe
DP=1e5 # Pressure drop
n=1/3.0 # flow index of polymer solution
dux_dy=1000.0
k=Meu
#Calculation
Meu_a=Meu
k_poly_sol=Meu_a/(dux_dy)**(n-1)
Ry=10.0*(dux_dy)**n
#From equation 3.136:
#For a power-law fluid:
u2=((DP/(4*k_poly_sol*l))**3)*(n*(d**((n+1)/n)))/(2*(3*n+1))
u1=(DP/(4*k*l))*(d**2)/8.0
ratio=u2/u1
#Result
print"Ratio of the volumetric flow rates of the two liquids =",round(ratio,3)
#Variable declaration
n=0.5
du_dy=0.01
import sympy
mu=sympy.Symbol('mu')
#Calculation
k=mu/(du_dy)**(n-1)
Ry=k*du_dy**(n-1)
#ux=(rho*g/k)**(1/n)*((s-y)**(n+1)/n)*(-n/(n+1)]+constant
#At the surface
y=0
ux=0
#At free surface:
#y=s
#us=(rho*g/k)**(1/n)*(n/(n+1))**(s*(n+1)/n)
s=sympy.Symbol('s')
sn=sympy.Symbol('sn')
#For non-newtonian:
us1=0.00592*sn**6/s**5
#For newtonian:
us2=0.0067*sn**5/s**4
sn_s=1/(us1/us2)
#Result
print" sN/s=",round(sn_s*sn/s,3)