In [1]:

```
import math
# Overall Heat Transfer Coefficient of a Heat Exchanger
# Variables
D_in = 0.02 #Diameter of inner tubes[m]
Di_out = 0.03 #Inner Diameter of Outer tubes[m]
mw = 0.5 #Mass Flow Rate of water[kg/s]
mo = 0.8 #Mass Flow rate of oil[kg/s]
Tw = 45 #Average Temp of water[degree Celcius]
To = 80 #Average Temp of oil [degree Celcius]
#Properties of water at Tw
rho_w = 990.1 #[kg/m**3]
Pr_w = 3.91 #Prandtl Number
k_w = 0.637 #[W/m.degree Celcius]
nu_w = 0.602*10**(-6) #[m**2/s]
#Properties of oil at To
rho_o = 852 #[kg/m**3]
Pr_o = 499.3 #Prandtl Number
k_o = 0.138 #[W/m.degree Celcius]
nu_o = 3.794*10**(-5) #[m**2/s]
# Calculations and Results
Vw = mw/(rho_w*(math.pi*(D_in**2)/4)) #[m/s]
print "The average velocity of water in the tube is",Vw,"m/s"
Re_w = Vw*D_in/nu_w;
print "The Reynolds number for flow of water in the tube is",Re_w
Nu_w = 0.023*(Re_w**(0.8))*(Pr_w**(0.4));
print "The nusselt no for turbulent water flow",Nu_w
hi = k_w*Nu_w/D_in #[W/m**2.degree Celcius]
#For oil flow
Dh = Di_out-D_in #Hydraulic Diameter for the annular space[m]
Vo = mo/(rho_o*(math.pi*((Di_out**2)-(D_in**2))/4)) #[m/s]
print "The average velocity for flow of oil is",Vo,"m/s"
Re_o = Vo*Dh/nu_o;
print "The Reynolds number for flow of oil is",Re_o
Nu_o = 5.45 #Nusselt number for flow of oil usign the table 11.3 and interpolating for value corresponding to Di_out/D_in
ho = Nu_o*k_o/Dh #[W/m**2.degree Celcius]
U = (1/((1/hi)+(1/ho))) #[W/m**2.degree Celcius]
print "The overall heat transfer Coefficient for the given heat exchanger is",U,"W/m**2.degree Celcius"
```

In [12]:

```
import math
# Effect of Fouling on the Overall Heat Transfer Coefficient
# Variables
k = 15.1 #[W/m**2.degree Celcius]
Di = 0.015 #Inner Diameter[m]
Do = 0.019 #Outer Diameter[m]
Di_s = 0.032 #Inner diameter of outer shell[m]
L = 1 #[m]
hi = 800 #W/m**2.degree Celcius
ho = 1200 #[W/m**2.degree Celcius]
Rfi = 0.0004 #[m**2.degree Celcius/W]
Rfo = 0.0001 #[m**2.degree Celcius/W]
# Calculations and Results
Ai = math.pi*Di*L #[m**2]
Ao = math.pi*Do*L #[m**2]
Ra = (1/(hi*Ai))+(Rfi/Ai)+((math.log(Do/Di))/(2*math.pi*k*L))+(Rfo/Ao)+(1/(ho*Ao)) #[m**2.degree Celcius/W]
print "The thermal Resistance for an unfinned shell and tube heat exchanger with\
fouling on both heat transfer surfaces is",Ra,"m**2.degree Celcius/W"
#Solution (b):-
Ui = 1/(Ra*Ai) #[W/m**2.degree Celcius]
Uo = 1/(Ra*Ao) #[W/m**2.degree Celcius]
print "The overall Heat transfer Coefficients based on the inner and outer surfaces of the tube are" \
,Ui,"and",Uo,"W/m**2.degree Celcius","respectively"
```

In [2]:

```
import math
# The Condensation of Steam in a Condenser
# Variables
Th_in = 30.
Th_out = 30.
Tc_in = 14.
Tc_out = 22. #Inlet and Outlet temperatures of hot and cold liquids [degree Celcius]
A = 45. #[m**2]
U = 2100. #[W/m**2.degree Celcius]
h_fg = 2431. #Heat of vapourisation of water at Th_i[kJ/kg]
Cp = 4184. #Specific heat of cold water [J/kg]
# Calculations and Results
del_T1 = Th_in-Tc_out #[degree Celcius]
del_T2 = Th_out-Tc_in #[degree Celcius]
del_T_lm = (del_T1-del_T2)/(math.log(del_T1/del_T2)) #[degree Celcius]
print "The logrithmic Mean temperature difference is",del_T_lm,"degree Celcius"
Q = U*A*del_T_lm #[W]
print "The heat transfer rate in the condenser is",Q,"W"
mw = Q/(Cp*(Tc_out-Tc_in)) #[kg/s]
print "The mass flow rate of the cooling water is",mw,"kg/s"
ms = (Q/(1000*h_fg)) #[kg/s]
print "The rate of condensation of steam is",ms,"kg/s"
```

