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(par): backtracking was out of sync #1343

Merged
merged 1 commit into from
Sep 7, 2023
Merged
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
2 changes: 1 addition & 1 deletion src/Solution/NumericalSolution.f90
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ module NumericalSolutionModule
procedure :: sln_nur_has_converged
procedure :: sln_calc_ptc
procedure :: sln_underrelax
procedure :: sln_backtracking_xupdate

! private
procedure, private :: sln_connect
procedure, private :: sln_reset
procedure, private :: sln_ls
procedure, private :: sln_setouter
procedure, private :: sln_backtracking
procedure, private :: sln_backtracking_xupdate
procedure, private :: sln_maxval
procedure, private :: sln_calcdx
procedure, private :: sln_calc_residual
Expand Down
22 changes: 22 additions & 0 deletions src/Solution/ParallelSolution.f90
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module ParallelSolutionModule
procedure :: sln_nur_has_converged => par_nur_has_converged
procedure :: sln_calc_ptc => par_calc_ptc
procedure :: sln_underrelax => par_underrelax
procedure :: sln_backtracking_xupdate => par_backtracking_xupdate

end type ParallelSolutionType

Expand Down Expand Up @@ -173,4 +174,25 @@ subroutine par_underrelax(this, kiter, bigch, neq, active, x, xtemp)

end subroutine par_underrelax

!> @brief synchronize backtracking flag over processes
!<
subroutine par_backtracking_xupdate(this, btflag)
! -- dummy variables
class(ParallelSolutionType), intent(inout) :: this !< ParallelSolutionType instance
integer(I4B), intent(inout) :: btflag !< global backtracking flag (1) backtracking performed (0) backtracking not performed
! -- local variables
integer(I4B) :: btflag_local
type(MpiWorldType), pointer :: mpi_world
integer :: ierr

mpi_world => get_mpi_world()

btflag_local = 0
call this%NumericalSolutionType%sln_backtracking_xupdate(btflag_local)

call MPI_Allreduce(btflag_local, btflag, 1, MPI_INTEGER, &
MPI_MAX, mpi_world%comm, ierr)

end subroutine par_backtracking_xupdate

end module ParallelSolutionModule