The direction the diffusion does not go
Worth reading first: The stencil that is not symmetric · A direction the smoother cannot see.
Exact along one axis measured what the tuned diffusion does in two dimensions: exact when the flow is along a grid line, wrong by twelve orders of magnitude five degrees later, and the worst of three schemes by forty-five. This essay is about where the error goes, and it is somewhere specific.
The added diffusion is τ b bᵀ. That matrix has rank one: applied to any vector perpendicular to b it returns exactly zero. So the artificial diffusion acts along the flow and not at all across it, which is not an oversight — it is the design, and it is what the word streamline in the method’s name means.
Why the design is right
The alternative is what upwinding does, and the convection field measured it in one dimension: upwinding is central differencing at ε(1 + Pe), with the added diffusion exactly h/2. That extra diffusion is isotropic — it acts in every direction, including across the flow — and the consequence is a smeared layer.
In one dimension there is no across, so the distinction is invisible. In two, adding diffusion across the flow smears the solution sideways, which is a first-order error in a direction where the exact solution has no structure at all. Streamline diffusion is aimed at exactly this: stabilise along the flow, where the oscillation comes from, and leave the crosswind alone.
The design is sound and this essay is the bill.
What is left undamped, counted
convection.js established the measurement this field uses for a scheme producing something the
equation forbids: the number of nodes at which the computed solution leaves the interval that the
maximum principle guarantees. Here the exact solution is between 0 and 1 everywhere, so any node
outside [0, 1] is a violation with no judgement in it.
| flow angle | nodes outside [0, 1], tuned | with a crosswind term | upwind |
|---|---|---|---|
| 0° | 0 | 0 | 0 |
| 15° | 18 | 9 | 0 |
| 30° | 50 | 11 | 0 |
| 45° | 48 | 0 | 0 |
On a 15×15 grid — 225 nodes — at Pe = 3.13.
Three readings, and the third is the one worth the essay.
At zero degrees there is nothing. There is no crosswind in the solution for an undamped crosswind direction to spoil, so the exact scheme is exact and stays inside the interval.
Off the axis, a fifth of the grid is outside the physical range. Fifty nodes at 30°, on a problem whose exact solution is smooth, monotone along the flow and constant across it.
And upwinding never leaves the interval, at any angle. That is its whole claim: it produces an M-matrix, the discrete maximum principle holds, and the answer is guaranteed to be between the boundary values whatever else is wrong with it. The tuned scheme gives that up, and the previous essay measured what it gets in return — an exact answer, at one angle.
That ratio is worth stating in words, because a figure drawn on a linear axis hides how large it is. The anti-diagonal at 45° is exactly a line across the flow, and the exact solution depends on the flow coordinate alone, so along it the exact answer is not merely smooth: it is the same double at all fifteen nodes, 1.95·10⁻³¹. The streamline scheme returns values from −1.6·10⁻¹⁰ to 5.1·10⁻¹⁰ there, changing direction eleven times — a swing 3.4·10²¹ times the answer, in a region the flow has carried nothing into. Adding the crosswind term takes the same line to 0 violations anywhere on the grid.
The absolute numbers are tiny and that is not a defence. A method is not excused by being wrong about a quantity that happens to be small: the pollution is what it is relative to the solution, and at every angle off the grid this scheme’s crosswind error is orders of magnitude larger than the thing it is computing.
The structural reason, which is not a coincidence
Counting violations says what happens. The matrix says why.
supg.js asserts of the one-dimensional tuned scheme that it is an M-matrix at every Péclet
number — no positive off-diagonal entries — and therefore cannot oscillate. That is a structural
guarantee rather than an accuracy claim: an M-matrix with the right sign pattern obeys a discrete
maximum principle, and its solution lies between the boundary values whatever else is true.
In two dimensions the property survives exactly one angle.
| flow angle | tuned | with crosswind | upwind | central |
|---|---|---|---|---|
| 0° | 0 | 0 | 0 | 210 |
| 15° | 602 | 392 | 0 | 210 |
| 30° | 812 | 392 | 0 | 420 |
| 45° | 812 | 392 | 0 | 420 |
Positive off-diagonal entries, out of 225 rows.
The cross term τb₁b₂ is zero only when the flow is along a grid line. At any other angle the four-point diagonal stencil it produces has positive entries — and 602 of them appear at fifteen degrees, where the previous essay’s error curve has already left the level of rounding.
So the violation count and the error cliff are the same event seen twice. The tuned scheme’s guarantee is a property of its sign pattern, the sign pattern is a property of the alignment, and neither is a property of ξ.
Upwinding’s zero in that table is the whole of its case. It is an M-matrix at every angle, by construction, which is why its solution never leaves [0, 1] and why it is the scheme people reach for when a guarantee matters more than an error constant.
The repair, and its price
The standard repair adds a second term: a diffusion acting on what the first one annihilates.
ε I + τ b bᵀ + c (I − b bᵀ)
with c some fraction of τ. At half:
| flow angle | tuned error | with crosswind | ratio |
|---|---|---|---|
| 0° | 2.4·10⁻¹⁷ | 5.3·10⁻¹⁷ | — |
| 15° | 3.2·10⁻² | 1.5·10⁻² | 2.20× |
| 30° | 5.7·10⁻² | 2.5·10⁻² | 2.32× |
| 45° | 6.6·10⁻² | 2.8·10⁻² | 2.35× |
The error is halved at every rotated angle, the violations fall from 18, 50, 48 to 9, 11, 0 — and the aligned case is untouched.
That last row is not a rounding coincidence. The exact solution at 0° has no crosswind variation, so a diffusion acting only across the flow has nothing to act on: it multiplies a second difference that is identically zero at every interior node. The repair costs nothing exactly where the original scheme was perfect.
A repair that is free where the method was already best is rare enough on this site to be worth stating as a rule with its reason attached: a correction aimed at a direction the solution does not vary in cannot change the solution.
What a fraction of a coefficient means
The slider on the hero figure is the crosswind coefficient, as a fraction of the streamline one, and what it does is the trade the whole scheme exists to avoid making.
More crosswind diffusion removes more of the oscillation and smears the layer further. At a quarter, some violations survive at every rotated angle; at one — full isotropy — the added diffusion is τ(bbᵀ + I − bbᵀ) = τI, the tensor is a scalar again, and the scheme has become a slightly cheaper upwinding with none of the aim it was built for.
So the fraction is a knob between two schemes this site has already measured, and the interesting thing about it is what the previous essay’s cone does under it. Half a coefficient of crosswind diffusion buys back most of the accuracy the rotation cost, and nothing buys back the exactness — that was a property of the alignment and no coefficient reaches it.
What the count is measuring
Nodes outside [0, 1] is a blunt instrument and it is chosen for that reason.
The exact solution of this problem is between 0 and 1 everywhere — it is a monotone boundary layer, and the maximum principle guarantees the discrete solution should be too under any scheme that produces an M-matrix. So a node outside the interval is a violation with no judgement in it: no tolerance, no smoothing parameter, no decision about what counts as an oscillation.
The convection field’s earlier measurement had to be more careful. A wiggle detector counting sign changes in consecutive differences reported 3.4% oscillation on a correct, non-oscillating answer, because the first test problem had a genuine interior maximum and its differences legitimately change sign once. That detector was replaced by this one, on the boundary-layer problem, where leaving the interval needs no interpretation.
The blunt instrument’s cost is that it says nothing about size. Eighteen nodes outside is eighteen nodes whether the excursion is 10⁻⁶ or 10⁻¹, and the worst undershoot at 15° is 7.8·10⁻⁵ — small in absolute terms, on a problem whose interior solution is 10⁻³. Both numbers are reported for that reason, and the count is the one asserted because it is the one with no free parameter in it.
The same shape, three fields along
The pattern this belongs to is now explicit enough to name, and it is not about convection.
A method is repaired using a quantity measured along a coordinate direction, the repair works beautifully where the difficulty is along that direction, and it fails where the difficulty is not. The line smoother takes the anisotropic V-cycle from 0.9565 to 0.0370 and returns 0.967 with the axes swapped. Semi-coarsening does the same. Smoothed aggregation returns 0.193 aligned and 0.789 rotated. And a tuned diffusion is exact at 0° and worst-of-three at 45°.
What separates this instance from the others is that the direction here is not a coordinate direction at all — it is the flow, which the method knows exactly. The tensor is built from b, so the method is correctly aimed at every angle. The failure is one level down: the discretisation of the crosswind second derivative is a central difference on a grid whose spacing across the flow is h/cos θ or worse, and nothing about being correctly aimed repairs a stencil that was never stabilised.
Why a coefficient cannot fix a rank
The previous essay noted a repair that looks obvious and is not one: recompute τ using the mesh spacing along the flow rather than the grid spacing, since at 45° the distance between grid lines along the flow is h√2.
Everything in this essay is the reason that does not work. The tensor is τ b bᵀ whatever τ is. Making τ larger adds more diffusion along the flow, where the scheme was already correct; it adds nothing at all across the flow, because b bᵀ annihilates that direction by construction; and it changes the positive off-diagonal count only in size, not in existence, because the cross term τb₁b₂ is positive for any positive τ at any angle strictly between the axes.
A coefficient cannot repair a rank deficiency, which is why every published repair adds a second term rather than adjusting the first. The forms differ — a crosswind term, a discontinuity-capturing term whose coefficient depends on the computed gradient, a shock-capturing operator — and they share the property that they act in a direction the first term does not.
That is a small structural observation and it settles a whole family of tuning attempts at once, which is the reason it is worth stating as a sentence rather than as a table.
What the layer pays
The last thing to check is the cost the whole design exists to avoid: does the crosswind term smear the layer?
It does, and the amount is the point of choosing a fraction rather than the whole. At 45° with the full coefficient the added tensor is τ(bbᵀ + I − bbᵀ) = τI — an isotropic diffusion, which is what upwinding adds and what streamline diffusion was built to avoid. At half, the crosswind direction receives half the streamline amount, and the error at every angle is better than either extreme: 2.8·10⁻² against the streamline-only 6.6·10⁻² and against upwinding’s own 1.9·10⁻³ at that angle.
That last comparison is the honest one and it does not flatter the repair. At 45° and this Péclet number, plain upwinding is still fifteen times more accurate than the repaired streamline scheme — because the problem is under-resolved, the solution in the interior is 10⁻⁴, and a scheme with a maximum principle is hard to beat when the answer is nearly zero everywhere and the only question is whether the method invents something that is not there.
The streamline method’s case is not this problem. It is the problem where the layer is resolved along the flow and smearing it across the flow would cost real accuracy — and the measurement in this essay says what has to be added back before that case is reached from an arbitrary angle.
What the assertions say
Four claims are checked on every build, and one of them is a refusal that would be easy to write the other way round.
The rank-one tensor annihilates the crosswind — checked as an inner product rather than argued, and
fed to rejects() as the claim that streamline diffusion acts across the flow, which must fail.
The tuned scheme leaves the interval off the axis and upwinding never does — asserted at four angles in both directions, because the second half is what makes the first a trade rather than a defect.
The crosswind term halves the error at every rotated angle — a factor asserted to be above 1.8, at three angles.
And it costs nothing at zero, asserted as an absolute error below 10⁻¹⁴, which is the claim a later change to the crosswind discretisation would break first.
What the drag does
The slider is the crosswind coefficient as a fraction of the streamline one, from a quarter to the whole of it.
At every position the aligned case is exact. That is the assertion the figure carries at every frame, and it is the one worth watching: whatever fraction is chosen, and however much the rotated cases improve, the bar at zero degrees does not move off the level of rounding.
What does move is the balance at the rotated angles. A quarter leaves violations everywhere; a half clears them at 45° and reduces them elsewhere; the whole of it clears them everywhere and has stopped being a streamline method. The right fraction is a problem-dependent choice — which is the position this field keeps arriving at, and is why the parameter is the modelling rather than a detail of the scheme.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- The diffusion that makes the answer exact — both name artificial diffusion, boundary layer, convection diffusion, m matrix, peclet number, streamline diffusion
Named objects
A flat tag is an object no other essay names yet.
Artificial diffusionBoundary layerConvection diffusionCrosswind diffusionDiscrete maximum principleGrid alignmentM matrixPeclet numberStreamline diffusionUpwinding