Index: /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/ARCH/arch-openmpi_NAVITI_MERCATOR.fcm
===================================================================
--- /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/ARCH/arch-openmpi_NAVITI_MERCATOR.fcm	(revision 8761)
+++ /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/ARCH/arch-openmpi_NAVITI_MERCATOR.fcm	(revision 8762)
@@ -23,5 +23,5 @@
 %CPP	             cpp
 %FC                  mpif90
-%FCFLAGS             -O2 -fp-model precise  -traceback -r8  -convert big_endian -assume byterecl
+%FCFLAGS             -O1 -fp-model precise  -traceback -r8  -convert big_endian -assume byterecl
 %FFLAGS              %FCFLAGS
 %LD                   mpif90
Index: /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/CONFIG/ORCA2_LIM3_PISCES/EXP00/1_namelist_cfg
===================================================================
--- /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/CONFIG/ORCA2_LIM3_PISCES/EXP00/1_namelist_cfg	(revision 8761)
+++ /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/CONFIG/ORCA2_LIM3_PISCES/EXP00/1_namelist_cfg	(revision 8762)
@@ -22,5 +22,5 @@
 &namdom        !   space and time domain (bathymetry, mesh, timestep)
 !-----------------------------------------------------------------------  
-   ln_linssh   = .true.   !  =T  linear free surface  ==>>  model level are fixed in time
+   ln_linssh   = .false.   !  =T  linear free surface  ==>>  model level are fixed in time
    nn_closea   =    0      !  remove (=0) or keep (=1) closed seas and lakes (ORCA)
    !
@@ -171,4 +171,5 @@
 &namdyn_hpg    !   Hydrostatic pressure gradient option
 !-----------------------------------------------------------------------
+   ln_hpg_sco  = .true.   !  s-coordinate (standard jacobian formulation)
 /
 !-----------------------------------------------------------------------
Index: /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/CONFIG/TEST_CASES/VORTEX/EXP00/1_namelist_cfg
===================================================================
--- /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/CONFIG/TEST_CASES/VORTEX/EXP00/1_namelist_cfg	(revision 8761)
+++ /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/CONFIG/TEST_CASES/VORTEX/EXP00/1_namelist_cfg	(revision 8762)
@@ -30,5 +30,5 @@
 &namdom        !   space and time domain (bathymetry, mesh, timestep)
 !-----------------------------------------------------------------------
-   ln_linssh   =  .true.   !  =T  linear free surface  ==>>  model level are fixed in time
+   ln_linssh   =  .false.  !  =T  linear free surface  ==>>  model level are fixed in time
    rn_rdt      =    480.   !  time step for the dynamics (and tracer if nn_acc=0)
    rn_atfp     =   0.05    !  asselin time filter parameter
@@ -39,6 +39,6 @@
    nn_cln_update =    1    !  baroclinic update frequency
    ln_spc_dyn    = .true.  !  use 0 as special value for dynamics
-   rn_sponge_tra = 2850.   !  coefficient for tracer   sponge layer [m2/s]
-   rn_sponge_dyn = 2850.   !  coefficient for dynamics sponge layer [m2/s]
+   rn_sponge_tra =  800.   !  coefficient for tracer   sponge layer [m2/s]
+   rn_sponge_dyn =  800.   !  coefficient for dynamics sponge layer [m2/s]
    ln_chk_bathy  = .FALSE. !
 /
Index: /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/CONFIG/TEST_CASES/VORTEX/EXP00/namelist_cfg
===================================================================
--- /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/CONFIG/TEST_CASES/VORTEX/EXP00/namelist_cfg	(revision 8761)
+++ /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/CONFIG/TEST_CASES/VORTEX/EXP00/namelist_cfg	(revision 8762)
@@ -30,5 +30,5 @@
 &namdom        !   space and time domain (bathymetry, mesh, timestep)
 !-----------------------------------------------------------------------
-   ln_linssh   =  .true.   !  =T  linear free surface  ==>>  model level are fixed in time
+   ln_linssh   =  .false.  !  =T  linear free surface  ==>>  model level are fixed in time
    rn_rdt      =   1440.   !  time step for the dynamics (and tracer if nn_acc=0)
    rn_atfp     =   0.05    !  asselin time filter parameter
@@ -39,6 +39,6 @@
    nn_cln_update =    1    !  baroclinic update frequency
    ln_spc_dyn    = .true.  !  use 0 as special value for dynamics
-   rn_sponge_tra = 2850.   !  coefficient for tracer   sponge layer [m2/s]
-   rn_sponge_dyn = 2850.   !  coefficient for dynamics sponge layer [m2/s]
+   rn_sponge_tra =  800.   !  coefficient for tracer   sponge layer [m2/s]
+   rn_sponge_dyn =  800.   !  coefficient for dynamics sponge layer [m2/s]
    ln_chk_bathy  = .FALSE. !
 /
Index: /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/NST_SRC/agrif_opa_sponge.F90
===================================================================
--- /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/NST_SRC/agrif_opa_sponge.F90	(revision 8761)
+++ /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/NST_SRC/agrif_opa_sponge.F90	(revision 8762)
@@ -38,5 +38,7 @@
       !
 #if defined SPONGE
-      timecoeff = REAL(Agrif_NbStepint(),wp)/Agrif_rhot()
+!!      timecoeff = REAL(Agrif_NbStepint(),wp)/Agrif_rhot()
+!! Assume persistence:
+      timecoeff = REAL(Agrif_rhot()-1,wp)/REAL(Agrif_rhot())
 
       CALL Agrif_Sponge
