Index: trunk/LMDZ.COMMON/libf/evolution/changelog.txt
===================================================================
--- trunk/LMDZ.COMMON/libf/evolution/changelog.txt	(revision 4135)
+++ trunk/LMDZ.COMMON/libf/evolution/changelog.txt	(revision 4136)
@@ -914,2 +914,6 @@
 == 16/03/2026 == JBC
 Relocate Mars-specific parameters out of "planet" module and into the modules that own their physics domain.
+
+== 17/03/2026 == JBC
+- Temporary memory load reduced in "xios_data".
+- Rename local variables in procedures to avoid masking variables in parent scope.
Index: trunk/LMDZ.COMMON/libf/evolution/geometry.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/evolution/geometry.F90	(revision 4135)
+++ trunk/LMDZ.COMMON/libf/evolution/geometry.F90	(revision 4136)
@@ -153,5 +153,5 @@
 
 !=======================================================================
-SUBROUTINE lonlat2vect(nlon,nlat,ngrid,v_ll,v_vect)
+SUBROUTINE lonlat2vect(nlon_in,nlat_in,ngrid_in,v_ll,v_vect)
 !-----------------------------------------------------------------------
 ! NAME
@@ -180,7 +180,7 @@
 ! ARGUMENTS
 !----------
-integer(di),                    intent(in)  :: nlon, nlat, ngrid
-real(dp), dimension(nlon,nlat), intent(in)  :: v_ll
-real(dp), dimension(ngrid),     intent(out) :: v_vect
+integer(di),                          intent(in)  :: nlon_in, nlat_in, ngrid_in
+real(dp), dimension(nlon_in,nlat_in), intent(in)  :: v_ll
+real(dp), dimension(ngrid_in),        intent(out) :: v_vect
 
 ! LOCAL VARIABLES
@@ -190,10 +190,10 @@
 ! CODE
 !-----
-if (ngrid == 1) then ! 1D case
+if (ngrid_in == 1) then ! 1D case
     v_vect(1) = v_ll(1,1)
     return
 else ! 3D
     ! Check
-    if (ngrid /= nlon*(nlat - 2) + 2) call stop_clean(__FILE__,__LINE__,'problem of dimensions!',1)
+    if (ngrid_in /= nlon_in*(nlat_in - 2) + 2) call stop_clean(__FILE__,__LINE__,'problem of dimensions!',1)
 
     ! Initialization
@@ -202,10 +202,10 @@
     ! Treatment of the poles
     v_vect(1) = v_ll(1,1)
-    v_vect(ngrid) = v_ll(1,nlat)
+    v_vect(ngrid_in) = v_ll(1,nlat_in)
 
     ! Treatment of regular points
-    do j = 2,nlat - 1
-        do i = 1,nlon
-            v_vect(1 + i + (j - 2)*nlon) = v_ll(i,j)
+    do j = 2,nlat_in - 1
+        do i = 1,nlon_in
+            v_vect(1 + i + (j - 2)*nlon_in) = v_ll(i,j)
         end do
     end do
@@ -216,5 +216,5 @@
 
 !=======================================================================
-SUBROUTINE vect2lonlat(nlon,nlat,ngrid,v_vect,v_ll)
+SUBROUTINE vect2lonlat(nlon_in,nlat_in,ngrid_in,v_vect,v_ll)
 !-----------------------------------------------------------------------
 ! NAME
@@ -243,7 +243,7 @@
 ! ARGUMENTS
 !----------
-integer(di),                    intent(in)  :: nlon, nlat, ngrid
-real(dp), dimension(ngrid),     intent(in)  :: v_vect
-real(dp), dimension(nlon,nlat), intent(out) :: v_ll
+integer(di),                          intent(in)  :: nlon_in, nlat_in, ngrid_in
+real(dp), dimension(ngrid_in),        intent(in)  :: v_vect
+real(dp), dimension(nlon_in,nlat_in), intent(out) :: v_ll
 
 ! LOCAL VARIABLES
@@ -253,10 +253,10 @@
 ! CODE
 !-----
-if (ngrid == 1) then ! 1D case
+if (ngrid_in == 1) then ! 1D case
     v_ll(1,1) = v_vect(1)
     return
 else ! 3D
     ! Check
-    if (ngrid /= nlon*(nlat - 2) + 2) call stop_clean(__FILE__,__LINE__,'problem of dimensions!',1)
+    if (ngrid_in /= nlon_in*(nlat_in - 2) + 2) call stop_clean(__FILE__,__LINE__,'problem of dimensions!',1)
 
     ! Initialization
@@ -265,10 +265,10 @@
     ! Treatment of the poles
     v_ll(:,1) = v_vect(1)
