Fluid Simulation using Laplacian Eigen Functions

Made by: Shweta Gulati & Joseph Cunningham


One of the most intriguing problems in computer graphics is the simulation of fluid-like behavior. Hence, as our final project we implemented visually compelling fluid phenomena using method described in the paper (http://www.dgp.toronto.edu/~tyler/fluids/FluidDynamicsLaplacianEigenfunctions.pdf).Like in their case, we employed a representation of the fluid's velocity field using a finite dimensional basis of Laplacian eigenfunctions. The main challenge in fluid motion that we overcame is to convincingly update fluid's velocity field.

Past Approaches

Past methods have used either Langrarian elements or Eulerian Grid for solving Navier Stokes equations, the principle equations governing fluid flow.

  1. Eulerian Grids

    Here the Idea is to divide the domain into a discrete grid that can be sampled to approximate our continuous velocity field, and update the grid at the next time step. The problem with this approach is that special care must be paid to the size of both grid and time steps, along with a few systems of equations to solve.

  2. Langrarian Particle Methods

    Instead of storing the info in static grids when the fluid moves through, particle methods represent fluid by storing info in a representative particle which moves through the fluid. The problem with this is that it is very hard to keep system from losing energy and it is also computationally very expensive.

  3. Model Reduction

    In this method, a large number of expensive but accurate physical simulations are run to extract the fundamental modes which can then be used as a basis at runtime for reconstructing the field. The problem in this approach is that it needs to have a large set of data computed before runtime to extract the basis. In the paper, they have proposed an algorithm for the interactive simulation of fluid motion that avoids many of the shortcomings of existing techniques.

Current Approach

The idea presented in this paper is similar to the model reduction in that we would like to look for these fundamental modes to create a finite basis which well approximates the actual function. Functional analysis tells us that the Laplace operator on a given domain can be nicely discretized, and we can get a closed form solution for the associated eigenfunctions. This is the basis we sought in reconstructing our field. The non-linear advection terms between pairs of basis functions is precomputed and the result is stored as structure coefficients in a set of matrices. Viscosity and external forces are incorporated using linear terms, and the basis function coefficients are hence updated using a simple matrix-vector equation.

Code Implementation

We used OpenGL to give a visualization of the density field of fluid. We updated velocity field at every stage using shader programs rather than C++. Hence, in our solver we updated both the flow and the motion of densities within the flow. We worked on fluid simulation using different basis dimensions (16, 32, 64) on a 2D square domain.

We write a function in a basis of eigen functions of the Laplacian operator. We think of function as a vector which in addition to being represented in standard basis can also be represented in the basis of eigen functions.
We used OpenGL , shaders (GLSL) for rendering particles. We updated the particles using the OpenGL transform feedback buffer which helps us to avoid CPU-GPU transfers and compute the physics of the position of the particle. Position is updated and then using shader program we render the particle.
P(tn) = P(tn-1)+ V.dt (tn-tn-1)

We render the velocity field as a grid of points and sample the velocity at those points. Points are translated to lines using geometry shaders.
We represent density as an image / texture and use the velocity field to advect the density by the equation. If f(x, tn) denotes the Density at position x and time tn .

f(x,tn) = f(x - v(tn-tn-1), tn-1)


We have implemented a fluid simulation method that uses eigenfunctions of the vector Laplacian as bases. The orthogonality of the basis functions and their correspondence to a spectrum of vorticity scales enables energy control at varying turbulent scales.[1]

Adding more basis dimensions allows for more flexibility and resolution of accurate velocity. Eliminating certain frequencies or a combination of certain frequencies can enforce certain symmetrical patterns. Choosing to write the velocity function in different basis allows freedom to use closed form expressions for certain domains.

The ability to integrate directly in a space of basis coefficients permits computational efficiency, enabling interactive performance. The existence of closed form solutions for simple domains allows symbolic evaluation of the advection operator and the ability to sparsely evaluate velocities on demand.

Future Work

From this project, we learned the concepts behind simulation of a fluid through the examination and comparison of various methods. We used freeglut for windows implementation, glm as vector library (http://glm.gtruc.net/api/modules.html) and glew as extensions. In future, this work could be extended to different domains (like 3D). There have been a number of domains which which when combined with boundary conditions are suitable for fluids and admit a closed form for the basis functions. Like mentioned in their paper, many exciting avenues of their algorithm can be explored. One of them being - Investigating its use for the the expressive control of fluid motion, such as spectral energy control and space time optimization.[1]


1. Fluid Simulation using Laplacian Eigenfunctions, TYLER DE WITT, CHRISTIAN LESSIG and EUGENE FIUME, University of Toronto