This project involved developing a custom Runge-Kutta numerical solver in Python to model the orbits of all 9 major planets in the Solar System. Using data from NASA's JPL Horizons API, we are able to get data for many near earth asteroids and also JWST. The simulation traces the trajectory of the James Webb Space Telescope as it travels toward the Earth-Sun L2 Lagrange point.
The solver was implemented using both CPU (NumPy) and GPU (CuPy) backends to benchmark performance improvements. An adaptive step-size version of the integrator was also created for greater stability and accuracy. The simulation remains close to real ephemeris data for several months before diverging—demonstrating both the strength and limits of Newtonian integration in an N-body problem.
The GPU side of the simulation is very much left up to CuPy and the built-in support. It would be much better to write a custom GPU kernel. I'm currently learning some basic C++ and plan to rewrite this project in C++ as I'm aware it's popular for CUDA development. The CPU version should have some nice optimisations to make as well, which will be easier to implement in C++.