Chapter 5: Principles of Unsteady-State Heat Transfer

Example 5.2-1, Page number 333

In [1]:
#Cooling of a Steel Ball
from math import pi, exp


#Variable declaration #English Units
r = 1./12           #Radius of a Steel Ball, ft
Tbi = 800.          #Initial uniform temperature of the steel ball, °F
Tinf = 250.         #Temeperature of a constant temperature bath, °F
h = 2.0             #Convective Heat Transfer Coefficient, Btu/(h.ft2°F)
t = 1.              #Time at which temperature of the ball is to be determined, s
k = 25.             #Thermal conductivity of the steel ball, Btu/(h.ft°F)
rho = 490.          #Density of a steel ball, lbm/ft3
cp = 0.11           #Specific heat of steel ball, Btu/(lbm.°F)

#Calculation

x1 = r/3
NBi = h*x1/k
A = 4*pi*r**2
V = 4*pi*r**3/3.
tau = h*A/(cp*rho*V)
Tb = Tinf + (Tbi - Tinf)*exp(-tau*t)
#Result
print "Temperature of ball after one hour: ", round(Tb),"°F"


#Variable declaration # SI Units

r = 0.0254                              #Radius of a Steel Ball, m
Tbi = 699.9                             #Initial uniform temperature of the steel ball, K
Tinf = 394.3                            #TEmeperature of a constant temperature bath, K
h = 11.36                               #Convective Heat Transfer Coefficient, W/(m2K)
t = 3600.                               #Time at which temperature of the ball is to be determined, s
k = 43.3                                #Thermal conductivity of the steel ball, W/(mK)
rho = 7849.                             #Density of a steel ball, kg/m3
cp = 460.6                              #Specific heat of steel ball, J/(kg.K)

#Calculation

x1 = r/3
NBi = h*x1/k
A = 4*pi*r**2
V = 4*pi*r**3/3.
tau = h*A/(cp*rho*V)
Tb = Tinf + (Tbi - Tinf)*exp(-tau*t)
#Result
print "Temperature of ball after one hour: ", round(Tb,1),"°C"
Temperature of ball after one hour:  395.0 °F
Temperature of ball after one hour:  474.6 °C

Example 5.2-2, Page Number 334

In [7]:
#Total amount of heat in cooling
from math import pi 

#Variable declaration
r = 0.0254                              #Radius of a Steel Ball, m
Tbi = 699.9                             #Initial uniform temperature of the steel ball, K
Tinf = 394.3                            #TEmeperature of a constant temperature bath, K
h = 11.36                               #Convective Heat Transfer Coefficient, W/(m2K)
t = 3600.                               #Time at which temperature of the ball is to be determined, s
k = 43.3                                #Thermal conductivity of the steel ball, W/(mK)
rho = 7849.                             #Density of a steel ball, kg/m3
cp = 460.6                              #Specific heat of steel ball, J/(kg.K)

#Calculation

x1 = r/3
NBi = h*x1/k
A = 4*pi*r**2
V = 4*pi*r**3/3.
tau = cp*rho*V/(h*A)
Q = cp*rho*V*(Tbi-Tinf)*(1-exp(-t/tau))
#Result

print 'Amount of Heat Transffered %6.4e'%(Q),"J"
Amount of Heat Transffered 5.5901e+04 J

Example 5.3-1, Page number 336

In [10]:
#Freezing Temperature in the ground
from math import pi, erfc, exp

# Variable declaration
Ti = 15.6                     #Earths constant temperature, degC
Tc = -17.8                    #Cold wave temperature, deg C
h = 11.36                     #Convective heat transfer coefficient, W/(m2K)
alpha = 4.65e-7               #THermal diffusivity of soil, m2/s
k = 0.865                     #Thermal conductivity of soil, W/(mK)
t = 5*3600                    #Time in seconds
x = 0.                        #Surface position , m
T0 = 0.                       #Freezing temperature for water

# Calculation SI units
absc = x/(2*sqrt(alpha*t))
param = h*sqrt(alpha*t)/k
corr = erfc(absc) - exp(param*(2*absc+param))*erfc(absc+param)
T = Ti + (Tc - Ti)*(erfc(absc) - exp(param*(2*absc+param))*erfc(absc+param))

