Iterating, instead of factorising

The direction the diffusion does not go

Streamline diffusion adds τbbᵀ, a rank-one tensor that annihilates every direction across the flow. That is the design. The price is 18, 50 and 48 nodes where the computed solution leaves the interval the equation guarantees — and half a coefficient of crosswind diffusion halves the error at every angle while costing exactly nothing where the scheme was exact.

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.

Streamline diffusion alone, and with 0.5 of it across the flowTwo bars an angle, on a logarithmic scale. On the axis both are at the level of rounding — the crosswind term costs nothing where the scheme was exact. At 45° the error falls from 0.0661 to 0.0281 and the nodes outside [0, 1] fall from 48 to 0.worst nodal error, and nodes outside the interval the equation guarantees0°, streamline only2.39·10⁻¹⁷ · 0 outside0°, with crosswind5.25·10⁻¹⁷ · 0 outside15°, streamline only0.032 · 18 outside15°, with crosswind0.0145 · 9 outside30°, streamline only0.0571 · 50 outside30°, with crosswind0.0247 · 11 outside45°, streamline only0.0661 · 48 outside45°, with crosswind0.0281 · 0 outsidewhat the crosswind term buyserror ratio at 0°0.45error ratio at 15°2.2error ratio at 30°2.3error ratio at 45°2.3free where the scheme was exactand half the error everywhere else
Fig. 1 Two bars an angle: the tuned scheme alone, and the same with half its coefficient added across the flow. The pair at zero degrees is the one to read first.

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.

The upwind answer, against the two problems it might be answeringThe upwind solution drawn against two exact solutions: the one for the ε that was asked for, whose layer is thin, and the one for ε(1 + Pe) = 0.02063, whose layer is 4.125 times thicker. It lies on the second. The two operators are identical entry for entry, to 1.3·10⁻¹⁶.00.250.50.75100.250.50.751xuexact at ε = 0.005exact at ε(1 + Pe)the upwind answeran exact answer to a different question‖upwind(ε) − central(ε(1+Pe))‖/‖·‖1.3·10⁻¹⁶distance to the problem it solves0.39distance to the problem posed71the added diffusion is h/2 = 0.01563, whatever ε isso refining removes it
Fig. 2 What upwinding is, from the one-dimensional field: central differencing at a different diffusion, entry for entry to 1.3·10⁻¹⁶, with the added amount exactly h/2. In two dimensions that addition is isotropic, and streamline diffusion exists to make it directional.

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
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.

The solution along a line across a flow at 30°Four curves along the anti-diagonal of the grid, which at 45° is exactly a line across the flow. The exact solution depends on the flow coordinate alone, so on this line it never rises above 1.96·10⁻²³ — the region the layer has decayed to nothing by. The streamline scheme's answer there swings over a range 8.9·10¹² times that value and changes direction 9 times; upwinding turns 1 time and stays inside [0, 1] everywhere on the grid, where the streamline scheme leaves it at 50 nodes.0246810121403.5·10⁻¹¹7·10⁻¹¹10⁻¹⁰1.4·10⁻¹⁰position across the flowcomputed valuestreamline onlywith crosswindexactwhat is left undampedturns along this line9swing, against the exact value8.9·10¹²nodes outside [0, 1]50with a crosswind term11upwind, for comparison0the exact solution is flat across the flowand the scheme aimed along it is not
Fig. 3 The same fact along one line, and the scale is the argument. The exact solution never exceeds 2·10⁻²³ on this line — the flow has carried nothing across it — while the streamline scheme swings over a range 8.9·10¹² times that, turning nine times. The curve that follows the exact one is the same scheme with a crosswind term added. Upwinding turns once and stays inside [0, 1] everywhere.

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 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
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.

