45namespace orrery::core {
53 Real kinetic_energy{};
54 Real potential_energy{};
55 Vec3 linear_momentum{};
56 Vec3 angular_momentum{};
58 [[nodiscard]]
constexpr Real total_energy()
const noexcept {
59 return kinetic_energy + potential_energy;
80 const Real magnitude = potential_energy < 0 ? -potential_energy : potential_energy;
81 return 2 * kinetic_energy / magnitude;
86[[nodiscard]] Real
total_mass(std::span<const Real> masses);
98 std::span<const Real> masses);
120 std::span<const Real> masses);
Storage for a set of point masses in structure-of-arrays layout.
Definition particle_data.hpp:43
The softening length of the Plummer kernel above.
Definition softening.hpp:49
Vec3 centre_of_mass(Vec3Span< const Real > positions, std::span< const Real > masses)
The mass-weighted mean position.
Real potential_energy(Vec3Span< const Real > positions, std::span< const Real > masses, Softening softening)
U = -G sum over pairs of m_i m_j / sqrt(r_ij^2 + eps^2).
Vec3 angular_momentum(Vec3Span< const Real > positions, Vec3Span< const Real > velocities, std::span< const Real > masses)
L = sum over i of m_i (r_i cross v_i), about the origin.
Real kinetic_energy(Vec3Span< const Real > velocities, std::span< const Real > masses)
T = sum over i of m_i v_i^2 / 2.
Diagnostics measure_diagnostics(const ParticleData &data, Softening softening)
Every quantity above, measured together.
Vec3 centre_of_mass_velocity(Vec3Span< const Real > velocities, std::span< const Real > masses)
The mass-weighted mean velocity, which is the velocity of the centre of mass and is what a sampler su...
Vec3 linear_momentum(Vec3Span< const Real > velocities, std::span< const Real > masses)
P = sum over i of m_i v_i.
Real total_mass(std::span< const Real > masses)
The sum of the masses.
The particle store: one contiguous array per component.
Plummer softening, defined once for everything that needs it.
Every conserved quantity of a configuration, measured at one instant.
Definition diagnostics.hpp:52
constexpr Real virial_ratio() const noexcept
The virial ratio 2T / |U|.
Definition diagnostics.hpp:79
A view of three component arrays of equal length.
Definition vec3_span.hpp:33
A vector in three-dimensional Euclidean space.
Definition vec3.hpp:26
The scalar and index types that every layer of the project agrees on.
A three-component vector for interfaces, not for storage.
Three parallel component arrays, viewed as one sequence of 3-vectors.