In [2]:

```
#Variable declaration:
scfm = 20000.0 #Volumetric flow rate of air at standard conditions (scfm)
H1 = 1170.0 #Enthalpy at 200°F (Btu/lbmol)
H2 = 14970.0 #Enthalpy at 2000°F (Btu/lbmol)
Cp = 7.53 #Average heat capacity (Btu/lbmol.°F)
T1 = 200.0 #Initial temperature (°F)
T2 = 2000.0 #Final temperature (°F)
#Calculation:
n = scfm/359.0 #Flow rate of air in a molar flow rate (lbmol/min)
DH = H2 - H1 #Change in enthalpy (Btu/lbmol)
DT = T2 - T1 #Change in temperature (°F)
Q1 = n*DH #Heat transfer rate using enthalpy data (Btu/min)
Q2 = n*Cp*DT #Heat transfer rate using the average heat capacity data (Btu/min)
#Result:
print "The heat transfer rate using enthalpy data is :",round(Q1/10**5,2)," x 10^5 Btu/min."
print "The heat transfer rate using the average heat capacity data is :",round(Q2/10**5,2)," x 10^5 Btu/min."
```

In [3]:

```
#Variable declaration:
n = 1200.0 #Flow rate of air in a molar flow rate (lbmol/min)
Cp = 0.26 #Average heat capacity (Btu/lbmol.°F)
T1 = 200.0 #Initial temperature (°F)
T2 = 1200.0 #Final temperature (°F)
#Calculation:
DT = T2 - T1 #Change in temperature (°F)
Q = n*Cp*DT #Required heat rate (Btu/min)
#Result:
print "The required heat rate is :",round(Q/10**5,2)," x 10^5 Btu/min ."
```

In [4]:

```
#Variable declaration:
Tc1 = 25.0 #Initial temperature of cold fluid (°C)
Th1 = 72.0 #Initial temperature of hot fluid (°C)
Th2 = 84.0 #Final temperature of hot fluid (°C)
#Calculation:
#From equation 14.2:
Tc2 = (Th2-Th1)+Tc1 #Final temperature of cold fluid (°C)
#Result:
print "The final temperature of the cold liquid is :",Tc2," °C ."
print "There is a printing mistake in unit of final temperature in book."
```

In [5]:

```
#Variable declaration:
Ts = 100.0 #Steam temperature at 1 atm (°C)
Tl = 25.0 #Fluid temperature (°C)
#Calculation:
DTlm = Ts - Tl #Log mean temperature difference (°C)
#Result:
print "The LMTD is :",DTlm," °C ."
```

In [6]:

```
from math import log
#Variable declaration:
Ts = 100.0 #Steam temperature at 1 atm (°C)
T1 = 25.0 #Initial fluid temperature (°C)
T2 = 80.0 #Final fluid temperature (°C)
#Calculation:
DT1 = Ts - T1 #Temperature difference driving force at the fluid entrance (°C)
DT2 = Ts - T2 #Temperature driving force at the fluid exit (°C)
DTlm = (DT1 - DT2)/log(DT1/DT2) #Log mean temperature difference (°C)
#Result:
print "The LMTD is :",round(DTlm,1)," °C ."
print "There is a calculation mistake regarding final result in book."
```

In [7]:

```
from math import log
#Variable declaration:
T1 = 500.0 #Temperature of hot fluid entering the heat exchanger (°F)
T2 = 400.0 #Temperature of hot fluid exiting the heat exchanger (°F)
t1 = 120.0 #Temperature of cold fluid entering the heat exchanger (°F)
t2 = 310.0 #Temperature of cold fluid exiting the heat exchanger (°F)
#Calculation:
DT1 = T1 - t2 #Temperature difference driving force at the heat exchanger entrance (°F)
DT2 = T2 - t1 #Temperature difference driving force at the heat exchanger exit (°F)
DTlm = (DT1 - DT2)/(log(DT1/DT2)) #LMTD (driving force) for the heat exchanger (°F)
#Result:
print "The LMTD (driving force) for the heat exchanger is :",round(DTlm)," °F ."
```

In [8]:

```
from math import log
#Variable declaration:
m = 8000.0 #Rate of oil flow inside the tube (lb/h)
Cp = 0.55 #Heat capacity of oil (Btu/lb.°F)
T1 = 210.0 #Initial temperature of oil (°F)
T2 = 170.0 #Final temperature of oil (°F)
t = 60.0 #Tube surface temperature (°F)
#Calculation:
DT = T2 - T1 #Change in temperature (°F)
Q = m*Cp*DT #Heat transferred from the heavy oil (Btu/h)
DT1 = T1 - t #Temperature difference driving force at the pipe entrance (°F)
DT2 = T2 - t #Temperature difference driving force at the pipe exit (°F)
DTlm = (DT1 - DT2)/(log(DT1/DT2)) #LMTD (driving force) for the heat exchanger (°F)
#Result:
print "The heat transfer rate is :",round(Q)," Btu/h ."
print "The LMTD for the heat exchanger is :",round(DTlm)," °F ."
```

