In [6]:

```
from __future__ import division
from sympy import symbols,solve
#Variable declaration:
#From steam tables:
h1 = 1572 #Enthalpy for super heated steam at (P = 40 atm, T = 1000°F) (Btu/lb)
h2 = 1316 #Enthalpy for super heated steam at (P = 20 atm, T = 600°F) (Btu/lb)
h3 = 1151 #Enthalpy for saturated steam (Btu/lb)
h4 = 28.1 #Enthalpy for saturated water (Btu/lb)
m1 = 1000 #Mass flowrate of steam (lb/h)
m = symbols('m') #Mass flow rate of steam (lb/h)
#Calculation:
Dh1 = m1*(h3-h4) #The change in enthalpy for the vaporization of the water stream (Btu/h)
Dh2 = m*(h1-h2) #The change in enthalpy for the cooling of the water stream (Btu/h)
x = solve(Dh1-Dh2,m) #Mass flowrate of steam (lb/h)
m2 = x[0]; #Mass flowrate of steam (lb/h)
#Result:
print "The mass flowrate of the utility steam required is :",round(m2)," lb/h."
```

In [7]:

```
from __future__ import division
#Variable declaration:
#From table 22.1:
QH1 = 12*10**6 #Heat duty for process unit 1 (Btu/h)
QH2 = 6*10**6 #Heat duty for process unit 2 (Btu/h)
QH3 = 23.5*10**6 #Heat duty for process unit 3 (Btu/h)
QH4 = 17*10**6 #Heat duty for process unit 4 (Btu/h)
QH5 = 31*10**6 #Heat duty for process unit 5 (Btu/h)
T1 = 90 #Supply water temperature (°F)
T2 = 115 #Return water temperature (°F)
cP = 1 #Cooling water heat capacity (Btu/(lb.°F))
p = 62*0.1337 #Density of water (lb/gal)
BDR = 5/100 #Blow-down rate
#Calculation:
QHL = (QH1+QH2+QH3+QH4+QH5)/60 #Heat load (Btu/min)
DT = T2-T1 #Change in temperature (°F)
qCW = round(QHL,-5)/(DT*cP*p) #Required cooling water flowrate (gpm)
qBD = BDR*qCW #Blow-down flow (gpm)
#Result:
print "The total flowrate of cooling water required for the services is :",round(qCW,-1)," gpm."
print "The required blow-down flow is :",round(qBD)," gpm."
```

In [8]:

```
from __future__ import division
#Variable declaration:
Q1 = 10*10**6 #Unit heat duty for process unit 1 (Btu/h)
Q2 = 8*10**6 #Unit heat duty for process unit 2 (Btu/h)
Q3 = 12*10**6 #Unit heat duty for process unit 3 (Btu/h)
Q4 = 20*10**6 #Unit heat duty for process unit 4 (Btu/h)
hv = 751 #Enthalpy of vaporization for pressure 500 psig (Btu/lb)
#Calculation:
mB1 = Q1/hv #Mass flowrate of 500 psig steam through unit 1 (lb/h)
mB2 = Q2/hv #Mass flowrate of 500 psig steam through unit 2 (lb/h)
mB3 = Q3/hv #Mass flowrate of 500 psig steam through unit 3 (lb/h)
mB4 = Q4/hv #Mass flowrate of 500 psig steam through unit 4 (lb/h)
mBT = mB1+mB2+mB3+mB4 #Total steam required (lb/h)
#Result:
print "The total steam required is :", round(mBT,-1)," lb/h."
```

In [9]:

