Ignore:
Timestamp:
May 30, 2025, 11:45:56 AM (9 days ago)
Author:
jbclement
Message:

PEM:
Correction of 'h2o_ice_depth' update in the main loop.
JBC

File:
1 edited

Legend:

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

    r3782 r3784  
    200200type(ptrarray), dimension(:,:), allocatable :: current           ! Current active stratum in the layering
    201201logical,        dimension(:,:), allocatable :: new_str, new_lag  ! Flags for the layering algorithm
    202 real                                        :: h2o_ice_depth_old ! Old depth of subsurface ice layer
     202real,           dimension(:,:), allocatable :: h2o_ice_depth_old ! Old depth of subsurface ice layer
    203203logical                                     :: is_subsurface_ice ! Boolean to know if there is subsurface ice
    204204
     
    751751stopPEM = 0
    752752if (layering_algo) then
    753     allocate(new_str(ngrid,nslope),new_lag(ngrid,nslope),current(ngrid,nslope))
     753    allocate(h2o_ice_depth_old(ngrid,nslope),new_str(ngrid,nslope),new_lag(ngrid,nslope),current(ngrid,nslope))
    754754    new_str = .true.
    755755    new_lag = .true.
     
    834834    allocate(zshift_surf(ngrid,nslope),zlag(ngrid,nslope))
    835835    if (layering_algo) then
     836        h2o_ice_depth_old = h2o_ice_depth
    836837        do islope = 1,nslope
    837838            do ig = 1,ngrid
    838839                call make_layering(layerings_map(ig,islope),d_co2ice(ig,islope),d_h2oice(ig,islope),new_str(ig,islope),zshift_surf(ig,islope),new_lag(ig,islope),zlag(ig,islope),current(ig,islope)%p)
    839                 co2_ice = 0.
    840                 h2o_ice = 0.
    841                 h2o_ice_depth = 0.
     840                co2_ice(ig,islope) = 0.
     841                h2o_ice(ig,islope) = 0.
     842                h2o_ice_depth(ig,islope) = 0.
    842843                if (is_co2ice_str(layerings_map(ig,islope)%top)) then
    843844                    co2_ice(ig,islope) = layerings_map(ig,islope)%top%h_co2ice
     
    10641065        do ig = 1,ngrid
    10651066            do islope = 1,nslope
    1066                 if (is_h2oice_sublim_ini(ig,islope)) then
    1067                     h2o_ice_depth_old = h2o_ice_depth(ig,islope)
    1068                     h2o_ice_depth(ig,islope) = thickness_toplag(layerings_map(ig,islope))
    1069                     call recomp_tend_h2o(h2o_ice_depth_old,h2o_ice_depth(ig,islope),tsurf_avg(ig,islope),tsoil_PEM_timeseries_old(ig,:,islope,:),tsoil_PEM_timeseries(ig,:,islope,:),d_h2oice(ig,islope))
    1070                 endif
     1067                if (is_h2oice_sublim_ini(ig,islope)) call recomp_tend_h2o(h2o_ice_depth_old(ig,islope),h2o_ice_depth(ig,islope),tsurf_avg(ig,islope),tsoil_PEM_timeseries_old(ig,:,islope,:),tsoil_PEM_timeseries(ig,:,islope,:),d_h2oice(ig,islope))
    10711068            enddo
    10721069        enddo
     
    11271124deallocate(d_co2ice,d_co2ice_ini,d_h2oice)
    11281125deallocate(is_co2ice_ini,is_co2ice_sublim_ini,is_h2oice_sublim_ini)
    1129 if (layering_algo) deallocate(new_str,new_lag,current)
     1126if (layering_algo) deallocate(h2o_ice_depth_old,new_str,new_lag,current)
    11301127!------------------------------ END RUN --------------------------------
    11311128
Note: See TracChangeset for help on using the changeset viewer.