Index: CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/context_nemo.xml
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/context_nemo.xml	(revision 6119)
+++ CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/context_nemo.xml	(revision 6152)
@@ -11,5 +11,5 @@
        <variable id="ref_month" type="int"> 01 </variable>
        <variable id="ref_day"   type="int"> 01 </variable>
-       <variable id="rau0"      type="float" > 1026.0 </variable>
+       <variable id="rho0"      type="float" > 1026.0 </variable>
        <variable id="cpocean"   type="float" > 3991.86795711963 </variable>
        <variable id="convSpsu"  type="float" > 0.99530670233846  </variable>
Index: CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/cpl_oasis3.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/cpl_oasis3.F90	(revision 6119)
+++ CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/cpl_oasis3.F90	(revision 6152)
@@ -14,5 +14,5 @@
    !!            3.6  !  2014-11  (S. Masson) OASIS3-MCT
    !!----------------------------------------------------------------------
-   
+
    !!----------------------------------------------------------------------
    !!   'key_oasis3'                    coupled Ocean/Atmosphere via OASIS3-MCT
@@ -64,18 +64,15 @@
 #endif
 
-   INTEGER                    ::   nrcv         ! total number of fields received 
-   INTEGER                    ::   nsnd         ! total number of fields sent 
+   INTEGER                    ::   nrcv         ! total number of fields received
+   INTEGER                    ::   nsnd         ! total number of fields sent
    INTEGER                    ::   ncplmodel    ! Maximum number of models to/from which NEMO is potentialy sending/receiving data
-   INTEGER, PUBLIC, PARAMETER ::   nmaxfld=60   ! Maximum number of coupling fields
+   INTEGER, PUBLIC, PARAMETER ::   nmaxfld=62   ! Maximum number of coupling fields
    INTEGER, PUBLIC, PARAMETER ::   nmaxcat=5    ! Maximum number of coupling fields
    INTEGER, PUBLIC, PARAMETER ::   nmaxcpl=5    ! Maximum number of coupling fields
-   LOGICAL, PARAMETER         ::   ltmp_wapatch = .TRUE.   ! patch to restore wraparound rows in cpl_send, cpl_rcv, cpl_define  
-   INTEGER                    ::   nldi_save, nlei_save
-   INTEGER                    ::   nldj_save, nlej_save
-   
+
    TYPE, PUBLIC ::   FLD_CPL               !: Type for coupling field information
       LOGICAL               ::   laction   ! To be coupled or not
-      CHARACTER(len = 8)    ::   clname    ! Name of the coupling field   
-      CHARACTER(len = 1)    ::   clgrid    ! Grid type  
+      CHARACTER(len = 8)    ::   clname    ! Name of the coupling field
+      CHARACTER(len = 1)    ::   clgrid    ! Grid type
       REAL(wp)              ::   nsgn      ! Control of the sign change
       INTEGER, DIMENSION(nmaxcat,nmaxcpl) ::   nid   ! Id of the field (no more than 9 categories and 9 extrena models)
@@ -90,5 +87,5 @@
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
-   !! $Id: cpl_oasis3.F90 12132 2019-12-10 10:38:28Z smasson $
+   !! $Id: cpl_oasis3.F90 14434 2021-02-11 08:20:52Z smasson $
    !! Software governed by the CeCILL license (see ./LICENSE)
    !!----------------------------------------------------------------------
@@ -102,5 +99,5 @@
       !!    exchange between AGCM, OGCM and COUPLER. (OASIS3 software)
       !!
-      !! ** Method  :   OASIS3 MPI communication 
+      !! ** Method  :   OASIS3 MPI communication
       !!--------------------------------------------------------------------
       CHARACTER(len = *), INTENT(in   ) ::   cd_modname   ! model name as set in namcouple file
@@ -115,13 +112,13 @@
       !------------------------------------------------------------------
       CALL oasis_init_comp ( ncomp_id, TRIM(cd_modname), nerror )
-      IF ( nerror /= OASIS_Ok ) &
+      IF( nerror /= OASIS_Ok ) &
          CALL oasis_abort (ncomp_id, 'cpl_init', 'Failure in oasis_init_comp')
 
       !------------------------------------------------------------------
-      ! 3rd Get an MPI communicator for OPA local communication
+      ! 3rd Get an MPI communicator for OCE local communication
       !------------------------------------------------------------------
 
       CALL oasis_get_localcomm ( kl_comm, nerror )
-      IF ( nerror /= OASIS_Ok ) &
+      IF( nerror /= OASIS_Ok ) &
          CALL oasis_abort (ncomp_id, 'cpl_init','Failure in oasis_get_localcomm' )
       !
@@ -136,5 +133,5 @@
       !!    exchange between AGCM, OGCM and COUPLER. (OASIS3 software)
       !!
-      !! ** Method  :   OASIS3 MPI communication 
+      !! ** Method  :   OASIS3 MPI communication
       !!--------------------------------------------------------------------
       INTEGER, INTENT(in) ::   krcv, ksnd     ! Number of received and sent coupling fields
@@ -149,13 +146,4 @@
       !!--------------------------------------------------------------------
 
-      ! patch to restore wraparound rows in cpl_send, cpl_rcv, cpl_define
-      IF ( ltmp_wapatch ) THEN
-         nldi_save = nldi   ;   nlei_save = nlei
-         nldj_save = nldj   ;   nlej_save = nlej
-         IF( nimpp           ==      1 ) nldi = 1
-         IF( nimpp + jpi - 1 == jpiglo ) nlei = jpi
-         IF( njmpp           ==      1 ) nldj = 1
-         IF( njmpp + jpj - 1 == jpjglo ) nlej = jpj
-      ENDIF 
       IF(lwp) WRITE(numout,*)
       IF(lwp) WRITE(numout,*) 'cpl_define : initialization in coupled ocean/atmosphere case'
@@ -178,16 +166,14 @@
       ENDIF
       !
-      ! ... Define the shape for the area that excludes the halo
-      !     For serial configuration (key_mpp_mpi not being active)
-      !     nl* is set to the global values 1 and jp*glo.
+      ! ... Define the shape for the area that excludes the halo as we don't want them to be "seen" by oasis
       !
       ishape(1) = 1
-      ishape(2) = nlei-nldi+1
+      ishape(2) = Ni_0
       ishape(3) = 1
-      ishape(4) = nlej-nldj+1
+      ishape(4) = Nj_0
       !
       ! ... Allocate memory for data exchange
       !
-      ALLOCATE(exfld(nlei-nldi+1, nlej-nldj+1), stat = nerror)
+      ALLOCATE(exfld(Ni_0, Nj_0), stat = nerror)        ! allocate only inner domain (without halos)
       IF( nerror > 0 ) THEN
          CALL oasis_abort ( ncomp_id, 'cpl_define', 'Failure in allocating exfld')   ;   RETURN
@@ -195,28 +181,28 @@
       !
       ! -----------------------------------------------------------------
-      ! ... Define the partition 
+      ! ... Define the partition, excluding halos as we don't want them to be "seen" by oasis
       ! -----------------------------------------------------------------
-      
-      paral(1) = 2                                              ! box partitioning
-      paral(2) = jpiglo * (nldj-1+njmpp-1) + (nldi-1+nimpp-1)   ! NEMO lower left corner global offset    
-      paral(3) = nlei-nldi+1                                    ! local extent in i 
-      paral(4) = nlej-nldj+1                                    ! local extent in j
-      paral(5) = jpiglo                                         ! global extent in x
-      
-      IF( ln_ctl ) THEN
+
+      paral(1) = 2                                      ! box partitioning
+      paral(2) = Ni0glo * mjg0(nn_hls) + mig0(nn_hls)   ! NEMO lower left corner global offset, without halos
+      paral(3) = Ni_0                                   ! local extent in i, excluding halos
+      paral(4) = Nj_0                                   ! local extent in j, excluding halos
+      paral(5) = Ni0glo                                 ! global extent in x, excluding halos
+
+      IF( sn_cfctl%l_oasout ) THEN
          WRITE(numout,*) ' multiexchg: paral (1:5)', paral
-         WRITE(numout,*) ' multiexchg: jpi, jpj =', jpi, jpj
-         WRITE(numout,*) ' multiexchg: nldi, nlei, nimpp =', nldi, nlei, nimpp
-         WRITE(numout,*) ' multiexchg: nldj, nlej, njmpp =', nldj, nlej, njmpp
-      ENDIF
-   
-      CALL oasis_def_partition ( id_part, paral, nerror, jpiglo*jpjglo )
-      !
-      ! ... Announce send variables. 
+         WRITE(numout,*) ' multiexchg: Ni_0, Nj_0 =', Ni_0, Nj_0
+         WRITE(numout,*) ' multiexchg: Nis0, Nie0, nimpp =', Nis0, Nie0, nimpp
+         WRITE(numout,*) ' multiexchg: Njs0, Nje0, njmpp =', Njs0, Nje0, njmpp
+      ENDIF
+
+      CALL oasis_def_partition ( id_part, paral, nerror, Ni0glo*Nj0glo )   ! global number of points, excluding halos
+      !
+      ! ... Announce send variables.
       !
       ssnd(:)%ncplmodel = kcplmodel
       !
       DO ji = 1, ksnd
-         IF ( ssnd(ji)%laction ) THEN
+         IF( ssnd(ji)%laction ) THEN
 
             IF( ssnd(ji)%nct > nmaxcat ) THEN
@@ -225,9 +211,9 @@
                RETURN
             ENDIF
-            
+
             DO jc = 1, ssnd(ji)%nct
                DO jm = 1, kcplmodel
 
-                  IF ( ssnd(ji)%nct .GT. 1 ) THEN
+                  IF( ssnd(ji)%nct .GT. 1 ) THEN
                      WRITE(cli2,'(i2.2)') jc
                      zclname = TRIM(ssnd(ji)%clname)//'_cat'//cli2
@@ -235,22 +221,22 @@
                      zclname = ssnd(ji)%clname
                   ENDIF
-                  IF ( kcplmodel  > 1 ) THEN
+                  IF( kcplmodel  > 1 ) THEN
                      WRITE(cli2,'(i2.2)') jm
                      zclname = 'model'//cli2//'_'//TRIM(zclname)
                   ENDIF
 #if defined key_agrif
-                  IF( agrif_fixed() /= 0 ) THEN 
+                  IF( agrif_fixed() /= 0 ) THEN
                      zclname=TRIM(Agrif_CFixed())//'_'//TRIM(zclname)
