This page lists some of my projects in computer graphics and media technology from the years of me studying at Linköping University. These are both course projects and free time projects.

An individual free time project of implementing a fluid simulator from scratch in C++.

I have gone from using semi-Lagrangian advection on the whole grid domain to later separate liquid from air by using marker particles. I then implemented PIC (Particle in Cell) / FLIP (Fluid Implicit Particle) advection as a better solution to simulate liquids. It is now possible to get highly viscous fluids using the PIC method and more liquid like behaviour then I was able to get using semi-Lagrangian advection and marker particles.

Current state of the project features:

  • Staggered MAC Grid
  • Different advection schemes
    • Semi Lagrangian advection with
      • Bilinear interpolation
      • Runge Kutta and Euler solver
    • PIC advection with bilinear interpolation
    • FLIP advection with bilinear interpolation
    • PIC / FLIP combination
  • Pressure solve using the conjugate gradient method with the linear algebra library "Eigen"
  • Enforce Dirichlet boundary condition
  • Marker particles for air/fluid separation
  • Velocity extension using brute force search through grid

Example simulations

PIC / FLIP simulations rendered with grid, velocity field and particles:

PIC Simulation

100% PIC simulation

FLIP Simulation

100% FLIP simulation

2% PIC 98% FLIP simulation

2% PIC and 98% FLIP simulation

A simulation on a bigger grid:

PIC/FLIP Simulation

A real time simulation with interaction and OpenGL rendering:

Future work

  • Adaptive time steps
  • Vorticity confinement
  • Make sure marker particles are outside of obstacles
  • Other interpolation alternatives (quadratic, cubic, Catmull Rom)
  • A better method for velocity extension
  • 3D simulation
  • Sophisticated rendering
  • Check if performance is enhanced if the conjugate gradient solve is parallelized using OpenMP or CUDA

I have a git repository hosted on github for this project.