Fluid simulation

Fluid simulation

This post collects the different fluid simulation methods that I have studied and implemented out during my studies, some of them as part of larger projects.

Pic-Flip Fluids

In this project, the simulation of a basic 2D fluids is carried out following the laws of continuum mechanics, defined by the Navier-Stokes equations. Navier Stokes equations are non-linear and difficult to solve, so they are divided into different components and are solved separately.

For this, a Pic-Flip solver is used, a hybrid between a fluid simulation based on particles (Flip: Fluid-Implicit-Particle) and based on volume, with grids (Pic: Particle in cell).

Basically, the domain is distributed in cells and particles are introduced into them through sampling. Depending on which part of the equations is solved, different data are used. In this simulation, the emission of ink in the cells through which the fluids pass, the advection of the different properties of the fluid, viscosity, gravity and pressure calculation have been programmed to project the fluid to an incompressible state.


Smoothed-Particle Hydrodynamics

The Smoothed-particle hydrodynamics (SPH) method was initially proposed to simulate astrophysical behaviours. This solver uses smoothing kernels and approximations to the Navier-Stokes equations. Later, in 2003, Müller et al. relied on the SPH algorithm to propose a particle-based approach that would allow the animation of arbitrary fluid flow (Müller, 2003).

Basically, the SPH model consists of an interpolation method with particle systems. This means that it is based on a Lagrangian approach in the discretization of the space to be simulated. The in-depth study of this method was done as part of my Degree Final Project.


Position-Based Fluids

Position-Based Fluids (PBF) (Macklin, 2013) combines Smoothed Particle Hydrodynamic (SPH) with Position-Based Dynamics (PBD, you can read here the post relative to this method). Thus, this method obtains the results of SPH, but with the robustness and efficiency of PBD.

This solver postulates each constraint using SPH definitions. For example, it defines the density constraint. Moreover, it takes advantage from SPH and applies its vorticity and viscosity.


Technical details

• 3 complex simulation algorithms have been studied and implemented.
• Collisions have been implemented.
• Programmed in C++ and C# on the Unity3D engine.