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

Last change on this file since 3989 was 3989, checked in by jbclement, 5 weeks ago

PEM:
Massive structural refactor of the PEM codebase for improved readability, consistency and maintainability. The goal is to modernize, standardize and consolidate the code while removing legacy complexity. In detail, this change:

  • Performs large-scale cleanup removing unused code, obsolete routines, duplicated functionality and deprecated initialization logic;
  • Removes "*_mod" wrappers;
  • Replaces mixed naming conventions with clearer variable names, domain-based file/module names and purpose-based routine names;
  • Adds native reading/writing capabilities to the PEM removing the cumbersome dependency on Mars PCM subroutines;
  • Centralizes soil/ice/orbital/PEM configuration logic into dedicated modules;
  • Simplifies routines and updates calls/interfaces to match the new structure.

This refactor significantly clarifies the codebase and provides a cleaner foundation for forthcoming developments.
JBC

File size: 1.4 KB
Line 
1MODULE stop_pem
2
3implicit none
4
5!=======================================================================
6contains
7!=======================================================================
8
9!=======================================================================
10SUBROUTINE stop_clean(modname,message,ierr)
11! Stop the simulation cleanly, closing files and printing various comments
12! Inputs: modname = name of calling program
13!         message = stuff to print
14!         ierr    = severity of situation (= 0 normal)
15
16#ifdef CPP_IOIPSL
17    use IOIPSL
18#else
19    ! If not using IOIPSL, we still need to use (a local version of) getin_dump
20    use ioipsl_getincom
21#endif
22
23#ifdef CPP_XIOS
24    use wxios ! For XIOS outputs
25#endif
26
27implicit none
28
29#include "iniprint.h"
30
31! Arguments
32!----------
33character(*), intent(in) :: modname
34integer,      intent(in) :: ierr
35character(*), intent(in) :: message
36
37! Code
38!-----
39#ifdef CPP_XIOS
40    CALL wxios_close() ! Closing XIOS properly
41#endif
42
43#ifdef CPP_IOIPSL
44    call histclo()
45    call restclo()
46#endif
47
48call getin_dump()
49write(lunout,*) 'stop_pem: stopping in ', modname
50write(lunout,*) 'Reason = ', message
51if (ierr == 0) then
52    write(lunout,*) 'Everything is cool!'
53    error stop
54else
55    write(lunout,*) 'Houston, we have a problem! ierr =', ierr
56    error stop 1
57endif
58
59END SUBROUTINE stop_clean
60!=======================================================================
61
62END MODULE stop_pem
Note: See TracBrowser for help on using the repository browser.