Virtual engineering lab

Advection, Diffusion & Numerical Error

Transport a periodic scalar, compare upwind and Lax–Wendroff schemes, and distinguish physical diffusion from numerical smearing.

Fluid Mechanics / Numerical MethodsintroductoryValidated educational model
Learning mode

Guided laboratory

Use the checklist when you want a structured lab. Explore mode leaves the instruments unrestricted.

Set up → solve → verify

Build your numerical experiment

Read the equations

Start with an example. Change one setting at a time and compare accuracy, conservation, and computation cost.

Boundary conditions. Periodic interval: material leaving either boundary re-enters through the opposite boundary.

Physical length of the periodic domain.
unitless
Uniform cells; resolution increases both accuracy and computational cost.
Negative velocity moves the profile left.
Zero removes physical diffusion; numerical diffusion may remain.
The last step lands at this physical time.
unitless
Automatic time steps use this fraction of the applicable explicit stability bound.

Choose an example or use the defaults, then run. Larger grids may take several seconds.

Keep this experiment

Valid settings are saved on this device. Project JSON preserves physical inputs and display units. Restore it and run again for fresh results.

Settings stay in this browser. Simulations run locally.

Measurements

Instrument readings

Normalized reference RMS error
Recorded from the current completed simulation.
Scalar balance error
Recorded from the current completed simulation.
Theory

Equations and model

Transport and diffusion

Constant velocity translates the scalar while diffusivity smooths it. Periodic finite-volume cells store averages. The analytical reference is averaged over the same cells to make a consistent comparison.

ct+acx=ν2cx2\frac{\partial c}{\partial t}+a\frac{\partial c}{\partial x}=\nu\frac{\partial^2c}{\partial x^2}cˉin+1=cˉinΔtΔx(Fi+1/2Fi1/2)\bar c_i^{n+1}=\bar c_i^n-\frac{\Delta t}{\Delta x}(F_{i+1/2}-F_{i-1/2})c(x,t)=1+12eνk2tsin[k(xat)],k=2πLc(x,t)=1+\frac12 e^{-\nu k^2t}\sin[k(x-at)],\quad k=\frac{2\pi}{L}

Stability is not accuracy

Upwind adds numerical smearing. Lax–Wendroff resolves smooth advection more accurately but can ring near discontinuities. The explicit diffusion term is centered. A pulse with nonzero diffusivity uses a bounded Fourier-series reference.

C=aΔtΔx,D=νΔtΔx2C=\frac{|a|\Delta t}{\Delta x},\quad D=\frac{\nu\Delta t}{\Delta x^2}C+2D1 (upwind),C2+2D1 (Lax–Wendroff)C+2D\leq1\ \text{(upwind)},\qquad C^2+2D\leq1\ \text{(Lax–Wendroff)}
Validation

Independent checks

Numerical balance or equation residualNot run

Review conservation, boundary, entropy, or residual checks.

Expected
Simulated
Error
Tolerance
0%

Run the experiment to perform this check.

Reference, bounds, or convergenceNot run

Review the specific check and its limits; this is not a universal accuracy certificate.

Expected
Simulated
Error
Tolerance
0%

Run the experiment to perform this check.

Engineering interpretation

Run the experiment to generate an engineering interpretation.

Assumptions and limitations
Assumptions
  • Periodic interval: material leaving either boundary re-enters through the opposite boundary.
  • Constant properties; uniform one- or two-dimensional meshes.
  • Physical quantities stored in SI. Changing display units preserves the simulation.
Limitations
  • Educational numerical verification does not certify a physical design.
  • No arbitrary CAD geometry, turbulence, compressibility, multiphase flow, or free surfaces.
  • Grid resolution, bounded computation, and reference limits are reported explicitly.
Local experiment export

Save your measurements and setup

Exports are generated in your browser. No account or server upload is required.

Settings JSON
Current parameters and instrument controls, including waveform, output enable, scope coupling, timebase, trigger, and cursors when present. Data labs also include the dataset, mappings, exclusions, budget, or propagation setup.
Measurements CSV
Completed instrument readings with labels, units, and descriptions.
Plot PNG
The current canvas-based scope, transient, sweep, or statistics visualization when available.
Summary
Markdown report with objectives, setup, measurements, validation, interpretation, assumptions, and graded guided concept-check results.

Ready to export the current local experiment state.

Learning objectives

What this experiment should establish

  • Establish a reference.
  • Isolate numerical diffusion.
  • Refine resolution.
  • Recognize ringing.
Check your understanding

Questions to answer from the experiment

  1. Why can an upwind pulse spread when physical diffusivity is zero?
  2. Which comparison isolates discretization error?
  3. What explains a stable Lax–Wendroff undershoot near a sharp pulse?
  4. What should stay constant under conservative periodic transport?
Continue learning

Sources and model review

Reviewed 2026-09-19. The educational model exposes its assumptions and validation; source references do not imply external certification.