LMDZ
abort_gcm.F
Go to the documentation of this file.
1 !
2 ! $Id: abort_gcm.F 1747 2013-04-23 14:06:30Z lguez $
3 !
4 c
5 c
6  SUBROUTINE abort_gcm(modname, message, ierr)
7 
8 #ifdef CPP_IOIPSL
9  USE ioipsl
10 #else
11 ! if not using IOIPSL, we still need to use (a local version of) getin_dump
12  USE ioipsl_getincom
13 #endif
14  USE parallel_lmdz
15 #include "iniprint.h"
16 
17 C
18 C Stops the simulation cleanly, closing files and printing various
19 C comments
20 C
21 C Input: modname = name of calling program
22 C message = stuff to print
23 C ierr = severity of situation ( = 0 normal )
24 
25  character(len=*), intent(in):: modname
26  integer ierr, ierror_mpi
27  character(len=*), intent(in):: message
28 
29  write(lunout,*) 'in abort_gcm'
30 #ifdef CPP_IOIPSL
31 c$OMP MASTER
32  call histclo
33  call restclo
34  if (mpi_rank .eq. 0) then
35  call getin_dump
36  endif
37 c$OMP END MASTER
38 #endif
39 c call histclo(2)
40 c call histclo(3)
41 c call histclo(4)
42 c call histclo(5)
43  write(lunout,*) 'Stopping in ', modname
44  write(lunout,*) 'Reason = ',message
45  if (ierr .eq. 0) then
46  write(lunout,*) 'Everything is cool'
47  else
48  write(lunout,*) 'Houston, we have a problem, ierr = ', ierr
49 #ifdef CPP_MPI
50 C$OMP CRITICAL (MPI_ABORT_GCM)
51  call mpi_abort(comm_lmdz, 1, ierror_mpi)
52 C$OMP END CRITICAL (MPI_ABORT_GCM)
53 #else
54  stop 1
55 #endif
56  endif
57  END
integer, save mpi_rank
subroutine abort_gcm(modname, message, ierr)
Definition: abort_gcm.F:7
subroutine, public getin_dump(fileprefix)
!$Header!gestion des impressions de sorties et de débogage la sortie standard prt_level COMMON comprint lunout
Definition: iniprint.h:7