diff options
Fix, test recursive grid refinement
-rw-r--r-- | apps/adrian/poiseuille2d/poiseuille2d.cpp | 41 | ||||
-rw-r--r-- | src/refinement/grid2D.hh | 4 |
2 files changed, 40 insertions, 5 deletions
diff --git a/apps/adrian/poiseuille2d/poiseuille2d.cpp b/apps/adrian/poiseuille2d/poiseuille2d.cpp index 20d2585..a6d7bd1 100644 --- a/apps/adrian/poiseuille2d/poiseuille2d.cpp +++ b/apps/adrian/poiseuille2d/poiseuille2d.cpp @@ -161,7 +161,7 @@ void getResults(const std::string& prefix, vtmWriter.createMasterFile(); } - if (iT%10==0) { + if (iT%20==0) { vtmWriter.write(iT); } @@ -220,6 +220,19 @@ int main(int argc, char* argv[]) sOnLatticeBoundaryCondition2D<T, DESCRIPTOR> fineSBoundaryCondition(fineGrid->getSuperLattice()); createLocalBoundaryCondition2D<T, DESCRIPTOR>(fineSBoundaryCondition); + const Vector<T,2> wantedFineExtend2 {0.4, 0.4}; + const Vector<T,2> fineOrigin2 = fineGrid->alignToGrid({1.05, (ly-wantedFineExtend2[1])/2}); + const Vector<T,2> fineExtend2 = fineGrid->alignToGrid(fineOrigin2 + wantedFineExtend2) - fineOrigin2; + + auto fineGrid2 = &fineGrid->refine(fineOrigin2, fineExtend2); + prepareGeometry(fineGrid2->getConverter(), fineGrid2->getSuperGeometry()); + + const T fine2DeltaX = fineGrid->getConverter().getPhysDeltaX(); + + IndicatorCuboid2D<T> refinedOverlap2(fineExtend2 - 4*fine2DeltaX, fineOrigin2 + 2*fine2DeltaX); + fineGrid->getSuperGeometry().rename(1,0,refinedOverlap2); + fineGrid->getSuperGeometry().rename(2,0,refinedOverlap2); + prepareLattice( fineGrid->getConverter(), fineGrid->getSuperLattice(), @@ -227,12 +240,26 @@ int main(int argc, char* argv[]) fineSBoundaryCondition, fineGrid->getSuperGeometry()); + BGKdynamics<T, DESCRIPTOR> fineBulkDynamics2( + fineGrid2->getConverter().getLatticeRelaxationFrequency(), + instances::getBulkMomenta<T, DESCRIPTOR>()); + + sOnLatticeBoundaryCondition2D<T, DESCRIPTOR> fineSBoundaryCondition2(fineGrid2->getSuperLattice()); + createLocalBoundaryCondition2D<T, DESCRIPTOR>(fineSBoundaryCondition2); + + prepareLattice( + fineGrid2->getConverter(), + fineGrid2->getSuperLattice(), + fineBulkDynamics2, + fineSBoundaryCondition2, + fineGrid2->getSuperGeometry()); + clout << "starting simulation..." << endl; Timer<T> timer( coarseGrid->getConverter().getLatticeTime(maxPhysT), coarseGrid->getSuperGeometry().getStatistics().getNvoxel()); util::ValueTracer<T> converge( - fineGrid->getConverter().getLatticeTime(physInterval), + fineGrid2->getConverter().getLatticeTime(physInterval), residuum); timer.start(); @@ -260,8 +287,16 @@ int main(int argc, char* argv[]) fineGrid->getSuperGeometry(), timer, converge.hasConverged()); + getResults( + "fine2_", + fineGrid2->getSuperLattice(), + fineGrid2->getConverter(), + iT, + fineGrid2->getSuperGeometry(), + timer, + converge.hasConverged()); - converge.takeValue(fineGrid->getSuperLattice().getStatistics().getAverageEnergy(), true); + converge.takeValue(fineGrid2->getSuperLattice().getStatistics().getAverageEnergy(), true); } timer.stop(); diff --git a/src/refinement/grid2D.hh b/src/refinement/grid2D.hh index d609746..71b943e 100644 --- a/src/refinement/grid2D.hh +++ b/src/refinement/grid2D.hh @@ -120,7 +120,7 @@ void Grid2D<T,DESCRIPTOR>::collideAndStream() this->getSuperLattice().collideAndStream(); for ( auto& fineGrid : _fineGrids ) { - fineGrid->getSuperLattice().collideAndStream(); + fineGrid->collideAndStream(); } for ( auto& fineCoupler : _fineCouplers ) { @@ -129,7 +129,7 @@ void Grid2D<T,DESCRIPTOR>::collideAndStream() } for ( auto& fineGrid : _fineGrids ) { - fineGrid->getSuperLattice().collideAndStream(); + fineGrid->collideAndStream(); } for ( auto& fineCoupler : _fineCouplers ) { |