In [1]:

```
#Force on submerged sphere
from math import pi
# Variable declaration
Rho_air = 1.137 #Density of air at 37.8 degC (kg/m3)
u = 0.000019 #Viscosity of air (Pa.s)
Dp = 0.042 #Diameter of the sphere (m)
V = 23.0 #velocity of the sphere (m/s)
# Data SI Units
#Calculation
Nre = Dp*Rho_air*V/(u)
Cd = 0.47 #Drag coefficient from fig 3.1-2
Ap = pi*Dp**2/4
Fd = Cd*V**2*Rho_air*Ap/2
#Result
print 'Reynolds number %4.3e'%Nre
print "The drag coefficient of the sphere is",Cd
print "The force on the cylinder is", round(Fd,4),"N"
```

In [2]:

```
#Force on a cylinder in a tunnel
# Variable declaration
V = 1. #Velocity of water in the tunnel (m/s)
d = 0.09 #Diameter of cylinder (m)
Rho_H2O = 997.2 #Density of water (kg/m3)
L = 1. #Length of the tunnel (m)
mu = 0.0009142 #Viscosity of water (Pa.s)
T = 24. #Temerature of water (Â°C)
# Data SI Units
#Calculation
Nre = d*Rho_H2O*V/(mu)
Cd = 1.4 #Drag Coefficient for cylinder from fig 3.1-2
Ap = L*d
Fd = Cd*V**2*Rho_H2O*Ap/2
#Result
print 'Reynolds number %4.3e'%Nre
print "The drag coefficient of the cylinder is",Cd
print "The force on the sphere is ",round(Fd,2),"N"
```

In [3]:

```
#Surface area in Packed Bed of Cylinders
# Variable declaration
D = 0.02 #Diamter of the cylinder (m)
h = 0.02 #Length of the cylinder (m)
d_pb = 962. #Density of packed bed (kg/m3)
d_sc = 1600. #Density of solid cylinders (kg/m3)
m_pb = 962. #Mass of the packed bed (kg)
v_pb = 1. #Volume of packed bed (m3)
v_t = 1. #Total volume of the bed (m3)
# Calculation
v_sc = m_pb/d_sc
#(a) Calculate void fraction
#e = Volume of voids in bed/total volume of bed
e = (v_pb - v_sc)/v_t
#(b)Calculate the effective Diameter of the particle
#Dp = 6/(6/D)
Dp = 6/(6/D)
#(c) Calculate the value of "a"
# a = 6*(1-e)/Dp
a = 6*(1-e)/Dp
#Result
print "(a) The void fraction of bed is",round(e,3)
print "(b) The effective diameter of the particle is",round(Dp,4),"m"
print "(c) The calculated value of 'a' is ",round(a,2), "1/m"
print 'The answers are correct because of book uses rounded numbers'
```

In [10]:

```
#Pressure drop and flow of gases through packed beds
from math import pi
from scipy.optimize import root
# Variable declaration
d = 0.0127 #Diameter of the pipe (m)
e = 0.38 #Void fraction
d_bed = 0.61 #Bed diameter (m)
h = 2.44 #Height of bed (m)
p1 = 1.1 #Pressure P1 (atm)
T = 311. #Temperature of water (K)
R = 8314.34 #Gas constant
M = 28.97 #Molecular weight of air
L = 2.44 #Length of the bed (m)
Mdot = 0.358 #Mass rate of air, kg/s
# Data
mu = 0.000019 #Viscosity of water (Pa.s)
# Calculation
A = pi*d_bed**2/4
G = Mdot/A
Nre = d*G/((1-e)*mu)
#Rho_av = M*Pav/(R*T)
p1 = p1*101325. #convert to pascal
er = 0.1
f = lambda dp:dp*(M*(p1+0.5*dp)/(R*T))*d*e**3/(G**2*L*(1-e))-(150./Nre + 1.75)
sol = root(f,0.049e5)
dp = sol.x[0]
#Result
print "The calclated Reynolds number is",round(Nre,0)
print 'The calculated pressure drop is %6.5e Pa'%(dp)
print 'The answer is difference than book because of method of solution, and is more correct.\nBook assumes a pressure drop and calculates density at average pressure'
```

In [11]:

```
#Mean Diameter for a Particle
# Variable declaration
# Data
x1 = 0.25
x2 = 0.40
x3 = 0.35
Dp1 = 25.
Dp2 = 50.
Dp3 = 75.
fi = 0.68
# Calculation
#Dpm = 1/(x1/(fi*Dp1) + x2/(fi*Dp2) + x3/(x3/(fi*Dp3))
Dpm = 1/((x1/(fi*Dp1)) + (x2/(fi*Dp2)) + (x3/(fi*Dp3)))
#Result
print "The calculated effective mean diameter is ",round(Dpm,4),"mm"
```

