Skip to content
VLASIFY™
GuideResearch & computing support

Scientific simulation verification: how to prove your code solves the equations correctly

Updated · Scientifically reviewed by Dinkar Mishra, PhD on

Short answer

Verification checks that a simulation solves its mathematical model correctly. It has two parts: code verification (does the software implement the equations without bugs? Tested with analytical solutions and the method of manufactured solutions, checking the observed order of accuracy) and solution verification (how large is the numerical error in this particular result? Estimated with convergence studies). Verification is different from validation, which asks whether the model matches reality.

Who this is for

Researchers, R&D engineers, reviewers and managers who need simulation results they can defend in a paper, thesis, grant report or design review.

How it works

Every simulation result contains several kinds of error. Verification addresses the ones that come from the computer and the numerics, not from the physics model:

Error sourceQuestionActivity
Programming mistakesDoes the code implement the equations as intended?Code verification
Discretisation (grid, time step, particles)How far is this result from the exact solution of the equations?Solution verification
Iterative and round-off errorAre solvers converged, and is precision sufficient?Solution verification
Model form (missing physics)Are these the right equations for reality?Validation (not verification)

Code verification

The strongest test compares the code with a known exact solution and checks the order of accuracy: if the scheme is second order, halving the cell size should reduce the error by about four.

  • Analytical benchmarks. For plasma codes these include the plasma oscillation frequency, the Landau damping rate, two-stream instability growth rates, Child–Langmuir current and sheath solutions. Our 1D PIC tutorial verifies against the plasma frequency.
  • Method of manufactured solutions (MMS). Choose a smooth function, derive the source term it requires, and check that the code reproduces it at the expected order. MMS exercises all terms and boundary conditions.
  • Conservation tests. Energy, momentum and charge should be conserved to the degree the scheme promises.

Solution verification

For the actual simulation you report, estimate the numerical uncertainty with a systematic convergence study: three or more resolutions, observed order, Richardson extrapolation or the Grid Convergence Index. See the numerical convergence study tutorial and, for particle codes, the PIC convergence test.

A practical verification workflow

  1. List the quantities you will report and the precision you need.
  2. Reproduce a benchmark in the same code, version and configuration as your production run.
  3. Check conservation throughout the production run (total energy, charge).
  4. Run a convergence study for each reported quantity.
  5. Cross-check critical results with a second code or a reduced model where possible.
  6. Document versions, inputs, scripts and results so that the study is reproducible; see scientific code reproducibility.

This is the methodology we apply to client projects, described on our methodology page.

Why it matters

Unverified simulations can produce smooth, plausible and wrong results. Numerical heating, under-resolved gradients or a sign error in a source term do not announce themselves. Verification turns “the code ran” into “the result is accurate to within a stated uncertainty”, which is what reviewers, funders and engineering decisions need.

Assumptions and limitations

  • Verification establishes accuracy with respect to the mathematical model, not agreement with experiment. For that, see verification vs validation.
  • Order-of-accuracy tests require smooth solutions. Shocks, discontinuities and stochastic particle noise reduce the observed order and need careful interpretation.
  • Verification effort should match the consequences of a wrong result. A screening study needs less than a safety-relevant design.

Frequently asked questions

Is verification necessary if I use a well-known, widely used code?+

Code verification by the developers reduces the risk of bugs, but your input deck, resolution, boundary conditions and the features you combine are specific to you. Solution verification (convergence of your quantities) and a benchmark in your own configuration are still needed.

What is the method of manufactured solutions?+

You choose an analytical function as the "solution", substitute it into the governing equations to compute the source term it implies, add that source to the code, and check that the code reproduces your function with the expected order of accuracy as the grid is refined. It tests every term of the equations, not just special cases.

How should verification be reported in a paper?+

State the benchmark problems you reproduced, the resolutions and particles per cell, the observed convergence of the quantities you report, and an estimate of the numerical uncertainty. A short appendix or supplementary section is usually enough.

Can Vlasify verify our simulations independently?+

Yes. Our verification and validation audit benchmarks your code or results against analytical theory, convergence and conservation checks, and delivers a written report. This is an available service, described on our simulation and V&V service page.

References

  1. Oberkampf & Roy, Verification and Validation in Scientific Computing (Cambridge University Press, 2010) · Standard textbook
  2. Oberkampf & Trucano, Verification and validation in computational fluid dynamics, Prog. Aerosp. Sci. 38, 209 (2002) · Review article
  3. Salari & Knupp, Code verification by the method of manufactured solutions, Sandia report SAND2000-1444 (2000) · Sandia National Laboratories (OSTI)
  4. Roache, Perspective: A method for uniform reporting of grid refinement studies, J. Fluids Eng. 116, 405 (1994) · Peer-reviewed article

Need help applying this?

Our physicists turn concepts into working, verified simulations for research groups and companies.

Services listed on this page are available today. Products marked “early access” or “in development” on our platform page are not yet generally available.

Spotted an error or an outdated command? Tell us. We correct verified issues promptly.

Related guides

How Vlasify can help

Get a Quote