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

Last change on this file was 4138, checked in by jbclement, 4 weeks ago

PEM:

  • Move ice table variables from "ice_table" to the main program.
  • Merge "job_id_mod" and "job_timelimit_mod" into "job" which is relocated to the PEM folder.
  • Rename local variables in procedures to avoid masking variables in parent scope.
  • Few cleanings to delete remaining PEM-external "include" and "use".

JBC

File size: 2.0 KB
Line 
1MODULE stoppage
2!-----------------------------------------------------------------------
3! NAME
4!     stoppage
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! DEPENDENCIES
17! ------------
18use numerics, only: di
19
20! DECLARATION
21! -----------
22implicit none
23
24contains
25!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
26
27!=======================================================================
28SUBROUTINE stop_clean(fname,fline,message,ierr)
29!-----------------------------------------------------------------------
30! NAME
31!     stop_clean
32!
33! DESCRIPTION
34!     Stop simulation cleanly, closing files and printing diagnostics.
35!
36! AUTHORS & DATE
37!     JB Clement, 2025
38!
39! NOTES
40!     Taken from Mars PCM.
41!-----------------------------------------------------------------------
42
43! DEPENDENCIES
44! ------------
45#ifdef CPP_IOIPSL
46use IOIPSL
47#else
48! If not using IOIPSL, we still need to use (a local version of) getin_dump
49use ioipsl_getincom
50#endif
51use display, only: print_msg, LVL_ERR
52
53! DECLARATION
54! -----------
55implicit none
56
57! ARGUMENTS
58! ---------
59character(*), intent(in) :: fname   ! Name of file
60integer(di),  intent(in) :: fline   ! Line number of file
61integer(di),  intent(in) :: ierr    ! Severity of situation (= 0 normal)
62character(*), intent(in) :: message ! Message to print
63
64! LOCAL VARIABLES
65! ---------------
66character(100) :: msg
67
68! CODE
69! ----
70#ifdef CPP_IOIPSL
71    call histclo()
72    call restclo()
73#endif
74
75call getin_dump()
76write(msg,'(a,i5,a)') 'Stopping in "'//fname//'" at line ',fline,'.'
77call print_msg(msg,LVL_ERR)
78call print_msg('Reason: '//message,LVL_ERR)
79write(msg,'(a,i3)') 'Houston, we have a problem! Error code = ',ierr
80call print_msg(msg,LVL_ERR)
81error stop ierr
82
83END SUBROUTINE stop_clean
84!=======================================================================
85
86END MODULE stoppage
Note: See TracBrowser for help on using the repository browser.