   Moving Conservation of mass from centered to Staggered grid in realtime CFD?
  I am working on a 3D implementation of Jos stam''s "Realtime fluid dynamics for games", and I now have 2 prototypes with working flows.My problem is that the centered representation limits my inner boundries, to be of thickness 2 at least. The definition of a boundry is that the velocity along the normal is zero. The only way to achieve this is to take the velocity inside the boundry and set it opposite the velocity outside. Thereby getting a speed of zero on the face of the normal.The problem is that this ruins the velocity behind the first boundry voxel, and the same trick has to be applied there if another bundry should be handled. Leaving me with unelegant boundries. That Is a problem, because I want to represent a local enviroment and the way flow runs through it. And at this point my enviroment consist of 16^3 voxels, so when a wall is at least 2 (2/16 of the sidelength!!!) voxels thick it is hard to approximate walls & obstacles etc.Furthermore the real edge of a boundry does not follow the boundrys edges. There is an error there also ruining the visual appearance of the model.Therefore I want to create a staggered grid model, where the velocities are defined on the faces of the voxels, and thereby alowing me to create boundries with only 1 voxel thickness.I have built my previous prototypes on the paper by Jos, and I have no background in nummerical analysis. In his paper he describes the steps needed to iterate the behavior of the fluid. Here are my understanding of the steps. Correct me if I am wrong. 1) External forces are added.Each velocity is given some contribution representing the external forces.This step can easily be adopted to the staggered grid. I havent seen any problems there. 2) Diffusion is handled by running a gauss-seidel relaxation method on the velocity field. I am not into the inner workings of Gauss seidel, but I have managed to make it work in my prototypes. I guess the method just tries to smoothen abrupt differences between neighbouring voxels? This step I also see no problem in doing on the staggered grid. 3) Advection I am not entirely sure, but I guess the same strategy Stam uses, by finding the velocity in each point and interpolating it back in time. I think it would work.4)Conservation of massProblem!! The projection step described in his paper seems the hardest step to me, but I think I have found a interpretation of the procedure. First the inflow of each voxel is found("overpressure"), and then it is "relaxed" between neighbours, before each voxel is adjusted down according to the "overpressure" in its neighbours. This I think could be a problem in a staggered grid, because im not sure how to distribute the overpressure? Any suggestions? Eg. each facevelocity could be updated according to the difference of the voxel it divides (times some factor)? My 1 prototype was a clean C++ model very similar to Jos, but my second prototype i have implemented on the GPU using Cg fragment programs. This has given me some trouble, because I have had to find an 2D representation of a 3D world that is fast on the GPU.When working on the GPU the major advantage is that more than one operation can be done. Will a staggered grid loose the advantage the centered grid can make of this?Another issue I have problems with is the boundry conditions, but i actually think they will be easier handeled in a staggered representation. I only have to set the speed on the normals to zero.Any comments are welcome. 