How to set up the velocity on Dirichlet boundaries with ShanChenD2Q9Descriptor

Hello, everyone,

After running the example of Multicomponent2D with ForcedShanChenD2Q9 descriptor, I have tried to change the boundary condition to the velocity on Dirichlet boundaries, because it is similiar with the our experiments in the lab. At the beginning, my method was as below:

  1. Change ‘#define DESCRIPTOR descriptors::ForcedShanChenD2Q9Descriptor’ -> ‘#define DESCRIPTOR ShanChenD2Q9Descriptor’

  2. Write ’ boundaryCondition.addVelocityBoundaryON(wettingFluid, Box2D(0, 0, 1, ny-2));
    boundaryCondition.addVelocityBoundaryON(nonwettingFluid, Box2D(nx-1, nx-1, 1, ny-2));
    setBoundaryVelocity(wettingFluid, wettingFluid.getBoundingBox(), Array<T, 2>(velocityLeft, 0));
    setBoundaryVelocity(nonwettingFluid, nonwettingFluid.getBoundingBox(), Array<T, 2>(velocityRight, 0));’
    to replace external force in the example.

However, after making and running it, the error information was printed out:
‘class plb::OnLatticeBoundaryCondition2D<double, plb::descriptors::ShanChenD2Q9Descriptor>’ has no member named ‘addVelocityBoundaryON’
Then the process of making failed…

Although deleting the first two lines (part of addVelocityBoundaryOn) and leaving ‘setBoundaryVelocity()’ can have making process running successfully, the resuts of the simulation was too weird (e.g., the average density can be less than zero !)

After those, I just found the ForcedShanChenD2Q9/D3Q19 descriptor examples from the file. Therefore, is there anyone knowing how to set up the velocity on Dirichlet boundary for Multicomponent simulations with ShanChenDXQX descriptor? Thanks very much in advance.

I have used this for presure
boundaryCondition->setPressureConditionOnBlockBoundaries(lightFluid, inlet);
setBoundaryDensity(lightFluid, inlet, 1.);
you can simply change and write Velocity…however the main concern is that I’ve found that all the methods to set dirichlet or neumann boundary conditions are intrinsically unstable. Only periodic BC and bounceback seem to work.