The Crank-Nicolson method solves both the accuracy and the stability problem. Recall the difference representation of the heat-flow equation (32).

(34) |

(35) |

(36) |

(37) |

(38) |

The values and are adjustable and have to do with the side boundary conditions. The important thing to notice is that the matrix is tridiagonal, that is, except for three central diagonals all the elements of the matrix in (38) are zero. The solution to such a set of simultaneous equations may be economically obtained. It turns out that the cost is only about twice that of the explicit method given by (32). In fact, this implicit method turns out to be cheaper, since the increased accuracy of (37) over (32) allows the use of a much larger numerical choice of .A program that demonstrates the stability of the method, even for large , is given next.

A tridiagonal simultaneous equation
solving subroutine `rtris()` explained in the next section.
The results are stable, as you can see.

a = 8.00 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.17 0.17 0.21 0.30 0.47 0.76 0.24 0.53 0.70 0.79 0.83 0.83 0.40 0.40 0.42 0.43 0.40 0.24 0.76 0.60 0.57 0.58 0.60 0.60 0.44 0.44 0.44 0.44 0.48 0.68 0.32 0.52 0.56 0.56 0.56 0.56

# Implicit heat-flow equation real q(12),d(12) nx=12; a = 8.; write(6,'(/"a =",f5.2)') a; alpha = .5*a do ix= 1,6 { q(ix) = 0.} # Initial temperature step do ix= 7,12 { q(ix) = 1.} do it= 1,4 { write(6,'(20f6.2)') (q(ix),ix=1,nx) d(1) = 0.; d(nx) = 0. do ix= 2, nx-1 d(ix) = q(ix) + alpha*(q(ix-1)-2.*q(ix)+q(ix+1)) call rtris( nx, alpha, -alpha, (1.+2.*alpha), -alpha, alpha, d, q) } call exit(0); end

10/31/1997