M34. Time on shapes in the plane¶
Package: A4, its second part: problems in time on a region that curves bound. The owner gave the package (decision D33.1).
What was built¶
The modes of a shape.
methods/elements.rs: from the elements of milestone 33, the symmetric matrix of the Laplacian with the conditions of the boundary, and one dense eigendecomposition of it by faer. The result,ShapeModes, turns values at the points of the elements into coefficients of modes and back, and turns what is given on the boundary into a forcing.Propagation. The modes of a shape are one more kind of
collocation::Modes. The propagator of boxes (decision D65) evolves them without a change: equations of first and of second order in time, with damping, with a source, and with boundary values that depend on time.A path through the pipeline.
shaped.rsreads the equation in time with the reader of boxes, andshaped_evolution.rsplans and solves: the methodelement_propagatorwith a degree, a spacing and the steps between two recorded times.The Python frontend needed no change for the problem:
time=andinitial=on aRegionwere already described. An animation of a region is now drawn up to its boundary in every frame, as a still picture is.Documentation: a section of the guide and of the method page, and the overviews.
Verified against exact solutions, from the problem to the solution: heat on a square, with the error falling by more than a factor of 50 from each of the degrees 4, 6 and 8 to the next, and to \(10^{-9}\) with the plan of the planner. A steady source. A plate without flux, which keeps its mean. Values and slopes that change in time, with the fourth order of the interpolation in time. A source that changes in time on a disk. Waves on a disk with a mix of value and slope, and with damping. The Schrödinger equation with a constant potential on a triangle, with complex values on its sides. A disk with a hole. From Python, the decay of a disk at the rate of its lowest mode, the square of the first zero of \(J_0\), to \(10^{-8}\).
What was found¶
The eigenproblem is the cost, and it is steep. 2 500 points take 2.4 s, 3 500 take 7 s, 4 800 take 16 s, on one core, with about 30 bytes of memory per point squared at the peak. Everything else in a solve takes less than a tenth. Locating the points of the output grid in the elements was done for every recorded time at first, and is now done once.
A hole is expensive. The disk with a hole of milestone 32 takes 84 elements on the coarsest mesh, and with them 3 120 points at the degree 6. The planner stops there and says that \(\sin(x)\cos(y)\) is not resolved to its tolerance: the error is \(10^{-8}\).
Rounding bounds the accuracy at about \(10^{-10}\). The eigendecomposition is right to a rounding error of the largest eigenvalue, which grows with the fourth power of the degree. On the square, the degree 12 is less accurate than 10 for this reason.
Waves show what heat hides. A membrane that is let go from a shape whose curvature does not vanish at the fixed rim carries a kink for good, and converges like a power of the degree: on a disk, the degrees 10 and 12 differ by \(3 \cdot 10^{-2}\) for such a start, against \(7 \cdot 10^{-4}\) for one that fits. A pulse that is narrow enough to vanish at the rim is not resolved by 3 500 points. Three or four digits are what a drum gets, and the documentation says so.
A plan must not promise what the solve refuses. A mix of value and slope with a ratio that is not real was first refused by the eigenproblem alone. It is now refused when the problem is read.
Decisions¶
D34.1. In time, a shape is propagated in its modes, from one dense eigenproblem¶
Developer, 2026-11-19.
Decision D65 propagates linear equations in time exactly, in the modes of the operator in space. On a box these come axis by axis. On a shape they come from the matrix of the elements as a whole.
One dense, symmetric eigenproblem. With the diagonal matrix \(M\) of the quadrature and the symmetric matrix \(K + B\) of the weak form, the matrix \(-M^{-1/2}(K+B)M^{-1/2}\) is real and symmetric, and its eigenvectors are orthogonal. The points whose value is given are left out. A real matrix serves complex equations too: the coefficient of the Laplacian multiplies the eigenvalues.
The modes are a kind of
collocation::Modes. The propagator, the treatment of a source, the cubic interpolation in time and the second order in time are those of boxes, unchanged. This is the reuse that the comparison of milestone 32 counted on.Conditions. Given values enter as a forcing through the entries of the matrix that join them to their neighbours, and given slopes through their integral over the boundary. Both may depend on time. A mix needs a real ratio of its two coefficients, or the matrix is not symmetric: such a problem is refused.
What it costs is accepted for now. Time with the cube of the points and memory with their square bound the method at a few thousand points. A plan with more than 6 000 is refused. What reaches further needs products with the operator only, and is package C17.
Against the hardest targets (decision D9): in space the same holds with far more points, which is why C17 comes before time on shapes in space.
D34.2. A method of its own in the plan: element_propagator¶
Developer, 2026-11-19.
The plan of a problem in time on a shape names the method
element_propagator, with the degree and the spacing of
spectral_elements and the steps of mode_propagator. One method with
all three, and not two entries, because a plan has one method. The grid
and the times are those of decision D33.4 and of every problem in time.
D34.3. In time the planner looks at what is given, and does not solve¶
Developer, 2026-11-19.
The stationary planner solves on one candidate after another (decision D33.7). In time a candidate costs an eigenproblem, so the planner does what the planner of boxes does: it resolves what is given.
The degree is the lowest from 8 on at which the Legendre coefficients of the initial state, and of the source at a few instants, fall to \(10^{-8}\) in every element. From 8 on, because what is given on the boundary is not looked at, and neither is the solution.
\(10^{-8}\) and not \(10^{-10}\). The error of the solution was found a hundred times below this tail, and a point costs more here than anywhere else.
The first mesh has a spacing of half the size of the shape, twice that of the stationary planner: few elements of a high degree resolve smooth data with the fewest points. A finer mesh is taken only where the coarse one fails.
3 500 points at most, which is seven seconds. The coarsest candidate is taken whatever it has. If the tolerance is not met, the plan says so, in the words that every planner uses: NOT resolved.
The steps are chosen as on a box, on what is given at 400 of the points and on the whole boundary.
The diagnostics are
spectral_tailfor what is given andsolution_tailfor the solution at the last time.
D34.4. Terms that must be stepped are refused on a shape for now¶
Developer, 2026-11-19.
Nonlinear terms and coefficients that vary are stepped on boxes by compiled terms that are tied to a tensor grid. On a shape the points are those of elements. Rather than a second, quick form of those terms, the problem is refused with a reason, and the work stays in package A4.
D34.5. Small changes outside the lane¶
Developer, 2026-11-19.
Two files of the lane of walls were touched, each by an addition:
methods/collocation.rs has the new kind of modes, and bounded.rs
lets shaped.rs use its reader of the part in time. In _plot.py, an
animation now treats a region as a still picture does.