Skip to main content

Module nbody_3d

Module nbody_3d 

Source
Expand description

3D N-Body Symplectic Gravitational and Relativistic Orbital Solver.

Provides a zero-heap Velocity-Verlet / symplectic leapfrog integrator with Newtonian pairwise gravitational acceleration and optional 1st Post-Newtonian (1PN) Einstein-Infeld-Hoffmann perihelion precession corrections.

Reference: AGENTS.md Workstream W5 (§5.4).

Structs§

CelestialBody3D
A celestial mass in 3D Cartesian coordinates.

Constants§

GRAVITATIONAL_CONSTANT
Gravitational constant $G$ in $\text{m}^3 \cdot \text{kg}^{-1} \cdot \text{s}^{-2}$.
MAX_STACK_BODIES
Maximum number of bodies supported in zero-heap stack buffer allocations.
SPEED_OF_LIGHT
Speed of light in vacuum $c$ in $\text{m} \cdot \text{s}^{-1}$.

Functions§

step_nbody_3d_verlet
Advances an N-body system by dt_s seconds using a symplectic Velocity-Verlet step.
total_angular_momentum
Evaluates total 3D angular momentum vector $[L_x, L_y, L_z]$ of the system ($\text{kg} \cdot \text{m}^2 \cdot \text{s}^{-1}$).
total_mechanical_energy
Evaluates total mechanical energy (kinetic + gravitational potential) of the system in Joules.