next up previous contents
Next: 2-D Conductive sheet Up: Solving the Heat Equation Previous: Solving the Heat Equation   Contents

1-D Circular Rod - Finite Difference Method

With only one dimension, and applying the finite difference method, we obtained the equation, for integer index i which can range from 1 to N as in equation (2.9). So the core algorithm aside from housekeeping procedures simply is:

for each time step in var i
    for j 2:N-1
        u[i+1][j] = z * (u[i][j-1] + u[i][j+1]) + (1-z) * u[i][j];
    end for
end for

Of course, assuming that u is a 2 dimensional array with which the first component represents the time step and second component is the discretized index.

Using this algorithm, a program called poissonRod was written. The result is represented in Figure 3.1 where

Figure 3.1: The result of running poissonRod program
\begin{figure}\begin{center}
\epsfbox{poisson.eps} \end{center} \end{figure}



J S 2002-08-14