Skip to content

alvinng4/Gravity-Simulator

Repository files navigation

Gravity Simulator

Python N-body gravity solver accelerated with C

This is a student project developed for learning purpose. It aims to provide a toolbox for Newtonian gravity simulations and visualizations.

Features:

  • Ten integrators including WHFast and IAS15
  • Barnes-Hut algorithm
  • CLI (for simple usage) and API Interfaces
  • (Optional) OpenMP and CUDA acceleration
  • Multiple sample projects

Image

Image

Documentation

The documentations for CLI and API are available in the docs folder.

Sample projects

Some projects are done with the API. The scripts are stored at the examples folder.

Evolving the solar system for 1 million years

Image

Image

Asteroid belt simulation

Image

Formation of Kirkwood gaps

Image

Image

Videos:

Galaxy collision

Note: This simulation is for demonstration only. The initial conditions are very different from actual galaxies.

Image

Videos:

Feedback and Bugs

If you found any bugs or want to leave some feedback, please feel free to let me know by opening an issue or sending an email to alvinng324@gmail.com.

Acknowledgement

The following book helped me a lot in learning the basics of N-body simulations and also the implementation of the integrators.

  • J. Roa, et al. Moving Planets Around: An Introduction to N-Body Simulations Applied to Exoplanetary Systems, MIT Press, 2020