In [2]:

```
#Example 4.1
# Calculate the time required for ball to attain a temperature of 150 deg C.
#variables:
c=460.0 # kJ/kg
k=35.0 #W/m
d=0.05 # diameter in meter
r=d/2 # radius in meter
h=10.0 #convection heat transfer coeff in W/sq meter
T=150.0 #Temperature in deg C
p=7800 #Density in kg/cubic meter
Ti=100.0 # T,infinity ..in celsius
To=450.0 # in Celsius
#CALCULATION
import math
A=(4*math.pi) * (r**2) #Arear in sq meter
V=(A*r/3) # Volume in cubic meters
c1=(h*(V/A))/k #it is less than 0.1 So,
print "hV/A/k is:",round(c1,4),"which is less than 0.1,So by eq 4.5"
c2=((h*A)/(p*c*V)) # assumed variable for easiness
#RESULTS
print "hA/pcV is",c2,"per second"
t=(-1/c2)*(math.log((T-Ti)/(To-Ti)))
print "Time is",round(t),"seconds"
```

In [4]:

```
#Example 4.2
#Calculate the temperature at a depth of 2.5 cm after 0.5 min for both cases
import math
#variable declaration
k = 45 # [W/m per deg C ] thermal conductivity of steel block
alpha = 1.4*10**( -5) ; # [ square meter / s ] constant
Tb = 35 # [ degree celsius ] block temperature
x = 0.025 # [m] depth at which temperature is calculated
t = 30 # [s]time after which temperature is to be calculated
To = 250 # [ degree celsius]
#CALCULATION & rESULT
er=(x/(2*math.sqrt(alpha*t))) # error function short form
T_x_t = (To +(Tb -To)*( math.erf(er)))
# for the constant heat flux case B we make use of eq4.13 a
# since qo/A is given
print "Temperature at depth of 0 .025 m after 30 s for case 1 is",round(T_x_t,1)," degree celsius "
q_by_A = 3.2*10**(5) ; # [W/ s qua r e meter ]
T_x_t1 =(Tb +(2* q_by_A*math.sqrt(alpha*t/math.pi)*math.exp(-(x**2)/(4*alpha *t))/k) -(q_by_A *x*(1 - math.erf(er))/k)) # [ degree celsius ]
print "Temperature at depth of 0 . 0 2 5 m after 30 second for case 2 is",round(T_x_t1,1),"degree celsius"
# for the constant heat flux case the surface temperature after 30 s would be evaluated with x= 0 in equation(4.13 a )
x = 0 # [m] at the surface
T_x_o = Tb +(2* q_by_A *math.sqrt(alpha*t/math.pi) * math.exp (-(x **2)/(4*alpha*t))/k) -(q_by_A*x*(1 -math.erf (er))/k) # [degree celsius]
print "Surface temperature after 30 second is:",round(T_x_o,1) ,"degree celsius "
```

In [5]:

```
#Example 4.3
#Estimate the temperature at the surface and at a depth of 2 mm after 2 sec
#Qo/A=10^7 J/sq meter
import math # import math file
#variable declaration
c1=10 # =Qo/A laser pulse in MJ/sq meter
c1=(c1*10**6) # convert in joule from MJ
p=7800 # Density in kg/cubic meter
c=460 #J/kg
a=(0.44*(10**(-5))) # sq m/sec
t=2 # time in seconds
Ti=40.0 # initial temp in deg C
print "ASSUMPTION: Negligible radiation effects"
#From eqq 4.13,:
print "At x=0"
#calculation
To=Ti+(c1/(p*c*math.sqrt((math.pi)*a*t)))
print "At x=2mm ie 0.002 m"
x=0.002
print x
T=(Ti+(c1/(p*c*math.sqrt((math.pi)*a*t)))*(math.exp(-(x**2)/(4*a*t))))
#RESULTS
print "T =:", round(T),"Celsius"
```

In [6]:

```
#Example 4.5:Sudden exposure of semi-infinite solid slab to convection
# Calculate time req for the temp to reach 120 deg C at depth of 4 cm
#VARIABLE DECLARATION
alpha = 8.4*10**(-5) # [square meter/s] constant
Ts = 200 # [degree celsius] initial temperature of of slab
Te = 70 # [degree celsius] environment temperature
k = 215 # [W/m deg C] heat transfer coefficient of slab
h = 525 # [W/sq m degree celsius] heat transfer coefficient
x = 0.04 # [m] depth at which temperature is calculated
T_x_t = 120 # [degree celsius] temperature at depth 0.04 m
# using eq 4-15 or figure (4-5) for solution of this problem
# by using figure it is easier to calculate it involves iterative method to solve because time appeares in both the variables
# h*sqrt(alpha*t)/k and x/(2*sqrt(alpha*t))
K = (T_x_t-Ts)/(Te-Ts)
# Seek the values of t such that the above value of K is equal to the value of K which comes out from graph
# values of t and obtain other readings
#CALCULATION & RESULT
print "The iteration are listed below"
# at t = 1000s
import math
t = 1000 # [s] time
A = h*math.sqrt(alpha*t)/k
B = x/(2*math.sqrt(alpha*t))
print " h*math.sqrt(alpha*t)/k x/(2*sqrt(alpha*t)) (T_x_t-Ts)/(Te-Ts)"
print t," ",round(A,3)," ",round(B,3)," ","0.41"
t = 3000 # [s] time
A = h*math.sqrt(alpha*t)/k
B = x/(2*math.sqrt(alpha*t))
print t," ",round(A,3)," ",round(B,3)," ","0.61"
t = 4000 # [s] time
A = h*math.sqrt(alpha*t)/k
B = x/(2*math.sqrt(alpha*t))
print t," ",round(A,3)," ",round(B,3)," ","0.68"
print "Consequently the time required is approximately 3000 second"
```

In [7]:

```
#Example 4.6-aluminium plate suddenly exposed to convection
#Calculate Energy removed /Area from the plate at this time
#VARIABLE DECLARATION
alpha = 8.4*10**(-5) # [square meter/s] constant
Ts = 200 # [deg celsius] initial temperature of plate
Te = 70 # [degree celsius] environment temperature
k = 215 # [W/m deg C] heat transfer coeff of plate
h = 525 #[W/sq m deg C] heat transfer coefficient
x = 0.0125 #[m] depth at which temperature is calculated
t = 60 #[s]time after which temperature is calculated
L = 0.025 # [m] thickness of plate
#CALCULATION
theta_i = Ts-Te # [degree celsius]
# then
Z = alpha*t/L**2
X = k/(h*L)
x_by_L = x/L
# from figure 4-7(page no.-144-145)
theta_o_by_theta_i = 0.61
theta_o = theta_o_by_theta_i*theta_i # [degree celsius]
# from figure 4-10(page no.-149) at x/L = 0.5,
theta_by_theta_o = 0.98
theta = theta_by_theta_o*theta_o # [degree celsius]
T = Te+theta # [degree celsius]
# using Figure 4-14(page no.-152). For this calculation we require the following properties of aluminium:
rho = 2700 # [kg/cubic meter]
C = 900 # [J/kg degree celsius]
# for figure 4-14(page no.-152) we need
V = h**2*alpha*t/(k**2)
B = h*L/k
# from figure 4-14(page no.-152)
Q_by_Qo = 0.41
# for unit area
Qo_by_A = rho*C*2*L*theta_i # [J/square meter]
# Now, heat removed per unit surface area is
Q_by_A = Qo_by_A*Q_by_Qo # [J/square meter]
#RESULTS
print"Temperature at a depth of 1.25 cm from one of faces after 1 min of exposure of plate to the environment is",round(T,1)," degree celsius"
print"Energy removed per unit area from the plate in this time is",Q_by_A," J/square meter"
```

