Skip to content

Next - Newtonian EXact Trajectories is a simulation tool written in C++.

License

Notifications You must be signed in to change notification settings

TimGoTheCreator/NEXT

Repository files navigation

NEXT - Newtonian EXact Trajectories

Build License: GPL v3 C++20 OpenMP

NEXT is a Multi-Threaded Simulation tool written in C/C++, solving the N-Body Problem

Using the Barnes-Hut With Higher Order Multipoles Algorithm at a time of O(N log N) licensed under the GNU GPLv3+

Initial Conditions

NEXT includes a modular python script to generate initial conditions, it outputs simple .txt files that NEXT can load directly.

The generator script is located in tools/icbuilder.py

NEXT supports two operating modes:

FP32, FP64

NEXT Multi-threading

NEXT Uses OpenMP with "#pragma omp parallel for" for parallelization.

NEXT uses a 3D Newtonian gravity formulation with:

  • reduced division count (3-6x faster on avg.)
  • Symmetric-force application

NEXT particle representation and I/O

Particles store:

position (x, y, z);
velocity (vx, vy, vz);
mass (m);

Building NEXT

mkdir build
cd build
cmake .. 
cmake --build . --config Release
cd ..

Running a Demo

cd examples/TwoBodies
python two_body.py
../../next two_body.txt 8 0.01 0.1 vtu

NEXT Mathematics

NEXT uses Division-avoiding algebra optimizations to make the simulation run faster.

NEXT also uses the Kick-Drift-Kick Leapfrog method which is implemented like this:

  1. Compute velocities with 0.5 dt
  2. Compute positions with full dt
  3. Compute velocities with 0.5 dt

NEXT Data Output

NEXT uses the .VTK format to output data. More formats like HDF5 are planned.

Media examples of NEXT

Preview the figure-eight simulation