11/28/2020 Yukei S. Murakami ,UCB (sterling.astro@berkeley.edu)
(for a video version of this sample output, please visit: https://youtu.be/9lIqs2ast2k)
This is a prototype version of an introductory N-body simulation (2D) with a Milky-Way-like galaxy density profile.
There are two main code files (jupyter notebook): Density_profile_prep.ipynb
and Simulation.ipynb
.
note: this repository does not include data/
and ani/
folders where data and aminations are saved. please prepare these folders on your own.
In this simulation, to make the code run faster and coding easier, we assume a static global mass density distribution.
That is, we only simulate N free-moving objects on a pre-determined gravitational potential. This is not perfect because the localization of gravitational potential is much more diluted, but the results are still fun to look at and meaningful for the educational purposes.
To fully make use of this pre-determined gravitational potential, we prepare a pre-calculated set of enclosed mass
This jupyter notebook contains main parts of simulation. It contains various tools, such as an initial condition preperator, a Force calculator, an RK4 calculator, the main simulator, and an animator. Following each step should prepare users to understand and run an N-body simulation.