When a model has no friction or external work, the total energy should not change. That makes energy a powerful test oracle for a simulation, but only after the selected system, every stored term, boundary transfer, time level, and tolerance are stated. A changed mechanical total can be correct under a model with friction or a moving boundary; its unexplained residual is the diagnostic.
Think like a programmer
Conservation is an invariant and ledger test. Store or recompute each named energy store at selected physical times, record signed transfers into the system, and compare actual next total with the expected ledger total. Log absolute/relative residual, cumulative drift, integrator, step, state timestamp, and tolerance policy. Never test a rendered total or compare energy components sampled at incompatible update stages.
Model checklist
Inputs
System boundary, mass/position/velocity, potential/field model, external work/heat/friction/boundary transfers, integrator/step, checkpoint times, absolute/relative tolerance, and expected numerical order.
State
Named kinetic/potential/internal/field stores, total energy, signed transfer ledger, residual/cumulative residual, and convergence history.
Rule
Sum only stores inside the boundary; add declared signed transfers to prior total; compare expected and actual next totals at compatible time levels; repeat at refined steps.
Output
Energy trace, component exchange, residual diagnostic, tolerance context, and conservation/transfer classification.
Check
Closed analytic fixture has bounded residual within tolerance; potential-to-kinetic exchange preserves total in the ideal case; adding a named negative friction transfer accounts for mechanical decrease; rescaling the problem respects a scale-aware tolerance; fixed-time refinement improves selected residual or identifies an unstable/incomplete model.
Energy as an accounting check
Set mass and height. In this no-loss model, gravitational potential energy becomes kinetic energy at ground level.
Potential energy 98.07 J; predicted landing speed 9.90 m/s; kinetic energy 98.07 J.
For a simple falling-body reference with no drag, potential and kinetic stores exchange while total remains constant. Energy components need not each remain constant. This distinguishes a real model prediction from a weak test that only checks one value at one frame.
Choose checkpoint times before running, then compare Δt and Δt/2 at the same physical times. A short run may hide systematic drift; a tiny per-step residual can accumulate. Pair energy with independent diagnostics such as momentum, constraint work, or analytic position/velocity reference so a compensating error cannot pass one scalar test by accident.
Try this experiment
Prediction: Potential energy decreases while kinetic energy increases by the same amount in the ideal model, while friction makes the mechanical decrease correct only after its transfer is named.
Change height in the ideal reference and record both components plus total at fixed checkpoints. Add a named friction or boundary transfer and verify the ledger rather than demanding constant mechanical energy. Repeat at two step sizes to the same final time, compare cumulative residual, and identify one additional invariant or analytic fixture that guards against compensating errors.
Where this model breaks
Energy conservation applies only to the modeled closed system. If friction, a motor, a thermostat, open boundary, constraint, or numerical instability is present, account for the corresponding transfer before calling a change an error. Missing potential terms, inconsistent time levels, nonlinear solver tolerance, and poor work quadrature can make a ledger incomplete even if the arithmetic residual is small.
Summary
Write conservation laws and transfer ledgers as tests. Define the system boundary, stored terms, compatible time levels, and scale-aware tolerance first, then use fixed-time drift/refinement to debug models and numerical methods.
Glossary
Conservation law: quantity unchanged in an isolated model.
Tolerance: acceptable numerical difference for a test.
System boundary: decision about which interactions the model includes.
Cumulative drift: residual accumulated across multiple updates.
Transfer ledger: signed account of energy entering or leaving the selected system.
Self-check
What is the energy invariant or ledger here?
Why state a tolerance and a physical checkpoint time?
Which omitted effect removes mechanical energy?
Why can component energies change while the total remains constant?
Sources
OpenStax, University Physics Volume 1, conservation of energy chapter.
E. Hairer, C. Lubich, and G. Wanner, Geometric Numerical Integration.
Model contract
Treat the lesson as a small function before treating it as a fact to memorize. Give every value a unit, keep only the state needed for the next step, and make the output easy to inspect.
Quantities you set or measure, with units and useful bounds.
State
Values the program must retain to reproduce the next result.
Rule
The relationship or update that turns inputs and state into a result.
Check
A known limit, unit check, invariant, or measured result that can expose a bad model.
Implement the idea as a model
For Numerical Energy Conservation, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In Energy, Work, and Power, the useful program is not the drawing: it is the smallest explicit model that makes a prediction you can test.
Guided experiment
Prediction: changing one declared input while holding the others fixed should change only the outputs that the model connects to that input. Choose one input, predict the direction of change, then check a limiting case such as zero, a symmetric arrangement, or a familiar low-speed or small-change approximation.
Where this model breaks
This lesson is a teaching model, not a complete simulator. Before using it outside the stated question, check which interactions, scales, uncertainties, boundary conditions, and measurement limits it leaves out.
Summary
Treat Numerical Energy Conservation as a contract: named inputs and units enter a rule, the rule produces an observable result, and a known limit or invariant checks whether the implementation deserves trust.
Glossary
Input: a measured value or chosen parameter supplied to a model.
State: the smallest set of values needed to continue or reproduce a model.
Validation: comparing an output with a known result, limit, invariant, or measurement.
Self-check
Which values are inputs, and which values must remain state?
What observable result would tell you the model is behaving as expected?
Which assumption would you test first before applying the model to a real system?
Model review: turn Numerical Energy Conservation into a test
Use total energy as a test oracle for an ideal no-loss motion model and distinguish numerical drift from new physics.
Name the inputs and units that the energy, work, and power model needs.
Separate the state you must keep from values you can calculate when needed.
Write one rule that maps the current state and inputs to an observable result.
Choose a limiting case, unit check, invariant, or known result before trusting an output.
State one assumption you would change before using this simplified model for a real decision.