← Back to writing

Your grid is a filter

A coarse finite difference is not a sloppy derivative. It is an exact one, of an averaged field. That turns what a coarse simulation leaves unresolved into something you can write down, take apart, and test.

An interactive companion to our paper:

A finite difference, we are all taught, approximates a derivative, and the approximation gets worse as the grid gets coarser. Here is a curve and a grid cell. Make the cell as wide as you like, move it around, and try to catch the finite difference making an error.

Try to make a finite difference wrong

Curve
h
curve uits average u over a cell of width hchord of u across the celltangent of u
Difference of u across the cell, divided by h
−2.96373
Slope of the average u at x
−2.96373
Slope of u itself at x
−6.86969

The first two are computed separately: one from the two end values of the curve, the other by differentiating the plotted average numerically. Here they differ by less than 10⁻⁹. Analytic demonstration, not experimental data.

The first two numbers agree for every curve, every position, and every cell width. Only the third one wanders off. So the finite difference is wrong about the slope of uu, as promised. But it is exactly right about something else, the slope of the cell average of uu:

u(x+h/2)−u(x−h/2)h=ddx uˉ(x),uˉ(x)=1h∫x−h/2x+h/2u(y) dy.\frac{u(x + h/2) - u(x - h/2)}{h} = \frac{\mathrm{d}}{\mathrm{d}x} \, \bar{u}(x), \qquad \bar{u}(x) = \frac{1}{h} \int_{x - h/2}^{x + h/2} u(y) \, \mathrm{d}y .

This is the fundamental theorem of calculus, read from right to left. No O(h2)\mathcal{O}(h^2) is hiding in it, and it asks nothing of uu: pick the sawtooth, or draw something worse, and it still holds. A finite difference is the correct answer to a question you did not ask.

Schumann noticed this for finite volumes in 1975. I call it the filter-swap: a derivative that the grid cannot compute is traded for a difference that it can, and the price is that the field becomes its average. The grid does not blur the derivative. The grid is a filter.

The finite volume method makes no error

Take a conservation law, ∂tu+∂xF(u)=0\partial_t u + \partial_x F(u) = 0, where FF is the flux. For Burgers’ equation, F(u)=12u2−ν ∂xuF(u) = \tfrac{1}{2} u^2 - \nu \, \partial_x u. Average the equation over a cell and apply the swap:

∂tuˉ+∂xhF(u)=0,\partial_t \bar{u} + \partial_x^h F(u) = 0,

where ∂xh\partial_x^h is the difference across a cell from the figure above. This is the finite volume method, and nothing has been approximated. The content of a cell changes by what crosses its two faces. The equation is already discrete in space, and still exact.

It is also useless as it stands, because the flux at the faces needs uu, and a coarse grid only carries uˉ\bar{u}. So a code replaces F(u)F(u) by a numerical flux Fh(uˉ)F_h(\bar{u}), built from neighbouring cell averages. That replacement is the only approximation in the method, and what it throws away has a name:

∂tuˉ+∂xhFh(uˉ)=−∂xhτ,τ=F(u)−Fh(uˉ).\partial_t \bar{u} + \partial_x^h F_h(\bar{u}) = - \partial_x^h \tau, \qquad \tau = F(u) - F_h(\bar{u}).

Everything a coarse simulation gets wrong sits in τ\tau, the residual flux. (In three dimensions it becomes a stress.) Look at what is inside it: FhF_h, your scheme, interpolations and all. The discretization error is not a separate tax on top of the turbulence closure problem. It is part of the same term.

One residual, three reasons

Add and subtract, and τ\tau comes apart into three differences, each with its own cause:

τ=F(u)‾−F(uˉ)⏟physics+F(uˉ)−Fh(uˉ)⏟your flux+F(u)−F(u)‾⏟your divergence.\tau = \underbrace{\overline{F(u)} - F(\bar{u})}_{\text{physics}} + \underbrace{F(\bar{u}) - F_h(\bar{u})}_{\text{your flux}} + \underbrace{F(u) - \overline{F(u)}}_{\text{your divergence}} .
  • Physics. Averaging does not commute with a nonlinear flux: the average of u2u^2 is not the square of the average. This is the classical subgrid stress, the object that sixty years of closure models, from Smagorinsky to neural networks, are aimed at.
  • Your flux. The numerical flux is not the flux. A central scheme and an upwind scheme disagree here, and both disagree with FF.
  • Your divergence. The swap wants the flux at the faces of a cell, and the classical term is built from the flux averaged over a cell width. This bracket is what it costs to replace ∂x\partial_x by ∂xh\partial_x^h.

Classical large-eddy simulation keeps the first bracket and files the other two under numerical error, small if the grid is fine enough. Whether they are small is something you can check.

Watch it be exact

Below, a direct numerical simulation (DNS) of Burgers’ equation runs next to a coarse simulation with 45 times fewer cells. The bars are the cell averages of the DNS, which is the solution the coarse run is supposed to produce. The dots are the coarse run. It uses FhF_h, and it is handed whichever brackets of τ\tau you leave switched on, computed from the DNS as it goes.

