Ignore:
Timestamp:
Mar 17, 2026, 11:12:37 AM (2 weeks ago)
Author:
jbclement
Message:

PEM:

  • Temporary memory load reduced in "xios_data".
  • Rename local variables in procedures to avoid masking variables in parent scope.

JBC

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

Legend:

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

    r4135 r4136  
    914914== 16/03/2026 == JBC
    915915Relocate Mars-specific parameters out of "planet" module and into the modules that own their physics domain.
     916
     917== 17/03/2026 == JBC
     918- Temporary memory load reduced in "xios_data".
     919- Rename local variables in procedures to avoid masking variables in parent scope.
  • trunk/LMDZ.COMMON/libf/evolution/geometry.F90

    r4134 r4136  
    153153
    154154!=======================================================================
    155 SUBROUTINE lonlat2vect(nlon,nlat,ngrid,v_ll,v_vect)
     155SUBROUTINE lonlat2vect(nlon_in,nlat_in,ngrid_in,v_ll,v_vect)
    156156!-----------------------------------------------------------------------
    157157! NAME
     
    180180! ARGUMENTS
    181181!----------
    182 integer(di),                    intent(in)  :: nlon, nlat, ngrid
    183 real(dp), dimension(nlon,nlat), intent(in)  :: v_ll
    184 real(dp), dimension(ngrid),     intent(out) :: v_vect
     182integer(di),                          intent(in)  :: nlon_in, nlat_in, ngrid_in
     183real(dp), dimension(nlon_in,nlat_in), intent(in)  :: v_ll
     184real(dp), dimension(ngrid_in),        intent(out) :: v_vect
    185185
    186186! LOCAL VARIABLES
     
    190190! CODE
    191191!-----
    192 if (ngrid == 1) then ! 1D case
     192if (ngrid_in == 1) then ! 1D case
    193193    v_vect(1) = v_ll(1,1)
    194194    return
    195195else ! 3D
    196196    ! Check
    197     if (ngrid /= nlon*(nlat - 2) + 2) call stop_clean(__FILE__,__LINE__,'problem of dimensions!',1)
     197    if (ngrid_in /= nlon_in*(nlat_in - 2) + 2) call stop_clean(__FILE__,__LINE__,'problem of dimensions!',1)
    198198
    199199    ! Initialization
     
    202202    ! Treatment of the poles
    203203    v_vect(1) = v_ll(1,1)
    204     v_vect(ngrid) = v_ll(1,nlat)
     204    v_vect(ngrid_in) = v_ll(1,nlat_in)
    205205
    206206    ! Treatment of regular points
    207     do j = 2,nlat - 1
    208         do i = 1,nlon
    209             v_vect(1 + i + (j - 2)*nlon) = v_ll(i,j)
     207    do j = 2,nlat_in - 1
     208        do i = 1,nlon_in
     209            v_vect(1 + i + (j - 2)*nlon_in) = v_ll(i,j)
    210210        end do
    211211    end do
     
    216216
    217217!=======================================================================
    218 SUBROUTINE vect2lonlat(nlon,nlat,ngrid,v_vect,v_ll)
     218SUBROUTINE vect2lonlat(nlon_in,nlat_in,ngrid_in,v_vect,v_ll)
    219219!-----------------------------------------------------------------------
    220220! NAME
     
    243243! ARGUMENTS
    244244!----------
    245 integer(di),                    intent(in)  :: nlon, nlat, ngrid
    246 real(dp), dimension(ngrid),     intent(in)  :: v_vect
    247 real(dp), dimension(nlon,nlat), intent(out) :: v_ll
     245integer(di),                          intent(in)  :: nlon_in, nlat_in, ngrid_in
     246real(dp), dimension(ngrid_in),        intent(in)  :: v_vect
     247real(dp), dimension(nlon_in,nlat_in), intent(out) :: v_ll
    248248
    249249! LOCAL VARIABLES
     
    253253! CODE
    254254!-----
    255 if (ngrid == 1) then ! 1D case
     255if (ngrid_in == 1) then ! 1D case
    256256    v_ll(1,1) = v_vect(1)
    257257    return
    258258else ! 3D
    259259    ! Check
    260     if (ngrid /= nlon*(nlat - 2) + 2) call stop_clean(__FILE__,__LINE__,'problem of dimensions!',1)
     260    if (ngrid_in /= nlon_in*(nlat_in - 2) + 2) call stop_clean(__FILE__,__LINE__,'problem of dimensions!',1)
    261261
    262262    ! Initialization
     
    265265    ! Treatment of the poles
    266266    v_ll(:,1) = v_vect(1)
    267     v_ll(:,nlat) = v_vect(ngrid)
     267    v_ll(:,nlat_in) = v_vect(ngrid_in)
    268268
    269269    ! Treatment of regular points
    270     do j = 2,nlat - 1
    271         do i = 1,nlon
    272             v_ll(i,j) = v_vect(1 + i + (j - 2)*nlon)
     270    do j = 2,nlat_in - 1
     271        do i = 1,nlon_in
     272            v_ll(i,j) = v_vect(1 + i + (j - 2)*nlon_in)
    273273        end do
    274274    end do
     
    279279
    280280!=======================================================================
    281 SUBROUTINE dyngrd2vect(ni,nj,ngrid,v_dyn,v_vect)
     281SUBROUTINE dyngrd2vect(ni,nj,ngrid_in,v_dyn,v_vect)
    282282!-----------------------------------------------------------------------
    283283! NAME
     
    306306! ARGUMENTS
    307307!----------
    308 integer(di),                intent(in)  :: ni, nj, ngrid
    309 real(dp), dimension(ni,nj), intent(in)  :: v_dyn
    310 real(dp), dimension(ngrid), intent(out) :: v_vect
     308integer(di),                   intent(in)  :: ni, nj, ngrid_in
     309real(dp), dimension(ni,nj),    intent(in)  :: v_dyn
     310real(dp), dimension(ngrid_in), intent(out) :: v_vect
    311311
    312312! LOCAL VARIABLES
     
    316316! CODE
    317317!-----
    318 if (ngrid == 1) then ! 1D case
     318if (ngrid_in == 1) then ! 1D case
    319319    v_vect(1) = v_dyn(1,1)
    320320    return
    321321else ! 3D
    322322    ! Check
    323     if (ngrid /= (ni - 1)*(nj - 2) + 2) call stop_clean(__FILE__,__LINE__,'problem of dimensions!',1)
     323    if (ngrid_in /= (ni - 1)*(nj - 2) + 2) call stop_clean(__FILE__,__LINE__,'problem of dimensions!',1)
    324324
    325325    ! Initialization
     
    328328    ! Treatment of the poles
    329329    v_vect(1) = v_dyn(1,1)
    330     v_vect(ngrid) = v_dyn(1,nj)
     330    v_vect(ngrid_in) = v_dyn(1,nj)
    331331
    332332    ! Treatment of regular points
     
    342342
    343343!=======================================================================
    344 SUBROUTINE vect2dyngrd(ni,nj,ngrid,v_vect,v_dyn)
     344SUBROUTINE vect2dyngrd(ni,nj,ngrid_in,v_vect,v_dyn)
    345345!-----------------------------------------------------------------------
    346346! NAME
     
    369369! ARGUMENTS
    370370!----------
    371 integer(di),                intent(in)  :: ni, nj, ngrid
    372 real(dp), dimension(ngrid), intent(in)  :: v_vect
    373 real(dp), dimension(ni,nj), intent(out) :: v_dyn
     371integer(di),                   intent(in)  :: ni, nj, ngrid_in
     372real(dp), dimension(ngrid_in), intent(in)  :: v_vect
     373real(dp), dimension(ni,nj),    intent(out) :: v_dyn
    374374
    375375! LOCAL VARIABLES
     
    379379! CODE
    380380!-----
    381 if (ngrid == 1) then ! 1D case
     381if (ngrid_in == 1) then ! 1D case
    382382    v_dyn(1,1) = v_vect(1)
    383383    return
    384384else ! 3D
    385385    ! Check
    386     if (ngrid /= (ni - 1)*(nj - 2) + 2) call stop_clean(__FILE__,__LINE__,'problem of dimensions!',1)
     386    if (ngrid_in /= (ni - 1)*(nj - 2) + 2) call stop_clean(__FILE__,__LINE__,'problem of dimensions!',1)
    387387
    388388    ! Initialization
     
    391391    ! Treatment of the poles
    392392    v_dyn(:,1) = v_vect(1)
    393     v_dyn(:,nj) = v_vect(ngrid)
     393    v_dyn(:,nj) = v_vect(ngrid_in)
    394394
    395395    ! Treatment of regular points
  • trunk/LMDZ.COMMON/libf/evolution/soil.F90

    r4135 r4136  
    2525! PARAMETERS
    2626! ----------
    27 ! Density and porosity of regolith and breccia
    28 real(dp), parameter :: rho_regolith      = 2000._dp ! [kg/m^3], Zent et al. 1995; Buhler and Piqueux 2021
     27real(dp), parameter :: rho_regolith      = 2000._dp ! Density of the martian regolith [kg/m^3], Zent et al. 1995; Buhler and Piqueux 2021
    2928real(dp), parameter :: regolith_porosity = 0.4_dp   ! Porosity of the martian regolith for a random loose packing of monodisperse sphere, Scott 1960
    3029real(dp), parameter :: breccia_porosity  = 0.1_dp   ! Porosity of breccia
     
    255254
    256255!=======================================================================
    257 SUBROUTINE set_soil(TI)
     256SUBROUTINE set_soil(therm_initia)
    258257!-----------------------------------------------------------------------
    259258! NAME
     
    291290! ARGUMENTS
    292291! ---------
    293 real(dp), dimension(:,:,:), intent(inout) :: TI ! Thermal inertia in the PEM [SI]
     292real(dp), dimension(:,:,:), intent(inout) :: therm_initia ! Thermal inertia in the PEM [SI]
    294293
    295294! LOCAL VARIABLES
     
    334333    do islope = 1,nslope
    335334        do iloop = 1,nsoil_PCM
    336             TI(ig,iloop,islope) = TI_PCM(ig,iloop,islope)
     335            therm_initia(ig,iloop,islope) = TI_PCM(ig,iloop,islope)
    337336        end do
    338337        if (nsoil > nsoil_PCM) then
    339338            do iloop = nsoil_PCM + 1,nsoil
    340                 TI(ig,iloop,islope) = TI_PCM(ig,nsoil_PCM,islope)
     339                therm_initia(ig,iloop,islope) = TI_PCM(ig,nsoil_PCM,islope)
    341340            end do
    342341        end if
  • trunk/LMDZ.COMMON/libf/evolution/xios_data.F90

    r4110 r4136  
    6868logical(k4)                                  :: here
    6969integer(di)                                  :: islope, isoil, iday
     70real(dp), dimension(:),       allocatable    :: var_read_1d
    7071real(dp), dimension(:,:),     allocatable    :: var_read_2d
    7172real(dp), dimension(:,:,:),   allocatable    :: var_read_3d
    7273real(dp), dimension(:,:,:,:), allocatable    :: var_read_4d
    7374character(:),                 allocatable    :: num ! To read slope variables
    74 real(dp), dimension(ngrid,nsoil,nslope,nday) :: h2o_soildensity_ts
    7575
    7676! CODE
     
    157157! Allocate and read the variables
    158158deallocate(var_read_2d,var_read_3d)
    159 allocate(var_read_3d(nlon,nlat,nday),var_read_4d(nlon,nlat,nsoil_PCM,nday))
     159allocate(var_read_1d(ngrid),var_read_3d(nlon,nlat,nday),var_read_4d(nlon,nlat,nsoil_PCM,nday))
    160160call get_var_nc('ps',var_read_3d)
    161161do iday = 1,nday
     
    171171end do
    172172if (do_soil) then
     173    h2o_soildensity_avg(:,:,:) = 0._dp
    173174    do islope = 1,nslope
    174175        if (nslope /= 1) then
     
    189190        do iday = 1,nday
    190191            do isoil = 1,nsoil_PCM
    191                 call lonlat2vect(nlon,nlat,ngrid,var_read_4d(:,:,isoil,iday),h2o_soildensity_ts(:,isoil,islope,iday))
     192                call lonlat2vect(nlon,nlat,ngrid,var_read_4d(:,:,isoil,iday),var_read_1d)
     193                h2o_soildensity_avg(:,isoil,islope) = h2o_soildensity_avg(:,isoil,islope) + var_read_1d
    192194            end do
    193             do isoil = nsoil_PCM + 1,nsoil
    194                 h2o_soildensity_ts(:,isoil,islope,iday) = h2o_soildensity_ts(:,nsoil_PCM,islope,iday) ! Explicit initialization because dimension with size nsoil > nsoil_PCM
    195             end do
    196         end do
     195        end do
     196        ! Keep deep layers consistent with PCM bottom layer when nsoil > nsoil_PCM.
     197        h2o_soildensity_avg(:,nsoil_PCM + 1:nsoil,islope) = h2o_soildensity_avg(:,nsoil_PCM,islope)
    197198    end do
    198     h2o_soildensity_avg(:,:,:) = sum(h2o_soildensity_ts,4)/nday
     199    h2o_soildensity_avg(:,:,:) = h2o_soildensity_avg(:,:,:)/real(nday,dp)
    199200end if
    200 deallocate(var_read_3d,var_read_4d,num)
     201deallocate(var_read_1d,var_read_3d,var_read_4d,num)
    201202
    202203! Close the NetCDF file of XIOS outputs
Note: See TracChangeset for help on using the changeset viewer.