-                  END IF
-#endif
-                  IF( ln_ctl ) WRITE(numout,*) "Define", ji, jc, jm, " "//TRIM(zclname), " for ", OASIS_Out
+                  ENDIF
+#endif
+                  IF( sn_cfctl%l_oasout ) WRITE(numout,*) "Define", ji, jc, jm, " "//TRIM(zclname), " for ", OASIS_Out
                   CALL oasis_def_var (ssnd(ji)%nid(jc,jm), zclname, id_part   , (/ 2, 1 /),   &
                      &                OASIS_Out          , ishape , OASIS_REAL, nerror )
-                  IF ( nerror /= OASIS_Ok ) THEN
+                  IF( nerror /= OASIS_Ok ) THEN
                      WRITE(numout,*) 'Failed to define transient ', ji, jc, jm, " "//TRIM(zclname)
                      CALL oasis_abort ( ssnd(ji)%nid(jc,jm), 'cpl_define', 'Failure in oasis_def_var' )
                   ENDIF
-                  IF( ln_ctl .AND. ssnd(ji)%nid(jc,jm) /= -1 ) WRITE(numout,*) "variable defined in the namcouple"
-                  IF( ln_ctl .AND. ssnd(ji)%nid(jc,jm) == -1 ) WRITE(numout,*) "variable NOT defined in the namcouple"
+                  IF( sn_cfctl%l_oasout .AND. ssnd(ji)%nid(jc,jm) /= -1 ) WRITE(numout,*) "variable defined in the namcouple"
+                  IF( sn_cfctl%l_oasout .AND. ssnd(ji)%nid(jc,jm) == -1 ) WRITE(numout,*) "variable NOT defined in the namcouple"
                END DO
             END DO
@@ -258,11 +244,11 @@
       END DO
       !
-      ! ... Announce received variables. 
+      ! ... Announce received variables.
       !
       srcv(:)%ncplmodel = kcplmodel
       !
       DO ji = 1, krcv
-         IF ( srcv(ji)%laction ) THEN 
-            
+         IF( srcv(ji)%laction ) THEN
+
             IF( srcv(ji)%nct > nmaxcat ) THEN
                CALL oasis_abort ( ncomp_id, 'cpl_define', 'Number of categories of '//   &
@@ -270,9 +256,9 @@
                RETURN
             ENDIF
-            
+
             DO jc = 1, srcv(ji)%nct
                DO jm = 1, kcplmodel
-                  
-                  IF ( srcv(ji)%nct .GT. 1 ) THEN
+
+                  IF( srcv(ji)%nct .GT. 1 ) THEN
                      WRITE(cli2,'(i2.2)') jc
                      zclname = TRIM(srcv(ji)%clname)//'_cat'//cli2
@@ -280,22 +266,22 @@
                      zclname = srcv(ji)%clname
                   ENDIF
-                  IF ( kcplmodel  > 1 ) THEN
+                  IF( kcplmodel  > 1 ) THEN
                      WRITE(cli2,'(i2.2)') jm
                      zclname = 'model'//cli2//'_'//TRIM(zclname)
                   ENDIF
 #if defined key_agrif
-                  IF( agrif_fixed() /= 0 ) THEN 
+                  IF( agrif_fixed() /= 0 ) THEN
                      zclname=TRIM(Agrif_CFixed())//'_'//TRIM(zclname)
-                  END IF
-#endif
-                  IF( ln_ctl ) WRITE(numout,*) "Define", ji, jc, jm, " "//TRIM(zclname), " for ", OASIS_In
+                  ENDIF
+#endif
+                  IF( sn_cfctl%l_oasout ) WRITE(numout,*) "Define", ji, jc, jm, " "//TRIM(zclname), " for ", OASIS_In
                   CALL oasis_def_var (srcv(ji)%nid(jc,jm), zclname, id_part   , (/ 2, 1 /),   &
                      &                OASIS_In           , ishape , OASIS_REAL, nerror )
-                  IF ( nerror /= OASIS_Ok ) THEN
+                  IF( nerror /= OASIS_Ok ) THEN
                      WRITE(numout,*) 'Failed to define transient ', ji, jc, jm, " "//TRIM(zclname)
                      CALL oasis_abort ( srcv(ji)%nid(jc,jm), 'cpl_define', 'Failure in oasis_def_var' )
                   ENDIF
-                  IF( ln_ctl .AND. srcv(ji)%nid(jc,jm) /= -1 ) WRITE(numout,*) "variable defined in the namcouple"
-                  IF( ln_ctl .AND. srcv(ji)%nid(jc,jm) == -1 ) WRITE(numout,*) "variable NOT defined in the namcouple"
+                  IF( sn_cfctl%l_oasout .AND. srcv(ji)%nid(jc,jm) /= -1 ) WRITE(numout,*) "variable defined in the namcouple"
+                  IF( sn_cfctl%l_oasout .AND. srcv(ji)%nid(jc,jm) == -1 ) WRITE(numout,*) "variable NOT defined in the namcouple"
 
                END DO
@@ -303,11 +289,12 @@
          ENDIF
       END DO
-      
+
       !------------------------------------------------------------------
       ! End of definition phase
       !------------------------------------------------------------------
-      !     
+      !
 #if defined key_agrif
-      IF( agrif_fixed() == Agrif_Nb_Fine_Grids() ) THEN
+      ! Warning: Agrif_Nb_Fine_Grids not yet defined at this stage for Agrif_Root -> must use Agrif_Root_Only()
+      IF( Agrif_Root_Only() .OR. agrif_fixed() == Agrif_Nb_Fine_Grids() ) THEN
 #endif
       CALL xios_oasis_enddef()
@@ -318,11 +305,7 @@
 #endif
       !
-      IF ( ltmp_wapatch ) THEN
-         nldi = nldi_save   ;   nlei = nlei_save
-         nldj = nldj_save   ;   nlej = nlej_save
-      ENDIF
    END SUBROUTINE cpl_define
-   
-   
+
+
    SUBROUTINE cpl_snd( kid, kstep, pdata, kinfo )
       !!---------------------------------------------------------------------
@@ -339,13 +322,4 @@
       INTEGER                                   ::   jc,jm     ! local loop index
       !!--------------------------------------------------------------------
-      ! patch to restore wraparound rows in cpl_send, cpl_rcv, cpl_define
-      IF ( ltmp_wapatch ) THEN
-         nldi_save = nldi   ;   nlei_save = nlei
-         nldj_save = nldj   ;   nlej_save = nlej
-         IF( nimpp           ==      1 ) nldi = 1
-         IF( nimpp + jpi - 1 == jpiglo ) nlei = jpi
-         IF( njmpp           ==      1 ) nldj = 1
-         IF( njmpp + jpj - 1 == jpjglo ) nlej = jpj
-      ENDIF
       !
       ! snd data to OASIS3
@@ -353,9 +327,9 @@
       DO jc = 1, ssnd(kid)%nct
          DO jm = 1, ssnd(kid)%ncplmodel
-        
-            IF( ssnd(kid)%nid(jc,jm) /= -1 ) THEN
-               CALL oasis_put ( ssnd(kid)%nid(jc,jm), kstep, pdata(nldi:nlei, nldj:nlej,jc), kinfo )
-               
-               IF ( ln_ctl ) THEN        
+
+            IF( ssnd(kid)%nid(jc,jm) /= -1 ) THEN   ! exclude halos from data sent to oasis
+               CALL oasis_put ( ssnd(kid)%nid(jc,jm), kstep, pdata(Nis0:Nie0, Njs0:Nje0,jc), kinfo )
+
+               IF ( sn_cfctl%l_oasout ) THEN
                   IF ( kinfo == OASIS_Sent     .OR. kinfo == OASIS_ToRest .OR.   &
                      & kinfo == OASIS_SentOut  .OR. kinfo == OASIS_ToRestOut ) THEN
@@ -365,19 +339,15 @@
                      WRITE(numout,*) 'oasis_put:  kstep ', kstep
                      WRITE(numout,*) 'oasis_put:   info ', kinfo
-                     WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(nldi:nlei,nldj:nlej,jc))
-                     WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(nldi:nlei,nldj:nlej,jc))
-                     WRITE(numout,*) '     -     Sum value is ', SUM(pdata(nldi:nlei,nldj:nlej,jc))
+                     WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(Nis0:Nie0,Njs0:Nje0,jc))
+                     WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(Nis0:Nie0,Njs0:Nje0,jc))
+                     WRITE(numout,*) '     -     Sum value is ',    SUM(pdata(Nis0:Nie0,Njs0:Nje0,jc))
                      WRITE(numout,*) '****************'
                   ENDIF
                ENDIF
-               
+
             ENDIF
-            
+
          ENDDO
       ENDDO
-      IF ( ltmp_wapatch ) THEN
-         nldi = nldi_save   ;   nlei = nlei_save
-         nldj = nldj_save   ;   nlej = nlej_save
-      ENDIF
       !
     END SUBROUTINE cpl_snd
@@ -398,11 +368,6 @@
       !!
       INTEGER                                   ::   jc,jm     ! local loop index
-      LOGICAL                                   ::   llaction, llfisrt
+      LOGICAL                                   ::   llaction, ll_1st
       !!--------------------------------------------------------------------
-      ! patch to restore wraparound rows in cpl_send, cpl_rcv, cpl_define
-      IF ( ltmp_wapatch ) THEN
-         nldi_save = nldi   ;   nlei_save = nlei
-         nldj_save = nldj   ;   nlej_save = nlej
-      ENDIF
       !
       ! receive local data from OASIS3 on every process
@@ -411,11 +376,5 @@
       !
       DO jc = 1, srcv(kid)%nct
-         IF ( ltmp_wapatch ) THEN
-            IF( nimpp           ==      1 ) nldi = 1
-            IF( nimpp + jpi - 1 == jpiglo ) nlei = jpi
-            IF( njmpp           ==      1 ) nldj = 1
-            IF( njmpp + jpj - 1 == jpjglo ) nlej = jpj
-         ENDIF
-         llfisrt = .TRUE.
+         ll_1st = .TRUE.
 
          DO jm = 1, srcv(kid)%ncplmodel
@@ -423,22 +382,24 @@
             IF( srcv(kid)%nid(jc,jm) /= -1 ) THEN
 
-               CALL oasis_get ( srcv(kid)%nid(jc,jm), kstep, exfld, kinfo )         
-               
+               CALL oasis_get ( srcv(kid)%nid(jc,jm), kstep, exfld, kinfo )
+
                llaction =  kinfo == OASIS_Recvd   .OR. kinfo == OASIS_FromRest .OR.   &
                   &        kinfo == OASIS_RecvOut .OR. kinfo == OASIS_FromRestOut
