# Chapter 3 : The general property balance¶

### Example 3.1 - Page No :65¶

In :
# Variables
a = 0.0006;  		 #[m**2] - area
l = 0.1;  			 #[m] - length

# (a) using the fourier law
deltax = 0.1;  		 #[m] - thickness of copper block
T2 = 100.;  		 #[degC] - temp on one side of copper block
T1 = 0.;  			 #[degC] - temp on other side of the copper block
k = 380.;  			 #[W/mK] - thermal conductivity

# Calculations
# using the formula (q/A)*deltax = -k*(T2-T1)
g = -k*(T2-T1)/deltax;
print " a) The steady state heat flux across the copper block is q/A = %5.1e J*m**-2*sec**-1 "%(g);

# (b)
V = a*l; 			 #[m**3] - volume
# using the overall balance equation with the accumulation and generation term
Qgen = 1.5*10**6;  			 #[j*m**-3*sec**-1]
SIx = (g*a-Qgen*V)/a;

# Results
print " b) the flux at face 1 is %5.1e j*m**-2*sec**-1;the negative sign indicates that the \
\nheat flux is from right to left negative x direction"%(SIx);

 a) The steady state heat flux across the copper block is q/A = -3.8e+05 J*m**-2*sec**-1
b) the flux at face 1 is -5.3e+05 j*m**-2*sec**-1;the negative sign indicates that the
heat flux is from right to left negative x direction


### Example 3.2 - Page No :68¶

In :
from sympy import *

# Variables
x = Symbol('x')
SIx2 = -3.8*10**5;  		 #[j*m**-2*sec**-1] - flux at x = 0.1,i.e through face2
Qgen = 1.5*10**6;  			 #[j*m**-3*sec**-1] - uniform generation in the volume
T2 = 100+273.15;  			 #[K] temperature at face 2
x2 = 0.1;  			         #[m]
k = 380.;  			         #[W/mK] - thermal conductivity

# Calculations
# using the equation der(SIx)*x = SIx+c1;where c1 is tyhe constant of integration
c1 = (Qgen*x2)-SIx2;
SIx = Qgen*x-c1;

# Results
print "SIx = ",SIx
print " where SIx is in units of J m**-2 sec**-1 and x is in units of m"

# using the equation -k*T = der(SIx)*x**2-c1*x+c2;where c2 is the constant of integration
c2 = -k*T2-(Qgen*(x2)**2)/2+c1*x2;
T = -(Qgen/k)*x**2+(c1/k)*x-(c2/k);
print "T = ",T
print " where T is in units of kelvin K"

# Answer may vary because of rouding error.

SIx =  1500000.0*x - 530000.0
where SIx is in units of J m**-2 sec**-1 and x is in units of m
T =  -3947.36842105263*x**2 + 1394.73684210526*x + 253.413157894737
where T is in units of kelvin K


### Example 3.3 - Page No :69¶

In :
import math
from sympy import *

# Variables
# given
x = Symbol('x')
t = Symbol('t')
hf1 = -270.;  			 #[J/sec] - heat flow at face 1
hf2 = -228.;  			 #[J/sec] - heat flow at face2
Qgen = 1.5*10**6;  		 #[J*m**-3*sec**-1] generation per unit volume per unit time
v = 6*10**-5;  			 #[m**3] volume
Cp = 0.093;  			 #[cal*g**-1*K**-1] heat capacity of copper
sp = 8.91;  			 #specific gravity of copper
a = 0.0006;  			 #[m**2] - area

# Calculation and Results
# (a) using the overall balance
acc = hf1-hf2+Qgen*v;
print "a) the rate of accumulation is %d J/sec "%(acc);

# (b)
SIx1 = hf1/a;
SIx2 = hf2/a;
x1 = 0.;

# solving for the constant of integration c1 in the equation [del(p*cp*T)/delt-der(SIx)]*x = -SIx+c1;
c1 = 0+SIx1;
x2 = 0.1;
g = (-(SIx2)+c1)/x2+Qgen;
SIx = c1-(g-Qgen)*x;
print "SI(x) = ","(b)",SIx

# solving for constant of integration c3 in the equation p*cp*T = g*t+c3
T2 = 100+273.15;
t2 = 0;
p = sp*10**3;  			 #[kg/m**3] - density
cp = Cp*4.1840;  			 #[J*kg**-1*K**-1]
c3 = p*cp*T2-g*t2;
T = (g*(10**-3)/(p*cp))*t+c3/(p*cp);
print "Relationship between T and t at x=0.1m is T = ",T

# solving for constant of integration c2 in the equation -k*T = der(SIx)*x**2-c1*x+c2
k = 380.;  			 #[w/m**1*K**1]
x2 = 0.1;
c2 = k*T+(3.5*10**5)*x2**2-(4.5*10**5)*x2;

def T(t,x):
return (-(3.5*10**5)*x**2+(4.5*10**5)*x+87.7*t+1.00297*10**5)/k;

# at face 1;
x1 = 0.;
t1 = 60.;  			 #[sec]
T1 = T(t1,x1);
print "Temperature profile as a function of x and t is T = %.2f K, at face 1"%T1

# at face 2
x2 = 0.1;
t2 = 60.;  			 # [sec]
T2 = T(t2,x2);
print "Temperature at face 2  = %.0f K ,at face 2"%T2

a) the rate of accumulation is 48 J/sec
SI(x) =  (b) 700000.0*x - 450000.0
Relationship between T and t at x=0.1m is T =  0.230747847543697*t + 373.15
Temperature profile as a function of x and t is T = 277.79 K, at face 1
Temperature at face 2  = 387 K ,at face 2