Lattice Boltzmann Method in CUDA

Assignment

The goal of this semester project was to implement a 3D Lattice Boltzmann method (LBM) solver for fluid simulation. LBM solves the Boltzmann equation and is one of the computational fluid dynamics (CFD) methods. The idea is that we simulate the microscopic properties of the fluid using particles (molecules of the fluid) and their possible distributions among the lattice nodes. These particles can travel between adjacent nodes (based on the distribution model) and collide with each other. The collisions are resolved with usage of the Bhatnagar-Gross-Krook (BGK) collision operator.

2D and 3D versions of the method were implemented using OpenGL and CUDA. Even though my initial goal was to create only the 3D version of the simulator, the 2D version was kept because it is much easier to debug and prototype on. CUDA and OpenGL interoperability is utilized which means that the whole simulation can be run purely on NVIDIA GPU. The final report for this project is available here.

Controls

The application can be controlled at runtime using the provided user interface or some of the selected keyboard shortcuts. W, S, A, D keys are used to operate the camera location. Q and E are used for camera rotation in 3D. R resets the simulation and T pauses it. I, O and P are used in 3D to set front, side and top view of the camera, respectively. Some of the variables that are not modifiable at runtime can be set before running the application in the configuration file "config.ini". Command line arguments can also be used. Available options are "-h" for help, "-t" for selecting LBM type (3D or 2D), "-s" for setting scene file, "-m" for whether to measure time (true or false), "-lh" for setting lattice height (3D only), "-p" for number of particles, "-c" for whether to use CUDA or not (true or false), "-tau" for setting value of tau, and many more for time measurements (see help for more details). The executables are packaged with multiple example batch files that demonstrate the application.

Downloads and Links

Programming Languages and Libraries