All Projects → fengwang → nbody-simulation

fengwang / nbody-simulation

Licence: other
a simulation of a dynamical system of particles

Programming Languages

C++
36643 projects - #6 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to nbody-simulation

nBody
GPU-accelerated N-Body particle simulator with visualizer.
Stars: ✭ 28 (+21.74%)
Mutual labels:  nbody, nbody-simulation
N-body-numerical-simulation
Script written in Python to integrate the equations of motion of N particles interacting with each other gravitationally. The script computes the equations of motion and use scipy.integrate to integrate them. Then it uses matplotlib to visualize the solution.
Stars: ✭ 40 (+73.91%)
Mutual labels:  nbody, nbody-simulation
heyoka.py
Python library for ODE integration via Taylor's method and LLVM
Stars: ✭ 45 (+95.65%)
Mutual labels:  nbody
concept
COsmological N-body CodE in PyThon
Stars: ✭ 62 (+169.57%)
Mutual labels:  nbody-simulation
Barnes-Hut-Simulator
A C++ implementation of the Barnes-Hut-Algorithm.
Stars: ✭ 51 (+121.74%)
Mutual labels:  nbody-simulation
mini-nbody
A simple gravitational N-body simulation in less than 100 lines of C code, with CUDA optimizations.
Stars: ✭ 73 (+217.39%)
Mutual labels:  nbody
heyoka
C++ library for ODE integration via Taylor's method and LLVM
Stars: ✭ 151 (+556.52%)
Mutual labels:  nbody
negative-mass-simulator
Negative Mass N-body Simulation Codes
Stars: ✭ 57 (+147.83%)
Mutual labels:  nbody-simulation

Introduction

This is a 3D simulation of a dynamical system of particles, under the influence of gravity.

Consider n point masses m_1, ... ,m_n in three-dimensional space. Suppose that the force of attraction experienced between each pair of particles is Newtonian. Then, if the initial positions in space and initial velocities are specified for every particle at some present instant t_0, determine the position of each particle at every future (or past) moment of time.

Configuration

N particles are generated randomly within a sphere. For each particle generated, its coordinate P(p_x, p_y, p_z) $$p_x^2 + p_y^2 + p_z^2 < 1 m$$, it mass m $$10^5 kg < m < 10^6 kg $$. The elapse time interval is set to $$0.1 s$$. Also Opengl is employed to visualize the simulation result.

Algorithms

Integration Algorithm

Using classic Runge-Kutta method.

http://math.fullerton.edu/mathews/n2003/RungeKuttaMod.html

Simulation Algorithm

Barnes-Hut simulation

J. Barnes and P. Hut (December 1986). "A hierarchical O(N log N) force-calculation algorithm". Nature 324 (4): 446-449. doi:10.1038/324446a0.

The volume is divided up into cubic cells in an octree, so that only particles from nearby cells need to be treated individually, and particles in distant cells can be treated as a single large particle centered at its center of mass.

Parallel

Using c++0x thread provided by pthread.

Simulation Result

  • N = 3 ------- file video/nbody_3.mkv
  • N = 30 ------- file video/nbody_30.mkv
  • N = 300 ------- file video/nbody_300.mkv
  • N = 1000 ------- file video/nbody_3000.mkv

Discussion

Author

Wang Feng [email protected]

License

Licensed under the GPLv3.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].