In [1]:

```
import math
# Flow of hot oil over a Flat Plate
# Variables
T_oil = 60 #Temp of engine oil[degree Celcius]
T_plate = 20 #Temp of flat plate[degree Celcius]
Rec = 5*10**5 #Critical reynolds number for laminar flow
Tf = (T_oil+T_plate)/2 #Film temperature[degree Celcius]
v = 2 #[m/s]
#Properties of engine oil at film temperature
rho = 876 #[kg/m**3]
Pr = 2962 #Prandtl number
k = 0.1444 #[W/m.degree Celcius]
nu = 2.485*10**(-4) #dynamic vismath.cosity[m**2/s]
L = 5 #Length of plate[m]
# Calculations and Results
ReL = (v*L)/nu;
if(ReL<Rec):
print ("We have laminar flow over the entire plate")
Cf = 1.33*(ReL**(-0.5));
print (Cf,"The average friction coefficient is")
#Pressure Drag is zero and thus Cd = Cf for parallel floe over a flat plate
Fd = Cf*5*1*rho*(v**2)/2 #[N]
print "The drag force acting on the plate per unit width is",Fd,"N"
else:
print ("flow is turbulent")
Nu = 0.664*(ReL**(0.5))*(Pr**(1/3)) #Nusselt Number
print "Nusselt Number is",(Nu)
h = k*Nu/L #[W/m**2.degree Celcius]
print "Convective heat transfer coefficient is",h,"W/m**.degree Celcius"
Q = h*(5*1)*(T_oil-T_plate) #[W]
print "Heat flow rate is",round(Q),"W"
```

In [2]:

```
import math
# Cooling of a Hot Block by Forced Air at High Elevation
# Variables
ReC = 5*10**5 #critical Reynolds number
v = 8 #Velocity of air[m/s]
T_air = 20 #Initial Temperature of air[degree Celcius]
T_plate = 140 #Temperature of flat plate[degree Celcius]
T_film = (T_air+T_plate)/2 #Film Temperature of air[degree Celcius]
#Properties of air at film temperature[degree Celcius]
k = 0.02953 #[W/m.degree Celcius]
Pr = 0.7154 #Prandtl Number
nu = 2.097*10**(-5) #Kinematic Vismath.cosity at 1 atm Pressure [m**2/s]
nu_ac = nu/0.823 #Kinematic vismath.cosity at pressure 0.823 atm[m**2/s]
#Solution(a)
L1 = 6 #Characteristic length of plate along the flow of air[m]
w1 = 1.5 #width[m]
ReL1 = (v*L1)/nu_ac #Reynolds number
if(ReL1>ReC):
print ("Flow is not laminar")
#We have average Nusselt Number
Nu1 = ((0.037*(ReL1**(0.8)))-871)*(Pr**(1/3));
print "Nusselt Number is",Nu1
h1 = k*Nu1/L1 #[W/m**2.degree Celcius]
As1 = w1*L1 #Flow Area of plate[m**2]
Q1 = h1*As1*(T_plate-T_air);
print "Heat Flow Rate is",Q1,"W"
else:
print ("Flow is laminar")
#Solution(b)
L2 = 1.5 #Characteristic length of plate along flow of air[m]
ReL2 = v*L2/nu_ac #Reynolds Number
if(ReL2<Rec):
print ("Flow is laminar")
Nu2 = 0.664*(ReL2**(0.5))*(Pr**(1/3));
print "Nusselt Number is",Nu2
h2 = k*Nu2/L2 #[W/m**2.degree Celcius]
Q2 = h2*As1*(T_plate-T_air);
print "The heat transfer rate is",Q2,"W"
else:
print ("Flow is turbulent")
```

In [3]:

```
import math
# Cooling of Plastic Sheets by Forced Air
# Variables
T_p = 95. #Temp of plastic Sheet[degree Celcius]
T_air = 25. #Temp of air[degree Celcius]
v = 3. #Velocity of flowing air[m/s]
L = 0.6 #Length of plastic sheet[m]
w = 1.2 #width[m]
k = 0.02808 #[W/m.degree Celcius]
Pr = 0.7202 #Prandtl Number
nu = 1.896*10**(-5) #[m**2/s]
rho = 1200. #[kg/m**3]
Cp = 1700. #[J/kg.degree Celcius]
vp = (9./60) #Velocity of moving plastic[m/s]
tp = 0.001 #Thickness of plastic[m]
ReC = 5.*10**5 #Crictical Reynolds Number
e = 0.9 #emissivity
# Calculations and Results
L1 = 2*L #Considering both sides of plastic sheet[m]
ReL1 = v*L1/nu #Reynolds number
if(ReL1<ReC):
print ("(a) Flow is laminar")
Nu1 = 0.664*(ReL1**0.5)*(Pr**(1/3));
print "The nusselt number is",Nu1
h = k*Nu1/L1 #[W/m**2.degree Celcius]
As = L1*w #[m**2]
Q_conv = h*As*(T_p-T_air) #[W]
print "The covection heat flow rate is",Q_conv,"W"
Q_rad = e*(5.67*10**(-8))*As*(((T_p+273)**4)-((T_air+273)**4)) #[W]
print "Radiation heat transfer rate is",(Q_rad),"W"
Q_total = Q_conv+Q_rad #[W]
print "The rate of cooling of the plastic sheet by combined convection and radiation is",(Q_total),"W"
else:
print ("(a) The Flow is turbulent")
#Solution(b)
At = w*tp #[m**2]
m = rho*At*vp #ass of th plastic rolling out per unit time[kg/s]
T2 = T_p+(-Q_total/(m*Cp)) #[degree Celcius]
print "(b) The temperature of the plastic sheet as it leaves the cooling section is",T2,"degree Celcius"
```

In [4]:

```
import math
# Drag Force Acting on a Pipe in a River
# Variables
T_water = 15. #[degree Celcius]
vw = 4. #Velocity of water[m/s]
od = 0.022 #Outer diameter of pipe[m]
w = 30. #width of river[m]
#At 15 degree C properties of water
rho = 999.1 #[kg/m**3]
# Calculations
mu = 1.138*10**(-3) #vismath.cosity[kg/m.s]
Re = (rho*vw*od)/mu #Reynolds number
Cd = 1.0 #Dreag coefficient
A = w*od #Frontal area for flow past a cylinder[m**2]
Fd = Cd*A*rho*(vw**2)/2 #[N]
# Results
print "The drag force acting on the pipe is",Fd/1000,"kN"
```

In [8]:

```
import math
# Heat Loss from a Steam Pipe in Windy Air
# Variables
d = 0.1 #diameter of pipe[m]
Ts = 110 #Temp of ecternal surface of pipe[degree Celcius]
Ta = 10 #Temp of air[degree Celcius]
va = 8 #Velocity of air[m/s]
Tf = (Ts+Ta)/2 #Film temperature[degree Celcius]
k = 0.02808 #[W/m.degree Celcius]
Pr = 0.7202 #Prandtl Number
nu = 1.896*10**(-5) #Kinematic vismath.cosity[m**2/s]
# Calculations and Results
Re = (va*d)/nu #Reynolds Number
Nu = 0.3+((0.62*(Re**(0.5))*(Pr**(1./3)))/((1+((0.4/Pr)**(2./3)))**(1./4))*((1+((Re/282000.)**(5./8)))**(4./5)));
print "The nusselt number is",round(Nu)
h = k*Nu/d #[W/m**2.degree Celcius]
As = math.pi*d*1 #Area of pipe per unit length[m**2]
Q = h*As*(Ts-Ta) #[W]
print "The rate of heat loss from the pipe per unit of its length is",math.ceil(Q),"W"
```

In [10]:

```
import math
# Cooling of a Steel Ball by Forced Air
# Variables
rho = 8055. #[kg/m**3]
Cp = 480. #[J/kg.degree Celcius]
To = 300. #Temp of oven[degree Celcius]
Ta = 25. #Temp of air[degree Celcius]
va = 3. #Velocity of air[m/s]
Ts = 200. #Dropped temp of surface of ball[degree Celcius]
Ts_avg = (Ts+To)/2 #[degree Celcius]
d = 0.25 #[m]
mu_s = 2.76*10**(-5) #Dynamic Vismath.cosity at average surface temperature[kg/m.s]
#Properties of air at 25 degree Celcius
k = 0.02551 #[W/m.degree Celcius]
nu = 1.562*10**(-5) #kinematic vismath.cosity[m**2/s]
mu = 1.849*10**(-5) #Dynamic vismath.cosity of air at 25 degree C[kg/m.s]
# Calculations and Results
Re = va*d/nu #[Reynolds Number]
Nu = 2+((0.4*(Re**(1./2)))+(0.06*(Re**(2./3))))*(Pr**(0.4))*((mu/mu_s)**(1/4.));
print "The Nusselt number is",Nu
h = k*Nu/d #[W/m**2.degree Celcius]
As = math.pi*(d**2) #[m**2]
Q_avg = h*As*(Ts_avg-Ta) #[W]
print "The average rate of heat transfer from Newtons Law of cooling is",(Q_avg),"W"
m = rho*math.pi*(d**3)/6 #[kg]
Q_total = m*Cp*(To-Ts) #[J]
print "The total heat transferred from the ball is",Q_total,"J"
delta_t = Q_total/Q_avg #[s]
print "The time of cooling is",delta_t/3600,"hour"
```

In [11]:

```
import math
# Preheating Air by Geothermal Water in a Tube Bank
# Variables
Ta_in = 20. #Temp of air whileentering the duct[degree Celcius]
v = 4.5 #mean velocity[m/s]
T_tw = 120. #Temp of geothermal water[degree Celcius]
od = 0.015 #Outer Diameter of tubes[m]
SL = 0.05
ST = 0.05 #Longitudinal and transverse pitches[m]
#Properties of air at mean temp
k = 0.02808 #[W/m.K]
rho = 1.059 #[kg/m**3]
Cp = 1007 #[J/kg.K]
Pr = 0.7202 #Prandtl no
Pr_s = 0.7073 #Prandtl no at temp = 120 degree C
mu = 2.008*10**(-5) #Vismath.cosity[kg/m.s]
rho_in = 1.204 #density of air at inlet conditions[kg/m**3]
# Calculations and Results
v_max = (ST*v)/(ST-od) #maximu velocity[m/s]
Re = rho*v_max*od/mu #Reynolds Number
print "Reynolds number is",Re
Nu = 0.27*(Re**(0.63))*(Pr**(0.36))*((Pr/Pr_s)**0.25);
print "The nusselt number is",Nu
Nl = 6 #No of rows of tubes
Nt = 10 #No of tubes in each row
F = 0.945 #For Nl = 6, correction factor
Nu_Nl = F*Nu;
h = Nu_Nl*k/od #[W/m**2.degree Celcius]
N = Nl*Nt #Total no of tubes
#For unit tube length
As = N*math.pi*od*1 #[m**2]
m = rho_in*v*(Nt*ST*1) #[kg/s]
print "Mass flow rate of air is",m,"kg/s"
Te = T_tw-((T_tw-Ta_in)*math.exp((-As*h)/(m*Cp))) #[degree Celcius]
print "Fluid exit temperature is",Te,"degree Celcius"
T_ln = (((T_tw-Te)-(T_tw-Ta_in))/(math.log((T_tw-Te)/(T_tw-Ta_in)))) #[degree Celcius]
print "Log mean temperature difference is",T_ln,"degree Celcius"
Q = h*As*T_ln #[W]
print "Rate of heat transfer is",Q,"W"
#For given Re and SL/od ratio friction coefficient is
f = 0.16;
delta_P = Nl*f*rho*(v_max**2)/2 #[Pa]
print "The pressure drop across the tube bank is",delta_P,"Pa"
```