ordi = (T0-Ti)/(Tc-Ti)
abscOrd = .16
x0 = 2*sqrt(alpha*t)*abscOrd

#Results
print "(a)   Temperature of the surface after 5 hour:", round(T,1), "°C"
print "(b)   Location of Freezing Temperature  after 5 hour:",round(x0,4),"m"


# Variable declaration English units
Ti = 60.                     #Earths constant temperature, degF
Tc = -0.                     #Cold wave temperature, deg F
h = 2.                       #Convective heat transfer coefficient, Btu/(ft2Fhr)
alpha = 0.018                #THermal diffusivity of soil, ft2/hr
k = 0.5                      #Thermal conductivity of soil, Btu/(ft F)
t = 5                        #Time in hr
x = 0.                       #Surface position , ft
T0 = 32.                     #Freezing temperature for water

# Calculation SI units
absc = x/(2*sqrt(alpha*t))
param = h*sqrt(alpha*t)/k
corr = erfc(absc) - exp(param*(2*absc+param))*erfc(absc+param)
T = Ti + (Tc - Ti)*(erfc(absc) - exp(param*(2*absc+param))*erfc(absc+param))

ordi = (T0-Ti)/(Tc-Ti)
abscOrd = .16
x0 = 2*sqrt(alpha*t)*abscOrd

#Result
print "(a)   Temperature of the surface after 5 hour:", round(T,1), "°F"
print "(b)   Location of Freezing Temperature  after 5 hour:",round(x0,4),"ft"
print 'The answers are different than book, because of book uses rounded numbers and rounded values of \ncomplimentary error function whereas code used built in erfc function'
(a)   Temperature of the surface after 5 hour: -5.2 °C
(b)   Location of Freezing Temperature  after 5 hour: 0.0293 m
(a)   Temperature of the surface after 5 hour: 22.7 °F
(b)   Location of Freezing Temperature  after 5 hour: 0.096 ft
The answers are different than book, because of book uses rounded numbers and rounded values of 
complimentary error function whereas code used built in erfc function

Example 5.3-2, Page number 338

In [21]:
#Heat Conduction in the slab

# Variable declaration
x1 = .0462       #Thickness of the slab, m
T0 = 277.6       #Uniform temperature of the slab, K
T1 = 297.1       #Ambient temperature of the fluid, K
h = 8.52         #Convective heat transfer coefficient, W/m2.K
t = 5*3600       #Time, s
rho = 998.       #Density of H2O at 4 deg C (kg/m3)
k = 0.197        #Thermal conductivity of butter, W/m.K
cp = 2300        #Specific heat of butter, J/kg.K

    
# Calculation
alpha = k/(rho*cp)       #Thermal diffusivity, m2/s

#PART A Calculation of temperature at the surface
param = k/(h*x2)
X = alpha*t/x2**2
x = 0.0462      #Distance from surface at which temperature needs to be calculated, m
n = x/x2
Y = 0.25    #From fig 5.3-5 
T = T1 - Y*(T1-T0)

#Result

print "Answers to part A"
print "Paramenter m for fig 5.3-5:", round(param,3)
print "Abscisa X for fig 5.3-2:", round(X,3) 
print "Parameter n for fig 5.3-2:", round(n,3)
print "Temeprature of the surface at .0462 m after 5 hour", round(T,1), "K", round(T-273.2,1), "°C"

#PART B Calculation of temperature at 25.4 mm below the surface 
param = k/(h*x2)
X = alpha*t/x2**2
x = 0.0208       #Distance from surface at which temperature needs to be calculated, m
n = x/x2
Y = 0.45    #From fig 5.3-5 
T = T1 - Y*(T1-T0)

#Result

print "Answers to part B"
print "Paramenter m for fig 5.3-5:", round(param,3)
print "Abscisa X for fig 5.3-2:", round(X,3) 
print "Parameter n for fig 5.3-2:", round(n,3)
print "Temeprature of the surface at .0208 m after 5 hour", round(T,1), "K", round(T-273.2,1), "°C"

#PART C Calculation of temperature at 46.2 mm below the surface
param = k/(h*x1)
X = alpha*t/x1**2
n = x/x1
Y = 0.5     #From fig 5.3-5 
T = T1 - Y*(T1-T0)

