The goal of this assignment is to experiment with a (partially-implemented) 3D Flow Simulator for fluid, smoke, viscous materials, etc. The bulk of the implementation has been provided including data structures, a discrete approximation of the Navier-Stokes Equations, and some rendering tools.
Some implementation details in the code are incomplete and other things may be (unintentionally) incorrect. In this assignment you will implement velocity interpolation for marker particles, play with free-slip and no-slip boundary conditions for incompressible flows, compressible flows, and create your own new scene or visualization.
fluid -grid 20 10 1 -size 600 -density 10 -timestep 0.05 -viscosity 0.1 fluid -grid 20 10 1 -size 600 -density 50 -timestep 0.1 -viscosity 0.05 fluid -grid 20 10 1 -size 600 -density 50 -timestep 0.2 -viscosity 0.01 fluid -grid 10 7 10 -size 600 -density 10 -timestep 0.1 -viscosity 0.05 fluid -input spiral_xy.txt -size 600 -gravity 0 -density 100 fluid -input spiral_xz.txt -size 600 -gravity 0 -density 100 fluid -input spiral_yz.txt -size 600 -gravity 0 -density 100
Once the viewer is launched you can rotate the scene with the mouse, press "a" to begin or pause the animation, press "m" to turn on/off the marker particle rendering, press "v" to turn on/off the average cell velocity rendering, press "e" to turn on/off the cell face velocity rendering, press "s" to turn on/off the marching cubes surface, press "c" to visualize the MAC (Full, Empty, Surface) voxels, or press "p" to visualize the pressure. You can also edit the viscosity and timestep from the command line. See argparser.h and glCanvas.C for all the options or to add your own.
Look at the code to MoveParticles function. The implementation is using a simple cell-centered average for the particle velocity. Your first task is to implement the correct interpolation in 3D as described in the papers referenced in class:
NOTE: In the implementation provided, each cell stores the face velocities (u, v, & w) for the face it shares with the cell in the positive direction along each axis. That is, cell_{i,j,k} stores u_{i+1/2,j,k}, v_{i,j+1/2,k}, and w_{i,j,k+1/2}. These values are stored in the variables u_plus, v_plus, and w_plus, and the corresponding accessors get_u_plus(), get_v_plus(), and get_w_plus().
If you're really motivated, increase the resolution of the grid before running marching cubes. You'll see in the implementation how each grid cell is divided into 8 cubes before polygonization. You can get a smoother surface if you subdivide further. And if you're extremely motivated, add gouraud shading to the marching cubes surface!
These files test your simulation in 2D perpendicular to each axis so you can check that you've got your indices sorted out correctly.
CODE COMPILED IN VISUAL STUDIO 6.0(.tar.gz)
Please read the assignment information again before submitting.