import math
# Variables
# given
id_ = 2.067; #[in] - inside diameter
t = 0.154; #[in] - wall thickness
od = id_+2*t; #[in] - outer diameter
a = 1.075; #[in**2] - wall sectional area of metal
A = a*(1./144); #[ft**2] - wall sectional area of metal in ft**2
deltaz = 5./12; #[ft] - length of transfer in z direction
T2 = 10+273.15; #[K] - temperature at the top
T1 = 0+273.15; #[K] - temperature at the bottom
q = -3.2; #[Btu/hr] - heat transferred
# Calculations
deltaT = (T2-T1)+8; #[degF]
k = round(-(q/A)/(deltaT/deltaz),2);
# Results
print "Thermal conductivity = %.2f Btu h**-1 ft**-1 degF**-1"%(k);
Alm = round((2*math.pi*deltaz*((od-id_)/(2*12)))/math.log(od/id_),3); #[ft**2] log-mean area
kincorrect = round(k*(A/Alm),3);
print "kincorrect = %.3f Btu h**-1 ft**-1 degF**-1 "%(kincorrect);
print "The error is a factor of %.1f"%(32.4)
import math
# Variables
# given
T1 = 0.; #[degC]
T2 = 10.; #[degC]
km = 17.17; #[W/m*K]
l = 1.; #[m]
r2 = 1.1875;
r1 = 1.0335;
deltaT = T1-T2;
# Calculations
# umath.sing the formula Qr = -km*((2*pi*l)/ln(r2/r1))*deltaT;
Qr = -km*((2*math.pi*l)/math.log(r2/r1))*deltaT;
# Results
print "Heat loss = %.0f W \nThe plus sign indicates that the heat flow is radially out from the center"%(Qr);
# Variables
# given
km = 9.92; #[Btu/h*ft*degF]
Alm = round(0.242*(12./5),3); #[ft**2]
T1 = 0.; #[degC]
T2 = 10.; #[degC]
deltaT = (T1-T2)*1.8; #[degF]
r2 = 1.1875;
r1 = 1.0335;
deltar = round((r2-r1)/12,3); #[ft]
# Calculations
# using the formula Qr/Alm = -km*(deltaT/deltar)
Qr = (-km*Alm*(deltaT/deltar));
# Results
print " qr by log-mean area method = %.0f Btu/h"%(Qr);
# in SI units
Alm = 0.177; #[m**2]
T1 = 0; #[degC]
T2 = 10; #[degC]
km = 17.17; #[W/m*K]
r2 = 1.1875;
r1 = 1.0335;
deltaT = T1-T2;
deltar = (r2-r1)*0.0254; #[m]
# umath.sing the same formula
Qr = (-km*(deltaT/deltar))*Alm;
print " qr in SI units = %.0f W"%(Qr);
# Note : Answers are wrong in book. Please calculate manually.
from scipy.integrate import quad
# Variables
# given
x1 = 0; #[cm]
x2 = 30; #[cm]
p1 = 0.3; #[atm]
p2 = 0.03; #[atm]
D = 0.164; #[am**2/sec]
R = 82.057; #[cm**3*atm/mol*K]
T = 298.15; #[K]
# Calculations
# using the formula Nax*int(dx/Ax) = -(D/RT)*int(1*dpa)
def f4(x):
return 1./((math.pi/4)*(10-(x/6))**2)
a = quad(f4,x1,x2)[0]
def f5(p):
return 1
b = quad(f5,p1,p2)[0]
Nax = -((D/(R*T))*b)/a;
# Results
print "Mass transfer rate = %.2e mol/sec = %.2e mol/h \nthe plus sign indicates diffusion to the right"%(Nax,Nax*3600);
from sympy import *
# Variables
# given
r = Symbol('r')
ro = 0.5; #[inch] - outside radius
ro = 0.0127; #[m] - outside radius in m
Tg = 2.*10**7; #[J/m**3*sec] - heat generated by electric current
Tw = 30.; #[degC] - outside surface temperature
km = 17.3; #[W/m*K] - mean conductivity
# Calculations
# using the formula T = Tw+(Tg/4*km)*(ro**2-r**2)
T = Tw+(Tg/(4*km))*(ro**2-r**2);
# Results
print "T = ",T,
print " where r is in meters and T is in degC"
def t(r):
return Tw+(Tg/(4*km))*(ro**2-r**2);
print "At the centre line r = 0, the maximum temperature is %.1f degC. \
\nAt the outside the temperature reduces to the boundary condition value of %.2f degC.\
\nThe distribution is parabolic between these 2 limits"%(t(0),t(0.0127));
import math
# Variables
# given
r = 10.**-3; #[m] - radius
l = 1.; #[m] - length
Q = 10.**-7; #[m**3/s] - flow rate
pressure = 1.01325*10**5
sPage_No = 1.1;
pwater = 1000.; #[kg/m**3] - density of water at 4degC
# Calculations
deltap = round((145 * pressure)/14.696,-4)
pfluid = sPage_No *pwater;
mu = abs(r*-(deltap)*(math.pi*r**3))/((4*Q)*(2*l));
mupoise = mu*10;
mucentipoise = mupoise*100;
# Results
print " mu = %.3f Ns-m**-2 = %.2f poise = %.0f cP"%(mu,mupoise,mucentipoise);