In [1]:

```
import math
#INPUT
T = 80.; #Bulk Temperature of water in degrees C
Di = 0.0254; #Inner diameter of steel pipe in m
Do = 0.0288; #Outer diameter of steel pipe in m
k = 50.; #Thermal conductivity of steel in W/m.K
ho = 30800.; #Average convection coefficient in W/m**2.K
v = 0.50; #Velocity of water in m/s
# Variables FROM HEAT AND MASS TRANSFER DATA BOOK FOR WATER AT BULK TEMPERATURE OF 80 degree C
d = 974.; #Density in kg/m**3
v1 = 0.000000364; #Kinematic viscosity in m**2/s
k1 = 0.6687; #Thermal conductivity in W/m.K
Pr = 2.2; #Prantl Number
# Calculations
Re = (v*Di)/v1; #Reynold's number
Nu = (0.023*Re**0.8*Pr**0.4); #Nusselts number
hi = Nu*(k1/Di); #Heat transfer coefficient in W/m**2.K
ri = (Di/2); #Inner radius of steel pipe in m
ro = (Do/2); #Outer radius of steel pipe in m
U = (1./((1./ho)+((ro/k)*math.log(ro/ri))+(ro/(ri*hi)))); #Overall heat transfer coefficient in W/m**2.K
# Results
print 'Overall heat transfer coefficient is %3.1f W/m**2.K'%(U)
```

In [3]:

```
import math
# Variables
Do = 0.0254; #Outer Diameter of heat exchanger tube in m
Di = 0.02286; #Inner Diameter of heat exchanger tube in m
k = 102; #Thermal conductivity of the tube in W/m.K
hi = 5500; #Heat transfer coefficients at the inner side of tube in W/m**2.K
ho = 3800; #Heat transfer coefficients at the outer side of tube in W/m**2.K
Rfi = 0.0002; #Fouling factor in m**2.W.K
Rfo = 0.0002; #Fouling factor in m**2.W.K
# Calculations
ro = (Do/2); #Outer radius of heat exchanger tube in m
ri = (Di/2); #Inner radius of heat exchanger tube in m
U = (1./((1./ho)+Rfo+((ro/k)*math.log(ro/ri))+((ro*Rfi)/ri)+(ro/(ri*hi)))); #Overall heat transfer coefficient in W/m**2.K
# Results
print 'Overall heat transfer coefficient is %i W/m**2.K'%(U)
```

In [4]:

```
import math
# Variables
mh = 10000.; #Mass flow rate of oil in kg/h
ch = 2095.; #Specific heat of oil J/kg.K
Thi = 80.; #Inlet temperature of oil in degree C
Tho = 50.; #Outlet temperature of oil in degree C
mc = 8000.; #Mass flow rate of water in kg/h
Tci = 25.; #Inlet temperature of water in degree C
U = 300.; #Overall heat ransfer coefficient in W/m**2.K
cc = 4180.; #Specific heat of water in J/kg.K
# Calculations
Q = (mh*ch*(Thi-Tho)); #Heat transfer rate in W
Tco = ((Q/(mc*cc))+Tci); #Outlet temperature of water in degree C
T = (Thi-Tco); #Temperature difference between oil inlet temperature and water outlet temperature in degree C
t = (Tho-Tci); #Temperature difference between oil outlet temperature and water inlet temperature in degree C
A = (((Q/U)*math.log(t/T))/(3600*(t-T))); #Area of heat exchanger in m**2
# Results
print 'Area of heat exchanger is %3.2f m**2'%(A)
```

In [6]:

```
import math
# Variables
Ch = 2500.; #Capacity rate of hot oil in W/K
Thi = 360.; #Temperature of hot fluid at the entrance of heat exchanger in degree C
Tho = 300.; #Temperature of hot fluid at the exit of heat exchanger in degree C
Tci = 30.; #Temperature of cold fluid at the entrance of heat exchanger in degree C
Tco = 200.; #Temperature of hot fluid at the exit of heat exchanger in degree C
U = 800.; #Overall heat transfer coefficient in W/m**2.K
# Calculations
Q = (Ch*(Thi-Tho)); #Heat transfer from the oil in W
#Parallel flow
T1 = Thi-Tci; #Temperature difference between hot fluid inlet temperature and cold fluid inlet temperature in degree C
T2 = Tho-Tco; #Temperature difference between hot fluid outlet temperature and cold fluid outlet temperature in degree C
Tlm1 = ((T1-T2)/math.log(T1/T2)); #LMTD for parallel flow arrangement in degree C
A1 = (Q/(U*Tlm1)); #Area of heat exchanger in m**2
#Counter flow
t1 = Thi-Tco; #Temperature difference between hot fluid inlet temperature and cold fluid outlet temperature in degree C
t2 = Tho-Tci; #Temperature difference between hot fluid outlet temperature and cold fluid inlet temperature in degree C
Tlm2 = ((t1-t2)/math.log(t1/t2)); #LMTD for counter flow arrangement in degree C
A2 = (Q/(U*Tlm2)); #Area of heat exchanger in m**2
# Results
print 'Area of heat exchanger in parallel flow arrangement is %3.3f m**2 \n \
Area of heat exchanger in counter flow arrangement is %3.3f m**2'%(A1,A2)
```

In [7]:

```
import math
# Variables
ch = 2130.; #Specific heat of oil in J/kg.K
T1 = 160.; #Temperature of hot fluid (oil) at the entrance of heat exchanger in degree C
T2 = 60.; #Temperature of hot fluid (oil) at the exit of heat exchanger in degree C
t1 = 25.; #Temperature of cold fluid (water) at the entrance of heat exchanger in degree C
d = 0.5; #Inner diameter of the tube in m
mc = 2.; #Mass flow rate of cooling water in kg/s
D = 0.7; #outer annulus outer diameter in m
mh = 2.; #Mass flow rate of hot oil in kg/s
U = 250.; #Overall heat transfer coefficient in W/m**2.K
cc = 4186.; #Specific heat of water in J/kg.K
# Calculations
Q = (mh*ch*(T1-T2)); # Required heat transfer rate in W
t2 = ((Q/(mc*cc))+t1); #Outer water temperature in degree C
T = T1-t2; #Change in temperature between inlet tmperature of hot fluid and outlet temperature of cold fluid in degree C
t = T2-t1; #Change in temperature between outlet tmperature of hot fluid and inlet temperature of cold fluid in degree C
Tlm = ((T-t)/(math.log(T/t))); #Value of LMTD in degree C
L = (Q/(U*3.14*d*Tlm)); #Length of the heat exchanger in m
# Results
print 'Length of the heat exchanger is %3.2f m'%(L)
```

In [8]:

```
# Variables
T = 120.; #Saturated steam temperature in degree C
U = 1800.; #Heat transfer coefficient in W/m**2.K
m = 1000.; #mass flow rate of water in kg/h
t1 = 20.; #Inlet temperature of water in degree C
t2 = 90.; #Outlet tmperature of water in degree C
hfg = 2200.; #Enthalpy of steam in kJ/kg
c = 4186.; #Specific het of water in J/kg.K
# Calculations
Tlm = (((T-t1)-(T-t2))/(math.log((T-t1)/(T-t2)))); #LMTD in a condenser in degree C
Q = ((m/3600)*c*(t2-t1)); #Rate of heat transfer in W
A = (Q/(U*Tlm)); #Surface area of heat exchanger in m**2
ms = ((Q*3600)/(hfg*1000)); #Rate of condensation of steam in kg/h
# Results
print 'Surface area of heat exchanger is %3.2f m**2 \n \
Rate of condensation of steam is %3.1f kg/h'%(A,ms)
```

In [11]:

```
import math
# Variables
T = 100.; #Temperature of saturated steam in degree C
t1 = 30.; #Inlet temperature of water in degree C
t2 = 70.; #Exit temperature of water in degree C
# Calculations
#COUNTER FLOW
Tc = (T-t2); #Temperature difference between saturated steam and exit water temperature in degree C
tc = (T-t1); #Temperature difference between saturated steam and inlet water temperature in degree C
Tlmc = ((Tc-tc)/math.log(Tc/tc)); #LMTD for counter flow in degree C
#PARALLEL FLOW
Tp = (T-t1); #Temperature difference between saturated steam and inlet water temperature in degree C
tp = (T-t2); #Temperature difference between saturated steam and exit water temperature in degree C
Tlmp = ((Tp-tp)/math.log(Tp/tp)); #LMTD for counter flow in degree C
#CROSS FLOW
R = ((T-T)/(t2-t1)); #R value for Correction factor F
P = ((t2-t1)/(T-t1)); #P value for Correction Factor F
F = 1; #Referring to Fig.12.12 in page no 515
Tlmx = (F*Tlmc); #LMTD for cross flow in degree C
# Results
print 'The effective math.log mean temperature difference for: \
\ni)COUNTER FLOW is %3.1f degree C \
\nii)PARALLEL FLOW is %3.1f degree C \niii)CROSS FLOW is %3.1f degree C'%(Tlmc,Tlmp,Tlmx)
```

In [12]:

```
# Variables
Ti = 18; #Inlet temperature of Shell fluid in degree C
To = 6.5; #Outlet temperature of Shell fluid in degree C
ti = -1.1; #Inlet temperature of Tube fluid in degree C
to = 2.9; #Outlet temperature of Tube fluid in degree C
U = 850; #Overall heat transfer coefficient in W/m**2.K
Q = 6000; #Design heat load in W
# Calculations
T = (Ti-to); #Temperature difference between shell side inlet fluid and tube side outlet fluid in degree C
t = (To-ti); #Temperature difference between shell side outlet fluid and tube side inlet fluid in degree C
Tlm = ((T-t)/math.log(T/t)); #LMTD for a counterflow arrangement in degree C
P = ((to-ti)/(Ti-ti)); #P value to calculate correction factor
R = ((Ti-To)/(to-ti)); #R value to calculate correction factor
F = 0.97 #Taking correction factor from fig. 12.9 on page no.514
A = (Q/(U*F*Tlm)); #Area of shell aand tube heat exchanger in m**2
# Results
print 'Area of shell-and-tube heat exchanger is %3.2f m**2'%(A)
```

In [13]:

```
# Variables
Q = 6000; #Taking design heat load value in W from Example no. 12.8 on page no.516
U = 850; #Taking overall heat transfer coefficient value in W/m**2.K from Example no. 12.8 on page no.516
Tlm = 10.92 #Taking LMTD for a counterflow arrangement in degree C from Example no. 12.8 on page no.517
R = 2.875; #Taking R value from Example no. 12.8 on page no.517
P = 0.209; #Taking P value from Example no. 12.8 on page no.517
F = 0.985; #Taking correction factor from Fig. 12.10 on page no.514
# Calculations
A = (Q/(U*F*Tlm)); #Area of shell-and-tube heat exchanger in m**2
# Results
print 'Area of shell aand tube heat exchanger is %3.3f m**2'%(A)
```

In [14]:

```
# Variables
Ti = 360.; #Inlet temperature of hot fluid in degree C taken from Example no. 12.4 on page no. 510
To = 300.; #Outlet temperature of hot fluid in degree C taken from Example no. 12.4 on page no. 510
ti = 30.; #Inlet temperature of cold fluid in degree C taken from Example no. 12.4 on page no. 510
to = 200.; #Outlet temperature of cold fluid in degree C taken from Example no. 12.4 on page no. 510
U = 800.; #Overall heat transfer coefficient in W/m**2.K taken from Example no. 12.4 on page no. 510
Q = 150000.; #Calculated heat transfer rate in W from Example no. 12.4 on page no. 510
Tlm = 210.22 #Calculated LMTD for counterflow arrangement in degree C taken from Example no. 12.4 on page no. 511
# Calculations
P = ((to-ti)/(Ti-ti)); #P value for calculation of correction factor
R = ((Ti-To)/(to-ti)); #R value for calculation of correction factor
F = 0.98; #Correction Factor value taken from Fig.12.11 on page no.515
A = (Q/(U*F*Tlm)); #Required surface area in a cross flow heat exchanger in m**2
# Results
print 'The required surface area in a cross flow heat exchanger is %3.2f m**2'%(A)
```

In [4]:

```
import math
# Variables
mc = 4.; #Mass flow rate of cold water in kg/s
Tci = 38.; #Inlet Temperature of cold water in degree C
Tco = 55.; #Outlet Temperature of cold water in degree C
D = 0.02; #Diameter of the tube in m
v = 0.35; #Velocity of water in m/s
Thi = 95.; #Inlet Temperature of hot water in degree C
mh = 2.; #Mass flow rate of hot water in kg/s
L = 2.; #Length of the tube in m
U = 1500.; #Overall heat transfer coefficient in W/m**2.K
c = 4186.; #Specific heat of water in J/kg.K
d = 1000.; #Density of water in kg/m**3
# Calculations
Q = (mc*c*(Tco-Tci)); #Heat transfer rate for cold fluid in W
Tho = (Thi-(Q/(mh*c))); #Outlet temperature of hot fluid in degree C
T = Thi-Tco; #Difference of temperature between hot water inlet and cold water outlet in degree C
t = Tho-Tci; #Difference of temperature between hot water outlet and cold water inlet in degree C
Tlm = ((T-t)/math.log(T/t)); #LMTD for counterflow heat exchanger
A = (Q/(U*Tlm)); #Area of heat exchanger in m**2
A1 = (mc/(d*v)); #Total flow area in m**2
n = ((A1*4)/(3.14*D**2)); #Number of tubes
L = (A/(36*3.14*D)); #Length of each tube taking n = 36 in m
N = 2; #Since this length is greater than the permitted length of 2m, we must use more than one tube pass. Let us try 2 tube passes
P = ((Tco-Tci)/(Thi-Tci)); #P value for calculation of correction factor
R = ((Thi-Tho)/(Tco-Tci)); #R value for calculation of correction factor
F = 0.9; #Corrction Factor from Fig.12.9 on page no. 514
A2 = (Q/(U*F*Tlm)); #Total area required for one shall pass,2 tube pass exchanger in m**2
L1 = (A2/(2*36*3.14*D)); #Length of tube per pass taking n = 36 in m
# Results
print 'Number of tubes per pass is %.f \n \
Number of passes is %i \n \
Length of tube per pass is %3.3f m'%(n,N,L1)
```

In [18]:

```
import math
# Variables
mh = 250.; #Mass flow rate of hot liquid in kg/h
ch = 3350.; #Specific heat of hot liquid in J/kg.K
Thi = 120.; #Inlet temperature of hot liquid in degree C
mc = 1000.; #Mass flow rate of cold liquid in kg/h
Tci = 10.; #Inlet temperature of cold liquid in degree C
U = 1160.; #Overall heat transfer coefficient in W/m**2.K
A = 0.25; #Surface area of heat exchanger in m**2
cc = 4186.; #Specific heat of cold liquid in J/kg.K
# Calculations
Cc = ((mc*cc)/3600); #Heat capacity rate for cold liquid in W/K
Ch = ((mh*ch)/3600); #Heat capacity rate for hot liquid in W/K
Cmin = min(Cc,Ch); #Minimum heat capacity rate in W/K
Cmax = max(Cc,Ch); #Maximum heat capacity rate in W/K
r = (Cmin/Cmax); #Ratio of min amd max heat capacity rates
NTU = ((U*A)/Cmin); #Number of transfer units
e = ((1-math.exp(-NTU*(1+r)))/(1+r)); #Effectiveness for a parallel flow heat exchanger
Qmax = (Cmin*(Thi-Tci)); #Maximum possible heat transfer rate in W
Q = (e*Qmax); #Actual rate of heat transfer in W
Tco = ((Q/Cc)+Tci); #Outlet temperature of cold liquid in degree C
Tho = (Thi-(Q/Ch)); #Outlet temperature of hot liquid in degree C
# Results
print 'Effectiveness for a parallel flow heat exchanger is %3.3f \n \
Outlet temperature of water is %3.2f degree C \n \
Outlet temperature of cooled liquid is %3.2f degree C'%(e,Tco,Tho)
```

