rho vs rhoBar

I’m rather confused about the use of rho and rhoBar in the AdvectionDiffusionDynamics code. In the advection-diffusion lattices, rhoBar is the sum of the populations and rho=rhoBar+1. From the literature, then, it seems like the BGK equilibrium term should be

f[sub]i[/sub][sup]eq[/sup] = t[sub]i[/sub] * rhoBar * (1 + ([b]u[/b]*[b]v[sub]i[/sub][/b])/c[sub]s[/sub][sup]2[/sup]).

But actually, in the code, it’s given as

f[sub]i[/sub][sup]eq[/sup] = t[sub]i[/sub] * (rhoBar + (rho * [b]u[/b]*[b]v[sub]i[/sub][/b])/c[sub]s[/sub][sup]2[/sup]).

So it seems that rhoBar distributed to one term, and rho the other. Or am I mistaken about something here? Is there any meaning in the distinction between rho and rhoBar other than its stated (in the user’s guide) use for increased numerical accuracy?

This distinction is a problem for me because it seems that, even when I initialise part of the system at rho=1, rhoBar=0 (so all populations are 0), over time, the advecting velocity seems to “create rho” in places where there should be no populations (nothing has diffused there). And that (at least to me) seems due to the fact that the full rho = 1 is used as a coefficient in the equilibrium term. It doesn’t make sense to me that the equilibrium distribution of a node initialised at all 0 populations should be at all non-zero, is that an incorrect intuition on my part? I would greatly appreciate an explanation, thank you.


I guess the reason is that in the algorithm needs to match a momentum. The collision operator conserves density, i.e. \sum_i {f_i}=\sum_i {f_i^{eq}} and the real density is calculated as rho=\sum_i{f_i}+1. However, the equilibrium function needs to satisfy a momentum condition, i.e. \sum_i{f_i^{eq} c_i}==\rho u_{\alpha}, where u_{alpha} is given and \rho needs to be substituted right. That means this is because u_{\alpha} is given.

Unfortunately I’m just guessing, because you need to look at the implementation.

Hopefully it will help,


The above definition of the advection-diffusion equilibrium can be understood by pure arithmetic means. The “populations” in Palabos are defined as f_i^bar = f_i-t_i, in order to gain accuracy, as explained here: http://www.palabos.org/wiki/howtos:reduce_roundoff . Similarly, the definition of the equilibrium required in Palabos is f_i^eq,bar = f_i^eq-t_i.

So, knowing that the usual equilibrium is

f[sub]i[/sub][sup]eq[/sup] = t[sub]i[/sub] * rho * (1 + ([b]u[/b]*[b]v[sub]i[/sub][/b])/c[sub]s[/sub][sup]2[/sup]).

and taking rhoBar=rho-1, you get:

f[sub]i[/sub][sup]eq,bar[/sup] = t[sub]i[/sub] * rho * (1 + ([b]u[/b]*[b]v[sub]i[/sub][/b])/c[sub]s[/sub][sup]2[/sup])-t_i
=  t[sub]i[/sub] * (rhoBar  + (rho *[b]u[/b]*[b]v[sub]i[/sub][/b])/c[sub]s[/sub][sup]2[/sup])

1 Like