Project 5: Fun with Fluid

 

Due: April 6, 2015, 10AM

        

Project description

Let’s build a fluid simulator! Your job is to create 2D smoke fluid simulation using a grid-based, Eularian approach. Your velocity field and density field must obey Navior-Stoke equations, incompressibility, and boundary conditions. The simulator must be interactive and run in real-time; the user can use a mouse to manipulate velocity and density fields and visualize the smoke evolving in the 2D grid in real-time. The skeleton code provides a pretty good starting point for you. It includes basic UI and mouse interaction code, as well as the data structures and major procedures required to simulate 2D fluids. In particular, the code for evolution of density field includes all three steps: adding density, diffusion, and advection. However, the code for evolution of velocity field is incomplete, as you can see that the smoke stays stationary in the current skeleton code. You will have to develop code for velocity advection and projection to move the smoke around accurately.


Requirements

  1. Develop a procedure to advect the velocity field using semi-Lagrange method.

  2. Develop a procedure to project the velocity field such that incompressibility and boundary conditions are satisfied.


Skeleton code

You will use the skeleton code provided in DART to complete this project.

Step 1:

Update DART CS4496 branch by running:

git pull

Step 2:

Run the skeleton code:

bin/fluid is the executable.

apps/fluid contains source code of the skeleton code.


UI control provided by the skeleton code:

Left click and drag: add density

Right click and drag: add velocity

‘v’: Visualizing velocity/density

space bar: simulation on/off


Tutorial

The skeleton code is similar to the framework proposed by Jos Stam in “Real-Time Fluid Dynamics for Games”. You should read this tutorial document before you start coding.

http://www.intpowertechcorp.com/GDC03.pdf


Extra points

  1. 1.Create a colorful smoke simulator by using three density fields, each of which stores the density of a color channel (e.g. Red, Green, Blue).

  2. 2.Implement code to load in an initial density field described as an image (grayscale of RGB). e.g. You can load in a picture of Mona Lisa and blow it away.

  3. 3.Add arbitrary boundary in the grid. e.g. Create a “C” shape in the middle of the grid to see how it affects the smoke.

  4. 4.Add external forces to the velocity field. e.g. Mimic the effect of a fan in the middle of the grid.

  5. 5.Extend it to 3D!