|
Orrery
A GPU-accelerated N-body gravitational simulator
|
Every conserved quantity of a configuration, measured at one instant. More...
#include <orrery/core/diagnostics.hpp>
Public Member Functions | |
| constexpr Real | total_energy () const noexcept |
| constexpr Real | virial_ratio () const noexcept |
| The virial ratio 2T / |U|. | |
Public Attributes | |
| Real | kinetic_energy {} |
| Real | potential_energy {} |
| Vec3 | linear_momentum {} |
| Vec3 | angular_momentum {} |
Every conserved quantity of a configuration, measured at one instant.
An aggregate, because it is a record of measurements with no invariant relating them. The two derived quantities are member functions rather than fields so that they cannot be stale.
|
inlinenodiscardconstexprnoexcept |
The virial ratio 2T / |U|.
One for a self-gravitating system in equilibrium, by the virial theorem. Below one the system is colder than equilibrium and will collapse before settling; above one it is hotter and will expand. It is the standard check that a sampled configuration is in the state its model claims, and it is how the Plummer sampler is validated.
The convention differs between authors: some write the same statement as -2T/U, which is identical for a bound system, and some as T/|U|, which is a half where this is one. This project quotes 2T/|U| throughout.
A configuration whose particles do not interact has no potential energy and no virial statement to make. The division then returns an infinity or a quiet NaN rather than a plausible number, which is the intended behaviour: a nonsense question should give a visibly nonsense answer.