#calculate the Surface temperature of transmission line, rate of heat generation and max temperature in the line
#Initialization of variables
import math
heat=54.5 #Btu/hr ft
d=0.811 #in
h=2.5 #Btu/hr ft**2 F
ts=100 #F
km=220 #Btu/hr ft F
#calculations
t2=heat*12/(h*math.pi*d) +ts
w=heat*4*144/(math.pi*d**2)
t1=w*(d/2)**2 /(4*144*km) + t2
#results
print '%s %.1f %s' %("Surface temperature of transmission line =",t2," F")
print '%s %d %s' %("\n Rate of heat generation per unit volume of wire =",w,"Btu/hr ft^2")
print '%s %.2f %s' %("\n Max. temperature in the line =",t1," F")
print '%s' %("The answers in the textbook are a bit different due to rounding off errors")
#calculate the heat rate, total hourly loss and approx. temp of the tip of the fin and total heat loss
#Initialization of variables
import math
d1=1. #in
l=1. #ft
r=0.5 #ft
L=0.5 #in
Ts=430. #F
Ta=170. #F
dela=0.0125 #ft
h=10. #Btu/hr ft^2 F
eta=0.77
eta2=0.94
n=60. #fins
thick=0.025 #in
k2=132. #Btu/hr ft F
#calculations
Q=h*math.pi*d1**2 *(Ts-Ta)/12
rate=(r+L)/r
k=26 #Btu/hr ft F
Lt=L/12 *(h*12/(k*dela))**(1/2)
dtm=eta*(Ts-Ta)
As=2*math.pi*((2*d1)**2 -d1**2)/4
Q1=h*n*As*dtm/144
Q2=h*math.pi*d1*(12-60*thick)*(Ts-Ta)/144
Qt=Q1+Q2
al=0.8
tl=Ta+(Ts-Ta)/math.cosh(al)
al2=r/12 *(h*12*2/(k2*thick))
dtm2=eta2*(Ts-Ta)
Q12=h*n*As*dtm2/144
Qt2=Q12+Q2
#results
print '%s %.1f %s' %("Heat rate per foot of bare tube =",Q,"Btu/hr")
print '%s %.1f %s' %("\n Total hourly heat loss per foot of finned tube =",Qt,"Btu/hr")
print '%s %d %s' %("\n Approx. temp for tip of the fin =",tl,"F")
print '%s %.1f %s' %("\n In case of Al, Total beat loss =",Qt2," Btu/hr")
print '%s' %("The answers in the textbook are a bit different due to rounding off errors")
#calculate the Length required
#Initialization of variables
import math
tl=125. #F
t0=80. #F
t1=1000. #F
d=1. #in
k=25. #Btu/hr ft F
k2=0.0208
Nu=18.
#calculations
byal=(tl-t0)/(t1-t0)
al=math.acosh(1/byal)
b=math.pi*d/12.
A=math.pi*d**2 /(4*144)
tm=(tl+t1)/2. +460
hr=0.79*0.1714*((tm/100)**4 - ((t0+460)/100)**4)/(tm-460-t0)
hc=Nu*k2*12/d
a=((hc+hr)*b/(k*A))**(0.5)
L=al/a
#results
print '%s %.2f %s' %("Length required =",L," ft")
#calculate the time required
#Initialization of variables
import math
c=0.0947 #Btu/lbm F
rho=0.0551 #lbm/ft**3
mu=0.0553 #lbm/hr ft
t1=440. #F
ts=400. #F
t2=80. #F
d=0.1 #in
k=0.0194 #Btu/hr ft**2 F
rho2=558. #lbm/ft**3
v=10. #ft/s
#calculations
Re=d*3600*v*rho/(12*mu)
Nu=0.37*Re**0.6
hc=k*Nu*12/d
ex=math.log((t1-ts)/(t1-t2))
tau=-ex*d*rho2*c/(12*6*hc)
time=tau*3600
#results
print '%s %d %s' %("Time required =",time,"sec")
#calculate the Cooling time and Center temperature
#Initialization of variables
h=2 #Btu/hr ft**2 F
delta=1/6.
t=125. #F
t0=100. #F
ti=350. #F
k=0.167 #Btu/hr ft F
rho=80. #lbm/ft**3
c=0.4 #Btu/lbm F
#calculations
Bi=h*delta/k
tr=(t-t0)/(ti-t0)
tau=1.5*delta**2 *rho*c/k
tr2=0.21
tc=tr2*(ti-t0) + t0
#results
print '%s %.2f %s' %("Cooling time =",tau," hr")
print '%s %d %s' %("\n Center temperature =",tc," F")
#calculate if the thin layero f insulation would increase the heat dissipation from wire
#Initialization of variables
h=2.5 #Btu/hr ft^2 F
kc=0.1 #Btu/hr ft F
r1=0.811/2
#calculations
r2c=kc/h *12
#results
if r2c>=r1:
print '%s %.2f %s' %("Thin layer of insulation would increase the heat dissipation from wire, r2c =",r2c,"in")
else:
print '%s %.2f %s' %("Thin layer of insulation would decrease the heat dissipation from wire. r2c=",r2c,"in")
#calculate the heat transfer from surfaces 1,2,3 and Temperature of surface R
#Initialization of variables
F12=0.19
F13=F12
FR3=F13
F2R=0.38
J1=1714.
Wb2=0.1714
#calculations
print '%s' %("Upon solving the simultaneous equations")
Q1=1774 #Btu/hr ft
Q2=-547 #Btu/r ft
Q3=-1227 #Btu/hr ft
J2=548 #Btu/hr ft^2
Tr=909 #R
#results
print '%s %d %s' %("Heat transfer rate from surface 1 =",Q1," Btu/hr ft")
print '%s %d %s' %("\n Heat transfer rate from surface 2 =",Q2," Btu/hr ft")
print '%s %d %s' %("\n Heat transfer rate from surface 3 =",Q3," Btu/hr ft")
print '%s %d %s' %("\n Temperature of surface R =",Tr,"R")