Ignore:
Timestamp:
Mar 9, 2026, 10:29:53 AM (4 days ago)
Author:
jbclement
Message:

PEM:

  • Introduction of a configurable display/logging system with options 'out2term', 'out2log', 'verbosity_lvl'. All messages now use verbosity levels ('LVL_NFO', 'LVL_WRN', 'LVL_ERR' and 'LVL_DBG').
  • Code encapsulation improvements with systematic privacy/protection of module variables.
  • Addition of workflow safety checks for required executables, dependencies (e.g. 'ncdump'), input files and callphys keys.
  • Renaming of PEM starting and diagnostic files ("startevol.nc" into "startevo.nc", "diagevol.nc" into "diagevo.nc").

JBC

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/evolution/clim_state_init.F90

    r4090 r4110  
    4848use tracers,    only: nq, qnames, set_q_PCM
    4949use stoppage,   only: stop_clean
    50 use display,    only: print_msg
     50use display,    only: print_msg, LVL_NFO
    5151
    5252! DECLARATION
     
    7676inquire(file = start_name,exist = here)
    7777if (.not. here) call stop_clean(__FILE__,__LINE__,'cannot find required file "'//start_name//'"!',1)
    78 call print_msg('> Reading "'//start_name//'"')
     78call print_msg('> Reading "'//start_name//'"',LVL_NFO)
    7979call open_nc(start_name,'read')
    8080
     
    126126use stoppage,   only: stop_clean
    127127use config,     only: read_callphys
    128 use display,    only: print_msg
     128use display,    only: print_msg, LVL_NFO
    129129
    130130! DECLARATION
     
    147147inquire(file = start1D_name,exist = here)
    148148if (.not. here) call stop_clean(__FILE__,__LINE__,'cannot find required file "'//start1D_name//'"!',1)
    149 call print_msg('> Reading "'//start1D_name//'"')
     149call print_msg('> Reading "'//start1D_name//'"',LVL_NFO)
    150150open(newunit = funit,file = start1D_name,status = "old",action = "read",iostat = ierr)
    151151if (ierr /= 0) call stop_clean(__FILE__,__LINE__,'error opening file "'//start1D_name//'"!',ierr)
     
    201201use geometry,  only: ngrid, nslope, nsoil_PCM
    202202use stoppage,  only: stop_clean
    203 use config,    only: read_controldata
     203use config,    only: read_control_data
    204204use slopes,    only: set_def_slope_mean, set_subslope_dist, set_iflat
    205205use surface,   only: set_albedodat_PCM, set_albedo_PCM, set_emissivity_PCM
     
    209209use surf_ice,  only: set_is_h2o_perice_PCM, set_co2_perice_PCM
    210210use soil,      only: set_TI_PCM, set_inertiedat_PCM
    211 use display,   only: print_msg
     211use display,   only: print_msg, LVL_NFO
    212212
    213213! DECLARATION
     
    228228
    229229! Allocate the array to store the variables
    230 call print_msg('> Reading "'//startfi_name//'"')
     230call print_msg('> Reading "'//startfi_name//'"',LVL_NFO)
    231231allocate(tmp1d(nslope + 1),tmp2d(ngrid,nslope))
    232232
    233233! Get control data
    234 call read_controldata()
     234call read_control_data()
    235235
    236236! Open
     
    308308!
    309309! DESCRIPTION
    310 !     Read the file "startevol.nc" which stores the PEM state.
     310!     Read the file "startevo.nc" which stores the PEM state.
    311311!
    312312! AUTHORS & DATE
     
    337337use slopes,             only: subslope_dist, def_slope_mean
    338338use maths,              only: pi
    339 use display,            only: print_msg
     339use display,            only: print_msg, LVL_WRN, LVL_NFO, LVL_ERR
    340340use utility,            only: int2str
    341341
     
    367367integer(di)                               :: i, islope, k, nb_str_max, nsoil_startpem
    368368real(dp)                                  :: delta           ! Depth of the interface regolith/breccia, breccia/bedrock [m]
    369 real(dp), dimension(ngrid,nsoil,nslope)   :: TI_startpem     ! Soil thermal inertia saved in the startevol [SI]
    370 real(dp), dimension(ngrid,nsoil,nslope)   :: tsoil_startpem  ! Soil temperature saved in the startevol [K]
     369real(dp), dimension(ngrid,nsoil,nslope)   :: TI_startpem     ! Soil thermal inertia saved in the startevo [SI]
     370real(dp), dimension(ngrid,nsoil,nslope)   :: tsoil_startpem  ! Soil temperature saved in the startevo [K]
    371371real(dp), dimension(:,:,:,:), allocatable :: layerings_array ! Array for layerings
    372372
     
    380380if (.not. here) then
    381381    ! It is possibly because it is the very first PEM run so everything needs to be initalized
    382     call print_msg('> The file "'//startpem_name//'" was not found (possibly because this is the first PEM run)')
     382    call print_msg('> The file "'//startpem_name//'" was not found (possibly because this is the first PEM run)',LVL_WRN)
    383383
    384384    ! H2O ice
    385     call print_msg("'h2o_ice' is initialized with default value 'h2oice_huge_ini' where 'watercaptag' is true and where yearly minimum of frost can be considered as a huge reservoir ('threshold_h2oice_cap').")
     385    call print_msg("'h2o_ice' is initialized with default value 'h2oice_huge_ini' where 'watercaptag' is true and where yearly minimum of frost can be considered as a huge reservoir ('threshold_h2oice_cap').",LVL_NFO)
    386386    h2o_ice(:,:) = 0._dp
    387387    do i = 1,ngrid
     
    394394
    395395    ! CO2 ice
    396     call print_msg("'co2_ice' is initialized with 'perennial_co2ice' and yearly minimum of frost found in the PCM.")
     396    call print_msg("'co2_ice' is initialized with 'perennial_co2ice' and yearly minimum of frost found in the PCM.",LVL_NFO)
    397397    co2_ice(:,:) = co2_perice_PCM(:,:) + co2frost_PCM(:,:) - co2_frost4PCM(:,:)
    398398
     
    494494    ! Layering
    495495    if (do_layering) then
    496         call print_msg('layerings_map is initialized with sub-surface strata.')
    497         call print_msg("Ice is added with 'h2oice_huge_ini' where 'watercaptag' is true and otherwise with 'perennial_co2ice' found in the PCM.")
     496        call print_msg('layerings_map is initialized with sub-surface strata.',LVL_NFO)
     497        call print_msg("Ice is added with 'h2oice_huge_ini' where 'watercaptag' is true and otherwise with 'perennial_co2ice' found in the PCM.",LVL_NFO)
    498498        do i = 1,ngrid
    499499            if (is_h2o_perice_PCM(i)) then
     
    516516! If the file is present
    517517! ~~~~~~~~~~~~~~~~~~~~~~
    518 call print_msg('> Reading "'//startpem_name//'"')
     518call print_msg('> Reading "'//startpem_name//'"',LVL_NFO)
    519519call open_nc(startpem_name,'read')
    520520
     
    531531    call get_dim_nc('subsurface_layers',nsoil_startpem)
    532532    if (nsoil_startpem /= nsoil) then
    533         call print_msg('nsoil (PEM) = '//int2str(nsoil)//' | nsoil ("'//startpem_name//'") = '//int2str(nsoil_startpem))
     533        call print_msg('nsoil (PEM) = '//int2str(nsoil)//' | nsoil ("'//startpem_name//'") = '//int2str(nsoil_startpem),LVL_ERR)
    534534        call stop_clean(__FILE__,__LINE__,'nsoil defined in the PEM is different from the one read in "'//startpem_name//'"!',1)
    535535    end if
Note: See TracChangeset for help on using the changeset viewer.