Orrery
A GPU-accelerated N-body gravitational simulator
Loading...
Searching...
No Matches
plummer.hpp File Reference

The Plummer sphere: a self-gravitating system that starts in equilibrium. More...

#include <numbers>
#include "orrery/core/particle_data.hpp"
#include "orrery/core/random.hpp"
#include "orrery/core/types.hpp"

Go to the source code of this file.

Classes

struct  orrery::initial_conditions::PlummerParameters
 A Plummer sphere to sample. More...

Functions

core::ParticleData orrery::initial_conditions::make_plummer_sphere (const PlummerParameters &parameters, core::RandomSource &random)
 Sample count particles from the model, in the centre-of-mass frame.
core::Real orrery::initial_conditions::plummer_potential_energy (const PlummerParameters &parameters)
 The potential energy of the model, -3 pi G M^2 / 32 a.
core::Real orrery::initial_conditions::plummer_kinetic_energy (const PlummerParameters &parameters)
 The kinetic energy of the model, 3 pi G M^2 / 64 a.
core::Real orrery::initial_conditions::plummer_total_energy (const PlummerParameters &parameters)
 The total energy of the model, -3 pi G M^2 / 64 a.

Variables

constexpr core::Real orrery::initial_conditions::kStandardPlummerRadius = 3 * std::numbers::pi_v<core::Real> / 16
 The scale radius that puts a unit-mass Plummer sphere into standard N-body units, where the total energy is exactly -1/4.

Detailed Description

The Plummer sphere: a self-gravitating system that starts in equilibrium.

A star cluster sampled at random from some convenient shape is not in equilibrium and spends the first part of any simulation violently rearranging itself, which is a poor thing to measure conservation against. The Plummer model is the standard alternative. Its density profile and its distribution of velocities are an exact self-consistent solution of the collisionless Boltzmann equation with Poisson's equation, so a sample drawn from it sits at a virial ratio of one and stays there.

It is also the model whose potential is the softened point mass of core/softening.hpp, which is not a coincidence: both come from the same closed-form pair of density and potential, the only one simple enough to invert by hand in both directions.

The sampling follows Aarseth, Henon and Wielen (1974). Radii come from inverting the cumulative mass profile, which needs no rejection; speeds come from rejection sampling of the distribution function, which has no closed inverse. Directions for both are drawn independently and uniformly, which is what makes the result isotropic.

Function Documentation

◆ make_plummer_sphere()

core::ParticleData orrery::initial_conditions::make_plummer_sphere ( const PlummerParameters & parameters,
core::RandomSource & random )
nodiscard

Sample count particles from the model, in the centre-of-mass frame.

Throws std::invalid_argument if the total mass or the scale radius is not positive, or if the cutoff is outside (0, 1).

◆ plummer_potential_energy()

core::Real orrery::initial_conditions::plummer_potential_energy ( const PlummerParameters & parameters)
nodiscard

The potential energy of the model, -3 pi G M^2 / 32 a.

The continuum value, which a sample approaches as the count rises. A finite sample departs from it in two ways worth knowing about when a tolerance is chosen: the statistical scatter of the draw, which falls as the square root of the count, and a deficit of one part in the count, because a sample of N particles has N(N-1)/2 interacting pairs where the continuum has, in effect, N^2/2.

◆ plummer_kinetic_energy()

core::Real orrery::initial_conditions::plummer_kinetic_energy ( const PlummerParameters & parameters)
nodiscard

The kinetic energy of the model, 3 pi G M^2 / 64 a.

Exactly half the magnitude of the potential energy, which is the virial theorem for this system and the statement the sampler is validated against.

◆ plummer_total_energy()

core::Real orrery::initial_conditions::plummer_total_energy ( const PlummerParameters & parameters)
nodiscard

The total energy of the model, -3 pi G M^2 / 64 a.

Equal to -1/4 for a unit-mass sphere at the standard scale radius above.

Variable Documentation

◆ kStandardPlummerRadius

core::Real orrery::initial_conditions::kStandardPlummerRadius = 3 * std::numbers::pi_v<core::Real> / 16
inlineconstexpr

The scale radius that puts a unit-mass Plummer sphere into standard N-body units, where the total energy is exactly -1/4.

3 pi / 16. The convention is Heggie and Mathieu's, and it is worth following rather than inventing: nearly every published figure for cluster simulations is quoted in these units, so a result computed here can be put beside one from the literature without a scaling factor standing between them.