So after spending the last two weeks parallelizing my program, I rediscovered the ingenuity that are mesoscopic simulation techniques. Instead of simulating the actual system at hand, you construct a simplified system, which reproduces only a minimal set of properties of the original system.

In the case of fluids, the most important properties are the local conservation of mass, momentum and energy. In real fluids two additional effects occur, first the temperature leads to random forces on objects in the fluid, second the local momentum is distributed due to the interaction between molecules. The first effect is known as Brownian motion, the second effect leads to the viscosity of the fluid.

In multi-particle collision dynamics (MPCD) the fluid is replaced by effective fluid particles, which represent a collection of actual fluid molecules. These effective particles undergo two steps, the streaming and the collision step:

In the streaming step, the effective fluid particles behave as non-interacting particles. Mathematically they are described by Newtons equation of motion. However, if this would be the end of the story, then we would simulate an ideal gas, clearly not a fluid.

Here, the second step of the dynamics, the collision steps leads to an effective, coarse grained, interaction: The particles are sorted into cells and then all particles in each cell interact with each other. As long as the interaction obeys the local conservation laws in each cell, you are pretty much free to do whatever you like.

All in all, this results in a pretty fast and quite simple fluid dynamics simulation technique. You can easily put both static and mobile boundaries into the fluid. Similarly, flexible objects as cells or polymers can be embedded.

You can find a thorough review on this method here. If you want to get an impression how a typical MPCD simulation looks like, have a look at this JavaScript implementation, I threw together. Note, that I took some algorithmic shortcuts and also the parameter values are rather chosen for effect, not so much for a realistic fluid.

A couple of remarks:

- You can clearly see the alternating steps "streaming" and "collision".
- In the streaming step the particle move freely. Note, that they do not interact with the boundaries and can flow into the solids. This is fixed afterwards by moving the particles back to the boundary.
- Then, the system is divided into cells (blue here) and the particles exchange momentum

- The simulation parameters are tuned, for you to see something. Probably, one would use smaller time-steps, with more intermediate steps, etc.
- I took some shortcuts, when coding this:
- There is no angular momentum conservation
- I simplified the boundary condition to place the particle straight to the boundary. Usually there would be additional steps involved. Also only one collision is resolved per time-step. If the colloid comes close to the wall, this underestimates the forces exerted by the fluid on the colloid.