Free surface simulation


I’m trying to simulate free surface problem with lattice Boltzmann method based on the method proposed by Thurey (2005). I have a problem in flag re-initialization step. Does anybody know exactly how to implement this step and distribute excess mass between cells?

It would be highly appreciated if anybody could help me in this regard.