In [5]:

```
import math
# Heating Water in a Counter Flow Heat Exchanger
# Variables
mw = 1.2
mgw = 2 #Mass Flow rate of water and geothermal fluid[kg/s]
U = 640 #Overall Heat transfer Coefficient[W/m**2.degree Celcius]
Di = 0.015 #[m]
Tw_out = 80
Tw_in = 20 #Outlet and Inlet temp of water[degree Celcius]
Tgw_in = 160 #Inlet temp of geothermal fluid[degree Celcius]
Cp_w = 4.18
Cp_gw = 4.31 #Specific Heats of water and geothermal fluid[kJ/kg.degree Celcius]
# Calculations and Results
Q = mw*Cp_w*(Tw_out-Tw_in) #[kW]
print "The rate of heat transfer in the heat exchanger is",Q,"kW"
Tgw_out = (Tgw_in-(math.ceil(Q)/(mgw*Cp_gw))) #[degree Celcius]
print "The outlet temp of geothermal fluid is",Tgw_out,"degree Celcius"
del_T1 = Tgw_in-Tw_out #[degree Celcius]
del_T2 = Tgw_out-Tw_in #[degree Celcius]
del_T_lm = (del_T1-del_T2)/(math.log(del_T1/del_T2)) #[degree Celcius]
print "The logrithmic Mean temperature difference is",del_T_lm,"degree Celcius"
As = 1000*math.ceil(Q)/(U*del_T_lm) #[m**2]
print "The surface area of the heat exchanger is",As,"m**2"
L = As/(math.pi*Di) #[m]
print "The length of the tube is",round(L),"m"
```

In [6]:

```
import math
# Heating of Glycerine in a Multipass Heat Exchanger
# Variables
#A 2,4 shell and tube heat exchanger
D = 0.02 #Diameter[m]
L = 60. #Length of tube[m]
Th_in = 80.
Th_out = 40.
Tc_in = 20.
Tc_out = 50. #Inlet and Outlet temperatures water and glycerine[degree Celcius]
hi = 160.
ho = 25. #Convective Heat transfer coefficients on both side of tube[W/m**2.degree Celcius]
Rf = 0.0006 #Fouling Resismath.tance[m**2.degree Celcius/W]
# Calculations and Results
As = math.pi*D*L #[m**2]
del_T1 = Th_in-Tc_out #[degree Celcius]
del_T2 = Th_out-Tc_in #[degree Celcius]
del_T_lm = (del_T1-del_T2)/math.log(del_T1/del_T2) #[degree Celcius]
print "The log mean temperature difference for the counter flow arrangement is",del_T_lm,"degree Celcius"
F = 0.91 #Correction Factor
#(a)
Ua = 1/((1/hi)+(1/ho)) #[W/m**2.degree Celcius]
print "In case of no fouling, the over all heat transfer coefficient is",Ua,"W/m**2.degree Celcius"
Qa = Ua*As*F*del_T_lm #[W]
print "And the rate of heat transfer is",Qa,"W"
#(b)
Ub = 1/((1/hi)+(1/ho)+(Rf)) #[W/m**2.degree Celcius
print "When there is fouling on one of the surfaces, the overall heat transfer coefficient is",Ub,"W/m**2.degree Celcius"
Qb = Ub*As*F*del_T_lm #[W]
print "And the rate of heat transfer is",round(Qb),"W"
```

In [8]:

```
import math
# Cooling of Water in an Automotive Radiator
# Variables
m = 0.6 #Mass Flow rate of water[kg/s]
Th_in = 90.
Th_out = 65.
Tc_in = 20.
Tc_out = 40. #[degree Celcius]
Di = 0.005 #[m]
L = 0.65 #[m]
n = 40. #No of tubes
Cp = 4195. #[J/kg.degree Celcius]
# Calculations and Results
Q = m*Cp*(Th_in-Th_out) #[W]
print "The rate of heat transfer in the radiator from the hot water to the air is",Q,"W"
Ai = n*math.pi*Di*L #[m**2]
del_T1 = Th_in-Tc_out #[degree Celcius]
del_T2 = Th_out-Tc_in #[degree Celcius]
del_T_lm = (del_T1-del_T2)/math.log(del_T1/del_T2) #[degree Celcius]
print "The log mean temperature difference for the counter flow arrangement is",del_T_lm,"degree Celcius"
F = 0.97 #Correction Factor for this situation
Ui = Q/(Ai*F*del_T_lm) #[W/m**2.degree Celcius]
print "the overall heat transfer coefficient is",round(Ui),"W/m**2.degree Celcius"
```

