Ignore:
Timestamp:
Jul 7, 2025, 2:46:43 PM (2 weeks ago)
Author:
jbclement
Message:

COMMON:
Rework related to the command-line parsing:

  • Replace ad-hoc argument parsing with a unified 'parse_args' subroutine, allowing easier extension to other programs and options across models;;
  • Use of '--version' (with ab optional output file) to print compilation/version details;
  • Addition of 'job_timelimit_mod' module to handle SLURM/PBS job time-limit via '--jobid' (currently only used in the PEM), allowing easier extension to other programs;
  • Replace manual SSO handling with 'parse_args' for the Mars start2archive;
  • Clean-up related legacy code in the programs supporting the version option.

JBC

Location:
trunk/LMDZ.GENERIC/libf
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/newstart.F

    r3621 r3836  
    5050     &                         latitude,  ! latitudes (rad)                       
    5151     &                         cell_area ! physics grid area (m2)
    52       use version_info_mod, only: print_version_info
     52      use parse_args_mod, only: parse_args
    5353                       
    5454      implicit none
     
    192192
    193193
    194       if (command_argument_count() > 0) then ! Get the number of command-line arguments
    195           call get_command_argument(1,txt) ! Read the argument given to the program
    196           select case (trim(adjustl(txt)))
    197               case('version')
    198                   call print_version_info()
    199                   stop
    200               case default
    201                   error stop 'The argument given to the program is '
    202      &//'unknown!'
    203           end select
    204       endif
     194      ! Parse command-line options
     195      call parse_args()
    205196
    206197c sortie visu pour les champs dynamiques
  • trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/start2archive.F

    r3576 r3836  
    3939     &                          east_gwstress, west_gwstress
    4040      use exner_hyb_m, only: exner_hyb
    41       use version_info_mod, only: print_version_info
     41      use parse_args_mod, only: parse_args
    4242
    4343      implicit none
     
    148148c   Initialisations
    149149c-----------------------------------------------------------------------
    150       if (command_argument_count() > 0) then ! Get the number of command-line arguments
    151           call get_command_argument(1,txt) ! Read the argument given to the program
    152           select case (trim(adjustl(txt)))
    153               case('version')
    154                   call print_version_info()
    155                   stop
    156               case default
    157                   error stop 'The argument given to the program is '
    158      &//'unknown!'
    159           end select
    160       endif
     150      ! Parse command-line options
     151      call parse_args()
    161152
    162153      CALL defrun_new(99, .TRUE. )
  • trunk/LMDZ.GENERIC/libf/phystd/dyn1d/kcm1d.F90

    r3716 r3836  
    2222  use dimphy, only : init_dimphy
    2323  use gases_h, only: ngasmx
    24   use version_info_mod, only: print_version_info
     24  use parse_args_mod, only: parse_args
    2525
    2626  implicit none
     
    111111  integer :: k
    112112
    113   character(100) :: arg ! To read command-line arguments
    114113 
    115114  ! --------------
    116115  ! Initialisation
    117116  ! --------------
    118   if (command_argument_count() > 0) then ! Get the number of command-line arguments
    119       call get_command_argument(1,arg) ! Read the argument given to the program
    120       select case (trim(adjustl(arg)))
    121           case('version')
    122               call print_version_info()
    123               stop
    124           case default
    125               error stop 'The argument given to the program is unknown!'
    126       end select
    127   endif
     117  ! Parse command-line options
     118  call parse_args()
    128119
    129120  pi=2.E+0*asin(1.E+0)
  • trunk/LMDZ.GENERIC/libf/phystd/dyn1d/rcm1d.F

    r3788 r3836  
    4343     &                  nf90_strerror,NF90_INQ_VARID, NF90_GET_VAR,
    4444     &                  NF90_CLOSE
    45       use version_info_mod, only: print_version_info
     45      use parse_args_mod, only: parse_args
    4646      !use inichim_1D_mod, only: inichim_1D
    4747      !use initracer_1D_mod, only: initracer_1D
     
    169169c INITIALISATION
    170170c=======================================================================
    171       if (command_argument_count() > 0) then ! Get the number of command-line arguments
    172           call get_command_argument(1,txt) ! Read the argument given to the program
    173           select case (trim(adjustl(txt)))
    174               case('version')
    175                   call print_version_info()
    176                   stop
    177               case default
    178                   error stop 'The argument given to the program is '
    179      &//'unknown!'
    180           end select
    181       endif
     171      ! Parse command-line options
     172      call parse_args()
    182173
    183174! check if 'rcm1d.def' file is around
Note: See TracChangeset for help on using the changeset viewer.