Lagrangian Particle Tracking on a GPU

Thesis

View the Project on GitHub nightlifelover/Thesis

Abstract

In addition to the most common numerical method, the finite volume method, particles are often used in complex fluid simulations. For example when simulating combustion in a Diesel engine the droplets are modeled as particles while the fluid is calculated in a discrete mesh. The two phases are called Eulerian and Lagrangian. While the Lagrangian phase does not need a mesh itself, coupling it with the Eulerian phase requires to know, for each time step, in which cell the particles reside. If unstructured meshes are used it is not trivial to find a particles occupancy cell, given its position. To do so a sophisticated particle tracking algorithm was developed. When using particles it is usually desirable to use a large number of particles, because this leads to better results. The aim of this project was to track particles more efficiently. Because the particle tracking algorithm tracks each particle individually it is suitable for massively parallel computing. A graphics processing unit (GPU) was used which can run thousands of threads concurrently. Using an existing computational fluid dynamics (CFD) package, OpenFOAM, a simple solver was developed in which particles are dragged by a given velocity field through the mesh. This work involved converting the mesh and particle data into structures suitable for parallel processing as well as porting the algorithm to the GPU. Testing and validating the code was the biggest part: Because of the lack of object oriented constructs for the code on the GPU, the data was stored in simple arrays making it necessary to calculate array indices in the program. This lead to rather error prone code. To ensure correctness the intermediate results of the sequential implementation were extracted and compared to the results of the new parallel implementation. Finally a switch was added to the solver which causes a mesh search after each time-step: For each particle a mesh search is executed for its end position revealing the actual occupancy cell. This is then compared with the new occupancy calculated by the newly-developed particle tracking algorithm. If it is turned on, one can ensure that occupancy cells of all particles are correct. This, of course, makes the solver extremely slow. Comparing the computation time for the tracking algorithm revealed a huge speedup. The GPU implementation is around 30 times faster compared to the sequential implementation in OpenFOAM. Because it is necessary to copy all the data over a slow bus to the GPU the practical execution time is slower, but still much faster than the sequential implementation.

Read the full thesis here.