In [1]:

```
import math
# Temperature Measurement by Thermocouples
# Variables
#Temperature of a gas stream is to be measured by a thermocouple whose junction can be approximated as a sphere
D = 0.001 #Diameter of junction sphere[m]
#Properties of the junction
k = 35. #Thermal conductivity[W/m.degree Celcius]
rho = 8500. #desity[kg/m**3]
Cp = 320. #Specific heat[J/kg.degree Celcius]
h = 210. #Convection heat transfer coefficient between junction and the gas[W/m**2.degree Celcius]
# Calculations and Results
Lc = (((math.pi/6)*(D**3))/(math.pi*(D**2))) #The characteristic length of the junction[m]
Bi = h*Lc/k #Biot Number
if(Bi<0.1):
print "Since Bi = ",Bi
print ("is less than 0.1 hence lumped system is applicable and the error involved\
in this approximation is negligible")
b = h/(rho*Cp*Lc) #math.exponent time consmath.tant[s**(-1)]
print "Time constant for given lumped heat capacity system",b,"s**(-1)"
#In order to read 99% of intial temperature difference between the junction and the gas we must have ((T(t)-T_end)/(Ti-T_end)) = 0.01
t = -1*(math.log(0.01))/b;
print "Required time is",round(t),"seconds"
```

In [2]:

```
import math
# Predicting the time of Death
# Variables
T_room = 20 #Temperature of room[degree Celcius]
T_body_f = 25 #Temperature of dead body after some time[degree Celcius]
T_body_i = 37 #Temperature of dead body just after death[degree Celcius]
h = 8 #Heat transfer Coefficient[W/m**2.degree Celcius]
L = 1.7 #Length of body which is assumed to be cylindrical in shape[m]
r = 0.15 #Radius of cylindrical body
#Average human body is 72% water by mass, thus we assumne body to have properties of water
rho = 996 #Density[kg/m**3]
k = 0.617 #Thermal conductivity[W/m.degree Celcius]
Cp = 4178 #Specific Heat[J/kg.degree Celcius]
# Calculations
Lc = (math.pi*(r**2)*L)/((2*math.pi*r*L)+(2*math.pi*(r**2))) #Characteristic length of body[m]
Bi = (h*Lc)/k #Biot no
if(Bi>0.1):
print ("lumped system analysis is not applicable, but we can still use it\
to get a rough estimate of time of death")
b = h/(rho*Cp*Lc) #[s**(-1)]
x = (T_body_i-T_room)/(T_body_f-T_room);
#math.exp(-b*t) = x;
t = (1./b)*math.log(x) #time elapsed[seconds]
# Results
print "As a rough estimate the person dies about",t/3600,"hour"
print ("before the body was found")
```

In [1]:

```
import math
# Boiling Eggs
# Variables
T1 = 5. #Initial temperature of egg[degree Celcius]
T2 = 95. #Temperature of Boiling Water[degree Celcius]
h = 1200. #Convection heat transfer coefficient of egg[W/m**2.degree Celcius]
r = 0.025 #Radius of egg[m]
T3 = 70 #Final temperature attained by centre of egg[degree Celcius]
k = 0.627 #Thermal conductivity[W/m.degree Celcius]
a = 0.151*(10**(-6)) #Thermal diffusivity[m**2/s]
# Calculations
Bi = (h*r)/k #Biot Number
if(Bi>0.1):
print ("the lumped system analysis is not applicable")
#Findinf coefficient for a sphere corresponding to this bi are,
lambda1 = 3.0754
A1 = 1.9959;
x = (T3-T2)/(T1-T2);
tau = (-1/(lambda1**2))*math.log(x/A1);
print "Fourier no is",tau
#Since fourier no is greater than 0.2, cooking time is determined from the definition of fourier no to be
t = (tau*(r**2))/a #[seconds]
print "The time taken for center of egg to reach 70 degree Celcius temperature",(t/60),"minutes"
else:
print ("the lumped system is not applicable")
```

In [5]:

```
import math
# Variables
# Heating of Brass Plates in an Oven
T_in = 20. #Initial uniform temperature of brass plate[degree Celcius]
T_f = 500. #Temperature of the oven[degree Celcius]
t = 7*60. #[seconds]
h = 120. #combined convection and radiation heat transfer coefficient[W/m**2.degree Celcius]
L = 0.04/2 #Thickness of plate 2L = 0.004[m]
#Properties of brass at room temperature are:-
k = 110. #Thermal conductivity[W/m.degree Celcius]
rho = 8530. #density[kg/m**3]
Cp = 380. #Specific Heat Capacity[J.kg.degree Celcius]
a = 33.9*(10**(-6)) #Thermal Diffusivity[m**2/s]
# Calculations
Bi1 = 1/(k/(h*L));
tau1 = (a*t)/(L**2);
#For above values of biot no and fourier no we have
p = 0.46 # p = (T0-T_f)/(T_in-T_f),where T0 is temperature of inner surface of plate at time t
x = L;
Bi2 = Bi1;
#For above condition of x/L ratio and Biot number we have
q = 0.99 #q = (T-T_f)/(T_in-T_f), where T is temperature of outer surface of plate after time t
T = T_f+((p*q)*(T_in-T_f)) #[degree Celcius]
# Results
print "The surface temperature of the plates when they leave the oven will be",T,"degree Celcius"
```

