Abort the program with finalization of the environment
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in), | optional | :: | errorMsg |
An optional error message to print a reason for the abort. |
subroutine tem_abort( errorMsg )
! -------------------------------------------------------------------- !
!> An optional error message to print a reason for the abort.
character(len=*), intent(in), optional :: errorMsg
! -------------------------------------------------------------------- !
integer :: iError
! -------------------------------------------------------------------- !
! @todo JZ: commented out the the tem_finalize here: In case that one rank
! while the other ranks are still waiting for communication the solver
! will not terminate.
!call tem_finalize()
if( present( errorMsg ) ) write(logUnit(1),*) errorMsg
write(logUnit(1),*)
write(logUnit(1),*) " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
write(logUnit(1),*) " Aborting. "
write(logUnit(1),*) " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
write(logUnit(1),*)
flush(logUnit(1))
call mpi_abort(MPI_COMM_WORLD, 1, iError)
end subroutine tem_abort