/GalMerge

Simulation of the dynamics of Galactic mergers

Primary LanguageJupyter Notebook

GalMerge

The aim of this project it to simulate of the dynamics of Galactic mergers using the Barnes-Hut (BH) algorithm implemented in Python 3.x in a fast and scalable way using multiprocessing and JIT (Just In Time) compilation.

To make a simulation change and edit main.py. This code accepts command line arguments which are explained on the help page shown by running python3 main.py --help. Running main.py will generate four files:

  • Properties.npz: Contains the run parameters, number of cells generated and number of particles considered by Barnes-Hut.
  • Data.npz: Contains the locations, velocity and forces acting on each particle for each frame of the simulation.
  • Cells.npz: Contains the cell objects generated by Barnes-Hut for each frame of the simulation.
  • animations/animation.mp4: An animation of the simulation.

Animator.py provides more possibilities for making simulations such as making an animation of the cells, toggling the grid on and off, coloring particles according to the magnitude of the gravitational force acting on it or its velocity etc.

Results

Some results of our simulations can be found in the simulation_results folder.

The code used to plot some of the figures in the report can be found in the report_plots folder.

System requirements:

This code was checked to be compatible with both Windows and Linux and requires only the base packages from Python 3.x together with numpy, matplotlib, tqdm and numba.