In [13]:

```
#Minimum Velocity for Fluidization
from scipy.optimize import root
# Variable declaration
d = 0.12 #Size of the particle (mm)
fi = 0.88 #Shape of the particle
P = 2. #Pressure of the fluidized bed (atm)
v = 0.42 #Voidage
A = 0.30 #Cross section of the bed (m2)
M = 300. #Weight of the solid (kg)
ep1 = 0.
ep_mf = 0.42 #voidage at minimum fluidisation
#Data
mua = 1.85e-5 #Viscosity of air (Pa.s)
rhoa = 2.374 #Density of air at 2 atm, kg/m3
p = 2.0165e5 #Pressure, Pa
rhop = 1000 #Density of particle, kg/m3
Dp = 0.00012 #Particle diameter, m
g = 9.80665 #m/s2
# Calculation
#Part A
V = M/rhop
L1 = V/A
Lmf = L1*(1. - ep1)/(1 - ep_mf)
#Part B
delp = Lmf*(1.-ep_mf)*(rhop-rhoa)*g
#Part C
#Nremf = d*umf*rhoa/mua
Nrea = Dp*rhoa/mua
f = lambda u: 1.75*(Nrea*u)**2/(fi*ep_mf**3)+150*(1.-ep_mf)*(Nrea*u)/(fi**2*ep_mf**3)-Dp**3*rhoa*(rhop-rhoa)*g/mua**2
sol = root(f,0.001)
umf = sol.x[0]
Nremf = Dp*rhoa*umf/mua
f1 = lambda u: Dp*rhoa*u/mua - sqrt(33.7**2 + 0.0408*Dp**3*rhoa*(rhop-rhoa)*g/mua**2) + 33.7
sol = root(f1,umf)
umfn = sol.x[0]
#Result
print "(a) The minimum height of the fluidized bed is",round(Lmf,3),"m"
print '(b) Pressure drop under conditions of minimum fluidization is %5.4e'%(delp),"Pa"
print "(c) Minimum fluidozation velocity",round(umf,6), "m/s"
print " Reynold number at Minimum fluidization is",round(Nremf,5)
print '(d) Minimum fluidozation velocity using simplified relation %7.6f'%umfn
print 'The answer is correct because of book uses rounded numbers'
```

In [14]:

```
#Expansion of Fluidized Bed
from scipy.optimize import root
# Variable declaration
Nre_mf = 0.07723 #From previous problem
vmf = 0.005015
epmf = 0.42
#Calculation
f = lambda K:vmf-K*epmf**3/(1-epmf)
sol = root(f,0.01)
K = sol.x[0]
vop = 3*vmf
f1 = lambda ep:vop-K*ep**3/(1-ep)
sol = root(f1,0.1)
ep1 = sol.x[0]
#Result
print 'Operating velocity %6.5f m/s'%vop
print 'Voidage of bed at operating velocity %4.3f m/s'%(ep1)
```

In [22]:

```
#Flow Measurement Using a Pitot Tube
from math import pi
# Variable declaration
d = 600. #Diameter of circular duct (m)
dh1 = 10.7 #Pitot tube reading (mm)
dh2 = 205. #Pitot tube reading (mm)
Cp = 0.98 #Pitot tube coefficient
mu = 0.0000203 #Viscosity of air (Pa.s)
rhoa = 1.043 #Density of air (kg/m3)
delh = 0.205 #Head loss in height of water (m)
rhow = 1000. #Density of water (kg/m3)
g = 9.80665 #Gravitational accleration (m/s2)
#Calculation
d = 600./1e3
dp1 = (dh2/1e3)*(rhow - rhoa)*g
p1abs = 101325 + dp1
rhoac = rhoa*p1abs/101325
dp = (dh1/1e3)*g*(rhow - rhoa)
v = Cp*sqrt(2*dp/rhoa)
Nre = d*v*rhoa/mu
A = 3.14*d**2/4
vav = 0.85*v
Q = A*vav
#Result
print 'Total absolute pressure %7.1f Pa'%p1abs
print 'Corrected density of air %5.4f kg/m3'%rhoac
print 'Velocity at centre %5.3f m/s'%v
print 'Average velocity through pipe %3.2f m/s'%vav
print 'Reynolds number %5.3f'%Nre
print "The Volumetric flow rate is",round(Q,4),"m/s"
print 'The answers are correct because of book uses rounded numbers'
```

In [26]:

```
#Metering Oil Flow by an Orifice
from math import pi
#Variable declaration
d0 = 0.0566 #Diameter of orifice (m)
d1 = 0.1541 #Diameter of pipe (m)
Rhooil = 878. #Density of oil (kg/m3)
mu = 0.0041 #Viscoity of oil (cp)
dP = 93200. #Pressure diffrence across orifice (kN/m2)
Co = 0.61 #Coeficient of discharge of orifice
#Calculations
beta = d0/d1
v = Co*sqrt(2*dP/Rhooil)/sqrt(1 - beta**4)
Q = v*pi*d0**2/4
Nre = d0*v*Rhooil/mu
#Result
print 'Velocity of oil %5.3f m/s'%v
print "The volumetric flowrate",round(Q,5), "m3/s"
print 'Reynolds number %5.4e'%Nre
```

In [27]:

```
#Calculation of Brake Horse Power of a Pump
#Variable declaration
m = 40. #Flowrate for the Pump (gal/min)
mfps = 5.56 #Flowrate of the Pump in fps units (lbm/s)
D = 62.4 #Density of water in fps units (lbm/ft3)
n = .60 #Efficiency of the pump
H = 38.5 #Developed Head (ft)
#Calculations
mfps = m*(1./60)*(1./7.481)*62.4
Ws = -H
Bhp = -Ws*mfps/(n*550)
#Result
print "The Calculated Brake Horse Power is ",round(Bhp,2), "hp"
```

In [7]:

```
#Brake-kQ Power of a Centrifugal Fan
#Variable declaration
m = 28.32 #Flowrate of the air (m3/min)
Ma = 28.97 #Molecular weight of air
V = 22.414 #Volume of 1 kg air at 101.3 atm pressure and 273.2 K
T1 = 273.2 #Temperature of air at atmospheric pressure (K)
T2 = 366.3 #Temperature of air at suction (K)
T3 = 294.1
P1 = 760. #Atmospheric pressure of air (mm Hg)
P2 = 741.7 #Suction Pressure of air (mm Hg)
P3 = 769.6 #Discharge Pressure of air (mm Hg)
n = 60. #Efficiency of the pump
confac = 101325. #Conversion factor pressure from (mm Hg) to (N/m2) (N/m2.atm)
rhow = 0.958 #Density of water (kg/m3)
V1 = 0. #Velocity of air at suction (m/s2)
V2= 45.7 #Velocity of air at discharge (m/s2)
z1 = 0. #Height at suction (m)
z2 = 0. #Height at discharge (m)
g = 9.8 #Gravitational accleration (m/s)
F = 0.
#Calculations
n = n/100
Rho1 = Ma*T1*P2/(V*T2*P1)
Rho2 = Rho1*P3/P2
Rhoavg = (Rho1 + Rho2)/2
mmks = m*(1./60)*(1./22.414)*(T1/T3)*(Ma)
P = (P3 - P2)*confac/(P1*rhow)
#z1*g + V1**2/2 + P1/Rho_avg + Ws = z2*g + V2**2/2 + P2/Rho_avg + F
#-Ws = -z1*g - V1**2/2 - P1/Rho_avg +z2*g + V2**2/2 + P2/Rho_avg + F
Ws = -z1*g - V1**2/2 + P +z2*g + V2**2/2 + F
BkW = Ws*mmks/(n*1000)
#Result
print "The Calculated Brake Horse Power is",round(BkW,2), "kW"
```

In [30]:

```
#Compression of Methane
from math import log
#Variable Declaration
Q = 0.00756 #Flowrate of methane (kg.mol/s)
P1 = 137.9 #Initial pressure (kPa)
P2 = 551.6 #Final pressure (kPa)
T1 = 26.7 #Temperature of methane (degC)
M_CH4 = 16. #Molecular weight of Methane
gama = 1.31
R = 8314.3 #Gas constant
n = .8 #Efficiency of compressor
#Calculation
#(a) Calculation for part (a)
T1_K = T1 + 273.2
Q_mks = Q*M_CH4
Ws = gama*R*T1_K*((P2/P1)**((gama - 1)/gama) - 1)/((gama - 1)*M_CH4)
B_kW = Ws*Q_mks/(n*1000)
#(b) Calculation for part (b)
# Ws_b = 2.3026*R*T1_K*math.log10(P2/P1)/M_CH4
Ws_b = (2.3026/M_CH4)*R*T1_K*log(P2/P1,10)
B_kW_b = Ws_b*Q_mks/(n*1000)
#Result
print "The power required for adiabatic compression",round(B_kW,2),"kW"
print "The power required for isothermal compression",round(B_kW_b,2),"kW"
print 'The answers are correct because of book uses rounded numbers'
```

In [31]:

```
#Power Consumption by an Agitator
#Variable Declaration
Dt = 1.83 #The tank diameter (m)
W = 0.122 #Width of the tank (m)
Da = 0.61 #The turbine diameter (m)
J = 0.15 #Width of baffle (m)
Vrpm = 90. #Speed of the turbine (rpm)
Rho = 929. #Density of liquid (kg/m3)
mu = 10. #Viscosity of liquid (cp)
mub = 100000. #Viscosity of the in part (b)liquid (cp)
#Calcualtion
mu = mu*1e-3
mub = mub*1e-3
#Calculation for (a)
Vrps = Vrpm/60.
Nre = Da**2*Vrps*Rho/mu
NpT = 5.
P = NpT*Rho*Vrps**3*Da**5/1000.
#Calculation for (b)
Nreb = Da*Vrps*Rho/mub
NpL = 14.
Pb = NpL*Rho*Vrps**3*Da**5/1000.
#Result
print "(a)The power required by the mixer is",round(P,3),"kW"
print "(b)The power requird by the mixer is for higher viscosity",round(Pb,2),"kW"
```

In [35]:

```
#Scale-up of Turbine Agitation System
from math import pi
#Variable Declaration
Dt1 = 1.83 #Tank diameter (m)
Da1 = 0.61 #Diameter of turbine (m)
W1 = 0.122 #Width of turbine (m)
J1 = 0.15 #Width of baffle (m)
N1 = 1.5 #Speed of the turbine (rev/s)
Rho = 929. #Density of fluid (kg/m3)
mu = 0.01 #Viscosity of the fluid (Pa.s)
H1 = Dt1
Np = 5.0
#Calcualtion
V1 = pi*Dt1**2*H1/4.
V2 = 3.*V1
R = (V2/V1)**(1./3)
Dt2 = R*Dt1
Da2 = R*Da1
W2 = R*W1
J2 = R*J1
P1 = Np*Rho*N1**3*Da1**5
P1_kW = P1/1000.
#(a)Calculation for equal rate of mass transfer
n = 2./3
N2 = N1*(1/R)**n
Nre = Da2**2*N2*Rho/mu
P2 = Np*Rho*N2**3*Da2**5
P2_kW = P2/1000.
#The power per unit volume
P_v1 = P1_kW/V1
P_v2 = P2_kW/V2
#(b)Calculation for equal liquid motion
n= 1.
N2_b = N1*(1./R)**n
P2_b = Np*Rho*N2_b**3*Da2**5
P2_vb = P2_b/V2
#Result
print "(a) For equal mass transfer"
print ' Total power for smaller tank %5.3f W and \n power required per unit volume is %5.4f W' %(P1,P_v1)
print ' Total power for larger tank %5.3f W and \n power required per unit volume is %5.4f W' %(P2,P_v2)
print "(b) The power per unit volume for equal liquid motion is",round(P2_vb/1000,4),"kW"
print 'The answers are different than book because book uses rounded numbers'
```

In [36]:

```
#Pressure Drop of Power-Law Fluid in Laminar Flow
#Variable Declaration
Rho = 1041. #Density of fluid (kg/m3)
L = 14.9 #Length of the tube (m)
D = 0.0524 #Inside diameter of the tube (m)
V = 0.0728 #Average Velocity of the flowing fluid (m/s)
K = 15.23 #Rheological properties of fluid
n = 0.4
#Calcualtion
#Calculation for part (a)
delP = (K*4*L/D)*(8*V/D)**n
Ff = delP/Rho
Nre = ((D**n)*(V**(2-n))*Rho)/(K*8**(n-1))
print 'Nre = %5.4f is in Laminar range' %Nre
#Calculation for part (b)
f = 16./Nre
delPb = 4*f*Rho*L*V**2/(D*2)
#Result
print "(a) The pressure drop calculated is",round(delP,0),"N/m2"
print " The friction loss calculated is",round(Ff,2),"J/kg"
print "(b) The pressure drop calculated by using the friction factor method is",round(delP/1000,2),"kN/m2"
print 'The answers are different than book because book uses rounded numbers'
```

In [37]:

```
#Turbulent Flow of Power-Law Fluid
#Variable Declaration
Rho = 961. #Density of fluid (kg/m3)
Di = 0.0508 #Inner diameter of circular tube (m)
V_av = 6.1 #Average velocity of fluid (m/s)
K = 2.744 #Consisitency index
n = 0.30 #Flow behaiviour index
L = 30.5 #Length of tubing, m
f = 0.0032 #Friction factor for turbulent flow
#Calcualtion
Nre = Di**n*V_av**(2-n)*Rho/K*8**(n-1)
delP = 4*f*Rho*L*V_av**2/(2*Di)
delP_kN = delP/1000
#Result
print "The frictional pressure drop for turbine is",round(delP_kN,1), "kN/m2"
```