In [7]:

```
import math
# Variables
t = 0.5; #Thickness of slab in m
A = 5; #Area of slab in m**2
k = 1.2; #Thermal conductivity in W/m.K
a = 0.00177; #Thermal diffusivity in m**2/h
# Calculations
x = 0;
y = -50+(24*x)+(60*x**2)-(60*x**3); #Temperature when x = 0
Qo = (-k*A*y); #Heat entering the slab in W
x = 0.5;
y = -50+(24*x)+(60*x**2)-(60*x**3); #Temperature when x = 0.5
QL = (-k*A*y); #Heat leaving the slab in W
R = (Qo-QL); #Rate of heat storage in W
x = 0;
z1 = 24+(120*x)-(180*x**2); #T' when x = 0
p1 = (a*z1); #Rate of temperature change at one side of slab in degree C/h
x = 0.5;
z2 = 24+(120*x)-(180*x**2); #T' when x = 0.5
p2 = (a*z2); #Rate of temperature change at one side of slab in degree C/h
#For the rate of heating or cooling to be maximum, T''' = 0
x = (120./360);
# Results
print 'a)\n \
i)Heat entering the slab is %i W \n \
ii)Heat leaving the slab is %i W \n\n\
b)Rate of heat storage is %i Wc \n \
i)Rate of temperature change at one side of slab is %3.4f degree C/h \n \
ii)Rate of temperature change at other side of slab is %3.4f degree C/h \
\n\nd)For the rate of heating or cooling to be maximum x = %3.2f'%(Qo,QL,R,p1,p2,x)
```

In [3]:

```
import math
# Variables
A = (0.4*0.4); #Area of copper slab in m**2
t = 0.005; #Thickness of copper slab in m
T = 250.; #Uniform teperature in degree c
Ts = 30.; #Surface temperature in degree C
Tsl = 90.; #Slab temperature in degree C
p = 9000.; #Density in kg/m**3
c = 380.; #Specific heat in J/kg.K
k = 370.; #Thermal conductivity in W/m.K
h = 90.; #Heat transfer coefficient in W/m**2.K
# Calculations
A1 = (2*A); #Area of two sides in m**2
V = (A*t); #Volume of the slab in m**3
Lc = (V/A1); #Corrected length in m
Bi = ((h*Lc)/k); #Biot number
t = -math.log((Tsl-Ts)/(T-Ts))/((h*A1)/(p*c*V)); #Time at which slab temperature becomes 90 degree C in s
y = (h*A1)/(p*c*V);
# Results
print 'Time at which slab temperature becomes 90 degree C is %3.2f s'%(t)
```

In [4]:

```
import math
# Variables
D = 0.01; #Outer diameter of the rod in m
T = 320.; #Original temperature in degree C
Tl = 120.; #Temperature of liquid in degree C
h = 100.; #Heat transfer coefficient in W/m**2.K
Tf = 200.; #Final temperature of rod in degree C
k = 40.; #Thermal conductivity in W/m.K
c = 460.; #Specific heat in J/kg.K
p = 7800.; #Density in kg/m**3
# Calculations
V = (3.14*D**2*1)/4; #Volume of rod in m**3 taking 1m length
A = (3.14*D*1); #Surface area of rod in m**2 taking 1m length
Lc = (D/4); #Corrected length in m
Bi = ((h*Lc)/k); #Biot number
t = -math.log((Tf-Tl)/(T-Tl))/((h*4)/(p*c*D)); #Time at which rod temperature becomes 200 degree C in s
# Results
print 'Time at which rod temperature becomes 200 degree C is %3.2f s'%(t)
```

In [3]:

```
import math
# Variables
w = 5.5; #Weight of the sphere in kg
Ti = 290.; #Initial temperature in degree C
Tl = 15.; #Temperature of liquid in degree C
h = 58.; #Heat transfer coefficient in W/m**2.K
Tf = 95.; #Final temperature in degree C
k = 205.; #Thermal conductivity in W/m.K
c = 900.; #Specific heat in J/kg.K
p = 2700.; #Density in kg/m**3
# Calculations
V = (w/p); #Volume of the sphere in m**3
R = ((3*V)/(4*3.14))**(1./3); #Radius of sphere in m
Lc = (R/3.); #Corrected length in m
t = -math.log((Tf-Tl)/(Ti-Tl))/((h*3)/(p*c*R)); #Time at which rod temperature becomes 95 degree C in s
# Results
print 'Time at which rod temperature becomes 95 degree C is %3.0f s'%(t)
# note : answer is slightly different because of rouding off error.
```

In [7]:

```
import math
# Variables
Ti = 100.; #Temperature of air in degree C
t = 0.03; #Thickness of slab in m
To = 210.; #Initial temperature of the plate in degree C
t = 300.; #Time for attaining temperature in s
T = 170.; #Temperature decreased in degree C
c = 380.; #Specific heat in J/kg.K
p = 9000.; #Density in kg/m**3
# Calculations
Lc = (t/2); #Corrected length in m
h = -math.log((T-Ti)/(To-Ti))/((t*10**4)/(p*c*Lc)); #Heat transfer coefficient in W/m**2.K
# Results
print 'Heat transfer coefficient is %3.2f W/m**2.K'%(h)
```

In [14]:

```
import math
# Variables
D = 0.00071; #Diameter of thermocouple in m
h = 600.; #Heat transfer coefficient in W/m**2.K
c = 420.; #Specific heat in J/kg.K
p = 8600.; #Density in kg/m**3
# Calculations
t = (p*c*D)/(4*h); #Time period in s
T = math.exp(-1); #Temperture distribution ratio
t1 = (4*t); #Total time in s
# Results
print 'At the end of time period t* = %3.3f s the temperature difference \
between the body and the source would be %3.3f of the initial temperature differnce.\n\
To get a true reading of gas temperature, it should be recorded after 4t* = %i seconds after\
the thermocouple has been \nintroduced into the stream'%(t,T,t1)
```

In [28]:

```
import math
# Variables
x = 0.2; #Distance of plane from the wall in m
t = 10; #Time for heat flow in h
T = [25,800]; #Initial and final tempertaure in degree C
k = 0.8; #Thermal conductivity in W/m.K
a = 0.003; #Thermal diffusivity in m**2/h
# Calculations
X = (x*(2*math.sqrt(a*t))); #Calculation of X for erf function
Y = 0.585 #erf(X) from table 5.1
Ti = T[1]-((T[1]-T[0]))*Y; #Temperarture of the plane in degree C
Qi = ((-k*(T[0]-T[1])*math.exp(-x**2/(4*a*t)))/(math.sqrt(3.14*a*t))); #Instanteneous heat flow rate per unit area in W/m**2
Q = ((2*k*(T[1]-T[0])*3600)/(math.sqrt((3.14*a)/t)))/10**8; #Total heat energy taken up by the wall in 10 hours in J/m**2
print
# Results
print 'Temperarture of the plane is %3.2f degree C\nInstanteneous heat flow rate per \
unit area is %i W/m**2 \nTotal heat energy taken up by the wall in 10 hours is %3.3f*10**8 J/m**2'%(Ti,Qi,Q)
```

In [11]:

```
# Variables
Tc = 55; #Tempertaure of the concrete in degree C
Ts = 35; #Temperature lowered in degree C
Tf = 45; #Final temperature in degree C
x = 0.05; #Depth of the slab in m
k = 1.279; #Thermal conductivity in W/m.K
a = 0.00177; #Thermal diffusivity in m**2/h
# Calculations
T = (Tf-Ts)/(Tc-Ts); #Temperature distribution
X = 0.485; #Taking 0.5 = erf(0.482) from table 5.1 on page no. 175
t = (x**2)/(4*X**2*a); #Time taken to cool the concrete to 45 degree C in h
# Results
print 'Time taken to cool the concrete to 45 degree C is %3.2f h'%(t)
```

In [12]:

```
import math
# Variables
q = (0.3*10**6); #Heat flux in W/m**2
t = (10./60); #Time taken for heat transfer in s
Ti = 30.; #Initial temperature of the slab in degree C
x = 0.2; #Distance of the plane from the surface in m
k = 386.; #Thermal conductivity in W/m.K
a = 0.404; #Thermal diffusivity in m**2/h
# Calculations
Ts = ((q*math.sqrt(3.14*a*t))/k)+Ti; #Surface temperature in degree C
X = (x/(2*math.sqrt(a*t))); #X for calculating erf function
Y = 0.4134; #Taking ref(0.385) = 0.4134 from table 5.1 on page no. 175
T = Ts-(Y*(Ts-Ti)); #Tempertaure at a distance of 20 cm from the surface after 10 min in degree C
# Results
print 'Tempertaure at a distance of 20 cm from the surface after 10 min is %3.2f degree C'%(T)
```

In [15]:

```
import math
# Variables
a = 0.405; #Thermal diffusivity in m**2/h
Ti = 100; #Initial temperture in degree C
Tf = 0; #Final tempertaure in degree C
Tg = (4*100); #Temperature gradient in degree C/m
t1 = 1; #Time taken in m
# Calculations
t = (Ti-Tf)**2/(Tg**2*3.14*a); #Time required for the temperature gradient at the surface to reach 4 degree/cm in h
x = math.sqrt(2*a*(t1/60.)); #The depth at which the rate of cooling is maximum after 1 minute in m
# Results
print 'Time required for the temperature gradient at the surface to reach 4 degree/cm is %3.3f h \
\nThe depth at which the rate of cooling is maximum after 1 minute is %3.4f m'%(t,x)
```

In [16]:

```
# Variables
x = 0.1; #Thickness of the slab in m
Ti = 500; #Initial temperature in degree C
Tl = 100; #Liquid temperature in degree C
h = 1200; #Heat transfer coefficient in W/m**2.K
t = (1*60); #Time for immersion in s
k = 215; #Thermal conductivity in W/m.K
a = (8.4*10**-5); #Thermal diffusivity in m**2/h
c = 900; #Specific heat in J/kg/K
p = 2700; #Density in kg/m**3
# Calculations
X = (a*t)/(x/2)**2; #Calculation for input in Heisler charts
B = (k/(h*(x/2))); #Calculation for input in Heisler charts
T1 = 0.68; #T value taken from Fig. 5.7 on page no. 183
Tc1 = (T1*(Ti-Tl)); #Temperature in degree C
To = Tc1+Tl; #Temperature in degree C
T2 = 0.880; #From Fig 5.8 on page no. 184 at x/L = 1.0 and for k/hL = 3.583, tempertaure in degree C
Tc2 = (T2*(To-Tl))+Tl; #Temperature in degree C
Y = (h**2*a*t)/(k**2); #Y to calculate the energy losses
Bi = (h*(x/2))/k; #Biot number
U = 0.32; #U/Uo value from Fig. 5.9 on page no.185
Uo = (p*c*x*(Ti-Tl)); #For unit area in J/m**2
U1 = (U*Uo)/(10**6); #Heat removed per unit surface area in MJ/m**2
# Results
print 'Temperature at the centreline and the surface 1 minute after the immersion is %3.2f degree C \n \
Heat removed per unit surface area is %3.1f*10**6 J/m**2'%(Tc2,U1)
```

In [17]:

```
# Variables
D = 0.12; #Diameter of cylinder in m
Ti = 20; #Initial temperature in degree C
Tf = 820; #Temperature of furnace in degree C
h = 140; #Heat transfer coefficient in W/m**2.K
Ta = 800; #Axis temperature in degree C
r = 0.054; #Radius in m
k = 21; #Thermal conductivity in W/m.K
a = (6.11*10**-6); #Thermal diffusivity in m**2/h
# Calculations
Bi = (h*(D/2))/(2*k); #Biot number
T = (Ta-Tf)/(Ti-Tf); #Temperature distribution
Fo = 5.2; #Umath.sing Fig.5.10, on page no.187 for 1./(2Bi) = 2.5
t = (Fo*(D/2)**2)/a; #Time required for the axis temperature to reach 800 degree C in s
r1 = (r/(D/2)); #Ratio at a radius of 5.4 cm
X = 0.85; #From Fig.5.11 on page no. 188 the temperature at r = 5.4 i sgiven by X
T1 = X*(Ta-Tf)+Tf; #Temperature at a radius of 5.4 cm at that tim ein degree C
# Results
print 'Time required for the axis temperature to reach 800 degree C is %3.0f s \n \
Temperature at a radius of 5.4 cm at that time is %i degree C'%(t,T1)
```

In [9]:

```
import math
import math
# Variables
r = 0.01; #Radius of the mettalic sphere in m
Ti = 400.; #Initial temperature in degree C
h1 = 10.; #Heat transfer coefficient in W/m**2.K
Ta = 20.; #Temperature of air in degree C
Tc = 335.; #Central temperature in degree C
Tw = 20.; #Temperature of water bath in degree C
h2 = 6000.; #Heat transfer coefficient in W/m**2.K
Tf = 50.; #Final temperature of the sphere in degree C
k = 20.; #Thermal conductivity in W/m.K
a = (6.66*10**-6); #Thermal diffusivity in m**2/h
c = 1000.; #Specific heat in J/kg/K
p = 3000.; #Density in kg/m**3
# Calculations
Bi1 = (h1*r)/(3*k); #Biot number
t = ((p*r*c)/(3*h1)*math.log((Ti-Ta)/(Tc-Ta))) #Time required for cooling in air in s
Bi2 = (h2*r)/(3*k); #Biot number
X = 1./(3*Bi2); #X value for lumped capacity method
T = (Tf-Ta)/(Tc-Ta); #Temperature distribution
Fo = 0.5; #Umath.sing Fig.5.13, on page no.190
t1 = (Fo*r**2)/a; #Time required for cooling in water in s
Z = 0.33; #Umath.sing Fig.5.14, on page no.191
Tr = Z*(Tf-Ta)+Ta; #Surface temperature at the end of cooling in degree C
# Results
print 'Time required for cooling in air is %3.0f s \n \
Time required for cooling in water is %3.1f s \n \
Surface temperature at the end of cooling is %3.0f degree C'%(t,t1,Tr)
```

In [19]:

```
import math
# Variables
Ti = 250.; #Temperature of aluminium slab in degree C
Tc = 50.; #Convective environment temperature in degree C
h = 500.; #Heat transfer coefficient in W/m**2.K
x = 0.05; #Depth of the plane in m
t = (1.*3600); #Time in s
k = 215.; #Thermal conductivity in W/m.K
a = (8.4*10**-5); #Thermal diffusivity in m**2/h
# Calculations
X = (h*math.sqrt(a*t))/k; #X for calculating Temperature
Y = (x/(2*math.sqrt(a*t))); #Y for calculating Temperature
Z = 0.62; #From Fig. 5.16 on page no.193
T = (Z*(Tc-Ti)+Ti); #Temperature at a depth of 5 cm after 1 hour in degree C
# Results
print 'Temperature at a depth of 5 cm after 1 hour is %3.0f degree C'%(T)
```

In [20]:

```
# Variables
D = 0.08; #Diameter of the cylinder in m
L = 0.16; #Length of the cylinder in m
Ti = 800; #Initial tempertaure in degree C
Tm = 30; #Temperature of the medium in degree C
h = 120; #Heat transfer coefficient in W/m**2.K
t = (30*60); #Time for cooling in s
k = 23.5; #Thermal conductivity in W/m.K
a = 0.022; #Thermal diffusivity in m**2/h
# Calculations
Bi2 = (h*(D/2))/k; #2 times the Biot number
X = (a*t)/(D/2)**2; #X for calculating C(R)
CR = 0.068; #From Fig.5.10 on page no.187
Bi1 = (k/(h*L)); #Biot number
Y = (a*t)/L**2; #Y for calculating P(X)
PX = 0.54; #From Fig.5.7 on page no.183
T = CR*PX; #Temperature at the centre of the cylinder in degree C
T30 = T*(Ti-Tm)+Tm; #Temperature at the centre of cylinder 30 minutes after cooling is initiated in degree C
# Results
print 'Temperature at the centre of cylinder 30 minutes after cooling is initiated is %3.2f degree C'%(T30)
```

