gr-Orbit-Toolkit: A Python-Based Software for Simulating and Visualizing Relativistic Orbits
Milagros Delgado, Wladimir E. Banda-Barragán
TL;DR
Gr-orbit-toolkit addresses the need for accessible numerical tools to compare classical Newtonian orbits with general-relativistic post-Newtonian corrections in teaching and research. The authors implement and compare multiple ODE integrators—Euler-Trapezoidal, RK3, and SciPy's DOP853—to solve the equations of motion, including the classical form $d^{2}u/d\phi^{2} + u = GM/h^{2}$ and the GR form $d^{2}u/d\phi^{2} + u = GM/h^{2} + 3 GM u^{2}/c^{2}$, and demonstrate relativistic precession $\Delta\phi = 6\pi GM/(a(1-e^{2})c^{2})$. They show relativistic effects are negligible for the Earth-Sun-like system but become significant near massive centers, e.g., a precession of $0.930$ radians per orbit for a body around a $5\times 10^{6} M_\odot$ black hole with $e=0$. The work provides seven simulations, convergence analyses, and notebooks in a public repository, establishing gr-orbit-toolkit as a practical digital twin for GR orbital mechanics in education and research.
Abstract
Creating software dedicated to simulation is essential for teaching and research in Science, Technology, Engineering, and Mathematics (STEM). Physics lecturing can be more effective when digital twins are used to accompany theory classes. Research in physics has greatly benefited from the advent of modern, high-level programming languages, which facilitate the implementation of user-friendly code. Here, we report our own Python-based software, the gr-orbit-toolkit, to simulate orbits in classical and general relativistic scenarios. First, we present the ordinary differential equations (ODEs) for classical and relativistic orbital accelerations. For the latter, we follow a post-Newtonian approach. Second, we describe our algorithm, which numerically integrates these ODEs to simulate the orbits of small-sized objects orbiting around massive bodies by using Euler and Runge-Kutta methods. Then, we study a set of sample two-body models with either the Sun or a black hole in the center. Our simulations confirm that the orbital motions predicted by classical and relativistic ODEs drastically differ for bodies near the Schwarzschild radius of the central massive body. Classical mechanics explains the orbital motion of objects far away from a central massive body, but general relativity is required to study objects moving at close proximity to a massive body, where the gravitational field is strong. Our study on objects with different eccentricities confirms that our code captures relativistic orbital precession. Our convergence analysis shows the toolkit is numerically robust. Our gr-orbit-toolkit aims at facilitating teaching and research in general relativity, so a comprehensive user and developer guide is provided in the public code repository.
