|
Physics Simulation & Visualization Tool 0.1
A C++ physics simulation engine with real-time 3D visualization
|
Numerical correctness and validation strategy for the physics engine.
The physics engine uses Velocity Verlet integration due to its stability and favorable energy conservation properties.
For general motion, the method has:
The current simulation supports only constant forces (e.g., gravity and constant thrust).
In this case, acceleration satisfies:
\[ \frac{d\ddot{\vec{r}}}{dt} = 0 \]
Velocity Verlet integrates constant acceleration exactly, meaning the theoretical truncation error is zero. As a result, any deviation from the analytical solution arises solely from floating-point rounding error.
For constant-force test cases, the expected bound on position error is:
\[ \lVert \vec{r}_{\text{error}} \rVert \le C \cdot N \cdot \epsilon \cdot \max\!\left(\lVert \vec{r}(t) \rVert\right) \]
where:
\[ N = \frac{1}{\Delta t} \]
\[ \epsilon \approx 1.19 \times 10^{-7} \]
Unit tests validate the physics core by:
This approach ensures that test failures indicate true logical or numerical errors, rather than expected floating-point noise.