@@ -61,5 +63,7 @@
 
 #if defined SPONGE
-      timecoeff = REAL(Agrif_NbStepint(),wp)/Agrif_rhot()
+!!      timecoeff = REAL(Agrif_NbStepint(),wp)/Agrif_rhot()
+!! Assume persistence:
+      timecoeff = REAL(Agrif_rhot()-1,wp)/REAL(Agrif_rhot())
 
       Agrif_SpecialValue=0.
@@ -207,5 +211,5 @@
       !
       IF( before ) THEN
-         tabres(i1:i2,j1:j2,k1:k2,n1:n2) = tsn(i1:i2,j1:j2,k1:k2,n1:n2)
+         tabres(i1:i2,j1:j2,k1:k2,n1:n2) = tsb(i1:i2,j1:j2,k1:k2,n1:n2)
       ELSE   
          !
Index: /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/NST_SRC/agrif_opa_update.F90
===================================================================
--- /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/NST_SRC/agrif_opa_update.F90	(revision 8761)
+++ /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/NST_SRC/agrif_opa_update.F90	(revision 8762)
@@ -139,9 +139,10 @@
 # if defined key_zdftke
 
-   SUBROUTINE Agrif_Update_Tke( )
+   SUBROUTINE Agrif_Update_Tke( kt )
       !!---------------------------------------------
       !!   *** ROUTINE Agrif_Update_Tke ***
       !!---------------------------------------------
       !!
+      INTEGER, INTENT(in) :: kt 
       ! 
       IF (Agrif_Root()) RETURN
@@ -272,5 +273,5 @@
    END SUBROUTINE dom_vvl_update_UVF
 
-   SUBROUTINE updateTS( tabres, i1, i2, j1, j2, k1, k2, n1, n2, before, nb, ndir )
+   SUBROUTINE updateTS( tabres, i1, i2, j1, j2, k1, k2, n1, n2, before )
       !!---------------------------------------------
       !!           *** ROUTINE updateT ***
@@ -279,7 +280,5 @@
       REAL(wp),DIMENSION(i1:i2,j1:j2,k1:k2,n1:n2), INTENT(inout) :: tabres
       LOGICAL, INTENT(in) :: before
-      INTEGER, INTENT(in) :: nb, ndir
       !!
-      LOGICAL :: western_side, eastern_side, southern_side, northern_side 
       INTEGER :: ji,jj,jk,jn
       REAL(wp) :: ztb, ztnu, ztno
@@ -340,106 +339,4 @@
          ENDIF
          !
-         !
-# if defined DECAL_FEEDBACK
-         IF (.NOT.ln_linssh) THEN 
-            western_side  = (nb == 1).AND.(ndir == 1)
-            eastern_side  = (nb == 1).AND.(ndir == 2)
-            southern_side = (nb == 2).AND.(ndir == 1)
-            northern_side = (nb == 2).AND.(ndir == 2)
-            !
-            ! Asselin correction 
-            IF (.NOT.(lk_agrif_fstep.AND.(neuler==0))) THEN
-               IF (southern_side) THEN
-                  DO jn = n1,n2
-                     DO jk=k1,k2
-                        DO ji=i1,i2
-                           ztb  = tsb(ji,j1-1,jk,jn) * e3t_b(ji,j1-1,jk) ! fse3t_b prior update should be used
-                           ztnu = tsn(ji,j1-1,jk,jn) * e3t_n(ji,j1-1,jk)
-                           ztno = tsn(ji,j1-1,jk,jn) * e3t_a(ji,j1-1,jk)
-                           tsb(ji,j1-1,jk,jn) = ( ztb + atfp * ( ztnu - ztno) )  & 
-                                     &        * tmask(ji,j1-1,jk) / e3t_b(ji,j1-1,jk)
-                        END DO
-                     ENDDO
-                  ENDDO
-               ENDIF
-               IF (northern_side) THEN
-                  DO jn = n1,n2
-                     DO jk=k1,k2
-                        DO ji=i1,i2
-                           ztb  = tsb(ji,j2+1,jk,jn) * e3t_b(ji,j2+1,jk) ! fse3t_b prior update should be used
-                           ztnu = tsn(ji,j2+1,jk,jn) * e3t_n(ji,j2+1,jk)
-                           ztno = tsn(ji,j2+1,jk,jn) * e3t_a(ji,j2+1,jk)
-                           tsb(ji,j2+1,jk,jn) = ( ztb + atfp * ( ztnu - ztno) )  & 
-                                     &        * tmask(ji,j2+1,jk) / e3t_b(ji,j2+1,jk)
-                        END DO
-                     ENDDO
-                  ENDDO
-               ENDIF
-               IF (western_side) THEN
-                  DO jn = n1,n2
-                     DO jk=k1,k2
-                        DO jj=j1,j2
-                           ztb  = tsb(i1-1,jj,jk,jn) * e3t_b(i1-1,jj,jk) ! fse3t_b prior update should be used
-                           ztnu = tsn(i1-1,jj,jk,jn) * e3t_n(i1-1,jj,jk)
-                           ztno = tsn(i1-1,jj,jk,jn) * e3t_a(i1-1,jj,jk)
-                           tsb(i1-1,jj,jk,jn) = ( ztb + atfp * ( ztnu - ztno) )  & 
-                                     &        * tmask(i1-1,jj,jk) / e3t_b(i1-1,jj,jk)
-                        END DO
-                     ENDDO
-                  ENDDO
-               ENDIF
-               IF (eastern_side) THEN
-                  DO jn = n1,n2
-                     DO jk=k1,k2
-                        DO jj=j1,j2
-                           ztb  = tsb(i2+1,jj,jk,jn) * e3t_b(i2+1,jj,jk) ! fse3t_b prior update should be used
-                           ztnu = tsn(i2+1,jj,jk,jn) * e3t_n(i2+1,jj,jk)
-                           ztno = tsn(i2+1,jj,jk,jn) * e3t_a(i2+1,jj,jk)
-                           tsb(i2+1,jj,jk,jn) = ( ztb + atfp * ( ztnu - ztno) )  & 
-                                     &        * tmask(i2+1,jj,jk) / e3t_b(i2+1,jj,jk)
-                        END DO
-                     ENDDO
-                  ENDDO
-               ENDIF
-            ENDIF ! Asselin correction
-
-            IF (southern_side) THEN
-               DO jn = n1,n2
-                  DO jk=k1,k2
-                     DO ji=i1,i2
-                        tsn(ji,j1-1,jk,jn) = tsn(ji,j1-1,jk,jn) * e3t_a(ji,j1-1,jk) / e3t_n(ji,j1-1,jk)
-                     END DO
-                  ENDDO
-               ENDDO
-            ENDIF
-            IF (northern_side) THEN
-               DO jn = n1,n2
-                  DO jk=k1,k2
-                     DO ji=i1,i2
-                        tsn(ji,j2+1,jk,jn) = tsn(ji,j2+1,jk,jn) * e3t_a(ji,j2+1,jk) / e3t_n(ji,j2+1,jk)
-                     END DO
-                  ENDDO
-               ENDDO
-            ENDIF
-            IF (western_side) THEN
-               DO jn = n1,n2
-                  DO jk=k1,k2
-                     DO jj=j1,j2
-                        tsn(i1-1,jj,jk,jn) = tsn(i1-1,jj,jk,jn) * e3t_a(i1-1,jj,jk) / e3t_n(i1-1,jj,jk)
-                     END DO
-                  ENDDO
-               ENDDO
-            ENDIF
-            IF (eastern_side) THEN
-               DO jn = n1,n2
-                  DO jk=k1,k2
-                     DO jj=j1,j2
-                        tsn(i2+1,jj,jk,jn) = tsn(i2+1,jj,jk,jn) * e3t_a(i2+1,jj,jk) / e3t_n(i2+1,jj,jk)
-                     END DO
-                  ENDDO
-               ENDDO
-            ENDIF
-         ENDIF
-#endif
       ENDIF
       ! 
