1 | MODULE abort_pem_mod |
---|
2 | |
---|
3 | implicit none |
---|
4 | |
---|
5 | !======================================================================= |
---|
6 | contains |
---|
7 | !======================================================================= |
---|
8 | |
---|
9 | SUBROUTINE abort_pem(modname,message,ierr) |
---|
10 | |
---|
11 | #ifdef CPP_IOIPSL |
---|
12 | use IOIPSL |
---|
13 | #else |
---|
14 | ! if not using IOIPSL, we still need to use (a local version of) getin_dump |
---|
15 | use ioipsl_getincom |
---|
16 | #endif |
---|
17 | |
---|
18 | #ifdef CPP_XIOS |
---|
19 | use wxios ! ug Pour les sorties XIOS |
---|
20 | #endif |
---|
21 | |
---|
22 | implicit none |
---|
23 | |
---|
24 | #include "iniprint.h" |
---|
25 | |
---|
26 | ! Stop the simulation cleanly, closing files and printing various comments |
---|
27 | ! Input: modname = name of calling program |
---|
28 | ! message = stuff to print |
---|
29 | ! ierr = severity of situation (= 0 normal) |
---|
30 | character(len = *), intent(in) :: modname |
---|
31 | integer, intent(in) :: ierr |
---|
32 | character(len = *), intent(in) :: message |
---|
33 | |
---|
34 | !----- Code |
---|
35 | write(lunout,*) 'in abort_pem' |
---|
36 | |
---|
37 | #ifdef CPP_XIOS |
---|
38 | CALL wxios_close() ! Fermeture propre de XIOS |
---|
39 | #endif |
---|
40 | |
---|
41 | #ifdef CPP_IOIPSL |
---|
42 | call histclo |
---|
43 | call restclo |
---|
44 | #endif |
---|
45 | |
---|
46 | call getin_dump |
---|
47 | write(lunout,*) 'Stopping in ', modname |
---|
48 | write(lunout,*) 'Reason = ', message |
---|
49 | if (ierr == 0) then |
---|
50 | write(lunout,*) 'Everything is cool!' |
---|
51 | stop |
---|
52 | else |
---|
53 | write(lunout,*) 'Houston, we have a problem, ierr =', ierr |
---|
54 | stop 1 |
---|
55 | endif |
---|
56 | |
---|
57 | END SUBROUTINE abort_pem |
---|
58 | |
---|
59 | END MODULE abort_pem_mod |
---|