I am embarking on a new project for my GPU Programming and Architecture class. The project goal is to produce a GPU implementation of a physically-based fluid simulator, using semi-Lagrangian advection scheme on a staggered grid. Technically I will be modifying and extending the CPU implementation that I made for another class (Physically-Based Animation).
The first goal of the project is to convert the projection step (i.e. the pressure update), which is the bottleneck of the CPU implementation, to run on the GPU. The projection step's purpose is to compute pressure differences between neighboring cells and adjust the fluid's velocity field, so that it stays incompressible and divergence-free. The step involves the solving of a linear system Ap = d, where A is n x n sparse matrix (where n is the number of cells in the simulation), d is a vector containing the velocity divergence of each of the n cells, and p is a unknown vector containing the pressures in each of the n cells. A and d are known, and the goal is to compute p, by computing the inverse of A (p = Ainv d) . Once the pressures for each of the cells are computed, the velocity field can be adjusted to become divergence free.
These videos are from my CPU implementation, which ran far from real-time even on small grids.
(to be continued...)