Stable Fluid Demo Video
Mass-Spring Demo Video
Stable Fluid Simulation
I have implemented stable fluid simulator with semi-Lagrangian advection and basic mass-spring simulator. I consult mostly Robert Bridson’s Fluid Simulation for Computer Graphics for fluid simulation and Andrew Witkin’s SIGGRAPH 1997 course note, Physically Based Modeling: Principles and Practice, for mass-spring simulation.
I used MAC (marker-and-cell) method, a staggered grid, for storing velocities and calculating divergence. This enables me to calculate unbiased and correct, i.e. having trivial null space, finite differences. Also, I used one of the Jos Stam’s stable fluid techniques, semi-Lagrangian advection, in order to achieve unconditionally stable simulation. In the Projection stage, I used plain conjugate gradient method to solve the linear system of pressures and divergence, and subsequently to make the fluid incompressible. Since I didn’t use any preconditioner, for example Robert Bridson mentioned modified incomplete Cholesky preconditioner in his book, my implementation may be improved a lot just by changing CG to PCG.
Thus, if I have more time to work on my simulator, I’d like to implement a level set method in order to get more precise interface between air and water, and also want to introduce preconditioners to improve the performance.
After unzip that file, please run
You can run demos like below.
# Fluid simulation demo $ cd prj $ python -m fluidsim # Mass-spring simulation demo $ cd prj $ python -m particlesim
* Woojong Koh, 2013