Used LSODA ODE solver (Adams for non-stiff, BDF for stiff)

Overview

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.

Fluid Simulation

Simulation Steps

Calculate an optimal time step

Self-advection (semi-Lagrangian)

Apply body forces including gravity

Projection

Update velocities by pressures

Trace marker particles’ new positions

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.