In [1]:

```
import math
print"Introduction to heat transfer by S.K.Som, Chapter 8, Example 1"
#Water is heated by a vertical flat plate length(L=200mm or .2m )by breadth(B=200mm) which is maintained at temprature,Tw=60Â°C
Tw=60;
L=.2;
B=.2;# in metre
#Area(A) is L*B
A=L*B;
#Water is at temprature,Tinf=20Â°C
Tinf=20;
#At mean film temprature 40Â°C The physical properties parameters can be taken as
#conductivity(k=0.0628W/(m*K)),Prandtl number(Pr=4.34),density(rho=994.59kg/m**3),kinematic viscosity(nu=0.658*10**-6m**2/s),volume expnasion coefficient(Beta=3*10**-4K**-1))
k=0.628;
Pr=4.34;
rho=994.59;
nu=0.658*10**-6;
Beta=3*10**-4;
#g is acceleration due to gravity =9.81m/s**2
g=9.81;
#Grashoff number is given by GrL=(g*beta*(Tw-Tinf)*L**3)/(nu)**2
print"Grashoff number is"
GrL=(g*Beta*(Tw-Tinf)*L**3)/(nu)**2
print"GrL=",GrL
#Rayleigh number is defined as RaL=GrL*Pr
print"Rayleigh number is"
RaL=GrL*Pr
print"RaL=",RaL
print"Therefore the flow is turbulent"
print"Now we use [(hbarL*L)/k]=0.10*(GrL*Pr)**(1/3)"
#hbarL is the average heat transfer coefficient
print"The average heat transfer coefficient in W/(m**2*K) is"
hbarL=(0.10*(GrL*Pr)**(1/3)*k)/L
print"hbarL=",hbarL
#The rate of heat transfer is given by q=hbarL*A*(Tw-Tinf)
print"The rate of heat transfer in W is"
q=hbarL*A*(Tw-Tinf)
print"q=",q
```

In [2]:

```
import math
print"Introduction to heat transfer by S.K.Som, Chapter 8, Example 2"
#The thin plates are kept at temprature(Tw)=60Â°C while the temprature of water bath(Tinf)=20Â°C
Tw=60;
Tinf=20;
#The plates have length(L)=90mm or .09m
L=.09;
#The minimum spacing between the plates will be twice the thickness of the boundary layer at the trailing edge where x=0.09.
print"The minimum spacing between the plates will be twice the thickness of the boundary layer at the trailing edge where x=0.09"
x=.09;
#At mean film temprature 40Â°C The physical properties parameters can be taken as
# conducivity(k=0.0628W/(m*K)),Prandtl number(Pr=4.34),Density(rho=994.59kg/m**3),kinematic viscosity(nu=0.658*10**-6m**2/s),Volume expansion coefficient(Beta=3*10**-4K**-1)
k=0.628;
Pr=4.34;
rho=994.59;
nu=0.658*10**-6;
Beta=3*10**-4;
#g is acceleration due to gravity =9.81m/s**2
g=9.81;
#Grashoff number is given by GrL=(g*beta*(Tw-Tinf)*L**3)/(nu)**2
print"Grashoff number is"
GrL=(g*Beta*(Tw-Tinf)*L**3)/(nu)**2
print"GrL=",GrL
#Rayleigh number is defined as RaL=GrL*Pr
print"Rayleigh number is"
RaL=GrL*Pr
print"RaL=",RaL
print"Since Ra<10**9,Therefore the flow is laminar"
#delta is the thickness of the boundary layer
print"The thickness of the boundary layer in metre is"
delta=x*3.93*Pr**(-1/2)*(0.952+Pr)**(1/4)*GrL**(-1/4)
print"delta=",delta
#spac is the minimum spacing
print"The minimum spacing in metre is"
spac=2*delta
print"spac=",spac
```

In [3]:

```
from scipy.integrate import quad
print "Introduction to heat transfer by S.K.Som, Chapter 8, Example 3"
#Considering question 5.7
#A wall is exposed to nitrogen at one atmospheric pressure and temprature,Tinf=4Â°C.
Tinf=4.0;
#The wall is H=2.0m high and 2.5m wide and is maintained at temprature,Tw=56Â°C
Tw=56.0;
H=2.0;
B=2.5;
A=H*B;#Area of wall in m**2
#The properties of nitrogen at mean film temprature (56+4)/2=30Â°C are given as
#density(rho=1.142kg/m*3) ,conductivity(k=0.026W/(m*K)),kinematic viscosity(nu=15.630*10-6 m*2/s) ,prandtl number(Pr=0.713)
rho=1.142;
k=0.026;
nu=15.630*10**-6;
Pr=0.713;
Tf=30.0;#mean film temprature
Beta=1/(273.0+Tf);#volume expansion coefficient:unit K**-1
#Now Grashoff number is Grx=(g*Beta*(Tw-Tinf)*x*3)/nu*2
g=9.81;#acceleration due to gravity
print "Grashoff number is"
x=0.8;#distance from the bottom of wall
Grx=(g*Beta*(Tw-Tinf)*x*3)/nu*2
print"Grx=",Grx
#Using equation delta=x*Pr*(-0.5)(0.952+Pr)*(0.25)*Grx*(-0.25)
#delta is the boundary layer thickness
print "The boundary layer thickness in metre is"
delta=x*3.93*Pr*(-0.5)*(0.952+Pr)*(0.25)*Grx*(-0.25)
print"delta=",delta
#Now using equation ux=(g*Beta*delta*2(Tw-Tinf))/(4*nu)
#ux is the velocity at point x
print "The velocity at point x is ux in m/s is"
ux=(g*Beta*delta*2*(Tw-Tinf))/(4*nu)
print"ux=",ux
# (u/ux)=(y/delta)*(1-y/delta)**2
#Putting value of ux we get velovity function,u=465.9*(y-116*y*2+3341*y*3)
#For maximum value of u,du/dy=465.9*(1-232*y+10023*y**2)=0...this is a quadratic equation in which coefficients a=10023,b=232,c=1
a=10023;
b=232;
c=1;
#Solution for quadratic equation is given by y=(-b+-(b*2-4ac)*0.5)/2*a
print "For maximum value of velocity,u"
y=(b+(b*2-4*a*c)*0.5)/(2*a)#root of the quadratic equation
y=(b-(b*2-4*a*c)*0.5)/(2*a)#root of the quadratic equation
#The value of 0.0173 is at the edge of boundary layer,where u=0
#Therefore the maximum value occurs at y=0.00573m i.e Umax=465.9*y*(1-57.8*y)**2
y=0.00573;
#Umax is maximum velocity
print "Maximum velocity in m/s is"
Umax=465.9*y*(1-57.8*y)*2#NOTE:The answer given in the book is incorrect,in this expresssion they considered square on y only,however it is on whole expression (1-57.8*y)*2
#mdot is mass flow rate
print"Umax=",Umax
print "Mass flow rate at x=0.8m,in kG is"
I=quad(lambda y:465.9*(y-116*y*2+3341*y*3),0,delta)
mdot=rho*B*I[0]
print"mdot=",mdot
```

In [11]:

```
import math
print"Introduction to heat transfer by S.K.Som, Chapter 8, Example 4"
#A square plate length,L=0.2m by breadth,B=0.2m is suspended vertically in a quiescent atmospheric air at a temprature(Tinf)=300K
L=0.2;
B=0.2;
Tinf=300;
#The Temprature of plate(Tw) is maintained at 400K
Tw=400;
#The required property value of air at a film temprature(Tf)=350K,kinematic viscosity (nu=20.75*10**-6),Prandtl number(Pr=0.69),conductivity(k=0.03W/(m*K))
Tf=350;
nu=20.75*10**-6;
Pr=0.69;
k=0.03;
#volume expansion coefficient is Beta
Beta=(1/Tf);
#g is acceleration due to gravity =9.81m/s**2
g=9.81;
#Grashoff number is given by GrL=(g*beta*(Tw-Tinf)*L**3)/(nu)**2
print"Grashoff number is"
GrL=(g*Beta*(Tw-Tinf)*L**3)/(nu)**2
print"GrL=",GrL
#Rayleigh number is defined as RaL=GrL*Pr
print"Rayleigh number is"
RaL=GrL*Pr
print"Hence,the flow is laminar"
print"RaL=",RaL
#delta is the thickness of the boundary layer
print"The thickness of the boundary layer in metre is"
x=0.2;#location of trailing edge of plate
delta=(x*3.93*(0.952+Pr)**(1/4))/(Pr**(1/2)*(GrL)**(1/4))#NOTE:The answer in the book is incorrect(calculation mistake)
print"delta=",delta
#hL and hbarL are local and average heat transfer coefficient respectively
print"The average heat transfer coeficient in W/(m**2*K) is"
hL=(2*k)/delta;
hbarL=(4.0/3)*(hL)#NOTE:The answer in the book is incorrect(calculation mistake)
print"hL=",hL
print"hbarL=",hbarL
```

