Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix refine/coarsen logging #1036

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,7 @@ void mapRefinement(dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid,

bool adaptRefinement(dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid, FsGrid<fsgrids::technical, FS_STENCIL_WIDTH> & technicalGrid, SysBoundary& sysBoundaries, Project& project, int useStatic) {
phiprof::Timer amrTimer {"Re-refine spatial cells"};
int refines {0};
uint64_t refines {0};
if (useStatic > -1) {
project.forceRefinement(mpiGrid, useStatic);
} else {
Expand All @@ -1455,9 +1455,9 @@ bool adaptRefinement(dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGri
refines = project.adaptRefinement(mpiGrid);
}

int cells = getLocalCells().size();
MPI_Allreduce(MPI_IN_PLACE, &refines, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
MPI_Allreduce(MPI_IN_PLACE, &cells, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
uint64_t cells {getLocalCells().size()};
MPI_Allreduce(MPI_IN_PLACE, &refines, 1, MPI_UINT64_T, MPI_SUM, MPI_COMM_WORLD);
MPI_Allreduce(MPI_IN_PLACE, &cells, 1, MPI_UINT64_T, MPI_SUM, MPI_COMM_WORLD);
double ratio_refines = static_cast<double>(refines) / static_cast<double>(cells);
logFile << "(AMR) Refining " << refines << " cells, " << 100.0 * ratio_refines << "% of grid" << std::endl;

Expand All @@ -1467,10 +1467,8 @@ bool adaptRefinement(dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGri
mpiGrid.initialize_refines();
initTimer.stop();

refines = mpiGrid.get_local_cells_to_refine().size();
double coarsens = mpiGrid.get_local_cells_to_unrefine().size();
MPI_Allreduce(MPI_IN_PLACE, &refines, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
MPI_Allreduce(MPI_IN_PLACE, &coarsens, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
refines = mpiGrid.get_cells_to_refine_count();
uint64_t coarsens {mpiGrid.get_cells_to_unrefine_count()};
ratio_refines = static_cast<double>(refines) / static_cast<double>(cells);
double ratio_coarsens = static_cast<double>(coarsens) / static_cast<double>(cells);
logFile << "(AMR) Refining " << refines << " cells after induces, " << 100.0 * ratio_refines << "% of grid" << std::endl;
Expand Down
4 changes: 2 additions & 2 deletions projects/project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -638,12 +638,12 @@ namespace projects {
return shouldUnrefine;
}

int Project::adaptRefinement( dccrg::Dccrg<spatial_cell::SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid ) const {
uint64_t Project::adaptRefinement( dccrg::Dccrg<spatial_cell::SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid ) const {
phiprof::Timer refinesTimer {"Set refines"};
int myRank;
MPI_Comm_rank(MPI_COMM_WORLD,&myRank);

int refines {0};
uint64_t refines {0};
if (!P::useAlpha1 && !P::useAlpha2 && !P::useAnisotropy && !P::useVorticity) {
if (myRank == MASTER_RANK) {
std::cout << "WARNING All refinement indices disabled" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion projects/project.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace projects {
* \param mpiGrid grid to refine
* @return The amount of cells set to refine
*/
virtual int adaptRefinement( dccrg::Dccrg<spatial_cell::SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid ) const;
virtual uint64_t adaptRefinement( dccrg::Dccrg<spatial_cell::SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid ) const;


/*!\brief Refine/unrefine spatial cells one level to the static criteria in the config
Expand Down
2 changes: 1 addition & 1 deletion submodules/dccrg
Submodule dccrg updated 1 files
+101 −76 dccrg.hpp
Loading