-               
-               IF ( ln_ctl )   WRITE(numout,*) "llaction, kinfo, kstep, ivarid: " , llaction, kinfo, kstep, srcv(kid)%nid(jc,jm)
-               
-               IF ( llaction ) THEN
-                  
+
+               IF ( sn_cfctl%l_oasout )   &
+                  &  WRITE(numout,*) "llaction, kinfo, kstep, ivarid: " , llaction, kinfo, kstep, srcv(kid)%nid(jc,jm)
+
+               IF( llaction ) THEN   ! data received from oasis do not include halos
+
                   kinfo = OASIS_Rcv
-                  IF( llfisrt ) THEN 
-                     pdata(nldi:nlei,nldj:nlej,jc) =                                 exfld(:,:) * pmask(nldi:nlei,nldj:nlej,jm)
-                     llfisrt = .FALSE.
+                  IF( ll_1st ) THEN
+                     pdata(Nis0:Nie0,Njs0:Nje0,jc) =   exfld(:,:) * pmask(Nis0:Nie0,Njs0:Nje0,jm)
+                     ll_1st = .FALSE.
                   ELSE
-                     pdata(nldi:nlei,nldj:nlej,jc) = pdata(nldi:nlei,nldj:nlej,jc) + exfld(:,:) * pmask(nldi:nlei,nldj:nlej,jm)
-                  ENDIF
-                  
-                  IF ( ln_ctl ) THEN        
+                     pdata(Nis0:Nie0,Njs0:Nje0,jc) = pdata(Nis0:Nie0,Njs0:Nje0,jc)   &
+                        &                                + exfld(:,:) * pmask(Nis0:Nie0,Njs0:Nje0,jm)
+                  ENDIF
+
+                  IF ( sn_cfctl%l_oasout ) THEN
                      WRITE(numout,*) '****************'
                      WRITE(numout,*) 'oasis_get: Incoming ', srcv(kid)%clname
@@ -446,26 +407,21 @@
                      WRITE(numout,*) 'oasis_get:   kstep', kstep
                      WRITE(numout,*) 'oasis_get:   info ', kinfo
-                     WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(nldi:nlei,nldj:nlej,jc))
-                     WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(nldi:nlei,nldj:nlej,jc))
-                     WRITE(numout,*) '     -     Sum value is ', SUM(pdata(nldi:nlei,nldj:nlej,jc))
+                     WRITE(numout,*) '     - Minimum value is ', MINVAL(pdata(Nis0:Nie0,Njs0:Nje0,jc))
+                     WRITE(numout,*) '     - Maximum value is ', MAXVAL(pdata(Nis0:Nie0,Njs0:Nje0,jc))
+                     WRITE(numout,*) '     -     Sum value is ',    SUM(pdata(Nis0:Nie0,Njs0:Nje0,jc))
                      WRITE(numout,*) '****************'
                   ENDIF
-                  
+
                ENDIF
-               
+
             ENDIF
-            
+
          ENDDO
 
-         IF ( ltmp_wapatch ) THEN
-            nldi = nldi_save   ;   nlei = nlei_save
-            nldj = nldj_save   ;   nlej = nlej_save
+         !--- we must call lbc_lnk to fill the halos that where not received.
+         IF( .NOT. ll_1st ) THEN
+            CALL lbc_lnk( 'cpl_oasis3', pdata(:,:,jc), srcv(kid)%clgrid, srcv(kid)%nsgn )
          ENDIF
-         !--- Fill the overlap areas and extra hallows (mpp)
-         !--- check periodicity conditions (all cases)
-         IF( .not. llfisrt ) THEN
-            CALL lbc_lnk( 'cpl_oasis3', pdata(:,:,jc), srcv(kid)%clgrid, srcv(kid)%nsgn )   
-         ENDIF
- 
+
       ENDDO
       !
@@ -473,5 +429,5 @@
 
 
-   INTEGER FUNCTION cpl_freq( cdfieldname )  
+   INTEGER FUNCTION cpl_freq( cdfieldname )
       !!---------------------------------------------------------------------
       !!              ***  ROUTINE cpl_freq  ***
@@ -491,5 +447,5 @@
       !
       DO ji = 1, nsnd
-         IF (ssnd(ji)%laction ) THEN
+         IF(ssnd(ji)%laction ) THEN
             DO jm = 1, ncplmodel
                IF( ssnd(ji)%nid(1,jm) /= -1 ) THEN
@@ -503,5 +459,5 @@
       ENDDO
       DO ji = 1, nrcv
-         IF (srcv(ji)%laction ) THEN
+         IF(srcv(ji)%laction ) THEN
             DO jm = 1, ncplmodel
                IF( srcv(ji)%nid(1,jm) /= -1 ) THEN
@@ -516,5 +472,5 @@
       !
       IF( id /= -1 ) THEN
-#if  defined key_oa3mct_v3
+#if  defined key_oa3mct_v1v2
          CALL oasis_get_freqs(id, mop, 1, itmp, info)
 #else
@@ -537,9 +493,9 @@
       !
       DEALLOCATE( exfld )
-      IF (nstop == 0) THEN
-         CALL oasis_terminate( nerror )         
+      IF(nstop == 0) THEN
+         CALL oasis_terminate( nerror )
       ELSE
          CALL oasis_abort( ncomp_id, "cpl_finalize", "NEMO ABORT STOP" )
-      ENDIF       
+      ENDIF
       !
    END SUBROUTINE cpl_finalize
@@ -591,5 +547,5 @@
       WRITE(numout,*) 'oasis_enddef: Error you sould not be there...'
    END SUBROUTINE oasis_enddef
-  
+
    SUBROUTINE oasis_put(k1,k2,p1,k3)
       REAL(wp), DIMENSION(:,:), INTENT(in   ) ::  p1
@@ -621,5 +577,5 @@
       WRITE(numout,*) 'oasis_terminate: Error you sould not be there...'
    END SUBROUTINE oasis_terminate
-   
+
 #endif
 
Index: CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/file_def_nemo-ice_ORCA1.xml
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/file_def_nemo-ice_ORCA1.xml	(revision 6119)
+++ CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/file_def_nemo-ice_ORCA1.xml	(revision 6152)
@@ -67,8 +67,7 @@
          <field field_ref="icestr"           name="sistre"  level="2" />
          <field field_ref="normstr"          name="normstr" level="2"/>
-         <field field_ref="sheastr"          name="sheastr" level="2" />
-         <field field_ref="isig1"            name="isig1"   level="2" />
-         <field field_ref="isig2"            name="isig2"   level="2" />
-         <field field_ref="isig3"            name="isig3"   level="2" />
+	 <field field_ref="sheastr"          name="sheastr" level="2" />
+         <field field_ref="sig1_pnorm"       name="sig1_pnorm"  level="2" />
+         <field field_ref="sig2_pnorm"       name="sig2_pnorm" level="2"/>
        <!-- heat fluxes -->
          <field field_ref="qt_oce_ai"        name="qt_oce_ai"   level="2" />
@@ -85,14 +84,20 @@
          <field field_ref="hfxcndbot"        name="hfxcndbot"  level="2" />
          <field field_ref="hfxsensib"        name="hfxsensib"  level="2" />
-
+         <field field_ref="hfxsub"           name="hfxsub"     level="2" />
+         <field field_ref="hfxspr"           name="hfxspr"     level="2" />
+         <field field_ref="hfxmelt"          name="hfxmelt"    level="2" />
+         <field field_ref="hfxldmelt"        name="hfxldmelt" level="2" />
+         <field field_ref="hfxldgrow"        name="hfxldgrow"  level="2" />
        <!-- salt fluxes -->
          <field field_ref="sfxice"           name="sfxice" level="1" />
          <field field_ref="sfxsni"           name="sfxsni" level="1" />
-
-       <!-- mass fluxes -->
+        <!-- mass fluxes -->
          <field field_ref="vfxice"           name="vfxice" level="2" />
          <field field_ref="vfxsnw"           name="vfxsnw" level="2" />
          <field field_ref="vfxsub"           name="vfxsub" level="2" />
          <field field_ref="vfxsub_err"       name="vfxsub_err" level="2" />
+         <field field_ref="vfxsnw_pre"       name="vfxsnw_pre" level="2" />
+         <field field_ref="vfxsnw_sub"       name="vfxsnw_sub" level="2" />
+	 <field field_ref="vfxpnd"           name="vfxpnd" level="2" />
 
      <!-- outputs by category -->
Index: CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/file_def_nemo-oce.xml
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/file_def_nemo-oce.xml	(revision 6119)
+++ CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/file_def_nemo-oce.xml	(revision 6152)
@@ -71,4 +71,6 @@
           <field field_ref="ibgheat_tot"      name="ibgheat_tot" level="1"  />
           <field field_ref="sbgheat_tot"      name="sbgheat_tot" level="1"  />
+          <field field_ref="ipbgvol_tot"      name="ipbgvol_tot" level="1"  />
+          <field field_ref="ilbgvol_tot"      name="ilbgvol_tot" level="1"  />
 	  
 	  <!-- global drifts (conservation checks) -->
@@ -124,9 +126,9 @@
 	  <field field_ref="subl_ai_cea"   name="subl_ai_cea"   level="1"    />
 	  <field field_ref="fmmflx"        name="fmmflx"  level="1" />
-          <field field_ref="fwfisf"        name="fwfisf"  level="1" />
+          <field field_ref="fwfisf_par"     name="fwfisf"  level="1" />
           <field field_ref="hflx_snow_ai_cea" name="hflx_snow_ai"  level="1"  />
           <field field_ref="hflx_snow_ao_cea" name="hflx_snow_ao" level="1"  />
           <field field_ref="hflx_ice_cea"     name="hflx_ice"     level="1"  />
-          <field field_ref="hflx_isf_cea"     name="hflx_isf"     level="1"  />
+          <field field_ref="qhcisf_par"     name="hflx_isf"     level="1"  />
           <field field_ref="hflx_rnf_cea"     name="hflx_rnf"     level="1"  />
 	  <!-- For salt conservation checking -->
@@ -176,12 +178,12 @@
 
         <file id="file8" name_suffix="_trdtra" description="ocean trends variables" >
