previous up next print clean
Next: The leapfrog method Up: FINITE DIFFERENCING Previous: First derivatives, implicit method

The explicit heat-flow equation

The heat-flow equation controls the diffusion of heat. This equation is a prototype for migration. The 15$^\circ$ migration equation is the same equation but the heat conductivity constant is imaginary. (The migration equation is really the Schroedinger equation, which controls the diffusion of probability of atomic particles).  
 \begin{displaymath}
{ \partial q \over \partial t } \eq
{ \sigma \over C }\ { \partial^{2\,} q \over \partial x^2 }\end{displaymath} (28)
Implementing (28) in a computer requires some difference approximations for the partial differentials. As before we use a subscript notation that allows (25) to be compacted into  
 \begin{displaymath}
{ \partial q \over \partial t } \ \ \ \approx \ \ \ { q_{{t+1}}\ -\ q_t 
\over \Delta t }\end{displaymath} (29)
where $t+\Delta t$ is denoted by t+1. The second-derivative formula may be obtained by doing the first derivative twice. This leads to $ q_{{t+2}} - 2\,q_{{t+1}} + q_t $.The formula is usually treated more symmetrically by shifting it to $ q_{{t+1}} - 2\,q_t + q_{{t-1}} $.These two versions are equivalent as $\Delta t$ tends to zero, but the more symmetrical arrangement will be more accurate when $\Delta t$ is not zero. Using superscripts to describe x-dependence gives a finite-difference approximation to the second space derivative:  
 \begin{displaymath}
{ \partial^2 q \over \partial x^2 } \ \ \ \approx \ \ \ { q^{{x+1}} 
\ -\ 2\, q^x \ +\ q^{ x-1 } \over \Delta x^2 }\end{displaymath} (30)
Inserting the last two equations into the heat-flow equation (and using = to denote $ \approx $) gives


 
Table 7: Differencing star and table for one-dimensional heat-flow equation.
9cData Table 1cx $\rightarrow$                
                   
    i n i t i a l  
                   
    6c              
    6c              
    6c              
    6c              
  s 6c   s          
    6c              
    6c              
  i 3c 1cstar 2c   i      
    6c              
    2|c|       2|c|      
  d 1c   $-\alpha$ $2\alpha - 1$ $-\alpha$ 1c   d
    2|c|       2|c|      
    3|c|   3|c|          
  e 2c   1 2c   e    
    3|c|   3|c|          
    6c              
    6c              
    6c              
    6c              
t   6c              

 
 \begin{displaymath}
{ q_{{t+1}}^x \ \ -\ \ q_t^x \over \Delta t } \eq
{ \sigma \...
 ...{x+1}}\ \ -\ 2\,q_t^x \ +\ q_t^{{x-1}} 
 \over ( \Delta x )^2 }\end{displaymath} (31)
(Of course it is not justified to use = to denote $ \approx $,but the study of errors must be deferred until the concepts have been laid out. Errors are studied in chapter [*].) Letting $\alpha = \sigma \, \Delta t / ( C\, \Delta x^2 )$,equation (31) becomes  
 \begin{displaymath}
q_{{t+1}}^x\ -\ q_t^x \ -\ \alpha \, ( q_t^{{x+1}}\ -\ 2\,q_t^x
\ +\ q_t^{{x-1}} \, ) \eq 0\end{displaymath} (32)
Equation (32) can be explicitly solved for q for any x at the particular time t+1 given q at all x for the particular time t and hence the name explicit method.

Equation (32) can be interpreted geometrically as a computational star in the (x,t)-plane, as depicted in Table [*].7. By moving the star around in the data table you will note that it can be positioned so that only one number at a time (the 1) lies over an unknown element in the data table. This enables the computation of subsequent rows beginning from the top. By doing this you are solving the partial-differential equation by the finite-difference method. There are many possible arrangements of initial and side conditions, such as zero-value side conditions. Next is a computer program and its result.

# Explicit heat-flow equation
real q(12), qp(12)
nx = 12
do ia= 1, 2 {		# stable and unstable cases
	alpha = ia*.3333;	write(6,'(/"alpha =",f5.2)') alpha
	do ix= 1,6  { q(ix) = 0.}	# Initial temperature step
	do ix= 7,12 { q(ix) = 1.}
	do it= 1, 6 {
		write(6,'(20f6.2)') (q(ix),ix=1,nx)
		do ix= 2, nx-1
			qp(ix) = q(ix) + alpha*(q(ix-1)-2.*q(ix)+q(ix+1))
		qp(1) = qp(2);	qp(nx) = qp(nx-1)
		do ix= 1, nx
			q(ix) = qp(ix)
		}
	}
call exit(0);	end

alpha = 0.33 0.00 0.00 0.00 0.00 0.00 0.00 1.00 1.00 1.00 1.00 1.00 1.00 0.00 0.00 0.00 0.00 0.00 0.33 0.67 1.00 1.00 1.00 1.00 1.00 0.00 0.00 0.00 0.00 0.11 0.33 0.67 0.89 1.00 1.00 1.00 1.00 0.00 0.00 0.00 0.04 0.15 0.37 0.63 0.85 0.96 1.00 1.00 1.00 0.00 0.00 0.01 0.06 0.19 0.38 0.62 0.81 0.94 0.99 1.00 1.00 0.00 0.00 0.02 0.09 0.21 0.40 0.60 0.79 0.91 0.98 1.00 1.00

alpha = 0.67 0.00 0.00 0.00 0.00 0.00 0.00 1.00 1.00 1.00 1.00 1.00 1.00 0.00 0.00 0.00 0.00 0.00 0.67 0.33 1.00 1.00 1.00 1.00 1.00 0.00 0.00 0.00 0.00 0.44 0.00 1.00 0.56 1.00 1.00 1.00 1.00 0.00 0.00 0.00 0.30 -0.15 0.96 0.04 1.15 0.70 1.00 1.00 1.00 0.00 0.00 0.20 -0.20 0.89 -0.39 1.39 0.11 1.20 0.80 1.00 1.00 0.13 0.13 -0.20 0.79 -0.69 1.65 -0.65 1.69 0.21 1.20 0.87 0.87


previous up next print clean
Next: The leapfrog method Up: FINITE DIFFERENCING Previous: First derivatives, implicit method
Stanford Exploration Project
10/31/1997