In [9]:

```
print "Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 7 Example # 7.1 "
#Diameter in m
D = 0.3;
#Cruimath.sing speed in m/s
Uinfinity = 150;
#At an altitude of 7500 m the standard atmospheric air pressure is 38.9 kPa and the density of the air is 0.566 kg/m3 (From Table 38 in Appendix 2).
rho = 0.566;
#Dynamic vismath.cosity in kgm/s
mu = 0.0000174;
#Prandtl number
Pr = 0.72;
#Thermal conductivity in W/mK
k = 0.024;
#The heat transfer coefficient at the stagnation point (0) is, according to Eq. (7.2)
print "Heat transfer coefficient at stagnation point in W/m2K"
#Heat transfer coefficient at stagnation point in W/m2K
h = (((k*1.14)*((((rho*Uinfinity)*D)/mu)**0.5))*(Pr**0.4))/D
print "Distribution of the convection heat trans-fer coefficient over the forward portion of the wing"
for o in range(0,90,15): #o is the parameter used in the loop
#convection heat trans-fer coefficients in W/m2K
ho = h*(1-(o/90.0)**3);
# L.26: No simple equivalent, so mtlb_fprintf() is called.
print "At an angle of ",o," degree, heat transfer coeffcient is ",round(ho,2)
```

In [10]:

```
print "Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 7 Example # 7.2 "
#Diameter of wire in m
D = 0.000025;
#Length of wire in m
L = 0.006;
#Free stream temperature of air in degeee C
T = 20;
#Wire temperature to be maintain in degree C
Tw = 230;
#Resistivity of platinum in ohm-cm
Re = 0.0000171;
#Since the wire is very thin, conduction along it can be neglected; also, the temperature gradient in the wire at any cross section can be disregarded.
#At freestream temperature, for air:
#Thermal conductivity in W/mC
k = 0.0251;
#Kinematic vismath.cosity in m2/s
nu = 0.0000157;
#Reynolds number at velocity = 2m/s
Rey = (2*D)/nu;
if Re<40:
#Umath.sing the correlation equa-tion from Eq. (7.3) and Table 7.1
#Average convection heat transfer coefficient as a function of velocity
#is
#hc=799U**0.4 W/m2C
#At this point, it is necessary to estimate the heat transfer coefficient for radiant heat flow.
#According to Eq. (1.21), we have approximately
#hr=sigma*epsilon*((Ts+Tinfinity)**3)/4
#The emissivity of polished platinum from Appendix 2, Table 7 is about 0.05, so hr is about 0.05 W/m2C.
#The rate at which heat is transferred from the wire is therefore
#0.0790U**4 W.
#The electrical resistance of the wire in ohm is
R = ((Re*L)*4)/(((100*math.pi)*D)*D);
#A heat balance with the current i gives
print "Current in ampere as a function of velocity is"
print "i=0.19*U**0.2"
# the answer is the equation hence we have to print the equation only
```

In [11]:

```
print "Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 7 Example # 7.3 "
#Velocity of air in m/s
Uinfinity = 0.5;
#Length and breadth of square shaped array in m
L = 2.5;
#Surface temperature in degree C
Ts = 70.0;
#Ambient temperature in degree C
Ta = 20.0;
#At free stream temperature of air
#Kinematic vismath.cosity in m2/s
nu = 0.0000157;
#Density in kg/m3
rho = 1.16;
#Specific heeat in Ws/kgC
c = 1012;
#Prandtl number
Pr = 0.71;
#Reynolds number
Re = (Uinfinity*L)/nu;
#From equation 7.18
#The average heat transfer coefficient in W/m2C is
#Heat transfer coefficient in W/m2C
h = (((0.0033*(Pr**(-2/3.0)))*c)*rho)*Uinfinity;
print "Heat loss from array in W is"
#Heat loss in W
q = ((h*L)*L)*(Ts-Ta)
print round(q,2)
# the answer is incorrect in the textbook
```

In [12]:

```
print "Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 7 Example # 7.4 "
#Diameter of pipe in m
D = 7.62/100;
#Diameter and length of cylinder in m
d = 0.93/100;
l = 1.17/100;
#Initial temperature in degree C
Ti = 50.0;
#Final temperature in degree C
Tf = 350.0;
#Temperature of pipe surface in degree C
Tp = 400.0;
#Therefore film temp. at inlet in degree C
Tfi = (Ti+Tp)/2;
#Therefore film temp. at outlet in degree C
Tfo = (Tf+Tp)/2;
#Average film temp. in degree C
Tf = (Tfi+Tfo)/2;
#At this film temperature
#Kinematic vismath.cosity in m2/s
nu = 0.0000482;
#Thermal conductivity in W/mC
k = 0.042;
#Density in kg/m3
rho = 0.6;
#Specific heat in J/kgC
c = 1081;
#Prandtl number
Pr = 0.71;
#Flow rte of gas in kg/h is
m = 5;
#Superficial velocity in m/h
Us = m/((((rho*math.pi)*D)*D)/4);
#Cylinder packaging volume in m3
V = (((math.pi*d)*d)*l)/4;
#Surface area in m2
A = (((2*math.pi)*d)*d)/4+(math.pi*d)*l;
#Equivalent packaging dia in meter
Dp = (6*V)/A;
#REynolds number based on this dia
Re = ((Us*3600)*Dp)/nu;
#From eq. 7.23
print "Heat transfer coefficient in W/m2C is"
#Heat transfer coefficient in W/m2C
h = (14.3*k)/Dp
print round(h,2)
```

In [14]:

```
print "Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 7 Example # 7.5 "
#Initial temperature in degree F
Ti = 58;
#Final temperature in degree F
Tf = 86.0;
#Film temperature of air in degree F
Tair = (Ti+Tf)/2;
#Temperature of condenmath.sing steam in degree F
Tsteam = 212.0;
#Heat transfer coeffcient in Btuh/ft2F
ho = 1000.0;
#Length of tube in ft
L = 2.0;
#Diameter of tube in in
d = 0.5;
#Wall thickness in inches
t = 0.049;
#Pitch in inches
p = 3/4.0;
#Width in ft and height in inches of rectangular shell
H = 15;
W = 2;
#Mass flow rate of air in lb/h
m = 32000;
#Appendix 2, Table 28 then gives for the properties of air at this mean
#bulk temperature
#Density in lb/ft3
rho = 0.072;
#Thermal conductivity in Btu/h F ft
k = 0.0146;
#Dynamic vismath.cosity in lb/fth
mu = 0.0444;
#Prandtl number for air and steam
Pr = 0.71;
#Calcaulating minimum free area in ft2
A = ((H/p)*W)*((p-d)/12.0);
#Maximum gas velocity in lb/h.ft2
Gmax = m/A;
#Hence the reynolds number is
Re = (Gmax*d)/(12*mu);
#Assuming that more than 10 rows will be required, the heat transfer coefficient is calculated from Eq. (7.29)
#h value in Btu/h ft2 F
h = ((((k*12)/d)*(Pr**0.36))*0.27)*(Re**0.63);
#The resistance at the steam side per tube in h F/Btu
R1 = 12/(((ho*math.pi)*(d-2*t))*L);
#The resistance of the pipe wall in h F/Btu
R2 = 0.049/(((60*math.pi)*L)*(d-t));
#The resistance at the outside of the tube in h F/Btu
R3 = 1/((((h*math.pi)*d)*L)/12);
#Total resistance in h F/Btu
R = R1+R2+R3;
#Mean temperature difference between air and steam in degree F is
deltaT = Tsteam-Tair;
#Specific heat of air in Btu/lb F
c = 0.241;
#Equating the rate of heat flow from the steam to the air to the rate of enthalpy rise of the air
#Solving for N gives
print "Total number of transverse tubes needed are"
#Total number of transverse tubes
N = (((m*c)*(Tf-Ti))*R)/(20*deltaT)
print "Rounding off = 5 tubes"
if N<10 :
#Correction for h value, again in Btu/h ft2 F
h = 0.92*h;
#The pressure drop is obtained from Eq. (7.37) and Fig. 7.25.
#Velocity in ft/s
Umax = Gmax/(3600*rho);
#Acceleration due to gravity in ft/s2
g = 32.2;
print "Corresponding pressure drop in lb/ft2"
#Corresponding pressure drop in lb/ft2
P = ((((6*0.75)*rho)*Umax)*Umax)/(2*g)
print round(P)
```