@@ -676,5 +573,5 @@
 
 
-   SUBROUTINE updateSSH( tabres, i1, i2, j1, j2, before, nb, ndir )
+   SUBROUTINE updateSSH( tabres, i1, i2, j1, j2, before )
       !!---------------------------------------------
       !!          *** ROUTINE updateSSH ***
@@ -683,7 +580,5 @@
       REAL(wp), DIMENSION(i1:i2,j1:j2), INTENT(inout) :: tabres
       LOGICAL, INTENT(in) :: before
-      INTEGER, INTENT(in) :: nb, ndir
       !!
-      LOGICAL :: western_side, eastern_side, southern_side, northern_side 
       INTEGER :: ji, jj
       !!---------------------------------------------
@@ -717,35 +612,5 @@
          ENDIF
          !
-# if defined DECAL_FEEDBACK
-!         western_side  = (nb == 1).AND.(ndir == 1)
-!         eastern_side  = (nb == 1).AND.(ndir == 2)
-!         southern_side = (nb == 2).AND.(ndir == 1)
-!         northern_side = (nb == 2).AND.(ndir == 2)
-!         !
-!         ! Asselin correction 
-!         IF ( ln_dynspg_ts.AND.ln_bt_fw ) THEN
-!            IF (southern_side) THEN
-!               DO ji=i1,i2
-!                  sshn(ji,j1-1) = sshn(ji,j1-1) - rdt * r1_e2t(ji,j1-1) * (vb2_b_s(ji,j1-1)-vb2_b(ji,j1-1))
-!               END DO
-!            ENDIF
-!            IF (northern_side) THEN
-!               DO ji=i1,i2
-!                  sshn(ji,j1+1) = sshn(ji,j1+1) + rdt * r1_e2t(ji,j1+1) * (vb2_b_s(ji,j1)-vb2_b(ji,j1))
-!               END DO
-!            ENDIF
-!            IF (western_side) THEN
-!               DO jj=j1,j2
-!                  sshn(i1-1,jj) = sshn(i1-1,jj) - rdt * r1_e2t(i1-1,jj) * (ub2_b_s(i1-1,jj)-ub2_b(i1-1,jj))
-!               END DO
-!            ENDIF
-!            IF (eastern_side) THEN
-!               DO jj=j1,j2
-!                  sshn(i1+1,jj) = sshn(i1+1,jj) + rdt * r1_e2t(i1+1,jj) * (ub2_b_s(i1,jj)-ub2_b(i1,jj))
-!               END DO
-!            ENDIF
-!            ! 
-!         ENDIF
-#endif
+
       ENDIF
       !
@@ -753,5 +618,5 @@
 
 
-   SUBROUTINE updateub2b( tabres, i1, i2, j1, j2, before )
+   SUBROUTINE updateub2b( tabres, i1, i2, j1, j2, before, nb, ndir )
       !!---------------------------------------------
       !!          *** ROUTINE updateub2b ***
