M35. General linear equations on shapes in the plane

Package: A4, its third part: stationary linear equations of second order on a region that curves bound, with first and mixed derivatives and with coefficients that vary. The owner gave the package (decision D33.1).

What was built

  • Any linear elliptic equation of second order for one unknown, on a region of the plane: $\nabla\cdot(\varepsilon\nabla u) + \sum a_{ij},\partial_i\partial_j u

    • \mathbf{b}\cdot\nabla u + c,u = f$, with coefficients that are formulas of the place. shaped.rs reads the terms, and methods/elements.rs builds the matrix of each element from the coefficients at its points.

  • The flux on the boundary. A side of an element on the boundary knows its normal and its direction. Where the matrix in front of the second derivatives turns the normal, the slope along the side enters, from the values on the side.

  • Nothing new in the plan. The method, the planner and the diagnostics are those of milestone 33. The tail of the coefficients counts with that of the source.

  • Documentation: a section of the guide and of the method page, and the overviews.

Verified against one exact solution on the disk with a hole, from the problem to the solution, with the error falling by more than a factor of 30 from each degree to the next and reaching \(10^{-10}\) or better at the degree 10: a drift with a term in the unknown, with a slope on the hole. A medium inside a divergence with a potential, with a mix of value and slope. A coefficient that varies in front of the Laplacian, with a slope on the rim. Different coefficients along the two coordinates with a mixed derivative, with slopes on every piece. Coefficients that vary in every term. A drift with slopes all around, which leaves a constant open.

What was found

  • The mean of a floating solution needs its own row. With the points inside the elements eliminated, the constraint on the mean and the constant that it frees couple to the shared points through the matrix of the element and through its transpose. For the Laplacian the two are the same, and milestone 33 used one for both. With a drift they differ: the first test was wrong by \(6 \cdot 10^{-4}\).

  • No cost for the simple case. The matrix of an element is now built in complex numbers from coefficients at every point. The solves of the two cases of milestone 33 take 0.88 and 0.93 of the time before.

  • A benchmark table was wrong. The record of milestone 33 gave the degree of the case region_poisson_2d as 10. It is 14.

Decisions

D35.1. One weak form for every linear equation of second order

Developer, 2026-11-19.

On a box each kind of term has its own treatment and its own package (A7, A8). Elements do not need that: the weak form takes every term of a linear equation of second order at once, with coefficients at the quadrature points.

  • Inside a divergence, \(\nabla\cdot(\varepsilon\nabla u)\): the coefficient is never differentiated.

  • In front of second derivatives, \(a_{ij}\,\partial_i\partial_j u\): taken under the derivative, which leaves the drift \(-(\partial_i a_{ij})\,\partial_j u\). The derivative of the coefficient is that of its polynomial on the element, and so as accurate as everything else. No formula is differentiated, and a frontend need not do it.

  • A coefficient that varies in front of a divergence whose inside varies too would need the same for a product. It is refused with a reason: an equation is rarely written so.

  • The matrix is not symmetric in general. The elimination and the sparse LU factorization of milestone 33 do not ask for symmetry.

  • The equation is scaled by the largest entry of the matrix in front of the second derivatives, where milestone 33 had the coefficient of the Laplacian.

Checked against the hardest targets (decision D9): the same form holds in space, and is where Newton’s method for nonlinear equations and systems will put their linearisations.

D35.2. A condition means the slope along the normal, also in a medium

Developer, 2026-11-19.

Decision D33.3 lets a condition hold the derivative along the outward normal. In a medium, and with coefficients that differ by direction, the weak form leaves another quantity on the boundary: the flux \(\mathbf{n}\cdot A\,\nabla u\).

  • The condition keeps its meaning. ∂u/∂n is the derivative along the normal, whatever the equation. A condition then reads the same on every domain, and a user who knows the flux divides by the coefficient.

  • The difference is computed. The flux is the slope along the normal times \(\mathbf{n}\cdot A\,\mathbf{n}\), plus the slope along the boundary times \(\mathbf{n}\cdot A\,\mathbf{t}\). The second is taken from the values on the side of the element, by the derivative of their polynomial.

D35.3. Ellipticity is checked at the points of the elements

Developer, 2026-11-19.

An equation whose second derivatives act with different signs in different directions is no boundary value problem. For real coefficients the matrix in front of the second derivatives must have a positive determinant at every point of the elements, and for complex ones a determinant that is not zero. Otherwise the problem is refused, with the point. A check on the formulas would need to know the region, which only the mesh does.

D35.4. In time the operator stays a Laplacian and a constant

Developer, 2026-11-19.

The modes of milestone 34 are those of a symmetric matrix. A drift or directions that differ make it something else, and coefficients that vary are stepped on every other domain. Both are refused in time with a reason, and stay in package A4 with the stepped terms.