A C++23 general relativity simulator built as a focused study of numerical relativity and CPU performance engineering. The design is metric-first: a MetricProvider interface owns the geometry, bodies integrate geodesics without knowing the metric underneath, and a hardware benchmarking layer (gr_bench) profiles the machine to assign per-body compute budgets at runtime.
Schwarzschild geodesics — isotropic Cartesian coordinates; metric, Christoffel symbols, and inverse metric computed analytically.
Validated against MTW §25.5: energy
Details
Observer system — static and co-moving observers accumulate proper time; gravitational time dilation from the Schwarzschild lapse factor
Hardware benchmarking gr_bench — probes sustained FLOP/s and memory bandwidth via PAPI or proxy counters; writes a HardwareProfile used by the roofline allocator to cap geodesic iterations per body per step
Test suite — three tests against MTW: geodesic RHS at the ISCO, two-clock gravitational time dilation, coarse vs. fine step-size accuracy contrast
Roofline allocator — real contention model distributing compute budget across bodies from hardware ridge point and local curvature demand
Kerr metric — next MetricProvider; validates metric-swapping at runtime; enables frame dragging, ergosphere, and spin-shifted ISCO (
Force injection — extend the RK4 stepper to accept
Null geodesics — photon paths as first-class simulation objects; photon sphere dynamics, shadow edges, light travel time
Vulkan renderer — camera-as-observer promoted from the observer system; null geodesic ray tracer; Flamm paraboloid embedding diagram
- Misner, Thorne & Wheeler, Gravitation (1973) — geodesic equations and ISCO derivation (§25.5)
- Gourgoulhon (2007), 3+1 Formalism and Bases of Numerical Relativity — isotropic Schwarzschild coordinates
- Jonsson (2013), The Schwarzschild metric: It's the coordinates, stupid! — conserved quantities in isotropic form