1 | SUBROUTINE abort_physic(modname, message, ierr) |
---|
2 | |
---|
3 | #ifdef CPP_IOIPSL |
---|
4 | USE IOIPSL |
---|
5 | #else |
---|
6 | ! if not using IOIPSL, we still need to use (a local version of) getin_dump |
---|
7 | USE ioipsl_getincom |
---|
8 | #endif |
---|
9 | USE mod_phys_lmdz_para |
---|
10 | #include "iniprint.h" |
---|
11 | |
---|
12 | ! |
---|
13 | ! Stops the simulation cleanly, closing files and printing various |
---|
14 | ! comments |
---|
15 | ! |
---|
16 | ! Input: modname = name of calling program |
---|
17 | ! message = stuff to print |
---|
18 | ! ierr = severity of situation ( = 0 normal ) |
---|
19 | |
---|
20 | character(len=*), intent(in):: modname |
---|
21 | integer ierr, ierror_mpi |
---|
22 | character(len=*), intent(in):: message |
---|
23 | |
---|
24 | write(lunout,*) 'in abort_gcm' |
---|
25 | #ifdef CPP_IOIPSL |
---|
26 | !$OMP MASTER |
---|
27 | call histclo |
---|
28 | call restclo |
---|
29 | if (mpi_rank .eq. 0) then |
---|
30 | call getin_dump |
---|
31 | endif |
---|
32 | !$OMP END MASTER |
---|
33 | #endif |
---|
34 | |
---|
35 | write(lunout,*) 'Stopping in ', modname |
---|
36 | write(lunout,*) 'Reason = ',message |
---|
37 | if (ierr .eq. 0) then |
---|
38 | write(lunout,*) 'Everything is cool' |
---|
39 | else |
---|
40 | write(lunout,*) 'Houston, we have a problem, ierr = ', ierr |
---|
41 | #ifdef CPP_MPI |
---|
42 | !$OMP CRITICAL (MPI_ABORT_PHYSIC) |
---|
43 | call MPI_ABORT(COMM_LMDZ_PHY, 1, ierror_mpi) |
---|
44 | !$OMP END CRITICAL (MPI_ABORT_PHYSIC) |
---|
45 | #else |
---|
46 | stop 1 |
---|
47 | #endif |
---|
48 | endif |
---|
49 | END |
---|