-    v_ll(:,nlat) = v_vect(ngrid)
+    v_ll(:,nlat_in) = v_vect(ngrid_in)
 
     ! Treatment of regular points
-    do j = 2,nlat - 1
-        do i = 1,nlon
-            v_ll(i,j) = v_vect(1 + i + (j - 2)*nlon)
+    do j = 2,nlat_in - 1
+        do i = 1,nlon_in
+            v_ll(i,j) = v_vect(1 + i + (j - 2)*nlon_in)
         end do
     end do
@@ -279,5 +279,5 @@
 
 !=======================================================================
-SUBROUTINE dyngrd2vect(ni,nj,ngrid,v_dyn,v_vect)
+SUBROUTINE dyngrd2vect(ni,nj,ngrid_in,v_dyn,v_vect)
 !-----------------------------------------------------------------------
 ! NAME
@@ -306,7 +306,7 @@
 ! ARGUMENTS
 !----------
-integer(di),                intent(in)  :: ni, nj, ngrid
-real(dp), dimension(ni,nj), intent(in)  :: v_dyn
-real(dp), dimension(ngrid), intent(out) :: v_vect
+integer(di),                   intent(in)  :: ni, nj, ngrid_in
+real(dp), dimension(ni,nj),    intent(in)  :: v_dyn
+real(dp), dimension(ngrid_in), intent(out) :: v_vect
 
 ! LOCAL VARIABLES
@@ -316,10 +316,10 @@
 ! CODE
 !-----
-if (ngrid == 1) then ! 1D case
+if (ngrid_in == 1) then ! 1D case
     v_vect(1) = v_dyn(1,1)
     return
 else ! 3D
     ! Check
-    if (ngrid /= (ni - 1)*(nj - 2) + 2) call stop_clean(__FILE__,__LINE__,'problem of dimensions!',1)
+    if (ngrid_in /= (ni - 1)*(nj - 2) + 2) call stop_clean(__FILE__,__LINE__,'problem of dimensions!',1)
 
     ! Initialization
@@ -328,5 +328,5 @@
     ! Treatment of the poles
     v_vect(1) = v_dyn(1,1)
-    v_vect(ngrid) = v_dyn(1,nj)
+    v_vect(ngrid_in) = v_dyn(1,nj)
 
     ! Treatment of regular points
@@ -342,5 +342,5 @@
 
 !=======================================================================
-SUBROUTINE vect2dyngrd(ni,nj,ngrid,v_vect,v_dyn)
+SUBROUTINE vect2dyngrd(ni,nj,ngrid_in,v_vect,v_dyn)
 !-----------------------------------------------------------------------
 ! NAME
@@ -369,7 +369,7 @@
 ! ARGUMENTS
 !----------
-integer(di),                intent(in)  :: ni, nj, ngrid
-real(dp), dimension(ngrid), intent(in)  :: v_vect
-real(dp), dimension(ni,nj), intent(out) :: v_dyn
+integer(di),                   intent(in)  :: ni, nj, ngrid_in
+real(dp), dimension(ngrid_in), intent(in)  :: v_vect
+real(dp), dimension(ni,nj),    intent(out) :: v_dyn
 
 ! LOCAL VARIABLES
@@ -379,10 +379,10 @@
 ! CODE
 !-----
-if (ngrid == 1) then ! 1D case
+if (ngrid_in == 1) then ! 1D case
     v_dyn(1,1) = v_vect(1)
     return
 else ! 3D
     ! Check
-    if (ngrid /= (ni - 1)*(nj - 2) + 2) call stop_clean(__FILE__,__LINE__,'problem of dimensions!',1)
+    if (ngrid_in /= (ni - 1)*(nj - 2) + 2) call stop_clean(__FILE__,__LINE__,'problem of dimensions!',1)
 
     ! Initialization
@@ -391,5 +391,5 @@
     ! Treatment of the poles
     v_dyn(:,1) = v_vect(1)
-    v_dyn(:,nj) = v_vect(ngrid)
+    v_dyn(:,nj) = v_vect(ngrid_in)
 
     ! Treatment of regular points
Index: trunk/LMDZ.COMMON/libf/evolution/soil.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/evolution/soil.F90	(revision 4135)
+++ trunk/LMDZ.COMMON/libf/evolution/soil.F90	(revision 4136)
@@ -25,6 +25,5 @@
 ! PARAMETERS
 ! ----------
