Boundary conditions in offLatticeExternalFlow.cpp

Hello community,

In the example of gridRefinement3D of the new release, offLatticeExternalFlow.cpp, when we set up the boundary conditions in the function applyOuterBoundaryConditions, it looks like we are imposing a velocity of zero in the boundaries of all blocks of the lattice MultiLevelCoupling3D, because where are doing a loop in all levels of the lattice, here is the code:

Box3D coarsestBoundingBox = lattices.getOgs().getClosedCover(0);
for (plint iLevel = 0; iLevel <= param.finestLevel; iLevel++) {
pcout << "Generating outer domain boundary conditions at level: " << iLevel << std::endl;
MultiBlockLattice3D<T,DESCRIPTOR>& lattice = lattices.getLevel(iLevel);


    Box3D boundingBox = coarsestBoundingBox.multiply(util::intTwoToThePower(iLevel));
    Box3D box = boundingBox;

    Box3D inlet   (box.x0,   box.x0, box.y0,   box.y1,   box.z0,   box.z1);
    Box3D outlet  (box.x1,   box.x1, box.y0+1, box.y1-1, box.z0+1, box.z1-1);
    Box3D yBottom (box.x0+1, box.x1, box.y0,   box.y0,   box.z0,   box.z1);
    Box3D yTop    (box.x0+1, box.x1, box.y1,   box.y1,   box.z0,   box.z1);
    Box3D zBottom (box.x0+1, box.x1, box.y0+1, box.y1-1, box.z0,   box.z0);
    Box3D zTop    (box.x0+1, box.x1, box.y0+1, box.y1-1, box.z1,   box.z1);

    // Inlet boundary condition.                                                                                 

    bc->setVelocityConditionOnBlockBoundaries(lattice, boundingBox, inlet, boundary::dirichlet);

    Array<T,3> velocity(param.inletVelocity_LB);
    setBoundaryVelocity(lattice, inlet, velocity);

    Array<T,3> zero((T) 0, (T) 0, (T) 0);

    // Lateral boundary conditions.                                                                              
    bc->setVelocityConditionOnBlockBoundaries(lattice, boundingBox, yBottom, boundary::dirichlet);
    setBoundaryVelocity(lattice, yBottom, velocity);

    bc->setVelocityConditionOnBlockBoundaries(lattice, boundingBox, yTop, boundary::dirichlet);
    setBoundaryVelocity(lattice, yTop, velocity);

    bc->setVelocityConditionOnBlockBoundaries(lattice, boundingBox, zBottom, boundary::dirichlet);
    setBoundaryVelocity(lattice, zBottom, velocity);

    bc->setVelocityConditionOnBlockBoundaries(lattice, boundingBox, zTop, boundary::dirichlet);
    setBoundaryVelocity(lattice, zTop, velocity);

    // Outlet boundary condition.                                                                                

    if (param.outflowBcType == 0) {
        bc->setVelocityConditionOnBlockBoundaries(lattice, boundingBox, outlet, boundary::dirichlet);
        setBoundaryVelocity(lattice, outlet, velocity);
    } else if (param.outflowBcType == 1) {
        bc->setPressureConditionOnBlockBoundaries(lattice, boundingBox, outlet, boundary::dirichlet);
        setBoundaryVelocity(lattice, outlet, velocity);
    } else if (param.outflowBcType == 2) {
        bc->setVelocityConditionOnBlockBoundaries(lattice, boundingBox, outlet, boundary::neumann);
        setBoundaryVelocity(lattice, outlet, velocity);

    setBoundaryDensity(lattice, box, param.rho_LB);

Why for the inner blocks the velocity is set to zero (or to the inlet velocity) when this value should not be imposed (I think it should be interpolated from the neighbors)?

Thank you for your help!


Hello Patricia,

For all levels of refinement, inletVelocity is applied on all dirichlet boundaries of

Box3D boundingBox = coarsestBoundingBox.multiply(util::intTwoToThePower(iLevel));

which should be the boundingBox of the whole domain of simulation, written in "iLevel’’ coordinates.

In practice, it is only applied if these boundaries are equal to the boundaries of “iLevel” level of refinement.