Diffusion Grid

Consider the distribution of heat in a rectangular plate whose edges are held at the indicated temperature below:
              20 degrees
    *----*----*----*----*-- ... --*----*----*----*----*
    |    |    |    |    |         |    |    |    |    |
    *----o----o----o----o-- ... --o----o----o---km----*
10  |    |    |    |    |         |    |    |    |    |  40 degrees
deg *----o----o----o----o-- ... --o----o----o----o----*
    |    |    |    |    |         |    |    |    |    |
         .    .    .                   .    .    . 
         .    .    .                   .    .    . 
         .    .    .                   .    .    . 

    |    |    |    |    |         |    |    |    |    |
    *----o----o----o----o-- ... --o----o----o---2m----*
    |    |    |    |    |         |    |    |    |    |
    *----1----2----3----4-- ... --o----o----o----m----*
    |    |    |    |    |         |    |    |    |    |
    *----*----*----*----*-- ... --*----*----*----*----*
              20 degrees
We number the nodes on the interior as
Row 1:   x         x           x          ... x 
          1         2           3              m

Row 2:   x         x           x          ...  x 
          m+1       m+2         m+3             2m

Row k:   x         x           x          ...  x 
          (k-1)m+1   (k-1)m+2   (k-1)m+3        km
In the diagram above, the nodes representing unknown values are marked with their node number, 1, 2, ... , or with the symbol "o". The known boundary value nodes are marked with the symbol "*".

The behavior of Heat is to diffuse, which means that the interior nodes will be the average of the neighboring nodes.

                           20 + x(2) + 10 + x(m+1)
For node 1, we have x(1) = -----------------------
                                     4
incorporating the known temperature values of 20 degrees on the lower edge and 10 degree on the left hand side edge.

For a completely interior node, we have the pattern

                          x(j-1) + x(j+1) + x(j-m) + x(j+m)
                   x(j) = ---------------------------------
                                          4
incorporate the node to the left, to the right, directly below, and directly above the node in question.

We continue this for all k rows of the matrix.

If you take out a large piece of paper and start writing these relationships down, they form a matrix A x = b, with mostly zero entries and non-zero values given in the pattern:

          A( i,   i ) =  4.0    i = 1,k*m
          A(i-1,  i ) = -1.0
          A(i+1,  i ) = -1.0
          A( i , i+m) = -1.0
          A( i , i-m) = -1.0
with care taken to correctly include the known temperatures on the four edges.

The number of unknown values is N = k*m (m nodes in a row; k rows)

Return to Report2_diffusion