Astronomy
Star cluster dynamics
A softened N-body cluster with up to 32768 mutually attracting stars. Follow real trajectories and compare mass segregation with CPU, CUDA, OpenCL or Vulkan calculations.

What happens
A Plummer cluster begins close to virial equilibrium. Encounters redistribute orbital energy; heavier stars can concentrate towards the centre. Positive instantaneous energy is a candidate escape criterion, not proof of permanent escape. The half-mass relaxation estimate is 0.138 N r_h^(3/2) / ln(0.11 N) in units G=M=1; it differs from the longer evaporation time. Colours and rendered sizes are illustrative.
Equations used in the module
Equations Plummer sphere, N-body units G = M = a = 1: the potential energy is exactly −3 pi/32 = −0.29452431127404 sampling: r(X) = a/sqrt(X^(−2/3) − 1) inverts M(r) = r^3/(1 + r^2)^(3/2); speeds by rejection from g(q) = q^2(1 − q^2)^(7/2) half-mass radius = a/sqrt(2^(2/3) − 1) = 1.3047660265041068, virial radius = 16 a/(3 pi) = 1.6976527263135504 crossing time = 2 R_v^(3/2) = 4.423879394216752; virial equilibrium means −2T/U = 1 leapfrog with softening: the energy error falls as the square of the step - measured slopes 2.02, 2.01, 2.00 a star has escaped when its own total energy is positive - a criterion, not a timer relaxation: t_relax = 0.138 N r_h^(3/2)/(sqrt(Gm) ln(0.11 N)) - it grows as N/ln N, so small clusters evaporate and big ones do not tide: Ω² = M/(3 r_J³) ; a = a_grav + (3Ω² x, 0, −Ω² z) − 2Ω × v ; E_J = T + U − (3/2) Ω² Σ m x² + (1/2) Ω² Σ m z² Salpeter: ξ(m) ∝ m^(−2.35), 0.1 ≤ m ≤ m_max ; Kroupa: m^(−1.3) (0.08–0.5 M☉), m^(−2.3) (0.5–m_max)


