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

Last change on this file 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
RevLine 
[3989]1MODULE stop_pem
[3991]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!-----------------------------------------------------------------------
[3076]15
[3991]16! DECLARATION
17! -----------
[3076]18implicit none
19
20contains
[3991]21!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[3076]22
[3989]23!=======================================================================
24SUBROUTINE stop_clean(modname,message,ierr)
[3991]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!-----------------------------------------------------------------------
[3076]38
[3991]39! DEPENDENCIES
40! ------------
[2888]41#ifdef CPP_IOIPSL
[3076]42    use IOIPSL
[2888]43#else
[3989]44    ! If not using IOIPSL, we still need to use (a local version of) getin_dump
[3076]45    use ioipsl_getincom
[2888]46#endif
47#ifdef CPP_XIOS
[3989]48    use wxios ! For XIOS outputs
[2888]49#endif
50
[3991]51! DECLARATION
52! -----------
[3076]53implicit none
54
[2888]55#include "iniprint.h"
56
[3991]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
[2888]62
[3991]63! CODE
64! ----
[2888]65#ifdef CPP_XIOS
[3989]66    CALL wxios_close() ! Closing XIOS properly
[2888]67#endif
68
69#ifdef CPP_IOIPSL
[3989]70    call histclo()
71    call restclo()
[2888]72#endif
[3076]73
[3989]74call getin_dump()
75write(lunout,*) 'stop_pem: stopping in ', modname
[3076]76write(lunout,*) 'Reason = ', message
77if (ierr == 0) then
[3351]78    write(lunout,*) 'Everything is cool!'
[3989]79    error stop
[3076]80else
[3989]81    write(lunout,*) 'Houston, we have a problem! ierr =', ierr
82    error stop 1
[3076]83endif
84
[3989]85END SUBROUTINE stop_clean
86!=======================================================================
[3076]87
[3989]88END MODULE stop_pem
Note: See TracBrowser for help on using the repository browser.