# bounce back boundary condition for Poiseuille flow

Hello all,

I am writing my first programme of lattice boltzmann for the poiseuille flow for 2D rectangular channel. Flow is driven by a force in the X direction with periodic boundary condition (in the X direction). Boune back boundary condition is used at y=0,L. I have posted below essential part of the code.

c_x[] :array of velocity component in x direction
c_y[] :array of velocity component in y direction
f : population at time t
f_temp : population at time t+1

[code=“cpp”]
for(int index=0;index<10;index++)
{
//for the lattice points in the bulk
for(int i=0;i<n_x;i++)
{
for(int j=1; j<n_y-1;j++)
{
for (int k=0; k<beta ; k++)
{
double t ;
//collision step

``````			t = f[i+n_x*j+n_x*n_y*k] - (delta_t*1.0/tau)*(f[i+n_x*j+n_x*n_y*k] - f_eq[i+n_x*j+n_x*n_y*k]) + getNeighbour(k,1)*drivingForce/10 ;
//streaming step
int x1 = mod(i+getNeighbour(k,1),n_x);
int y1 = mod(j+getNeighbour(k,0),n_y);

f_temp[x1+n_x*y1+n_x*n_y*k] = t;
}
}
}
``````

//for the lattice points at the boundary
int x1;
if(index!=0)
for(int i=0;i<n_x;i++)
{
for(int j=0; j<n_y;j++)
{
if(j==1)
{
x1 = mod(i-1,n_x);
f[i+n_x*j+n_x*n_y*5] = f_temp[x1+n_x*(j-1)+n_xn_y7] ;
x1 = mod(i,n_x);
f[i+n_x*j+n_x*n_y*2] = f_temp[x1+n_x*(j-1)+n_xn_y4] ;
x1 = mod(i+1,n_x);
f[i+n_x*j+n_x*n_y*6] = f_temp[x1+n_x*(j-1)+n_xn_y8] ;
}
if(j==n_y-2)
{
x1 = mod(i-1,n_x);
f[i+n_x*j+n_x*n_y*8] = f_temp[x1+n_x*(j+1)+n_xn_y6] ;
x1 = mod(i,n_x);
f[i+n_x*j+n_x*n_y*4] = f_temp[x1+n_x*(j+1)+n_xn_y2] ;
x1 = mod(i+1,n_x);
f[i+n_x*j+n_x*n_y*7] = f_temp[x1+n_x*(j+1)+n_xn_y5] ;
}
}
}
//set f_temp to f
for(int i=0;i<n_x;i++)
for(int j=0; j<n_y;j++)
for (int k=0; k<beta ; k++)
f[i+n_x*j+n_x*n_y*k] = f_temp[i+n_x*j+n_x*n_y*k];
}

``````

I am not able to see where I am making a mistake. Any suggestion or clarification will be greatly appreciated.``````

Hi

The bounce back boundary condition for 2D Poiseuille flow ngular channel is not needed anymore.
I suggest you to read this paper:
On pressure and corner boundary conditions with two lattice Boltzmann construction approaches
Mathematics and Computers in Simulation
Volume 84, October 2012, Pages 26–41

which also available
here

Good luck
mecobio

It is completely misleading to say bounce back boundary conditions are not needed anymore. There are many alternatives to bounce back dating back more than 15 years. Sometimes the alternatives are favourable, other times they are not, but it most certainly can not and should not be said that one method in a one paper (which is very very similar to older methods and is similar in spirit to some very old methods over a decade old) is superior without considerable evidence. This would be marketing, not science. Channel flow is the most basic of tests .It is excellent for analysis because we can find exact solutions, and is a useful first simulation for assessing a method. Just about every method can pass this test but many perform poorly for flows with a 2D solution. Channel flow is not the judge nor jury.