You probably want to use the idea of prefex sum that I described in class. Please write your algorithm clearly. Write an MPI program to perform N-body simulation. N nodes are randomly scattered over a square, two-dimensional space. Each node is described by an associated mass, position and velocity.
Nodes are subject to an applied force by other nodes within the space.
Write a simulation program for simulating the movement of the nodes in time. One simple way to do the simulation is to calculate the movement of a node by accumulating the effects of pairwise node interaction. Thus, given the accumulated acceleration a i at time t , the new velocity v and position p for node i at time are calculated using and . The initial velocity for each node is 0 and mass is 1. Let G be 1 for simplicity.