/ tutorials / laplace-dirichlet
Sign in
tutorials / laplace-dirichlet
laplace-dirichlet / src / chapters / ch07 / text.md
3.9 KBPreviewCodeBlameHistoryRaw

A second-order method with a perfect solver still needs 101210^{12} unknowns for twelve digits. The way out is the same as in Chapter 3: keep the structure that makes the solver fast, and change the stencil.

The compact nine-point stencil#

Add the four diagonal neighbours, with weights chosen to cancel as much of the truncation error as possible:

4(uE+uW+uN+uS)+(uNE+uNW+uSE+uSW)−20 uP6h2  =  Δu+h212Δ2u+O(h4).\frac{4(u_E + u_W + u_N + u_S) + (u_{NE} + u_{NW} + u_{SE} + u_{SW}) - 20\,u_P}{6h^2} \;=\; \Delta u + \frac{h^2}{12}\Delta^2 u + O(h^4).

This is the Mehrstellen operator. For Poisson's equation the h2h^2 term is h212Δf\frac{h^2}{12}\Delta f, which is known and can be subtracted, giving a fourth-order scheme with the same nine points. For Laplace's equation, Δ2u=Δ(Δu)=0\Delta^2 u = \Delta(\Delta u) = 0 identically, so that term is not merely computable, it is zero, and the next one vanishes as well: the scheme is sixth-order accurate.

The stencil is still a sum of tensor products of tridiagonal operators, so the sine vectors are still its eigenvectors. With a=πk/Na = \pi k/N and b=πl/Nb = \pi l/N the eigenvalue is

20−8cos⁡a−8cos⁡b−4cos⁡acos⁡b,20 - 8\cos a - 8\cos b - 4\cos a \cos b,

and the solver of the previous chapter applies verbatim, with one line changed. A sixth-order method for the price of a second-order one, on the same grid, in the same time.

Chebyshev in two dimensions#

The one-dimensional collocation of Chapter 4 extends to the square by taking the tensor product of two Chebyshev grids. Written on the array UU of interior values, the discrete problem is a Sylvester equation,

AU+UA ⁣⊤=F,A U + U A^{\!\top} = F,

where AA is the one-dimensional operator on interior nodes and FF collects the boundary contributions. Solving it by forming I⊗A+A⊗II \otimes A + A \otimes I and calling backslash costs O(N6)O(N^6) and is the two-dimensional dense solve all over again. Diagonalising A=VΛV−1A = V\Lambda V^{-1} once instead turns the equation into a division,

U~ij  =  (V−1FV−⊤)ijλi+λj,U=VU~V ⁣⊤,\widetilde U_{ij} \;=\; \frac{\big(V^{-1} F V^{-\top}\big)_{ij}}{\lambda_i + \lambda_j}, \qquad U = V \widetilde U V^{\!\top},

at a cost of one eigendecomposition and four matrix products, O(N3)O(N^3) in total. This is the matrix-decomposition method, and it is the same idea as the sine transform of Chapter 6, with the eigenvectors computed at run time instead of known in advance. Unlike the sine transform it does not care that the operator is a difference operator, only that the problem separates.

What the comparison says#

On expsin, at the default settings:

Three methods, the same problem, the same machine, and a factor of a million in unknowns between the first and the last. The nine-point curve is a straight line of slope −6-6 until it hits the roundoff floor near 10−1410^{-14}; the Chebyshev curve does not have a slope, it falls off a cliff.

The qualifications matter as much as the numbers.

↑↓ move↵openescclose