Linear advection: four schemes on the same square pulse
What you are seeing: the simplest PDE in numerical analysis, , solved four different ways on the same square pulse. The exact solution just translates the pulse to the right at speed 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.
WHAT TO TRY
- Vary each control and watch the rail readouts respond.
- Compare the diagnostic plot against the live scene.