In [8]:

```
import math
# Cooling of a long Stainless Steel Cylindrical Shaft
# Variables
Ti = 600. #Temperature of cylinder just after taking it out of the oven[degree Celcius]
h = 80. #average heat transfer coefficient[W/m**2.degree Celcius]
t = 45.*60 #Time for cooling[seconds]
r = 0.1 #Radius of cylinder[m]
l = 1. #Length of cylinder[m]
#Properties of stainless steel cylinder
k = 14.9 #Thermal conductivity[W/m.degree Celcius]
rho = 7900. #Density[kg/m**3]
Cp = 477. #Specific Heat Capacity[J/kg.degree Celcius]
a = 3.95*(10**(-6)) #Thermal diffusivity[m**2/s]
T_f = 200. #Ambient temperature[degree Celcius]
# Calculations and Results
Bi1 = (h*r)/k;
tau1 = (a*t)/(r**2);
#For biot no = Bi1 and fourier no = tau1,we have
p = 0.40 #p = (T(0)-T_f)/(Ti-T_f)
T_0 = T_f+(p*(Ti-T_f)) #[degree Celcius]
print "The center temperature of the shaft after 45 minutes is",T_0,"degree Celcius"
#Determining actual heat transfer
m = rho*math.pi*(r**2)*l #[kg]
Q_max = m*Cp*(Ti-T_f)*(1./1000) #[kJ]
x = (Bi1**2)*tau1;
#For biot no = Bi1 and (h**2)at/(k**2) = x, we have
y = 0.62 #y = Q/Q_max
Q = y*Q_max #[kJ]
print "The total heat transfer from the shaft during 45 minutes of cooling is",round(Q),"kJ"
```

In [9]:

```
import math
# Minimum Burial Depth of Water Pipes to avoid Freezing
# Variables
#Soil properties:-
k = 0.4 #Thermal conductivity[W/m.degree Celcius]
a = 0.15*(10**(-6)) #Thermal diffusivity[m**2/s]
T_in = 15 #Initial uniform temperature of ground[degree Celcius]
T_x = 0 #Temperature after 3 months[degree Celcius]
Ts = -10 #Temperature of surface[degree Celcius]
# Calculations
#The temperature of the soil surrounding the pipes wil be 0 degree Celcius after three months in the case of minimum burial depth, therefore we have
x = (h/k)*(math.sqrt(a*t));
#Since h tends to infinty
#x = %inf;
y = (T_x-T_in)/(Ts-T_in);
#For values of x and y we have
neta = 0.36;
t = 90*24*60*60 #[seconds]
x = 2*neta*math.sqrt(a*t) #[m]
# Results
print "Water pipes must be burried to a depth of at least ",x,"m"
print ("so as to avoid freezing under the specified harsh winter conditions")
```

In [10]:

```
import math
# Surface Temperature Rise of Heated Blocks
# Variables
flux = 1250. #Consmath.tant solar heat flux[W/m**2]
T = 20 #Temperature of black painted wood block[degree Celcius]
k_wood = 1.26 #Thermal conductivity of wood at room temperature[W/m.K]
a_wood = 1.1*(10**(-5)) #Diffusivity of wood at room temperature[m**2/s]
k_aluminium = 237 #Thermal conductivity of aluminium at room temperature[W/m.K]
a_aluminium = 9.71*(10**(-5)) #Diffusivity of aluminium at room temperature[m**2/s]
t = 20*60 #[seconds]
# Calculations
Ts_wood = T+((flux/k_wood)*(math.sqrt((4*a_wood*t)/math.pi))) #[degree Celcius]
Ts_aluminium = T+((flux/k_aluminium)*(math.sqrt((4*a_aluminium*t)/math.pi))) #[degree Celcius]
# Results
print "The surface temperature fro both the wood and aluminium blocks are " \
,(Ts_wood),"and",round(Ts_aluminium),"degree Celcius","respectively"
```

In [11]:

```
import math
# Cooling of a Short Brass Cylinder
# Variables
Ti = 120 #Initial Temperature[degree Celcius]
T_ambient = 25 #Temperature of atmospheric air[degree Celcius]
h = 60 #convetcion heat transfer coefficient[W/m**2.degree Celcius]
r = 0.05 #radius of cylinder[m]
L = 0.06 #thickness[m]
a = 3.39*(10**(-5)) #Diffusivity of brass[m**2/s]
k = 110 #Thermal conductivity of brass[W/m.degree Celcius]
t = 900 #[seconds]
# Calculations and Results
print ("At the center of the plane wall")
tau1 = (a*t)/(L**2);
Bi1 = (h*L)/k;
print "Fourier no and Biot no are",tau1,"and",Bi1,"respectively"
print ("At the center of the cylinder")
tau2 = (a*t)/(r**2);
Bi2 = (h*r)/k;
print "Fourier no and Biot no are",tau2,"and",Bi2,"respectively"
theta_wall_c = 0.8 #(T(0,t)-T_ambient)/(Ti-T_ambient)
theta_cyl_c = 0.5 #(T(0,t)-T_ambient)/(Ti-T_ambient)
T_center = T_ambient+((theta_wall_c*theta_cyl_c)*(Ti-T_ambient)) #[degree Celcius]
print "The temperature at the center of the short cylinder is",round(T_center),"degree Celcius"
#Solution (b):-
#The centre of the top surface of the cylinder is still at the center of the lonf cylinder(r = 0),but at the outer surface of the plane wall(x = L).
x = L #[m]
y = x/L;
#For Bi = Bi1 and x = 1
theta_wall_L = 0.98*theta_wall_c #(T(L,t)-T_ambient)/(Ti-T_ambient)
T_surface = T_ambient+((theta_wall_L*theta_cyl_c)*(Ti-T_ambient)) #[degree Celcius]
print "The temperature at the top surface of the cylinder",round(T_surface),"degree Celcius"
```

