Index: /NEMO/releases/r4.0/r4.0-HEAD/src/ICE/iceistate.F90
===================================================================
--- /NEMO/releases/r4.0/r4.0-HEAD/src/ICE/iceistate.F90	(revision 15494)
+++ /NEMO/releases/r4.0/r4.0-HEAD/src/ICE/iceistate.F90	(revision 15495)
@@ -65,4 +65,7 @@
    TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   si  ! structure of input fields (file informations, fields read)
    !   
+#if defined key_agrif
+   REAL(wp), PUBLIC ::   rsshadj   !: initial mean ssh adjustment due to initial ice+snow mass
+#endif
    !!----------------------------------------------------------------------
    !! NEMO/ICE 4.0 , NEMO Consortium (2018)
@@ -94,5 +97,5 @@
       !!
       INTEGER  ::   ji, jj, jk, jl         ! dummy loop indices
-      REAL(wp) ::   ztmelts
+      REAL(wp) ::   ztmelts, zsshadj, area
       INTEGER , DIMENSION(4)           ::   itest
       REAL(wp), DIMENSION(jpi,jpj)     ::   zswitch    ! ice indicator
@@ -399,35 +402,56 @@
       ENDIF ! ln_iceini
       !
-      !----------------------------------------------
-      ! 4) Snow-ice mass (case ice is fully embedded)
-      !----------------------------------------------
+      !----------------------------------------------------------
+      ! 4) Adjust ssh and vertical scale factors to snow-ice mass
+      !----------------------------------------------------------
       snwice_mass  (:,:) = tmask(:,:,1) * SUM( rhos * v_s + rhoi * v_i + rhow * ( v_ip + v_il ), dim=3  )   ! snow+ice mass
       snwice_mass_b(:,:) = snwice_mass(:,:)
       !
       IF( ln_ice_embd ) THEN            ! embedded sea-ice: deplete the initial ssh below sea-ice area
-         !
+         !                              ! ----------------
          sshn(:,:) = sshn(:,:) - snwice_mass(:,:) * r1_rau0
          sshb(:,:) = sshb(:,:) - snwice_mass(:,:) * r1_rau0
          !
-         IF( .NOT.ln_linssh ) THEN
-            !
-            DO jk = 1, jpkm1            ! adjust initial vertical scale factors                
-               DO jj = 1, jpj
-                  DO ji = 1, jpi
-                     IF( snwice_mass(ji,jj) /= 0._wp ) THEN
-                        e3t_n(ji,jj,jk) = e3t_0(ji,jj,jk) * ( 1._wp + sshn(ji,jj) * tmask(ji,jj,jk) / ht_0(ji,jj) )
-                        e3t_b(ji,jj,jk) = e3t_n(ji,jj,jk)
-                        e3t_a(ji,jj,jk) = e3t_n(ji,jj,jk)
-                     ENDIF
-                  END DO
+      ELSE                              ! levitating sea-ice: deplete the initial ssh over the whole domain
+         !                              ! ------------------
+         area    = glob_sum( 'iceistate', e1e2t(:,:) * ssmask(:,:) )
+         zsshadj = glob_sum( 'iceistate', snwice_mass(:,:) * r1_rau0 * e1e2t(:,:) ) / area
+#if defined key_agrif
+         ! Override ssh adjustment in nested domains by the root-domain ssh adjustment;
+         ! store the adjustment value in a global module variable to make it retrievable in nested domains
+         IF( .NOT.Agrif_Root() ) THEN 
+            zsshadj = Agrif_Parent(rsshadj)
+         ELSE
+            rsshadj = zsshadj
+         ENDIF
+#endif
+         IF(lwp) WRITE(numout,'(A23,F10.6,A20)') ' sea level adjusted by ', -zsshadj, ' m to compensate for'
+         IF(lwp) WRITE(numout,*) ' the initial snow+ice mass'
+         !
+         WHERE( ssmask(:,:) == 1._wp )
+            sshn(:,:) = sshn(:,:) - zsshadj
+            sshb(:,:) = sshb(:,:) - zsshadj
+         ENDWHERE
+         !
+      ENDIF
+      
+      IF( .NOT.ln_linssh ) THEN
+         !
+         DO jk = 1, jpkm1            ! adjust initial vertical scale factors                
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  IF( snwice_mass(ji,jj) /= 0._wp ) THEN
+                     e3t_n(ji,jj,jk) = e3t_0(ji,jj,jk) * ( 1._wp + sshn(ji,jj) * tmask(ji,jj,jk) / ht_0(ji,jj) )
+                     e3t_b(ji,jj,jk) = e3t_n(ji,jj,jk)
+                     e3t_a(ji,jj,jk) = e3t_n(ji,jj,jk)
+                  ENDIF
                END DO
             END DO
-            !
-            CALL dom_vvl_zgr            ! interpolation of all scale factors 
-            !
-         ENDIF
+         END DO
+         !
+         CALL dom_vvl_zgr            ! interpolation of all scale factors 
          !
       ENDIF
-
+      !
 !!clem: output of initial state should be written here but it is impossible because
 !!      the ocean and ice are in the same file
