In [1]:

```
# Variables
di = 0.06 #m,initial diameter of iceball
T1 = 30. #C, room temp.
T2 = 0. #ice ball temp.
h = 11.4 #W/m**2 C, heat transfer coefficient
x = 40. #% for reduction
rho = 929. #kg/m**3, density of ice
Lv = 3.35*10**5 #j/kg, latent heat of fusion
# Calculations
# m = 4/3*math.pi*r**3 #kg,mass of ice ball
#rate of melting = -dm/dt
#rate of heat adsorption = -4*math.pi*r**2*rho*dr/dt*lamda
#at initial time t = 0
C1 = di/2 #consmath.tant of integration
#if the volume of the ball is reduced by 40% of the original volume
r = ((1-x/100)*(di/2)**3)**(1./3)
#time required for melting umath.sing eq. 1
t = (di/2-r)/(h*(T1-T2)/(rho*Lv))
# Results
print "The time required for melting the ice is %.0f s"%(t)
# note : rounding off error.
```

In [1]:

```
import math
from scipy.integrate import quad
#calculate the time required for the heating coil.
# Variables
P = 1.*10**3 #W, electrical heating capacity
V = 220. #V, applied voltage
d = 0.574*10**-3 #m, diameter of wire
R = 4.167 #ohm, electrical resistance
Tr = 21. #C, room temp.
h = 100. #W/m**2 C, heat transfer coefficient
rho = 8920. #kg/m**3, density of wire
cp = 384. #j/kg C, specific heat of wire
percent = 63. #%, percent of the steady state
#Calculation
R_ = V**2/P #ohm, total electrical resistance
l = R_/R #m, length of wire
A = math.pi*d*l #m**2, area of wire
Tf = P/(h*A)+Tr #final temp.
dtf = Tf-Tr #C. steady state temp. rise
#temp. of wire after 63% rise
T = Tr+(percent/100)*dtf
#rate of heat accumulation on the wire
#d/dt(m*cp*T) (1)
#rate of heat loss
#h*A*(T-Tr).........................(2)
#heat balance eq. (1) = (2)
m = math.pi*d**2*l*rho/4 #kg. mass of wire
#integrating heat balance eq.
def f6(T):
return 1/((P/(m*cp))-((h*A)/(m*cp))*(T-Tr))
t = quad(f6,21,322)[0]
# Results
print "The time required for the heating coil is %.1f s"%(t)
```

In [8]:

```
# Variables
t = 0.2 #m, thickness of wall
k = 1.163 #W/m C, thermal conductivity of material
Ta = 30 #C, ambient temp
# Calculations and Results
#(a) at x = 0.2 let T = T1 at x = x1
x1 = 0.2
T1 = 250-2750*x1**2
#let D = dT/dx
D = -5500*0.2 #C/m, at x = 0.2
h = -k*D/(T1-Ta)
print " the heat transfer coefficient is %.2f W/m**2 C "%(h)
#(b)at other surface of wall, x = 0 = x2 (say)
x2 = 0
a = -5500*0
print "So there is no heat flow at other surface of the wall "
#(c)
A = 1 #m**2, area
Vw = A*x1 #m**3, volume of wall
HL = h*(T1-Ta) #W, heat loss from unit area
Vav = HL/x1
print "average volumetric rate of heat generation is %.0f W/m**3"%(Vav)
```

In [7]:

```
from scipy.optimize import fsolve
import math
# Variables
id_ = 97.*10**-3 #m,internal diameter of steam pipe
od = 114.*10**-3 #m,outer diameter of steam pipe
pr = 30. #bar, absolute pressure os saturated steam
Ti = 234. #C, temp. at 30 bar absolute pressure
Ts = 55. #C, skin temp.
To = 30. #C, ambient temp.
kc = 0.1 #W/m C, thermal conductivity of wool
kw = 43. #W/m C, thermal conductivity of pipe
h = 8. #W/m**2 C, external air film coefficient
L = 1. #m, assume length
#Calculation
ri = id_/2 #m,
r1 = (114.*10**-3)/2 #m,outer radius of steam pipe
#thermal resistance of insulation
#Ri = math.log(ro/r1)/(2*math.pi*L*kc)
#Thermal resistance of pipe wall
Rp = math.log(r1/ri)/(2*math.pi*L*kw)
#RT = Ri+Rp
DF = Ti-Ts #C, driving force
#At steady state the rate of heat flow through the insulation
# and the outer air film are equ
#by trial and error method :
def f(ro):
return (Ti-Ts)/(math.log(ro/r1)/kc+math.log(r1/ri)/kw)-(h*ro*(Ts-To))
ro = fsolve(f,0.1)
th = ro-r1 #m, required thickness of insulation
Q = 2*math.pi*ro*h*L*(Ts-To)
# Results
print "The rate of heat loss is %.1f W"%(Q)
```

