# Heating of a copper ball
import math
# Variables
#(a)
#density of the copper ball
rho = 8950 #[kg/m**3]
#Diameter of the copper ball
D = 0.1 #[m]
#mass of the ball
m = rho*(math.pi/6)*(D**3) #[kg]
#Specific Heat of copper
Cp = 0.395 #[kJ/Kg/m**3]
#Initial Temperature
T1 = 100 #[degree C]
#Final Temperature
T2 = 150 #[degree C]
# Calculations and Results
# The amount of heat transferred to the copper ball is simply the change in it's internal energy and is given by
# Energy transfer to the system = Energy increase of the system
Q = (m*Cp*(T2-T1));
print "Heat needs to be transferred to the copper ball to heat it from 100 to 150 degree celsius is ",Q,"kJ"
#b
#Time interval for which the ball is heated
dT = 1800 #[seconds]
Qavg = (Q/dT)*1000 #[W]
print "Average Heat Transfer by the iron ball is ",Qavg,"W"
#(c)
#Heat Flux
qavg = (Qavg/(math.pi*(D**2))) #[W/m**2]
print "Average flux is",qavg,"W/m**2"
# Heating of water in an Electric Teapot
# Variables
#Mass of liquid water
m1 = 1.2
m2 = 0.5 #[Kg]
#Initial Temperature
t1 = 15 #[Degree Celcius]
#Final Temperature
t2 = 95 #[Degree Celcius]
#Specific heat of water
cp1 = 4.186 #[kJ/kG.K]
#Specific heat capacity of teapot
cp2 = .7 #[]
# Calculations
Em = (m1*cp1*(t2-t1))+(m2*cp2*(t2-t1)) #[kJ]
#Rating of Electric Heating Equipment
Em1 = 1.2 #[kJ/s]
dt = (Em/Em1)/60 #[seconds]
# Results
print "Time needed for this heater to supply ",Em,"kJ","of heat is",round(dt),"minutes"
# Heat Loss from Heating Ducts in a Basement
# Variables
T_in = 60+273 #Temperature of hot air while entering the duct[K]
T_out = 54+273 #Temperature of hot air while leaving the duct[K]
T_avg = (T_in+T_out)/2 #Average temperature of air[K]
# Calculations and Results
Cp = 1.007 #[kJ/kg]
print "The constant pressure specific heat of air at the average temperature of",T_avg,"K is",Cp,"kJ/kg"
P = 100 #Pressure of air while entering the duct[kPa]
R = 0.287 #Universal Gas Consmath.tant[kPa.(m**3/kg).K]
v = 5 #Average velocity of flowing air[m/s]
neta = 0.8 #Efficiency of natural gas furnace
ucost = 1.60 #Cost of natural gas in that area[$/therm],where 1therm = 105,500kJ
#Solution;-
rho = P/(R*T_in) #The density of air at the inlet conditions is[kg/m**3]
Ac = 0.20*0.25 #Cross sectional area of the duct[m**2]
m_ = rho*v*Ac #[kg/s]
print "mass flow rate of air through the duct is",m_,"kg/s"
Q_loss = m_*Cp*(T_in-T_out) #[kJ/s]
print "The rate of heat loss by the air is",Q_loss,"kJ/s"
cost = (Q_loss*3600)*(ucost)*(1./105500)*(1/neta) #[$/h]
print " Cost of heat loss to the home owner is" ,"$",cost,"per hour"
# Electric Heating of a House at High Elevation
# Variables
#(a)
t1 = 10+273 #Initial temperature of house[K]
t2 = 20+273 #Temperature after turning on heater[K]
# Calculations and Results
tavg = (t1+t2)/2 #Average temperature[K]
cp = 1.007 #[kJ/kg.K]
cv = .720 #[kJ/kg.K]
print "The specific heat capacities of air","at the average temperature of",tavg,"K",cv,"and",cp,"kJ/kg.K"
A = 200 #The floor area[m**2]
h = 3 #Height of room[m]
V = A*h #Volume of the air in the house[m**3]
P = 84.6 #Pressure [kPa]
R = 0.287 #Universal gas consmath.tant[kPa.m**3/kg.K]
m = (P*V)/(R*t1) #[kg]
print "Mass of air in the room is",m,"kg"
Eincv = m*cv*(t2-t1);
print "The amount of energy transferred to air at constant volume is ",Eincv,"kJ"
u_cost = 0.075 #Unit math.cost of energy[$/kWh]
Cost1 = (Eincv*u_cost)/(3600) #[$]
print "Cost of Energy is $",Cost1
#(b)
Eincp = m*cp*(t2-t1) #[kJ]
print "The amount of energy transferred to air at constant is ",Eincp,"kJ"
Cost2 = (Eincp*u_cost)/3600 #[$]
print "Cost of Energy is $",Cost2
# The cost of Heat loss through a Roof
# Variables
k = 0.8 #The thermal conductivity of the roof[W/m.degree.C]
A = 6*8 #Area of the roof[m**2]
t1 = 15 #temperature of inner surface roof[degree C]
t2 = 4 #temperature of outer surface roof[degree C]
L = 0.25 #thickness of roof[m]
# Calculations and Results
Q_ = k*A*(t1-t2)/L #[W]
print "The steady rate of heat transfer through the roof is",Q_,"W"
#(b)
dt = 10. #time period[h]
Q = Q_*dt/1000 #[kWh]
u_cost = 0.08 #Unit math.cost of energy[$/kWh]
Cost = Q*u_cost #[$]
print "The amount of heat lost through the roof",Q,"kWh","and its cost is $",Cost
# Measuring the Thermal Conductivity of a Material
# Variables
V = 110 #Voltage diffrence b/w thermocouples[V]
I = 0.4 #Current drawn by thermocouples[A]
# Calculations and Results
We = V*I #[W]
print "The electrical power consumed by the resismath.tance heater and converted to heat is",We,"W"
q_ = We/2 #[W]
print "The rate of heat flow through each sample",q_,"W"
dT = 15 #Temperature drop in the direction of heat flow[degree C]
l = .03 #length for which temperature change is measured[m]
D = .05 #diameter of cylinder[m]
a = (math.pi*D**2)/4 #Cross-sectional area of the cylinder[m**2]
K = (q_*l)/(a*dT) #[W/m.degreeC]
print "The thermal conductivity of the sample is",K,"W/mC"
# Conversion between SI and English Units
# Variables
W_to_btu_p_h = 3.41214 #Conersion from Watt to btu per hour[btu/h]
m_to_ft = 3.2808 #Conversion from meter to english unit feet[ft]
deg_C_to_deg_F = 1.8 #Conversion from degree Celcius to degree Farenhiet
# Calculations
W_per_m_deg_C = W_to_btu_p_h/(m_to_ft*deg_C_to_deg_F) #Conversion factor for 1W/m.degree Celcius[Btu/h.ft.degree Farenhiet]
k_brick = 0.72*W_per_m_deg_C #[Btu/h.ft.degree Farenhiet]
# Results
print "The thermal conductivity of the brick in English units is",k_brick,"Btu/h.ft.degree Farenhiet"
# Measuring Convection Heat Transfer coefficient
# Variables
T_ambient = 15 #Temperature of room[degree Celcius]
T_surface = 152 #Temperature of surface of wire[degree Celcius]
L = 2 #Length of wire[m]
D = 0.003 #Diameter of wire[m]
V = 60 #Voltage drop across the current wire[Volts]
I = 1.5 #Current flowing in the wire[amp]
# Calculations and Results
#When steady conditions are reached, the rate of heat loss from the wire equals the rate of heat generation in the wire as a result of resismath.tance heating
Q_ = V*I #[W]
print "The rate of heat generated in the wire as a result of resismath.tance heating is",Q_,"W"
As = math.pi*D*L #Surface Area of the wire[m**2]
#Using Newton's Law of Cooling
#and assuming all heat loss in wire to occur by convection
h = Q_/(As*(T_surface-T_ambient)) #[W/m**2.degree Celcius]
print "The convection Heat Transfer coefficient is",h, "W/m**2.degree Celcius"
# Radiation Effect on Thermal Comfort
# Variables
T_room = 22+273 #Temperature fo room[K]
T_wntr = 10+273 #Average Temperature of inner surfaces of walls,floors and the cieling in winter[K]
T_smmr = 25+273 #Average Temperature of inner surfaces of walls,floors and the cieling in summer[K]
T_outr = 30+273 #Average outer surface temperature of the person[K]
A = 1.4 #The math.exposed surface area[m**2]
e = 0.95 #Emissivity of person
# Calculations
sigma = 5.67*(10**(-8)) #Stefan's consmath.tant
Q_rad_wntr = e*sigma*A*((T_outr**4)-(T_wntr**4)) #[W]
Q_rad_smmr = e*sigma*A*((T_outr**4)-(T_smmr**4)) #[W]
# Results
print "The net rates of radiation heat transfer from the body to the surrounding walls \
,ceiling, and floor in winter and summer are respectively",round(Q_rad_wntr),"and",Q_rad_smmr,"W"
# Heat Loss from a Person
# Variables
T_room = 20+273 #Temperature of breezy room[K]
T_outr = 29+273 #Average outer surface temperature of the person[K]
As = 1.6 #math.exposed Surface Area[m**2]
h = 6 #Convection Heat transfer coefficient[W/m**2.K]
e = 0.95 #Emissivity of person
# Calculations and Results
sigma = 5.67*(10**(-8)) #Stephan's consmath.tant[W/m**2.degree Celcius]
Q_conv = h*As*(T_outr-T_room) #[W]
print "Rate of convection heat transfer from the person to the air in the room is",Q_conv,"W"
Q_rad = e*sigma*As*((T_outr**4)-(T_room**4)) #[W]
print "The rate of convection heat transfer from the person to the surrounding walls,cieling,fllor is",Q_rad,"W"
Q_total = Q_conv+Q_rad #[W]
print "The rate of total heat transfer from the body is ",round(Q_total),"W"
# Heat transfer between two Isothermal Plates
# Variables
T1 = 300
T2 = 200. #Temperatures of two large parallel isothermal plates[K]
L = 0.01 #dismath.tance between both plates[m]
e = 1 #Emissivity of plates
A = 1 #Surface area of plates[m**2]
# Calculations and Results
T_avg = (T1+T2)/2 #Average temperature[K]
sigma = 5.67*(10**(-8)) #Stefan's consmath.tant[W/m**2.K**4]
#Solution (a)[space between plates is filled with air]
k_air = 0.0219 #The thermal conductivity of aair at the average temperature[W/m.K]
Q_cond = k_air*A*(T1-T2)/L #[W]
Q_rad = e*sigma*A*((T1**4)-(T2**4)) #[W]
print "The rates of conduction and radiation heat transfer between the plates through\
the air layer are respectively",Q_cond,"and",round(Q_rad),"W"
Q_total_a = Q_cond+Q_rad #[W]
print ("W",round(Q_total_a),"Net rate of heat transfer is")
print ("The heat transfer rate in reality will be higher because of the natural convection currents that are likely to occur in the air space between the plates")
#Solution (b)[space between the plates is evacutaed]
print "when the air space b/w the plates is evacuted there is no conduction or convection, \
and the only heat transfer between the plates will be by radiation. "
print ("Therefore"),
Q_total_b = Q_rad #[W]
print "Net rate of heat transfer is",round(Q_total_b),"W"
#Solution (c)[space between the plates is filled with urethane insulation]
k_insu = 0.026 #At average temperature thermal conductivity of urethane insulation [W/m.K]
print ("An opaque solid material placed b/w the two plates blocks direct radiation heat\
transfer between the plates")
Q_cond_c = k_insu*A*(T1-T2)/L #[W]
Q_total_c = Q_cond_c #[W]
print "The net rate of heat transfer through the urethane insulation is",round(Q_total_c),"W"
#Solution (d)[the dismath.tance between the plates is filled with superinsulation]
k_super = 0.00002 #At average temperature thermal conductvity of superinsulation[W/m.K]
print ("The layers of superinsulation prevent any direct radiation heat transfer between the plates")
Q_cond_d = k_super*A*(T1-T2)/L #[W]
Q_total_d = Q_cond_d #[W]
print "The net rate of heat transfer through the layer of superinsulation is",Q_total_d,"W"
# Heating of a Plate by Solar Energy
# Variables
a = 0.6 #absorptivity of math.exposed surface of plate
q_incident = 700 #Rate at which solar radiation incident on the plate [W/m**2]
T_surr = 25+273 #Surrounding air temperature[K]
h = 50 #Combined radiation and convection heat transfer coefficient[W/m**2.K]
# Calculations
#Temperature keeps on increamath.sing till a point comes at which the rate of heat loss from the plate equals the rate of solar energy absorbed, and the temperature of the plate no longer changes
T_surface = T_surr+(a*(q_incident)/h) #[K]
# Results
print "The plate surface temperature is",T_surface-273,"degree Celcius"
from scipy.optimize import fsolve
import math
# Non-linear equation in two variable
#x1 = x, x2 = y
def f2(x):
f = [0,0]
f[0] = x[0]-x[1]-4;
f[1] = x[0]**2+x[1]**2-x[0]-x[1]-20;
return f
#To get the desired output assign an initial value such as x0 = [1,1], [xs,fxs,m] = fsolve(f2,x0')
#To get the desired output assign an initial value such as
x0 = [1,1]
f = fsolve(f2,x0)
print f