source: trunk/LMDZ.COMMON/libf/evolution/stop_pem.F90 @ 3995

Last change on this file since 3995 was 3991, checked in by jbclement, 4 weeks ago

PEM:
Apply documentation template everywhere: standardized headers format with short description, separators between functions/subroutines, normalized code sections, aligned dependencies/arguments/variables declaration.
JBC

File size: 1.9 KB
Line 
1MODULE stop_pem
2!-----------------------------------------------------------------------
3! NAME
4!     stop_pem
5!
6! DESCRIPTION
7!     Clean stopping utilities for PEM: close outputs and report reason.
8!
9! AUTHORS & DATE
10!     JB Clement, 2025
11!
12! NOTES
13!
14!-----------------------------------------------------------------------
15
16! DECLARATION
17! -----------
18implicit none
19
20contains
21!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22
23!=======================================================================
24SUBROUTINE stop_clean(modname,message,ierr)
25!-----------------------------------------------------------------------
26! NAME
27!     stop_clean
28!
29! DESCRIPTION
30!     Stop simulation cleanly, closing files and printing diagnostics.
31!
32! AUTHORS & DATE
33!     JB Clement, 2025
34!
35! NOTES
36!     Taken from Mars PCM.
37!-----------------------------------------------------------------------
38
39! DEPENDENCIES
40! ------------
41#ifdef CPP_IOIPSL
42    use IOIPSL
43#else
44    ! If not using IOIPSL, we still need to use (a local version of) getin_dump
45    use ioipsl_getincom
46#endif
47#ifdef CPP_XIOS
48    use wxios ! For XIOS outputs
49#endif
50
51! DECLARATION
52! -----------
53implicit none
54
55#include "iniprint.h"
56
57! ARGUMENTS
58! ---------
59character(*), intent(in) :: modname ! name of calling program
60integer,      intent(in) :: ierr    ! severity of situation (= 0 normal)
61character(*), intent(in) :: message ! stuff to print
62
63! CODE
64! ----
65#ifdef CPP_XIOS
66    CALL wxios_close() ! Closing XIOS properly
67#endif
68
69#ifdef CPP_IOIPSL
70    call histclo()
71    call restclo()
72#endif
73
74call getin_dump()
75write(lunout,*) 'stop_pem: stopping in ', modname
76write(lunout,*) 'Reason = ', message
77if (ierr == 0) then
78    write(lunout,*) 'Everything is cool!'
79    error stop
80else
81    write(lunout,*) 'Houston, we have a problem! ierr =', ierr
82    error stop 1
83endif
84
85END SUBROUTINE stop_clean
86!=======================================================================
87
88END MODULE stop_pem
Note: See TracBrowser for help on using the repository browser.