Skip to content

A small application for simulating basic gravitational mechanics.

License

Notifications You must be signed in to change notification settings

CorbinFoucart/orbital_mechanics

Repository files navigation

orbital_mechanics

time integration of the n-body problem.

  • Simulation code is written in C++, see celestial_mechanics.h, celestial_mechanics.cc, and the driver code driver.cc. Outputs trajectories to CSV file.
  • Simulation code is templated by space dimension to simultaneously implement both 2D and 3D dynamics in a dimension-independent way.
  • Python code to plot and animate the CSV trajectory output can be found in animations.ipynb.

Some animations.

I enjoyed writing this and it helped me get a better feel for n-body dynamics. Pull requests welcome :-)

running the code

In this directory,

  • run cmake .
  • compile and run driver.cc with make run
  • run the jupyter notebook to plot and animate the simulation trajectories

requirements

  • C++: cmake 3.11+ gcc 10.2+
  • python, jupyter, numpy, scipy, matplotlib, pandas

About

A small application for simulating basic gravitational mechanics.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published