Skip to content

N-Body problem in C with parallel computing using 12 order Runge-Kutta with adaptive step size

Notifications You must be signed in to change notification settings

yiqiangjizhang/N-Body-Problem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

N-body-problem

Solution of the N-Body Problem with 12-order Runge-Kutta in C using parallel processors with ALL-Pairs algorithm.

Physics

Given bodies in an inertial reference frame in with an initial position and velocity for , the force vector on body caused by its gravitational attraction to body is given by the following equation:

Where and are the masses of the bodies and respectively; and is the distance between the position vectors. Summing over all masses yields the -body equations of motion:

where is the self-potential energy

Algorithm

The computation has two steps:

  1. Compute the forces on each element
  2. Move each element a bit based on this force, and then repeat

Since each object computes the forces on it from each other object ( objects). Thus, the work complexity of this problem is a algorithm. Each object must compute its interaction with each other object so each of objects has to compute forces.