-          <field field_ref="ttrd_zdfp_e3t"   name="ttrdtr_zdfp"  long_name="Tendency_of_heat_content_from_parameterized_dianeutral_mixing"  unit="W m-2"     level="2"  > this * $cpocean * $rau0  </field>
-          <field field_ref="ttrd_iso_e3t"    name="ttrdtr_iso"   long_name="Tendency_of_heat_content_from_parameterized_eddy_diffusion"     unit="W m-2"     level="2"   > this * $cpocean * $rau0  </field>
-          <field field_ref="ttrd_totad_e3t"  name="ttrdtr_totad" long_name="Tendency_of_heat_content_from_residual_mean_advection"          unit="W m-2"     level="2"   > this * $cpocean * $rau0  </field>
-          <field field_ref="ttrd_tot_e3t"    name="ttrdtr_tot"   long_name="Tendency_of_heat_content_from_all_processes"                    unit="W m-2"     level="2"   > this * $cpocean * $rau0  </field>
-          <field field_ref="strd_zdfp_e3t"   name="strdtr_zdfp"  long_name="Tendency_of_salt_content_from_parameterized_dianeutral_mixing"  unit="kg m-2 s-1" level="2"  > this * $rau0 </field>
-          <field field_ref="strd_iso_e3t"    name="strdtr_iso"   long_name="Tendency_of_salt_content_from_parameterized_eddy_diffusion"     unit="kg m-2 s-1" level="2"  > this * $rau0 </field>
-          <field field_ref="strd_totad_e3t"  name="strdtr_totad" long_name="Tendency_of_salt_content_from_residual_mean_advection"          unit="kg m-2 s-1" level="2"  > this * $rau0  </field>
-          <field field_ref="strd_tot_e3t"    name="strdtr_tot"   long_name="Tendency_of_salt_content_from_all_processes"                    unit="kg m-2 s-1" level="2"  > this * $rau0  </field>
+          <field field_ref="ttrd_zdfp_e3t"   name="ttrdtr_zdfp"  long_name="Tendency_of_heat_content_from_parameterized_dianeutral_mixing"  unit="W m-2"     level="2"  > this * $cpocean * $rho0  </field>
+          <field field_ref="ttrd_iso_e3t"    name="ttrdtr_iso"   long_name="Tendency_of_heat_content_from_parameterized_eddy_diffusion"     unit="W m-2"     level="2"   > this * $cpocean * $rho0  </field>
+          <field field_ref="ttrd_totad_e3t"  name="ttrdtr_totad" long_name="Tendency_of_heat_content_from_residual_mean_advection"          unit="W m-2"     level="2"   > this * $cpocean * $rho0  </field>
+          <field field_ref="ttrd_tot_e3t"    name="ttrdtr_tot"   long_name="Tendency_of_heat_content_from_all_processes"                    unit="W m-2"     level="2"   > this * $cpocean * $rho0  </field>
+          <field field_ref="strd_zdfp_e3t"   name="strdtr_zdfp"  long_name="Tendency_of_salt_content_from_parameterized_dianeutral_mixing"  unit="kg m-2 s-1" level="2"  > this * $rho0 </field>
+          <field field_ref="strd_iso_e3t"    name="strdtr_iso"   long_name="Tendency_of_salt_content_from_parameterized_eddy_diffusion"     unit="kg m-2 s-1" level="2"  > this * $rho0 </field>
+          <field field_ref="strd_totad_e3t"  name="strdtr_totad" long_name="Tendency_of_salt_content_from_residual_mean_advection"          unit="kg m-2 s-1" level="2"  > this * $rho0  </field>
+          <field field_ref="strd_tot_e3t"    name="strdtr_tot"   long_name="Tendency_of_salt_content_from_all_processes"                    unit="kg m-2 s-1" level="2"  > this * $rho0  </field>
         </file>
 
@@ -247,5 +249,4 @@
       <!-- <field field_ref="28d"           level="1" /> -->
       <field field_ref="hc300"         level="1" />
-      <field field_ref="heatc"         level="1" />
       <!-- next variables are additional for PISCES offline-->
           <field field_ref="hdiv"         name="hdivtr"   long_name="horizontal divergence transport"      operation="average" freq_op="1mo" level="2" > @hdiv * @e3t </field>
@@ -259,26 +260,38 @@
 	  <field field_ref="qt_ice"        name="qt_ice"   long_name="downward total flux at ice surface"         level="2"   />
 	  <field field_ref="qemp_ice"      name="qemp_ice" long_name="Downward Heat Flux from E-P over ice"        level="2"    />
-	  <field field_ref="hflx_rain_cea" name="hflx_rain_cea"    level="2"   />
-	  <field field_ref="hflx_evap_cea" name="hflx_evap_cea"    level="2"   />
-	  <field field_ref="hflx_snow_cea" name="hflx_snow_cea"    level="2"   />
-	  <field field_ref="hflx_cal_cea"  name="hflx_cal_cea"    level="2"   />
-	  <!-- For freshwater conservation checking -->
-	  <field field_ref="empmr"         name="wfo"      long_name="water_flux_into_sea_water"        level="1"              />
-	  <field field_ref="emp_oce"       name="emp_oce"       level="2"                />
-	  <field field_ref="emp_ice"       name="emp_ice"       level="2"                />
-	  <field field_ref="runoffs"       name="runoffs"        level="2"               />
-      <field field_ref="runoffs"       name="friver"   long_name="water_flux_into_sea_water_from_rivers"     level="1" > runoffs - iceberg_cea </field>
-	  <field field_ref="calving_cea"   name="calving" level="2" />
+          <field field_ref="hflx_rain_cea" name="hflx_rain_cea"    level="2"   />
+          <field field_ref="hflx_evap_cea" name="hflx_evap_cea"    level="2"   />
+          <field field_ref="hflx_snow_cea" name="hflx_snow_cea"    level="2"   />
+          <field field_ref="hflx_snow_ao_cea" name="hflx_snow_ao_cea"    level="2"   />
+          <field field_ref="hflx_snow_ai_cea" name="hflx_snow_ai_cea"    level="2"   />
+          <field field_ref="hflx_cal_cea"  name="hflx_cal_cea"    level="2"   />
+          <field field_ref="hflx_icb_cea"  name="hflx_icb_cea"    level="2"   />
+          <field field_ref="hflx_rnf_cea"  name="hflx_rnf_cea"    level="2"   />
+	  <field field_ref="qhcisf_par"     name="hflx_isf_cea"     level="1"  />
+
+          <!-- For freshwater conservation checking -->
+          <field field_ref="empmr"         name="wfo"      long_name="water_flux_into_sea_water"        level="1"              />
+          <field field_ref="emp_oce"       name="emp_oce"       level="2"                />
+          <field field_ref="emp_ice"       name="emp_ice"       level="2"                />
+          <field field_ref="runoffs"       name="runoffs"        level="2"               />
+          <field field_ref="runoffs"       name="friver"   long_name="water_flux_into_sea_water_from_rivers"     level="1" > runoffs - iceberg_cea </field>
+          <field field_ref="calving_cea"   name="calving" level="2" />
           <field field_ref="iceberg_cea"   name="iceberg" level="2" />
-          <field field_ref="iceshelf_cea"  name="iceshelf" level="2" />
-	  <field field_ref="vfxice"        name="vfxice" level="2" />
-	  <field field_ref="vfxsnw"        name="vfxsnw" level="2" />
-	  <field field_ref="vfxsub"        name="vfxsub" level="2" />
-	  <field field_ref="rain"          name="rain"   level="2"    />
-	  <field field_ref="snow_ao_cea"   name="snow_ao_cea"    level="2"   />
-	  <field field_ref="snow_ai_cea"   name="snow_ai_cea"    level="2"   />
-	  <field field_ref="evap_ao_cea"   name="evap_ao_cea"    level="2"   />
-	  <field field_ref="subl_ai_cea"   name="subl_ai_cea"    level="2"   />
-	  <!-- For salt conservation checking -->
+          <field field_ref="fwfisf_par"     name="iceshelf" level="2" />
+         <field field_ref="vfxice"           name="vfxice" level="2" />
+         <field field_ref="vfxsnw"           name="vfxsnw" level="2" />
+         <field field_ref="vfxsub"           name="vfxsub" level="2" />
+         <field field_ref="vfxsub_err"       name="vfxsub_err" level="2" />
+         <field field_ref="vfxsnw_pre"       name="vfxsnw_pre" level="2" />
+         <field field_ref="vfxsnw_sub"       name="vfxsnw_sub" level="2" />
+         <field field_ref="vfxpnd"           name="vfxpnd" level="2" />
+          <field field_ref="rain"          name="rain"   level="2"    />
+          <field field_ref="snow_ao_cea"   name="snow_ao_cea"    level="2"   />
+          <field field_ref="snow_ai_cea"   name="snow_ai_cea"    level="2"   />
+          <field field_ref="evap_ao_cea"   name="evap_ao_cea"    level="2"   />
+          <field field_ref="subl_ai_cea"   name="subl_ai_cea"    level="2"   />
+          <field field_ref="precip"       name="precip" level="2" />
+          <field field_ref="snowpre"      name="snowpre" level="2"  />
+          <!-- For salt conservation checking -->
           <field field_ref="saltflx"      name="sosflxdo" level="2"  />
         </file>
@@ -291,8 +304,4 @@
           <field field_ref="uocetr_eff"   name="uocetr_eff"  level="2" />
           <field field_ref="ahu_bbl"       />
-      <!-- available with key_diaar5 -->
-      <field field_ref="u_masstr"     name="vozomatr"  level="2" />
-      <field field_ref="u_heattr"     name="sozohetr"  level="2" />
-      <field field_ref="u_salttr"     name="sozosatr"  level="2" />
 	</file>
 	
@@ -304,8 +313,4 @@
           <field field_ref="vocetr_eff"   name="vocetr_eff" level="2"  />
           <field field_ref="ahv_bbl"       />
-      <!-- available with key_diaar5 -->
-      <field field_ref="v_masstr"     name="vomematr" level="2"  />
-      <field field_ref="v_heattr"     name="somehetr" level="2"  />
-      <field field_ref="v_salttr"     name="somesatr" level="2"  />
 	</file>
 	
@@ -420,12 +425,12 @@
 
         <file id="file18" name_suffix="_trdtra" description="ocean trends variables" >