@@ -760,5 +625,7 @@
       REAL(wp), DIMENSION(i1:i2,j1:j2), INTENT(inout) :: tabres
       LOGICAL, INTENT(in) :: before
+      INTEGER, INTENT(in) :: nb, ndir
       !!
+      LOGICAL :: western_side, eastern_side 
       INTEGER :: ji, jj
       REAL(wp) :: zrhoy, za1
@@ -774,11 +641,34 @@
          tabres = zrhoy * tabres
       ELSE
+         ! 
+         tabres(i1:i2,j1:j2) = tabres(i1:i2,j1:j2) * r1_e2u(i1:i2,j1:j2)
+         !
+         ! Refluxing here:
+#if defined DECAL_FEEDBACK
+         western_side  = (nb == 1).AND.(ndir == 1)
+         eastern_side  = (nb == 1).AND.(ndir == 2)
+         !
+         IF (western_side) THEN
+            DO jj=j1,j2
+               sshn(i1  ,jj) = sshn(i1  ,jj) + rdt * r1_e1e2t(i1  ,jj) &
+                     &         * e2u(i1,jj) * (ub2_b(i1,jj)-tabres(i1,jj))
+            END DO
+         ENDIF
+         IF (eastern_side) THEN
+            DO jj=j1,j2
+               sshn(i2+1,jj) = sshn(i2+1,jj) - rdt * r1_e1e2t(i2+1,jj) &
+                     &         * e2u(i2,jj) * (ub2_b(i2,jj)-tabres(i2,jj))
+            END DO
+         ENDIF
+         ! 
+#endif
          za1 = 1._wp / REAL(Agrif_rhot(), wp)
-         tabres(i1:i2,j1:j2) = tabres(i1:i2,j1:j2) * r1_e2u(i1:i2,j1:j2)
+         !
          DO jj=j1,j2
             DO ji=i1,i2
+               ! Update time integrated fluxes also in case of multiply nested grids:
                ub2_i_b(ji,jj) = ub2_i_b(ji,jj) & 
                 & + za1 * (tabres(ji,jj) - ub2_b(ji,jj))
-!               ub2_b_s(ji,jj) = ub2_b(ji,jj)
+               ! Update half step back fluxes:
                ub2_b(ji,jj) = tabres(ji,jj)
             END DO
@@ -789,5 +679,5 @@
 
 
-   SUBROUTINE updatevb2b( tabres, i1, i2, j1, j2, before )
+   SUBROUTINE updatevb2b( tabres, i1, i2, j1, j2, before, nb, ndir )
       !!---------------------------------------------
       !!          *** ROUTINE updatevb2b ***
@@ -796,5 +686,7 @@
       REAL(wp), DIMENSION(i1:i2,j1:j2), INTENT(inout) :: tabres
       LOGICAL, INTENT(in) :: before
+      INTEGER, INTENT(in) :: nb, ndir
       !!
+      LOGICAL :: southern_side, northern_side 
       INTEGER :: ji, jj
       REAL(wp) :: zrhox, za1
@@ -810,11 +702,33 @@
          tabres = zrhox * tabres
       ELSE
+         ! 
+         tabres(i1:i2,j1:j2) = tabres(i1:i2,j1:j2) * r1_e1v(i1:i2,j1:j2)
+         !
+         ! Refluxing here:
+#if defined DECAL_FEEDBACK
+         southern_side = (nb == 2).AND.(ndir == 1)
+         northern_side = (nb == 2).AND.(ndir == 2)
+         !
+         IF (southern_side) THEN
+            DO ji=i1,i2
+               sshn(ji,j1  ) = sshn(ji,j1  ) + rdt * r1_e1e2t(ji,j1  ) &
+                     &         * e1v(ji,j1  ) * (vb2_b(ji,j1)-tabres(ji,j1))
+            END DO
+         ENDIF
+         IF (northern_side) THEN               
+            DO ji=i1,i2
+               sshn(ji,j2+1) = sshn(ji,j2+1) - rdt * r1_e1e2t(ji,j2+1) &
+                     &         * e1v(ji,j2  ) * (vb2_b(ji,j2)-tabres(ji,j2))
+            END DO
+         ENDIF
+         ! 
+#endif
          za1 = 1._wp / REAL(Agrif_rhot(), wp)
-         tabres(i1:i2,j1:j2) = tabres(i1:i2,j1:j2) * r1_e1v(i1:i2,j1:j2)
          DO jj=j1,j2
             DO ji=i1,i2
+               ! Update time integrated fluxes also in case of multiply nested grids:
                vb2_i_b(ji,jj) = vb2_i_b(ji,jj) & 
                 & + za1 * (tabres(ji,jj) - vb2_b(ji,jj))
-!               vb2_b_s(ji,jj) = vb2_b(ji,jj)
+               ! Update half step back fluxes:
                vb2_b(ji,jj) = tabres(ji,jj)
             END DO
@@ -952,16 +866,16 @@
          !
 !> jc tmp:
-!         DO jk = 1, jpkm1
-!            DO jj=j1,j2
-!               DO ji=i1,i2
-!                  IF (tmask(ji,jj,jk)==1) THEN
-!                     ptab(ji,jj,jk) = ptab(ji,jj,jk) * e3t_0(ji,jj,jk)
-!                  ELSE
-!                     ptab(ji,jj,jk) = e3t_0(ji,jj,jk)
-!                  ENDIF
-!               END DO
-!            END DO
-!         END DO
-         ptab(i1:i2,j1:j2,k1:k2) = ptab(i1:i2,j1:j2,k1:k2) * e3t_0(i1:i2,j1:j2,k1:k2)
+         DO jk = 1, jpkm1
+            DO jj=j1,j2
+               DO ji=i1,i2
+                  IF (tmask(ji,jj,jk)==1) THEN
+                     ptab(ji,jj,jk) = ptab(ji,jj,jk) * e3t_0(ji,jj,jk)
+                  ELSE
+                     ptab(ji,jj,jk) = e3t_0(ji,jj,jk)
+                  ENDIF
+               END DO
+            END DO
+         END DO
+!         ptab(i1:i2,j1:j2,k1:k2) = ptab(i1:i2,j1:j2,k1:k2) * e3t_0(i1:i2,j1:j2,k1:k2)
 !< jc tmp:
 
@@ -969,5 +883,5 @@
          ! of prognostic variables (needed to update initial state only)
          e3t_a(i1:i2,j1:j2,k1:k2) = e3t_n(i1:i2,j1:j2,k1:k2)
