In [1]:

```
import math
from scipy.integrate import quad
print"Introduction to heat transfer by S.K.Som, Chapter 5, Example 3"
#Air at temprature (T1=20Â°C) and 1 atmospheric pressure flows over a flat plate with a free stream velocity(Uinf) of 1m/s.
Uinf=1;
T1=20;
#The length of plate is 1m and is heated over its entire length to a constant temprature of T2=100Â°C.
T2=100;
#For air at 20Â°C(The mean temprature of 100Â°C and 20Â°C),viscosity(mu=1.9*10**-5kg/(m*s)),density(rho=1.05kg/m**3),conductivity(k=0.03W/(m*K)),specific heat(cp=1.007kJ/(kg*K))
#Prandtl number is Pr=0.7
mu=1.9*10**-5;
rho=1.05;
k=0.03;
cp=1.007;
Pr=0.7;
#For laminar flow over a plate Nusselt number is Nux=0.332*Rex**0.5*Pr**(1/3)
#The boundary layer flow over a flat plate will be laminar if Reynolds number is Rex=(rho*Uinf*x)/mu<5*10**5
#First of all we have to check whether the flow is laminar or not.
#Let us check at x=1m
x=1.0;
print"Reynolds number is"
ReL=(rho*Uinf*x)/mu
print"ReL=",ReL
#There fore the flow is laminar and we can use the relationships of Nux,
#Thus Rex=(1.05*1*x)/(1.9*10**-5)=0.5526*10**5*x
#Therefore we can write Nux=(hx*x/k)=0.332*(0.5526*10**5*x)**0.5*Pr**(1/3)....or hx=2.08*x**(-1/2) W/(m**2*Â°C)
#hbarL is the average heat transfer coefficient over a length(L)
print"The average heat transfer coefficient over a length(L)= 1m ,in W/m**2 is"
L=1;
hbarL=(1.0/L)*quad(lambda x:2.08*x**(-1/2.0),0,L)[0]
print"hbarL=",hbarL
#Q is the rate of heat transfer
print"The rate of heat transfer in W/m of width is"
Q=hbarL*L*(T2-T1)
print"Q=",Q
```

In [27]:

```
import math
print"Introduction to heat transfer by S.K.Som, Chapter 5, Example 4"
#Air at atmospheric pressure is required to flow over a circuit board to cool the electronics element mounted on it.
#Chip has length (L)=3mm and width(B)=3mm located x=0.1m from the leading edge
L=0.003;#in metre
B=0.003;#in metre
x=0.1;
#The Nusselt no. is given by Nux=0.06*Rex**0.85*Pr**0.33
#The chip has to dissipate E=50mW of energy while its surface temprature has to be kept below temprature,Ts=45Â°C and free strem Temptrature of air is Tinf=25Â°C
Ts=45;
Tinf=25;
E=50*10**-3;#in watt
#For air ,density(rho=1.2kg/m**3),viscosity(mu=1.8*10**5kg/(m*s)),conductivity(k=0.03W/(m*K)) and specific heat(cp=1000J/(kg*K))
rho=1.2;
mu=1.8*10**5;
k=0.03;
cp=1000;
#Let the minimum flow velocity be U.
#The local heat transfer coefficient hx where the chip is mounted is determined as hx=(k/x)*0.06*(rho*U*x/mu)**0.85*(mu*cp/k)**0.33
print"The local heat transfer coefficient hx is hx=27.063*U**0.85"
#from an enrgy balance we can write as E=27.063*U**0.85*L*B*(Ts-Tinf)
print"The minimum flow velocity in m/s is"
U=(E/(27.063*L*B*(Ts-Tinf)))**(1/0.85)
print"U=",U
```

In [1]:

```
import math
print"Introduction to heat transfer by S.K.Som, Chapter 5, Example 6"
#Air at 1atm pressure and temprature(Tin)=30Â°C enters a tube of 25mm diameter(D) with a velocity(U) of 10m/s
D=0.025;#in metre
U=10;
Tin=30;
#Tube is heated so that a constant heat flux(q) of 2kW/m**2 is maintained at the wall whose temprature is deltaT=20Â°C above the bulk mean air temprature through the length of tube
#Let Tw-Tb=T
q=2000;
deltaT=20;
#The length(L)= 2m
L=2;
#For air density(rho=1.2kg/m**3),specific heat(cp=1000J/(kg*K))
rho=1.2;
cp=1000;
#From an energy balance of a control volume of air we get mdot*cp*(Tb+(dTb/dx)*deltax-Tb)=q*pi*D*deltax or (dTb/dx)=(q*pi*D)/(mdot*cp)
#mass flow rate=mdot
mdot=rho*math.pi*D**2*U;
print"mdot=",mdot
#let (dTb/dx)=Y
print"(dTb/dx)in Â°C/m is"
Y=(4*q*math.pi*D)/(mdot*cp)
print"Y=",Y
#Tb2 is Exit bulk mean temprature
print"Therefore Exit bulk mean temprature Tb2 in Â°C is"
Tb2=Tin+Y*2
print"Tb2=",Tb2
#Again we can write at any section of the tube hx*(Tw-Tb)=q or hx=q/(Tw-Tb)
#hx is heat flux
print"Heat flux(hx) in W/(m**2*Â°C) is "
hx=q/(deltaT)
print"hx=",hx
#Since Tw-Tb remains the same,The heat transfer coefficient at all sections are the same
#Now Overall Nusselt number,NuL=hx*D/k
#The thermal conductivity of air at mean temprature of (30+83.4)/2=56.7Â°C is k=0.0285 W/(m*K)
k=0.0285;
print"Overall Nusselt number is "
NuL=hx*D/k
print"NuL=",NuL
```

In [3]:

```
import math
print"Introduction to heat transfer by S.K.Som, Chapter 5, Example 7"
#A wall is exposed to nitrogen at one atmospheric pressure and temprature,Tinf=4Â°C.
Tinf=4;
#The wall is H=2.0m high and B=2.5m wide and is maintained at temprature,Ts=56Â°C
Ts=56;
H=2;
B=2.5;
A=H*B;#area is(A)
#The average nusselt number NuHbar over the height of the plate is given by NuHbar=0.13*(Gr*Pr)**(1/3)
#The properties of nitrogen at mean film temprature(Tf) is (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;
#We first have to detrmine the value of Grashoff number,Gr.In consideration of nitrogen as an ideal gas,we can write
#Beta(The volumetric coefficient of expansion)=1/T
print"Beta(The volumetric coefficient of expansion in K**-1 is"
Beta=1/(273+Tf)
print"Beta=",Beta
#Now Gr=(g*Beta*(Ts-Tinf)*H**3)/nu**2
g=9.81;#acceleration due to gravity
print"Grashoff number is"
Gr=(g*Beta*(Ts-Tinf)*H**3)/nu**2
print"Gr=",Gr
print"The average nusselt number is"
NuHbar=0.13*(Gr*Pr)**(1/3)
print"NuHbar=",NuHbar
#hbar is the heat flux
print"Heat flux hbar in W/(m**2*Â°C)"
hbar=NuHbar*k/H
print"hbar=",hbar
#Q is the heat loss from the plate
print"The heat loss from the plate in W is"
Q=hbar*A*(Ts-Tinf)
print"Q=",Q
```

In [1]:

```
import math
print"Introduction to heat transfer by S.K.Som, Chapter 5, Example 8"
#Eletric current passes through a L=0.5m long horizontal wire of D=0.1mm diameter.
L=0.5;
D=0.1*10**-3;
#The wire is to be maintained at temprature,Twire=400K and the air is at temprature,Tair=300K.
Twire=400;
Tair=300;
#The resistance of the wire(R) is 0.012ohm per meter.Nusselt number(NuL) over the length of wire to be 0.4.
NuL=0.4;
R=0.012;
#At mean temprature of Tf=350K, The thermal conductivity of air is k=0.03W/(m*K)
k=0.03;
#Nusselt number is NuL=hbar*D/k
#hbar is the heat flux
print"The heat flux in W/(m**2*K) is"
hbar=NuL*k/D
print"hbar",hbar
#Q is the heat loss from the wire
print"The heat loss from the wire is Q=hbar*pi*D*L*(Twire-Tair) in Watt"
Q=hbar*math.pi*D*L*(Twire-Tair)
print"Q=",Q
#At steady state the ohmic loss in the wire equals the heat loss from its surface Therfore I**2*R=Q
#I is the current flow.
print"The current in Ampere is"
I=(Q/(R*L))**0.5
print"I=",I
```