In [1]:

```
# Heat Loss through a Wall
import math
#assumptions:-
#1)Heat transfer through the wall is steady
#2)Heat transfer is one-imensional
# Variables
k = 0.9 #[W/m.K]
print "The thermal conductivity is given to be",k,"W/m.K"
# Calculations and Results
#Heat transfer through the wall is by conduction
A = (3*5) #[m**2]
print "The area of the wall is",A,"m**2"
T1 = 16 #temperature of inner wall[degree Celcius]
T2 = 2 #Temperature of Outer wall[degree Celcius]
delta_T = T1-T2 #Temperature Gradient[degree Celcius]
L = 0.3 #Length of wall along which heat is being transferred[m]
R_wall = L/(k*A) #[degree Celcius/W]
print "Thermal Resistnace offered by the wall is",R_wall,"degree Celicus/W"
Q_ = (delta_T/R_wall) #[W]
print "The steady rate of heat transfer through the wall is ",Q_,"W"
```

In [2]:

```
import math
# Heat Loss through a Single Pane Window
#Assumptions :-
#1)Heat transfer through the window is steady
#2)Heat transfer through the wall is one dimensional
# Variables
k = 0.78 #[W/m.K]
print "The thermal conductivity is given to be",k,"W/m.K"
L = 0.008 #Thickness of glass window[m]
A = (0.8*1.5) #Area of the window[m**2]
T_1 = 20 #Temeprature of inner surface of glass window[dgree Celcius]
T_2 = -10 #Temeprature of outer surface of glass window[dgree Celcius]
h_in = 10 #Heat transfer coefficient on the inner surface of the window[W/m**2]
h_out = 40 #Heat transfer coefficient on the outer surface of the window[W/m**2]
# Calculations and Results
#Convection Resistance
R_conv1 = 1/(h_in*A) #[degree Celcius/W]
R_conv2 = 1/(h_out*A) #[degree Celcius/W]
#Conduction Resismath.tance
R_cond = L/(k*A) #[degree Celcius/W]
#Net Resismath.tance are in series
R_total = R_conv1+R_conv2+R_cond #[degree Celcius/W]
print "The total Resismath.tance offered by glass window",R_total,"degree Celcius/W"
Q_ = (T_1-T_2)/R_total #[W]
print "Steady rate of Heat Transfer through the window is",Q_,"W"
#Knowing the rate of Heat Transfer
T1 = T_1-(Q_*R_conv1) #[degree Celciusthe inner surface temperature of the window glass can be determined from]
print "Inner Surface Temperature of the window glass",T1,"degree Celcius"
```

In [3]:

```
import math
# Heat Loss through double pane windows
# Variables
k_g = 0.78 #Thermal conductitvity of glass [W/m.K]
k_a = 0.026 #Thermal conductivity of air space[W/m.K]
L_g = .004 #Thickness of glass layer[m]
L_a = 0.01 #Thickness of air space[m]
h_in = 10 #ConvectionHeat transfer coefficient on the inner surface of the window[W/m**2]
h_out = 40 #ConvectionHeat transfer coefficient on the outer surface of the window[W/m**2]
T_1 = 20 #Outer wall Temperature [degree Celcius]
T_2 = -10 #Inner wall Temperature [degree Celcius]
# Calculations
A = (0.8*1.5) #Area of glass window[m**2]
#Convection Resistances
R_conv1 = 1/(h_in*A) #Due to convection heat transfer between inner atmosphere and glass[degree Celcius/W]
R_conv2 = 1/(h_out*A) #Due to convection heat transfer between outer atmosphere and glass[degree Celcius/W]
#Conduction Resistances
R_cond1 = L_g/(k_g*A) #Due to conduction heat transfer through the glass[degree Celcius/W]
R_cond2 = R_cond1 #Glass Medium is seperated by air spac hence two glass mediums are created[degree Celcius/W]
R_cond3 = L_a/(k_a*A) #Due to conduction heat transfer through the air space[degree Celcius/W]
#Net Resistance offered by window is the sum of all the individual resistances written in the oreder of their occurence
R_total = R_conv1+R_cond1+R_cond2+R_cond3+R_conv2 #[degree Celcius/W]
# Results
print "The net resismath.tance offered is",R_total,"degree Celcius/W"
Q_ = (T_1-T_2)/R_total #[W]
print "The steady rate of Heat transfer through the window is",Q_,"W"
#Inner surface temperature of the window is given by
T1 = T_1-(Q_*R_conv1) #[degree Celcius]
print "Inner Surface Temperature of the window is",T1,"degree Celcius"
```