```
from __future__ import division
from sympy import symbols,solve
from math import log,pi
#Variable declaration:
po = 53*16.0185 #Density of oil (kg/m^3)
co = 0.46*4186.7 #Heat capacity of oil (J/kg.°C)
muo = 150/1000 #Dynamic viscosity of oil (kg/m.s)
ko = 0.11*1.7303 #Thermal conductivity of oil (W/m.°C)
qo = 28830*4.381*10**-8 #Volumetric flowrate of oil (m^3/s)
pw = 964 #Density of water (kg/m^3)
cw = 4204 #Heat capacity of water (J/kg.°C)
muw = 0.7/3600*1.4881 #Dynamic viscosity of water (kg/m.s)
kw = 0.678 #Thermal conductivity of water (W/m.°C)
qw = 8406*4.381*10**-8 #Volumetric flowrate of water (m^3/s)
t1 = 23.5 #Initial temperature of oil (°C)
t2 = 27 #Final temperature of oil (°C)
T1 = 93 #Water heating temperature of water (°C)
T2 = symbols('T2') #Minimum temperature of heating water (°C)
A = symbols('A') #Heat transfer area (m^2)
Uc = 35.4 #Clean heat transfer coefficient (W/m^2.K)
Rf = 0.0007 #Thermal resistance (m^2.K/W)
D = 6*0.0254 #Inside diameter of pipe (m)
#Calculation:
vo = muo/po #Kinematic viscosity of oil (m^2/s)
mo = po*qo #Mass flowrate of oil (kg/s)
vw = muw/pw #Kinematic viscosity of (m^2/s)
mw = pw*qw #Masss flow rate of water (kg/s)
Q1 = mo*co*(t2-t1) #Duty of exchanger of oil (W)
T2m = t1 #Lowest possible temperature of the water (°C) (part 1)
Qmw = mw*cw*(T1-T2m) #Maximum duty of exchanger of water (W) (part 2)
Q2 = mw*cw*(T1-T2) #Duty of exchanger of water in terms of T2 (W)
x = solve(Q1-Q2,T2) #Solving value for T2 (°C)
T3 = x[0]; #Minimum temperature of heating water (°C)
DT1 = T3-t1 #Inlet temperature difference (°C)
DT2 = T1-t2 #Outlet temperature difference (°C)
DTlm = (DT1-DT2)/log(DT1/DT2) #Log mean temperature difference (°C)
Ud1 = 1/Uc+Rf #Dirty heat transfer coefficient (W/m^2.K) (part 3)
Ud2 = 34.6 #Dirty heat transfer coefficient (W/m^2.°C)
Q3 = Ud2*A*DTlm #Duty of exchanger (W) (part 4)
y = solve(Q1-Q3,A) #Heat transfer area (m^2)
A1 = y[0]; #Required heat transfer area (m^2)
L = A1/(pi*D) #Required heat transfer length (m)
Qmo = mo*co*(T1-t1) #Maximum duty of exchanger of oil (W) (part 5)
Qm = Qmw #Maximum duty of exchanger (W)
E = Q1/Qm*100 #Effectiveness (%)
NTU = Ud2*A1/(mw*cw) #Number of transfer units
#Result:
print "1. The lowest possible temperature of the water is :",T2m," °C ."
print "2. The log mean temperature difference is :",round(DTlm,2)," °C ."
print "3. The overall heat transfer coefficient for the new clean exchanger is :",round(Ud2,1)," (W/m^2.°C ."
print "4. The length of the double pipe heat exchanger is :",round(L,2)," m ."
print "5. The effectiveness of the exchanger is :",round(E,2)," % ."
print " The NTU of the exchanger is :",round(NTU,4)," ."
```

In [10]:

```
from __future__ import division
from math import log,pi
#Variable declaration:
#From example 22.9:
t1 = 23.5 #Initial temperature of oil (°C)
t2 = 27 #Final temperature of oil (°C)
T1 = 93 #Water heating temperature of water (°C)
T2 = 88.16 #Minimum temperature of heating water (°C)
U = 34.6 #Overall heat transfer coefficient (W/m^2.°C)
Q = 7227.2 #Duty of exchanger (W)
D = 6*0.0254 #Inside diameter of pipe (m)
l = 6.68 #Previous heat transfer length (m)
#Calculation:
DT1 = T1-t1 #Inlet temperature difference (°C)
DT2 = T2-t2 #Outlet temperature difference (°C)
DTlm = (DT1-DT2)/log(DT1/DT2) #Log mean temperature difference (°C)
A = Q/(U*DTlm) #Required heat transfer area (m^2)
L = A/(pi*D) #Required heat transfer length (m)
#Result:
print "The length of the parallel pipe heat exchanger is :",round(L,2)," m ."
if L>l:
print "The tube length would increase slightly."
elif L<l:
print "The tube length would decrease slightly."
```

In [1]:

```
from __future__ import division
from scipy.optimize import fsolve
from math import log
#Variable declaration:
T = 80 #Pipe surface temperature (°F)
t1 = 10 #Inlet temperature of brine solution (°F)
m = 1200 #mass flowrate of solution (kg/s)
c = 0.99 #Heat capacity of brine solution (Btu/lb.°F)
A = 2.5 #Heat transfer area (ft^2)
U1 = 150 #Overall heat transfer coefficient at temperature approach (Btu/h.ft^2.°F)
U2 = 140 #Overall heat transfer coefficient at inlet brine temperature (Btu/h.ft^2.°F)
#Calculation:
DT1 = T-t1 #Temperature approach at the pipe entrance (°F)
def equation(DT2):
Q1 = m*c*(DT1-DT2) #Energy balance to the brine solution across the full length of the pipe (Btu/h)
DTlm = (DT1-DT2)*log(DT2/DT1) #Log mean temperature difference (°F)
Q2 = A*(U2*DT1-U1*DT2)/log((U2*DT1)/(U1*DT2)) #Heat transfer rate (Btu/h)
return Q2-Q1
t2 = round(T-fsolve(equation,1),1) #The temperature of the brine solution (°F)
#Results:
print 'The temperature of brine solution is: ',(t2-32)/1.8,'°C'
```

In [13]:

```
from __future__ import division
from math import log
#Variable declaration:
m = 1200 #mass flowrate of solution (kg/s)
c = 0.99 #Heat capacity of brine solution (Btu/lb.°F)
DT1 = 70 #Temperature approach at the pipe entrance (°F)
DT2 = 51.6 #Temperature difference at the pipe exit (°F)
#Calculation:
Q = m*c*(DT1-DT2) #Heat transfer rate (Btu/h)
DTlm = (DT1-DT2)/log(DT1/DT2) #Log mean temperature difference (°F)
#Result:
print "1. The rate of heat transfer is :",round(Q,-1)," Btu/h."
print "Or, the rate of heat transfer is :",round(Q/3.412)," W."
print "2. The log mean temperature difference is :",round(DTlm,1)," °F."
print "Or, the log mean temperature difference is :",round(DTlm/1.8,1)," °C."
```

In [25]:

```
from __future__ import division
from math import log
#Variable declaration:
Too = 100 #Steam temperature (°C)
Ti = 18 #Initial temperature of liquid TCA (°C)
Tf = 74 #Final temperature of liquid TCA (°C)
t = 180 #Heating time (s)
p = 87.4 #Density of TCA (lb/ft^3)
V = 18 #Kinematic viscosity of TCA (m^2/s)
cp = 0.23 #Heat capacity of TCA (Btu/lb.°F)
U = 200 #Overall heat transfer coefficient (Btu/h.ft^2.°F)
#Calculation:
ui = Too-Ti #Initial excess temperature (°C)
uf = Too-Tf #Final excess temperature (°C)
R = log(ui/uf) #Ratio t/r
r = t/R #Thermal time constant (s)
A = p*V*cp/(3600*U*r) #Required heating area (ft^3)
Ti_F = Ti*9/5+32 #Initial temperature in fahrenheit scale (°F)
Tf_F = Tf*9/5+32 #Final temperature in fahrenheit scale (°F)
Q = p*V*cp*(Tf_F-Ti_F) #Total amount of heat added (Btu)
#Result:
print "1. The required surface area of the heating coil is :",(A,1)," ft^3 ."
print "2. The total heat added to the liquid TCA is :",round(Q)," Btu ."
```

In [27]:

```
#Variable declaration:
m1 = 62000 #Mass flowrate of alcohol (lb/h)
h1 = 365 #Enthalpy of vapour (Btu/lb)
cp = 1 #Heat capacity of water (Btu/lb.°F)
T1 = 85 #Entering temperature of water (°F)
T2 = 120 #Exit temperature of water (°F)
a1 = 2.11 #Flow area for the shell side (ft^2)
N = 700 #Total number of tubes
a2 = 0.546 #Flow area per tube (in^2/tube)
n = 4 #Number of tube passes
p = 62.5 #Density of water (lb/ft^3)
L = 16 #Length of condenser (ft)
hio = 862.4 #Cooling water inside film coefficient (Btu/h.ft^2.°F)
g = 9.8 #Gravitational accleration (m^2/s)
Rf = 0.003 #Fouling factor (Btu/h.ft^2.°F)
#Calculation:
Q1 = m1*h1 #Heat loss from alcohol (Btu/h)
Q2 = Q1 #Heat gained by water (Btu/h)
DT = T2-T1 #Temperature difference (°F)
m2 = Q2/(cp*DT) #Water mass flow rate (lb/h)
LMTD = ((T2-32)-(T1-32))/log((T2-32)/(T1-32)) #Log mean temperature difference (°F)
at = (N*a2)/(144*n) #Total flow area for tube side (ft^2)
G1 = m1/a1 #Mass velocity of flow in shell side (lb/h.ft^2)
G2 = m2/at #Mass velocity of flow in tube side (lb/h.ft^2)
V = G2/(3600*p) #Velocity of water (ft/s)
G3 = m1/(L*N)**(2/3) #Loading G (lb/h.ft)
#For alcohol:
kf = 0.105 #Thermal conductivity (Btu/h.ft.°F)
muf = 0.55*2.42 #Dynamic viscosity (lb/ft.h)
sf = 0.79 #
pf = sf*p #Density (lb/ft^3)
h = 151*(((kf**3)*(pf**2)*g*muf)/((muf**2)*n*G3))**(1/3) #Heat transfer coefficient for the shell side (Btu/h.ft^2.°F)
ho = h #Outside heat transfer coefficient of the tube bundle (Btu/h.ft^2.°F)
Uc = (hio*ho)/(hio+ho) #Overall heat transfer coefficient for a new (clean) heat exchanger (Btu/h.ft^2.°F)
A = N*L*0.2618 #Area for heat transfer (ft^2)
Ud = Q1/(A*DT) #Design (D) overall heat transfer coefficient (Btu/h.ft^2.°F)
Rd = (Uc-Ud)/(Uc*Ud) #Dirt (d) factor (Btu/h.ft^2.°F)
#Result:
print "The dirt (d) factor is :",round(Rd,4)," Btu/h.ft^2.°F ."
if (Rd>Rd):
print "Therefore, the exchanger as specified is unsuitable for these process conditions since the fouling factor is above the recommended value. Cleaning is recommended."
else:
print "Therefore, the exchanger as specified is suitable for these process conditions since the fouling factor is below the recommended value. Cleaning is not recommended."
```