In [9]:

```
from math import log
#Variable declaration:
T1 = 138.0 #Temperature of oil entering the cooler (°F)
T2 = 103.0 #Temperature of oil leaving the cooler (°F)
t1 = 88.0 #Temperature of coolant entering the cooler (°F)
t2 = 98.0 #Temperature of coolant leaving the cooler (°F)
#Calculation:
#For counter flow unit:
DT1 = T1 - t2 #Temperature difference driving force at the cooler entrance (°F)
DT2 = T2 - t1 #Temperature difference driving force at the cooler exit (°F)
DTlm1 = (DT1 - DT2)/(log(DT1/DT2)) #LMTD (driving force) for the heat exchanger (°F)
#For parallel flow unit:
DT3 = T1 - t1 #Temperature difference driving force at the cooler entrance (°F)
DT4 = T2 - t2 #Temperature difference driving force at the cooler exit (°F)
DTlm2 = (DT3 - DT4)/(log(DT3/DT4)) #LMTD (driving force) for the heat exchanger (°F)
#Result:
print "The LMTD for counter-current flow unit is :",round(DTlm1,1)," °F ."
print "The LMTD for parallel flow unit is :",round(DTlm2,1)," °F ."
```

In [11]:

```
#Variable declaration:
A = 1.0 #Surface area of glass (m^2)
h1 = 11.0 #Heat transfer coefficient inside room (W/m^2.K)
L2 = 0.125*0.0254 #Thickness of glass (m)
k2 = 1.4 #Thermal conductivity of glass (W/m.K)
h3 = 9.0 #Heat transfer coefficient from window to surrounding cold air (W/m^2.K)
#Calculation:
R1 = 1.0/(h1*A) #Internal convection resistance (K/W)
R2 = L2/(k2*A) #Conduction resistance through glass panel (K/W)
R3 = 1.0/(h3*A) #Outside convection resistance (K/W)
Rt = R1+R2+R3 #Total thermal resistance (K/W)
U = 1.0/(A*Rt) #Overall heat transfer coefficient (W/m^2.K)
#Result:
print "The overall heat transfer coefficient is :",round(U,1)," W/m^2.K ."
```

In [12]:

```
#Variable declaration:
Dx = 0.049/12.0 #Thickness of copper plate (ft)
h1 = 208.0 #Film coefficient of surface one (Btu/h.ft^2.°F)
h2 = 10.8 #Film coefficient of surface two (Btu/h.ft^2.°F)
k = 220.0 #Thermal conductivity for copper (W/m.K)
#Calculation:
U = 1.0/(1.0/h1+Dx/k+1.0/h2) #Overall heat transfer coefficient (Btu/h.ft^2.°F)
#Result:
print "The overall heat transfer coefficient is :",round(U,2)," Btu/h.ft^2.°F ."
```

In [13]:

```
#Variable declaration:
Do = 0.06 #Outside diameter of pipe (m)
Di = 0.05 #Inside diameter of pipe (m)
ho = 8.25 #Outside coefficient (W/m^2.K)
hi = 2000.0 #Inside coefficient (W/m^2.K)
R = 1.33*10**-4 #Resistance for steel (m^2.K/W)
#Calculation:
U = 1.0/(Do/(hi*Di)+R+1.0/ho) #Overall heat transfer coefficient (W/m^2.°K)
#Result:
print "The overall heat transfer coefficient is :",round(U,2)," W/m^2.°K ."
```

In [15]:

