Examples » 2D Fluid Simulation new in 2020.06

2D fluid simulation using the APIC method.


A 2D fluid simulation using the APIC (Affine Particle-in-Cell) method. Compared to 3D Fluid Simulation, the simulation is running in a single thread.


  • mouse drag interacts with the simulation
  • E emits more particles
  • H shows / hides the overlay
  • R resets the simulation
  • Space pauses the simulation


This example was originally contributed by Nghia Truong.


Full source code is linked below and also available in the magnum-examples GitHub repository. This example depends on the ImGuiIntegration library which is not a part of the core Magnum repository, see its documentation for usage instructions.

The ports branch contains additional patches for Emscripten support that aren't present in master in order to keep the example code as simple as possible.