A multithreaded C++ N-body gravity solver.
Move into N_Body and run make. Executables are then found in /bin:
main- N-body code.random- Initializes stars randomly throughout the box.lattice- Initializes stars in a cubic lattice. throughout the box.
Usage: main [OPTIONS]
Options:
--threads, -t <num> Number of threads to use (default: maximum available threads)
--parameters, -p <file> Path to parameter file (default: N_Body/parameters.txt)
--initials, -i <file> Path to initial conditions file (default: N_Body/initial_conditions.csv)
--help, -h Display this help message and exit
parameters.txt
deltaTime: time step (s).maxTime: time code runs until (s).stepsBetweenSnapshots: number of timesteps between saved snapshots.boxSize: size of the periodic box.softeningLength: gravitational softening length.
initial_conditions.csv
Each row contains the attributes for each star. The columns are:
mmassxx-coordinateyy-coordinatezz-coordinatevxvelocity along x-axisvyvelocity along y-axisvzvelocity along z-axisaxacceleration along x-axisayacceleration along y-axisazacceleration along z-axis
Example Python scripts for visualization and analysis in python directory.
Creates an animation of the box in 3d.
Creates an animation of the box in 2d, in the x-y plane.
Creates an animation of the Sun, Earth, Mars, Jupiter system for one Jupiter year.
Plots the distance of Earth from the origin.