Most simple boundary outflow problem

I want to create a simple 2d flow with an inflow on the left side and an outflow on the right side and freeslip walls on the top and bottom side. I had a look at the poisseuille flow code where the flow is working correctly, but my code does not produce nice flow results. (The render results can be viewed here). For some reason the fluid bounces from the outflow.

I posted the code below. Any help would be really appreciated. Thanks in advance!!

int main(int argc, char* argv[]) {
plbInit(&argc, &argv);

const plint maxIter = 10000; // Iterate during 1000 steps.
const plint nx = 400;       // Choice of lattice dimensions.
const plint ny = 400;
const T omega = 0.188;        // Choice of the relaxation parameter
const T density = 1.0;

    boundaryCondition = createLocalBoundaryCondition2D<T,DESCRIPTOR>();

MultiBlockLattice2D<T, DESCRIPTOR> lattice (
       nx, ny, new BGKdynamics<T,DESCRIPTOR>(omega) );

Array<T, 2> zeroVelocity(0,0);
Array<T, 2> boundaryVelocity(0.1,0);

boundaryCondition->setVelocityConditionOnBlockBoundaries (
        lattice, Box2D(0,0, 1,ny-2) );
boundaryCondition->setVelocityConditionOnBlockBoundaries (
        lattice, Box2D(nx-1,nx-1, 1,ny-2), boundary::outflow );

// Velocity boundary condition on bottom wall.
boundaryCondition->setVelocityConditionOnBlockBoundaries (
        lattice, Box2D(0, nx-1, 0, 0), boundary::freeslip );
// Velocity boundary condition on top wall.
boundaryCondition->setVelocityConditionOnBlockBoundaries (
        lattice, Box2D(0, nx-1, ny-1, ny-1), boundary::freeslip );

// Define the value of the imposed density on all nodes which have previously been
//   defined to be pressure boundary nodes.
setBoundaryDensity (
        lattice, lattice.getBoundingBox(),
        density );

// Define the value of the imposed velocity on all nodes which have previously been
//   defined to be velocity boundary nodes.

/*defineDynamics(lattice, lattice.getBoundingBox(),
               new RectShapeDomain2D<T>(200,220,200,220),
               new plb::BounceBack<T,DESCRIPTOR>);*/

setBoundaryVelocity (
        lattice, lattice.getBoundingBox(),
        boundaryVelocity );

initializeAtEquilibrium (
       lattice, lattice.getBoundingBox(), density, zeroVelocity);

setBoundaryVelocity (
        lattice, lattice.getBoundingBox(),
        boundaryVelocity );

A few things to try:

  • increase omega to at least 0.5, 0.9 would be better.
  • decrease the inlet velocity to 0.02
  • don’t set a boundary density, you don’t have pressure boundary nodes
  • initialize the flow field with the inlet velocity to get rid of the initial oscillations