Instructions: You can drag the fluid around with your mouse and adjust the sliders at the top to change the properties of the fluid in real-time. Please check out this video if you're having trouble figuring out what the sliders do. It requires Java to run.
This is my implementation of the Material Point Method.
For interpolation, I use the quadratic B-spline presented here: Analysis and Reduction of Quadrature Errors in the Material Point Method. Please note that there is an error in equation 17, for the cubic B-spline. The middle two equations should end with 2/3. I don't use the cubic spline though, because I'm interested in real-time simulation and I feel that the quadratic spline is the best balance of speed and quality.
Instead of integrating the density over time (which is what most of the MPM papers do), I do a density summation every frame. Because this is not dependent on previously calculated values of density, there is no accumulated error. To minimize grid artifacts, I use the cubic interpolation method presented here: A Semi-Lagrangian CIP Fluid Solver without Dimensional Splitting.
Some of these parameters are hard to explain in one or two sentences (and a couple I made up) so I'll also link you to their corresponding Wikipedia pages. One object I like to compare fluids with is springs. Everybody is familiar with springs. If you pull on them they'll try to go back to their original shape. Some springs are stronger and some are weaker (stiffness and elasticity). Some springs will continue to bounce back and forth for a long time, while others will quickly slow down and stop (bulk viscosity and viscosity). If you pull hard enough the spring will break.
Density - Target density for the particles. Higher density makes particles want to be closer together.
Stiffness - How compressible the fluid is.
Bulk viscosity - Kind of like damping. Another effect it will have is that it'll smooth out shockwaves.
Elasticity - How fast the fluid will try to return to its original shape.
Viscosity - Kind of like bulk viscosity only this operates on the shear components.
Yield rate - How fast the fluid forgets its shape or melts away. Only affects things when elasticity is non-zero.
Gravity - How much the particles will accelerate downwards.
Smoothing - Smooths the velocity field. Will make things more stable. It is also useful to have a high smoothing value when simulating elastic materials.
©2011 Grant Kot