On a rectangle discretised by a uniform grid (for example the pixel-aligned bilinear meshes of Pixel Images and Finite Element Functions), the Discrete Cosine Transform inverts the constant-coefficient Neumann operator in operations. For the Weighted Stiffness Matrix this gives a fast direct solver when σ is constant and a preconditioner with mesh-independent condition number when σ varies. These notes collect the technical points for an implementation.
Requirements
- Tensor-product grid: (or ) cells with constant spacings , (and ). The spacings may differ from each other. No hanging nodes.
- Bilinear u space (Q1). The σ space is arbitrary, since only the operator on u is replaced.
- A permutation between the finite element numbering of the u dofs and the lexicographic grid numbering. It is found once from the node coordinates, and the tensor structure is checked at the same time.
Constant conductivity
For , , and is one forward transform, a diagonal scaling and one backward transform (see Discrete Cosine Transform). The solution has zero domain integral. The boundary grounding of the library (see Grounding of the Potential) is restored by subtracting a constant.
Variable conductivity: preconditioning
For , the energies satisfy . The preconditioned operator therefore has condition number at most on the complement of the constants, independently of the mesh. The number of Projected Conjugate Gradient iterations is bounded by for a relative tolerance on every mesh, not proportional to as for Jacobi preconditioning. On coarse meshes CG converges earlier, because there are fewer distinct eigenvalues, so the iteration count first grows under refinement and then levels off below the bound. The scale of the preconditioner does not change the iteration count.
Two variants are worth comparing:
- Constant coefficient, . It is robust and depends only on the contrast.
- Scaled (Concus–Golub), with the nodal values (σ averaged over the cells around each node). Formally, becomes for with . For smooth σ, the condition number then hardly depends on the contrast. At jumps, behaves like the derivative of a step, its discrete version grows as the mesh is refined, and so does the condition number. The constant variant is the right choice for piecewise constant conductivities.
Nodal conductivities need not be known separately: they can be read off the system matrix as , a weighted mean of σ around node .
Compared with Algebraic Multigrid, the transform needs no setup that depends on σ. It works unchanged for every σ during a reconstruction and applies to many right-hand sides at once (see Block Conjugate Gradient).
Low-rank corrections: contact terms and constrained nodes
Two kinds of modifications of occur, both supported on few nodes:
- the contact term of the complete electrode model, , on the boundary nodes under the electrodes;
- constrained nodes of voltage-driven problems, where is prescribed.
Write with the injections , of these nodes. The equations on the free nodes, , become, with and Lagrange multipliers for the constraints,
is singular, but the pseudo-inverse is exact on its range. So write and add the solvability condition . This gives the bordered capacitance system
of size . The matrix (entries of the discrete Neumann Green’s function between the special nodes) is computed once, from transform solves. It depends only on the mesh, the electrodes and the constrained nodes. After a conductivity update only changes (through or ), so refactoring the small system is cheap. Each application costs two transform solves.
Regularising instead, e.g. with the trapezoidal weights (diagonal in the transform basis), and correcting by inside the capacitance matrix, is numerically unstable: its diagonal entry is a difference of two terms of size , and must be of the order of the smallest eigenvalue, in these units.
Electrode models
- Continuum, point and gap models, current-driven: only the right-hand side involves the electrodes, and the operator is exactly , so the transform pseudo-inverse is the preconditioner (see Discrete Electrode Models).
- Complete electrode model. The system
adds the contact term and electrode potentials , coupled through constant blocks (see Complete Electrode Model). The u block is inverted with the capacitance system above. The electrode potentials are eliminated with the Schur complement , which is recomputed after every conductivity update. It is singular (the constants of ) and is applied as a pseudo-inverse.
Dirichlet problems
Voltage-driven problems prescribe u on the constrained nodes: all boundary nodes for the continuum model, the electrode nodes for the gap and point models. For the complete electrode model the prescribed electrode voltages only remove , and the u block keeps its contact term. The constrained nodes enter the capacitance system as . When the whole boundary is constrained, the interior operator is also diagonalised directly by sines (DST-I). This avoids the capacitance nodes on very fine grids.
Implementation notes
- Grid detection. The discretization must be a conforming uniform tensor grid of bilinear quadrilaterals, with any spacings . The node coordinates give the permutation to lexicographic order. The pixel-aligned meshes of Pixel Images and Finite Element Functions qualify.
- Transforms. DCT-I through the real FFT of the even extension, along both grid directions of an block, so the code only needs the generic FFT interface (on GPUs as well).
- Setup cost. The capacitance matrix needs one transform solve per contact node and per constrained node. For the complete electrode model that is about the number of boundary nodes under the electrodes, once per forward model.
- Checks. For constant σ the preconditioner is the exact (pseudo-)inverse, for all electrode models and for both problem types, so block CG converges in one iteration. For variable σ the preconditioned operator must be symmetric positive definite on the complement of the null space with condition number .
Beyond rectangles. On disks, rotationally symmetric meshes admit the analogous solver with a Fourier transform in the angle and radial tridiagonal solves (see Fast Solvers on Disk Domains). Alternatively, a disk embedded in a square can be handled with the capacitance matrix method for irregular regions (Buzbee et al.). The correction then acts on all boundary nodes of the disk ( of them), and the approximation of the curved boundary by grid lines has to be dealt with separately.
In ModularEIT.jl: DCTPreconditioner, dct_preconditioner, structured_grid.
References
- P. Concus, G. H. Golub (1973). Use of Fast Direct Methods for the Efficient Numerical Solution of Nonseparable Elliptic Equations. SIAM J. Numer. Anal. 10(6), 1103–1120. doi:10.1137/0710092
- B. L. Buzbee, F. W. Dorr, J. A. George, G. H. Golub (1971). The Direct Solution of the Discrete Poisson Equation on Irregular Regions. SIAM J. Numer. Anal. 8(4), 722–736. doi:10.1137/0708066
- P. N. Swarztrauber (1977). The Methods of Cyclic Reduction, Fourier Analysis and the FACR Algorithm for the Discrete Solution of Poisson’s Equation on a Rectangle. SIAM Rev. 19(3), 490–501. doi:10.1137/1019071
- G. Strang (1999). The Discrete Cosine Transform. SIAM Rev. 41(1), 135–147. doi:10.1137/S0036144598336745