# FLIP Variants

Below are some of the FLIP variants I have implemented in my research.

Currently, I am interested in combining FLIP with other physically based animation techniques to extend the range of supported phenomenon.

## FLIP123 a.k.a. muFLIP

Inspired by smallpt and minray I got to thinking, how many lines would it take to write a FLIP implementation? My answer is 123. And that includes visualization as well.

Grab the code from GitHub.

## MGPCG FLIP

Arguably, getting the boundary conditions right is the hardest part of a FLIP implementation, but at end of the day, the pressure solve merits the most attention as it requires the most compute time during the simulation.

To get the best performance on the pressure solve, we implemented a mulitgrid preconditioner for the conjugate gradient method. It has been introduced for Semi-Lagrangian fluid simulations, but can be adapted to FLIP just as well.

Using MGPCG reduced the time of the pressure solve to 10% of what we had for CG.

## OpenVDB FLIP (with MGPCG)

OpenVDB is a library for sparse 3D data structures.

The premise of OpenVDB for FLIP is pretty straightforward: With the sparse grid, we only store meaningful data, and we won't waste memory or computations on the empty portions of the domain.

To our disappointment, using OpenVDB for *the whole simulation* turned out to
impose such a performance hit, that it did not justify the reduced memory benefits.

After switching to dense structures, our time steps got twice as fast as before, even without reducing the domain to the bounding box of the fluid.

## CUDA FLIP

When something is as computationally heavy as a fluid simulator, it is always a good idea to try to throw a GPU at it.

Indeed, even without serious optimization, the CUDA implementation of FLIP is crunching frames like nobody's business.

The cost of a CUDA project is the harder maintainability and more difficult debugging. Because of these reasons, we decided to keep this a pilot project, and return to CUDA only at major milestones of the research, when the CPU-only version is mature enough.

Extra: flow around a cylinder