6 Transport and the price of stability
A passive scalar satisfies for incompressible source-free flow. Along an exact characteristic it is constant. Semi-Lagrangian transport traces backward from an arrival sample and interpolates the old field. Stam’s stable-fluids construction popularized this in interactive graphics [S1]. Stability must name a norm and interpolation rule.
Backtracing
First-order tracing uses . A midpoint estimate first samples velocity halfway along that estimate, then traces with the midpoint velocity. Each staggered component uses its own lattice offset; the scalar has another offset.
Trilinear interpolation is a convex combination of eight values when fractional coordinates lie in . Nonnegative weights summing to one give
Convex_sum_bounds proves this finite real statement. Repeated bounded interpolation cannot leave the original global range if boundaries and sources obey it. This does not imply conservation of all sample values.
Row sums and column sums
For , convex interpolation means nonnegative entries and unit row sums. Conservation of an unweighted total requires unit column sums. For example,
maps to . Outputs are bounded but total rises from 1 to 1.5. The exact rational arithmetic is checked in Lean. This is a matrix counterexample to an implication, not a claim that this matrix comes from smooth incompressible periodic flow.
Constant translation on a periodic uniform one-dimensional grid happens to give a doubly stochastic interpolation matrix. The companion’s box test verifies that special case, not general semi-Lagrangian conservation. Variable velocity and irregular boundaries need separate evidence.
Numerical diffusion
For positive constant speed and Courant number in ,
A Fourier mode has amplification , hence
Amplitude generally decays. Taylor expansion gives leading artificial diffusion under fixed-Courant refinement. A bounded solver can therefore erase thin jets or smear silhouettes. Arbitrarily large stable steps also degrade trajectory accuracy and obstacle interaction.
Conservative flux updates
Finite volume computes one shared face flux and applies opposite signs:
Summation over periodic cells cancels all internal fluxes. Positive-speed upwind flux preserves positivity for , proved by upwind_positive. At , , , the new value is , also formally checked. Conservation does not imply positivity.
The field determines the contract. A smoke appearance tracer may tolerate measured dissipation. A liquid fraction needs bounded conservative transport and interface geometry. A signed-distance field needs surface-position analysis. One generic quality parameter cannot hide these differences.
Component aware trilinear sampling
For an x-face field, convert world position to lattice coordinates . For a y-face, subtract half from x and z; for a z-face, subtract half from x and y. For cell-centered scalars subtract half from all coordinates.
Let and . The eight weights are products of either or . For corner ,
Their sum factors into . Nonnegativity follows when each fractional coordinate lies in . This derivation explains the exact hypotheses of the interpolation proof. Boundary remapping must preserve or deliberately replace the stencil; simply dropping invalid corners breaks partition of unity.
An affine scalar is reproduced exactly by trilinear interpolation on a complete stencil in real arithmetic. The expanded companion tests this on all four lattice offsets using independently evaluated world positions. It then deliberately uses the wrong offset for an x-face field to show the expected half-cell bias. This fixture catches a defect that constant-preservation tests miss.
Sampling boundaries
Periodic sampling wraps integer indices modulo the component’s periodic extent, accounting for duplicated boundary faces if the storage convention has them. A closed-wall sampler uses its declared ghost extension. A clamped texture sampler repeats edge values; it is not automatically a no-slip boundary condition. An out-of-domain trace at an open boundary needs a prescribed exterior value or a validity failure.
Return a sample together with validity information when the method needs it. Corrected advection needs to know whether forward and reverse stencils are valid and reversible. A scalar value alone cannot communicate that a trace hit a wall or crossed a source discontinuity.
Trace integrators
For an autonomous frozen velocity field, midpoint backtracing is
A higher-order trace reduces ODE integration error but cannot improve interpolation order or unresolved velocity detail. For time-varying velocity, temporal interpolation between known levels is another approximation. Name which field drives tracing: old velocity, provisional velocity or projected velocity. These choices change the splitting.
A solid-rotation fixture with has an analytic rotation trajectory. Compare departure points against the exact rotation over one step and over one period. A translation fixture cannot distinguish Euler from midpoint tracing because both are exact for constant velocity. The companion includes the rotation test specifically to expose that difference.
Failure fixtures
Use a constant field to test partition of unity, an affine field to test offsets, a sinusoid to measure dissipation, a top-hat to reveal overshoot and limiter behavior, and a segment crossing a thin wall to test collision handling. Add a trace ending exactly on a lattice boundary, where floor and integer conversion policies matter.
For corrected transport, record the number of reverted samples and the maximum unbounded overshoot before reversion. A zero overshoot on a smooth wave is not evidence for discontinuities. For conservative transport, compare integrated amount separately from min/max bounds. These fixtures should remain distinct because each isolates a different contract.