Corner implementation in D2Q9

Dear all,

I am facing some difficulties implementing a simple Couette flow!
In my case, however, instead of using periodic BCs at inlet/outlet, as usual, I intend to use velocity BC there. As a result, the domain has 4 velocity BCs at the 4 boundaries.
For that I am using Zou He BC.
Since the LB solution must be equal to the analytical one. This problem allows me to benchmark my velocity BCs implementation.
The problem is that I do not obtain the aimed exact solutions and as far as I understand the problem comes from the corners.
When the wall velocity is zero the corner implementation is that given in Zou He paper. However in the case the wall is moving the non-equilibrium bounce-back condition is not equivalent to the straight bounce-back formula.
Yet I thought the required modifications would be straightforward. For instance for the top-left corner:

x=1; y=LY;

However, my reasoning appears to be wrong.
Does anyone have ever tried to do the same thing?
If so, could you please provide me some help/suggestion here. I would be much appreciated.

Thank you advance.


Hi Goncalo,

First of all congratulations with the article (I saw it in the internet :slight_smile: ) . Velocity boundary conditions for wall I guess even from mathematical point of view are singular. Can you try just to etrapolate populations from the node in the diagonal direction (I do for my binary liquid calculations) or just put the equilibrium function with the velocity taken from the diagonal node?

Hopefully it will help,

Hello Alex

Thanks a lot.

Yes you are right, I could extrapolate. Yet I wanted to keep everything local. I solved my problem by also changing the value of the rest distribution function, f(9).
For instance:

 % Bottom left (inlet)
    x=1; y=1;


Now everything works fine :wink:

Thank you anyway Alex.



I am interesting in your method to solve the nodes. would you please write that more clearly. for instant what is the meaning ‘g(1,x,y)+g(2,x,y)’
Best wishes!


Thank you for your interest in my post.
What do you mean by “more clearly”?
Basically the reasoning in the corner is the same of the boundary using the Zou-He method, i.e. you have to bounceback the non-equilibrium distribution of populations streaming out of the boundary with a normal component to surface. In a 2D boundary you have 3 of those populations. In a 2D corner you will have 1 more, that is 4! Plus you have one link, i.e. 2 populations that never stream in or out of the domain - this is called buried link. So altogether we have 6 unknown populations to specify. Since you don’t have enough equations to close the problem for all unknowns, for a velocity BC I extrapolate the pressure. Please find in this link a more or less thorough explanation on the rational I use.

Regarding g(1,x,y) and g(2,x,y), g stands for an external body force and 1 or 2 are its vector components. Although people rarely take this into account when you use Zou-He method in a problem with an external body force, the Zou-He method must be modified to account for the force. The reason is that Zou-He is based on the bouceback of non-equilibrium contributions in the populations, but in the LBM dynamics the force also appears at non-equilibrium level, so it must be account explicitly. Note, if your body force is constant in space this is not so important as the forcing non-equilibrium contribution always vanishes.

Good luck



Hi Goncalo,

Do you have a paper or a document with the explanation of the implementation of zou-he boundary conditions at wall with a non constant body force, like in partial heated cavity for example.
I suggest the partial heated cavity because it is my test case and I first simulate this case with thebody force on all nodes (wall incuded) and I have issues in mass conservation. Now I simulate with the body force only on fluid nodes. I have better results but your treatment seems to be smart and I would like to understand it properly.


Best regards


Dear Ben,

First of all thank you for your interest in my post :slight_smile:

Concerning your problem I not 100% positive whether my way to incorporate the body force in Zou-He method will fix your lack of mass conservation on boundaries. I say this because, by construction, Zou-He is not a machine accurate mass conserving BC scheme as the bounceback is, for instance.

Having said that, of course, I can send you some more detailed info on the way I take to implement the corners within the Zou-He framework including a body force. Please send me your email as private message.

By the way, just one more disclaimer! In corners you have more unknowns that on boundary planes. Therefore, in order to close your problem, i.e. specific values for unknown quantities in terms of known ones, you have to sacrifice something on the corners.
It turns out that in corners the option that I take is to sacrifice the mass density. While in planes the mass density can be computed in terms of known populations, in corners that is not possible. Therefore, I simply extrapolate the mass density on the corner from a bulk node nearby. Nevertheless, send me your email and after testing for yourself we can discuss more on this later on :slight_smile:



I think I use exactly your implementation (I start form your courses at the edmondton workshop). The mass density is sacrified on corners so I agree that mass conservation is not zero machine. By the way, I have zero machine which half-way bounce back BC, but thermal BC are more complicated in this case (I use counter slip approach).
To be more precise my mass conservation is good when I apply the body force only on fluid nodes but I have no theoritical justification of this implementation, (I just tried and choose the one who gives me the best results …)