This afternoon a student asked me what might be a good way to simulate fluid viscosity. I didn’t know the answer, so I made one up.
Basically, I suggested that when any two particles in a viscous fluid are near each other, they should form a temporary bond, so it would be harder for them to slide past each other. As viscosity gets higher, this will make the fluid act more and more like a solid.
I was curious to see whether this would actually work, so I sat down and implemented it. I am happy to report that it works just fine.
You can play with my little viscous fluid simulator here.