The problem of granular materials is not alone a problem of material properties, but also a problem of structures. To examine these interesting systems, one uses molecular dynamics simulations. The objective of the work presented here was to have a program which can run on cheap high-end shared memory workstations. Therefore we have developed a fast thread-based simulation of polygonal particles.
A thread is an independent sequence of program code inside a process. So having two threads in a program, running on a two processor-machine, the two threads are executed parallel, sharing the same memory. However, one has to prevent a race conditions which arise when both threads are manipulating the same data. This may be done by the use of semaphores although this consumes a small amount of time. The better solution is to design the algorithms in a way so that every thread can manipulate a separate part of the data.
In the first step, the program looks for collisions of the particles' bounding boxes by resorting the list of all boxes. As we are using two threads we split the algorithm into two threads for the X and Y-axis. The second step is a fast method to compute the distance between two polyhedra by finding and tracking the closest points. Here we get a list of possible collisions from the bounding box algorithm. This list can be divided and checked in a completely independent way. Having the list of contacts, we can calculate the forces from this list also in parallel, since a contact is not affected by other contacts. Now the differential equation solver can be started for each particle in the simulation. Again, all information is located in one structure, so the threads can do their work without communication or the use of semaphores.
We will present our parallel versions of algorithms for the simulation of granular materials. The program is designed to offer optimal conditions for shared memory parallelization.