# Corner Node Boundary Conditions

I am looking for a bit of input/error checking of my code I have included just the relevant portions of code to the BCs and calling them from main.

I am looking to do the following:

CBBBBBBBBBBBBBBBBBBBBBBBBBc
X ---------------------------------------------O
X ---------------------------------------------O
X ---------------------------------------------O
X ---------------------------------------------O
CBBBBBBBBBBBBBBBBBBBBBBBBBc

c-corner node, boundary::outflow
C-corner node, boundary::freeslip
X- inlet with defined rho and vel [Velocity BC]
O- outlet with rho defined [Pressure BC]
B- defined density bounce back [Contact angle (sort of)]

So this setup works with out the following lines:

``````

//Defines free slip at inlet corners
boundaryCondition.addExternalVelocityCornerPP( 0, 0, lattice, boundary::freeslip );
boundaryCondition.addExternalVelocityCornerPN( 0, ny-1, lattice, boundary::freeslip );

//Defines free slip at outlet corners
boundaryCondition.addExternalVelocityCornerNP( nx-1, 0, lattice, boundary::outflow );
boundaryCondition.addExternalVelocityCornerNN( nx-1, ny-1, lattice, boundary::outflow );

``````
``````
void BCSetup( MultiBlockLattice2D<T,DESCRIPTOR>& lattice,
OnLatticeBoundaryCondition2D<T,DESCRIPTOR>& boundaryCondition )
{
const plint gap = 1;
Box2D inlet(0,0, 1, ny-2);
Box2D outlet(nx-1,nx-1, 1, ny-2);
Box2D bottom(0,nx-1, 0,0);
Box2D top(0,nx-1, ny-1,ny-1);

//Defines interaction density at boundary for the bounceback collision
defineDynamics(lattice, bottom, new BounceBack<T, DESCRIPTOR>(solidRhoL) );
defineDynamics(lattice, top, new BounceBack<T, DESCRIPTOR>(solidRhoL) );

//
boundaryCondition.setVelocityConditionOnBlockBoundaries (lattice, inlet );
setBoundaryVelocity(lattice, inlet, inlet_vel);

//Sets density everywhere to RhoAll
setBoundaryDensity ( lattice, lattice.getBoundingBox(), RhoAll);
//sets the density just at the outlet to DeltaRho (establishing the parameter needed for the pressure bc)
boundaryCondition.setPressureConditionOnBlockBoundaries (lattice, outlet );
setBoundaryDensity ( lattice, outlet, DeltaRho );

//Defines free slip at inlet corners
boundaryCondition.addExternalVelocityCornerPP( 0, 0, lattice, boundary::freeslip );
boundaryCondition.addExternalVelocityCornerPN( 0, ny-1, lattice, boundary::freeslip );

//Defines free slip at outlet corners
boundaryCondition.addExternalVelocityCornerNP( nx-1, 0, lattice, boundary::outflow );
boundaryCondition.addExternalVelocityCornerNN( nx-1, ny-1, lattice, boundary::outflow );

}

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

MultiBlockLattice2D<T, DESCRIPTOR> lattice (
nx,ny, new ExternalMomentBGKdynamics<T, DESCRIPTOR>(omega));
OnLatticeBoundaryCondition2D<T,DESCRIPTOR>*
boundaryCondition = createInamuroBoundaryCondition2D<T,DESCRIPTOR>();

BCSetup(lattice, *boundaryCondition);

plint processorLevel = 1;
integrateProcessingFunctional (
new ShanChenSingleComponentProcessor2D<T,DESCRIPTOR> (
G, new interparticlePotential::PsiShanChen94<T>(psi0,rho0) ),
lattice.getBoundingBox(), lattice, processorLevel );

lattice.initialize();

for (int iT=0; iT<maxIter; ++iT) {
lattice.collideAndStream();
}
}

``````

So my question is how to implement these corner nodes correctly?

Secondly am I implementing the other BCs the way I think I am?

~Thank you!