M58. The lowest modes of a shape, by iteration¶
Package: F2, its second part: the lowest modes of a shape from the stationary solve, which is sparse, in the place of the dense eigenproblem for all modes. More points, a mesh that shrinks towards corners, and shapes with holes.
What was built¶
Elements::factor: an operator on spectral elements, factorized once for many right-hand sides. The points inside each element are eliminated, the system of the points on the sides is factorized sparse, andFactored::solvecosts the two triangular solves and a product per element. Conditions give zero on every piece.The modes by inverse iteration.
shaped_modesno longer takes the lowest of all modes of the elements. With the stiffness \(K\) and the mass \(M\) under the density, it runs the block iteration of milestone 55 on \(-\sqrt{M}\,(K + \sigma M)^{-1}\sqrt{M}\), whose lowest eigenvalues are \(-1/(E + \sigma)\). No preconditioner: the eigenvalues of the inverse lie far apart, and a dozen iterations reach a residual of \(10^{-11}\).The iteration applies its operator in parallel. The corrections of a step are made orthonormal first, and the operator is then applied to all of them, on a thread each. For a solve that is most of the work. The results do not depend on the threads.
The mesh of a stationary problem. The planner takes
shaped::graded_mesh: layers towards every corner at which a mode has a singularity. The methodelement_modeshaslayersbeside the degree and the spacing.A planner that knows what an eigenvalue shows. The degree is the first at which the modes are resolved to \(10^{-8}\), or, on a mesh with layers, the first at which no eigenvalue moves by more than \(10^{-9}\) of its size.
A boundary that feeds the modes is refused: a mix of the value and the slope with coefficients of opposite signs.
What it reaches¶
Shape |
Modes |
Degree |
Points |
Error of the eigenvalues |
Time |
|---|---|---|---|---|---|
The unit square, fixed |
4 |
12 |
3 553 |
\(3\cdot10^{-12}\) |
0.3 s |
The unit disk, fixed |
6 |
12 |
3 553 |
\(10^{-12}\) |
0.4 s |
The unit disk, free |
4 |
10 |
2 481 |
\(2\cdot10^{-13}\) |
0.2 s |
The ring between the radii ½ and 1, fixed |
6 |
14 |
9 632 |
\(10^{-12}\) |
1.4 s |
The unit square with four round holes, fixed |
6 |
16 |
35 965 |
\(2\cdot10^{-11}\) |
8.5 s |
The L-shape, fixed, with 18 layers |
1 |
8 |
62 945 |
\(5\cdot10^{-10}\) |
2.3 s |
The L-shape, fixed, with 18 layers |
6 |
10 |
98 241 |
12 s |
|
The unit disk, fixed |
40 |
16 |
6 273 |
15 s |
Milestone 57 had the lowest mode of the L-shape to \(6\cdot10^{-3}\), left a shape with a hole unresolved, and took 3.1 s for the six modes of the disk.
The tests check the disk against the zeros of Bessel functions, the ring against the zeros of their products, with the value and with the slope given on the outer circle, the square with one side held against \(\pi^2((m + \tfrac12)^2 + n^2)\), a square on springs against the roots of \(2k\cos k + (1 - k^2)\sin k\), and the L-shape against \(9.6397238440219\). The error of an eigenvalue of the square falls by more than three digits from the degree 4 to the degree 6.
Decisions¶
D58.1. The lowest modes from the inverse, with no preconditioner¶
Developer, 2026-11-20.
Two ways led from the dense eigenproblem to a sparse one. The block iteration could run on the operator of the elements, with the stationary solve as its preconditioner. Or it could run on the inverse of the operator, where the lowest modes are the largest, far apart, and need no preconditioner. Both cost one solve for each function and step. The second was taken: its operator is exactly what the solve computes, symmetric in the variable \(\sqrt{M}\,u\), and the iteration converges at a rate that does not depend on the mesh. Its stability at small residuals was settled in milestone 55.
D58.2. A shift that is known, and the case where none is refused¶
Developer, 2026-11-20.
The inverse needs \(K + \sigma M\) positive. With the value, the slope or a spring on the boundary, \(K\) is bounded below by the lowest value of the potential, and the shift is how far that reaches below zero, plus the energy of a wave as long as the shape, for a drum that nothing holds. A condition \(a\,u + b\,\partial u/\partial n = 0\) with \(a\) and \(b\) of opposite signs adds negative energy along the boundary, as much as its ratio and the corners allow. No shift is known for it without solving for it, and a shift that is too small returns modes that are not the lowest, silently. So that condition is refused. The dense path of milestone 57 took it, and nothing had asked for it.
D58.3. Eight digits of the modes, and eigenvalues that have settled¶
Developer, 2026-11-20.
With a sparse solve a higher degree is cheap, and the modes are asked for to \(10^{-8}\), as in a problem in time: decision D57.4 is replaced. At a corner with a singularity that cannot be reached: the layers leave the singularity in their innermost element, where the coefficients of the mode stop at about \(10^{-6}\). There the eigenvalues say when the rest is resolved, and the planner stops when none of them moves by more than \(10^{-9}\) of its size from one degree to the next. The plan says which of the two ended the search.
D58.4. The operator is applied to a block at a time¶
Developer, 2026-11-20.
The iteration applied its operator to one correction after another, between making each orthogonal to the ones before. A sparse triangular solve does not use several cores, so the solves of a block are run side by side: the corrections are made orthonormal first, and their products with the operator are computed together. Each product is that of one vector on one thread, so the bits do not depend on the number of threads. The iteration on a Fourier grid gains nothing and loses nothing: its transforms were parallel already.
D58.5. The factorization stays complex and general¶
Developer, 2026-11-20.
The matrix of a mode problem is real, symmetric and positive. A Cholesky factorization would take a fraction of the time and tell at once whether the shift suffices. The elements assemble a general complex matrix, and the rows of given values make it unsymmetric. To change that is the package C16 for every solve on a shape, and it was not opened here: the factorization is a quarter of the time of a mode problem.
What is left¶
Many modes at once: the iteration works with every pair of the functions of its block, vector by vector.
A boundary that feeds the modes, with a shift that is found.
Boxes and round domains.
Waveguides and cavities, as pairs of scalar problems.
First derivatives.