! ! $Id: abort_gcm.F 1747 2013-04-23 14:06:30Z lguez $ ! ! ! SUBROUTINE abort_gcm(modname, message, ierr) USE iniprint_mod_h USE IOIPSL USE parallel_lmdz ! ! Stops the simulation cleanly, closing files and printing various ! comments ! ! Input: modname = name of calling program ! message = stuff to print ! ierr = severity of situation ( = 0 normal ) character(len=*), intent(in):: modname integer :: ierr, ierror_mpi character(len=*), intent(in):: message write(lunout,*) 'in abort_gcm' !$OMP MASTER call histclo call restclo if (MPI_rank .eq. 0) then call getin_dump endif !$OMP END MASTER ! call histclo(2) ! call histclo(3) ! call histclo(4) ! call histclo(5) write(lunout,*) 'Stopping in ', modname write(lunout,*) 'Reason = ',message if (ierr .eq. 0) then write(lunout,*) 'Everything is cool' else write(lunout,*) 'Houston, we have a problem, ierr = ', ierr if (using_mpi) THEN !$OMP CRITICAL (MPI_ABORT_GCM) call MPI_ABORT(COMM_LMDZ, 1, ierror_mpi) !$OMP END CRITICAL (MPI_ABORT_GCM) else stop 1 endif endif END SUBROUTINE abort_gcm