In [5]:

```
# Variables
Tci = 15.; #Inlet temperature of water in degree C
mc = 1300.; #Mass flow rate of water in kg/h
ch = 2000.; #Specific heat of oil in J/kg.K
mh = 550.; #Mass flow rate of oil in kg/h
Thi = 94.; #Inlet temperature of oil in degree C
A = 1.; #Area of heat exchanger in m**2
U = 1075.; #Overall heat transfer coefficient in W/m**2.K
cc = 4186.; #Specific heat of water in J/kg.K
# Calculations
Cc = ((mc*cc)/3600); #Heat capacity of water in W/K
Ch = ((mh*ch)/3600); #Heat capacity of oil in W/K
Cmin = min(Cc,Ch); #Minimum heat capacity in W/K
Cmax = max(Cc,Ch); #Maximum heat capacity in W/K
r = (Cmin/Cmax); #Ratio of min and max heat capacity
NTU = ((U*A)/Cmin); #Number of transfer Units
e = 0.94 #Effectiveness of heat exchanger from Fig. 12.15 on page no.524
Qmax = (Cmin*(Thi-Tci)); #Maximum possible heat transfer rate in W
Q = (e*Qmax); #Actual heat transfer rate in W
Tco = ((Q/Cc)+Tci); #Outlet Temperature of water in degree C
Tho = (Thi-(Q/Ch)); #Outlet Temperature of oil in degree C
# Results
print 'The total heat transfer is %3.1f W \n \
Outlet Temperature of water is %i degree C \n \
Outlet Temperature of oil is %3.2f degree C'%(Q,Tco,Tho)
```

In [20]:

```
# Variables
N = 3000.; #Number of brass tubes
D = 0.02; #Diameter of brass tube in m
Tci = 20.; #Inlet temperature of cooling water in degree C
mc = 3000.; #Mass flow rate of cooling water in kg/s
ho = 15500.; #Heat transfer coefficient for condensation in W/m**2.K
Q = (2.3*10**8); #Heat load of the condenser in W
Thi = 50.; #Temperature at which steam condenses in degree C
hfg = 2380. #Enthalpy of liquid vapour mixture in kJ/kg
m = 1.; #Flow rate of each tube in kg/s
Cc = 4180.; #Specific heat of water in J/kg.K
#Properties of water at 300K from data book
Cc = 4186.; #Specific heat in J/kg.K
mu = (855.*10**-6); #Dynamic vismath.cosity in Ns/m**2
k = 0.613; #Thermal Conductivity in W/mK
Pr = 5.83 #Prantl number
# Calculations
Tco = ((Q/(mc*Cc))+Tci); #Outlet temperature of cooling water in degree C
Re = ((4*m)/(3.1415*D*mu)); #Reynold's number
Nu = (0.023*Re**(4./5)*Pr**(2./5)); #Nusselts number
hi = (Nu*(k/D)); #Heat transfer coefficient in W/m**2.K
U = (1./((1./ho)+(1./hi))); #Overall heat transfer coefficient in W/m**2.K
Cmin = (mc*Cc); #Minimum heat capacity in W/K
Qmax = (Cmin*(Thi-Tci)); #Maximum heat transfer rate in W
e = (Q/Qmax); #Effectiveness of heat transfer
NTU = 0.8; #Number of transfer units from Fig. 12.16 on page no.525
A = ((NTU*Cmin)/U); #Area of heat exchanger in m**2
L = (A/(2*N*3.1415*D)); #Length of tube per pass in m
ms = (Q/(hfg*1000)); #Amount of steam condensed in kg/s
# Results
print 'The outlet temperature of the cooling water is %3.2f degree C \n \
The overall heat transfer coefficient is %3.1f W/m**2.K \n \
Tube length per pass using NTU method is %3.2f m \n \
The rate of condensation of steam is %3.0f kg/s'%(Tco,U,L,ms)
```

