In [1]:

```
import math
# Initialization of Variable
mu = 6.3/100; #viscosity
rho = 1170.; #density
d = .3; #diameter of pipe
b = 0.142; #conversion factor
pi=3.14;
#calculation
Q = 150000.*b/24./3600 #flow rate
u = Q/pi/d**2.*4 #flow speed
Re = rho*u*d/mu
if Re>4000:
print "the system is in turbulent motion as reynolds no is greater than 4000: %.3f"%Re
elif Re<2100 :
print "the system is in laminar motion" ,Re
else:
print "the system is in transition motion",Re
mu = 5.29/1000;
d = 0.06;
G = 0.32; #mass flow rate
Re = 4*G/pi/d/mu;
if Re>4000 :
print "the system is in turbulent motion as reynolds no is greater than 4000: ",Re
elif Re<2100 :
print "the system is in laminar motion as Re is less than 2100 : %.3f" %Re
else:
print "the system is in transition motion",Re
```

In [2]:

```
import math
# Initialization of Variable
G=21.2; #mass flow rate
rho=1120; #density
d=0.075; #diameter
l=50.;
g=9.81;
pi=3.14;
delz=24./100; #head difference
#calculation
delP=delz*rho*g; #differece of pressure
u=4*G/pi/d**2/rho;
phi=delP/rho*d/l/u**2./4*50;
print "The Stanton-Pannel friction factor per unit of length: %f"%phi
R=phi*rho*u**2;
print "shear stress exerted by liquid on the pipe wall in (N/m**2) : %.3f"% R
F=pi*d*l*R;
print "Total shear force exerted on the pipe in (N): %.3f"%F
Re=(.0396/phi)**4;#reynold's no.
mu=rho*u*d/Re;
print "viscosity of liquid in (kg/m/s):%f" %mu
```

In [3]:

```
import math
# Initialization of Variable
pi=3.14;
g=9.81;
d=0.00125;
Re=2100;
l=0.035;
rhoc=779. #density of cyclohexane
rhow=999. #density of water
muc=1.02/1000; #viscosity of cyclo hexane
#calculation
u=Re*muc/rhoc/d; #speed
Q=pi*d**2*u/4; #volumetric flow rate
delP=32*muc*u*l/d**2;#pressure difference
delz=delP/(rhow-rhoc)/g;
print "the difference between the rise levels of manometer in (cm): %.4f"%(delz*100 )
```

In [5]:

```
import math
# Initialization of Variable
d=0.05;
l=12.;
per=100.-2;
pi=3.1428
#calculation
s=math.sqrt(per/100/4*d**2);#radius of core of pure material
V=pi*d**2./4.*l/(2.*(1-(2.*s)**2/d**2));
print "The volume of pure material so that 2%% technical material appears at the end in (m**3): %.3f"%V
```

In [6]:

```
import math
# Initialization of Variable
a=1./2*(1-1/math.sqrt(2.));
print "The percent value of d for which where pitot tube is kept show average velocity \
in streamline flow in (%%) : %.4f"%(a*100)
a=(49./60)**7/2.
print "The percent value of d for which where pitot tube is kept show average velocity in \
turbulent flow in (%%) : %.4f"%(a*100)
#on equating coefficient of r
y=a*2; #y=a/100*2*r
s=1-y; #s=r-y
#on equating coeff. of 1/4/mu*del(P)/del(l)
E=(1-s**2-.5)/.5;
print "The error shown by pitot tube at new position if value of streamlined flow flow was\
to be obtained in (%%) : %.4f"%E
print "The - sign indicates that it will print lay reduced velocity than what actually is"
```

In [7]:

```
# Initialization of Variable
rhon = 1068. #density of nitric acid
mun = 1.06/1000. #viscosity of nitric acid
g = 9.81
l = 278.
d = 0.032
alpha = 1.
h2 = 57.4 #height to be raised
h1 = 5. #height from which to be raised
e = .0035/1000. #roughness
G = 2.35 #mass flow rate
pi = 3.14
#calculations
#part 1
u = 4.*G/rhon/pi/d**2
Re = rhon*d*u/mun
rr = e/d #relative roughness
#Reading's from Moody's Chart
phi = .00225 #friction coeff.
W = u**2/2.+g*(h2-h1)+4*phi*l*u**2/d #The work done/kg of fluid flow in J/kg
V = abs(W)*G
print "The Power required to pump acid in kW : %.4f"%(abs(V)/1000)
#part 2
P2 = -u**2*rhon/2.+g*(h1)*rhon+abs(W+2)*rhon
print "The gauge pressure at pump outlet when piping is new in (kPa) : %.4f"%(P2/1000)
#part 3
e = .05/1000
Re = rhon*d*u/mun
rr = e/d
#Reading's from Moody's Chart
phi = 0.0029
W = u**2/2+g*(h2-h1)+4*phi*l*u**2/d
Vnew = abs(W)*G
Pi = (Vnew-V)/V*100.
print "The increase in power required to transfer in old pipe in (%%): %.4f"%Pi
#part 4
P2 = -u**2*rhon/2+g*(h1)*rhon+abs(W+2)*rhon
print "The gauge pressure at pump outlet when piping is old in (kPa) :%.4f"%(P2/1000)
```

