Back

Advection Scheme Shootout

What you are seeing: the simplest PDE in numerical analysis, ut+cux=0u_t + c\,u_x = 0, solved four different ways on the same square pulse. The exact solution just translates the pulse to the right at speed cc forever, no distortion. The four numerical schemes all try to do that. They all fail in different, instructive ways.

FTCS (forward-time, centered-space) is the obvious first guess and is unconditionally unstable; the solution blows up. Upwind is first-order accurate and dissipative; the pulse smears out but stays positive. Lax-Wendroff is second-order; it preserves the pulse shape better but produces visible oscillations near the discontinuity (Gibbs-like). MacCormack is a predictor-corrector second-order method; similar accuracy to LW. The dashed green curve is the exact solution.

Figure 1. 1D linear advection ut+cux=0u_t + c u_x = 0 on a periodic domain, square pulse initial condition. Four schemes side-by-side: FTCS, upwind, Lax-Wendroff, MacCormack.
c1.00
CFL0.80
speed3

WHAT TO TRY

  • Watch the same square pulse advected four ways: FTCS blows up (unconditionally unstable), first-order upwind smears the pulse into a diffusive lump, and Lax-Wendroff and MacCormack ring with dispersive wiggles near the edges.
  • Raise the CFL number toward 1: the schemes sharpen, but push past the stability limit and even the stable schemes blow up. The total-variation readout flags the instability.
  • Compare the L2 errors: no second-order linear scheme escapes either diffusion or dispersion at a discontinuity, the Godunov barrier that motivates flux limiters.