source: LMDZ6/trunk/libf/phy_common/abort_physic.F90 @ 4688

Last change on this file since 4688 was 4600, checked in by yann meurdesoif, 17 months ago

Suppress CPP_MPI key usage in source code. MPI wrappers is used to supress missing symbol if the mpi library is not linked

YM

File size: 1.5 KB
Line 
1! $Id: $
2      SUBROUTINE abort_physic(modname, message, ierr)
3     
4#ifdef CPP_IOIPSL
5      USE IOIPSL
6#else
7! if not using IOIPSL, we still need to use (a local version of) getin_dump
8      USE ioipsl_getincom
9#endif
10      USE mod_phys_lmdz_para
11      USE print_control_mod, ONLY: lunout
12      IMPLICIT NONE
13!
14! Stops the simulation cleanly, closing files and printing various
15! comments
16!
17!  Input: modname = name of calling program
18!         message = stuff to print
19!         ierr    = severity of situation ( = 0 normal )
20
21      character(len=*), intent(in):: modname
22      integer ierr, ierror_mpi
23      character(len=*), intent(in):: message
24
25      write(lunout,*) 'in abort_physic'
26#ifdef CPP_IOIPSL
27!$OMP MASTER
28      call histclo
29      call restclo
30      if (mpi_rank .eq. 0) then
31         call getin_dump
32      endif
33!$OMP END MASTER
34#endif
35
36      write(lunout,*) 'Stopping in ', modname
37      write(lunout,*) 'Reason = ',message
38      if (ierr .eq. 0) then
39        write(lunout,*) 'Everything is cool'
40        if (using_mpi) then
41          !$OMP CRITICAL (MPI_ABORT_PHYSIC)
42          call MPI_ABORT(COMM_LMDZ_PHY, 0, ierror_mpi)
43          !$OMP END CRITICAL (MPI_ABORT_PHYSIC)
44        else
45          stop 0
46        endif         
47      else
48        write(lunout,*) 'Houston, we have a problem, ierr = ', ierr
49        if (using_mpi) then
50          !$OMP CRITICAL (MPI_ABORT_PHYSIC)
51          call MPI_ABORT(COMM_LMDZ_PHY, 1, ierror_mpi)
52          !$OMP END CRITICAL (MPI_ABORT_PHYSIC)
53        else
54          stop 1
55        endif         
56      endif
57      END
Note: See TracBrowser for help on using the repository browser.