In [21]:

```
# Variables
Tci = 5.; #Inlet temperature of water in degree C
mc = 4600.; #Mass flow rate of water in kg/h
mh = 4000.; #Mass flow rate of air in kg/h
Thi = 40.; #Inlet temperature of air in degree C
U = 150.; #Overall heat transfer coefficient in W/m**2.K
A = 25.; #Area of heat exchanger in m**2
Cc = 4180.; #Specific heat of water in J/kg.K
Ch = 1010.; #Specific heat of air in J/kg.K
# Calculations
C1 = ((mh*Ch)/3600); #Heat capacity of air in W/K
C2 = ((mc*Cc)/3600); #Heat capacity of water in W/K
Cmin = min(C1,C2); #Minimum value of heat capacity in W/K
Cmax = max(C1,C2); #Maximum value of heat capacity in W/K
r = (Cmin/Cmax); #Ratio of min and max heat capacity in W/K
NTU = ((U*A)/Cmin); #Number of heat transfer units
e = 0.92; #Effectiveness of heat exchanger from Fig. 12.18 on page no.526
Q = (e*Cmin*(Thi-Tci)); #Heat transfer rate in W
Tco = ((Q/C2)+Tci); #Outlet temperature of water in degree C
Tho = (Thi-(Q/C1)); #Outlet temperature of air in degree C
# Results
print 'The exit temperature of water is %3.1f degree C \n \
The exit temperature of air is %3.1f degree C'%(Tco,Tho)
```

In [23]:

```
# Variables
A = 15.82; #Total outside area of heat exchanger in m**2
Thi = 110; #Inlet temperature of oil in degree C
Ch = 1900; #Specific heat of oil in J/kg.K
mh = 170.9; #Mass flow rate of oil in kg/min
mc = 68; #Mass flow rate of water in kg/min
Tci = 35; #Inlet temperature of water in degree C
U = 320; #Overall heat transfer coefficient in W/m**2.K
Cc = 4186; #Specific heat of water in J/kg.K
# Calculations
C1 = ((mh*Ch)/60); #Heat capacity of oil in W/K
C2 = ((mc*Cc)/60); #Heat capacity of water in W/K
D = (U*A*((1./C1)-(1./C2))); #Constant
r = (C1/C2); #Ratio of heat capacity of oil and water
Tho = Thi-(((Thi-Tci)*(1-math.exp(D)))/(r-math.exp(D))); #Outlet temperature of oil in degree C
Tco = Tci+(r*(Thi-Tho)); #Outlet temperature of water in degree C
# Results
print 'The exit temperature of oil is %3.2f degree C \n \
The exit temperature of water is %3.1f degree C'%(Tho,Tco)
```

In [24]:

```
# Variables
Tci = 20.; #Inlet temperature of water in degree C
Tco = 50.; #Outlet temperature of water in degree C
Th = 120.; #Temperature at which steam condenses in degree C
newTci = 15.; #New Inlet temperature of water in degree C
# Calculations
newTco = (((Tco-Tci)*(Th-newTci))/(Th-Tci))+newTci; #New outlet temperature of water in degree C
# Results
print 'New outlet temperature of water is %3.1f degree C'%(newTco)
```

In [8]:

```
# Variables
T = 100; #Total length of tubes in m
# Calculations
D = ((3.14*4000)/(3.14*30000))**0.5; #Diameter of the exchanger in m
L = (2./(3.1415*D**2)); #Length of the exchanger in m
Cost = (10000+(15000*D**3*L)+(2000*D*L)); #Optimal math.cost in Rs
# Results
print 'The diameter of the exchanger is %3.3f m \n \
The Length of the exchanger is %3.2f m \n \
Optimal cost is %3.0f Rs'%(D,L,Cost)
# note : rounding error.
```