In [2]:

```
import math
# Equivalent Thickness for Contact Resistance
# Variables
k = 237 #Thermal conductivity of aluminium[W/m.K]
L = 0.01 #Thickness of aluminium plate[m]
hc = 11000 #Thermal contact conducmath.tance[W/m**2.K]
# Calculations and Results
Rc = 1./hc #[m**2.K/W]
print ("Since thermal contact resismath.tance is the inverse of thermal contact conductance")
print "Hence Therml contact Resistance is",Rc,"m**2.K/W"
#For a unit surface area, the thermal resismath.tance of a flat plate is defined as
R = L/k;
#Equivalent thickness for R = Rc
L = k*Rc #[m]
print "Equivalent thickness is",(100*L),"cm"
```

In [6]:

```
import math
# Contact Reismath.tance of Transistors
# Variables
k = 386 #Thermal Conductivity of Copper[W/m.K]
hc = 42000 #Contact Conducmath.tance coreesponding to copper-aluminium interface for the case of 1.17-1.4 micron roughness and 5MPa[pressure, which is close to given to what we have[W/m**2.K]
Ac = .0008 #Contact area b/w the case and the plate[m**2]
A = 0.01 #Plate area for each resistor[m**2]
L = 0.01 #Thickness of plate[m]
ho = 25 #Heat tranfer coefficient for back surface
T_1 = 20 #Ambient Temperature[degree Celcius]
T_2 = 70 #Maximum temperature of case[degree Celcius]
# Calculations
#Resistances Offered
R_interface = 1./(hc*Ac) #Resismath.tance offered at the copper aluminium interface[degree Cecius/W]
R_plate = L/(k*A) #conduction resismath.tance offered by coppr plate[degree Cecius/W]
R_conv = 1./(ho*A) #Convection resismath.tance offerd by back surface of camath.sing[degree Cecius/W]
R_total = R_interface+R_plate+R_conv #[degree Cecius/W]
# Results
print "The total thermal Tesistance is",R_total,"degree Cecius/W"
Q_ = (T_2-T_1)/R_total #[W]
print "The rate of heat transferred is",Q_,"W"
delta_T = Q_*R_interface #[degree Celcius]
print "The temperature jump at the interface is given by",delta_T,"degree Celcius"
```

In [7]:

```
import math
# Heat Loss through a Composite Wall
# Variables
#We consider a 1m deep and 0.25 m high portion of the wall math.since it is representative of the entire wall
#Assuming any cross-section of the wall normal to the x-direction to be isothermal
k_b = 0.72 #thermal conductivity of bricks[W/m.K]
k_p = 0.22 #thermal conductivity of plaster layers[W/m.K]
k_f = 0.026 #thermal conductivity of foam layers[W/m.K]
T_in = 20 #Indoor Temperature[dgeree Celcius]
T_out = -10 #Outdoor Temperature[dgeree Celcius]
h_in = 10 #Inner heat transfer coefficient[W/m**2.K]
h_out = 25 #Outer heat transfer coefficient[W/m**2.K]
L_f = 0.03 #Thickness of foam layer[m]
L_p = 0.02 #Thickness of plaster[m]
L_b = 0.16 #Thickness of brick wall[m]
L_c = 0.16 #Thickness of central plaster layer[m]
A1 = (0.25*1) #[m**2]
A2 = (0.015*1) #[m**2]
A3 = (0.22*1) #[m**2]
# Calculations
#Resistances offered:-
R_in = 1/(h_in*A1) #Resismath.tance to conevction heat transfer from inner surface[degree Celcius/W]
R1 = L_f/(k_f*A1) #Conduction Resismath.tance offered by outer foam layer[degree Celcius/W]
R2 = L_p/(k_p*A1) #Conduction Resismath.tance offered by Outer side Plaster Wall[degree Celcius/W]
R6 = R2 #Conduction Resismath.tance offered by Inner side Plaster Wall[degree Celcius/W]
R3 = L_c/(k_p*A2) #Conduction Resismath.tance offered by one side central Plaster wall[degree Celcius/W]
R5 = R3 #Conduction Resismath.tance offered by other side central Plaster wall[degree Celcius/W]
R4 = L_b/(k_b*A3) #Conduction Resismath.tance offered by Brick Wall[degree Celcius/W]
R_out = 1/(h_out*A1) #Convection Resismath.tance from outer surface[degree Celcius/W]
#R_in,R1,R2,R6,R_out are connected in series
#R3,R4,R5 are connected in parallel
R_mid = 1/((1/R3)+(1/R4)+(1/R5)) #Effective Parrallel Resismath.tance
R_total = (R_in+R1+R2+R_mid+R6+R_out) #[degree Celcius/W]
# Results
print "Net Resismath.tance offered is",R_total,"degree Celcius/W"
Q_ = (T_in-T_out)/R_total #[W]
print "The steady rate of heat transfer through the wall is",Q_,"W"
Q_p = Q_/A1 #[W/m**2]
print "Heat Transfer per unit area is",Q_p,"W/m**2"
A_total = 3*5 #Total Area of wall[m**2]
Q_total = Q_p*A_total #[W]
print "Thr rate of heat transfer through the entire wall",Q_total,"W"
```