In [16]:

```
print "Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 7 Example # 7.6 "
#Temperature of methane in degree C
T = 20;
#Outer dia of tube in m
D = 4/100.0;
#Longitudinal spacing in m
SL = 6/100.0;
#Transverse spacing in m
ST = 8/100.0;
#Wall temperature in degree C
Tw = 50.0;
#Methane flow velocity in m/s
v = 10.0;
#For methane at 20°C, Table 36, Appendix 2 gives
#Density in kg/m3
rho = 0.668;
#Thermal conductivity in W/mK
k = 0.0332;
#Kinematic vismath.cosity in m2/s
nu = 0.00001627;
#Prandtl number
Pr = 0.73;
#From the geometry of the tube bundle, we see that the minimum flow
#area is between adjacent tubes in a row and that this area is half
#the frontal area of the tube bundle. Thus,
#Velocity in m/s
Umax = 2*v;
#Reynolds number
Re = (Umax*D)/nu;
#Since ST/SL<2, we use Eq. (7.30)
#Nusselt number
Nu = ((0.35*((ST/SL)**0.2))*(Re**0.6))*(Pr**0.36);
#Heat transfer coefficient in W/m2K
h = (Nu*k)/D;
#Since there are fewer than 10 rows, the correlation factor in Table 7.3 gives
print "Heat transfer coefficient in W/m2K"
#Heat transfer coefficient in W/m2K
h = 0.92*h
print round(h)
#Tube-bundle pressure drop is given by Eq. (7.37). The insert in Fig. (7.26) gives the correction factor x.
print "Corresponding pressure drop in N/m2"
#Corresponding pressure drop in N/m2
P = ((((5*0.25)*rho)*Umax)*Umax)/2
print round(P)
```

In [19]:

```
print "Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 7 Example # 7.7 "
#Temperature of jet in degree C
T = 20;
#Thermal conductivity in W/mK
k = 0.597;
#Dynamic vismath.cosity in Ns/m2
mu = 0.000993;
#Prandtl number
Pr = 7;
#Mass flow rate in kg/s
m = 0.008;
#Diameter of jet in m
d = 6/1000.0;
#Total heat flux in W/m2
q = 70000.0;
#Reynolds number
Re = (4*m)/((math.pi*d)*mu);
print "For r=3mm"
#From Eq. (7.45)
#Heat transfer coefficient in W/m2K
h = (63*k)/d;
print "Surface temperature at r=3mm in degree C is"
#Surface temperature in degree C
Ts = T+q/h
print round(Ts,1)
print "For r=12mm"
#From Eq. (7.48)
#Heat transfer coefficient in W/m2K
h = (35.3*k)/d;
print "Surface temperature at r=12mm in degree C is"
#Surface temperature in degree C
Ts = T+q/h
print round(Ts,1)
```

In [22]:

```
print "Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 7 Example # 7.8 "
#Temperature of plate in degree C
Tplate = 60;
#Temperature of jet in degree C
T = 20;
#Thermal conductivity in W/mK
k = 0.0265;
#Dynamic vismath.cosity in Ns/m2
mu = 0.00001912;
#Prandtl number
Pr = 0.71;
#Density in kg/m3
rho = 1.092;
#Mass flow rate in kg/s
m = 0.008;
#Width of jet in m
w = 3/1000.0;
#Length of jet in m
l = 20/1000.0;
#Velocity of jet in m/s
v = 10.0;
#Exit distance in m
z = 0.01;
#Width given for plate in m
L = 0.04;
#Reynolds number
Re = ((rho*v)*w)/mu;
#From Eq. (7.68) with x= 0.02 m, z =0.01 m, and w= 0.003 m
#Nusselt number
Nu = 11.2;
# ! L.33: mtlb(d) can be replaced by d() or d whether d is an M-file or not.
#Heat transfer coefficient in W/m2K
h = (Nu*k)/w;
print "Heat transfer rate from the plate in W is"
#Heat transfer rate from the plate in W
q = ((h*L)*l)*(Tplate-T)
print round(q,1)
```