Skip to content

drons/nbody

Repository files navigation

Build Status Build Status Ubuntu@Colab+CUDA codecov Coverity Scc Count Badge codefactor.io

Features

Integration methods

Method alias Order Description Implicit Dynamic step
adams up to 5 Adams–Bashforth method
bs 2*max_level Bulirsch-Stoer method
euler 1 Classic Euler method
midpoint 2 Midpoint method
midpoint-st 2 Midpoint method (Stetter modification. See 1) p. 228)
rk4 4 Classic Runge-Kutta 4-order method
rk_butcher - Runge-Kutta method with arbitrary Butcher tableu
rkck 5 Runge-Kutta-Cash–Karp 5-order method
rkdp 5 Runge-Kutta-Dormand–Prince 5-order method
rkdverk 5 Runge-Kutta-Verner 5-order method. See 1) p. 181
rkf 7 Runge-Kutta-Fehlberg 7-order method. See 1) p. 180
rkfeagin10 10 Runge-Kutta-Feagin 10-order method. See 4)
rkfeagin12 12 Runge-Kutta-Feagin 12-order method.
rkfeagin14 14 Runge-Kutta-Feagin 14-order method.
rkgl 6 Gauss–Legendre 6-order method
rklc 4 Runge-Kutta-Lobatto IIIC 4-order method
trapeze 2 Trapeze method

Compute engines

Engine alias Approximate Description
ah Single threaded engine with Ahmad-Cohen universe force simulation. See 2)
block Multi-threaded (OpenMP) engine with block-by-block force computation
cuda Parallel CUDA engine
cuda_bh CUDA engine with Burnes-Hut force simulation
cuda_bh_tex CUDA engine with Burnes-Hut force simulation and with bodies tree stored at texture memory. Possible tree layout is 'heap' and 'heap_stackless'
opencl Parallel OpenCL engine
opencl_bh Parallel OpenCL engine with Burnes-Hut force simulation
openmp Multi-threaded (OpenMP) engine
simple Simple single threaded engine
simple_bh Multi-threaded (OpenMP) engine with Burnes-Hut force simulation

How to run

Simulation

To run n-body problem simulation use 'nbody-simulation' program.

Simulation control
Argument Description
--stars_count Stars count
--box_size 'Universe' box size.
--output Output stream name.
--resume Stream name to resume (in this case output and initial_state are ignored).
--initial_state Optional initial state file
--initial_type Initial state type. Possible values are: Zeno, G1, SI, ADK. See initial state types table.
--max_part_size Max stream file size (splits a stream into multiple files).
--max_time Max simulation time.
--dump_step Time step to dump simulation state to stream.
--check_step Time step to verify the fundamental laws of physics. Conservation of impulse [P], angular momentum [L], energy [E], mass center velocity [V].
--check_list List of fundamental laws of physics to check. For example --check_list=PL to check only conservation of impulse [P] and angular momentum [L].
--verbose Print detailed simulation information.
Initial state types
Type Description
Zeno File in 'Zeno' format. Can be created with snapascii tool.
G1 Plane text table with Rx Ry Rz Vx Vy Vz M values. Space as separator.
SI Plane text table same format as G1. Units are meter, second, kilogram. On load mass will be multiplied by MassFactorSI to convert to G1 type.
ADK Plane text table same format as G1. Units are astronomical unit, day, kilogram. On load mass will be multiplied by MassFactorAuDayKg to convert to G1 type.
Engine control arguments are:
Argument Description
--engine Compute engine type.
--distance_to_node_radius_ratio Simulation accuracy control for Burnes-Hut engines.
--traverse_type Space tree traverse type for Burnes-Hut engine. Possible values are cycle or nested_tree.
--tree_layout Space tree layout type for Burnes-Hut engine. Possible values are tree or heap.
--tree_build_rate Full tree build rate in cucles for Burnes-Hut engine. Only boxes geometry are rebuild between full builds, cells layout is not changed. If 0 than full tree build occurs on each compute.
--full_recompute_rate Full force recompute rate in cucles (Ahmad-Cohen engine).
--max_dist The maximum distance at which the force is calculated completely at each step (Ahmad-Cohen engine).
--min_force The minimum force of attraction at which it is calculated completely at each step (Ahmad-Cohen engine).
--device Platforms/devices list for OpenCL based engines. Format: Platform1_ID:Device1,Device2;Platform2_ID:Device1,Device2... For example: --device=0:0,1 - first and second devices from first platform (with same context), --device=0:0;0:1 - first and second devices from first platform (with separate contexts)
--oclprof Enable OpenCL profile
--block_size Data block size to load at local OpenCL/CUDA memory
--use_nccl Use libNCCL for CUDA multi GPU communications (default: false)
Solver control arguments are:
Argument Description
--solver Solver type.
--max_step Solvers max time step
--min_step Embedded solvers min time step
--rank Adams–Bashforth solver rank (1...5).
--correction Kahan summation at each integration step (for now at Adams–Bashforth and Runge-Kutta solvers)
--starter_solver Adams–Bashforth starter solver.
--refine_steps_count Refine step count for implicit solvers.
--error_threshold Step error threshold for solvers with dynamic step. If the error at the current step is greater than the threshold, then we decrease the time step and repeat the step.
--max_recursion Max recursion level for embeded solvers.
--substep_subdivisions Number of embeded solver substeps into which the current step is divided at the next level of recursion when the error greater than error_threshold.
--max_level Maximum extrapolation table size for Bulirsch-Stoer solver
--clamp Clamp outliers coordinates to bounding box

Player

To view simulation results run 'nbody-player' program.

Argument Description
--input Input stream name.
--check_list List of fundamental laws of physics to check. For example --check_list=PL to check only conservation of impulse [P] and angular momentum [L].

Other parameters controlled via UI.

Gallery

GCS GCS GCS GCS GCS

Refs

  1. Hairer, Ernst; Nørsett, Syvert Paul; Wanner, Gerhard (1993), Solving ordinary differential equations I: Nonstiff problems, Berlin, New York
  2. A Numerical Integration Scheme for the N-Body Gravitational Problem A. AHMAD AND L. COHEN 1973
  3. Задача N тел или как взорвать галактику не выходя из кухни
  4. Feagin T. A tenth-order Runge–Kutta method with error estimate. In: Proc. of the IAENG Conf. on Scientific Computing. Hong Kong, 2007.

Releases

No releases published

Packages

No packages published