-          <field field_ref="ttrd_zdfp_e3t"   name="ttrdtr_zdfp"  long_name="Tendency_of_heat_content_from_parameterized_dianeutral_mixing"  unit="W m-2"      level="2"   > this * $cpocean * $rau0  </field>
-          <field field_ref="ttrd_iso_e3t"    name="ttrdtr_iso"   long_name="Tendency_of_heat_content_from_parameterized_eddy_diffusion"     unit="W m-2"      level="2"   > this * $cpocean * $rau0  </field>
-          <field field_ref="ttrd_totad_e3t"  name="ttrdtr_totad" long_name="Tendency_of_heat_content_from_residual_mean_advection"          unit="W m-2"      level="2"   > this * $cpocean * $rau0  </field>
-          <field field_ref="ttrd_tot_e3t"    name="ttrdtr_tot"   long_name="Tendency_of_heat_content_from_all_processes"                    unit="W m-2"      level="2"   > this * $cpocean * $rau0  </field>
-          <field field_ref="strd_zdfp_e3t"   name="strdtr_zdfp"  long_name="Tendency_of_salt_content_from_parameterized_dianeutral_mixing"  unit="kg m-2 s-1" level="2"   > this * $rau0 </field>
-          <field field_ref="strd_iso_e3t"    name="strdtr_iso"   long_name="Tendency_of_salt_content_from_parameterized_eddy_diffusion"     unit="kg m-2 s-1" level="2"  > this * $rau0 </field>
-          <field field_ref="strd_totad_e3t"  name="strdtr_totad" long_name="Tendency_of_salt_content_from_residual_mean_advection"          unit="kg m-2 s-1" level="2"  > this * $rau0  </field>
-          <field field_ref="strd_tot_e3t"    name="strdtr_tot"   long_name="Tendency_of_salt_content_from_all_processes"                    unit="kg m-2 s-1" level="2"  > this * $rau0  </field>
+          <field field_ref="ttrd_zdfp_e3t"   name="ttrdtr_zdfp"  long_name="Tendency_of_heat_content_from_parameterized_dianeutral_mixing"  unit="W m-2"      level="2"   > this * $cpocean * $rho0  </field>
+          <field field_ref="ttrd_iso_e3t"    name="ttrdtr_iso"   long_name="Tendency_of_heat_content_from_parameterized_eddy_diffusion"     unit="W m-2"      level="2"   > this * $cpocean * $rho0  </field>
+          <field field_ref="ttrd_totad_e3t"  name="ttrdtr_totad" long_name="Tendency_of_heat_content_from_residual_mean_advection"          unit="W m-2"      level="2"   > this * $cpocean * $rho0  </field>
+          <field field_ref="ttrd_tot_e3t"    name="ttrdtr_tot"   long_name="Tendency_of_heat_content_from_all_processes"                    unit="W m-2"      level="2"   > this * $cpocean * $rho0  </field>
+          <field field_ref="strd_zdfp_e3t"   name="strdtr_zdfp"  long_name="Tendency_of_salt_content_from_parameterized_dianeutral_mixing"  unit="kg m-2 s-1" level="2"   > this * $rho0 </field>
+          <field field_ref="strd_iso_e3t"    name="strdtr_iso"   long_name="Tendency_of_salt_content_from_parameterized_eddy_diffusion"     unit="kg m-2 s-1" level="2"  > this * $rho0 </field>
+          <field field_ref="strd_totad_e3t"  name="strdtr_totad" long_name="Tendency_of_salt_content_from_residual_mean_advection"          unit="kg m-2 s-1" level="2"  > this * $rho0  </field>
+          <field field_ref="strd_tot_e3t"    name="strdtr_tot"   long_name="Tendency_of_salt_content_from_all_processes"                    unit="kg m-2 s-1" level="2"  > this * $rho0  </field>
         </file>
 
@@ -476,4 +481,5 @@
 	  <field field_ref="hflx_snow_cea" name="hflx_snow_cea"    level="2"   />
 	  <field field_ref="hflx_cal_cea"  name="hflx_cal_cea"    level="2"   />
+	  <field field_ref="qhcisf_par"     name="hflx_isf"     level="1"  />
 	  <!-- For freshwater conservation checking -->
 	  <field field_ref="empmr"         name="wfo"      long_name="water_flux_into_sea_water"             level="2"         />
@@ -484,5 +490,5 @@
 	  <field field_ref="calving_cea"   name="calving" level="2" />
           <field field_ref="iceberg_cea"   name="iceberg" level="2" />
-          <field field_ref="iceshelf_cea"  name="iceshelf" level="2"  />
+          <field field_ref="fwfisf_par"  name="iceshelf" level="2"  />
 	  <field field_ref="vfxice"        name="vfxice" level="2"  />
 	  <field field_ref="vfxsnw"        name="vfxsnw" level="2" />
@@ -556,12 +562,12 @@
 
         <file id="file26" name_suffix="_trdtra" description="ocean trends variables" >
-          <field field_ref="ttrd_zdfp_e3t"   name="ttrdtr_zdfp"  long_name="Tendency_of_heat_content_from_parameterized_dianeutral_mixing"  unit="W m-2"      level="2"  > this * $cpocean * $rau0  </field>
-          <field field_ref="ttrd_iso_e3t"    name="ttrdtr_iso"   long_name="Tendency_of_heat_content_from_parameterized_eddy_diffusion"     unit="W m-2"      level="2"  > this * $cpocean * $rau0  </field>
-          <field field_ref="ttrd_totad_e3t"  name="ttrdtr_totad" long_name="Tendency_of_heat_content_from_residual_mean_advection"          unit="W m-2"      level="2"  > this * $cpocean * $rau0  </field>
-          <field field_ref="ttrd_tot_e3t"    name="ttrdtr_tot"   long_name="Tendency_of_heat_content_from_all_processes"                    unit="W m-2"      level="2"  > this * $cpocean * $rau0  </field>
-          <field field_ref="strd_zdfp_e3t"   name="strdtr_zdfp"  long_name="Tendency_of_salt_content_from_parameterized_dianeutral_mixing"  unit="kg m-2 s-1" level="2"  > this * $rau0 </field>
-          <field field_ref="strd_iso_e3t"    name="strdtr_iso"   long_name="Tendency_of_salt_content_from_parameterized_eddy_diffusion"     unit="kg m-2 s-1" level="2"  > this * $rau0 </field>
-          <field field_ref="strd_totad_e3t"  name="strdtr_totad" long_name="Tendency_of_salt_content_from_residual_mean_advection"          unit="kg m-2 s-1" level="2"  > this * $rau0  </field>
-          <field field_ref="strd_tot_e3t"    name="strdtr_tot"   long_name="Tendency_of_salt_content_from_all_processes"                    unit="kg m-2 s-1" level="2"  > this * $rau0  </field>
+          <field field_ref="ttrd_zdfp_e3t"   name="ttrdtr_zdfp"  long_name="Tendency_of_heat_content_from_parameterized_dianeutral_mixing"  unit="W m-2"      level="2"  > this * $cpocean * $rho0  </field>
+          <field field_ref="ttrd_iso_e3t"    name="ttrdtr_iso"   long_name="Tendency_of_heat_content_from_parameterized_eddy_diffusion"     unit="W m-2"      level="2"  > this * $cpocean * $rho0  </field>
+          <field field_ref="ttrd_totad_e3t"  name="ttrdtr_totad" long_name="Tendency_of_heat_content_from_residual_mean_advection"          unit="W m-2"      level="2"  > this * $cpocean * $rho0  </field>
+          <field field_ref="ttrd_tot_e3t"    name="ttrdtr_tot"   long_name="Tendency_of_heat_content_from_all_processes"                    unit="W m-2"      level="2"  > this * $cpocean * $rho0  </field>
+          <field field_ref="strd_zdfp_e3t"   name="strdtr_zdfp"  long_name="Tendency_of_salt_content_from_parameterized_dianeutral_mixing"  unit="kg m-2 s-1" level="2"  > this * $rho0 </field>
+          <field field_ref="strd_iso_e3t"    name="strdtr_iso"   long_name="Tendency_of_salt_content_from_parameterized_eddy_diffusion"     unit="kg m-2 s-1" level="2"  > this * $rho0 </field>
+          <field field_ref="strd_totad_e3t"  name="strdtr_totad" long_name="Tendency_of_salt_content_from_residual_mean_advection"          unit="kg m-2 s-1" level="2"  > this * $rho0  </field>
+          <field field_ref="strd_tot_e3t"    name="strdtr_tot"   long_name="Tendency_of_salt_content_from_all_processes"                    unit="kg m-2 s-1" level="2"  > this * $rho0  </field>
         </file>
 
Index: CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/file_def_nemo-pisces.xml
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/file_def_nemo-pisces.xml	(revision 6119)
+++ CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/file_def_nemo-pisces.xml	(revision 6152)
@@ -33,6 +33,6 @@
           <field field_ref="tcexp"    name="tcexp"     unit="PgC/yr" operation="instant" level="2" > tcexp * 12. * 86400. * 365. / 1e15 </field>
           <field field_ref="tintpp"   name="tintpp"    unit="PgC/yr" operation="instant" level="2" > tintpp * 12. * 86400. * 365. / 1e15 </field>
-          <field field_ref="pno3tot"  name="pno3tot"   unit="umolN"  operation="instant" level="2" > pno3tot * 16. / 122. * 1e6 </field>
-          <field field_ref="ppo4tot"  name="ppo4tot"   unit="umolP"  operation="instant" level="2" > ppo4tot * 1. / 122. * 1e6 </field>
+          <field field_ref="pno3tot"  name="pno3tot"   unit="umolN"  operation="instant" level="2" > pno3tot * 16. / 117. * 1e6 </field>
+          <field field_ref="ppo4tot"  name="ppo4tot"   unit="umolP"  operation="instant" level="2" > ppo4tot * 1. / 117. * 1e6 </field>
           <field field_ref="psiltot"  name="psiltot"   unit="umolC"  operation="instant" level="2" > psiltot * 1e6  </field>
           <field field_ref="palktot"  name="palktot"   unit="umolC"  operation="instant" level="2" > palktot * 1e6  </field>
@@ -51,6 +51,6 @@
           <field field_ref="tcexp"    name="tcexp"     unit="PgC/yr" operation="instant" level="2" > tcexp * 12. * 86400. * 365. / 1e15 </field>
           <field field_ref="tintpp"   name="tintpp"    unit="PgC/yr" operation="instant" level="2" > tintpp * 12. * 86400. * 365. / 1e15 </field>
-          <field field_ref="pno3tot"  name="pno3tot"   unit="umolN"  operation="instant" level="2" > pno3tot * 16. / 122. * 1e6 </field>
-          <field field_ref="ppo4tot"  name="ppo4tot"   unit="umolP"  operation="instant" level="2" > ppo4tot * 1. / 122. * 1e6 </field>
+          <field field_ref="pno3tot"  name="pno3tot"   unit="umolN"  operation="instant" level="2" > pno3tot * 16. / 117. * 1e6 </field>
+          <field field_ref="ppo4tot"  name="ppo4tot"   unit="umolP"  operation="instant" level="2" > ppo4tot * 1. / 117. * 1e6 </field>
           <field field_ref="psiltot"  name="psiltot"   unit="umolC"  operation="instant" level="2" > psiltot * 1e6  </field>
           <field field_ref="palktot"  name="palktot"   unit="umolC"  operation="instant" level="2" > palktot * 1e6  </field>
@@ -123,4 +123,5 @@
         <field field_ref="EPCAL100"   name="EPCAL100" level="2"  />
         <field field_ref="xfracal"    name="xfracal"  level="2" />
