Another WebGL fluid simulation, though a very rough one. The algorithm used here is FLIP(FLuid Implicit Particle), introduced by Animating sand as a fluid. The author of that paper also supply a simple code. There are few controllers in this demo, but *?droplet* or *?text* can be added to the URL to change the initial condition. A blog (in Chinese) introduced a fluid simulation which is implemented in many languages: Java, ActionScript, JavaScript. And there are also mobile versions: iOS, Android. The Original Java version is not open source, but it says Material Point Method is implemented. The ActionScript version is the first open source version, and its detailed algorithm is learned by followers. This algorithm used both particles and grid points, like FLIP, but the pressure calculation is different. In this algorithm, roughly speaking, the pressure of fluid is determined by the number of particles in a grid cell. In FLIP method, to make the fluid incompressible, the velocity field is interpolated from particles to grid points, then the pressure field is solved to make velocity field divergence-free. This leads to a Poisson equation. Modified incomplete Cholesky factorization preconditioned conjugate gradient is used to solve the equation in Animating sand as a fluid, but ~~the name of this method is too long~~ this method can hardly be implemented in WebGL. Multigrid method is picked for this task. Multigrid method is introduced with WebGL demos in this blog. Demidov wrote something about Multigrid recently. Real-Time Gradient-Domain Painting is an interesting application and its source code is given. My implementation is much simpler than A multigrid fluid pressure solver handling separating solid boundary conditions, but its constraint of the pressure is adopted. The other parts of FLIP method are much simplified. The final result is not good enough, I think, though I have tried my best. There is a thread about this demo in bugzilla. If this does not run correctly on your computer, you can report it there.

## WebGL Demo: free surface flow

Advertisements

This entry was posted in Computational fluid mechanics and tagged fluid, Multigrid, WebGL. Bookmark the permalink.