You are on page 1of 2

Solving the heat equation

Charles Xie

The heat conduction for heterogeneous media is modeled using the following partial differential
equation:

 T 
c     vT     kT   q (1)
 t 

where k is the thermal conductivity, c is the specific heat capacity,  is the density, v is the velocity
field, and q is the internal heat generation. The heat equation has two parts: the diffusion part
characterized by the conductivity field function and the advection part characterized by the velocity
field function. The internal heat generation term can be thought of as an external force.

The partial differential equation is discretized in both space and time domain in order to find
approximate solutions. Sometimes, this numeric method is called the finite-difference time-
domain (FDTD) method. An implicit FDTD method can be used to achieve better numeric
stability:

Ti ,nj,1k  Ti ,nj ,k uin11, j ,k Ti n1,1j ,k  u in11, j ,k Ti n1,1j ,k 


   
 t 2x 
 i , j ,k ci , j ,k  n1 n1 n 1 n 1 n 1 n 1 n 1 n 1 
 vi , j 1,k Ti , j 1,k  vi , j 1,k Ti , j 1,k  wi , j ,k 1Ti , j ,k 1  wi , j ,k 1Ti , j ,k 1 
 2y 2z 

1  Ti n1,1j ,k  Ti ,nj,1k Ti ,nj,1k  Ti n1,1j ,k 


 k i 1 / 2, j ,k  k i 1 / 2, j ,k 
x  x x 
1  Ti ,nj11,k  Ti ,nj,1k Ti ,nj,1k  Ti ,nj11,k 
 k i , j 1 / 2,k  k i , j 1 / 2,k 
y  y y 
1  Ti ,nj,1k 1  Ti ,nj,1k Ti ,nj,1k  Ti ,nj,1k 1  n
 k
 i , j ,k 1 / 2  k i , j , k 1 / 2   qi , j , k ( 2)
z  z z 

where Mi0, Nj0, and Lk0, with M, N, and L representing the numbers of cubic voxels in x,
y, and z directions, and x, y, and z are the lengths of the cubic voxels in the three directions,
respectively. t is the time step. In theory, an implicit method is unconditionally stable, allowing
any time step to be taken, and the simulation will not “blow” up1. Note that in Eq. (2) we also avoid
directly calculating the spatial derivatives of the conductivity function, which would be very large
at the interfaces between two distinct kinds of media and therefore would cause numeric instability.

Let:

1
In practice, the advection part of the heat equation can cause numeric instability, especially when the
velocity is high.

1
 i , j , k ci , j , k
i , j ,k 
t
k i 1 / 2, j ,k k i 1, j ,k  k i , j ,k k i 1 / 2, j ,k k i , j ,k  k i 1, j ,k
Aix, j ,k   , Bix, j ,k  
x  2
2x 
2
x  2
2x 
2

k i , j 1 / 2,k k i , j 1,k  k i , j ,k k i , j 1 / 2,k k i , j ,k  k i , j 1,k


Aiy, j ,k   , Biy, j ,k  
y 2 2y 
2
y 2 2y 
2

k i , j ,k 1 / 2 k i , j ,k 1  k i , j ,k k i , j ,k 1 / 2 k i , j ,k  k i , j ,k 1
Aiz, j ,k   , Biz, j ,k  
z  2
2z 
2
z 2 2z 
2

 i , j ,k ci , j ,k uin11, j ,k  i , j ,k ci , j ,k u in11, j ,k
C x
i , j ,k A x
i , j ,k  ,D x
i , j ,k B x
i , j ,k 
2x 2x
 i , j ,k ci , j ,k vin, j 11,k  i , j ,k ci , j ,k vin, j 11,k
Ciy, j ,k  Aiy, j ,k  , Diy, j ,k  Biy, j ,k 
2y 2y
 i , j , k ci , j , k w n 1
i , j , k 1  i , j ,k ci , j ,k win, j 1,k 1
C z
i , j ,k A z
i , j ,k  ,D z
i , j ,k B z
i , j ,k  (3)
2z 2z

Eq. (2) can be rewritten as:

Ti ,nj,1k 
i , j ,k Ti ,nj ,k  qin, j ,k  Cix, j ,k Ti n1,1j ,k  Dix, j ,k Ti n1,1j ,k  Ciy, j ,k Ti ,nj11,k  Diy, j ,k Ti ,nj11,k  Ciz, j ,k Ti ,nj,1k 1  Diz, j ,k Ti ,nj,1k 1
i , j ,k  Aix, j ,k  Bix, j ,k  Aiy, j ,k  Biy, j ,k  Aiz, j ,k  Biz, j ,k
(4)
This is a very sparse matrix that can be solved efficiently using a relaxation method2.

Two boundary conditions can be used. The first kind is the Dirichilet boundary condition, which
maintains the temperature at the boundary. The second kind is the Neumann boundary condition,
which maintains the flux at the boundary.

2
http://en.wikipedia.org/wiki/Relaxation_method