Real-time Affine Particle-In-Cell vs Fluid Implicit Particle Fluid Simulation

Authors: Kevin You and Katerina Nikiforova

Project Goal

This project explores a parallel, highly optimized hybrid Lagrangian/Eulerian fluid simulation, focusing on real-time performance. We investigate both the established Fluid Implicit Particle (FLIP) method and the more recent Affine Particle-In-Cell (APIC) technique that addresses FLIP's instabilities.

Project Plan

Progress Updates

Here, we keep a log of weekly progress throughout the project:

April 14th:
Created a 2D particle simulator framework (with potential for 3D expansion). Implemented particle advection and a sparse grid structure. Literature reviewed:

Example Run:

April 17th:
Currently have a working Eulerian grid implementation, with a particle-to-grid and from-grid transfer. The pressure solve is still unimplemented:

Example Run:

April 21st:
Currently have a partially working 2D particle simulation implmented. The interpolation scheme is wrong, and the pressure solve is buggy, but the system is end-to-end complete. The next steps will involve debugging the pressure solve, and implementing profiling. There are clear performance issues even in 2D with the pressure solve, and the system only runs real-time if the pressure solver is allowed on the order of 10 iterations.

Example Run:

April 23rd
The 2D implementation is complete and debugged! I'm really happy with how it looks. This runs in real time, so I plan to expand the system to 3D, which should cause performance problems (that we can then solve :))

April 25th
The sequential fluid simulation is fully implemented and debugged in 3 dimensions in C++. There are clear performance issues for large grids, and the pressure solver struggles to converge to a solution for the pressure gradient which is required every time step of the simulation. The below videos show the visualization of the current state of the simulation: the color of the particle represents its depth along the z axis.

Running in real time with a very small grid:
Running in real time with a very poor pressure solve:
Running not in real time with a 32 x 32 x 32 voxel grid and a 100-iteration pressure solver:

Given the above limitations, the code has been instrumented with profiling and the following initial profiling results were found over 500 iterations of the simulation:

Function Time (seconds)
advect 0.020462
external_forces 0.004851
solve_pressure 33.041090
transfer_from_grid 0.440525
transfer_to_grid 0.624375
Clearly, the pressure solver is the most time consuming part. This will the focus of the optimizations.

Results

Coming soon...