+        <field field_ref="GRAZ1"      name="GRAZ"     level="2" > this + GRAZ2 </field>
 
        </file>
@@ -133,6 +134,6 @@
           <field field_ref="tcexp"    name="tcexp"     unit="PgC/yr" operation="instant" level="1" > tcexp * 12. * 86400. * 365. / 1e15 </field>
           <field field_ref="tintpp"   name="tintpp"    unit="PgC/yr" operation="instant" level="1" > tintpp * 12. * 86400. * 365. / 1e15 </field>
-          <field field_ref="pno3tot"  name="pno3tot"   unit="umolN"  operation="instant" level="1" > pno3tot * 16. / 122. * 1e6 </field>
-          <field field_ref="ppo4tot"  name="ppo4tot"   unit="umolP"  operation="instant" level="1" > ppo4tot * 1. / 122. * 1e6 </field>
+          <field field_ref="pno3tot"  name="pno3tot"   unit="umolN"  operation="instant" level="1" > pno3tot * 16. / 117. * 1e6 </field>
+          <field field_ref="ppo4tot"  name="ppo4tot"   unit="umolP"  operation="instant" level="1" > ppo4tot * 1. / 117. * 1e6 </field>
           <field field_ref="psiltot"  name="psiltot"   unit="umolC"  operation="instant" level="1" > psiltot * 1e6  </field>
           <field field_ref="palktot"  name="palktot"   unit="umolC"  operation="instant" level="1" > palktot * 1e6  </field>
@@ -208,4 +209,5 @@
         <field field_ref="EPCAL100"   name="EPCAL100" level="1"  />
         <field field_ref="xfracal"    name="xfracal"  level="2" />
+        <field field_ref="GRAZ1"      name="GRAZ"     level="2" > this + GRAZ2 </field>
 
         </file>
