Talk:Crank–Nicolson method

Two dimensional Crank-Nicolson method
It appears that the 2-d CN method is not going to lead to a tridiagonal system. Instead, we get a large square matrix, with small square matrices arranged tridiagonally on it: $$ M = \left(\begin{array}{ccccc} T & I & 0 & 0 & 0 \\ I & T & I & 0 & 0 \\ 0 & I  & T & I & 0 \\ 0& 0 & I  & T & I \\  0&0& 0 & I  & T \end{array} \right) $$ with T a tridiagonal (5 X 5) matrix, I the (5 X 5) identity matrix and 0 the (5 X 5) matrix of zeros (this is obviously for the case of 5 points in each direction). To get this matrix, I have ordered the points with increasing x, followed by increasing y.

This matrix is still sparse (so storage is not a problem), but it is not tridiagonal, and so the linear system will be quite slow to solve. Does anyone know a way around this? i.e. Is there a way to set up the problem so that we get a tridiagonal system, or is there a good algorithm for solving the linear system with this type of coefficient matrix?

Woodford 15:40, 9 November 2006 (UTC)Simon


 * This is not quite my area, but perhaps I can give you some hints to get you started. I don't know of a set-up which gives a tridiagonal matrix, but there are a lot of methods for solving systems with M. You can use a general method for sparse matrices, like the Gauss-Seidel method or successive over-relaxation, or a more complicated but faster methods like conjugate gradient. These methods can be improved by using multigrid techniques. There are also methods exploiting the special structure of the matrix M; one of them is the Hockney method which is based on the fast Fourier transform. Such methods are called "fast Poisson solvers"; a search on that term should give some useful documents.
 * Source: Iserles, A First Course in the Numerical Analysis of Differential Equations, Cambridge University Press. -- Jitse Niesen (talk) 07:08, 10 November 2006 (UTC)

The 2d Crank-Nicolson will lead to a band diagonal matrix rather than a tridiagonal one. Crack open your favorite Numerical Recipes book for methods on quickly solving band diagonal matrices. Axemanstan 15:39, 9 November 2007 (UTC)


 * This problem is similar to the problem of solving the discrete Poisson equation, as already mentioned. The discrete Poisson equation is a commonly occuring problem in incompressible flow simulations, but it also solved in some compressible flow solvers.


 * According to this paper which uses a structured grid, their multigrid solver "outperforms PCG" (preconditioned conjugate gradient method, which accordingly was "the state of the art way to solve for incompressibility in fluid solvers") in all scenarios they tested except from one.


 * The multigrid method have also been used for less structured grids, like in this paper where it was used on an octree grid.


 * On the other hand, this paper, which also used an octree data structure, refered to another paper which "pointed out that these multigrid approaches can be problematic in the presence of objects with high frequency detail". "Moreover", the paper continues, "the situation worsens in the presence of interfaces (such as that between water and air), especially since the faithful coarse mesh representation of watertight isosurfaces is a difficult research problem in itself". Instead, they used the preconditioned conjugate gradients method, and claimed that their new symmetric formulation of the Poisson equation "reduces the pressure solver to approximately 25 % of the total simulation time requiring only about 20 iterations to converge to an accuracy of machine precision".


 * —Kri (talk) 16:06, 25 May 2012 (UTC)

Phyllis Nicolson
I would be grateful if someone could add a page for PN (if appropriate). See eg MacTutor archive which leads to http://www-history.mcs.st-andrews.ac.uk/Biographies/Nicolson.html. (I would do it myself but she was my mother.) roundhouse 20:11, 10 January 2007 (UTC)

Stability on changing time steps
I constrained my solutions to a rate of increase in time step of 1:2. The 1D and 2D solutions became stable.

The time-step changed from 1/100 second to 1 second when a change from condensative to convective heat transfer occured on the boundary. Constraining the rate of change appeared to be a logical solution. This was back in 1966. Kdf9andtd1a (talk) 02:18, 22 July 2011 (UTC)

Financial mathematics versus other applications.
Why do the applications to financial mathematics deserve a mention in its own section here? The diffusion equation and related pdes, which are solved by this and related methods, are used in plenty of other applications as well. --jftsang 19:03, 26 December 2015 (UTC)

Error in 1D Example
Someone please correct the formula at the end of "Example: 1D diffusion"

It should be (2r - 1)u_i^n on the right-hand side instead of (1 - 2r) u_i^n.

Took me a while to figure this out.

Thanks! — Preceding unsigned comment added by 2001:7C0:2049:1D4:7C11:3E47:91B4:A2D (talk) 13:43, 8 January 2018 (UTC)


 * As far as I can see, (1 - 2r) u_i^n on the right hand side of that equation is correct. It follows from the previous equation. If there is a problem, perhaps you can explain in more details? Blueskiwi (talk) 18:09, 16 August 2020 (UTC)

Typesetting in section "Example: 1D diffusion with advection for steady flow, with multiple channel connections"
The typesetting is not done in a proper mathematical way.

HerrHartmuth (talk) 07:11, 30 September 2020 (UTC)
 * 1) The superscript on the matrix $$\mathbf{C}^{\mathbf{j}}$$ should not be bold, i.e. $$\mathbf{C}^j$$, as it is not a multidimensional quantity itself.
 * 2) There are matrices defined which look like the multiplication of different matrices but are meant to be a single matrix. The variable name is just made up of multiple letters, e.g. $$\mathbf{A} \mathbf{A} \mathbf{1}$$. Maybe we can come up with a better naming sceme? I would vote for one bold upper-case letter and a specific subscript index, e.g. $$\mathbf{A}_1$$.