In [9]:

```
import math
# Heat Transfer to a Spherical Container
#Radiation effect is being considered. For the black math.tank emissivity = 1
# Variables
k = 15 #thermal conductivity of stainless steel[W/m.degree Celcius]
T_ice = 0+273 #temeperature of iced water[K]
T_tank = 22+273 #temperature of math.tank stored at room temperature[K]
h_in = 80 #Heat Transfer Coefficient at the inner surface of the math.tank[W/m**2.degree Celcius]
h_out = 10 #Heat Transfer Coefficient at the outer surface of the math.tank[W/m**2.degree Celcius]
heat_f = 333.7 #Heat of fusion of water at atmospheric pressure[kJ/kg]
e = 1 #emissivity of math.tank
sigma = 5.67*(10**(-8)) #Stefan's [W/m**2.K**4]
D1 = 3 #inner diameter[m]
D2 = 3.04 #Outer diameter[m]
# Calculations and Results
#a)
A1 = (math.pi)*(D1**2) #Inner Surface area of the math.tank[m**2]
A2 = (math.pi)*(D2**2) #outer Surface area of the math.tank[m**2]
print ("The radiation heat transfer coefficient is given by ")
print ("h_rad = e*sigma*((T2**2)+(T_tank**2))*(T2+T_tank)")
print ("But we dont know the outer surface temperature T2 of the math.tank. hence we assume a T2 value")
print ("since heat transfer inside the math.tank is larger ")
T2 = 5+273 #[K]
print "Therefore taking T2 = ",T2,"K"
h_rad = e*sigma*((T2**2)+(T_tank**2))*(T2+T_tank) #[W/m**2.K]
print "The radiation heat transfer coefficient is determined to be",h_rad,"W/m**2.degree Celcius"
#Individual Thermal Resistances Offered
R_in = 1/(h_in*A1) #Resistance to convetion from inner side of math.tank[degree Celcius/W]
R_sphere = ((D2-D1)/2)/(4*math.pi*k*(D1/2)*(D2/2)) #Resismath.tance to conduction due to ice sphere[degree Celcius/W]
R_out = 1/(h_out*A2) #Resistance to convection from outer side of math.tank[degree Celcius/W]
R_rad = 1/(h_rad*A2) #Resistance to radiation heat transfer[degree Celcius/W]
#R_out and R_rad are in parallel connection,
R_eq = (1/((1/R_out)+(1/R_rad))) #[degree Celcius/W]
#R_in,R_sphere and R_eq are connected in series
R_total = R_in+R_sphere+R_eq #[degree Celcius/W]
Q_ = (T_tank-T_ice)/R_total #[W]
print "The steady rate of heat transfer to the iced water is",Q_,"W"
print ("We determine outer surface temperature to check the validity of assumption")
T2 = T_tank-(Q_*R_eq) #[K]
print T2,"K"
print ("which is sufficiently close to 278 K")
#b)
delta_t = 24 #Time duration[h]
Q = Q_*delta_t*(3600/1000) #[kJ]
print "The total amount of heat transfer during a 24 hour period is",Q,"kJ"
#It takes 333.7 kJ of energy to melt 1kg of ice at 0 degree Celcius
m_ice = Q/heat_f #[kg]
print "The amount of ice that will melt during 24h period is",m_ice,"kg"
```

In [10]:

```
import math
# Heat Loss through an Insulated Steam Pipe
# Variables
T_steam = 320. #[degree Celcius]
T_surr = 5. #[degree Celcius]
k_iron = 80. #Thermal conductivity of cast iron[W/m.degree Celcius]
k_insu = 0.05 #Thermal conductivity of glass wool insulation[W/m.degree Celcius]
h_out = 18. #Covection heat transfer coefficient outside the pipe[w/m**2.degree Celcius]
h_in = 60. #Covection heat transfer coefficient insideside the pipe[w/m**2.degree Celcius]
D_in = 0.05 #Inner diameter of pipe[m]
D_out = 0.055 #Outer diameter of pipe[m]
t = 0.03 #Thickness of insulation[m]
r = (D_out/2)+t #Effective outer radius[m]
L = 1. #Length of pipe[m]
# Calculations
#Areas of surfaces math.exposed to convection
A1 = 2*math.pi*(D_in/2)*L #Inner Area of pipe[m**2]
A2 = 2*math.pi*(r)*L #Outer Area of pipe[m**2
#Individual Thermal Resismath.tances
R_conv_in = 1/(h_in*A1) #Resismath.tance to convetion from inner surface of pipe[degree Celcius/W]
R_pipe = (math.log(D_out/D_in))/(2*math.pi*k_iron*L) #Resimath.tance to conduction through iron pipe[degree Celcius/W]
R_insu = (math.log(r/(D_out/2)))/(2*math.pi*k_insu*L) #Resismath.tance to conduction through insulation[degree Celcius/W]
R_conv_out = 1/(h_out*A2) #Resismath.tance to convetion from outer surface of insulation on pipe[degree Celcius/W]
#All resismath.tances are in series
R_total = R_conv_in+R_pipe+R_insu+R_conv_out #Total Resismath.tance[degree Celcius]
Q_ = (T_steam-T_surr)/R_total #[W]
# Results
print "The Steady rate of heat loss from the steam per m length of pipe is",Q_,"W"
delta_T_pipe = Q_*R_pipe #[degree Celcius]
delta_T_insu = Q_*R_insu #[degree Celcius]
print "The temperature drop across the pipe and the insulation is respectively" \
,delta_T_pipe,"and",delta_T_insu,"degree Celcius"
```

In [11]:

```
import math
# Heat Loss from an Insulated Electric Wire
# Variables
k_insu = 0.15 #[W/m.degree Celcius]
V = 8 #Voltage drop across wire[Volts]
I = 10 #Current flowimg through the wire[Amperes]
T_atm = 30 #Temperature of atmosphere to which wire is math.exposed[degree Celcius]
h = 12 #heat transfer coefficient[W/m**2.degree Celcius]
L = 5 #length of wire[m]
D = 0.003 #diameter of wire[m]
t = 0.002 #thickness of insulation[m]
r = (D/2)+t #Effective radius[m]
# Calculations and Results
#Rate of heat generated in the wire becomes equal to the rate of heat transfer
Q_ = V*I #[W]
print "Heat generated in the wire is",Q_,"W"
A2 = 2*math.pi*r*L #Outer surface area[m**2]
#Resistances offered
R_conv = 1/(h*A2) #Convection resismath.tance for the outer sueface of insulation[degree Celcius/W]
R_insu = (math.log(r/(D/2)))/(2*math.pi*k_insu*L) #Conduction resimath.tance for the plastic insulation[degree Celcius/W]
#Effective Resistance
R_total = R_conv+R_insu #[degree Celcius/W]
#Interface Temperature can be determined from
T1 = T_atm+(Q_*R_total) #[degree Celcius]
print "The interface temperature is",T1,"degree Celcius"
#Critical radius
r_cr = k_insu/h #[m]
print "The critical radius of insulation of the plastic cover is",r_cr*1000,"mm"
#Larger value of critical radius ensures that increamathsing the thickness
# of insulation upto critical radius will increase the rate of heat transfer
```

In [12]:

```
import math
# Maximum Power dissipation of a Transistor
# Variables
T_ambient = 25. #Ambient temperature[degree Celcius]
T_case = 85. #Maximum temperature of the case[degree Celcius]
R_case_ambient = 20. #Resismath.tance for convection b/w case and ambient [degree Celcius/W]
# Calculations
Q_ = (T_case-T_ambient)/R_case_ambient #[W]
# Results
print "The given power transistor should not be operated at power levels above",Q_,"W"
print ("if is its case temperature is not to exceed 85 degree Celcius")
```

In [13]:

```
import math
# Selecting a Heat Sink for a Transistor
# Variables
Q_ = 60. #Rate of heat transfer from given transistor at at full power[W]
T_ambient = 30. #Temperature of ambient air[degree Celcius]
T_case = 90 #Maximum temperature of case[degree Celcius]
# Calculations
R_math_sink = (T_case-T_ambient)/Q_ #[degree Celcius/W]
# Results
print "The thermal resistance b/w the transistor attached to the heat sink\
and the ambient air for the specified temperature difference is ",R_math_sink,"degree Celcius/W"
```

In [14]:

```
import math
# Effect of fins on Heat transfer from steam pipes
# Variables
k_fin = 180 #thermal conductivity of aluminium alloy fins[W/m.degree Celcius]
D_tout = 0.03 #Outer diameter of tube[m]
D_fout = 0.06 #Outer diameter of circular fins[m]
t = 0.002 #thickness of fin[m]
s = 0.003 #dismath.tance between fins attached to the tube[m]
n = 200 #number of fins per meter of tube
L = 1 #length of tube[m]
T_surr = 25 #Surrounding temperature[degree Celcius]
T_wall = 120 #Temperature of wall of the tube[degree Celcius]
h = 60 #Combined heat transfer coefficient[W/m**2.degree Celcius]
# Calculations and Results
print ("In case of no fins")
A_nf = math.pi*D_tout*L #Area of tube with no fins attached[m**2]
#Using Newton's Law of cooling
Q_nf = h*A_nf*(T_wall-T_surr) #[W]
print "Rate of heat transfer when no finis attached",Q_nf,"W"
#The efficiency of the circular fins attached to a circular tube is plotted in Fig 3.43
L_fin = (D_fout-D_tout)/2 #[m]
#In this case we have following corrected parameters
r2c = (D_fout+t)/2 #[m]
Lc = L_fin+(t/2) #[m]
Ap = Lc*t #[m**2]
r = r2c/(D_tout/2);
alpha = (Lc*math.sqrt(Lc))*math.sqrt(h/(k_fin*Ap)) #efficiency
print (alpha)
#for above value of alpha efficiency is found out from the plot in fig 3.43
neta = 0.96;
A_f = 2*math.pi*((r2c**2)-((D_tout/2)**2)) #Area of tube with fins attached to it[m**2]
Q_f_max = h*A_f*(T_wall-T_surr) #maximum rate of heat transfer[W]
Q_f = neta*Q_f_max #Heat transfer through tube with fins is efficiency times the maximum rate of heat transfer[W]
print "Heat transfer due to the finned tube",Q_f,"W"
#From unfinned portion
A_uf = math.pi*D_tout*s # Unfinned area between two consecutive fins[m**2]
Q_uf = h*A_uf*(T_wall-T_surr) # [W]
print "Heat transfer from the unfinned portion of the tube is",Q_uf,"W"
#Since there are 200 fins per meter of the tube hence 200 interfin spacing
Q_tf = n*(Q_f+Q_uf) #[W]
print "The total Heat transfer from the finned tube is",Q_tf,"W"
Q_increase = Q_tf-Q_nf #[W]
print "The increase in heat transfer from the tube per meter of\
length as a result of the addition of fins is",Q_increase,"W"
eff = Q_tf/Q_nf #Effectiveness
print "The rate of heat transfer from the steam tube increases by a factor of",eff,
print ("as a result of adding fins")
```

In [15]:

```
import math
# Heat Loss from Buried Steam Pipes
# Variables
T_esurf = 10 #Surface temperatur of earth[degree Celcius]
T_psurf = 80 #Outer surface temperature of pipe[degree Celcius]
k_soil = 0.9 #Thermal Conductivity of soil[W/m.degree Celcius]
L = 30 #Length of pipe[m]
D = 0.1 #Diameter of pipe[m]
z = 0.5 #Depth at which pipe is kept[m]
# Calculations and Results
#Calculating shape factor
if(z>(1.5*D)):
S = (2*math.pi*L)/(math.log((4*z)/D)) #[m]
print "Shape factor is",S
Q_ = S*k_soil*(T_psurf-T_esurf) #[W]
print "The steady rate of heat transfer from the pipe is",Q_,"W"
```

In [17]:

```
import math
# Heat Transfer between Hot and Cold Water pipes
# Variables
T_hot = 70. #Surface Temperature of hot pipe[degree Celcius]
T_cold = 15. #Surface Temperature of cold pipe[degree Celcius]
L = 5 #Length of both pipes[m]
D = 0.05 #Diameter of both the pipes[m]
z = 0.3 #Dismath.tance between centreline of both the pipes[m]
k = 0.75 #Thermal Conductivity of the concerte[W/m.degree Celcius]
# Calculations and Results
#Calculating Shape Factor
S = (2*math.pi*L)/(math.cosh(((4*(z**2))-(D**2)-(D**2))/(2*D*D))) #[m]
print "Shave factor for given configuration is",S,"m"
Q_ = S*k*(T_hot-T_cold) #[W]
print "The steady rate of heat transfer between the pipes becomes",Q_,"W"
```