In [12]:

```
import math
# Heat transfer from a Short Cylinder
# Variables
Ti = 120. #Initial Temperature[degree Celcius]
T_ambient = 25. #Temperature of atmospheric air[degree Celcius]
rho = 8530. #density of brass cyliner[kg/m**3]
Cp = 0.380 #Specific heat of brass cylinder[kJ/kg.degree Celcius]
r = 0.05 #radius[m]
H = 0.12 #Height of cylinder[m]
h = 60. #convetcion heat transfer coefficient[W/m**2.degree Celcius]
a = 3.39*(10**(-5)) #Diffusivity of brass [m**2/s]
k = 110. #Thermal conductivity of brass[W/m.degree Celcius]
L = 0.06 #[m]
t = 900 #[seconds]
# Calculations
m = rho*(math.pi*(r**2)*H) #mass of cylinder[kg]
Q_max = m*Cp*(Ti-T_ambient) #[kJ]
print ("At the center of the plane wall")
tau1 = (a*t)/(L**2);
Bi1 = (h*L)/k;
x = (Bi1**2)*tau1;
#For given x and Bi1
p = 0.23 #(Q/Qmax) for plane wall
print ("At the center of the cylinder")
tau2 = (a*t)/(r**2);
Bi2 = (h*r)/k;
y = (Bi2**2)*tau2;
#For given y and Bi2
q = 0.47 #(Q/Qmax) for infinite cylinder
Q = Q_max*(p+(q*(1-p))) #[kJ]
print "The total heat transfer from the cylinder during the first 15 minutes of cooling is",Q,"kJ"
```

In [17]:

```
import math
# Cooling of a Long Cylinder by Water
# Variables
Ti = 200. #Initial Temperature of aluminium cylinder[degree Celcius]
Tf = 15. #Temperature of water in which cylinder is kept[degree Celcius]
h = 120. #Heat transfer Coefficent[W/m**2.degree Celcius]
t = 5*60. #[seconds]
#Properties of aluminium at room temperature
k = 237 #Thermal conductivity[W/m.degree Celcius]
a = 9.71*(10**(-5)) #Thermal diffusivity[m**/s]
r = 0.1 #Radius of cylinder[m]
x = 0.15 #[m]
# Calculations
Bi = (h*r)/k #Biot number
#Corresponding to this biot no coefficients for a cylinder
lambda_ = 0.3126
A = 1.0124;
tau = (a*t)/(r**2);
#Umath.sing one term approximation
theta0 = A*math.exp(-(lambda_**2)*tau);
neta = x/(2*math.sqrt(a*t));
u = (h*math.sqrt(a*t))/k;
v = (h*x)/k;
w = (u**2);
theta_semiinfinite = 1-math.erfc(neta)+(math.exp(v+w)*math.erfc(neta+u));
theta = theta_semiinfinite*theta0;
T_x_t = Tf+(theta*(Ti-Tf)) #[degree Celcius]
# Results
print "the temperature at the center of the cylinder 15cm from the exposed bottom surface",(T_x_t),"degree Celcius"
```

In [19]:

```
import math
# Refrigerating Steaks while Avoiding Frostbite
# Variables
Ti = 25 #Initial temperature of steaks[degree Celcius]
Tf = -15 #Temperature of refrigerator[degree Celcius]
L = 0.015 #Thickness of steaks[m]
#Properties of steaks
k = 0.45 #[W/m.degree Celcius]
rho = 1200 #density[kg/m**3]
a = 9.03*(10**(-8)) #Thermal diffusivity[m**2/s]
Cp = 4.10 #Specific Heat [kJ/kg]
T_L = 2
T_0 = 8 #[degree Celcius]
# Calculations
#In the limiting case the surface temperature at x = L from the centre will be 2 degree C,while midplane temperature is 8 degree C in an environment at -15 degree C we have
x = L;
p = (T_L-Tf)/(T_0-Tf);
#For this value of p we have
Bi = 1/1.5 #Biot number
h = (Bi*k)/L #[W/m**2.degree Celcius]
# Results
print "The convection heat transfer coefficient should be kept below the value",h,"W/m**2.degree Celcius"
print ("to satisfy the constraints on the temperature of the steak during refrigeration")
```