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

Related simulators

Continue with similar topics in this category — or all 85 in Math Visualization.

View category →
NewUniversity / research

Finite-Volume Advection-Diffusion 2D

Launch Simulator

Conservative scalar transport on a 2D grid: face fluxes, upwind vs central interpolation, Peclet number, CFL, and numerical diffusion.

NewUniversity / research

Heat Equation: Finite Differences

Launch Simulator

1D heat equation u_t = αu_xx with explicit FTCS and implicit backward Euler; tune CFL r = αΔt/Δx², watch explicit blow-up for r > 1/2, and compare numerical diffusion.

NewUniversity / research

Keller–Segel Chemotaxis

Launch Simulator

∂ₜn = Dₙ∇²n − χ∇·(n∇c), ∂ₜc = D_c∇²c + αn − βc; bacteria follow attractant; collapse at high χ; 96² grid.

NewUniversity / research

Flow Field Particles

Launch Simulator

Synthetic v(x,y,t); advection with wrap; optional arrow grid.

NewUniversity / research

Monte Carlo Integration & Variance Reduction

Launch Simulator

Compare plain Monte Carlo, importance sampling, and stratified sampling for ∫f(x)dx, with convergence curves, standard error, and the 1/√N rate.

NewUniversity / research

Convolution (pulses)

Launch Simulator

Two rectangular pulses; overlap length at τ = 0.

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

Linear advection u_t + cu_x = 0 on a periodic grid: compare upwind diffusion, Lax-Wendroff and MacCormack dispersive ringing, exact pulse translation, L2 error, and CFL ν.

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

About this model

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

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.