In [4]:

```
import math
print"Introduction to heat transfer by S.K.Som, Chapter 8, Example 5"
#A square plate of length(L)=0.5m by breadth,B=0.5m in a room at temprature,Tinf=30Â°C
#One side of plate is kept a uniform temprature(Tw)=74Â°C
Tw=74;
L=0.5;
B=0.5;
Tinf=30.0;
#The required properties at the film temprature(Tf)=52Â°C are kinematic viscosity(nu=1.815*10**-5),Prandtl number(Pr=0.71),conductivity(k=0.028W/(m*Â°C))
Tf=52.0;
Pr=0.71;
nu=1.815*10**-5;
k=0.028;
#Area(A)=L*B m**2
A=L*B;
#Volume expansion coefficient is Beta
Beta=1/(273+Tf);
#g is acceleration due to gravity =9.81m/s**2
g=9.81;
#Grashoff number is given by GrL=(g*beta*(Tw-Tinf)*L**3)/(nu)**2
print"Grashoff number is"
GrL=(g*Beta*(Tw-Tinf)*L**3)/(nu)**2
print GrL
#Rayleigh number is defined as RaL1=GrL*Pr
print"Rayleigh number is"
RaL1=GrL*Pr
print RaL1
print"Therefore the flow is laminar"
#We make use of following equation to find Nusselt number,NuL1=(4/3)*(0.508*Pr**(-1/2)*(0.952+Pr)**(-1/4)*Gr**(1/4))
print"Nusselt number is"
NuL1=(4.0/3)*(0.508*Pr**(1.0/2)*(0.952+Pr)**(-1.0/4)*GrL**(1.0/4))
#Average heat transfer coefficient(hbarL) is given by (NuL*k)/L
print NuL1
print"Average heat transfer coefficient(hbarL)in W/(m**2*Â°C)"
hbarL=(NuL1*k)/L
#The rate of heat transfer(Q) from the plate by free convection is given by Q=hbarL*A*(Tw-Tinf)
print"The rate of heat transfer in W is "
Q=hbarL*A*(Tw-Tinf)
print"Now if we use NuL2=0.59*RaL**(1/4) with the value of C=0.59,n=(1/4)"
print"Nusselt number is"
NuL2=0.59*RaL1**(1.0/4)
#Average heat transfer coefficient(hbarL) is given by (NuL*k)/L
print"Average heat transfer coefficient(hbarL)in W/(m**2*Â°C)"
hbarL=(NuL2*k)/L
#The rate of heat transfer(Q) from the plate by free convection is given by Q=hbarL*A*(Tw-Tinf)
print"The rate of heat transfer in W is "
Q=hbarL*A*(Tw-Tinf)
print Q
print"(b)For the horizontal plate facing up"
#Perimeter(P) for a square plate is P=4*L
P=4*L;
#Characterstic length(Lc)=A/P
Lc=A/P
print"Now RaL2=Gr*Pr*(Lc/L)**3"
print"Rayleigh number is"
RaL2=GrL*Pr*(Lc/L)**3
#The values of constants,C=0.54 and n=(1/4)
C=0.54;
n=(1.0/4);
print"Nusselt number is given by NuL3=C*(GrL*Pr)**n"
NuL3=C*(RaL2)**n
print"Average heat transfer coefficient(hbarL)in W/(m**2*Â°C)"
hbarL=(NuL3*k)/Lc
print"The rate of heat transfer in W is "
Q=hbarL*A*(Tw-Tinf)
print Q
print"(c)When the hot surface faces is down"
print"Nusselt number is given by NuL4=0.27*RaL2**(1/4)"
NuL4=0.27*RaL2**(1.0/4)
print NuL4
print"Average heat transfer coefficient(hbarL) in W/(m**2)"
hbarL=(NuL4*k)/Lc
print hbarL
print"The rate of heat transfer in W is "
Q=hbarL*A*(Tw-Tinf)
print Q
```