Error against the angle between the flow and the grid, at Pe = 1.56Three curves against the flow angle on a logarithmic vertical axis. The tuned scheme is exact at zero — 3.5·10⁻¹⁷ — and is 0.00303 five degrees later. Central differencing and upwinding start at 0.263 and 0.198 and fall as the angle grows, because the exact solution's own size in the interior falls with it.05101520253035404510⁻¹⁷10⁻¹⁴10⁻¹¹10⁻⁸10⁻⁵10⁻²angle between the flow and the grid (degrees)worst nodal errortunedcentralupwindexact, and then nottuned, on the axis3.5·10⁻¹⁷tuned, five degrees off0.003tuned at 45°0.037upwind at 45°0.019fifteen orders of magnitude for five degreesand the worst of the three by forty-five
Fig. 4 The previous essay’s measurement at a milder Péclet number, where the tuned scheme holds its lead out to about 25°. The crosswind term moves this picture up, in the sense of making the tuned curve flatter in the angle, and it does not move the point at zero.

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.

Smoothed aggregation against the angle of the anisotropy (ε = 0.001)Convergence factor against the rotation angle, with the stencil's largest axis coupling and its diagonal coupling on the same axis. Aligned, the factor is 0.1935. At 45° it is 0.7894, and the reason is beside it: the axis couplings are 0.5005 while the coupling along the direction the anisotropy runs in is 0.2497. The matrix does not contain the anisotropy.-213284300.250.50.751rotation of the anisotropy (degrees)factor / couplingusableconvergence factoraxis couplingdiagonal couplingthe standard answer, and the anglefactor at 0°0.19factor at 45°0.79axis ÷ diagonal coupling at 45°2the hierarchy reads the matrixand the matrix lost the direction
Fig. 5 The synthesis phase’s version of the same shape: an algebraic method that discovers semi-coarsening from the matrix entries alone, and fails at 45° because the rotated stencil no longer contains the anisotropy the equation has. The failure there is in the discretisation too.

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.

−εu″ + u′ = 0 on 31 points, ε = 0.005, cell Péclet 3.125Three solutions of a boundary-layer problem on the same grid. The exact one rises monotonically from 0 to 1 with a layer of width ε at the right-hand end. The central-difference answer alternates at every point and leaves [0, 1] at 16 of the 31 of them, by as much as 0.5152. The upwind answer is monotone at every Pe.00.250.50.75100.250.50.751xuexactcentral differencesupwindthe oscillation is exact‖Ax − b‖/‖b‖ for the central answer4.6·10⁻¹⁸values outside [0, 1]16worst excursion0.52the dashed lines are 0 and 1, which the equation guaranteesno solver was involved
Fig. 6 The threshold underneath both essays, measured by bisection at 1.0000000000000002. Above it a central difference oscillates, and the crosswind direction is where one is left.
The damping of each Fourier mode, ε = 0.005, ω = 0.6667The modulus of one weighted Jacobi sweep's effect on each grid mode, against the frequency. On the operator with no convection in it the effect is a real number and the oscillatory half is damped to ⅓ at ω = 2/3. With convection the symbol is complex, its imaginary part does not depend on ω, and the worst damping over the oscillatory half is 1.0937.00.7853981.57082.356193.1415900.250.50.751frequency θdamping |g(θ)|the oscillatory half →⅓ — the symmetric optimumno convectionwith convectionits imaginary parta modulus, not a valuesmoothing factor at this ω1.1best over every ω0.84the symmetric operator's, at ω = 2/30.33the imaginary part does not depend on ωso no ω removes it
Fig. 7 What convection does to a smoother’s symbol in one dimension. The rank-one tensor here is the discretisation’s version of an aim that only points one way.
Three schemes at ε = 0.005, cell Péclet number 1.56The computed solution of each scheme against position, with the exact solution drawn as a dashed line. The tuned scheme's values lie on it — the largest nodal difference is 1.4·10⁻¹⁷. Upwinding is smooth and 0.198 away at its worst. Central differencing oscillates and leaves the interval [0, 1] at 11 of the 63 points.00.250.50.75100.250.50.751xuexact & tunedupwindcentralone of these is exacttuned, worst nodal error1.4·10⁻¹⁷upwind, worst nodal error0.2central, points outside [0, 1]11exact at every nodeand only at the nodes
Fig. 8 The aligned case, where the crosswind term costs nothing because the solution has no crosswind variation to damage.

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.

Named objects

A flat tag is an object no other essay names yet.

Artificial diffusionBoundary layerConvection diffusionCrosswind diffusionDiscrete maximum principleGrid alignmentM matrixPeclet numberStreamline diffusionUpwinding