diff --git a/src/finalize.F90 b/src/finalize.F90 index da9d80e2fd..0236eb4e84 100644 --- a/src/finalize.F90 +++ b/src/finalize.F90 @@ -36,6 +36,7 @@ contains if (output_tallies) then if (master) call write_tallies() end if + if (check_overlaps) call reduce_overlap_count() end if #ifdef PETSC @@ -69,4 +70,22 @@ contains end subroutine finalize_run +!=============================================================================== +! REDUCE_OVERLAP_COUNT accumulates cell overlap check counts to master +!=============================================================================== + + subroutine reduce_overlap_count() + +#ifdef MPI + if (master) then + call MPI_REDUCE(MPI_IN_PLACE, overlap_check_cnt, n_cells, & + MPI_INTEGER8, MPI_SUM, 0, MPI_COMM_WORLD, mpi_err) + else + call MPI_REDUCE(overlap_check_cnt, overlap_check_cnt, n_cells, & + MPI_INTEGER8, MPI_SUM, 0, MPI_COMM_WORLD, mpi_err) + end if +#endif + + end subroutine reduce_overlap_count + end module finalize diff --git a/src/global.F90 b/src/global.F90 index addfaadbed..502968054a 100644 --- a/src/global.F90 +++ b/src/global.F90 @@ -275,8 +275,8 @@ module global integer :: verbosity = 7 ! Flag for enabling cell overlap checking during transport - logical :: check_overlaps = .false. - integer, allocatable :: overlap_check_cnt(:) + logical :: check_overlaps = .false. + integer(8), allocatable :: overlap_check_cnt(:) ! Trace for single particle logical :: trace diff --git a/src/initialize.F90 b/src/initialize.F90 index 4870123bb4..c9c572ddda 100644 --- a/src/initialize.F90 +++ b/src/initialize.F90 @@ -150,7 +150,7 @@ contains if (particle_restart_run) run_mode = MODE_PARTICLE ! Warn if overlap checking is on - if (check_overlaps) then + if (master .and. check_overlaps) then message = "" call write_message() message = "Cell overlap checking is ON" diff --git a/src/output.F90 b/src/output.F90 index fc5d1d6a69..727747dff5 100644 --- a/src/output.F90 +++ b/src/output.F90 @@ -1504,7 +1504,7 @@ contains write(ou,*) 100 format (1X,A,T15,A) -101 format (1X,I8,T15,I8) +101 format (1X,I8,T15,I12) end subroutine print_overlap_check