# Boundary condition problem with periodic and freeslip

Hello fellow palabos-users,

Im using periodic BC in X and Y direction, noslip on the bottom and freeslip on top of my domain. The simulation runs fine, but a closer look at the velocity profile revealed a problem with the BC:

on the top, either on the inlet (or sometimes the outlet) side, there always appears a single line, where the bounceback rule is applied (like for all outer boundaries which werent specified otherwise).

That´s the code to setup the BC:

``````
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);

boundaryCondition->setVelocityConditionOnBlockBoundaries (lattice, topWall, boundary::freeslip);

``````

Now I made several changes to try to get it to work properly, the last one I tried looks like:

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

//lattice.periodicity().toggle(2, true); // periodic along the y-axis
OnLatticeBoundaryCondition3D<T,DESCRIPTOR>* boundaryCondition = createLocalBoundaryCondition3D<T,DESCRIPTOR>();
Box3D topWall(2, nx-3, 2, ny-3, nz-1, nz-1);
boundaryCondition->setVelocityConditionOnBlockBoundaries (lattice, topWall, boundary::freeslip);
boundaryCondition->addExternalVelocityEdge1NP( Box3D( 1, 1, 1, ny-2, nz-1, nz-1), lattice, boundary::freeslip );
boundaryCondition->addExternalVelocityEdge1PP( Box3D( nx-2, nx-2, 1, ny-2, nz-1, nz-1), lattice, boundary::freeslip ););
lattice.periodicity().toggle(0, true); // periodic along the x-axis
lattice.periodicity().toggle(1, true); // periodic along the y-axis

``````

It compiles, and the code works, but there is still a line which consists of bounceback-nodes. If I place the Edges on the domain walls (which are periodic) the code compiles, but produces a segmentation fault.

Any hints on what is wrong here ?
thanks,
Chris

Edith found a way how to get rid of the segmentation fault, but the problem is still not solved

Old topic, but I had the same issue, and solved it using addVelocityBoundary functions:

Box3D yTop (box.x0, box.x1, box.y1, box.y1, box.z0, box.z1);