τ =++
Coarse scheme Fh
DNS ufiltered DNS u (cell averages)coarse run fed τ45 coarse cells · 2025 DNS cells
Residual flux at the coarse facesExact τ is removing energy
scale ±0.5
Error of the coarse run
round-off10010−410−810−1210−16t = 0t = 2
t = 0.60 / 2.00

Round-off only: the coarse run is the filtered DNS.

Changing a bracket or the scheme restarts the coarse run from the filtered DNS at that instant. Live in-browser re-enactment at reduced resolution, not the paper's data.

With all three brackets on, the dots do not approximate the bars. They are the bars: the error sits at 10−1510^{-15}, the round-off floor of double precision, for as long as the simulation runs. No closure model can do this, because no model gets to see uu. The point is that the target a model should aim for exists, and that it is τ\tau, not its first bracket.

Three things to try:

  • Switch off your divergence in the middle of a run. The error leaves the round-off band at once. It jumps about eleven orders of magnitude in a single time step and is at the percent level a moment later.
  • Leave only physics on. This is the classical recipe with perfect knowledge of the classical term, and the coarse run still wanders off by tens of percent.
  • Switch the coarse scheme to upwind. The flow is the same and so is the target, but the middle bracket changes, and the exact τ\tau flips from removing energy to handing it back: an upwind scheme already dissipates more than it should. Now feed that run only physics. In most flows it does worse than feeding it nothing at all.

Same flow, two truths

That last experiment is the one I would remember. The residual flux is not a property of the turbulence. It is a property of the turbulence and the scheme used to simulate it. Change the scheme and the right answer for the closure changes with it, down to its sign.

This takes the air out of an old argument. Explicit large-eddy simulation adds a model on top of a scheme that does not dissipate. Implicit large-eddy simulation lets a dissipative scheme do the model’s job. In the figure above these are not rival philosophies. They are one expression, τ\tau, evaluated with two different FhF_h, and in both cases τ\tau says how much is left for a model to do. It also says why a closure calibrated in one code should not be expected to work in another: part of what it was fitted to was the first code’s middle bracket.

How much of your turbulence is your grid?

So far the grid was the only filter. Large-eddy simulation usually thinks of a second, wider filter of width Δ\Delta that selects the scales to keep, and nothing stops you from stacking one on top of the grid’s. The three brackets survive, with the bar now meaning both filters. What you cannot do is remove the grid’s filter. You only choose what to put on top of it. (To leading order, the stack acts like a single filter of width Δ2+h2\sqrt{\Delta^2 + h^2}.)

How much of τ\tau is then discretization, meaning the second and third brackets, depends on the ratio Δ/h\Delta / h:

72%
Δ = 0 the grid is the only filter
~25%
Δ = 4h the upper edge of common practice
<1%
Δ = 32h the textbook limit
Share of the residual flux that is discretization rather than classical subgrid stress. Measured in the paper on Burgers turbulence with a central scheme.

At Δ=32h\Delta = 32h the textbook picture is right, and nobody computes there, because it spends a factor 32 in resolution on scales that are then filtered away. Where simulations are actually run, between Δ=0\Delta = 0 and 4h4h, a quarter to nearly three quarters of what a closure is asked to model is the discretization.

What this is good for

Nobody can run a DNS next to every coarse simulation, so the figure above is a certificate, not a method. What it certifies is the target.

In the paper we refit the simplest closure there is, the one-coefficient Smagorinsky model, against τ\tau instead of against its first bracket. With a central scheme the coefficient comes out larger, because it now carries the dissipation that the discretization asks for, and the coarse simulations improve, most clearly when the grid is the only filter. For closures with thousands of parameters, trained directly on such data, the choice of target matters far more. That was the lesson of an earlier paper.

The price is that τ\tau is married to your grid and your scheme. Change either and the target has to be computed again, and a closure fitted to it has to be recalibrated. That dependence was there all along. The exact expression only makes it visible.

Two more boxes

Everything here came from one move: integrate a derivative over a cell, and what remains lives on the boundary of the cell. In one dimension that boundary is two points. Two other boxes are worth opening.

  • A cube. In three dimensions each face of a cell carries its own average, so two stress components that the textbook calls equal are averaged over different faces, and stop being equal. Add the pressure, and the stress stops being local as well. That is part two.
  • A brick in space-time. A forward-Euler time step is the same identity along the time axis, with a one-sided average. That is part three.

The numbers behind this post
  • The live figure runs in your browser: a 2025-cell DNS of the viscous Burgers equation, 45 coarse cells, forward Euler for both. It is a re-enactment at reduced resolution, not the paper’s data. New flow draws another random initial condition.
  • The paper’s Burgers experiment uses a 13 500-cell DNS, coarse grids of 300, 900 and 2700 cells, and 1000 random initial conditions. With the grid as the only filter, feeding the coarse run only the classical term leaves a 16% error at the end of the run, adding the numerical-flux term leaves 8%, and all three give machine precision. At Δ=4h\Delta = 4h the first two numbers are 7% and 2%.
  • The proofs, the construction that makes all of this exact on two nested grids, and the three-dimensional theory are in the paper. Everything in it is reproducible with ExactClosure.jl.
Find something interesting