Particles

Static Badge Static Badge

We are given \(n\) particles that are either positively or negatively charged. The force between two particles \(i\) and \(j\) is calculated using the following formula. \(\(F = |c_i \cdot c_j| / d^2\)\) where \(c_i\) and \(c_j\) are their charges and \(d\) is the euclidean distance between them. If the particles have the same charge then the force will attract them, otherwise the force repels them. Particles move in a two-dimensional plane that is bounded with a rectangle. The rectangle bounds hole the particles in the array by having its own charge that repels particles. At the beginning, the particles are given random positions and speed. (further reading about the modeling of the problem explained in chapter 11.2).

Implementation guidelines

  1. Implementation of the graphical interface:

    • The program should have parameters with which the graphical interface can be toggled to achieve best performance

    • The drawing of the graphics should be done independently of the computational threads.

    • The default size of the window is 800x600px but can be adjusted manually.

    • The drawing of frames should be limited to 60 frames per second (FPS).

  2. Running the program:

    • The program can be ran in different modes (sequential, parallel, distributed) by specifying a parameter.

    • User can specify the number of particles in the simulation with a parameter.

    • The program allows setting the number of cycles the simulation runs for (compute cycles not draw).

    • The program measures run-time needed to complete.

  3. Problem specific implementation requirements

    • Every version (sequential, parallel, and distributed) measures cycles passed. Every update of positions of all particles is considered a cycle. All three implementations run the simulation until they reach a specified number of cycles.

    • The starting position of and force of particles is random. However, if the simulation is ran in all three versions, the same initial distribution of particles is used for all three versions.

    • The implementation must adapt automatically to the hardware it is being ran on (Physical CPU's, Cores, Memory, etc..);

Testing

The report must include extensive testing and explanation of results (numeric and graphical). All three versions must be tested. The tests should be performed without drawing graphics. The parameters that influence the runtime are the number of cycles the simulation should run and the number of particles. Consequently, both need to be tested independently to show how the implementation scales. Present the results with informative charts/figures and explain them in detail. The implementation should be tested in the following way: