next up previous print clean
Next: Solving tridiagonal simultaneous equations Up: FINITE DIFFERENCING IN (omega,x)-SPACE Previous: The leapfrog method

The Crank-Nicolson method

The Crank-Nicolson method solves both the accuracy and the stability problem. Recall the difference representation of the heat-flow equation (27).
\begin{displaymath}
q_{{t+1}}^x \ -\ q_t^x \eq a\ \left( q_t^{{x+1}} - 2
q_t^x + q_t^{{x-1}} \right)\end{displaymath} (29)
Now, instead of expressing the right-hand side entirely at time t, it will be averaged at t and t+1, giving  
 \begin{displaymath}
q_{{t+1}}^x - q_t^x \eq {a \over 2 }\left[
\left( q_t^{{x+1}...
 ...}^{{x+1}} - 2q_{{t+1}}^x + q_{{t+1}}^{{x-1}} \right) \, \right]\end{displaymath} (30)
This is called the Crank-Nicolson method. Defining a new parameter $\alpha = a/2$,the difference star is  
 \begin{displaymath}
\begin{tabular}
{\vert lccc\vert c\vert} \hline
& &\multicol...
 ...column{3}{c}{} \\ \ $t$\ &\multicolumn{4}{c}{} \\ \end{tabular}\end{displaymath} (31)
When placing this star over the data table, note that, typically, three elements at a time cover unknowns. To say the same thing with equations, move all the t+1 terms in (30) to the left and the t terms to the right, obtaining  
 \begin{displaymath}
- \alpha q_{{t+1}}^{{x+1}} \,+\,
( 1+2 \alpha )q_{{t+1}}^x \...
 ... q_t^{{x+1}} \,+\,
(1-2 \alpha ) q_t^x \,+\, \alpha q_t^{{x-1}}\end{displaymath} (32)
Now think of the left side of equation (32) as containing all the unknown quantities and the right side as containing all known quantities. Everything on the right can be combined into a single known quantity, say, dtx. Now we can rewrite equation (32) as a set of simultaneous equations. For definiteness, take the x-axis to be limited to five points. Then these equations are:

 
 \begin{displaymath}
\left[
\matrix {
\matrix { e_{\rm left} \cr - \alpha_{}^{}\c...
 ...rix {
d_t^1 \cr d_t^2 \cr d_t^3 \cr d_t^4 \cr d_t^5 }
}
\right]\end{displaymath} (33)
Equation (32) does not give us each qt+1x explicitly, but equation (33) gives them implicitly by the solution of simultaneous equations.

The values $e_{\rm left}$ and $e_{\rm right}$ 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 (33) 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 (27). In fact, this implicit method turns out to be cheaper, since the increased accuracy of (32) over (27) allows the use of a much larger numerical choice of $ \Delta t $.A program that demonstrates the stability of the method, even for large $ \Delta t $, is given next.

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


next up previous print clean
Next: Solving tridiagonal simultaneous equations Up: FINITE DIFFERENCING IN (omega,x)-SPACE Previous: The leapfrog method
Stanford Exploration Project
12/26/2000