# Does it do what I think it does?

Hey, I’ve been playing around a lot with various pieces of the code, just to try and get a feel for how things work. I was wondering if someone felt like commenting on whether I’m understanding the flow of execution properly. Just for fun I changed the code specifying the boundaries in cylinder2d.cpp to what I’m pasting below; I included the entire function to make it easier to navigate. What I’ve done is commenting out all the codes determining the right-most boundary (I think? I’d be happy for corrections on that) and then added
lattice.periodicity().toggleAll(false);
before the rest. My thinking was that what should happen here is that first all sides are set to bounceback, but then that is over-written on the left, bottom and top sides, while the right side remanins bounceback. I THINK that’s what I’m seeing in the result, but I find myself hesitating about what I’ve actually told the program to do. So yea, this is certainly not an attempt to write a serious modification, just trying to get to know the code and how it behaves. Corrections or confirmations on my understanding both very much appreciated!

[code=“cpp”]
void cylinderSetup( MultiBlockLattice2D<T,DESCRIPTOR>& lattice,
IncomprFlowParam const& parameters,
OnLatticeBoundaryCondition2D<T,DESCRIPTOR>& boundaryCondition )
{
const plint nx = parameters.getNx();
const plint ny = parameters.getNy();
Box2D outlet(nx-1,nx-1, 1, ny-2);

``````lattice.periodicity().toggleAll(false);

// Create Velocity boundary conditions everywhere
boundaryCondition.setVelocityConditionOnBlockBoundaries (
lattice, Box2D(0, 0, 1, ny-2) );
boundaryCondition.setVelocityConditionOnBlockBoundaries (
lattice, Box2D(0, nx-1, 0, 0) );
boundaryCondition.setVelocityConditionOnBlockBoundaries (
lattice, Box2D(0, nx-1, ny-1, ny-1) );
// .. except on right boundary, where we prefer an outflow condition
//boundaryCondition.setVelocityConditionOnBlockBoundaries (
//														 lattice, Box2D(nx-1, nx-1, 1, ny-2), boundary::outflow );

setBoundaryVelocity (
lattice, lattice.getBoundingBox(),
PoiseuilleVelocity<T>(parameters) );
//setBoundaryDensity (
//					lattice, outlet,
//					ConstantDensity<T>(1.) );
initializeAtEquilibrium (
lattice, lattice.getBoundingBox(),
PoiseuilleVelocityAndDensity<T>(parameters) );

plint cx     = nx/4;
plint cy     = ny/2+2; // cy is slightly offset to avoid full symmetry,
//   and to get a Von Karman Vortex street.