Shapes with corners¶
On a region of the plane the error of spectral elements falls exponentially with the degree of the elements. This page explains which corners of a region break that rate, and how the mesh shrinks towards them in layers.
Corners¶
That rate needs a solution that is smooth up to the boundary. At some corners it is not. Near a corner with the angle \(\omega\) inside the region, a solution behaves like \(r^\lambda\) in the distance \(r\) from the corner, with
the first where the two pieces that meet both give the value or both the slope, the second where one gives the value and the other the slope. Below \(\lambda = 1\) the slope of the solution grows without bound towards the corner. That is so at every corner that points into the region, such as the one of an L-shape, where \(\omega = 3\pi/2\) and \(\lambda = 2/3\). It is also so in the middle of a straight side at which the condition changes from a value to a slope, where \(\lambda = 1/2\).
No polynomial follows \(r^{2/3}\) at \(r = 0\). On a mesh that takes no notice of the corner, the error falls like a power of the degree and of the size of the elements, and four digits are all that comes easily. The remedy is a mesh whose elements shrink towards the corner: layer by layer, each half the size of the one before. On each layer the solution is smooth on the scale of its elements, and what is left of the singularity sits in the innermost layer, where it is small.
pdemagic finds these corners from the pieces of the boundary and the kinds
of their conditions, and adds the layers: layers in the plan. For
\(-\nabla^2 u = 1\) on the L-shape with \(u = 0\) on the edge, at the degree
12:
Layers |
Elements |
\(u(-0.5, 0.5)\) |
Solve |
|---|---|---|---|
0 |
66 |
0.131 047 826 |
0.04 s |
6 |
300 |
0.131 052 901 |
0.1 s |
12 |
612 |
0.131 052 961 853 |
0.2 s |
18 |
828 |
0.131 052 962 029 |
0.3 s |
24 |
1 320 |
0.131 052 962 031 |
0.6 s |
Every six layers gain two to three digits. For a solution that is known, \(u = r^{2/3}\sin(2\theta/3)\) on the same shape, the largest error on the grid of the solution falls from \(10^{-3}\) without layers to \(10^{-10}\) with the 18 that the planner chooses.
The planner gives every such corner the same number of layers, \(\lceil 12/\lambda \rceil\) for the smallest exponent among them: 18 for an L-shape, 24 where a condition changes on a straight side. The innermost elements are then smaller than the first by \(2^{-12/\lambda}\), and what they leave of the singularity is the same for any exponent. At most 40 layers are taken, beyond which the corners of the innermost elements can no longer be told apart.
The exponent is that of the Laplacian. A medium, or coefficients that differ by direction, change it somewhat, and the layers are then more or fewer than the corner needs. A jump in the values that are given along the boundary is a singularity too, and is not looked for.
Limits¶
Singularities that are not at a corner of the kinds above are not looked for: a jump in the values given along the boundary, or a corner whose exponent a medium has lowered below 1.