Ignore:
Timestamp:
Dec 11, 2025, 12:56:05 PM (5 weeks ago)
Author:
jbclement
Message:

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:
1 moved

Legend:

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

    r3988 r3989  
    1 MODULE ice_table_mod
     1MODULE ice_table
    22
    33implicit none
     
    5757!!!
    5858!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    59 use math_mod,                   only: findroot
    60 use comsoil_h_PEM,              only: mlayer_PEM, layer_PEM ! Depth of the vertical grid
    61 use soil_thermalproperties_mod, only: ice_thermal_properties
     59use math_toolkit,         only: findroot
     60use soil,                 only: mlayer_PEM, layer_PEM ! Depth of the vertical grid
     61use soil_thermal_inertia, only: get_ice_TI
    6262
    6363implicit none
     
    7474real, dimension(ngrid,nslope), intent(out) :: ice_table_depth     ! ice table depth [m]
    7575real, dimension(ngrid,nslope), intent(out) :: ice_table_thickness ! ice table thickness [m]
    76 ! Locals
    77 ! ------
     76! Local variables
     77! ---------------
    7878integer                       :: ig, islope, isoil, isoilend ! loop variables
    7979real, dimension(nsoil)        :: diff_rho                    ! difference of water vapor density between the surface and at depth [kg/m^3]
     
    129129    do ig = 1,ngrid
    130130        if (ice_table_depth(ig,islope) > previous_icetable_depth(ig,islope) .and. previous_icetable_depth(ig,islope) >= 0) then
    131             call ice_thermal_properties(.false.,1.,regolith_inertia(ig,islope),wice_inertia)
     131            call get_ice_TI(.false.,1.,regolith_inertia(ig,islope),wice_inertia)
    132132            stretch = (regolith_inertia(ig,islope)/wice_inertia)**2
    133133            ice_table_thickness(ig,islope) = ice_table_thickness(ig,islope) + (ice_table_depth(ig,islope) - &
     
    149149!!!
    150150!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    151 use comsoil_h_PEM,         only: mlayer_PEM
     151use soil,         only: mlayer_PEM
    152152use comslope_mod,          only: subslope_dist, def_slope_mean
    153153use constants_marspem_mod, only: porosity
     
    208208!!!
    209209!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    210 use comsoil_h_PEM, only: nsoilmx_PEM, mlayer_PEM
    211 use math_mod,      only: deriv1, deriv1_onesided, colint, findroot, deriv2_simple
     210use soil, only: nsoilmx_PEM, mlayer_PEM
     211use math_toolkit,  only: deriv1, deriv1_onesided, colint, findroot, deriv2_simple
    212212
    213213implicit none
     
    379379!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    380380
    381 use comsoil_h_PEM, only: mlayer_PEM
    382 use abort_pem_mod, only: abort_pem
     381use soil,      only: mlayer_PEM
     382use stop_pem, only: stop_clean
    383383
    384384implicit none
     
    395395real, intent(out) :: Tice ! Ice temperatures (K)
    396396
    397 ! Locals
    398 ! ------
     397! Local variables
     398! ---------------
    399399integer :: ik       ! Loop variables
    400400integer :: indexice ! Index of the ice
     
    417417    endif
    418418    if (indexice < 0) then
    419         call abort_pem("compute_Tice_pem","Subsurface ice is below the last soil layer!",1)
     419        call stop_clean("compute_Tice_pem","Subsurface ice is below the last soil layer!",1)
    420420    else
    421421        if(indexice >= 1) then ! Linear inteprolation between soil temperature
     
    439439!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    440440
    441 use abort_pem_mod, only: abort_pem
     441use stop_pem, only: stop_clean
    442442
    443443implicit none
     
    453453        rho = (1.72391 - 2.53e-4*T-2.87*1e-7*T**2)*1.e3 ! Mangan et al. 2017
    454454    case default
    455         call abort_pem("rho_ice","Type of ice not known!",1)
     455        call stop_clean("rho_ice","Type of ice not known!",1)
    456456end select
    457457
    458458END FUNCTION rho_ice
    459459
    460 END MODULE ice_table_mod
     460END MODULE ice_table
Note: See TracChangeset for help on using the changeset viewer.