The diffusion that makes the answer exact
Worth reading first: The stencil that is not symmetric.
The convection essay leaves the field with two schemes and a threshold between them. Central differencing solves its own system to 4.6·10⁻¹⁸ and, past a cell Péclet number of exactly one, produces a solution that leaves the interval [0, 1] at sixteen of thirty-one points — an answer the differential equation forbids, computed correctly. Upwinding never leaves the interval, and it is solving a different problem: ε(1 + Pe) instead of ε, entry for entry to 1.3·10⁻¹⁶, with the added diffusion exactly h/2 and independent of ε.
Both of those are choices about a single number, and neither choice was made by asking what the answer was. Upwinding adds h/2 because that is what a one-sided difference happens to add. Central differencing adds nothing because that is what a symmetric difference happens to add.
This essay is about the scheme that picks the number on purpose, and about what its success is a property of.
One formula
ξ(Pe) = coth(Pe) − 1/Pe ε̃ = ε (1 + ξ·Pe)
Discretise with central differences at ε̃ rather than ε, and the computed solution equals the exact solution at every grid point.
| n | ε | Pe | ξ | tuned | upwind | central |
|---|---|---|---|---|---|---|
| 31 | 0.005 | 3.125 | 0.684 | 2.4·10⁻¹⁷ | 0.136 | 0.517 |
| 31 | 0.05 | 0.313 | 0.103 | 5.6·10⁻¹⁷ | 0.092 | 0.012 |
| 63 | 0.002 | 3.906 | 0.745 | 2.7·10⁻¹⁷ | 0.113 | 0.593 |
| 15 | 0.1 | 0.313 | 0.103 | 1.1·10⁻¹⁶ | 0.092 | 0.012 |
Not “second order”, not “uniformly convergent in ε”, not “accurate for practical purposes”: exact, at the nodes, at every Péclet number tried, with the error at the level of the arithmetic that computed it.
The site has one other family with this property — the Hilbert matrix, whose inverse exact.js
computes in BigInt rationals, and the Kac–Murdock–Szegő matrix, whose inverse is tridiagonal in closed
form. Both are exact ground truths because somebody wrote down a formula for an answer. This one is
a formula for a scheme, and the exactness is of the discretisation rather than of the solve.
Why it works, which is also why it is fragile
The exact solution of −εu″ + u′ = 0 with u(0) = 0, u(1) = 1 is
u(x) = (e^{x/ε} − 1) / (e^{1/ε} − 1)
which, sampled at equally spaced points, is a geometric sequence plus a constant: uᵢ = (rⁱ − 1)/(rⁿ⁺¹ − 1) with r = e^{h/ε}.
A three-point difference operator applied to a geometric sequence gives that sequence back multiplied by a quadratic in its ratio. So the discrete equation is satisfied exactly if the operator’s quadratic has a root at exactly r — and ξ is the value of the diffusion coefficient that puts it there. The derivation is two lines and it consists entirely of matching the discrete ratio to e^{h/ε}.
That is the whole of the mechanism, and it says immediately what the scheme is good for: it is exact because the answer is a geometric sequence and the scheme was built to reproduce one. Nothing about it is a general repair for convection.
Both older schemes are limits of it
| n | Pe | ξ | tuned adds | upwind adds |
|---|---|---|---|---|
| 31 | 3.125 | 0.684 | 1.07·10⁻² | 1.56·10⁻² |
| 63 | 1.563 | 0.452 | 3.53·10⁻³ | 7.81·10⁻³ |
| 127 | 0.781 | 0.250 | 9.78·10⁻⁴ | 3.91·10⁻³ |
| 255 | 0.391 | 0.129 | 2.52·10⁻⁴ | 1.95·10⁻³ |
So the field’s two existing schemes are not two ideas with a third one beside them. They are the two ends of one curve, and the practical statement is that upwinding over-corrects at every finite Péclet number — by a factor of 1/ξ, which is 1.5 at Pe = 3 and 7.8 at Pe = 0.39.
That is worth stating as a criticism of upwinding rather than as praise of the tuned scheme, and it is the criticism the convection field’s own measurement already implied: upwinding’s answer is 0.388 from the exact solution of the problem it solves and 71.1 from the exact solution of the problem that was posed. It is solving a well-behaved problem that is not the one asked about, and ξ says exactly how much of that substitution was necessary.
And it cannot oscillate
The tuned operator’s upper off-diagonal is −ε̃/h² + 1/2h, which is nonpositive exactly when ξ ≥ 1 − 1/Pe — and coth(Pe) ≥ 1 makes that true at every Pe. So the matrix is an M-matrix at every grid and every diffusion, and the solution obeys the maximum principle by inequality rather than by luck.
| n | Pe | tuned: points outside [0, 1] | central: points outside |
|---|---|---|---|
| 7 | 12.5 | 0 | 4 |
| 15 | 6.25 | 0 | 8 |
| 31 | 3.125 | 0 | 16 |
| 63 | 1.563 | 0 | 11 |
| 127 | 0.781 | 0 | 0 |
The last row is where central differencing crosses back under Pe = 1 and stops oscillating, which is the threshold that essay bisected to 1.0000000000000002 arriving here as a column of zeros.
Exact at the nodes is not exact
The nodal values are the true solution to rounding. Between them, the computed function is whatever is drawn through those points — a straight line, in every plot and in every interpolation a code would use for output.
| n | ε | nodal error | midpoint error | where |
|---|---|---|---|---|
| 31 | 0.005 | 2.4·10⁻¹⁷ | 0.457 | x = 0.984 |
| 63 | 0.002 | 2.7·10⁻¹⁷ | 0.480 | x = 0.992 |
Nearly half the solution’s whole range, in the cell nearest the boundary — because the true solution climbs from near zero to one inside that single cell, and a straight line across it is as wrong as a straight line can be.
That is not a criticism of the scheme; it is what “nodally exact” means, and the phrase is in every account of the method precisely because the distinction is real. What the scheme guarantees is the value at the points it was asked about. The layer is still unresolved, and if what is wanted is the flux at the wall, or the position of the layer, or the solution anywhere between two grid points, the tuned scheme has not helped at all.
The finding: the exactness belongs to the problem
Same operator, same ε, same grid, same tuned ε̃. Different right-hand side: a manufactured smooth solution u(x) = sin(πx), with whatever f that requires.
| n | tuned | central | tuned ÷ central |
|---|---|---|---|
| 31 | 6.69·10⁻² | 1.60·10⁻³ | 41.9 |
| 63 | 2.21·10⁻² | 3.99·10⁻⁴ | 55.4 |
| 127 | 6.12·10⁻³ | 9.96·10⁻⁵ | 61.4 |
The ratio grows with refinement, because central differencing is second order here — 4.00 and 4.00 to two decimals, which is asserted — and the tuned scheme is not: 3.03 and 3.61, between first and second order, because the diffusion it adds is only O(h²) in the limit Pe → 0 and these grids are not there.
The added diffusion is an error wherever there is no layer for it to stabilise, and nothing in the formula knows whether there is one. ξ is a function of Pe alone. It does not look at the right-hand side, and the right-hand side is what decides whether the solution is a geometric sequence.
Which is a finding this site has made before, in another field
The depth phase measured a multigrid smoother built for anisotropy: it returns a convergence factor of 0.037 on the problem it was aimed at and 0.967 on the same problem turned through a right angle. The name that phase gave the shape was where a method’s competence was put into it by hand — the repair encodes not “cope with anisotropy” but “cope with anisotropy along y”, and the direction was supplied by whoever typed the string.
This is the same shape with the hand-supplied information being the form of the solution rather than a direction. ξ encodes “the answer is a geometric sequence with ratio e^{h/ε}”. On a problem where that is true, the scheme is exact. On a problem where it is not, the scheme is a first-order method competing against a second-order one, and losing by a factor that grows as the grid is refined.
What a real code does with this
The one-dimensional streamline diffusion method is this scheme — the streamline-upwind Petrov–Galerkin stabilisation reduces to exactly ε̃ = ε(1 + ξPe) on this problem — and in more than one dimension it is where the method’s design decisions actually live. Two of them are visible from here.
The direction. Streamline diffusion adds its diffusion along the flow rather than isotropically, which is what stops it from smearing the solution across the streamlines. In one dimension there is only one direction and the distinction is invisible; in two it is the whole method, and it is the same distinction the anisotropy field spends four essays on.
And the parameter. Every practical code uses ξ, or a cheaper approximation to it, computed per element from a local Péclet number. What this essay says about that is not that it is wrong but that its optimality is inherited from a one-dimensional constant-coefficient problem with no source term — and that the measurement above, of the same formula on a smooth problem, is what the inheritance costs when the local situation is not the one it was derived from.
The derivation, in the form that says what it assumes
The exactness reads as luck until the two lines behind it are written down, and the two lines are also the list of what has to be true for it to hold.
The exact solution sampled at equally spaced points is a geometric sequence plus a constant: uᵢ = (rⁱ − 1)/(rⁿ⁺¹ − 1) with r = e^{h/ε}. Apply a three-point difference operator with diffusion ε̃ to a geometric sequence with ratio q and the result is that sequence multiplied by
(−ε̃/h² + 1/2h)·q + 2ε̃/h² + (−ε̃/h² − 1/2h)/q
which is zero exactly when q is a root of a quadratic whose coefficients are the stencil’s. So the discrete equation is satisfied exactly if the operator’s quadratic has a root at r — and ξ is the diffusion that puts it there. That is the whole mechanism.
What the derivation needs is now visible: a constant coefficient, so that r is one number rather than one per cell; a constant ε, for the same reason; and a right-hand side that leaves the solution a combination of 1 and rⁱ. Change any of the three and the scheme is a first-order method with an unusually large constant, which is what the manufactured problem measures.
Why it cannot oscillate, as an inequality
The M-matrix property is checked as a measurement above and it holds for a reason that needs no measurement. The upper off-diagonal is −ε̃/h² + 1/2h, which is nonpositive exactly when
ε̃ ≥ h/2 ⟺ 1 + ξ·Pe ≥ Pe ⟺ ξ ≥ 1 − 1/Pe
and ξ = coth(Pe) − 1/Pe with coth(Pe) ≥ 1 for every positive Pe. So the inequality holds at every Péclet number with room to spare, and the column of zeros in the excursion table is a consequence rather than a coincidence.
That is worth having beside the central scheme’s threshold. Central differencing satisfies the same inequality exactly when Pe ≤ 1, which is the threshold that field bisected to 1.0000000000000002 — so the two schemes differ by whether a condition holds at one Péclet number or at all of them, and the tuned scheme buys that with the smallest amount of diffusion that does it.
And where a real code puts this
The one-dimensional streamline diffusion method is this scheme: the SUPG stabilisation of the one-dimensional convection–diffusion equation reduces to exactly ε̃ = ε(1 + ξPe), which is why the formula appears in every finite-element account of stabilisation as well as in every finite-difference one.
In more than one dimension the method’s design decisions become visible, and two of them are worth naming from here because both are invisible in one dimension. The stabilisation is added along the streamline rather than isotropically, which is what stops it smearing the solution across the flow — a distinction that does not exist when there is one direction. And the parameter is computed per element from a local Péclet number, which inherits its optimality from the constant-coefficient one-dimensional problem above and therefore inherits the limitation this essay measures.
What is left
Two dimensions, where the flow has a direction, the stabilisation is anisotropic by design, and none of the closed forms above survive. That is where the subject actually lives and it is a phase’s work rather than a section’s.
Higher-order stabilisations — the discontinuous Galerkin family, and the residual-based schemes that add diffusion proportional to how badly the equation is being violated locally. The second of those is the direct answer to this essay’s finding: a scheme that measures whether there is a layer rather than assuming one.
And a variable coefficient. The exactness rests on ε and the velocity being constant, so that r is one number rather than a different ratio in every cell. A problem with a varying velocity has a different geometric ratio per cell and the scheme is no longer exact anywhere — which is measurable, and is not measured here.
What links here
Computed from the collection, not written here: the essays that point at this one.
Named objects
A flat tag is an object no other essay names yet.
Artificial diffusionBoundary layerConvection diffusionDiscretisation errorM matrixManufactured solutionPeclet numberStreamline diffusionUpwind differencing