In [11]:

```
import math
# Variables
w1 = 8. #%, solubility of alcohol
w2 = 92. #%, solubility of water
k1 = 0.155 #W/m C, thermal conductivity of alcohol
k2 = 0.67 #W/m C thermal conductivity of water
ka = 0.0263 #W/m C thermal conductivity of air
kw = 45. #W/m Cthermal conductivity of pipe wall
ki = 0.068 #W/m C , thermal cond. of glass
id_ = 53.*10**-3 #m, internal diameter of pipe
od = 60.*10**-3 #m, outer diameter of pipe
t = 0.04 #m, thickness of insulation
hi = 800. #W/m**2 C, liquid film coefficient
ho = 10. #W/m**2 C, air film coefficient
L = 1. #m, length of pipe
T1 = 75. #C, initial temp.
T2 = 28. #C, ambient air temp.
# Calculations and Results
#(a)
km = (w1/100)*k1+(w2/100)*k2-0.72*(w1/100)*(w2/100)*(-(k1-k2))
deli = km/hi #m, effective thickness of liquid film
delo = ka/ho #m, effective thickness of air film
print "effective thickness of air is %.2f mm"%(deli*10**3)
print "effective thickness of liquid films is %.1f mm."%(delo*10**3)
#(b)
Ai = 2*math.pi*id_/2*L #m**2, inside area
ri = id_/2 #m,inside radius of pipe
r_ = od/2 #m, outside radius of pipe
ro = r_+t #m, outer radius of insulation
Ao = 2*math.pi*ro*L #m**2, outer area
#from eq. 3.11, overall heat transfer coefficient
Ui = 1/(1/hi+(Ai*math.log(r_/ri))/(2*math.pi*L*kw)+(Ai*math.log(ro/r_))/(2*math.pi*L*ki)+Ai/(Ao*ho))
print "the overall heat transfer coefficient based on i.d of pipe is %.3f W/m**2 C"%(Ui)
#(c)
#frim eq. 3.14
Uo = Ui*Ai/Ao
print "the overall heat transfer coefficient based on od of pipe is %.3f W/m**2 C"%(Uo)
#(d)
R = 1/(Ui*Ai) #C/W, total heat transfer resistance
Rair = 1/(Ao*ho) #C/W, heat transfer resistance of air film
p = Rair/R
print "the percentage of total resistance offered by air film. is %.2f percent"%(p*100)
#(e)
Q = Ui*Ai*(T1-T2)
print "Rate of heat loss is %.1f W"%(Q)
#(f)
Ts = Uo*Ao*(T1-T2)/(ho*Ao)+T2
print "insulation skin temp.is %.1f C"%(Ts)
```

In [6]:

```
import math
# Variables
id_ = 1.5 #m, internal diameter of math.tank
h = 2.5 #m, height of math.tank
t1 = 0.006 #m, thickness of wall
t2 = 0.04 #m, thickness of insulation
Ta = 25. #C, ambient temp.
T1 = 80. #C, outlet temp. of liquid
cp = 2000. #j/kg C, specific heat of liquid
FR = 700./3600 #KG/s, Liquid flow rate
# Calculations and Results
ri = id_/2+t1 #m, inner radius of insulation
ro = ri+t2 #m, outer radius of insulation
ki = 0.05 #W/m C, thermal conductivity of insulation
hc = 4 #W/m**2 C, heat transfer coefficient at cylindrical surface
ht = 5.5 #W/m**2 C, heat transfer coefficient at flat surface
l = h+t1+t2 #m, height of the top of insulation
#fromm eq. 3.10
#heat transfer resistance of cylindrical wall
Rc = math.log(ro/ri)/(2*math.pi*l*ki)+1/(2*math.pi*ro*l*hc)
#heat transfer resistance of flat insulated top surface
Ri = (1/(math.pi*ro**2))*((ro-ri)/ki+1/ht)
tdf = T1-Ta #C, temp. driving force
Q = tdf/Rc + tdf/Ri #W, total rate of heat loss
Tt = Q/(FR*cp)+T1 #C, inlet temp. of liquid
print "Inlet liquid temp. should be %.0f C "%(Tt)
Q1 = tdf/Ri #W, rate of heat loss from flat surface
T1 = Q1/(math.pi*ro**2*ht)+Ta
print " the insulation skin temp. at the flat top surface is %.0f C "%(T1)
#similarly
T2 = 38
print "similarly the insulation skin temp at cylindrical surface is %.0f C"%(T2)
```

