This was a quick and simple project where I wanted to try and make a material point method (MPM) simulation to allow me to scale it up for the Waterflow3D project.
The idea behind MPM is that it combines the best parts of an Eulerian and Lagrangian methods.
Eulerian methods of fluid simulation use a background mesh/grid as the frame of reference, each grid has fluid moving in, and some moving out. Due to the mesh being well defined we can use it to help us calcuate gradients in the fluid properties like pressure and volume.
Lagrangian methods use the particles themselves as the frame of reference, each particle of water exists with some mass and volume and moves around through the system interacting with other particles.
The material point method is a hybrid Euler-Lagrange method, it uses particles to track the flow of mass and the state of the simulation and a grid to calculate the evolution of the system.
Roughly speaking the particles are used to solve dynamics and the grid to solve kinematics.
MPM needs fine timesteps, and much higher memory requirements - but allows multiphase and destructive simulations with ease.
Overview:
Transfer mass & velocities from particles to grid
Apply constraints on the grid
Velocities from grid to particle
Update particle model with velocity field & advect particles
Here's a demo of the output