SkillAgentSearch skills...

Nbody

N body gravity attraction problem solver

Install / Use

/learn @drons/Nbody
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

N-body simulation program

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 | :heavy_minus_sign: | :heavy_minus_sign: bs | 2*max_level | Bulirsch-Stoer method | :heavy_minus_sign: | :star: euler | 1 | Classic Euler method | :heavy_minus_sign: | :heavy_minus_sign: midpoint | 2 | Midpoint method | :heavy_minus_sign: | :heavy_minus_sign: midpoint-st | 2 | Midpoint method (Stetter modification. See 1) p. 228) | :star: | :heavy_minus_sign: rk4 | 4 | Classic Runge-Kutta 4-order method | :heavy_minus_sign: | :heavy_minus_sign: rk_butcher | - | Runge-Kutta method with arbitrary Butcher tableu | :heavy_minus_sign: | :heavy_minus_sign: rkck | 5 | Runge-Kutta-Cash–Karp 5-order method | :heavy_minus_sign: | :star: rkdp | 5 | Runge-Kutta-Dormand–Prince 5-order method | :heavy_minus_sign: | :star: rkdverk | 5 | Runge-Kutta-Verner 5-order method. See 1) p. 181 | :heavy_minus_sign: | :star: rkf | 7 | Runge-Kutta-Fehlberg 7-order method. See 1) p. 180 | :heavy_minus_sign: | :star: rkfeagin10 | 10 | Runge-Kutta-Feagin 10-order method. See 4)| :heavy_minus_sign: | :star: rkfeagin12 | 12 | Runge-Kutta-Feagin 12-order method.| :heavy_minus_sign: | :star: rkfeagin14 | 14 | Runge-Kutta-Feagin 14-order method.| :heavy_minus_sign: | :star: rkgl | 6 | Gauss–Legendre 6-order method | :star: | :heavy_minus_sign: rklc | 4 | Runge-Kutta-Lobatto IIIC 4-order method | :star: | :star: trapeze | 2 | Trapeze method | :star: | :heavy_minus_sign:

Compute engines

Engine alias | Approximate | Description -------------|-------------|------------- ah | :star: | Single threaded engine with Ahmad-Cohen universe force simulation. See 2) block | :heavy_minus_sign: | Multi-threaded (OpenMP) engine with block-by-block force computation cuda | :heavy_minus_sign: | Parallel CUDA engine cuda_bh |:star: | CUDA engine with Burnes-Hut force simulation cuda_bh_tex |:star: | CUDA engine with Burnes-Hut force simulation and with bodies tree stored at texture memory. Possible tree layout is 'heap' and 'heap_stackless' opencl | :heavy_minus_sign: | Parallel OpenCL engine opencl_bh | :star: | Parallel OpenCL engine with Burnes-Hut force simulation openmp | :heavy_minus_sign: | Multi-threaded (OpenMP) engine simple | :heavy_minus_sign: | Simple single threaded engine simple_bh | :star: | 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](https://youtu.be/0_8nZCrVqWI "Million stars Adams–Bashforth method

Related Skills

View on GitHub
GitHub Stars81
CategoryDevelopment
Updated5d ago
Forks5

Languages

C++

Security Score

85/100

Audited on Mar 22, 2026

No findings