# How to implement periodic boundary condition in Palabos

Hello, everyone. I want to use Palabos to simulate microscopic porous flow. The simplified model is as following:
|---------------------periodic boundary--------------------------|
|
|
velocity inlet
|
|
|---------------------periodic boundary--------------------------|

and the outlet condition is outflow. To make it easy, I modified the showcase CYLINDER2D. The modified partion is:

``````
MultiBlockLattice2D<T, DESCRIPTOR> lattice (
parameters.getNx(), parameters.getNy(),
new BGKdynamics<T,DESCRIPTOR>(parameters.getOmega()) );

lattice.periodicity().toggle(1, true); // the line I add to make the y-direction BC periodic

OnLatticeBoundaryCondition2D<T,DESCRIPTOR>*
boundaryCondition = createInterpBoundaryCondition2D<T,DESCRIPTOR>();

cylinderSetup(lattice, parameters, *boundaryCondition);

``````

and in the statement of cylinderSetup, I delete the lines:

``````
boundaryCondition.setVelocityConditionOnBlockBoundaries (
lattice, Box2D(0, nx-1, 0, 0));
boundaryCondition.setVelocityConditionOnBlockBoundaries (
lattice, Box2D(0, nx-1, ny-1, ny-1));

``````

Well, I don't know where the problem is, but I get the result just like the periodic BC doesn't work. So I come again for your help. Thanks in advance for your suggestions. Luke

Hello,

setVelocityConditionOnBlockBoundaries automatically puts corners on the “corners” of your domain. You should rather use addVelocityBoundary0N(Box2D(0, 0, 0, ny-1),lattice) and addVelocityBoundary0P(Box2D(nx-1, nx-1, 0, ny-1),lattice).

Orestis

Hello Orestis,

Thanks very much for your advice. Though I still don’t know how the corner matters, but what you said is rather useful.
Thanks again!

Luke

Hi Orestis,