In [9]:

```
import math
# Using the Effectiveness- NTU Method
# Variables
mc = 1.2
mh = 2 #Mass Flow rate of water and geothermal fluid[kg/s]
U = 640 #Overall Heat transfer Coefficient[W/m**2.degree Celcius]
Di = 0.015 #[m]
Tc_out = 80
Tc_in = 20 #Outlet and Inlet temp of water[degree Celcius]
Th_in = 160 #Inlet temp of geothermal fluid[degree Celcius]
Cp_c = 4.18
Cp_h = 4.31 #Specific Heats of water and geothermal fluid[kJ/kg.degree Celcius]
# Calculations and Results
Ch = mh*Cp_h #[kW/degree Celcius]
Cc = mc*Cp_c #[kW/degree Celcius]
if(Ch>Cc):
Cmin = Cc;
c = Cmin/Ch;
else:
Cmin = Ch;
c = Cmin/Cc;
Q_max = Cmin*(Th_in-Tc_in) #[kW]
print "The maximum heat transfer rate is",Q_max,"kW"
Q_ac = mc*Cp_c*(Tc_out-Tc_in) #[kW]
e = Q_ac/Q_max;
print "The effectiveness of the heat exchanger is",e
NTU = (1/(c-1))*math.log((e-1)/(e*c-1));
print "The NTU of this counter flow heat exchanger is",NTU
As = NTU*Cmin*1000/U #[m**2]
print "The heat transfer surface area is",As,"m**2"
L = As/(math.pi*Di) #[m]
print "The length of the tube is",round(L),"m"
```

In [10]:

```
import math
# Cooling Hot Oil by Water in Multipass Heat Exchanger
# Variables
Cp_c = 4.18
Cp_h = 2.13 #Specific Heats of water and oil[kJ/kg]
mc = 0.2
mh = 0.3 #Mass Flow rate of oil and water [kg/s]
Th_in = 150
Tc_in = 20 #[degree Celcius]
n = 8 #No of tubes
D = 0.014 #[m]
L = 5 #[m]
U = 310 #Overall Heat transfer Coefficient[W/m**2.degree Celcius]
# Calculations and Results
Ch = mh*Cp_h #[kW/degree Celcius]
Cc = mc*Cp_c #[kW/degree Celcius]
if(Ch>Cc):
Cmin = Cc;
c = Cmin/Ch;
else:
Cmin = Ch;
c = Cmin/Cc;
Q_max = Cmin*(Th_in-Tc_in) #[kW]
print "The maximum heat transfer rate is",Q_max,"kW"
As = n*math.pi*D*L #[m**2]
print "Heat transfer Surface Area is",As,"m**2"
NTU = U*As/Cmin;
print "The NTU of this heat exchanger is",NTU
e = 0.47 #Determined from fig 11.26(c)umath.sing value of NTU and c
Q = e*Q_max #[kW]
Tc_out = Tc_in+(Q/Cc) #[degree Celcius]
Th_out = Th_in-(Q/Ch) #[degree Celcius]
print "The temperature of cooling water will rise from""degree Celcius",Tc_in,"degree Celcius","to",Tc_out
print "as it cools the hot oil from",Th_in,"degree Celcius","to",Th_out,"degree Celcius"
```

In [11]:

```
import math
# Installing a Heat Exchanger to Save Energy and Money
# Variables
Cp = 4.18 #[kJ/kg.degree Celcius]
Th_in = 80
Tc_in = 15 #Inlet temperatures of hot and cold water[degree Celcius]
m = 15./60 #[kg/s]
e = 0.75 #Effectiveness
t = 24. * 365 #Operating Hours[hours/year]
neta = 0.8 #Eficiency
cost = 1.10 #[$/therm]
# Calculations and Results
Q_max = m*Cp*(Th_in-Tc_in) #[kJ/kg.degree Celcius]
print "Maximun Heat recover is",Q_max,"kJ/kg.degree Celcius"
Q = e*Q_max #[kJ/s]
E_saved = Q*t*3600 #[kJ/year]
print "The energy saved during an entire year will be",E_saved,"kJ/year"
F_saved = (E_saved/neta)*(1./105500) #[therms]
print "Fuel savings will be",F_saved,"therms/year"
M_saved = F_saved*cost #[$/year]
print "The amount of money saved is $",M_saved,"per year"
```