-!         hdivb(i1:i2,j1:j2,k1:k2)   = e3t_b(i1:i2,j1:j2,k1:k2)
+!         hdivn(i1:i2,j1:j2,k1:k2)   = e3t_b(i1:i2,j1:j2,k1:k2)
 
          IF (     (.NOT.(lk_agrif_fstep.AND.(neuler==0)).AND.(ln_dynspg_exp)) &
Index: /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/NST_SRC/agrif_top_sponge.F90
===================================================================
--- /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/NST_SRC/agrif_top_sponge.F90	(revision 8761)
+++ /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/NST_SRC/agrif_top_sponge.F90	(revision 8762)
@@ -46,5 +46,7 @@
       !
 #if defined SPONGE_TOP
-      timecoeff = REAL( Agrif_NbStepint(), wp ) / Agrif_rhot()
+!!      timecoeff = REAL( Agrif_NbStepint(), wp ) / Agrif_rhot()
+!! Assume persistence 
+      timecoeff = REAL(Agrif_rhot()-1,wp)/REAL(Agrif_rhot())
       CALL Agrif_sponge
       Agrif_SpecialValue    = 0._wp
@@ -73,5 +75,5 @@
       !
       IF( before ) THEN
-         tabres(i1:i2,j1:j2,k1:k2,n1:n2) = trn(i1:i2,j1:j2,k1:k2,n1:n2)
+         tabres(i1:i2,j1:j2,k1:k2,n1:n2) = trb(i1:i2,j1:j2,k1:k2,n1:n2)
       ELSE      
 !!gm line below use of :,:  versus i1:i2,j1:j2  ....   strange, not wrong.    ===>> to be corrected
Index: /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/NST_SRC/agrif_top_update.F90
===================================================================
--- /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/NST_SRC/agrif_top_update.F90	(revision 8761)
+++ /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/NST_SRC/agrif_top_update.F90	(revision 8762)
@@ -65,14 +65,12 @@
 
 
-   SUBROUTINE updateTRC( ptab, i1, i2, j1, j2, k1, k2, n1, n2, before, nb, ndir )
+   SUBROUTINE updateTRC( tabres, i1, i2, j1, j2, k1, k2, n1, n2, before )
       !!----------------------------------------------------------------------
-      !!                      *** ROUTINE updateT ***
+      !!                      *** ROUTINE updateTRC ***
       !!----------------------------------------------------------------------
       INTEGER                                    , INTENT(in   ) ::   i1, i2, j1, j2, k1, k2, n1, n2
-      REAL(wp),DIMENSION(i1:i2,j1:j2,k1:k2,n1:n2), INTENT(inout) ::   ptab
+      REAL(wp),DIMENSION(i1:i2,j1:j2,k1:k2,n1:n2), INTENT(inout) ::   tabres
       LOGICAL                                    , INTENT(in   ) ::   before
-      INTEGER, INTENT(in) :: nb, ndir
       !!
-      LOGICAL :: western_side, eastern_side, southern_side, northern_side 
       INTEGER :: ji,jj,jk,jn
       REAL(wp) :: ztb, ztnu, ztno
@@ -134,106 +132,4 @@
          ENDIF
          !
-         !
-# if defined DECAL_FEEDBACK
-         IF (.NOT.ln_linssh) THEN 
-            western_side  = (nb == 1).AND.(ndir == 1)
-            eastern_side  = (nb == 1).AND.(ndir == 2)
-            southern_side = (nb == 2).AND.(ndir == 1)
-            northern_side = (nb == 2).AND.(ndir == 2)
-            !
-            ! Asselin correction 
-            IF (.NOT.(lk_agrif_fstep.AND.(neuler==0))) THEN
-               IF (southern_side) THEN
-                  DO jn = n1,n2
-                     DO jk=k1,k2
-                        DO ji=i1,i2
-                           ztb  = trb(ji,j1-1,jk,jn) * e3t_b(ji,j1-1,jk) ! fse3t_b prior update should be used
-                           ztnu = trn(ji,j1-1,jk,jn) * e3t_n(ji,j1-1,jk)
-                           ztno = trn(ji,j1-1,jk,jn) * e3t_a(ji,j1-1,jk)
-                           trb(ji,j1-1,jk,jn) = ( ztb + atfp * ( ztnu - ztno) )  & 
-                                     &        * tmask(ji,j1-1,jk) / e3t_b(ji,j1-1,jk)
-                        END DO
-                     ENDDO
-                  ENDDO
-               ENDIF
-               IF (northern_side) THEN
-                  DO jn = n1,n2
-                     DO jk=k1,k2
-                        DO ji=i1,i2
-                           ztb  = trb(ji,j2+1,jk,jn) * e3t_b(ji,j2+1,jk) ! fse3t_b prior update should be used
-                           ztnu = trn(ji,j2+1,jk,jn) * e3t_n(ji,j2+1,jk)
-                           ztno = trn(ji,j2+1,jk,jn) * e3t_a(ji,j2+1,jk)
-                           trb(ji,j2+1,jk,jn) = ( ztb + atfp * ( ztnu - ztno) )  & 
-                                     &        * tmask(ji,j2+1,jk) / e3t_b(ji,j2+1,jk)
-                        END DO
-                     ENDDO
-                  ENDDO
-               ENDIF
-               IF (western_side) THEN
-                  DO jn = n1,n2
-                     DO jk=k1,k2
-                        DO jj=j1,j2
-                           ztb  = trb(i1-1,jj,jk,jn) * e3t_b(i1-1,jj,jk) ! fse3t_b prior update should be used
-                           ztnu = trn(i1-1,jj,jk,jn) * e3t_n(i1-1,jj,jk)
-                           ztno = trn(i1-1,jj,jk,jn) * e3t_a(i1-1,jj,jk)
-                           trb(i1-1,jj,jk,jn) = ( ztb + atfp * ( ztnu - ztno) )  & 
-                                     &        * tmask(i1-1,jj,jk) / e3t_b(i1-1,jj,jk)
-                        END DO
-                     ENDDO
-                  ENDDO
-               ENDIF
-               IF (eastern_side) THEN
-                  DO jn = n1,n2
-                     DO jk=k1,k2
-                        DO jj=j1,j2
-                           ztb  = trb(i2+1,jj,jk,jn) * e3t_b(i2+1,jj,jk) ! fse3t_b prior update should be used
-                           ztnu = trn(i2+1,jj,jk,jn) * e3t_n(i2+1,jj,jk)
-                           ztno = trn(i2+1,jj,jk,jn) * e3t_a(i2+1,jj,jk)
-                           trb(i2+1,jj,jk,jn) = ( ztb + atfp * ( ztnu - ztno) )  & 
-                                     &        * tmask(i2+1,jj,jk) / e3t_b(i2+1,jj,jk)
-                        END DO
-                     ENDDO
-                  ENDDO
-               ENDIF
-            ENDIF ! Asselin correction
-
-            IF (southern_side) THEN
-               DO jn = n1,n2
-                  DO jk=k1,k2
-                     DO ji=i1,i2
-                        trn(ji,j1-1,jk,jn) = trn(ji,j1-1,jk,jn) * e3t_a(ji,j1-1,jk) / e3t_n(ji,j1-1,jk)
-                     END DO
-                  ENDDO
-               ENDDO
-            ENDIF
-            IF (northern_side) THEN
-               DO jn = n1,n2
-                  DO jk=k1,k2
-                     DO ji=i1,i2
-                        trn(ji,j2+1,jk,jn) = trn(ji,j2+1,jk,jn) * e3t_a(ji,j2+1,jk) / e3t_n(ji,j2+1,jk)
-                     END DO
-                  ENDDO
-               ENDDO
-            ENDIF
-            IF (western_side) THEN
-               DO jn = n1,n2
-                  DO jk=k1,k2
-                     DO jj=j1,j2
-                        trn(i1-1,jj,jk,jn) = trn(i1-1,jj,jk,jn) * e3t_a(i1-1,jj,jk) / e3t_n(i1-1,jj,jk)
-                     END DO
-                  ENDDO
-               ENDDO
-            ENDIF
-            IF (eastern_side) THEN
-               DO jn = n1,n2
-                  DO jk=k1,k2
-                     DO jj=j1,j2
-                        trn(i2+1,jj,jk,jn) = trn(i2+1,jj,jk,jn) * e3t_a(i2+1,jj,jk) / e3t_n(i2+1,jj,jk)
-                     END DO
-                  ENDDO
-               ENDDO
-            ENDIF
-         ENDIF
-#endif
       ENDIF
       ! 
Index: /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/NST_SRC/agrif_user.F90
===================================================================
--- /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/NST_SRC/agrif_user.F90	(revision 8761)
+++ /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/NST_SRC/agrif_user.F90	(revision 8762)
@@ -343,5 +343,5 @@
 # if defined key_zdftke
 ! JC remove update because this precludes from perfect restartability
-!!   CALL Agrif_Update_tke()
+!!   CALL Agrif_Update_tke(0)
 # endif
 
Index: /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90
===================================================================
--- /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90	(revision 8761)
+++ /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90	(revision 8762)
@@ -1295,5 +1295,5 @@
 #if defined key_agrif
       ! Restrict the use of Agrif to the forward case only
-!!!      IF( .NOT.ln_bt_fw .AND. .NOT.Agrif_Root() )   CALL ctl_stop( 'AGRIF not implemented if ln_bt_fw=.FALSE.' )
+      IF( .NOT.ln_bt_fw .AND. .NOT.Agrif_Root() )   CALL ctl_stop( 'AGRIF not implemented if ln_bt_fw=.FALSE.' )
 #endif
       !
Index: /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfgls.F90
===================================================================
--- /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfgls.F90	(revision 8761)
+++ /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfgls.F90	(revision 8762)
@@ -207,9 +207,11 @@
          DO jj = 2, jpjm1
             DO ji = fs_2, fs_jpim1   ! vector opt.
-               avmu(ji,jj,jk) = 0.5_wp * ( avm(ji,jj,jk) + avm(ji+1,jj,jk) )   &
+!               avmu(ji,jj,jk) =   avmu(ji,jj,jk) &
+               avmu(ji,jj,jk) = 0.5_wp * ( avm(ji,jj,jk) + avm(ji+1,jj,jk) ) * umask(ji,jj,jk)  &
                   &                    * ( un(ji,jj,jk-1) - un(ji,jj,jk)   )   &
                   &                    * ( ub(ji,jj,jk-1) - ub(ji,jj,jk)   )   &
                   &                    / (  e3uw_n(ji,jj,jk) * e3uw_b(ji,jj,jk) )
-               avmv(ji,jj,jk) = 0.5_wp * ( avm(ji,jj,jk) + avm(ji,jj+1,jk) )   & 
+!               avmv(ji,jj,jk) =   avmv(ji,jj,jk) &
+               avmv(ji,jj,jk) = 0.5_wp * ( avm(ji,jj,jk) + avm(ji,jj+1,jk) ) * vmask(ji,jj,jk)  & 
                   &                    * ( vn(ji,jj,jk-1) - vn(ji,jj,jk)   )   &
                   &                    * ( vb(ji,jj,jk-1) - vb(ji,jj,jk) )     &
Index: /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90
===================================================================
--- /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90	(revision 8761)
+++ /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90	(revision 8762)
@@ -192,5 +192,5 @@
       ! Update child grid f => parent grid 
 !!! JC: suppress update since restartability is not possible in that case
-!!!      IF( .NOT.Agrif_Root() )   CALL Agrif_Update_Tke( )      ! children only
+!!!      IF( .NOT.Agrif_Root() )   CALL Agrif_Update_Tke(kt)      ! children only
 #endif      
      ! 
Index: /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/SETTE/sette.sh
===================================================================
--- /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/SETTE/sette.sh	(revision 8761)
+++ /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/SETTE/sette.sh	(revision 8762)
@@ -1114,7 +1114,5 @@
     set_namelist namelist_cfg ln_clobber .true.
     set_namelist namelist_cfg ln_read_cfg .true.
-    set_namelist namelist_cfg ln_linssh .true.
-    set_namelist namelist_cfg ln_hpg_sco .false.
-    set_namelist namelist_cfg ln_hpg_zps .true. 
+    set_namelist namelist_cfg ln_linssh .false.
     set_namelist namelist_cfg nn_fwb 0
     set_namelist namelist_cfg jpni 1
@@ -1126,7 +1124,5 @@
     set_namelist 1_namelist_cfg ln_clobber .true.
     set_namelist 1_namelist_cfg ln_read_cfg .true.
-    set_namelist 1_namelist_cfg ln_linssh .true.
-    set_namelist 1_namelist_cfg ln_hpg_sco .false.
-    set_namelist 1_namelist_cfg ln_hpg_zps .true. 
+    set_namelist 1_namelist_cfg ln_linssh .false.
     if [ ${USING_MPMD} == "yes" ] ; then
        set_xio_using_server iodef.xml true
@@ -1160,7 +1156,5 @@
     set_namelist namelist_cfg ln_clobber .true.
     set_namelist namelist_cfg ln_read_cfg .true.
-    set_namelist namelist_cfg ln_linssh .true.
-    set_namelist namelist_cfg ln_hpg_sco .false.
-    set_namelist namelist_cfg ln_hpg_zps .true. 
+    set_namelist namelist_cfg ln_linssh .false.
     set_namelist namelist_cfg nn_fwb 0
     set_namelist namelist_cfg jpni 2
@@ -1197,7 +1191,5 @@
     set_namelist namelist_cfg ln_clobber .true.
     set_namelist namelist_cfg ln_read_cfg .true.
-    set_namelist namelist_cfg ln_linssh .true.
-    set_namelist namelist_cfg ln_hpg_sco .false.
-    set_namelist namelist_cfg ln_hpg_zps .true. 
+    set_namelist namelist_cfg ln_linssh .false.
     set_namelist namelist_cfg nn_fwb 0
     set_namelist namelist_cfg jpni 2
@@ -1236,7 +1228,5 @@
     set_namelist namelist_cfg ln_clobber .true.
     set_namelist namelist_cfg ln_read_cfg .true.
-    set_namelist namelist_cfg ln_linssh .true.
-    set_namelist namelist_cfg ln_hpg_sco .false.
-    set_namelist namelist_cfg ln_hpg_zps .true. 
+    set_namelist namelist_cfg ln_linssh .false.
     set_namelist namelist_cfg nn_fwb 0
     set_namelist namelist_cfg jpni 2
@@ -1251,7 +1241,5 @@
     set_namelist 1_namelist_cfg ln_clobber .true.
     set_namelist 1_namelist_cfg ln_read_cfg .true.
-    set_namelist 1_namelist_cfg ln_linssh .true.
-    set_namelist 1_namelist_cfg ln_hpg_sco .false.
-    set_namelist 1_namelist_cfg ln_hpg_zps .true. 
+    set_namelist 1_namelist_cfg ln_linssh .false.
 #
     if [ ${USING_MPMD} == "yes" ] ; then
@@ -1275,7 +1263,5 @@
     set_namelist namelist_cfg ln_clobber .true.
     set_namelist namelist_cfg ln_read_cfg .true.
-    set_namelist namelist_cfg ln_linssh .true.
-    set_namelist namelist_cfg ln_hpg_sco .false.
-    set_namelist namelist_cfg ln_hpg_zps .true. 
+    set_namelist namelist_cfg ln_linssh .false.
     set_namelist namelist_cfg nn_fwb 0
     set_namelist namelist_cfg jpni 2
@@ -1291,7 +1277,5 @@
     set_namelist 1_namelist_cfg ln_clobber .true.
     set_namelist 1_namelist_cfg ln_read_cfg .true.
-    set_namelist 1_namelist_cfg ln_linssh .true.
-    set_namelist 1_namelist_cfg ln_hpg_sco .false.
-    set_namelist 1_namelist_cfg ln_hpg_zps .true. 
+    set_namelist 1_namelist_cfg ln_linssh .false.
     set_namelist namelist_cfg cn_ocerst_in \"O2LP_LONG_00000075_restart\"
     set_namelist namelist_ice_cfg cn_icerst_in \"O2LP_LONG_00000075_restart_ice\"
@@ -1336,7 +1320,5 @@
     set_namelist namelist_cfg ln_clobber .true.
     set_namelist namelist_cfg ln_read_cfg .true.
-    set_namelist namelist_cfg ln_linssh .true.
-    set_namelist namelist_cfg ln_hpg_sco .false.
-    set_namelist namelist_cfg ln_hpg_zps .true. 
+    set_namelist namelist_cfg ln_linssh .false.
     set_namelist namelist_cfg nn_fwb 0
     set_namelist namelist_cfg jpni 4
@@ -1349,7 +1331,5 @@
     set_namelist 1_namelist_cfg ln_clobber .true.
     set_namelist 1_namelist_cfg ln_read_cfg .true.
-    set_namelist 1_namelist_cfg ln_linssh .true.
-    set_namelist 1_namelist_cfg ln_hpg_sco .false.
-    set_namelist 1_namelist_cfg ln_hpg_zps .true. 
+    set_namelist 1_namelist_cfg ln_linssh .false.
 
     if [ ${USING_MPMD} == "yes" ] ; then
@@ -1375,7 +1355,5 @@
     set_namelist namelist_cfg ln_clobber .true.
     set_namelist namelist_cfg ln_read_cfg .true.
-    set_namelist namelist_cfg ln_linssh .true.
-    set_namelist namelist_cfg ln_hpg_sco .false.
-    set_namelist namelist_cfg ln_hpg_zps .true. 
+    set_namelist namelist_cfg ln_linssh .false.
     set_namelist namelist_cfg nn_fwb 0
     set_namelist namelist_cfg jpni 2
@@ -1388,7 +1366,5 @@
     set_namelist 1_namelist_cfg ln_clobber .true.
     set_namelist 1_namelist_cfg ln_read_cfg .true.
-    set_namelist 1_namelist_cfg ln_linssh .true.
-    set_namelist 1_namelist_cfg ln_hpg_sco .false.
-    set_namelist 1_namelist_cfg ln_hpg_zps .true. 
+    set_namelist 1_namelist_cfg ln_linssh .false.
 
     if [ ${USING_MPMD} == "yes" ] ; then
Index: /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/SETTE/sette_rpt.sh
===================================================================
--- /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/SETTE/sette_rpt.sh	(revision 8761)
+++ /branches/2017/dev_r8624_AGRIF3_VVL/NEMOGCM/SETTE/sette_rpt.sh	(revision 8762)
@@ -32,14 +32,14 @@
     cd ${TOOLS_DIR}/REBUILD_NEMO
     #SF echo "REBUILD LONG restart SAS files, without standard output"
-    ./rebuild_nemo -t 4 ../../CONFIG/SAS_LONG/LONG/SAS_00000100_restart_ice  $NPROC > /dev/null 2>&1
+    ./rebuild_nemo -t 4 ../../CONFIG/SAS_LONG/LONG/SAS_00000240_restart_ice  $NPROC > /dev/null 2>&1
     #SF echo "REBUILD SHORT restart SAS files, without standard output"
-    ./rebuild_nemo -t 4 ../../CONFIG/SAS_LONG/SHORT/SAS_00000100_restart_ice $NPROC >&-
+    ./rebuild_nemo -t 4 ../../CONFIG/SAS_LONG/SHORT/SAS_00000240_restart_ice $NPROC >&-
     cd ${SAS_RESTART_DIR}/LONG
     #SF echo "COPY rebuild restart files"
-    cp SAS_00000100_restart_ice.nc $vdir/$nam/$mach/$dorv/LONG/.
-    cp ../SHORT/SAS_00000100_restart_ice.nc $vdir/$nam/$mach/$dorv/SHORT/.
-
-    f1o=$vdir/$nam/$mach/$dorv/LONG/SAS_00000100_restart_ice.nc
-    f2o=$vdir/$nam/$mach/$dorv/SHORT/SAS_00000100_restart_ice.nc
+    cp SAS_00000240_restart_ice.nc $vdir/$nam/$mach/$dorv/LONG/.
+    cp ../SHORT/SAS_00000240_restart_ice.nc $vdir/$nam/$mach/$dorv/SHORT/.
+
+    f1o=$vdir/$nam/$mach/$dorv/LONG/SAS_00000240_restart_ice.nc
+    f2o=$vdir/$nam/$mach/$dorv/SHORT/SAS_00000240_restart_ice.nc
     if  [ ! -f $f1o ] &&  [ ! -f $f2o ] ; then
       printf "%-20s %s\n" $nam " REBUILD SAS restart ice DOES NOT exists; incomplete test";