-! Density and porosity of regolith and breccia
-real(dp), parameter :: rho_regolith      = 2000._dp ! [kg/m^3], Zent et al. 1995; Buhler and Piqueux 2021
+real(dp), parameter :: rho_regolith      = 2000._dp ! Density of the martian regolith [kg/m^3], Zent et al. 1995; Buhler and Piqueux 2021
 real(dp), parameter :: regolith_porosity = 0.4_dp   ! Porosity of the martian regolith for a random loose packing of monodisperse sphere, Scott 1960
 real(dp), parameter :: breccia_porosity  = 0.1_dp   ! Porosity of breccia
@@ -255,5 +254,5 @@
 
 !=======================================================================
-SUBROUTINE set_soil(TI)
+SUBROUTINE set_soil(therm_initia)
 !-----------------------------------------------------------------------
 ! NAME
@@ -291,5 +290,5 @@
 ! ARGUMENTS
 ! ---------
-real(dp), dimension(:,:,:), intent(inout) :: TI ! Thermal inertia in the PEM [SI]
+real(dp), dimension(:,:,:), intent(inout) :: therm_initia ! Thermal inertia in the PEM [SI]
 
 ! LOCAL VARIABLES
@@ -334,9 +333,9 @@
     do islope = 1,nslope
         do iloop = 1,nsoil_PCM
-            TI(ig,iloop,islope) = TI_PCM(ig,iloop,islope)
+            therm_initia(ig,iloop,islope) = TI_PCM(ig,iloop,islope)
         end do
         if (nsoil > nsoil_PCM) then
             do iloop = nsoil_PCM + 1,nsoil
-                TI(ig,iloop,islope) = TI_PCM(ig,nsoil_PCM,islope)
+                therm_initia(ig,iloop,islope) = TI_PCM(ig,nsoil_PCM,islope)
             end do
         end if
Index: trunk/LMDZ.COMMON/libf/evolution/xios_data.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/evolution/xios_data.F90	(revision 4135)
+++ trunk/LMDZ.COMMON/libf/evolution/xios_data.F90	(revision 4136)
@@ -68,9 +68,9 @@
 logical(k4)                                  :: here
 integer(di)                                  :: islope, isoil, iday
+real(dp), dimension(:),       allocatable    :: var_read_1d
 real(dp), dimension(:,:),     allocatable    :: var_read_2d
 real(dp), dimension(:,:,:),   allocatable    :: var_read_3d
 real(dp), dimension(:,:,:,:), allocatable    :: var_read_4d
 character(:),                 allocatable    :: num ! To read slope variables
-real(dp), dimension(ngrid,nsoil,nslope,nday) :: h2o_soildensity_ts
 
 ! CODE
@@ -157,5 +157,5 @@
 ! Allocate and read the variables
 deallocate(var_read_2d,var_read_3d)
-allocate(var_read_3d(nlon,nlat,nday),var_read_4d(nlon,nlat,nsoil_PCM,nday))
+allocate(var_read_1d(ngrid),var_read_3d(nlon,nlat,nday),var_read_4d(nlon,nlat,nsoil_PCM,nday))
 call get_var_nc('ps',var_read_3d)
 do iday = 1,nday
@@ -171,4 +171,5 @@
 end do
 if (do_soil) then
+    h2o_soildensity_avg(:,:,:) = 0._dp
     do islope = 1,nslope
         if (nslope /= 1) then
@@ -189,14 +190,14 @@
         do iday = 1,nday
             do isoil = 1,nsoil_PCM
-                call lonlat2vect(nlon,nlat,ngrid,var_read_4d(:,:,isoil,iday),h2o_soildensity_ts(:,isoil,islope,iday))
+                call lonlat2vect(nlon,nlat,ngrid,var_read_4d(:,:,isoil,iday),var_read_1d)
+                h2o_soildensity_avg(:,isoil,islope) = h2o_soildensity_avg(:,isoil,islope) + var_read_1d
             end do
-            do isoil = nsoil_PCM + 1,nsoil
-                h2o_soildensity_ts(:,isoil,islope,iday) = h2o_soildensity_ts(:,nsoil_PCM,islope,iday) ! Explicit initialization because dimension with size nsoil > nsoil_PCM
-            end do
-        end do
+        end do
+        ! Keep deep layers consistent with PCM bottom layer when nsoil > nsoil_PCM.
+        h2o_soildensity_avg(:,nsoil_PCM + 1:nsoil,islope) = h2o_soildensity_avg(:,nsoil_PCM,islope)
     end do
-    h2o_soildensity_avg(:,:,:) = sum(h2o_soildensity_ts,4)/nday
+    h2o_soildensity_avg(:,:,:) = h2o_soildensity_avg(:,:,:)/real(nday,dp)
 end if
-deallocate(var_read_3d,var_read_4d,num)
+deallocate(var_read_1d,var_read_3d,var_read_4d,num)
 
 ! Close the NetCDF file of XIOS outputs
