PhysSandbox
Classical MechanicsWaves & SoundElectricity & MagnetismOptics & LightGravity & OrbitsLabs
🌙Astronomy & The Sky🌡️Thermodynamics🌍Biophysics, Fluids & Geoscience📐Math Visualization🔧Engineering🧪Chemistry

More from Math Visualization

Other simulators in this category — or see all 72.

View category →
NewUniversity / research

Finite Element Poisson Solver (2D)

Triangular P1 finite elements for -Δu=f on a square: assemble stiffness matrices, pin Dirichlet nodes or add natural Neumann flux, solve by CG, and view potential as a colored membrane.

Launch Simulator
NewUniversity / research

Multigrid Relaxation

1D Poisson error dynamics: Jacobi and Gauss-Seidel smooth high-frequency error, while a V-cycle uses residual restriction and coarse-grid correction to remove low-frequency modes.

Launch Simulator
NewUniversity / research

Gaussian Process Regression

Interactive GP regression with RBF and Matérn kernels: tune length scale/noise, add observations by clicking, view posterior mean with uncertainty bands, and sample at max posterior variance.

Launch Simulator
NewUniversity / research

Rössler Attractor

RK4 integration of ẋ=−y−z, ẏ=x+ay, ż=b+z(x−c); period-doubling cascade as c grows.

Launch Simulator
NewSchool

L-Systems (Turtle)

Lindenmayer string rewriting + turtle: Koch, Sierpinski, Hilbert, Heighway dragon, plant.

Launch Simulator
NewSchool

Bézier & de Casteljau

Drag control points; live recursive linear-interpolation scaffolding evaluates B(t).

Launch Simulator
PhysSandbox

Interactive physics, chemistry, and engineering simulators for students, teachers, and curious minds.

Physics

  • Classical Mechanics
  • Waves & Sound
  • Electricity & Magnetism

Science

  • Optics & Light
  • Gravity & Orbits
  • Astronomy & The Sky

More

  • Thermodynamics
  • Biophysics, Fluids & Geoscience
  • Math Visualization
  • Engineering
  • Chemistry

© 2026 PhysSandbox. Free interactive science simulators.

PrivacyTermsContact
Home/Math Visualization/Advection Schemes: Upwind / LW / MacCormack

Advection Schemes: Upwind / LW / MacCormack

This simulator solves the constant-speed linear advection equation u_t + c u_x = 0 on a periodic one-dimensional grid. The exact solution is just a translated initial pulse, so numerical artifacts are easy to see. The first-order upwind scheme uses information from the incoming direction and is monotone for ν = cΔt/Δx ≤ 1, but it introduces numerical diffusion that visibly smears square pulses. Lax–Wendroff adds a second-order correction term and greatly reduces diffusion, but discontinuities reveal dispersive oscillations (overshoot and undershoot). MacCormack is a predictor-corrector method with similar second-order accuracy for smooth waves and similar ringing near sharp fronts. The page advances all three schemes side by side, overlays the exact translated profile, and plots pointwise error below the solution so students can separate diffusion from dispersion.

Who it's for: Students in numerical PDEs, CFD, signal transport, and computational physics learning CFL limits, upwinding, and the trade-off between monotonicity and second-order accuracy.

Key terms

  • Linear advection
  • Upwind scheme
  • Lax-Wendroff
  • MacCormack
  • CFL condition
  • Numerical diffusion
  • Numerical dispersion
  • Finite differences

Advection schemes

0.8
2

Upwind is monotone but diffusive; Lax-Wendroff and MacCormack are second order and sharper, but discontinuities reveal dispersive overshoot/undershoot. All use periodic boundaries and c>0.

Shortcuts

  • •Space / Enter — run / pause
  • •P — pause / resume
  • •R — reset

Measured values

time t0.000
Δt (c=1)3.64e-3
mass0.200
L2 err upwind0.000
L2 err L-W0.000
L2 err Mac0.000

How it works

Linear advection on a periodic 1D grid: compare first-order upwind, Lax-Wendroff, and MacCormack schemes against the exact translated pulse, exposing numerical diffusion, dispersive ringing, and the CFL limit.

Key equations

u_t + c u_x = 0, ν = cΔt/Δx. Upwind: u_i^{n+1}=u_i^n−ν(u_i^n−u_{i−1}^n). Lax-Wendroff adds (ν²/2)(u_{i+1}−2u_i+u_{i−1}); MacCormack uses predictor-corrector. Stable range here: roughly ν ≤ 1.

Frequently asked questions

Why does upwind smear the pulse?
For positive speed, upwind replaces the derivative with a biased backward difference. Its modified equation contains an artificial diffusion term proportional to (1−ν)Δx, so discontinuities are damped and broadened rather than translated sharply.
Why do Lax–Wendroff and MacCormack overshoot near jumps?
They are second-order, less diffusive schemes. Around a discontinuity, high-frequency components acquire phase errors, producing dispersive ringing. This is the same monotonicity-vs-accuracy tension behind TVD limiters and modern high-resolution methods.
What does CFL ν mean here?
ν = cΔt/Δx is the number of grid cells information travels in one time step. For these explicit linear advection schemes the basic stability range is roughly ν ≤ 1. Above that, the numerical domain of dependence cannot keep up with the PDE.