M53. Systems on a shape, in time

Package: A4, its twelfth part: several unknowns on a region of the plane, each with an equation of first order in time and with conditions of its own on the boundary, coupled through terms that are stepped. Reaction and diffusion on a dish of any shape.

What was built

  • shaped_system: the classification, the planner and the solver of a system on a shape. Each equation is sorted by what its terms hold: the terms with the unknown whose rate of change it gives, or with no unknown, make a problem on the shape for that unknown alone, which is read by the code that reads a single equation. The terms that hold another unknown are the coupling.

  • One stepping for all unknowns. Each unknown is expanded in the modes of its own operator and conditions. The coefficients of all of them are the state of the exponential scheme of milestone 38, and the terms that are stepped, the coupling and whatever a single equation would have stepped, are compiled together and evaluated at the points of the elements.

  • Shared modes. Unknowns whose operators differ by a factor alone, with the same conditions, share one eigenproblem (ShapeModes::scaled_to).

  • The planner chooses the elements by the initial states and the terms of all equations, and stays within the points that it has one equation stepped with.

  • In Python: a condition on a region may be a list of equations, one for each unknown, for the whole boundary or for a curve or a piece. solution(…, unknown=v) and solution.integral(v) read the unknown that is named from what the method holds.

  • What a single equation in time is given (Given) hands the terms that it has stepped on as they are written, and takes the terms at the initial state from outside when it measures how well they are resolved. The search for the elements of a problem in time (choose_with) is the same for one equation and for a system.

What it reaches

On the unit square, \(u = e^{-t}\sin\pi x\,\sin\pi y\) with the value zero on the sides and \(v = e^{-2t}\cos\pi x\,\cos\pi y\) with the slope zero, for \(u_t = \nabla^2 u - u v + f\) and \(v_t = \tfrac12\nabla^2 v + u^2 v + g\), on three elements to the time 1/4:

Degree

Error

Tolerance

Steps

Error

4

\(3\cdot10^{-3}\)

\(10^{-4}\)

1

\(1\cdot10^{-5}\)

6

\(5\cdot10^{-5}\)

\(10^{-6}\)

4

\(5\cdot10^{-8}\)

8

\(4\cdot10^{-7}\)

\(10^{-8}\)

16

\(2\cdot10^{-11}\)

The tests assert both: the fall with the degree, and the fourth order of the steps. Each solve takes a fraction of a second.

Two unknowns that turn into each other, \(u_t = \nabla^2 u + i v\) and \(v_t = 3\nabla^2 v + i u\) on a triangle that lets nothing out, are \(\cos t\) and \(i \sin t\) to \(10^{-8}\), with one eigenproblem for both.

On the unit disk, with the value of one unknown and the slope of the other given on the rim, both changing in time, and a first derivative in the coupling, the solution is right to \(4\cdot10^{-6}\) at degree 4.

Two substances with \(a + b \to 2b\) on an ellipse, 861 points for each: 176 steps in 4.9 s at the tolerance \(10^{-10}\), and the sum of both integrals is constant to \(10^{-13}\).

Decisions

D53.1. A system is its single equations and what couples them

Developer, 2026-11-20.

An equation of a system is split into the terms with its own unknown and the terms with another. The first part is a problem for one unknown, and is read by shaped::classify as it stands: everything that a single equation in time may have, a density, a medium, a potential, a drift, terms of its own that are stepped, holds for each equation of a system without a line of new reading. The second part is stepped.

The alternative was a matrix of operators, as on periodic domains (decision D56), with modes of the whole system. On a shape the modes come from a dense eigenproblem whose cost grows with the cube of the points, and a coupled one would be that for all unknowns at once, and not symmetric. What the split cannot do is coupling in the second derivatives, cross-diffusion: that is refused, and left in the backlog.

D53.2. Each equation gives the rate of change of one unknown

Developer, 2026-11-20.

An equation holds the derivative in time of exactly one unknown, and each unknown has one such equation. That names the unknown whose modes the equation is solved in. Constraints, equations without a derivative in time, would need a solve in every evaluation of the terms, and equations of second order in time are not stepped on a shape at all (milestone 38): both are refused with their reason.

D53.3. A condition holds one unknown

Developer, 2026-11-20.

Each unknown has a condition on every piece of the boundary, on its value, its slope or a mix. A condition that holds two unknowns would couple their modes, and is refused. In Python a list of equations stands where one equation stood, so that a problem for one unknown is written as before.

D53.4. What the method holds, one unknown after another

Developer, 2026-11-20.

The values at the points of the elements, from which a solution is evaluated anywhere and integrated, are kept for each unknown at all times, one unknown after the other. The core functions values_at and integrals are unchanged: they take the part of one unknown, which the frontend cuts out.

D53.5. Shared modes by comparison of what was computed

Developer, 2026-11-20.

Whether two unknowns share their modes is seen at the points of the elements: the same density, medium and potential there, and the same conditions. The factor in front may differ. That costs a comparison of arrays, and saves half of the eigenproblems in the case that matters, substances that differ in their rate of diffusion.

What is left

  • Stationary systems on a shape: the matrix of the elements in blocks, and Newton’s method on it. The next part of A4.

  • Systems of second order in time, second derivatives in the coupling, constraints, and conditions that hold several unknowns.

  • Values on the boundary that change in time cost the stepping orders, for one equation as for a system: a thousand times the accuracy takes sixteen times the steps there. A scheme that treats what the boundary gives exactly would restore the order.