From 3bc4210c9a3c10ffe61f0237bba101f9700b7668 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Thu, 31 Jan 2019 15:14:03 +0100 Subject: Report total number of active cells in refinement hierarchy --- apps/adrian/cylinder2d/cylinder2d.cpp | 5 +++-- apps/adrian/poiseuille2d/poiseuille2d.cpp | 1 + src/refinement/grid2D.h | 2 ++ src/refinement/grid2D.hh | 10 ++++++++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/apps/adrian/cylinder2d/cylinder2d.cpp b/apps/adrian/cylinder2d/cylinder2d.cpp index 56866c4..a0732e4 100644 --- a/apps/adrian/cylinder2d/cylinder2d.cpp +++ b/apps/adrian/cylinder2d/cylinder2d.cpp @@ -251,7 +251,7 @@ int main(int argc, char* argv[]) coarseGrid.getSuperGeometry().rename(4,0,refined); } - const Vector fineExtend2 {4*cylinderD, 2*cylinderD}; + const Vector fineExtend2 {3.6*cylinderD, 2*cylinderD}; const Vector fineOrigin2 {1*cylinderD, 2*cylinderD-fineExtend2[1]/2}; auto& fineGrid2 = fineGrid.refine(fineOrigin2, fineExtend2); @@ -264,12 +264,13 @@ int main(int argc, char* argv[]) prepareLattice(fineOutflowGrid); prepareLattice(fineGrid2); + clout << "Total number of active cells: " << coarseGrid.getActiveVoxelN() << endl; clout << "Starting simulation..." << endl; Timer timer( coarseGrid.getConverter().getLatticeTime(maxPhysT), coarseGrid.getSuperGeometry().getStatistics().getNvoxel()); timer.start(); - const int statIter = coarseGrid.getConverter().getLatticeTime(0.5); + const int statIter = coarseGrid.getConverter().getLatticeTime(1); for (int iT = 0; iT < coarseGrid.getConverter().getLatticeTime(maxPhysT); ++iT) { setBoundaryValues(coarseGrid, iT); diff --git a/apps/adrian/poiseuille2d/poiseuille2d.cpp b/apps/adrian/poiseuille2d/poiseuille2d.cpp index 4091905..5a47f96 100644 --- a/apps/adrian/poiseuille2d/poiseuille2d.cpp +++ b/apps/adrian/poiseuille2d/poiseuille2d.cpp @@ -248,6 +248,7 @@ int main(int argc, char* argv[]) prepareLattice(fineGrid); + clout << "Total number of active cells: " << coarseGrid.getActiveVoxelN() << endl; clout << "starting simulation..." << endl; Timer timer( coarseGrid.getConverter().getLatticeTime(maxPhysT), diff --git a/src/refinement/grid2D.h b/src/refinement/grid2D.h index 37e764a..95324f7 100644 --- a/src/refinement/grid2D.h +++ b/src/refinement/grid2D.h @@ -110,6 +110,8 @@ public: RefiningGrid2D& refine(Vector origin, Vector extend, bool addCouplers=true); + std::size_t getActiveVoxelN() const; + }; template class DESCRIPTOR> diff --git a/src/refinement/grid2D.hh b/src/refinement/grid2D.hh index 941bff7..504808a 100644 --- a/src/refinement/grid2D.hh +++ b/src/refinement/grid2D.hh @@ -217,6 +217,16 @@ Vector Grid2D::alignExtendToGrid(Vector extend) const return util::floor(extend / deltaX) * deltaX; } +template class DESCRIPTOR> +std::size_t Grid2D::getActiveVoxelN() const +{ + std::size_t n = _geometry->getStatistics().getNvoxel(); + for (const auto& grid : _fineGrids) { + n += grid->getActiveVoxelN(); + } + return n; +} + template class DESCRIPTOR> RefiningGrid2D& Grid2D::refine( Vector wantedOrigin, Vector wantedExtend, bool addCouplers) -- cgit v1.2.3