#Result
print "Answers to part B"
print "Paramenter m for fig 5.3-5:", round(param,2)
print "Abscisa X for fig 5.3-2:", round(X,2) 
print "Parameter n for fig 5.3-2:", round(n,1)
print "Temeprature of the surface at .0462 m after 5 hour", round(T,1), "K", round(T-273.2,1), "°C"
Answers to part A
Paramenter m for fig 5.3-5: 0.5
Abscisa X for fig 5.3-2: 0.724
Parameter n for fig 5.3-2: 1.0
Temeprature of the surface at .0462 m after 5 hour 292.2 K 19.0 °C
Answers to part B
Paramenter m for fig 5.3-5: 0.5
Abscisa X for fig 5.3-2: 0.724
Parameter n for fig 5.3-2: 0.45
Temeprature of the surface at .0208 m after 5 hour 288.3 K 15.1 °C
Answers to part B
Paramenter m for fig 5.3-5: 0.5
Abscisa X for fig 5.3-2: 0.72
Parameter n for fig 5.3-2: 0.5
Temeprature of the surface at .0462 m after 5 hour 287.4 K 14.2 °C

Example 5.3-3, Page number 342

In [22]:
#Transient Heat Conduction in a Can of Pea Puree

# Variable declaration
D = 0.0681       #Diameter of a Can, m
T0 = 29.4        #Uniform temperature of the slab, deg C
T1 = 115.6       #Ambient temperature of the steam, deg C
h = 4540         #Convective heat transfer coefficient, W/m2.K
t = 0.75*3600    #Time, s
x = 0.0          #Centre of the Can, m
k = 0.830        #Thermal conductivity of butter, W/m.K
alpha = 2.007e-7 #THermal diffusivity, m2/s
  
# Calculation
x1 = D/2.
n = x/x1
param = k/(h*x1)
X = alpha*t/x1**2
Y = 0.13    #From fig 5.3-8
T = T1 - Y*(T1-T0)
   
#Result
print "Paramenter m for fig 5.3-8:", round(param,5)
print "Abscisa X for fig 5.3-8:", round(X,3) 
print "Parameter n for fig 5.3-8:", n
print "Temeprature at the centre after 0.75 hour", round(T,1),"°C "
Paramenter m for fig 5.3-8: 0.00537
Abscisa X for fig 5.3-8: 0.467
Parameter n for fig 5.3-8: 0.0
Temeprature at the centre after 0.75 hour 104.4 °C 

Example 5.3-4, Page number 347

In [16]:
#Two-Dimensional Conduction in a Short Cylinder 

# Variable declaration

D = 0.0681       #Diameter of a Can, m
H = 0.1016       #Height of a Can, m
T0 = 29.4        #Uniform temperature of the slab, deg C
T1 = 115.6       #Ambient temperature of the steam, deg C
h = 4540         #Convective heat transfer coefficient, W/m2.K
t = 0.75*3600    #Time, s
x = 0.0          #Centre of the Can in radial direction, m
y = 0.0          #Centre of the Can in axial direction, m
k = 0.830        #Thermal conductivity of butter, W/m.K
alpha = 2.007e-7 #THermal diffusivity, m2/s

# Calculation

x1 = D/2.
y1 = H/2.

#Radial direction
n = x/x1
m = k/(h*x1)
X = alpha*t/x1**2
Yx = 0.13    #From fig 5.3-8

print "Prameters for Radial Direction"
print "Paramenter m for fig 5.3-8:", round(m,5)
print "Abscisa X for fig 5.3-8:", round(X,4) 
print "Parameter n for fig 5.3-8:", n
print "Parameter Yx from figure 5.3-8:", round(Yx,3)

#Axial Direction
n = y/y1
m = k/(h*y1)
X = alpha*t/y1**2
Yy = 0.8     #From Fig 5.3.6

print "\nPrameters for Axial Direction"
print "Paramenter m for fig 5.3-8:", round(m,5)
print "Abscisa X for fig 5.3-8:", round(X,4) 
print "Parameter n for fig 5.3-8:", n
print "Parameter Yy from figure 5.3-8:", round(Yy,3)
Yxy = Yx*Yy
Txy = T1 - Yxy*(T1-T0)
#Result