In [5]:

```
import math
print"Introduction to heat transfer by S.K.Som, Chapter 8, Example 6"
#A vertical wire of length(L)=0.5m and Dimeter(D)=0.1mm is maintained at temprature, Tw=400K
#The temprature of quicsent air is Tinf=300K
#Resistance(R) per meter length is 0.12ohm
R=0.12;
Tw=400.0;
L=0.5;
D=0.1*10**-3;#in metre
Tinf=300;
#The required properties at the film temprature(Tf)=350K are kinematic viscosity(nu=20.75*10**-6m**2/s),Prandtl number(Pr=0.70),conductivity(k=0.03W/(m*Â°C))
Tf=350.0;
Pr=0.70;
nu=20.75*10**-6;
k=0.03;
#Area(A)=L*B m**2
A=math.pi*D*L;
#Volume expansion Coefficient is Beta
Beta=1/(Tf);
#g is acceleration due to gravity =9.81m/s**2
g=9.81;
#Grashoff number is given by GrL=(g*beta*(Tw-Tinf)*L**3)/(nu)**2
print"Grashoff number is"
GrL=(g*Beta*(Tw-Tinf)*L**3)/(nu)**2
print"GrL=",GrL
#Rayleigh number is defined as RaL=GrL*Pr
print"Rayleigh number is"
RaL=GrL*Pr
print"RaL=",RaL
print"Therefore the flow is laminar"
#NuL is nusselt number
#C and n are constants
print"Now we use NuL=0.59*RaL**(1/4.0) with the value of constants C=0.59,n=(1/4.0)"
print"Nusselt number is"
NuL=0.59*RaL**(1/4.0)
print"NuL=",NuL
#hbarL1 is the Average heat transfer coefficient
print"Average heat transfer coefficient in W/(m**2*K)"
hbarL1=(NuL*k)/L
print"hbarL1=",hbarL1
#Grashoff number GrD=GrL*(D/L)**3
print"Grashoff number GrD=GrL*(D/L)**3"
GrD=GrL*(D/L)**3
print"GrD=",GrD
#The correction factor is given By F=1.3*((L/D)/GrD)**(1/4.0)+1.0
print"The correction factor is"
F=1.3*((L/D)/GrD)**(1/4.0)+1.0
print"F=",F
print"The correct value of Average heat transfer coefficient(hbarL2)=hbarL1*F in W/(m**2*K) is"
hbarL2=hbarL1*F
print"hbarL2=",hbarL2
#The ohmic power loss is given by energy balance I**2*R=q=hbar2*A*(Tw-Tinf)
#q is the ohmic power loss
print"The ohmic loss in W is "
q=hbarL2*A*(Tw-Tinf)
print"q=",q
#The current flowing in the wire I=(q/(R*L)**(1/2.0)
print"The current flowing in the wire in Ampere is"
I=(q/(R*L))**(1/2.0)
print"I=",I
```

In [6]:

```
import math
print"Introduction to heat transfer by S.K.Som, Chapter 8, Example 7"
#A long horizontal pressurized hot water of diameter(D)=200mm passes through a room where the air temprature is Tinf=25Â°C
D=.2;
Tinf=25;
#Length(L)=1m ,since the unit length is considered
L=1;
#Area(A)=pi*L*D
A=math.pi*L*D;
#The pipe surface temprature is Tw=130Â°C
Tw=130;
#The properties of air at the film temprature Tf=77.5Â°C are kinematic viscosity(nu=21*10**-6m**2/s),Prandtl number(Pr=0.70),Conductivity(k=0.03W/(m*K))
Tf=77.5;
nu=21*10**-6;
k=0.03;
Beta=(1/(273+Tf));#Volume expansion coefficient in k**-1)
Pr=0.70;
#g is acceleration due to gravity =9.81m/s**2
g=9.81;
#Grashoff number is given by GrD=(g*beta*(Tw-Tinf)*L**3)/(nu)**2
print"Grashoff number is"
GrD=(g*Beta*(Tw-Tinf)*D**3)/(nu)**2
print"GrD=",GrD
#Rayleigh number is defined as RaD=GrD*Pr
print"Rayleigh number is"
RaD=GrD*Pr
print"RaD=",RaD
print"The flow is laminar over the entire cylinder"
#NuD is the nusselt number
print"we use following equation to find Nusselt number NuD=(0.60+((0.387*RaD**(1/6))/(1+(0.559/Pr**(9/16)))**(8/27)))**2"
NuD=(0.60+((0.387*RaD**(1/6))/(1+(0.559/Pr**(9/16)))**(8/27)))**2
print"NuD=",NuD
#hbar is the avearge heat transfer coefficient
print"Average heat transfer coefficient in W/(m**2*K)"
hbar=(NuD*k)/D
print"hbar=",hbar
#The heat loss per meter length is given by q=hbar*A*(Tw-Tinf)
print"The heat loss per meter length in W is"
q=hbar*A*(Tw-Tinf)
print"q=",q
```

In [7]:

```
import math
print"Introduction to heat transfer by S.K.Som, Chapter 8, Example 8"
#An electric immersion heater diameter(D)=8mm and length(L)=300mm is rated at power input,P=450W
P=450;
L=0.3;#in metre
D=0.008;#in metre
#If the heater is horizontally positioned in a large tank of stationery water at temprature,Tinf=20Â°C
Tinf=20;
#At steady state ,The electrical power input(P)=(Q)Heat loss from the heater
#P=Q
#Q=hbarD*(pi*D)*L*(Tw-Tinf)
#This gives Tw(surface temprature)=Tinf+(P/(hbarD*pi*D*L))
#So we need to find Average heat transfer coefficient,hbarD.
#In this problem we need to take guess of steady state surface temprature(Tw) and iterate the solution for Tw till a desired convergence is achieved.
print"Let us take first trial Tw=64Â°C"
Tw=64;
Tf=(Tw+Tinf)/2;#mean film temprature
#At this temprature of 42Â°C,The required properties of water kinematic viscosity(nu=6.25*10**-7m**2/s),Prandtl number(Pr=4.16),Conductivity(k=0.634W/(m*K)),Beta=4*10**-4K**-1
Beta=4*10**-4;#Volume expansion coefficient
nu=6.25*10**-7;
Pr=4.16;
k=0.634;
#g is acceleration due to gravity =9.81m/s**2
g=9.81;
#Grashoff number is given by GrD=(g*beta*(Tw-Tinf)*L**3)/(nu)**2
print"Grashoff number is"
GrD=(g*Beta*(Tw-Tinf)*D**3)/(nu)**2
print"GrD=",GrD
#Rayleigh number is defined as RaD=GrD*Pr
print"Rayleigh number is"
RaD=GrD*Pr
print"The flow is laminar "
print"RaD=",RaD
#/NuD is nusselt number
#hbarD is Average heat transfer coefficient
print"we use following equation to find Nusselt number NuD=(0.60+((0.387*RaD**(1/6))/(1+(0.559/Pr**(9/16)))**(8/27)))**2"
NuD=(0.60+((0.387*RaD**(1/6))/(1+(0.559/Pr**(9/16)))**(8/27)))**2
print"NuD=",NuD
print"Average heat transfer coefficient in W/(m**2*K)"
hbarD=(NuD*k)/D
print"hbarD=",hbarD
print"Hence,steady state Surface temprature in Â°C is"
Tw=Tinf+(P/(hbarD*math.pi*D*L))
print"Hence we see that our guess is in excellent agreement with the calculated value"
print"Tw=",Tw
```