Channel flow with pressure gradient or with body force

Dear all,

I need some information about using pressure gradient or body-force in poiseuille flow.

Can you please explain about how to use these conditions in the code? (specially pressure gradient in the channel)

I really appreciate it

Hello Casy,

I can tell you how to use the body force driven flow.
At first you need a modified collision step. In my code it is implemented as

void collision()
for(k = k1; k < k2; k++) {
  if(obstacle[k] == 0) {
    for(ii = 0; ii < NRVELO; ii++) ff[ii][k] = ff[ii][k] + (fe[ii] - ff[ii][k]) / tau + nn[k] * GG[ii]; } }

Important is the very last expression

nn[k] * GG[ii]

nn[k] is the density at lattice node k and GG[ii] is the force in lattice direction ii. My approach does only take into account a homogeneous and time-independent force. The quantities GG[ii] are for example calculated like this:

void setBodyForce()
for(ii = 0; ii < NRVELO; ii++) GG[ii] = ww[ii] * (vl[ii][0] * G[0] + vl[ii][1] * G[1] + vl[ii][2] * G[2]) / c2;

where (G[0], G[1], G[2]) is the physical force in three dimensions. ww[ii] are the weight factors of the lattice and the vl[ii][0] are the lattice speeds. Here you have to be careful. This force definition is not the most general one and not the most accurate one. Have a look at this paper for the discussion: “Discrete lattice effects on the forcing term in the lattice Boltzmann method” by Zhaoli Guo, Chuguang Zheng and Baochang Shi (DOI: 10.1103/PhysRevE.65.046308). I recommend that you first consider this publication before implementing anything.

Since I have not tested pressure boundary conditions, I cannot help you with that issue.


The pressure boundary condition (BC) is not very different from the velocity BC. On a wall cell in lattice Boltzmann you need to know three quantities (in 2D) namely the density, and 2 components of the velocity in order to be able to perform the collision step. In fact on a flat boundary you only need two of them. When one uses a velocity BC both components of the velocity are imposed, and the density can be deduced from the known distributions and the velocity. For pressure BC you will have to impose a density (density is proportional to pressure p=c_s^2*rho) and a component of the velocity, then the second one will be computed from the known distributions and the density and the known component of the density. You should read the following paper from Zou and He which explains in more details how to recover the missing quantity on a wall (or a boundary).

Once you have the macroscopic informations you have to use a BC to recover the missing distribution functions. There is a paper which reviews some of them here.

Good luck.


Hello and thanks for your guids

I have another question regarding this,

As I mentioned, when we use the Body-Force in periodic boundary conditions, we mean that there is a constant presure gradient (delta p) along the channel, Is it true?

Then what is the relationship between the value of F and Delta P ?
moreover, how can we evaluate the reynolds number from Body-force?

Thanks a lot

when you use a body force you don’t have a pressure gradient. Therefore you cannot relate the force to delta P. To evaluate the Reynolds number from your body force, you should relate it to the reference velocity of your flow (say the maximum velocity). Then it is straightforward to relate it to the reynolds number. (Of course I don’t know the formula by heart, but it shouldn’t be too difficult for you to do the computation.)

Hello Orestis

Thanks for your reply

Can you please explain a bit more about using body force in channel flow?

I confused, so when we use body force in periodic boundary conditions? and when we have pressure gradient in boundary conditions?

Thanks a lot

Hi casy,

pressure gradient and body force density are physically exactly equivalent, this means you just have to replace Delta p / L by f, where L is the length of the channel and f is the force per unit volume (1 in LB units).


It is your choice which kind of boundary conditions you want to take.
The advantage of periodic boundary conditions with body force is that there is no density gradient in your simulation. Sometimes it is however not practical to use a body force, for example if you don’t know the body force everywhere in your geometry. Setting the pressure or the velocity on the inlet / outlet gives you much more control of the simulation.

Hi Timm

Thanks for your help

So can you please tell me how should I add the body-force to PDFs along the channel?
when the pressure decreases along the channel, so do you mean that I should subtract the value of F from PDFs along the channel?

Also, I have a code about Poiseuille flow with periodic boundary conditions and body force. When I run the Code with a constant Body-Force, the maximum velocity of the channel first increases with time steps and then remain constant with increasing the time step, Can you please explain me about this behavior?
Moreover, how can we demonstrate the value of Maximum velocity from Body-Force?

"Setting the pressure or the velocity on the inlet / outlet gives you much more control of the simulation. " how can we do this in periodic boundary conditions?

Thanks a lot

Dear casy,

at the top of this thread I have posted how one can include a body force in LB. You should also read the paper I have suggested to you in my post.

What you do: you initialize the density, e. g. equal 1, and the velocity, e. g. equal 0. Then the body force slowly increases the flow velocity until you have reached steady state at some point in time. This is the reason why you observe an increase in velocity first and a constant velocity later on.

You cannot use periodic BC AND pressure or velocity inlet / outlet BC at the same time, because the pressure and velocity BC overwrites the incoming populations at the inlet and the outlet. Actually, I use a periodic code with velocity BC, but the periodicity is suppressed by the velocity BC.

Is this clearer now? I hope it helps you a bit.