# periodic boundary condition + freeslip BC produce zero velocity nodes

I´m using the following BC, and found the following problem (bug?):

in 3D, in x- and y-direction I use periodic BC, noslip for the bottom and freeslip on top. And an external force to drive the flow (in x-direction). The combination of these BC seems to produce zero velocity nodes on the top plane, at the edges where the periodic and the freeslip nodes are adjacent.
so its two lines, at x=0 and x=max along the y-axis (only at the top plane, where the freeslip-condition was defined).

If you change the force in y-direction, those nodes will also appear, but along the x-axis at y=0 and y=max position.
In case of periodicity in all 3 directions or noslip on bottom and top there appears to be no problem.

I know one has to be carfull with periodic boundaries and Neumann boundaries as mentioned in the documentation,
so here is the code:

``````
MultiBlockLattice3D<T, DESCRIPTOR> lattice (nx, ny, nz,
new GuoExternalForceBGKdynamics<T,DESCRIPTOR>(units.getOmega()) );

// apply boundary conditions
lattice.periodicity().toggle(0, true); // periodic along the x-axis
lattice.periodicity().toggle(1, true); // periodic along the y-axis

OnLatticeBoundaryCondition3D<T,DESCRIPTOR>* boundaryCondition = createLocalBoundaryCondition3D<T,DESCRIPTOR>();

Box3D topWall(1, nx-2, 0, ny-1, nz-1, nz-1);
Box3D bottomWall(0, nx-1, 0, ny-1, 0, 0);
boundaryCondition->setVelocityConditionOnBlockBoundaries (lattice, topWall, boundary::freeslip);

``````

I made the topWall-element (1,nx-2,…) so there is no overlap with the periodic nodes, but while it´s better than (0, nx-1) these zero-nodes still appear. (in the second case there seem to be 2 zero-velocity lines on both sides).

Also, since the nodes are only at the “inlet” and “outlet”, there is no difference in the results if the Box is (0,ny-1) or (1, ny-2) in y-direction.

I´m still lacking some skills to go through the code and find the problem on my own, so any help is highly appreciated, since this BC-setup is the one I need for my simulations.

Thanks,
Chris

Seems it´s no bug after all, just some missunderstanding on when to use these addVelocityBoundaryDP - methods instead of the setVelocityConditionOnBlockBoundaries.
I used them only on the outline of the above boxes, which made the effect even worse.

Now if only the addVelocityBoundaryDP (where D is 0,1,2 for x,y,z-direction) are used:

``````
MultiBlockLattice3D<T, DESCRIPTOR> lattice (nx, ny, nz,
new GuoExternalForceBGKdynamics<T,DESCRIPTOR>(units.getOmega()) );

// apply boundary conditions
lattice.periodicity().toggle(0, true); // periodic along the x-axis
lattice.periodicity().toggle(1, true); // periodic along the y-axis

OnLatticeBoundaryCondition3D<T,DESCRIPTOR>* boundaryCondition = createLocalBoundaryCondition3D<T,DESCRIPTOR>();

Box3D topWall(0, nx-1, 0, ny-1, nz-1, nz-1);
Box3D bottomWall(0, nx-1, 0, ny-1, 0, 0);
boundaryCondition->addVelocityBoundary2P (topWall, lattice, boundary::freeslip);
boundaryCondition->addVelocityBoundary2N (bottomWall, lattice, boundary::freeslip);

``````

all is fine.
Just in case anybody (besides me) wondered

cheers,
chris

I have the same problem even doing things as you describe them in your second mail. Could you send the full source of your example to compare please.

TIA,

Olivier.

Thank you!