From dd658eec1f3d716fa18ceb990b924b38721ecdeb Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Fri, 11 Jan 2019 11:20:10 +0100 Subject: Improve grid refinement interface By deriving RefiningGrid2D from Grid2D to provide methods specific to refining subgrids. --- apps/adrian/poiseuille2d/poiseuille2d.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'apps/adrian/poiseuille2d') diff --git a/apps/adrian/poiseuille2d/poiseuille2d.cpp b/apps/adrian/poiseuille2d/poiseuille2d.cpp index e71e51e..3d263fa 100644 --- a/apps/adrian/poiseuille2d/poiseuille2d.cpp +++ b/apps/adrian/poiseuille2d/poiseuille2d.cpp @@ -24,7 +24,9 @@ */ #include "olb2D.h" +#ifndef OLB_PRECOMPILED #include "olb2D.hh" +#endif #include @@ -187,18 +189,15 @@ int main(int argc, char* argv[]) auto coarseGrid = Grid2D::make(coarseCuboid, N, baseTau, Re); prepareGeometry(coarseGrid->getConverter(), coarseGrid->getSuperGeometry()); - const Vector wantedFineExtend {3.0, 1.5}; - const Vector fineOrigin = coarseGrid->alignOriginToGrid({0.8, (ly-wantedFineExtend[1])/2}); - const Vector fineExtend = coarseGrid->alignExtendToGrid(wantedFineExtend); + const Vector fineExtend {3.0, 1.5}; + const Vector fineOrigin {0.8, (ly-fineExtend[1])/2}; auto fineGrid = &coarseGrid->refine(fineOrigin, fineExtend); prepareGeometry(fineGrid->getConverter(), fineGrid->getSuperGeometry()); - const T coarseDeltaX = coarseGrid->getConverter().getPhysDeltaX(); - - IndicatorCuboid2D refinedOverlap(fineExtend - 4*coarseDeltaX, fineOrigin + 2*coarseDeltaX); - coarseGrid->getSuperGeometry().rename(1,0,refinedOverlap); - coarseGrid->getSuperGeometry().rename(2,0,refinedOverlap); + auto refinedOverlap = fineGrid->getRefinedOverlap(); + coarseGrid->getSuperGeometry().rename(1,0,*refinedOverlap); + coarseGrid->getSuperGeometry().rename(2,0,*refinedOverlap); BGKdynamics coarseBulkDynamics( coarseGrid->getConverter().getLatticeRelaxationFrequency(), @@ -221,18 +220,15 @@ int main(int argc, char* argv[]) sOnLatticeBoundaryCondition2D fineSBoundaryCondition(fineGrid->getSuperLattice()); createLocalBoundaryCondition2D(fineSBoundaryCondition); - const Vector wantedFineExtend2 {0.6, 0.4}; - const Vector fineOrigin2 = fineGrid->alignOriginToGrid({1.05, (ly-wantedFineExtend2[1])/2}); - const Vector fineExtend2 = fineGrid->alignExtendToGrid(wantedFineExtend2); + const Vector fineExtend2 {0.6, 0.4}; + const Vector fineOrigin2 {1.05, (ly-fineExtend2[1])/2}; auto fineGrid2 = &fineGrid->refine(fineOrigin2, fineExtend2); prepareGeometry(fineGrid2->getConverter(), fineGrid2->getSuperGeometry()); - const T fine2DeltaX = fineGrid->getConverter().getPhysDeltaX(); - - IndicatorCuboid2D refinedOverlap2(fineExtend2 - 4*fine2DeltaX, fineOrigin2 + 2*fine2DeltaX); - fineGrid->getSuperGeometry().rename(1,0,refinedOverlap2); - fineGrid->getSuperGeometry().rename(2,0,refinedOverlap2); + auto refinedOverlap2 = fineGrid2->getRefinedOverlap(); + fineGrid->getSuperGeometry().rename(1,0,*refinedOverlap2); + fineGrid->getSuperGeometry().rename(2,0,*refinedOverlap2); prepareLattice( fineGrid->getConverter(), -- cgit v1.2.3