View Full Version : Fluid Simulation using LatticeBoltzmann

06 June 2006, 08:20 AM
I try to simulate a fluid movement using LatticeBoltzmann method. The method works great for me in case there weren't any force acting on it. When adding a force like a gravity to the simulation. I see all the particle distribution functions tend to zero and may tend to negative values too and as a result I see all the fluid parts disappears (after a little time I see no fluid, I mean no particle lift!!).

I use the method suggested by [Buick and Greated, 2000], which alter the overall lattice site velocity with the active force (gravity for example) in this lattice site. And then computer the distribution function and these equations for sure must preserve the Mass, Momentum and the Energy of the system. It can't just disappear!!
Mustafa ELBanna

06 June 2006, 01:01 AM
Welcome to the community Mustafa,
It's good to see people doing compex stuff here.
At this point I am not completely sure of your situation, I can say after spending a month or two looking at simulating fire that fields only affect velocity which leads to turbulance which equates to disspurtion and diffusion.
I have been building MEL scripts (in Maya) to control fluid density, tepurature and fuel. Normally fluids is more like gases, and something completely different is needed for good fluids.

For now I hope this leads you down the right path, but I think it will just help you understand what more I need to understand your problem. Maybe simplify your question or provide more details possible sample images or animations to help us understand what your doing. Program, software etc.???

There are people here that are useful, I hope to be able to assist with this in some way.

06 June 2006, 08:47 AM
Hello,First, thanks for your reply, I really checked the source code too much for bugs but I really can't find. I have 3 weeks (16 hour per day) until now working to find what's wrong with the simulation, and I really can't find, I'm really so exauhsted. So, in brief I'll describe to you what's is going on:

The code written until now is works perfect if I removed the Collision step, which means I just propagate the PDFs and DETECT the collisions with WALLS or any of these things, and then immediately draw what is going on (I mean without tending to the equiblibruim function). I test this part too much it works perfectly, So I don't think there is a bug here.
For the collide part, I tested it HUNDRED of times and I think if there is a bug so the bug on my understanding not the implementation, So I'll tell you what I do briefly (I'll use names from pseudo code done in page 9 chapter 2 in document titled "A single-phase free-surface Lattice Boltzmann Method ("):
1- On every lattice site I sum the PDFs and assign it to a density variable.
2- On every lattice site I get Ux, Uy, Uz:

For all i from 0 to 18uX += f[i]*eX[i]uY += f[i]*eY[i]

uZ += f[i]*eZ[i]

* Then I divide these values by the density:uX/=densityuY/=density


* There are really a lot of models to add the force like gravity to the simulation:I used the one you also suggested in your document by adding the force to the uX, uY, uZ , which I put a constant like (0,-0.1,0):uY+=-0.1

Then I computer the U vecto like this: u = uX*uX+uY*uY+uZ*uZ Then for all the 19 direction I do this:

Compute a variable I call uV like : uV = uX*eX[l]+uY*eY[l]+uZ*eZ[l]
The compute feq = w[l]*(density-(3/2.0)*u+3*uV+(9/2.0)*uV*uV), Please notice this feq is different than what in document, document state that feq = w[l]*density*(1-(3/2.0)*u+3*uV+(9/2.0)*uV*uV)!

Then I computer the new PDF like this:

For displaying I just draw particles at every lattice site (When the lattice site density is more than 0 ) using OpenGL.
Is there any thing wrong!Thanks,

Mustafa ELBanna

06 June 2006, 11:10 AM
I think you propbaly have a better chance of getting an answer here ( CGTalk is pretty lo-fi, most people asking R&D involved questions here n00bs as trhere's plenty of other boards, lists and groups out there were people with more solid knowledge hang around since years.

And another thing is that some of the most knowledge people I know don't like forums but rather prefer mailing lists or newsgroups or even IRC to exchange information like that.


08 August 2006, 01:44 PM
Just as sub-topic, does anyone have any experience of LBM work here and whats the advantage of using it over the conventional Navier-Stokes solver/s? Also, can it provide just as good a simulation as other methods?

08 August 2006, 04:50 AM
I did a bit of reading on Lattice-Boltzman methods, and to my recollection their primary advantage is that they are simpler to implement than Navier-Stokes solvers, and faster to compute. Their primary disadvantage is that they are very memory intensive. For a NS solver, you typically have to keep track of a velocity and a density at each grid point (so four floats, say), but for a LBM solver, you have to track densities moving in several discrete directions, as many as 19 (I think -- it's been a while) per advected quantity.

Kevin Atkinson

08 August 2006, 10:47 AM
Cheers for the info, Kevin! The Lattice-Boltzmann technique does look like an attractive alternative to the NS solvers, just not too sure if it can produce the same results or not. Most of the shots I see using the LBM stuff look blobby, although I guess thats more due to the rendering rather than the simulation.

Do you happen to know of any (commercial or opensource) products that use it at all?

08 August 2006, 06:22 PM
Blenders fluid dynamics uses the LBM solver,


09 September 2006, 08:01 AM
Cool, just had a look at Blender's fluid sim and its rather nice. Still doesn't look like its getting as good results as a standard NS solver with level sets, but not sure why that is! Still a bit unsure of how good the LBM solvers are? Any ideas?

09 September 2006, 02:32 PM
If you are looking into Blender Fluids and what they can do, you owe it to yourself to check out this guy's site ( It's simply amazing.

10 October 2006, 09:31 AM
Hey 'MustafaEffect', did you get any joy on that LBM solver? Any results/pics/etc that you can share at all?

10 October 2006, 04:54 PM
Any one else tried their hand at using LBM for free surface fluids? Anyone ... ?

CGTalk Moderation
10 October 2006, 04:54 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.