Index: CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/isfparmlt.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/isfparmlt.F90	(revision 6152)
+++ CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/isfparmlt.F90	(revision 6152)
@@ -0,0 +1,237 @@
+MODULE isfparmlt
+   !!======================================================================
+   !!                       ***  MODULE  isfparmlt  ***
+   !! Ice shelf parametrisation module :  update surface ocean boundary condition under ice
+   !!                   shelf using an ice shelf melt parametrisation
+   !!======================================================================
+   !! History :  4.0  ! original code
+   !!----------------------------------------------------------------------
+
+   USE isf_oce                  ! ice shelf
+   USE isftbl , ONLY: isf_tbl   ! ice shelf depth average
+   USE isfutils,ONLY: debug     ! debug subroutine
+
+   USE dom_oce                  ! ocean space and time domain
+   USE oce    , ONLY: ts        ! ocean dynamics and tracers
+   USE phycst , ONLY: rcp, rho0 ! physical constants
+   USE eosbn2 , ONLY: eos_fzp   ! equation of state
+
+   USE in_out_manager              ! I/O manager
+   USE iom        , ONLY: iom_put  ! I/O library
+   USE fldread    , ONLY: fld_read, FLD, FLD_N !
+   USE lib_fortran, ONLY: glob_sum !
+   USE lib_mpp    , ONLY: ctl_stop !
+
+   IMPLICIT NONE
+
+   PRIVATE
+
+   PUBLIC  isfpar_mlt 
+
+
+   !! * Substitutions
+#  include "domzgr_substitute.h90"   
+   !!----------------------------------------------------------------------
+   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
+   !! $Id: sbcisf.F90 10536 2019-01-16 19:21:09Z mathiot $
+   !! Software governed by the CeCILL license (see ./LICENSE)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+! -------------------------------------------------------------------------------------------------------
+! -------------------------------- PUBLIC SUBROUTINE ----------------------------------------------------
+! -------------------------------------------------------------------------------------------------------
+
+   SUBROUTINE isfpar_mlt( kt, Kmm, pqhc, pqoce, pqfwf )
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE isfpar_mlt  ***
+      !!
+      !! ** Purpose : Compute Salt and Heat fluxes related to ice_shelf 
+      !!              melting and freezing 
+      !!
+      !! ** Method  :  2 parameterizations are available according
+      !!                        1 : Specified melt flux
+      !!                        2 : Beckmann & Goose parameterization
+      !!
+      !!-------------------------- OUT -------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: pqfwf, pqoce, pqhc  ! fresh water, ice-ocean heat and heat content fluxes
+      !!-------------------------- IN  -------------------------------------
+      INTEGER, INTENT(in) ::   kt   ! ocean time step
+      INTEGER, INTENT(in) ::   Kmm  ! ocean time level index
+      !!---------------------------------------------------------------------
+      !
+      ! Choose among the available ice shelf parametrisation
+      SELECT CASE ( cn_isfpar_mlt )
+      CASE ( 'spe' )    ! specified runoff in depth (Mathiot et al., 2017 in preparation)
+         CALL isfpar_mlt_spe(kt, Kmm, pqhc, pqoce, pqfwf)
+      CASE ( 'bg03' )    ! Beckmann and Goosse parametrisation 
+         CALL isfpar_mlt_bg03(kt, Kmm, pqhc, pqoce, pqfwf)
+      CASE ( 'oasis' )
+         CALL isfpar_mlt_oasis( kt, Kmm, pqhc, pqoce, pqfwf)
+      CASE DEFAULT
+         CALL ctl_stop('STOP', 'unknown isf melt formulation : cn_isfpar (should not see this)')
+      END SELECT
+      !
+      IF (ln_isfdebug) THEN
+         IF(lwp) WRITE(numout,*) ''
+         CALL debug( 'isfpar_mlt qhc  :', pqhc (:,:) )
+         CALL debug( 'isfpar_mlt qoce :', pqoce(:,:) )
+         CALL debug( 'isfpar_mlt qfwf :', pqfwf(:,:) )
+         IF(lwp) WRITE(numout,*) ''
+      END IF
+      !
+   END SUBROUTINE isfpar_mlt
+
+! -------------------------------------------------------------------------------------------------------
+! -------------------------------- PRIVATE SUBROUTINE ---------------------------------------------------
+! -------------------------------------------------------------------------------------------------------
+
+   SUBROUTINE isfpar_mlt_spe(kt, Kmm, pqhc, pqoce, pqfwf)
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE isfpar_mlt_spe  ***
+      !!
+      !! ** Purpose : prescribed ice shelf melting in case ice shelf cavities are closed.
+      !!              data read into a forcing files.
+      !!
+      !!-------------------------- OUT -------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: pqhc, pqfwf, pqoce  ! fresh water and ice-ocean heat fluxes
+      !!-------------------------- IN  -------------------------------------
+      INTEGER,  INTENT(in) :: kt
+      INTEGER,  INTENT(in) :: Kmm    !  ocean time level index
+      !!--------------------------------------------------------------------
+      INTEGER :: jk
+      REAL(wp), DIMENSION(jpi,jpj,jpk)  :: ztfrz3d
+      REAL(wp), DIMENSION(jpi,jpj)      :: ztfrz
+      !!--------------------------------------------------------------------
+      !
+      ! 0. ------------Read specified fwf from isf to oce
+      CALL fld_read ( kt, 1, sf_isfpar_fwf   )
+      !
+      ! compute ptfrz
+      ! 1. ------------Mean freezing point
+      DO jk = 1,jpk
+         CALL eos_fzp(ts(:,:,jk,jp_sal,Kmm), ztfrz3d(:,:,jk), gdept(:,:,jk,Kmm))
+      END DO
+      CALL isf_tbl(Kmm, ztfrz3d, ztfrz, 'T', misfkt_par, rhisf_tbl_par, misfkb_par, rfrac_tbl_par )
+      !
+      pqfwf(:,:) =   sf_isfpar_fwf(1)%fnow(:,:,1)      ! fresh water flux from the isf (fwfisf <0 mean melting)       ( > 0 from isf to oce)
+      pqoce(:,:) = - pqfwf(:,:) * rLfusisf             ! ocean/ice shelf flux assume to be equal to latent heat flux  ( > 0 from isf to oce)
+      pqhc (:,:) =   pqfwf(:,:) * ztfrz(:,:) * rcp     ! heat content flux                                            ( > 0 from isf to oce)
+      !
+      CALL iom_put('isftfrz_par', ztfrz(:,:) * mskisf_par(:,:) )
+      !
+   END SUBROUTINE isfpar_mlt_spe
+
+   SUBROUTINE isfpar_mlt_bg03(kt, Kmm, pqhc, pqoce, pqfwf)
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE isfpar_mlt_bg03  ***
+      !!
+      !! ** Purpose : compute an estimate of ice shelf melting and 
+      !!              latent, ocean-ice and heat content heat fluxes
+      !!              in case cavities are closed based on the far fields T and S properties. 
+      !!
+      !! ** Method  : The ice shelf melt is computed as proportional to the differences between the 
+      !!              mean temperature and mean freezing point in front of the ice shelf averaged 
+      !!              over the ice shelf min ice shelf draft and max ice shelf draft and the freezing point
+      !!
+      !! ** Reference : Beckmann and Goosse (2003), "A parameterization of ice shelf-ocean
+      !!                interaction for climate models", Ocean Modelling 5(2003) 157-170.
+      !!----------------------------------------------------------------------
+      !!-------------------------- OUT -------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: pqhc, pqfwf, pqoce  ! fresh water and ice-ocean heat fluxes
+      !!-------------------------- IN  -------------------------------------
+      INTEGER,  INTENT(in) :: kt
+      INTEGER,  INTENT(in) :: Kmm    !  ocean time level index
+      !!--------------------------------------------------------------------
+      INTEGER :: jk
+      REAL(wp), DIMENSION(jpi,jpj,jpk) :: ztfrz3d        ! freezing point
+      REAL(wp), DIMENSION(jpi,jpj)     :: ztfrz          ! freezing point
+      REAL(wp), DIMENSION(jpi,jpj)     :: ztavg          ! temperature avg
+      !!----------------------------------------------------------------------
+      !
+      ! 0. ------------Mean freezing point
+      DO jk = 1,jpk
+         CALL eos_fzp(ts(:,:,jk,jp_sal,Kmm), ztfrz3d(:,:,jk), gdept(:,:,jk,Kmm))
+      END DO
+      CALL isf_tbl(Kmm, ztfrz3d, ztfrz, 'T', misfkt_par, rhisf_tbl_par, misfkb_par, rfrac_tbl_par )
+      !
+      ! 1. ------------Mean temperature
+      CALL isf_tbl(Kmm, ts(:,:,:,jp_tem,Kmm), ztavg, 'T', misfkt_par, rhisf_tbl_par, misfkb_par, rfrac_tbl_par )
+      !
+      ! 2. ------------Net heat flux and fresh water flux due to the ice shelf
+      pqfwf(:,:) =   rho0 * rcp * rn_isfpar_bg03_gt0 * risfLeff(:,:) * e1t(:,:) * (ztavg(:,:) - ztfrz(:,:) ) * r1_e1e2t(:,:) / rLfusisf  ! ( > 0 from isf to oce)
+      pqoce(:,:) = - pqfwf(:,:) * rLfusisf             ! ocean/ice shelf flux assume to be equal to latent heat flux  ( > 0 from isf to oce)
+      pqhc (:,:) =   pqfwf(:,:) * ztfrz(:,:) * rcp     ! heat content flux                                            ( > 0 from isf to oce)
+      !
+      ! 3. ------------BG03 output
+      ! output ttbl
+      CALL iom_put('ttbl_par', ztavg(:,:) * mskisf_par(:,:) )
+      !
+      ! output thermal driving
+      CALL iom_put('isfthermald_par',( ztavg(:,:) - ztfrz(:,:) ) * mskisf_par(:,:))
+      !
+      ! output freezing point used to define the thermal driving and heat content fluxes
+      CALL iom_put('isftfrz_par', ztfrz(:,:) * mskisf_par(:,:) )
+      !
+   END SUBROUTINE isfpar_mlt_bg03
+
+   SUBROUTINE isfpar_mlt_oasis(kt, Kmm, pqhc , pqoce, pqfwf )
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE isfpar_mlt_oasis  ***
+      !!
+      !! ** Purpose    : scale the fwf read from input file by the total amount received by the sbccpl interface
+      !!
+      !! ** Purpose    : - read ice shelf melt from forcing file and scale it by the input file total amount => pattern
+      !!                 - compute total amount of fwf given by sbccpl (fwfisf_oasis)
+      !!                 - scale fwf and compute heat fluxes
+      !!
+      !!---------------------------------------------------------------------
+      !!-------------------------- OUT -------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(  out) :: pqhc, pqoce, pqfwf  ! heat content, latent heat and fwf fluxes
+      !!-------------------------- IN  -------------------------------------
+      INTEGER                     , INTENT(in   ) :: kt                  ! current time step
+      INTEGER                     , INTENT(in   ) :: Kmm                 !  ocean time level index
+      !!--------------------------------------------------------------------
+      INTEGER                           :: jk                            ! loop index
+      REAL(wp)                          :: zfwf_fld, zfwf_oasis          ! total fwf in the forcing fields (pattern) and from the cpl interface (amount)
+      REAL(wp), DIMENSION(jpi,jpj)      :: ztfrz                         ! tbl freezing temperature
+      REAL(wp), DIMENSION(jpi,jpj)      :: zfwf                          ! 2d fwf map after scaling
+      REAL(wp), DIMENSION(jpi,jpj,jpk)  :: ztfrz3d
+      !!--------------------------------------------------------------------
+      !
+      ! 0. ------------Read specified runoff
+      CALL fld_read ( kt, 1, sf_isfpar_fwf   )
+      !
+      ! 1. ------------Mean freezing point (needed for heat content flux)
+      DO jk = 1,jpk
+         CALL eos_fzp(ts(:,:,jk,jp_sal,Kmm), ztfrz3d(:,:,jk), gdept(:,:,jk,Kmm))
+      END DO
+      CALL isf_tbl(Kmm, ztfrz3d, ztfrz, 'T', misfkt_par, rhisf_tbl_par, misfkb_par, rfrac_tbl_par )
+      !
+      ! 2. ------------Scale isf melt pattern with total amount from oasis
+      ! ice shelf 2d map of fwf from isf to oce
+      zfwf(:,:) = sf_isfpar_fwf(1)%fnow(:,:,1)
+      !
+      ! compute glob sum from input file
+      ! (PM) should we consider delay sum as in fwb ? (it will offset by 1 time step if I understood well)
+      zfwf_fld = glob_sum('isfcav_mlt', e1e2t(:,:) * zfwf(:,:))
+      !
+      ! compute glob sum from atm->oce ice shelf fwf
+      ! (PM) should we consider delay sum as in fwb ?
+      zfwf_oasis = glob_sum('isfcav_mlt', e1e2t(:,:) * fwfisf_oasis(:,:))
+      !
+      ! scale fwf
+      zfwf(:,:) = zfwf(:,:) * zfwf_oasis / zfwf_fld
+      ! 
+      ! 3. -----------Define fwf and qoce
+      ! ocean heat flux is assume to be equal to the latent heat
+!      pqfwf(:,:) =   zfwf(:,:)                         ! fwf                ( > 0 from isf to oce)
+      pqfwf(:,:) =   fwfisf_oasis(:,:)                         ! fwf                ( > 0 from isf to oce)
+      pqoce(:,:) = - pqfwf(:,:) * rLfusisf             ! ocean heat flux    ( > 0 from isf to oce) (assumed to be the latent heat flux)
+      pqhc (:,:) =   pqfwf(:,:) * ztfrz(:,:) * rcp     ! heat content flux  ( > 0 from isf to oce)
+      !
+      CALL iom_put('isftfrz_par', ztfrz )
+      !
+   END SUBROUTINE isfpar_mlt_oasis
+
+END MODULE isfparmlt
Index: CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/isfstp.F90
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/isfstp.F90	(revision 6152)
+++ CONFIG/UNIFORM/v6/IPSLCM6.5.1/SOURCES/NEMO/isfstp.F90	(revision 6152)
@@ -0,0 +1,314 @@
+MODULE isfstp
+   !!======================================================================
+   !!                       ***  MODULE  isfstp  ***
+   !! Ice Shelves :  compute iceshelf load, melt and heat flux
+   !!======================================================================
+   !! History :  3.2  !  2011-02  (C.Harris  ) Original code isf cav
+   !!            X.X  !  2006-02  (C. Wang   ) Original code bg03
+   !!            3.4  !  2013-03  (P. Mathiot) Merging + parametrization
+   !!            4.1  !  2019-09  (P. Mathiot) Split param/explicit ice shelf and re-organisation
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   isfstp       : compute iceshelf melt and heat flux
+   !!----------------------------------------------------------------------
+   USE isf_oce                                      ! isf variables
+   USE isfload, ONLY: isf_load                      ! ice shelf load
+   USE isftbl , ONLY: isf_tbl_lvl                   ! ice shelf boundary layer
+   USE isfpar , ONLY: isf_par, isf_par_init         ! ice shelf parametrisation
+   USE isfcav , ONLY: isf_cav, isf_cav_init         ! ice shelf cavity
+   USE isfcpl , ONLY: isfcpl_rst_write, isfcpl_init ! isf variables
+
+   USE dom_oce        ! ocean space and time domain
+   USE oce      , ONLY: ssh                           ! sea surface height
+   USE domvvl,  ONLY: ln_vvl_zstar                      ! zstar logical
+   USE zdfdrg,  ONLY: r_Cdmin_top, r_ke0_top            ! vertical physics: top/bottom drag coef.
+   !
+   USE lib_mpp, ONLY: ctl_stop, ctl_nam
+   USE fldread, ONLY: FLD, FLD_N
+   USE in_out_manager ! I/O manager
+   USE timing
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   isf_stp, isf_init, isf_nam  ! routine called in sbcmod and divhor
+
+   !! * Substitutions
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
+   !! $Id: isfstp.F90 15529 2021-11-23 15:00:19Z techene $
+   !! Software governed by the CeCILL license (see ./LICENSE)
+   !!----------------------------------------------------------------------
+CONTAINS
+ 
+   SUBROUTINE isf_stp( kt, Kmm )
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE isf_stp  ***
+      !!
+      !! ** Purpose : compute total heat flux and total fwf due to ice shelf melt
+      !!
+      !! ** Method  : For each case (parametrisation or explicity cavity) :
+      !!              - define the before fields
+      !!              - compute top boundary layer properties
+      !!                (in case of parametrisation, this is the 
+      !!                 depth range model array used to compute mean far fields properties)
+      !!              - compute fluxes
+      !!              - write restart variables
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt    ! ocean time step
+      INTEGER, INTENT(in) ::   Kmm   ! ocean time level index
+      !
+      INTEGER :: jk                              ! loop index
+#if defined key_qco
+      REAL(wp), DIMENSION(jpi,jpj,jpk) :: ze3t   ! 3D workspace
+#endif
+      !!---------------------------------------------------------------------
+      !
+      IF( ln_timing )   CALL timing_start('isf')
+      !
+      !=======================================================================
+      ! 1.: compute melt and associated heat fluxes in the ice shelf cavities
+      !=======================================================================
+      !
+      IF ( ln_isfcav_mlt ) THEN
+         !
+         ! 1.1: before time step 
+         IF ( kt /= nit000 ) THEN 
+            risf_cav_tsc_b (:,:,:) = risf_cav_tsc (:,:,:)
+            fwfisf_cav_b(:,:)      = fwfisf_cav(:,:)
+         END IF
+         !
+         ! 1.2: compute misfkb, rhisf_tbl, rfrac (deepest level, thickness, fraction of deepest cell affected by tbl)
+         rhisf_tbl_cav(:,:) = rn_htbl * mskisf_cav(:,:)
+#if defined key_qco
+         DO jk = 1, jpk
+            ze3t(:,:,jk) = e3t(:,:,jk,Kmm)
+         END DO 
+         CALL isf_tbl_lvl( ht(:,:), ze3t           , misfkt_cav, misfkb_cav, rhisf_tbl_cav, rfrac_tbl_cav )
+#else
+         CALL isf_tbl_lvl( ht(:,:),  e3t(:,:,:,Kmm), misfkt_cav, misfkb_cav, rhisf_tbl_cav, rfrac_tbl_cav )
+#endif
+         !
+         ! 1.3: compute ice shelf melt
+         CALL isf_cav( kt, Kmm, risf_cav_tsc, fwfisf_cav )
+         !
+      END IF
+      ! 
+      !=================================================================================
+      ! 2.: compute melt and associated heat fluxes for not resolved ice shelf cavities
+      !=================================================================================
+      !
+      IF ( ln_isfpar_mlt ) THEN
+         !
+         ! 2.1: before time step 
+         IF ( kt /= nit000 ) THEN 
+            risf_par_tsc_b(:,:,:) = risf_par_tsc(:,:,:)
+            fwfisf_par_b  (:,:)   = fwfisf_par  (:,:)
+         END IF
+         !
+         ! 2.2: compute misfkb, rhisf_tbl, rfrac (deepest level, thickness, fraction of deepest cell affected by tbl)
+         ! by simplicity, we assume the top level where param applied do not change with time (done in init part)
+         rhisf_tbl_par(:,:) = rhisf0_tbl_par(:,:)
+#if defined key_qco
+         DO jk = 1, jpk
+            ze3t(:,:,jk) = e3t(:,:,jk,Kmm)
+         END DO
+         CALL isf_tbl_lvl( ht(:,:), ze3t           , misfkt_par, misfkb_par, rhisf_tbl_par, rfrac_tbl_par )
+#else
+         CALL isf_tbl_lvl( ht(:,:),  e3t(:,:,:,Kmm), misfkt_par, misfkb_par, rhisf_tbl_par, rfrac_tbl_par )
+#endif
+         !
+         ! 2.3: compute ice shelf melt
+         CALL isf_par( kt, Kmm, risf_par_tsc, fwfisf_par )
+         !
+      END IF
+      !
+      !==================================================================================
+      ! 3.: output specific restart variable in case of coupling with an ice sheet model
+      !==================================================================================
+      !
+      IF ( ln_isfcpl .AND. lrst_oce ) CALL isfcpl_rst_write(kt, Kmm)
+      !
+      IF( ln_timing )   CALL timing_stop('isf')
+      !
+   END SUBROUTINE isf_stp
+
+   
+   SUBROUTINE isf_init( Kbb, Kmm, Kaa )
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE isfstp_init  ***
+      !!
+      !! ** Purpose :   Initialisation of the ice shelf public variables
+      !!
+      !! ** Method  :   Read the namisf namelist, check option compatibility and set derived parameters
+      !!
+      !! ** Action  : - read namisf parameters
+      !!              - allocate memory
+      !!              - output print
+      !!              - ckeck option compatibility
+      !!              - call cav/param/isfcpl init routine
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   Kbb, Kmm, Kaa   ! ocean time level indices
+      !!----------------------------------------------------------------------
+      !
+      ! constrain: l_isfoasis need to be known
+      !
+      CALL isf_nam()                                              ! Read namelist
+      !
+      CALL isf_alloc()                                            ! Allocate public array
+      !
+      CALL isf_ctl()                                              ! check option compatibility
+      !
+      IF( ln_isfcav ) CALL isf_load( Kmm, risfload )              ! compute ice shelf load
+      !
+      ! terminate routine now if no ice shelf melt formulation specify
+      IF( ln_isf ) THEN
+         !
+         IF( ln_isfcav_mlt )   CALL isf_cav_init()                ! initialisation melt in the cavity
+         !
+         IF( ln_isfpar_mlt )   CALL isf_par_init()                ! initialisation parametrised melt
+         !
+         IF( ln_isfcpl     )   CALL isfcpl_init( Kbb, Kmm, Kaa )  ! initialisation ice sheet coupling
+         !
+      END IF
+         
+  END SUBROUTINE isf_init
+
+  
+  SUBROUTINE isf_ctl()
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE isf_ctl  ***
+      !!
+      !! ** Purpose :   output print and option compatibility check
+      !!
+      !!----------------------------------------------------------------------
+      IF (lwp) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) 'isf_init : ice shelf initialisation'
+         WRITE(numout,*) '~~~~~~~~~~~~'
+         WRITE(numout,*) '   Namelist namisf :'
+         !
+         WRITE(numout,*) '   ice shelf cavity (open or parametrised)  ln_isf = ', ln_isf
+         WRITE(numout,*)
+         !
+         IF ( ln_isf ) THEN
+#if key_qco 
+# if ! defined key_isf 
+            CALL ctl_stop( 'STOP', 'isf_ctl: ice shelf requires both ln_isf=T AND key_isf activated' ) 
+# endif 
+#endif
+            WRITE(numout,*) '      Add debug print in isf module           ln_isfdebug     = ', ln_isfdebug
+            WRITE(numout,*)
+            WRITE(numout,*) '      melt inside the cavity                  ln_isfcav_mlt   = ', ln_isfcav_mlt
+            IF ( ln_isfcav_mlt) THEN
+               WRITE(numout,*) '         melt formulation                         cn_isfcav_mlt= ', TRIM(cn_isfcav_mlt)
+               WRITE(numout,*) '         thickness of the top boundary layer      rn_htbl      = ', rn_htbl
+               WRITE(numout,*) '         gamma formulation                        cn_gammablk  = ', TRIM(cn_gammablk) 
+               IF ( TRIM(cn_gammablk) .NE. 'spe' ) THEN 
+                  WRITE(numout,*) '         gammat coefficient                       rn_gammat0   = ', rn_gammat0  
+                  WRITE(numout,*) '         gammas coefficient                       rn_gammas0   = ', rn_gammas0  
+                  WRITE(numout,*) '         top background ke used (from namdrg_top) rn_ke0       = ', r_ke0_top
+                  WRITE(numout,*) '         top drag coef.    used (from namdrg_top) rn_Cd0       = ', r_Cdmin_top
+               END IF
+            END IF
+            WRITE(numout,*) ''
+            !
+            WRITE(numout,*) '      ice shelf melt parametrisation          ln_isfpar_mlt   = ', ln_isfpar_mlt
+            IF ( ln_isfpar_mlt ) THEN
+               WRITE(numout,*) '         isf parametrisation formulation         cn_isfpar_mlt   = ', TRIM(cn_isfpar_mlt)
+            END IF
+            WRITE(numout,*) ''
+            !
+            WRITE(numout,*) '      Coupling to an ice sheet model          ln_isfcpl       = ', ln_isfcpl
+            IF ( ln_isfcpl ) THEN
+               WRITE(numout,*) '         conservation activated ln_isfcpl_cons     = ', ln_isfcpl_cons
+               WRITE(numout,*) '         number of call of the extrapolation loop  = ', nn_drown
+            ENDIF
+            WRITE(numout,*) ''
+            !
+         ELSE
+            !
+            IF ( ln_isfcav ) THEN
+               WRITE(numout,*) ''
+               WRITE(numout,*) '   W A R N I N G: ice shelf cavities are open BUT no melt will be computed or read from file !'
+               WRITE(numout,*) ''
+            END IF
+            !
+         END IF
+
+         IF (ln_isfcav) THEN
+            WRITE(numout,*) '      Ice shelf load method                   cn_isfload        = ', TRIM(cn_isfload)
+            WRITE(numout,*) '         Temperature used to compute the ice shelf load            = ', rn_isfload_T
+            WRITE(numout,*) '         Salinity    used to compute the ice shelf load            = ', rn_isfload_S
+         END IF
+         WRITE(numout,*) ''
+         FLUSH(numout)
+
+      END IF
+      !
+
+      !---------------------------------------------------------------------------------------------------------------------
+      ! sanity check  ! issue ln_isfcav not yet known as well as l_isfoasis  => move this call in isf_stp ?
+      ! melt in the cavity without cavity
+      IF ( ln_isfcav_mlt .AND. (.NOT. ln_isfcav) ) &
+          &   CALL ctl_stop('ice shelf melt in the cavity activated (ln_isfcav_mlt) but no cavity detected in domcfg (ln_isfcav), STOP' )
+      !
+      ! ice sheet coupling without cavity
+      IF ( ln_isfcpl .AND. (.NOT. ln_isfcav) ) &
+         &   CALL ctl_stop('coupling with an ice sheet model detected (ln_isfcpl) but no cavity detected in domcfg (ln_isfcav), STOP' )
+      !
+      IF ( ln_isfcpl .AND. ln_isfcpl_cons .AND. ln_linssh ) &
+         &   CALL ctl_stop( 'The coupling between NEMO and an ice sheet model with the conservation option does not work with the linssh option' )
+      !
+      IF ( l_isfoasis .AND. .NOT. ln_isf ) CALL ctl_stop( ' OASIS send ice shelf fluxes to NEMO but NEMO does not have the isf module activated' )
+      !
+      IF ( l_isfoasis .AND. ln_isf ) THEN
+         !
+         ! NEMO coupled to ATMO model with isf cavity need oasis method for melt computation 
+         IF ( ln_isfcav_mlt .AND. TRIM(cn_isfcav_mlt) /= 'oasis' ) CALL ctl_stop( 'cn_isfcav_mlt = oasis is the only option availble if fwf send by oasis' )
+         IF ( ln_isfpar_mlt .AND. TRIM(cn_isfpar_mlt) /= 'oasis' ) CALL ctl_stop( 'cn_isfpar_mlt = oasis is the only option availble if fwf send by oasis' )
+         !
+         ! oasis melt computation with cavity open and cavity parametrised (not coded)
+         IF ( ln_isfcav_mlt .AND. ln_isfpar_mlt ) THEN
+            IF ( TRIM(cn_isfpar_mlt) == 'oasis' .AND. TRIM(cn_isfcav_mlt) == 'oasis' ) CALL ctl_stop( 'cn_isfpar_mlt = oasis and cn_isfcav_mlt = oasis not coded' )
+         END IF
+         !
+         ! compatibility ice shelf and vvl
+      !   IF( .NOT. ln_vvl_zstar .AND. ln_isf ) CALL ctl_stop( 'Only vvl_zstar has been tested with ice shelf cavity' )
+         !
+      END IF
+   END SUBROUTINE isf_ctl
+
+   
+   SUBROUTINE isf_nam
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE isf_nam  ***
+      !!
+      !! ** Purpose :   Read ice shelf namelist cfg and ref
+      !!
+      !!----------------------------------------------------------------------
+      INTEGER               :: ios                  ! Local integer output status for namelist read
+      !!----------------------------------------------------------------------
+      NAMELIST/namisf/ ln_isf        ,                                                           & 
+         &             cn_gammablk   , rn_gammat0    , rn_gammas0    , rn_htbl, sn_isfcav_fwf,   &
+         &             ln_isfcav_mlt , cn_isfcav_mlt , sn_isfcav_fwf ,                           &
+         &             ln_isfpar_mlt , cn_isfpar_mlt , sn_isfpar_fwf ,                           &
+         &             sn_isfpar_zmin, sn_isfpar_zmax, sn_isfpar_Leff,                           &
+         &             ln_isfcpl     , nn_drown      , ln_isfcpl_cons, ln_isfdebug,              &
+         &             cn_isfload    , rn_isfload_T  , rn_isfload_S  , cn_isfdir  ,              &
+         &             rn_isfpar_bg03_gt0
+      !!----------------------------------------------------------------------
+      !
+      READ  ( numnam_ref, namisf, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namisf in reference namelist' )
+      !
+      READ  ( numnam_cfg, namisf, IOSTAT = ios, ERR = 902 )
+902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namisf in configuration namelist' )
+      IF(lwm) WRITE ( numond, namisf )
+
+   END SUBROUTINE isf_nam
+   !!
+   !!======================================================================
+END MODULE isfstp