In [8]:

```
#Example4.7-Long cylinder suddenly exposed to convection
#VARIABLE DECLARATION
d = 0.05 # [m] diameter of cylinder
Ti = 200 # [degree C] initial temperature of aluminium cylinder
Tinf = 70 # [degree celsius] temperature of environment
h = 525 # [W/sq m degree celsius] heat transfer coefficient
#CALCULATION
# we have
theta_i = Ti-Tinf # [degree celsius]
alpha = 8.4*10**(-5) # [square meter/s]
ro = d/2 # [m]
t = 60 # [s]
k = 215 # [W/m degree celsius]
r = 0.0125 # [m]
rho = 2700 # [kg/cubic meter]
C = 900 # [J/kg degree celsius]
# we compute
Z = alpha*t/ro**2
X = k/(h*ro)
r_by_ro = r/ro
# from figure 4-8(page no.-146)
theta_o_by_theta_i = 0.38
# from figure 4-11(page no.-150) at r/ro = 0.5
theta_by_theta_o = 0.98
# so that
theta_by_theta_i = theta_o_by_theta_i*theta_by_theta_o
theta = theta_i*theta_by_theta_i # [degree celsius]
T = Tinf+theta # [degree celsius]
# to compute the heat lost, we determine
V = h**2*alpha*t/k**2
B = h*ro/k
# from figure 4-15(page no.-153)
Q_by_Qo = 0.65
# for unit length
import math
Qo_by_L = rho*C*math.pi*ro**2*theta_i # [J/m]
#actual heat lost per unit length is
Q_by_L = Qo_by_L*Q_by_Qo # [J/m]
#RESULTS
print"Temperature at a radius of 1.25 cm is",round(T,1)," degree celsius"
print"Heat lost per unit length 1 minute after the cylinder is exposed to the environment is",round(Q_by_L),"J/m"
```

In [10]:

```
#Example 4.8-
#Calculate temperature at axis and surface of th cylinder 10 cm from end 1 min after exposure
#VARIABLES DECLARATION
import math
d = 0.05 # [m] diameter of aluminium cylinder
Ti = 200 # [degree celsius] initial temperature of of cylinder
Te = 70 # [degree celsius] environment temperature
k = 215 # [W/m degree celsius] heat transfer coefficient of plate
h = 525 # [W/sq m degree celsius] convection heat transfer coefficient
alpha = 8.4*10**(-5) # [square meter/s] constant
x = 0.10 # [m] distance at which temperature is calculated from end
t = 60 # [s] time after which temperature is measured
# so that the parameters for use with figure(4-5)
#CALCULATION
A = h*math.sqrt(alpha*t)/k
B = x/(2*math.sqrt(alpha*t))
# from figure (4-5)
z = 1-0.036
S_of_X = z
# for the infinite cylinder we seek both the axis- and surface-temperature ratios.
# the parameters for use with fig(4-8) are
r_o = d/2 # [m] radius of aluminium cylinder
r = d/2 # [m] for surface temperature ratio
C = k/(h*r_o)
D = (alpha*t/r_o**(2))
y = 0.38
# this is the axis temperature ratio.
# to find the surface-temperature ratio,we enter figure (4-11),using
R = r/r_o
u = 0.97
# thus
w = y # at r = 0
v = y*u # at r = r_o
C_of_O_axis = w # at r = 0
C_of_O_r_o = v # at r = r_o
# combining the solutions for the semi-infinite slab and infinite cylinder, we have
t = S_of_X*C_of_O_axis
s = S_of_X*C_of_O_r_o
# the corresponding temperatures are
T_axis = Te+t*(Ti-Te)
T_r_o = Te+s*(Ti-Te)
#RESULTS
print"The temperature at the axis is:",round(T_axis,1)," degree celsius"
print"The temperature at the surface is",round(T_r_o,1)," degree celsius"
```

In [13]:

```
#Example 4.9
# finite length cylinder suddenly exposed to convection
#Variable declaration
d = 0.05 # [m] diameter of aluminium cylinder
Ti = 200 # [degree celsius] initial temperature of of cylinder
Te = 70 # [degree celsius] environment temperature
k = 215 # [W/m deg celsius] heat transfer coefficient of plate
h = 525 # [W/sq m deg C] convection heat transfer coefficient
alpha = 8.4*10**(-5) #[square meter/s] constant
x1 = 0.00625 #[m]dist at which temperature is calculated from end
t = 60 # [s] time after which temperature is measured
r = 0.0125 # [m] radius at which temperature is calculated
# to solve this problem we combine the solutions from heisler charts for an infinite cylinder and an infinite plate in accordance with the combination shown in fig (4-18f)
# for the infinite plate problem
L = 0.05 # [m]
#CALCULATION
# the x position is measured fromthe center of the plate so that
x = L-x1 # [m]
A = k/(h*L)
B = (alpha*t/L**(2))
# from figures (4-17) and (4-10) respectively
thetha_o_by_i = 0.75
thetha_by_i = 0.95
# so that
thetha_by_i_plate = thetha_o_by_i*thetha_by_i
# for the cylinder
r_o = d/2 # [m] radius of the cylinder
R = r/r_o
C = k/(h*r_o)
D = (alpha*t/r_o**(2))
# and from figures (4-8) and (4-11), respectively
thetha_o_by_i_cyl = 0.38
thetha_by_o = 0.98
# so that
thetha_by_i_cyl = thetha_o_by_i_cyl*thetha_by_o
# combining the solutions for the plate and cylinder gives
thetha_by_i_short_cyl = thetha_by_i_plate*thetha_by_i_cyl
#thus
T = Te+thetha_by_i_short_cyl*(Ti-Te)
#RESULTS
print"Temperature at a radial position of 0.0125 m and a distance of 0.00625m from one end of cylinder 60 second after exposure to environment is",round(T,1),"degree celsius"
```

In [14]:

```
#Example 4.10
# heat loss for finite-length cylinder
#Variable declaration
d = 0.05 # [m] diameter of aluminium cylinder
l = 0.1 # [m] length of aluminium cylinder
Ti = 200 # [degree celsius] initial temperature of of cylinder
Te = 70 # [degree celsius] environment temperature
k = 215 # [W/m degree celsius] heat transfer coefficient of plate
h = 525 # [W/sq m deg celsius] convection heat transfer coefficient
alpha = 8.4*10**(-5) #[square meter/s] constant
x1 = 0.00625 #[m] distance at which temperature is calculated from end
t = 60 #[s]time after which temperature is measured
r = 0.0125 #[m] radius at which temperature is calculated
#CALCULATION
# calculate the dimensionless heat-loss ratio for the infinite plate and infinite cylinder which make up the multidimensional body
# for the plate we have
L = 0.05 # [m]
A = h*L/k
B = h**(2)*alpha*t/k**(2)
# from figure (4-14), for the plate, we read
Q_by_Q_o_plate = 0.22
# for the cylinder
r_o = 0.025 # [m]
# so we calculate
C = h*r_o/k
# and from figure(4-15) we have
Q_by_Q_o_cyl = 0.55
# the two heat ratios may be inserted in equation(4-22) to give
Q_by_Q_o_tot = Q_by_Q_o_plate+Q_by_Q_o_cyl*(1-Q_by_Q_o_plate)
c = 896 # [J/kg degree celsius] specific heat of aluminium
rho = 2707 # [kg/cubic meter] density of aluminium
import math
V = math.pi*r_o**(2)*l # [cubic meter]
Qo = rho*c*V*(Ti-Te) # [J]
Q = Qo*Q_by_Q_o_tot # [J] the actual heat loss in the 1-minute
#RESULTS
print "The actual heat loss in the 1-minute:",round((Q/1000),1)," kJ"
```