print "\nThe Temperature at the Centre of short cylinder:", round(Txy,1), "°C"  
Prameters for Radial Direction
Paramenter m for fig 5.3-8: 0.00537
Abscisa X for fig 5.3-8: 0.4674
Parameter n for fig 5.3-8: 0.0
Parameter Yx from figure 5.3-8: 0.13

Prameters for Axial Direction
Paramenter m for fig 5.3-8: 0.0036
Abscisa X for fig 5.3-8: 0.21
Parameter n for fig 5.3-8: 0.0
Parameter Yy from figure 5.3-8: 0.8

The Temperature at the Centre of short cylinder: 106.6 °C

Example 5.4-1, Page number 353

In [7]:
#Unsteady State Conduction and the Schmidt Numerical Method
import matplotlib.pyplot as plt
import copy 

#Variable declaration
thk = 1.0       #Thickness of slab, m
Ti = 100.       #Initial uniform temperature of slab, °C
Ta = 0.         #Constant Temperature of environment, °C
alpha = 2.0e-5  #Thermal diffusivity of slab, m2/s
ns = 5          #Number of slices
M = 2.0         #M for Schmidt numerical method
tmax = 6000     #Time at which temperature of the slab at various location to be calculated, s
#Calculation and Result

dx = thk/ns
x = [0,.2,.4,.6,.8,1.]
dt = dx**2/(alpha*M)
ylim(-1.,110.)
xlim(0,1.1)
#m = tmax/dt
t=0
T = [Ti,Ti,Ti,Ti,Ti,Ti]
plt.plot(x,T,'ko-',label='Initial Temperature Profile')
T[0] = Ta
Tcal = [0,0,0,0,0,0]
for i in range(1,7,1):
    t = int(dt*i)
    for j in range(len(T)):
        if j==0:
            Tcal[j]= Ta
            #print Tcal[j]
        elif j>=1 and j<(len(T)-1):
            Tcal[j]=(T[j-1]+T[j+1])/2.
            #print T[j-1], T[j+1],Tcal[j]
        else:
            Tcal[j]=((M-2)*T[j]+2*T[j-1])/M
            #print Tcal[j]
    T = copy.copy(Tcal)
    plt.plot(x,T, 'o-',label=str(i)+'th iteration Temp. Profile.')
print "At 6000s"
for i in range(1,7,1):
    print "Temperature of the node",i,"is", round(T[i-1],2),"°C"
plt.xlabel('Node number')
plt.ylabel('Temperature, degC')
plt.legend(loc='lower right',fontsize='small' )
At 6000s
Temperature of the node 1 is 0.0 °C
Temperature of the node 2 is 31.25 °C
Temperature of the node 3 is 54.69 °C
Temperature of the node 4 is 78.13 °C
Temperature of the node 5 is 85.94 °C
Temperature of the node 6 is 93.75 °C
Out[7]:
<matplotlib.legend.Legend at 0x8a65e30>

Example 5.4-2, Page number 356

In [25]:
#Unsteady-State Conduction Using the Digital Computer  

import copy 

#Variable declaration
thk = 1.        #Thickness of slab, m
Ti = 100.       #Initial uniform temperature of slab, °C
Ta = 0.         #Constant Temperature of environment, °C
alpha = 2.0e-5  #Thermal diffusivity of slab, m2/s
ns = 20         #Number of slices
M = 2.0         #M for Schmidt numerical method
tmax = 6000     #Time at which temperature of the slab at various location to be calculated, s

#Calculation and Result
dx = thk/ns
x = range(21)
dt = dx**2/(alpha*M)
m = tmax/dt

t=0
T = [Ti,Ti,Ti,Ti,Ti,Ti,Ti,Ti,Ti,Ti,Ti,Ti,Ti,Ti,Ti,Ti,Ti,Ti,Ti,Ti,Ti]
T[0] = Ta
Tcal = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

for i in range(1,96,1):
    t = int(dt*i)
    for j in range(len(T)):
        if j==0:
            Tcal[j]= Ta
            #print Tcal[j]
        elif j>=1 and j<(len(T)-1):
            Tcal[j]=(T[j-1]+T[j+1])/2.
            #print T[j-1], T[j+1],Tcal[j]
        else:
            Tcal[j]=((M-2)*T[j]+2*T[j-1])/M
            #print Tcal[j]
    T = copy.copy(Tcal)
    #plt.plot(x,T, 'o-',label=str(i)+'th iteration Temp. Profile.')
