M70. Reaction and diffusion between walls¶
Package: A10: several unknowns in time on a box with walls or on a round domain, each with its own operator and its own conditions on the faces, coupled through the terms that are stepped. Reaction and diffusion of several substances.
What was built¶
Systems in time on boxes and round domains. A problem with several unknowns, a time and boundary conditions is solved where each equation gives the rate of change of one unknown at first order in time: on a box of any dimension, also with periodic sides, and on a disk, a ring, a ball, a shell and a cylinder. The plan names the method
exponential_runge_kutta.Each unknown has its own conditions.
boundary=takes a list of equations for a face, one for each unknown, as on a region. One substance can be held at a wall that another cannot pass.The module
bounded_system. It sorts each equation into the terms of its own unknown and the terms that hold another one, reads the first as a single equation on the domain, and steps the coefficients of all unknowns as one state.The pages for users. The topic page on systems has a section on walls, the reference lists the form on boxes and on round domains, the gallery has a reaction in a dish, and the methods have a page.
What was measured¶
\(u_t = D u_{xx} - v\), \(v_t = D v_{xx} + u\) between walls that hold both: \(\sin\pi x\) turns from one unknown into the other while it decays. The error is \(1.5\cdot10^{-12}\) at the time 2, after 80 steps.
A manufactured pair with different conditions, \(u = e^{-t}\sin\pi x\) held at the walls and \(v = e^{-2t}\cos\pi x\) without a slope there, in \(u_t = \tfrac14 u_{xx} + u v + f\) and \(v_t = \tfrac12 v_{xx} - u^2 + g\): the error is \(1\cdot10^{-3}\), \(1\cdot10^{-5}\), \(9\cdot10^{-8}\), \(4\cdot10^{-10}\) and \(7\cdot10^{-13}\) on 6, 8, 10, 12 and 16 points.
Mirror symmetry, as the package asked: the Gray–Scott reaction between two walls without flux against the periodic solver on twice the length. A pulse that lives and spreads agrees to \(4\cdot10^{-9}\) at the time 50. The two solvers share the stepping scheme and nothing in space.
A manufactured pair in a disk and in a ball, polynomials of the radius with different conditions, to \(10^{-8}\). A reaction \(a + b \to 2b\) in a ball, a ring and a cylinder keeps the integral of \(a + b\) to \(10^{-13}\).
A coupling through a first derivative, through a second derivative, and with the imaginary unit, each against an exact solution.
Decisions¶
D70.1. Each unknown is a problem of its own, and the coupling is stepped¶
Developer, 2026-11-20.
The same cut as on a shape (decision D53.1). An equation is sorted into the terms that hold its own unknown alone and the terms that hold another one. The first, with the conditions of that unknown, are handed to the classification of a single equation, which returns the operator, what is stepped of it, the source and the conditions. So everything a single equation in time takes, a system takes for each of its unknowns, and nothing had to be written twice: a drift, a decay, a potential that varies, values on the faces that depend on time. The state of the stepping is the coefficients of all unknowns in their own modes, one unknown after another. The package named boxes. Round domains came with them, since a single equation there is the same kind of object.
D70.2. An unknown that does not diffuse is refused¶
Developer, 2026-11-20.
The modes of an unknown are those of its operator with its conditions, and without a second derivative along a direction with faces there are no conditions to take and no such modes. The slow unknown of the FitzHugh–Nagumo model is of this kind. It is refused with the reason that a single equation gets, and is a package of its own (A23), with equations of second order in time and constraints: each needs a state that is not the coefficients in the modes of a diffusion.
D70.3. One grid, judged on what the terms are at the start¶
Developer, 2026-11-20.
All unknowns live on one grid. The planner takes the coarsest on which the initial states, what each unknown is given, and every stepped term at the initial state are resolved, with the least number of points of a stepped problem. A derivative in a stepped term is taken on the grid, where it does not depend on the conditions of the unknown that it is taken of, so one unknown’s differentiation serves all of them.
D70.4. The loss of order at walls is measured and recorded¶
Developer, 2026-11-20.
With a value other than zero held at a wall, or values that depend on time, the scheme takes 1 280 or 2 560 steps where 80 would do, and the error grows with the number of steps: \(5\cdot10^{-8}\) for the manufactured pair with \(u = e^{-t}(1 + x + \sin\pi x)\) given on the walls. One equation behaves the same way, and has since milestone 18: the stepped term then does not vanish at the wall, and the exponential scheme loses its order. The remedy, to step the unknown without a part that carries the values on the faces, changes the stepping of single equations as well, and is a package of its own (C18). The limit is listed, with the numbers.
What was found on the way¶
In a ball the number of modes is not the number of values inside it, and the state was cut by the second. A trial from Python found it, and a test on a ball with a coarse grid holds it.
The checks of this pull request were cancelled at their limit of 30 minutes, with every test passed and the pages half built: the runner took 27 minutes for the tests, which took 13 for milestone 69 an hour before, and take as long as then on the developer’s machine. The limit is now 45 minutes.
What is left¶
An unknown that does not diffuse, equations of second order in time, constraints, and data from arrays (A23).
Stationary systems between walls, and systems whose operator couples the unknowns (A11).
The loss of order at walls that hold a value (C18).
A derivative in a term that couples, on a round domain (A15).