In [7]:

```
import math
# Variables
id_ = 2.5*10**-2 #m, internal diameter of glass tube
t = 0.3*10**-2 #m, thickness of wall
l = 2.5 #m, length of nichrome wire
L = 0.12 #m, length of steel covered with heating coil
Re = 16.7 #ohm, electrical resistance
ti = 2.5*10**-2 #m, thickness of layer of insulation
kg = 1.4 #W/m C, thermal conductivity of glass
ki = 0.041 #W/m C, thermal conductivity of insulation
T1 = 91. #C, boiling temp. of liquid
T2 = 27. #C, ambient temp.
ho = 5.8 #W/m **2 C outside air film coefficient
V = 90. #V, voltage
#Calculation
Rc = Re*l #ohm, resistance of heating coil
Q = V**2/Rc #W, rate of heat generation
ri = id_/2 #m, inner radius of glass tube
r_ = ri+t #m, outer radius of glass tube
ro = r_+ti #m,outer radius of insulation
#heat transfer resistance of glass wall
Rg = math.log(r_/ri)/(2*math.pi*L*kg)
#combined resistance of insulation and outer air film
Rt = math.log(ro/r_)/(2*math.pi*L*ki)+1/(2*math.pi*ro*L*ho)
#Rate of heat input to the boiling liquid in steel = Q1 = (Ts-T1)/Rg
#Rate of heat loss through insulation ,Q2 = (Ts-To)/(Rt)
#Q1+Q2 = Q
Ts = (Q+ T1/Rg +T2/Rt)/(1/Rg +1/Rt)
Q1 = (Ts-T1)/Rg
Q2 = Q-Q1
# Results
print "the heat imput to the boiling.is %.1f W"%(Q1)
```

In [2]:

```
import math
# Variables
ri = 1.3*10**-3 #m, radius of 10 gauge wire
t = 1.3*10**-3 #m, thickness of rubber insulation
Ti = 90. #C, temp. 0f insulation
To = 30. #C, ambient temp.
h = 15. #W/m**2 C, air film coefficient
km = 380. #W/m C, thermal cond. of copper
kc = 0.14 #W/m C, thermal cond. of rubber(insulation)
Rc = 0.422/100 #ohm/m, eletrical resistance of copper wire
# Calculations and Results
Tcmax = 90. #X, the maximum temp. in insulation
ro = ri+t #m, outside radius of 10 gauge wire
Sv = ((Tcmax-To)*(2*kc/ri**2))/(math.log(ro/ri)+kc/(h*ro))
I = (math.pi*ri**2*Sv/Rc)**0.5 #A, Current strength
print "maximum allowable current is %.2f A"%(I)
#(b) at r = 0
Tm = To+(ri**2*Sv/2)*(1/km+(math.log(ro/ri))/kc+1/(h*ro))
print "remp. at the centre of wire is %.3f C"%(Tm)
#at r = ro
Tc = 30+(ri**2*Sv/(2*kc))*(kc/(h*ro))
print "The temprature at the outer surface of insulation is %.1f C"%(Tc)
```

In [6]:

```
# Variables
tA = 0.25 #m, thickness of slab A
tB = 0.1 #m, thickness of slab B
tC = 0.15 #m, thickness of slab C
kA = 15. #W/m C, thermal comductivity of slab A
kB = 10. #W/m C, thermal comductivity of slab B
kC = 30. #W/m C, thermal comductivity of slab C
#Temprature distribution in slab A
T1 = 40. #C, fluid temp.
T2 = 35. #C, medium temp.
# Calculations and Results
#(a)
x1 = tB
TA1 = 90.+4500*x1-11000*x1**2
#similarly at the right surface
x2 = tA+tB
TA2 = 90.+4500*x2-11000*x2**2
#let dTA/dx = D
D = 0 #for maximum temp.
x3 = 4500./22000
TAmax = 90.+4500*x3-11000*x3**2
print "At x = 0.1 the temp. at the surface of slab A is %.0f C"%(TA1)
print "At x = 0.35 the temp. at the surface of slab A is %.0f C"%(TA2)
print " the maximum Temp. in A occurs at %.4f m"%(x3)
print " the maximum Temp. in A is %.1f TAmax "%(TAmax)
#(b)
#At the interface 2
D1 = 4500-2.*11000*x1 #C/W, D1 = dTA/dx, at x = 0.1
#At the interface 3
D2 = 4500-2.*11000*x2 #D12 = dTA/dx, at x = 0.35
#Temprature gradient in slab B and C
#by umath.sing the continuity of heat flux at interface (2)
D3 = -kA*D1/(-kB) #D3 = dTB/dx, at x = 0.1
#at interface (1)
D4 = D3 #D4 = dTB/dx at x = 0
#similarly
D5 = -1600. #C/W, dTB/dx, x = 0.35
D6 = D5 #at interface 4
print "temp. gradient at interface 2 of the slabs A is %.0f C/W"%(D1)
print "temp. gradient at interface 3 of the slabs A is %.0f C/W"%(D2)
print "temp. gradient at interface 2 of the slabs B is %.0f C/W"%(D3)
print "temp. gradient at interface 1 of the slabs B is %.0f C/W"%(D4)
print "temp. gradient at interface 3 of the slabs C is %.0f C/W"%(D5)
print "temp. gradient at interface 4 of the slabs C is %.0f C/W"%(D6)
#(c)
#from D3 = 3450 and TB = beeta1*x+beeta2
beeta1 = 3450.
beeta2 = 85.
x = 0.
TB = beeta1*x+beeta2
#similary
TC = 877.5-1600*x
h1 = -kB*D4/(T1-TB)
#similarly
h2 = 1129.
print "The heat transfer coefficient at one surface of solid fluid interface is %.1f W/m**2 C"%(h1)
print "The heat transfer coefficient at other surface of solid fluid interface is %.0f W/m**2 C"%(h2)
```

In [13]:

```
import math
# Variables
id_ = 78.*10**-3 #m, actual internal dia of pipe
tw = 5.5*10**-3 #m, wall thickness
nl = 8. #no. of longitudinal fins
tf = 1.5*10**-3 #m, thickness of fin
w = 30.*10**-3 #m,breadth of fin
kf = 45. #W/m C, thermal conductivity of fin
Tw = 150. #C, wall temp.
To = 28. #C, ambient temp.
h = 75. #W/m**2C, surface heat transfer coefficient
#Calculation
#from eq. 3.27
e = math.sqrt(2*h/(kf*tf))
n = (1./(e*w))*math.tanh(e*w) #efficiency of fin
L = 1. #m, length of fin
Af = 2.*L*w #m**2, area of math.single fin
Atf = nl*Af #m**2 total area of fin
Qmax = h*Atf*(Tw-To) #W, maximum rate of heat transfer
Qa = n*Qmax #W, actual rate of heat transfer
Afw = L*tf #m**2, area of contact of fin with pipe wall
Atfw = Afw*nl #m**2 , area of contact of all fin with pipe wall
ro = id_/2+tw #m, outer pipe radius
A = 2*math.pi*L*ro #m**2 area per meter
Afree = A-Atfw #m**2, free outside area of finned pipe
#Rate of heat transfer from free area of pipe wall
Q1 = h*Afree*(Tw-To) #W,
#total rate of hewat gtransfer from finned pipe
Qtotal = Qa+Q1 #W
#Rate of heat transfer fromm unfinned pipe
Q2 = h*A*(Tw-To)
per = (Qtotal-Q2)/Q2
# Results
print "the percentage increase in the rate of heat transfer is %.1f percent "%(per*100)
```

In [14]:

```
import math
# Variables
id_ = 90.*10**-2 #m, internal diameter of steel
od = 110.*10**-2 #m, outer diameter of steel
Ti = 180. #C, inside temp. of steel
To = 170. #C, outside temp. of steel
k = 37. #W/m C, thermal conductivity of alloy
Q = 5.18*10**3 #W, Rate of heat loss
# Calculations and Results
ri = id_/2 #m, inside radius of shell
ro = od/2 #m, outside radius of shell
r_ = 0.5 #m, boundary between the layers
L = 1 #m, length of shell
#Rate of heat transfer in the absence of contact resistance
Q1 = 2*math.pi*L*k*(Ti-To)/(math.log(ro/ri))
print "Rate of heat transfer in the absence of contact resistance is %.3f KW"%(Q1/1000)
print "The actual rate of heat loss is 5.18kW is much less than this value\
. So there is a thermal contact resistance at the interface between the layers "
#(b)
Ri = (math.log(r_/ri)/(2*math.pi*L*k)) #C/W, resistance of inner layer
Ro = (math.log(ro/r_)/(2*math.pi*L*k)) #C/W, resistance of outer layer
Rc = ((Ti-To)/(Q))-(Ri+Ro) #C/W, contact resistance
print "The contact resistance is %f C/W "%(Rc)
Ac = 2*math.pi*L*r_ #m**2, area of contact surface of shell
hc = 1/(Ac*Rc) #W/m**2 c, contact heat transfer coefficient
print "contact heat transfer coefficient is %.1f W/m**2 C "%(hc)
#(c)
dt = Q/(hc*Ac)
print "The temprature jump is %.1f C"%(dt)
```

In [6]:

```
# Variables
d = 5.2*10**-3 #m, diameter of copper wire
ri = d/2 #inner radius of insulation
kc = 0.43 #W/m C, thermal conductivity of PVC
Tw = 60. #C, temp. 0f wire
h = 11.35 #W/m**2 C, film coefficient
To = 21. #C, ambient temp.
#calculation
Ro = kc/h #m,critical outer radius of insulation
t = Ro-ri
# Results
print "the critical thickness is %.2f mm"%(t*10**3)
```

In [5]:

```
# calculate the critical insulation thickness.
# Variables
d = 15.*10**-2 #m, length of steam main
t = 10.*10**-2 #m, thickness of insulation
ki = 0.035 #W/m C, thermal conductivity of insulation
h = 10. #W/m**2 C, heat transfer coefficient
#calculation
#from eq. 3.29
ro = ki/h
# Results
print "ro = %.1f cm "%(ro*10**3)
print "Radius of bare pipe is larger than outer radius of insulation So critical \
insulation thickness does not exist "
```

In [4]:

```
from scipy.optimize import fsolve
import math
# Variables
Ti = 172. #C, saturation temp.
To = 20. #C, ambient temp.
Cs = 700. #per ton, math.cost of steam
Lv = 487. #kcal/kg, latent heat of steam
ho = 10.32 #kcal/h m**2 C, outer heat transfer coefficient
kc = 0.031 #W/m C, thermal conductivity of insulation
n = 5. #yr, service life of insulation
i = 0.18 #Re/(yr)(Re), interest rate
#Calculation
di = 0.168 #m, inner diameter of insulation
#Cost of insulation
Ci = 17360.-(1.91*10**4)*di #Rs/m**3
Ch = Cs/(1000*Lv) #Rs/cal, math.cost of heat energy in steam
sm = 1./(1+i)+1/(1+i)**2+1/(1+i)**3+1/(1+i)**4+1/(1+i)**n
#from eq. 3.33
ri = di/2 #m inner radius of insulation
L = 1 #m, length of pipe
#Pt = Ch*sm*2*math.pi*ri*L*( 1/(((ri/kc)*('math.log(ro/ri)'))+ri/(ho*ro)))*7.2*10**3*(Ti-To)+math.pi*(ro**2-ri**2)*L*Ci
#On differentiating , dpt/dro = -957.7*((1/ro)-(0.003/ro**2))/(math.log(ro)+(0.003/ro)+2.477)**2
def f(ro):
return -957.7*((1/ro)-(0.003/ro**2))/(math.log(ro)+(0.003/ro)+2.477)**2+98960*ro
ro = fsolve(f,0.1)
t = ro-ri
# Results
print "The optimum insulation thickness is %.0f mm"%(t*1000)
```