In [9]:

```
import math
# Initialization of Variable
rho=990.;
mu=5.88/10000;
g=9.81;
pi=3.14;
temp=46.+273
e=1.8/10000 #absolute roughness
Q=4800./1000./3600;
l=155.;
h=10.5;
d=0.038;
delh=1.54 #head loss at heat exchanger
effi=0.6 #efficiency
#calculations
u=Q*4./pi/d**2;
Re=rho*d*u/mu;
rr=e/d #relative roughness
#from moody's diagram
phi=0.0038 #friction factor
alpha=1. #constant
leff=l+h+200*d+90*d;
Phe=g*delh #pressure head lost at heat exchanger
W=u**2/2/alpha+Phe+g*h+4*phi*leff*u**2/d; #work done by pump
G=Q*rho; #mass flow rate
P=W*G; #power required by pump
Pd=P/effi #power required to drive pump
print "power required to drive pump in (kW) : %.4f"%(Pd/1000)
P2=(-u**2/2/alpha+W)*rho;
print "The gauge pressure in (kPa): %.4f"%(P2/1000)
```

In [10]:

```
import math
# Initialization of Variable
rho=908.;
mu=3.9/100;
g=9.81;
pi=3.14;
d=0.105;
l=87.;
h=16.8;
e=0.046/1000; #absolute roughness
#calculations
#part1
P=-rho*g*h; #change in pressure
a=-P*rho*d**3/4/l/mu**2 #a=phi*Re**2
#using graph given in book(appendix)
Re=8000.
u=mu*Re/rho/d
Q=u*pi*d**2/4.
print "Volumetric flow rate initial (m**3/s): %.4f"%Q
#part 2
W=320.;
Pd=W*rho; #pressure drop by pump
P=P-Pd;
a=-P*rho*d**3./4./l/mu**2 #a=phi*Re**2
#using graph given in book(appendix)
Re=15000.;
u=mu*Re/rho/d;
Q=u*pi*d**2./4;
print "Volumetric flow rate final(part 2) (m**3/s) : %.4f"%Q
```

In [11]:

```
import math
from numpy import linspace
# Initialization of Variable
rho=1000.;
mu=1.25/1000;
g=9.81;
pi=3.14
d = 0.105
d1=0.28; #diameter of tank
d2=0.0042; #diameter of pipe
l=0.52; #length of pipe
rr=1.2/1000./d; #relative roughness
phid=0.00475;
print "It is derived from tyhe graph giben in appedix and can be seen \
is arying b/w 0.0047 & 0.0048 dependent on D which varies from 0.25 to 0.45 : %f"%phid
#calculations
def intregrate():
s=0
for i in range(0,1000):
D=linspace(0.25,0.45,1000);
y=math.sqrt(((pi*d1**2./pi/d2**2)**2-1)/2/9.81+(4*phid*l*(pi*d1**2/pi \
/d2**2)**2)/d2/9.81)*((0.52+D[i])**-0.5)*2/10000;
s=s+y;
a=s;
return a
b=intregrate();
print "Time required to water level to fall in the tank in (s): %.4f"%b
```

In [17]:

```
import math
# Initialization of Variable
rho=1000.;
mu=1.42/1000;
g=9.81;
pi=3.14;
l=485.;
h=4.5
e=8.2/100000;
Q=1500.*4.545/1000/3600;
print "assume d as 6cm"
d=0.06;
u=4*Q/pi/d**2;
Re=rho*d*u/mu;
rr=e/d; #relative roughness
#using moody's chart
phi=0.0033 #friction coeff.
d=(64*phi*l*Q**2/pi**2/g/h)**0.2;
print "The calculated d after (1st iteration which is close to what we\
assume so we do not do any more iteration) in(cm) %d "%(d*100)
```

In [ ]:

```
```