Index: trunk/LMDZ.MARS/changelog.txt
===================================================================
--- trunk/LMDZ.MARS/changelog.txt	(revision 4176)
+++ trunk/LMDZ.MARS/changelog.txt	(revision 4177)
@@ -5167,2 +5167,8 @@
 - Updating xml files accordingly.
 - Switching localtime and zrecast back to previous version (undoing changes in r4161).
+
+== 09/04/2026 == JM
+- Adding write_output for inertiedat.
+- Adding an icelocationmode = 6 that uses surface thermal inertia to
+prescribe watercaptag. Can be irrelevant if the spatial resolution is too
+coarse.
Index: trunk/LMDZ.MARS/libf/phymars/physiq_mod.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/physiq_mod.F	(revision 4176)
+++ trunk/LMDZ.MARS/libf/phymars/physiq_mod.F	(revision 4177)
@@ -3339,4 +3339,6 @@
          call write_output("watercaptag","Watercap tag"
      &         ,"Boolean",watercaptag(:))
+         call write_output("inertiedat","Soil inertia",
+     &                 "J/kg/K",inertiedat(:,:))
          if (grid_type == regular_lonlat) then
            call write_output("area","Mesh area","m2",
@@ -3447,5 +3449,5 @@
      &                 "K",tsoil(:,:,iflat))
       call write_output("inertiedat","Soil inertia",
-     &                 "K",inertiedat(:,:))
+     &                 "J/kg/K",inertiedat(:,:))
 #endif
 
Index: trunk/LMDZ.MARS/libf/phymars/surfini_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/surfini_mod.F90	(revision 4176)
+++ trunk/LMDZ.MARS/libf/phymars/surfini_mod.F90	(revision 4177)
@@ -9,4 +9,6 @@
 ! icelocationmode = 4 ---> predefined 64x48 but usable with every
 ! resolution, and easily adaptable for dynamico
+! icelocationmode = 5 ---> uses the watercaptag as stored in startfi.nc
+! icelocationmode = 6 ---> build watercaptag based on surface line from inertiedat
 ! For visualisation : > /u/tnalmd/bin/watercaps gcm_txt_output_file
 integer :: icelocationmode = 5
@@ -32,4 +34,5 @@
       use mod_phys_lmdz_para, only : is_master, gather, scatter
 #endif
+      use comsoil_h, only: inertiedat, nsoilmx
       USE comcstfi_h, ONLY: pi
       use mod_grid_phy_lmdz, only: nbp_lon, nbp_lat
@@ -112,4 +115,5 @@
 #if CPP_PARA
       logical watercaptag_glo(klon_glo)
+      real inertiedat_glo(klon_glo,nsoilmx)
       real dryness_glo(klon_glo)
       real lati_glo(klon_glo)
@@ -117,4 +121,5 @@
 #else
       logical watercaptag_glo(ngrid)
+      real inertiedat_glo(ngrid,nsoilmx)
       real dryness_glo(ngrid)
       real lati_glo(ngrid)
@@ -172,4 +177,5 @@
       call gather(longitude,long_glo)
       call gather(watercaptag,watercaptag_glo)
+      call gather(inertiedat,inertiedat_glo)
 
       if (is_master) then
@@ -449,8 +455,27 @@
          write(*,*)'Surfini: ice caps defined using startfi.nc data'
 
+            case(6) ! icelocationmode == 6
+
+         ! CAUTION (JM): this mode is irrelevant for too coarse spatial
+         ! resolutions (irrelevant for 64x48 in lonlat and nbp=15 in dynamico
+         ! for instance).
+         write(*,*)'icelocationmode = 6'
+         write(*,*)'Surfini: ice caps defined using surface inertiedat (first line)'
+
+         ! North pole always has an ice cap, South pole doesn't as
+         ! we only consider North hemisphere
+         watercaptag_glo(1) = .true.
+         watercaptag_glo(klon_glo) = .false.
+         do ig=2, klon_glo-1
+            if ((inertiedat_glo(ig,1) > min_icevalue).and. &
+                (lati_glo(ig)>0.)) then
+              watercaptag_glo(ig) = .true.
+            endif 
+         enddo 
+
             case default
 
          write(*,*) 'In surfini.F, icelocationmode is ', icelocationmode
-         write(*,*) 'It should be 1, 2, 3, 4 or 5 (default is 5)'
+         write(*,*) 'It should be 1, 2, 3, 4, 5 or 6 (default is 5)'
          call abort_physic("surfini","wrong icelocationmode",1)
 
