The external force term in LBE can act both as a source or a sink for particles. I am trying to simulate a closed system with a spatially non-uniform external force term and at each collision step I loose a very tiny fraction of particles which slowly adds up and ruins my simulation. Any ideas on how to stem such a leak by forcing conservation of mass during collisions in the LBE would be really appreciated. I don't know if using entropic LBM would help. Thanks.

Hmmm, then I’m afraid I don’t know - I think this formulation should be mass conserving (at least for straight walls) if implemented correctly. Other that checking the code and its structure and making sure all parameters are in the safe bounds then I don’t know what to suggest. I can’t see how entropic would be any help. The most common sources of error occur in the implementation of boundaries (especially corners) and using inappropriate values of the parameters.

I’m sorry I can’t be of more use but I hope someone else can be more helpful and/or you figure out the problem.
Good luck!

Thanks Tim. The book by Wolf-Gladrow titled “Lattice gas cellular automata and lattice Boltzmann models” discusses this issue in section 5.7.3 and suggests that using a spatial average of the force term with the nearest neighbor in the direction of streaming should help conserve mass. Also, I found a similar implementation in

Title: Generalized lattice Boltzmann equation with forcing term for computation of wall-bounded turbulent flows
Author(s): Premnath Kannan N.; Pattison Martin J.; Banerjee Sanjoy
Source: PHYSICAL REVIEW E Volume: 79 Issue: 2 Article Number: 026703 DOI: 10.1103/PhysRevE.79.026703 Part: Part 2 Published: FEB 2009

Hopefully, this should work. I still need to try it out though…will keep you posted.

Ah, ok, I misread your message - you have a nonuniform force. I should learn to read! Not that this is likely to make a difference in terms of help - I have no experience with this. But I have a quick thought, which may be silly:

The velocity with this forcing is sometimes given as u’=u-0.5*force. If u is the fluid velocity (which goes into the equilibrium) then we need to find u from u’. This is easy, but if “force” is a function of the velocity then we may have to be a bit more careful (especially if it is a non-linear function). But all this depends on how you’ve formulated your problem.

Sorry I can’t be more help!

ps
you may want to have a look at some of the work by Rick Salmon too.

Yes, if the forcing term is velocity dependent as in Coriolis force or the magnetic Lorentz force then one would need to take care of that too. Wolf-Gladrow suggests using a predictor corrector method.

without reading the entire thread: An external force in lattice Boltzmann cannot change the mass of the fluid when properly implemented. There must be a bug in the code. The presence of bounce-back walls (as long as they do not move in a complex way) will not change the mass conservation.