In [22]:

```
import math
from numpy import *
# Variables
L = array([0.5,0.4,0.2]); #Lengths of sides of a recmath.tangular steel billet in m
Ti = 30; #Initial temperature in degree C
Tf = 1000; #Final temperature in degree C
t = (90*60); #Time for heating in s
h = 185; #Heat transfer coefficient in W/m**2.K
k = 37; #Thermal conductivity in W/m.K
a = 0.025; #Thermal diffusivity in m**2/h
# Calculations
L1 = L/2; #L values of the parallelepiped in m
Bi1 = (h*L[0])/k; #Biot number
X1 = (a*t)/L[0]**2; #X1 for calculating P(X1)
PX1 = 0.68; #P(X1) value from From Fig.5.7 on page no.183
Bi2 = (h*L[1])/k; #Biot number
X1 = (a*t)/L[1]**2; #X1 for calculating P(X2)
PX2 = 0.57; #P(X2) value from From Fig.5.7 on page no.183
Bi3 = (h*L[2])/k; #Biot number
Y = (1./Bi3); #Inverse of Biot number
X1 = (a*t)/L[2]**2; #X1 for calculating P(X3)
PX3 = 0.22; #P(X3) value from From Fig.5.7 on page no.183
T = PX1*PX2*PX3; #Temperature at the centre of billet in degree C
T1 = T*(Ti-Tf)+Tf; #Temperature at the centre of cylinder 90 minutes after heating is initiated in degree C
# Results
print 'Temperature at the centre of cylinder 90 minutes after heating is initiated is %3.2f degree C'%(T1)
```

In [23]:

```
# Variables
Ti = 30; #Initial temperature of the slab in degree C
q = (2*10**5); #Constant heat flux in W/m**2
k = 400; #Thermal conductivity in W/m.K
a = (117*10**-6); #Thermal diffusivity in m**2/h
n = 0.075; #Nodal spacing in m
x = 0.15; #Depth in m
t = (4*60); #Time elapsed in s
#CALCULATION
R = (x**2/(a*t)); #R value for t1
t1 = (n**2/(R*a)); #Value of t1 in s
To = 121.9; #The surface temperature after 4 min in degree C from the table on page no. 203
T2 = 64; #Temperature at 0.15 m from the surface after 4 minutes in degree C from the table on page no. 203
# Results
print 'The surface temperature after 4 min is %3.1f degree C \n \
Temperature at 0.15 m from the surface after 4 minutes is %i degree C'%(To,T2)
```

In [24]:

```
# Variables
t = 0.6; #Thickness of the wall in m
x = 0.1; #x value taken from Fig.Ex. 5.19 on page no. 205
Ti = 20; #Initial temperature in degree C
T = [150,300]; #Temperatures of the sides of the wall in degree C
Tf = 150; #Final temperature of the wall in degree C
a = (1.66*10**-3); #Thermal diffusivity in m**2/h
# Calculations
t = (x**2/(2*a)); #Length of one time increment in h
t1 = (9*t); #Elapsed time in h
# Results
print 'Elasped time before the centre of the wall attains a temperature of 150 degree C is %3.0f h'%(t1)
```

In [25]:

```
# Variables
k = 0.175; #Thermal conductivity in W/m.K
a = (0.833*10**-7); #Thermal diffusivity in m**2/h
Th = 144; #Heated temeparture in degree C
Tc = 15; #Cooled temperature in degree C
x = 0.02; #Thickness of the plate in m
h = 65; #Heat transfer coefficient in W/m**2.K
t = (4*60); #Tiem elapsed in s
# Calculations
s = 0.002; #Space increment in m from FIg. Ex. 5.20 on page no. 207
t1 = (s**2/(2*a)); #Time increment for the space increment in s
x1 = (k/h); #Convective film thickness in mm
Tn = 114; #Temperature at the centre in degree C from Fig. Ex.5.20 on page no. 207
Ts = 50; #Surface temperature in degree C from Fig. Ex.5.20 on page no. 207
# Results
print 'Temperature at the centre is %i degree C \n \
Surface temperature is %i degree C'%(Tn,Ts)
```

