Ignore:
Timestamp:
Mar 18, 2026, 1:56:02 PM (3 weeks ago)
Author:
jbclement
Message:

PEM:
Fix to avoid building large temporary arrays in the arguments evaluation of "compute_tendice" which caused memory to stall.
JBC

Location:
trunk/LMDZ.COMMON/libf/evolution
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/evolution/changelog.txt

    r4139 r4140  
    927927== 18/03/2026 == JBC
    928928Partial reversion of r4138: relocating "job_mod" to "LMDZ.COMMON/libf/misc/" because "parse_arg_mod" needs to know "job_mod" even if it is not the PEM.
     929
     930== 18/03/2026 == JBC
     931Fix to avoid building large temporary arrays in the arguments evaluation of "compute_tendice" which caused memory to stall.
  • trunk/LMDZ.COMMON/libf/evolution/pem.F90

    r4139 r4140  
    210210allocate(d_h2oice(ngrid,nslope),d_co2ice(ngrid,nslope))
    211211call print_msg('> Computing surface ice tendencies',LVL_NFO)
    212 call compute_tendice(minPCM_h2operice + minPCM_h2ofrost,h2o_ice(:,:) > 0._dp,d_h2oice)
     212call compute_tendice(minPCM_h2operice,minPCM_h2ofrost,h2o_ice,d_h2oice)
    213213call print_msg('H2O ice tendencies [kg/m2/yr] (min|max): '//real2str(minval(d_h2oice))//' | '//real2str(maxval(d_h2oice)),LVL_NFO)
    214 call compute_tendice(minPCM_co2perice + minPCM_co2frost,co2_ice(:,:) > 0._dp,d_co2ice)
     214call compute_tendice(minPCM_co2perice,minPCM_co2frost,co2_ice,d_co2ice)
    215215call print_msg('CO2 ice tendencies [kg/m2/yr] (min|max): '//real2str(minval(d_co2ice))//' | '//real2str(maxval(d_co2ice)),LVL_NFO)
    216216deallocate(minPCM_h2operice,minPCM_co2perice,minPCM_h2ofrost,minPCM_co2frost)
     
    433433
    434434    ! Save periodic backups of restart files
    435     if (backup_rate > 0 .and. mod(idt,backup_rate) == 0) then
    436         call save_clim_state(h2o_ice,co2_ice,tsurf_avg,tsurf_dev,tsoil_avg,tsoil_dev,ps_avg,ps_dev,ps_avg_glob,ps_avg_glob_ini, &
    437                              icetable_depth,icetable_thickness,ice_porefilling,h2o_ads_reg,co2_ads_reg,layerings_map,idt)
     435    if (backup_rate > 0) then
     436        if (mod(idt,backup_rate) == 0) call save_clim_state(h2o_ice,co2_ice,tsurf_avg,tsurf_dev,tsoil_avg,tsoil_dev,ps_avg,ps_dev,ps_avg_glob,ps_avg_glob_ini, &
     437                                                            icetable_depth,icetable_thickness,ice_porefilling,h2o_ads_reg,co2_ads_reg,layerings_map,idt)
    438438    end if
    439439
  • trunk/LMDZ.COMMON/libf/evolution/tendencies.F90

    r4135 r4140  
    2828
    2929!=======================================================================
    30 SUBROUTINE compute_tendice(min_ice,is_perice,d_ice)
     30SUBROUTINE compute_tendice(min_perice,min_frost,perice,d_ice)
    3131!-----------------------------------------------------------------------
    3232! NAME
     
    5151! ARGUMENTS
    5252! ---------
    53 real(dp),    dimension(:,:,:), intent(in)  :: min_ice
    54 logical(k4), dimension(:,:),   intent(in)  :: is_perice
    55 real(dp),    dimension(:,:),   intent(out) :: d_ice
     53real(dp), dimension(:,:,:), intent(in)  :: min_perice
     54real(dp), dimension(:,:,:), intent(in)  :: min_frost
     55real(dp), dimension(:,:),   intent(in)  :: perice
     56real(dp), dimension(:,:),   intent(out) :: d_ice
    5657
    5758! CODE
    5859! ----
    5960! We compute the difference to get the tendency
    60 d_ice(:,:) = min_ice(:,:,2) - min_ice(:,:,1)
     61d_ice(:,:) = min_perice(:,:,2) + min_frost(:,:,2) - (min_perice(:,:,1) + min_frost(:,:,1))
    6162
    6263! If the difference is too small, then there is no evolution
     
    6465
    6566! If the tendency is negative but there is no ice reservoir for the PEM
    66 where (abs(d_ice) < 0._dp .and. .not. is_perice) d_ice = 0._dp
     67where (d_ice < 0._dp .and. abs(perice) < minieps) d_ice = 0._dp
    6768
    6869END SUBROUTINE compute_tendice
Note: See TracChangeset for help on using the changeset viewer.