In [18]:

```
import math
# Cost of Heat Loss through walls in winter
# Variables
R_va_insu = 2.3 #thickness to thermal conductivity ratio[m**2.degreeCelcius/W]
L1 = 12. #length of first wall of house[m]
L2 = 12. #length of second wall of house[m]
L3 = 9. #length of third wall of house[m]
L4 = 9. #length of fourth wall of house[m]
H = 3. #height of all the walls[m]
T_in = 25. #Temperature inside house[degree Celcius]
T_out = 7.; #average temperature of outdoors on a certain day[degree Celcius]
ucost = 0.075 #Unit Cost of elctricity[$/kWh]
h_in = 8.29
h_out = 34.0 #Heat transfer coefficients for inner and outer surface of the walls respectively[W/m**2.degree Celcius]
v = 24*(3600./1000) #velocity of wind[m/s]
# Calculations and Results
#Heat transfer Area of walls = (Perimeter*Height)
A = (L1+L2+L3+L4)*H #[m**2]
#Individual Resismath.tances
R_conv_in = 1/(h_in*A) #Convection Resismath.tance on inner surface of wall[degree Celcius/W]
R_conv_out = 1/(h_out*A) #Convection Resismath.tance on outer surface of wall[degree Celcius/W]
R_wall = R_va_insu/A #Conduction resismath.tance to wall[degree Celcius/W]
#All resistances are in series
R_total = R_conv_in+R_wall+R_conv_out #[degree Celcius/W]
Q_ = (T_in-T_out)/R_total #[W]
print "The steady rate of heat transfer through the walls of the house is",Q_,"W"
delta_t = 24 #Time period[h]
Q = (Q_/1000)*delta_t #[kWh/day]
print "The total amount of heat lost through the walss during a 24 hour period ",Q,"kWh/day"
cost = Q*ucost #[$/day]
print "Cost of heat consumption is $",cost,"per day"
```

In [19]:

```
import math
# The R-value of a Wood Frame Wall
# Variables
f_area_insu = 0.75 #area fraction for the insulation section
f_area_stud = 0.25 #area fraction for the stud
R_bstud = 3.05 #Total unit thermal resismath.tance of section between studs[m**.degree Celcius/W]
R_atstud = 1.23 #Total unit thermal resismath.tance of section at studs[m**.degree Celcius/W]
P = 50 #Perimeter of the building[m]
H = 2.5 #height of the walls[m]
T_in = 22 #Temperature inside the walls[degree Celcius]
T_out = -2 #Temperature outside the walls[degree Celcius]
# Calculations and Results
U_bstud = 1/R_bstud #[W/m**2.degree Celcius]
U_atstud = 1/R_atstud #[W/m**2.degree Celcius]
Total_U = (f_area_insu*U_bstud)+(f_area_stud*R_atstud) #[W/m**2.degree Celcius]
print "Overall U factor is",Total_U,"W/m**"
print "Overall unit thermal Resistance is",(1/Total_U),"degree Celcius.m**2/W"
#/Since glazing constitutes 20% of the walls,
A_wall = (0.80)*P*H #[m**2]
Q_ = Total_U*A_wall*(T_in-T_out) #[W]
print "The rate of heat loss through the walls under design conditions is",Q_,"W"
#Answer is slighthly different from book because of no of digits after decimal pont used here is quite large
```

In [20]:

```
import math
# The R value of a Wall with Rigid Foam
# Variables
#using values from previous
R_old = 2.23 #AS written in book[m**2.degree Celcius/W]
#R value of of the fibreboard and the foam insulation, respectively
R_removed = 0.23 #[m**2.degree Celcius/W]
R_added = 0.98 #[m**2.degree Celcius/W]
# Calculations
R_new = R_old-R_removed+R_added #[m**2.degree Celcius/W]
increase = ((R_new-R_old)/R_old)*100;
# Results
print "Old R value is",R_old,"m**2.degree Celcius/W"
print "New R value is",R_new,"m**2.degree Celcius/W"
print "Percent increase in R-value",increase
```