# Boundary for MultiGridLattice

Hi,
I’m trying the MultiGridLattice2D learning from the gridRefinement2d dipole case.
I created the 3 level lattice2D and want to set different boundary for different edge, but it does not success.
It is like this.

[code=“cpp-qt”]
void applyOuterBoundaryConditions( MultiGridLattice2D<T,DESCRIPTOR>& lattice,
ConvectiveRefinementParameters const& parameters,
OnLatticeBoundaryCondition2D<T,DESCRIPTOR>& bc)
{
Box2D coarsestBoundingBox=lattice.getComponent(0).getBoundingBox();
for (plint iLevel = 0; iLevel < lattice.getNumLevels(); ++iLevel) {

``````    MultiBlockLattice2D<T,DESCRIPTOR>& oneLattice = lattice.getComponent(iLevel);

oneLattice.periodicity().toggleAll(false);

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

Box2D inlet   (box.x0,   box.x0,   box.y0-1,   box.y1-1);
Box2D outlet  (box.x1,   box.x1,   box.y0-1,   box.y1-1);
Box2D yBottom (box.x0,   box.x1,   box.y0,   box.y0);
Box2D yTop    (box.x0,   box.x1,   box.y1,   box.y1);

// Inlet boundary condition.
bc.setVelocityConditionOnBlockBoundaries(oneLattice, boundingBox, inlet, boundary::dirichlet);

// Outlet boundary condition.
bc.setVelocityConditionOnBlockBoundaries(oneLattice, boundingBox, outlet, boundary::outflow);

// Lateral boundary conditions.
bc.setVelocityConditionOnBlockBoundaries(oneLattice, boundingBox, yBottom, boundary::dirichlet);
bc.setVelocityConditionOnBlockBoundaries(oneLattice, boundingBox, yTop, boundary::dirichlet);

//Initial Velocity & Density
setBoundaryVelocity( lattice.getComponent(iLevel),
lattice.getComponent(iLevel).getBoundingBox(), Array<T,2>((T)0.,(T)0.) );
initializeAtEquilibrium( lattice.getComponent(iLevel), lattice.getComponent(iLevel).getBoundingBox(), InletVelocity<T>(parameters[iLevel]) );
}
lattice.initialize();
``````

}

``````

I know that to the coarsest grid I can set the different edges boundary by telling the x0,x1,y0,y1. But  I've no idea how to deal with the fine girds.

2. And as showed in the dipole case, the grid is written into VTK files by interpolate it to the finest grids using
writeVTK(*lattice.convertToLevel(interpLevel),parameters[interpLevel],interpLevel,iT);
But I want to write the original multigrids to the VTK files to see the grids status. How should I do?

Thank you very much.

best wishes,
steed188``````