From 9519d45f0c51f044108c67261ebd47712911f687 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sat, 5 Jan 2019 22:31:54 +0100 Subject: Test basic coarse subset refinement --- apps/adrian/poiseuille2d/poiseuille2d.cpp | 46 +++++++++++++++++++------------ 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'apps') diff --git a/apps/adrian/poiseuille2d/poiseuille2d.cpp b/apps/adrian/poiseuille2d/poiseuille2d.cpp index 632fba5..6c50339 100644 --- a/apps/adrian/poiseuille2d/poiseuille2d.cpp +++ b/apps/adrian/poiseuille2d/poiseuille2d.cpp @@ -97,8 +97,10 @@ void prepareCoarseLattice(UnitConverter const& converter, sLattice.defineDynamics(superGeometry, 1, &bulkDynamics); // bulk sLattice.defineDynamics(superGeometry, 2, &instances::getBounceBack()); sLattice.defineDynamics(superGeometry, 3, &bulkDynamics); // inflow + sLattice.defineDynamics(superGeometry, 4, &bulkDynamics); // outflow sBoundaryCondition.addVelocityBoundary(superGeometry, 3, omega); + sBoundaryCondition.addPressureBoundary(superGeometry, 4, omega); const T Lx = converter.getLatticeLength(lx); const T Ly = converter.getLatticeLength(ly); @@ -118,6 +120,8 @@ void prepareCoarseLattice(UnitConverter const& converter, sLattice.defineRhoU(superGeometry, 3, rho, u); sLattice.iniEquilibrium(superGeometry, 3, rho, u); + sLattice.defineRhoU(superGeometry, 4, rho, u); + sLattice.iniEquilibrium(superGeometry, 4, rho, u); sLattice.initialize(); @@ -138,9 +142,6 @@ void prepareFineLattice(UnitConverter const& converter, sLattice.defineDynamics(superGeometry, 0, &instances::getNoDynamics()); sLattice.defineDynamics(superGeometry, 1, &bulkDynamics); // bulk sLattice.defineDynamics(superGeometry, 2, &instances::getBounceBack()); - sLattice.defineDynamics(superGeometry, 4, &bulkDynamics); // outflow - - sBoundaryCondition.addPressureBoundary(superGeometry, 4, omega); const T Lx = converter.getLatticeLength(lx); const T Ly = converter.getLatticeLength(ly); @@ -149,7 +150,7 @@ void prepareFineLattice(UnitConverter const& converter, const T maxVelocity = converter.getCharLatticeVelocity(); const T radius = ly/2; - std::vector axisPoint{lx, ly/2}; + std::vector axisPoint{0, ly/2}; std::vector axisDirection{1, 0}; Poiseuille2D u(axisPoint, axisDirection, maxVelocity, radius); @@ -158,9 +159,6 @@ void prepareFineLattice(UnitConverter const& converter, sLattice.defineRhoU(superGeometry, 2, rho, u); sLattice.iniEquilibrium(superGeometry, 2, rho, u); - sLattice.defineRhoU(superGeometry, 4, rho, u); - sLattice.iniEquilibrium(superGeometry, 4, rho, u); - sLattice.initialize(); clout << "Prepare fine lattice ... OK" << std::endl; @@ -610,11 +608,11 @@ int main(int argc, char* argv[]) const T coarseDeltaX = 1./N; Vector coarseOrigin { 0.0, 0.0 }; - Vector coarseExtend { 0.5 * lx, ly }; + Vector coarseExtend { lx, ly }; IndicatorCuboid2D coarseCuboid(coarseExtend, coarseOrigin); - Vector fineOrigin { 0.5 * lx - coarseDeltaX, 0.0 }; - Vector fineExtend { 0.5 * lx + coarseDeltaX, ly }; + Vector fineOrigin { 0.25 * lx, 0.0 }; + Vector fineExtend { 0.5 * lx, ly }; IndicatorCuboid2D fineCuboid(fineExtend, fineOrigin); auto coarseGrid = Grid::make(coarseCuboid, N, 0.8, Re); @@ -623,6 +621,10 @@ int main(int argc, char* argv[]) prepareGeometry(coarseGrid->getConverter(), coarseGrid->getSuperGeometry()); prepareGeometry(fineGrid->getConverter(), fineGrid->getSuperGeometry()); + IndicatorCuboid2D overlapCuboid(Vector{fineExtend[0]-2*coarseDeltaX, fineExtend[1]}, Vector{fineOrigin[0]+coarseDeltaX, fineOrigin[1]}); + coarseGrid->getSuperGeometry().rename(1,0,overlapCuboid); + coarseGrid->getSuperGeometry().rename(2,0,overlapCuboid); + Dynamics* coarseBulkDynamics; coarseBulkDynamics = new BGKdynamics( coarseGrid->getConverter().getLatticeRelaxationFrequency(), @@ -664,11 +666,13 @@ int main(int argc, char* argv[]) const Vector originC2F = fineOrigin; const Vector extendC2F { 0, fineExtend[1] }; - FineCoupler fineCoupler(*coarseGrid, *fineGrid, originC2F, extendC2F); + FineCoupler fineCoupler0(*coarseGrid, *fineGrid, fineOrigin, extendC2F); + FineCoupler fineCoupler1(*coarseGrid, *fineGrid, fineOrigin + Vector(fineExtend[0],0), extendC2F); const Vector originF2C { fineOrigin[0] + coarseDeltaX, fineOrigin[1] }; const Vector extendF2C { 0, fineExtend[1] }; - CoarseCoupler coarseCoupler(*coarseGrid, *fineGrid, originF2C, extendF2C); + CoarseCoupler coarseCoupler0(*coarseGrid, *fineGrid, originF2C, extendF2C); + CoarseCoupler coarseCoupler1(*coarseGrid, *fineGrid, fineOrigin + Vector(fineExtend[0]-coarseDeltaX,0), extendF2C); for (int iT = 0; iT < coarseGrid->getConverter().getLatticeTime(maxPhysT); ++iT) { if (converge.hasConverged()) { @@ -676,18 +680,24 @@ int main(int argc, char* argv[]) break; } - fineCoupler.store(); + fineCoupler0.store(); + fineCoupler1.store(); coarseGrid->getSuperLattice().collideAndStream(); fineGrid->getSuperLattice().collideAndStream(); - fineCoupler.interpolate(); - fineCoupler.couple(); + fineCoupler0.interpolate(); + fineCoupler0.couple(); + fineCoupler1.interpolate(); + fineCoupler1.couple(); fineGrid->getSuperLattice().collideAndStream(); - fineCoupler.store(); - fineCoupler.couple(); + fineCoupler0.store(); + fineCoupler0.couple(); + fineCoupler1.store(); + fineCoupler1.couple(); - coarseCoupler.couple(); + coarseCoupler0.couple(); + coarseCoupler1.couple(); getResults( "coarse_", -- cgit v1.2.3