Simulation Tests

Quantitative verification of stability, convergence, and consistency in physical simulations.

Conceptual context

A physical simulation needs tests just as an experiment needs calibration. A result may look reasonable yet depend strongly on hh, violate an expected conservation law, or amplify small perturbations. Convergence, stability, conservation, and consistency tests turn those doubts into quantitative diagnostics. Δs\Delta_{s} compares the result with a reference; RcR_c measures improvement under refinement; δQ\delta_{Q} monitors invariants; ρ\rho checks equations; and IsI_s detects amplification. Together they determine whether the calculation is trustworthy within declared limits.

🟢 Essential level

Testing a simulation means asking controlled questions. First, compare ytesty_test with yrefy_ref to obtain Δs\Delta_{s}. The comparison must use the same observable, time, unit, and physical condition.

Next repeat the calculation at several hh values without changing the model or parameters. A regular reduction in discrepancy supports convergence; a plateau or increase calls for investigation of tolerances, roundoff, or instability. RcR_c summarizes how much one run improves over another.

Reference agreement alone is insufficient. Expected balances, equation fulfillment, and response to small perturbations must also be checked. Every test needs a documented threshold and a physical justification suited to the observable and interval. A trustworthy simulation combines compatible trends, preserves run provenance, and retains its conclusions when the calculation is extended or refined once more.

No single test is enough: a small discrepancy against a biased reference, conservation demanded where it does not apply, or a well-normalized but poorly scaled residual can each create a false sense of confidence unless they are checked against one another.

🔵 Formal level

Basic formulas

The basic discrepancy between simulation and reference is evaluated with:

Absolute discrepancy

Δs=∣yp−yr∣\Delta_s=|y_p-y_r|

This produces Δs\Delta_{s} from ytesty_test and yrefy_ref. Both must describe the same observable, in the same units, time, and location.

Improvement between two resolutions is quantified by:

Convergence ratio

Rc=Δ1Δ2R_c=\frac{\Delta_1}{\Delta_2}

Here Δ1\Delta_{1} belongs to the coarse run and Δ2\Delta_{2} to the refined run. A value above one indicates reduced discrepancy.

If the steps of both simulations, h1h_1 and h2h_2, are also known, the discrepancy ratio gives the observed pobsp_obs:

Observed order of convergence

pobs=ln⁡(e1/e2)ln⁡(h1/h2)p_{obs}=\frac{\ln(e_1/e_2)}{\ln(h_1/h_2)}

An observed order that matches the method's theoretical one is the most convincing evidence that the code is correctly implemented.

Real student questions

Is a small discrepancy enough? No. The reference may share the same bias.

Why are several resolutions needed? One run does not reveal a trend.

Is every drift an error? No. Some drift is physically expected.

Does a small residual guarantee accuracy? No. It only shows good satisfaction of the discrete equation.

Is chaos numerical instability? Not necessarily. Sensitivity may be physical.

Which test matters most? It depends on the model; combining tests is stronger.

Final synthesis

A simulation becomes credible when it passes independent, consistent tests. Varying hh, measuring Δs\Delta_{s}, and checking conservation, consistency, and stability separates apparent precision from quantitative evidence.

Formal development

This section is part of the complete theory. See the subscription options to access it.

🔴 Structural level

This section is part of the complete theory. See the subscription options to access it.

Deep physical interpretation

This section is part of the complete theory. See the subscription options to access it.

Order of magnitude

This section is part of the complete theory. See the subscription options to access it.

Personalized resolution method

This section is part of the complete theory. See the subscription options to access it.

Special cases and extended example

This section is part of the complete theory. See the subscription options to access it.

Cross-cutting connections and study paths

This section is part of the complete theory. See the subscription options to access it.