print "At 6000s"

for i in range(1,22,4):
    print "Temperature of the node",i,"is", round(T[i-1],2),"°C"

print 'The difference in the answers is due to rounding error'
At 6000s
Temperature of the node 1 is 0.0 °C
Temperature of the node 5 is 31.81 °C
Temperature of the node 9 is 58.72 °C
Temperature of the node 13 is 77.81 °C
Temperature of the node 17 is 88.64 °C
Temperature of the node 21 is 92.08 °C
The difference in the answers is due to rounding error

Example 5.4-3, Page number 357

In [29]:
#Unsteady-State conduction with Convective Boundary Conditions

import copy 

#Variable declaration
thk = 1.0       #Thickness of slab, m
Ti = 100.       #Initial uniform temperature of slab, °C
Ta = 0.         #Constant Temperature of environment, °C
alpha = 2.0e-5  #Thermal diffusivity of slab, m2/s
ns = 5          #Number slices
h = 25.0        #Covective coefficient, W/m2K
k = 10.0        #Thermal conductivity of slab, W/mK
M = 2.0         #M for Schmidt numerical method
tmax = 6000     #Time at which temperature of the slab at various location to be calculated, s

#Calculation and Result

dx = thk/ns
N = h*dx/k
M = 2*N+2
M =round(M+1)
dt = dx**2/(alpha*M)
m = tmax/dt
T = [Ti,Ti,Ti,Ti,Ti,Ti]
Tcal = [0,0,0,0,0,0]
x = range(6)

for i in range(1,13,1):
    for j in range(len(T)):
        if j==0:
            Tcal[j]= (1/M)*(2*N*Ta+(M-(2*N+2))*T[j]+2*T[j+1])
        elif j>=1 and j<(len(T)-1):
            Tcal[j]=(1/M)*(T[j+1]+(M-2)*T[j]+T[j-1])
        else:
            Tcal[j]=(1/M)*((M-2)*T[j]+2*T[j-1])
    T = copy.copy(Tcal)
    print 'i:%3d and time %5d s'%(i,i*dt)
    for i in range(len(T)):
        print "Temperature of the node",i+1,"is", round(T[i],2),"°C"
i:  1 and time   500 s
Temperature of the node 1 is 75.0 °C
Temperature of the node 2 is 100.0 °C
Temperature of the node 3 is 100.0 °C
Temperature of the node 4 is 100.0 °C
Temperature of the node 5 is 100.0 °C
Temperature of the node 6 is 100.0 °C
i:  2 and time  1000 s
Temperature of the node 1 is 68.75 °C
Temperature of the node 2 is 93.75 °C
Temperature of the node 3 is 100.0 °C
Temperature of the node 4 is 100.0 °C
Temperature of the node 5 is 100.0 °C
Temperature of the node 6 is 100.0 °C
i:  3 and time  1500 s
Temperature of the node 1 is 64.06 °C
Temperature of the node 2 is 89.06 °C
Temperature of the node 3 is 98.44 °C
Temperature of the node 4 is 100.0 °C
Temperature of the node 5 is 100.0 °C
Temperature of the node 6 is 100.0 °C
i:  4 and time  2000 s
Temperature of the node 1 is 60.55 °C
Temperature of the node 2 is 85.16 °C
Temperature of the node 3 is 96.48 °C
Temperature of the node 4 is 99.61 °C
Temperature of the node 5 is 100.0 °C
Temperature of the node 6 is 100.0 °C
i:  5 and time  2500 s
Temperature of the node 1 is 57.71 °C
Temperature of the node 2 is 81.84 °C
Temperature of the node 3 is 94.43 °C
Temperature of the node 4 is 98.93 °C
Temperature of the node 5 is 99.9 °C
Temperature of the node 6 is 100.0 °C
i:  6 and time  3000 s
Temperature of the node 1 is 55.35 °C
Temperature of the node 2 is 78.96 °C
Temperature of the node 3 is 92.41 °C
Temperature of the node 4 is 98.05 °C
Temperature of the node 5 is 99.68 °C
Temperature of the node 6 is 99.95 °C
i:  7 and time  3500 s
Temperature of the node 1 is 53.31 °C
Temperature of the node 2 is 76.42 °C
Temperature of the node 3 is 90.45 °C
Temperature of the node 4 is 97.05 °C
Temperature of the node 5 is 99.34 °C
Temperature of the node 6 is 99.82 °C
i:  8 and time  4000 s
Temperature of the node 1 is 51.54 °C
Temperature of the node 2 is 74.15 °C
Temperature of the node 3 is 88.59 °C
Temperature of the node 4 is 95.97 °C
Temperature of the node 5 is 98.89 °C
Temperature of the node 6 is 99.58 °C
i:  9 and time  4500 s
Temperature of the node 1 is 49.96 °C
Temperature of the node 2 is 72.11 °C
Temperature of the node 3 is 86.83 °C
Temperature of the node 4 is 94.86 °C
Temperature of the node 5 is 98.33 °C
Temperature of the node 6 is 99.23 °C
i: 10 and time  5000 s
Temperature of the node 1 is 48.54 °C
Temperature of the node 2 is 70.25 °C
Temperature of the node 3 is 85.15 °C
Temperature of the node 4 is 93.72 °C
Temperature of the node 5 is 97.69 °C
Temperature of the node 6 is 98.78 °C
i: 11 and time  5500 s
Temperature of the node 1 is 47.26 °C
Temperature of the node 2 is 68.55 °C
Temperature of the node 3 is 83.57 °C
Temperature of the node 4 is 92.57 °C
Temperature of the node 5 is 96.97 °C
Temperature of the node 6 is 98.23 °C
i: 12 and time  6000 s
Temperature of the node 1 is 46.09 °C
Temperature of the node 2 is 66.98 °C
Temperature of the node 3 is 82.06 °C
Temperature of the node 4 is 91.42 °C
Temperature of the node 5 is 96.19 °C
Temperature of the node 6 is 97.6 °C

