# 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_temp[i+n_x*j+n_x*n_y*5] = f[x1+n_x*(j-1)+n_xn_y7] ;
x1 = mod(i,n_x);
f_temp[i+n_x*j+n_x*n_y*2] = f[x1+n_x*(j-1)+n_xn_y4] ;
x1 = mod(i+1,n_x);
f_temp[i+n_x*j+n_x*n_y*6] = f[x1+n_x*(j-1)+n_xn_y8] ;
}
if(j==n_y-2)
{
x1 = mod(i-1,n_x);
f_temp[i+n_x*j+n_x*n_y*8] = f[x1+n_x*(j+1)+n_xn_y6] ;
x1 = mod(i,n_x);
f_temp[i+n_x*j+n_x*n_y*4] = f[x1+n_x*(j+1)+n_xn_y2] ;
x1 = mod(i+1,n_x);
f_temp[i+n_x*j+n_x*n_y*7] = f[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(I am not sure about how to include a force term ). Any suggestion or clarification will be greatly appreciated.``````

Hi

The bounce back boundary condition for 2D corners 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