```
from math import pi,log
#Variable declaration:
Di = 0.825/12.0 #Pipe inside diameter (ft)
Do = 1.05/12.0 #Pipe outside diameter (ft)
Dl = 4.05/12.0 #Insulation thickness (ft)
l = 1.0 #Pipe length (ft)
kp = 26.0 #Thermal conductivity of pipe (Btu/h.ft.°F)
kl = 0.037 #Thermal conductivity of insulation (Btu/h.ft.°F)
hi = 800.0 #Steam film coefficient (Btu/h.ft^2.°F)
ho = 2.5 #Air film coefficient (Btu/h.ft^2.°F)
#Calculation:
ri = Di/2.0 #Pipe inside radius (ft)
ro = Do/2.0 #Pipe outside radius (ft)
rl = Dl/2.0 #Insulation radius (ft)
Ai = pi*Di*l #Inside area of pipe (ft^2)
Ao = pi*Do*l #Outside area of pipe (ft^2)
Al = pi*Dl*l #Insulation area of pipe (ft^2)
A_Plm = (Ao-Ai)/log(Ao/Ai) #Log mean area for steel pipe (ft^2)
A_Ilm = (Al-Ao)/log(Al/Ao) #Log mean area for insulation (ft^2)
Ri = 1.0/(hi*Ai) #Air resistance (m^2.K/W)
Ro = 1.0/(ho*Al) #Steam resistance (m^2.K/W)
Rp = (ro-ri)/(kp*A_Plm) #Pipe resistance (m^2.K/W)
Rl = (rl-ro)/(kl*A_Ilm) #Insulation resistance (m^2.K/W)
U = 1.0/(Ai*(Ri+Rp+Ro+Rl)) #Overall heat coefficient based on the inside area (Btu/h.ft^2.°F)
#Result:
print "The overall heat transfer coefficient based on the inside area of the pipe is :",round(U,3)," Btu/h.ft^2.°F ."
```

In [16]:

```
from math import pi
#Variable declaration:
#From example 14.14:
Di = 0.825/12.0 #Pipe inside diameter (ft)
L = 1.0 #Pipe length (ft)
Ui = 0.7492 #Overall heat coefficient (Btu/h.ft^2.°F)
Ts = 247.0 #Steam temperature (°F)
ta = 60.0 #Air temperature (°F)
#Calculation:
Ai = pi*Di*L #Inside area of pipe (ft^2)
Q = Ui*Ai*(Ts-ta) #Heat transfer rate (Btu/h)
#Result:
print "The heat transfer rate is :",round(Q,1)," Btu/h ."
```

In [17]:

```
#Variable declaration:
hw = 200.0 #Water heat coefficient (Btu/h.ft^2.°F)
ho = 50.0 #Oil heat coefficient (Btu/h.ft^2.°F)
hf = 1000.0 #Fouling heat coefficient (Btu/h.ft^2.°F)
DTlm = 90.0 #Log mean temperature difference (°F)
A = 15.0 #Area of wall (ft^2)
#Calculation:
X = 1.0/hw+1.0/ho+1.0/hf #Equation 14.34 for constant A
U = 1.0/X #Overall heat coeffocient (Btu/h.ft^2.°F)
Q = U*A*DTlm #Heat transfer rate (Btu/h)
#Result:
print "The heat transfer rate is :",round(Q,-1)," Btu/h ."
```

In [18]:

```
from __future__ import division
from sympy import symbols,log,nsolve
#Variable declaration:
T = 80.0 #Pipe surface temperature (°F)
t1 = 10.0 #Brine inlet temperature (°F)
DT2 = symbols('DT2') #Discharge temperature of the brine solution (°F)
m = 20*60 #Flowrate of brine solution (lb/h)
Cp = 0.99 #Heat capacity of brine solution (Btu/lb.°F)
U1 = 150 #Overall heat transfer coefficient at brine solution entrance (Btu/h.ft^2.°F)
U2 = 140 #Overall heat transfer coefficientat at brine solution exit (Btu/h.ft^2.°F)
A = 2.5 #Pipe surface area for heat transfer (ft^2)
#Calculation:
DT1 = T-t1 #Temperature approach at the pipe entrance (°F)
Q = m*Cp*(DT1-DT2) #Energy balance to the brine solution across the full length of the pipe (Btu/h)
DT1m = (DT1-DT2)/log(DT1/DT2) #Equation for the LMTD
QQ = A*(U2*DT1-U1*DT2)/log(U2*DT1/U1/DT2) #Equation for the heat transfer rate (Btu/h)
E = QQ-Q #Energy balance equation
R = nsolve([E],[DT2],[1.2]) #
DT = R[0] #Log mean temperature difference
t2 = T-DT #In discharge temperature of the brine solution (°F)
t2c = 5/9*(t2-32) #In discharge temperature of the brine solution in °C (c/5 = (F-32)/9)
_Q_ = Q.subs(DT2,DT) #Heat transfer rate (Btu/h)
#Result:
print "The temperature approach at the brine inlet side is :",round(DT1,1)," °F."
print "Or, the temperature approach at the brine inlet side is :",round(DT1/1.8,1)," °C."
print "The exit temperature of the brine solution is :",round(t2,1)," °F."
print "Or, the exit temperature of the brine solution is :",round((t2-32)/1.8,1)," °C."
print "The rate of heat transfer is :",round(_Q_,-1)," Btu/h."
print "Or, the rate of heat transfer is :",round(_Q_/3.412,-2)," W."
```