Example 5.5-1, Page number 361

In [19]:
# Chilling Dressed Beef

#Variable Declaration

rho = 1073.                 #Density of a beef, kg/m3
cp = 3480.                  #Specific heat of Beef, J/(kg.K)
k = 0.498                   #Thermal conductivity of beef, W/(m.K)
thk = 0.203                 #Thickness of beef slab, m
Ti = 37.8                   #Initial beef temperature, deg C
Tf = 1.7                    #Uniform fluid temeperature, deg C
T = 10.                     #Temperature of the centre, deg C
h = 39.7                    #Convective heat Transfer coefficient, W/(m2.K)
x = 0
#Calculation

alpha = k/(rho*cp)          #Thermal diffusivity of beef slab, m2/s
x1 = thk/2                  #Centre of slab, m
n = x/x1
m = k/(h*x1)
Y = (Tf-T)/(Tf-Ti)
X = 0.90               
t = X*x1**2/alpha
#Result
print "The parameter to be used in association with Fig. 5.3-6"
print "n: ", n
print "m: ", round(m,4)
print "Y: ", round(Y,4)
print "Time required to attend 10°C: ", round(t,1),"s OR", round(t/3600,1), "hr"
The parameter to be used in association with Fig. 5.3-6
n:  0.0
m:  0.1236
Y:  0.2299
Time required to attend 10°C:  69522.3 s OR 19.3 hr

Example 5.5-2, Page number 364

In [33]:
#Freezing of Meat 

#Variable Declaration

rho = 1057.                 #Density of a meat, kg/m3
cp = 3480.                  #Specific heat of Beef, J/(kg.K)
k = 1.038                   #Thermal conductivity of meat, W/(m.K)
a = 0.0635                  #Thickness of beef slab, m
Tf = 270.4                  #Initial meat temperature, deg C
T1 = 244.3                  #Uniform air blast temeperature, K
h = 17.0                    #Convective heat Transfer coefficient, W/(m2.K)
Lambdafw = 335000           #Latent heat of fusion of for Water, J/kg

#Calculations

Lambdameat = 0.75*Lambdafw
t = Lambdameat*rho/(Tf-T1)*(a/(2*h)+a**2/(8*k))

#Results
print "Latent heat of freezing of meat:", round(Lambdameat/1000,1), "kJ/kg"
print 'Time required for freezing:%4.3e s OR %3.2f'%(t,t/3600)
Latent heat of freezing of meat: 251.3 kJ/kg
Time required for freezing:2.394e+04 s OR 6.65