This program simulates the behaviour of a system of n particles/bodies following Newton's law of universal gravitation. The basic principles can be found here.
A number of random particles can be specified or a file to read the particle data from. The format of the file has to be:
[mass] [x] [y] [z] [vx] [vy] [vz]
You can choose between a brute-force approach (standard) or using the Barnes-Hut method.
Use the provided Makefile to compile the code. Tested on Linux and Max OSX 10.9.5. Boost and GL/GLUT,OpenGL libraries required.
./nbody -h
Allowed options:
-h [ --help ] produce help message
-p [ --particles ] arg (=100) set number of particles
-f [ --infile ] arg specify input file
-e [ --epsilon ] arg (=0) set softening factor
-t [ --theta ] arg (=1) set threshold value for theta
-B [ --Barneshut ] [=arg(=1)] use Barnes-Hut method
-b [ --boundary ] [=arg(=1)] use periodic boundary conditions
-o [ --octants ] [=arg(=1)] make octants visible
-n [ --threads ] arg (=1) specify number of threads (only for BH. No need
to add -B.)
Sebastian Potthoff: [email protected]
University of Warwick, March 2016