In [13]:

```
import math
# Effect of insulation on Surface Temperature
# Variables
Ti = 120 #Initial temp of hot water[degree Celcius]
k_pipe = 15 #W/m.degree Celcius
ri = 0.008
ro = 0.01 #Inner and outer radii[m]
t = 0.002 #Thickness of pipe[m]
To = 25 #Ambient temperature[degree Celcius]
Ts = 40 #Maximum Temp of outer surface of insulation[degree Celcius]
hi = 70
ho = 20 #Heat transfer coefficients inside and outside of the pipe[W/m**2.degree Celcius]
k_insu = 0.038 #[W/m.degree Celcius]
L = 1 #section of pipe[m]
# Calculations
#Areas of surfaces math.exposed to convection
A1 = 2*math.pi*ri*L #[m**2]
#Individual Thermal Resismath.tances
R_conv1 = 1/(hi*A1) #[degree Celcius/W]
R_pipe = (math.log(ro/ri))/(2*math.pi*k_pipe*L) #[degree Celcius/W]
#R_insu = (math.log(r3/ri))/(2*math.pi*k_insu*L)
#R_conv2 = 1/(ho*2*math.pi*r3*L)
#R_total = R_conv1+R_conv2+R_pipe+R_insu
#Q = (Ti-To)/R_total;
#Q = (Ts-To)/R_conv2;
#Equating both Q we get
def radius(r3):
r[0] = 1884*r3[0]*(0.284+0.0024+4.188*math.log((r3[0])/0.01)+(1/(125.6*r3[0])))-95;
# Results
#print "The outer radius of the insulation is",xs,"m"
#t = xs-ro #[m]
#print "The minimum thickness of fibreglass insulation required is",100*t,"cm"
#/Correct output will be print layed after executing the codes once and then re-executin them
```

In [15]:

```
import math
# Optimum Thickness of insulation
# Variables
k_insu = 0.024 #[Btu/h.ft**2.degree Farenhiet]
Ts = 180 #temp of math.exposed surface of oven[degree F]
Ta = 75 #temp of ambient air[degree F]
L = 12 #length[ft]
d = 8 #Diameter[m]
time = 5840 #[h/year]
ho = 3.58 #Heat transfer coefficient on the outer surface[tu/h.ft**2.degree F]
unit_c1 = 0.75 #[$/therm]
unit_c2 = 2.70 #Unit math.cost of insulation[4/ft**2]
neta = 0.8 #Efficiency
# Calculations and Results
As = (2*math.pi*((d/2)**2))+(2*math.pi*L*d/2) #math.exposed surface area[ft**2]
print (As)
Q = ho*As*(Ts-Ta) #[Btu/h]
Q_total = (1./neta)*Q*time/(100000) #[therms]
print "The total amount of heat loss from the surrounding is",Q_total,"Therms"
annual_c1 = Q_total*unit_c1 #[$/year]
print "The annual fuel math.cost of the oven before insulation is $",annual_c1,"per year"
R_conv = 1./(ho*math.ceil(As));
R_insu = (1./12)/(k_insu*math.ceil(As)) #Thickness id 1inch or 1/12 ft
Q_insu = (Ts-Ta)/(R_conv+R_insu) #[Btu/hr]
Q_insu_total = (1./neta)*Q_insu*time*(1./100000) #[therms]
print "Total energy consumption by oven on being insulated",Q_insu_total,"therms"
annual_c2 = Q_insu_total*unit_c1 #[$/yr]
insu_cost = (unit_c2*As) #Insulation math.cost[$]
Total_c = annual_c2+insu_cost #[$]
print "The sum of insulation math.cost and heat loss math.costs is $",Total_c
```