In [27]:

```
import math
# Variables
t = 24; #Time period in h
T = [-10,10]; #Range of temperatures in degree C
x = 0.1; #Depth in m
c = 1970; #Specific heat in J/kg/K
p = 1000; #Density in kg/m**3
k = 0.349; #Thermal conductivity in W/m.K
ta = 5; #Time in h
# Calculations
w = (2*3.14)/t; #Angular velocity in rad/h
Tm = (T[0]+T[1])/2; #Mean teperature in degree C
Tmax = T[1]-Tm; #Maximum temperature in degree C
a = ((k*3600)/(p*c)); #Thermal diffusivity in m**2/h
Txmax = Tmax*exp(-math.sqrt(w/(2*a))*x); #Amplitude of temperature variation in degree C
t1 = math.sqrt(1./(2*a*w))*x; #Time lag of temperature wave at a depth of 0.1 m in h
t2 = (3.14/w); #Time for surface temperature is minimum in h
t3 = t2+ta; #Time in h
Tx = Tmax*exp(-math.sqrt(w/(2*a))*x)*math.cos((w*t3)-(x*x*math.sqrt(w/(2*a)))); #Temperature at 0.1m 5 hours after the surface temperature reaches the minimum in degree C
# Results
print 'Amplitude of temperature variation at a depth of 0.1m is %3.2f degree C \n \
Time lag of temperature wave at a depth of 0.1 m is %3.2f h \n \
Temperature at 0.1m 5 hours after the surface temperature reaches the minimum is %3.3f degree C'%(Txmax,t1,Tx)
```

In [12]:

```
import math
# Variables
T = [800.,200.]; #Limits in which temperature varies in degree C
t = 12.; #Cycle time in h
x = 0.1; #Depth of penetration in m
k = 1.8; #Thermal conductivity in W/m.K
a = 0.02; #Thermal diffusivity in m**2/h
# Calculations
w = (2*3.14)/t; #Angular velocity in rad/h
t1 = math.sqrt(1./(2*a*w))*x; #Time lag in h
Tmax = (T[0]-T[1])/2; #Range of maximum temperature in degree C
q = ((2*k*Tmax)/math.sqrt(math.pi/6*a))*(3600./1000); #Heat flow through the surface in kJ/m**2
# Results
print 'i)Time lag of the temperature wave at a depth of 10 cm from the inner surface is %3.2f h \n \
ii)The flow through a surface located at a distance of 10 cm from the surface during the first\
six hours interval while the temperature is above the mean value is %i kJ/m**2'%(t1,q)
```

In [29]:

```
# Variables
N = 2000; #Speed of the engine
a = 0.06; #Thermal diffusivity in m**2/h
# Calculations
t = 1./(60*N); #Period of on oscillation in h
x = (1.6*math.sqrt(3.14*a*t))*1000; #Depth of penetration in mm
# Results
print 'Depth of penetration of the temperature oscillation into the cylinder wall of a \
single acting cylinder two stroke IC engine is%3.0f mm'%(x)
```

In [30]:

```
import math
# Variables
Tc = 55; #Tempaerature of concrete hyway in degree C
Tl = 35; #Temperature lowered in degree C
Tf = 45; #Final temperature in degree C
x = 0.05; #Depth in m
k = 1.279; #Thermal conductivity in W/m.K
a = (1.77*10**-3); #Thermal diffusivity in m**2/h
# Calculations
t = 1.4; #Time taken from page no. 219 in h
q = 2*(k*(Tl-Tf))/(math.sqrt(3*a*t)); #Instantaneous heat removal rate in W/m**2
# Results
print 'Instantaneous heat removal rate is %3.1f W/m**2'%(q)
```