from __future__ import division
import math
#Variables
T1=2273; #temp. of liquid air,K
T2=303; #temp. of room,K
T3=973; #temp. of shield,K
D1=0.003; #diameter of crucible,m
D2=0.05; #diameter of shield,m
theta1=330; #surrounding angle of jet,degree
theta2=30 # angle of slit,degree
Fjr=theta2/360; #fraction of energy of view of jet occupied by room
Fjs=theta1/360 ; #fraction of energy of view of jet occupied by shield
sigma=5.67*10**-8; #Stefen-Boltzman constant
#Calculations
Qnjr=math.pi*D1*Fjr*sigma*(T1**4-T2**4); #net heat transfer from jet to room,W/m
Qnjs=math.pi*D1*Fjs*sigma*(T1**4-T3**4); #net heat transfer from jet to shield,W/m
#to find the radiation from the inside of the shield to the room, we need Fshield-room.since any radiation passing out of the slit goes to the room,we can find this view factor equating view factors to the room with view factors to the slit.
Aslit=math.pi*D2*Fjr; #Slit's area, m^2
Fsj=math.pi*D1/Aslit*Fjr; #fraction of energy of view of slit occupied by jet
Fss=1-Fsj; #fraction of energy of view of slit occupied by shield.
Fsr=Aslit*Fss/(math.pi*D2*Fjs); #fraction of energy of view of shield occupied by room
Qnsr=math.pi*D2*Fjs*sigma*Fsr*(T3**4-T2**4); #net heat transfer from shield to room, W/m
#Result
print "Heat transfer from jet to room through the slit is :",round(Qnjr,2),"W/m\n"
print "Heat transfer from the jet to shield is :",round(Qnjs,2)," W/m\n"
print "Heat transfer from inside of shield to the room is :",round(Qnsr,2),"W/m\n"
print "Both the jet and the inside of the shield have relatively small view factors to the room, so that comparatively little heat is lost through the silt \n"
from __future__ import division
import math
#Variables
T1=373; #temp. of shield,K
T2=1473; #temp of heater,K
h=0.2 ; #height of disc heater,m
r1=0.05; #smaller radius of heater,m
r2=0.1; #larger radius of heater,m
R1=r1/h ; #factors necessary for finding view factor
R2=r2/h ; #factors necessary for finding view factor
sigma=5.67*10**-8; #Stefen-Boltzman constant
#Calculations
X=1+(1+R2**2)/R1**2; #factors necessary for finding view factor
Fht=0.5*(X-math.sqrt(X**2-4*(R2**2/R1**2))); #view factor
Fhs=1-Fht; #view factor of heater occupied by shield
Qnhs=math.pi*r2**2*Fhs*sigma*(T2**4-T1**4)/4; #Net heat transfer from the heater to shield
#Result
print "Net heat transfer from the heater to shield is : ",round(Qnhs)," W\n"
from __future__ import division
import math
#Variables
h=0.2 ; #height of disc heater,m
r1=0.05; #smaller radius of heater,m
r2=0.1; #larger radius of heater,m
Fhs=0.808; #view factor of heater occupied by shield
#Calculations
As=math.pi*(r1+r2)*math.sqrt(h**2+(r2-r1)**2); #area of frustrum shaped shield,m**2
Ah=math.pi/4*r2**2; #heater area,m**2
Fsh=Ah/As*Fhs; #view factor of shield occupied by heater
#Result
print "View factor of shield occupied by heater is :",round(Fsh,3),"\n"
from __future__ import division
#Variables
F1342=0.245; #view factor of 1and 3 occupied by 2 and 4
F14=0.2; #view factor of 1 occupied by 4
#Calculations
F12=F1342-F14; #view factor of 1 occupied by 2
#Results
print "View factor of 1 occupied by 2 is :",F12,"\n"
from __future__ import division
import math
from sympy import *
#Variables
T1=80; #temp.of liquid nitrgen,K
T2=230; #temp of chamber walls,K
D1=0.00635; #outer diameter of steel, m
D2=0.0127; #diameter of 2nd steel tube, m
e1=0.2 ; #emissivity 0f steel
sigma=5.67*10**-8; #Stefen-Boltzman constant
#Calculations
x = Symbol('x');
#the nitrogen coolant will hold the surface of the line at essentially 80 K, since the thermal ressistance of tube wall and int. convection or boiling process are small.
Qgain=math.pi*D1*e1*sigma*(T2**4-T1**4); # net heat gain of line per unit length,W/m
#with the shield , assuming that the chamber area is large compared to the shielded line.
Qgain1=math.pi*D1*sigma*(T2**4-T1**4)/(((1-e1)/e1+1)+D1/D2*(2*(1-e1)/e1+1)); #net heat gain with shield,W/m
s=(Qgain-Qgain1)/Qgain*100; #rate of heat gain reducton in percentage
T = (230**4 -0.328/(3.14*D2*e1*sigma))**(1/4) #Temp. of the shield
#Result
print "Net heat gain of line per unit length is :",round(Qgain,2)," W/m\n"
print "Rate of heat gain reducton is :",round(s,2)," percent \n"
print "Temp. of the shield is : ",round(T,2)," C\n"
from __future__ import division
from numpy import mat
from numpy.linalg import inv
from sympy import solve, symbols
#Variables
T1=250 ; #temp.of surrounding,K
l1=1; #width of strips, m
l2=2.4; #distance between strips,m
F12=0.2; #view factor of 1 occupied by 2.
#Calculations
A=mat('1 -0.14;-1, 10') ; #matrix representation for solving the linear equations, for black surroundings
B=mat('559.6;3182.5'); #matrix representation for solving the linear equations.
X=inv(A)*B;
Qn12=(X.item(0)-X.item(1))/(1/(0.9975*F12)); #net heat flow from 1 to 2 for black surroundings.
#since each strip loses heat to the surrounding,Qnet1, Qnet2 and Qnet1-2 are different.
# three equations will be
#(1451-B1)/2.33 = (B1-B2)/(1/0.2)+(B1-B3)/(1/0.8)......(1)
#(459.B2) = (B2-B1)/(1/0.2)+(B2-B3)/(1/0.8)............(2)
#0=(B3-B1)/(1/0.8)+(B3-B2)/(1/0.8).....................(3)
#solving these equations, we get the values of B1,B2 and B3.
B1=987.7 #heat flux by surface 1.
B2=657.4 #heat flux by surface 2.
B3=822.6 #heat flux by surface 3.
qn12=(B1-B2)/(1/F12)+(B1-B3)/(1/(1-F12));# net heat transfer between 1 and 2 if they are connected by an insulated diffuse reflector between the edges on both sides.
#Results
print "Net heat transfer between 1 and 2 if the surroundings are black is :",round(Qn12,2),"W/m^2\n"
print "Net heat transfer between 1 and 2 if they are connected by an insulated diffuse reflector between the edges on both sides is : ",qn12," W/m^2\n"
x=symbols('x');
x=solve(sigma*(x**4)-822.6,x); #Solving for Temp. of the reflector.
print "Temperature of the reflector is : ",round(x[1],2)," K\n"
from __future__ import division
from numpy import array,dot
from numpy.linalg import inv
#Variables
T1=773; #temp.of two sides of duct,K
T2=373; #temperature of the third side,K
e1=0.5; #emissivity of stainless steel
e2=0.15; #emissivity of copper
a=5.67*10**-8; #stefan constant
f12=0.4; #view factor of 1 occupied by 2.
f21=0.67; #view factor of 2 occupied by 1
f13=0.6; # view factor of 1 occupied by 3
f31=0.75; #view factor of 3 occupied by 1
f23=0.33; #view factor of 2 occupied by 3
f32=0.25; #view factor of 2 occupied by 3
#Calculations
A=array(([1, (-1+e2)*f12, (e2-1)*f13],[(-1*e1*f21), 1, (e1*-1*f23)],[(e1*-1*f31), (e1*-1*f32), 1]));#matrix method to solve three equations to find radiosity
B=array(([e2*a*T2**4],[e1*a*T1**4],[e1*a*T1**4])); #matrix method to solve three equations to find radiosity
X=dot(inv(A),B); #solution of above matrix method
Qn1=0.5*e2/(1-e2)*(a*T2**4-X.item(0)); #net heat transfer to the copper base per meter of the length of the duct,W/m
Qn2=Qn1+2.6;
#Result
print "Net heat transfer to the copper base per meter of length of the duct is : ",round(Qn2,2),"W/m ,the -ve sign indicates that the copper base is gaining heat.\n"
from __future__ import division
#Variables
T1=1473 ; #temp.of gas,K
T2=573 ; #temp of walls,K
D1=0.4; #diameter of combustor, m
a=5.67*10**-8; #stefan boltzman coefficient,W/(m**2*K**4)
#we have Lo=D1=0.4m, a total pressure of 1 atm., pco2=0.2 atm. , using figure, we get eg=0.098.
eg=0.098; #total emittance
#Calculations
ag=(T1/T2)**0.5*(0.074); #total absorptance
#now we can calculate Qnetgas to wall. for these problems with one wall surrounding one gas, the use of the mean beam length in finding eg and ag accounts for all geometric effects and no view factor is required.
Qngw=math.pi*D1*a*(eg*T1**4-ag*T2**4)/1000; #net heat radiated to the walls,kW/m
#Result
print "Net heat radiated to the walls is : ",round(Qngw,2),"KW/m\n"
#end
from __future__ import division
from sympy import solve,symbols
#Variables
T1=291; #temp.of sky,K
T2=308; #temp of air,K
e1=0.9; #emissivity 0f black paint
h=8; #heat transfer coefficient,W/(m**2*K)
P=600 ; #Solar radiation of roof, W/m**2
aacr=0.26; #heat flux,W/m**2
ablk=0.9; #heat flux,W/m**2
sigma=5.67*10**-8; #Stefen-Boltzman constant
#Calculations-1
#heat loss from the roof to the inside of the barn will lower the roof temp., since we dont have enough information to evaluate the loss, we can make an upper bound on roof temp. by assuming that no heat is transferred to the interior.
T=symbols('T');
T=solve(((e1*sigma*(T**4-T1**4)+h*(T-T2))-ablk*P),T);
Tn=T[1]
#Result-1
print "For non-sensitive black paint, temp. of roof is:",round(Tn)-273,"degree C \n"
#Calculations-2
#for white acrylic paint, by using table, e=0.9 and absorptivity is 0.26,Troof
T=symbols('T');
T=solve(((e1*sigma*(T**4-T1**4)+h*(T-T2))-0.26*P),T);
Tn=T[1]
#Result-2
print "For acrylic paint temp. of the root is :",round(Tn)-273,"degree C \n\nThe white painted roof is only a few degrees warmer than the air.\n"
#end