Index: NEMO/branches/2019/dev_r11233_AGRIF-05_jchanut_vert_coord_interp/src/NST/agrif_oce_update.F90
===================================================================
--- NEMO/branches/2019/dev_r11233_AGRIF-05_jchanut_vert_coord_interp/src/NST/agrif_oce_update.F90	(revision 11605)
+++ NEMO/branches/2019/dev_r11233_AGRIF-05_jchanut_vert_coord_interp/src/NST/agrif_oce_update.F90	(revision 11607)
@@ -284,15 +284,14 @@
       !!
       INTEGER :: ji,jj,jk,jn
-      REAL(wp), DIMENSION(i1:i2,j1:j2,1:jpk,n1:n2) :: tabres_child
+      INTEGER  :: N_in, N_out
+      REAL(wp) :: ztb, ztnu, ztno
       REAL(wp) :: h_in(k1:k2)
       REAL(wp) :: h_out(1:jpk)
-      INTEGER  :: N_in, N_out
-      REAL(wp) :: zrho_xy, h_diff
-      REAL(wp) :: tabin(k1:k2,n1:n2)
+      REAL(wp) :: tabin(k1:k2,jpts)
+      REAL(wp), DIMENSION(i1:i2,j1:j2,1:jpk,1:jpts) :: tabres_child
       !!---------------------------------------------
       !
       IF (before) THEN
          AGRIF_SpecialValue = -999._wp
-         zrho_xy = Agrif_rhox() * Agrif_rhoy() 
          DO jn = n1,n2-1
             DO jk=k1,k2
@@ -300,5 +299,5 @@
                   DO ji=i1,i2
                      tabres(ji,jj,jk,jn) = (tsn(ji,jj,jk,jn) * e3t_n(ji,jj,jk) ) &
-                                           * tmask(ji,jj,jk) + (tmask(ji,jj,jk)-1)*999._wp
+                                           * tmask(ji,jj,jk) + (tmask(ji,jj,jk)-1._wp)*999._wp
                   END DO
                END DO
@@ -314,5 +313,5 @@
          END DO
       ELSE
-         tabres_child(:,:,:,:) = 0.
+         tabres_child(:,:,:,:) = 0._wp
          AGRIF_SpecialValue = 0._wp
          DO jj=j1,j2
@@ -332,11 +331,4 @@
                ENDDO
                IF (N_in > 0) THEN !Remove this?
-                  h_diff = sum(h_out(1:N_out))-sum(h_in(1:N_in))
-                  IF (h_diff < -1.e-4) THEN
-                     print *,'CHECK YOUR bathy T points ...',ji,jj,h_diff,sum(h_in(1:N_in)),sum(h_out(1:N_out))
-                     print *,h_in(1:N_in)
-                     print *,h_out(1:N_out)
-                     STOP
-                  ENDIF
                   CALL reconstructandremap(tabin(1:N_in,1:jpts),h_in(1:N_in),tabres_child(ji,jj,1:N_out,1:jpts),h_out(1:N_out),N_in,N_out,jpts)
                ENDIF
@@ -346,24 +338,26 @@
          IF (.NOT.(lk_agrif_fstep.AND.(neuler==0))) THEN
             ! Add asselin part
-            DO jn = n1,n2-1
-               DO jk=1,jpk
-                  DO jj=j1,j2
-                     DO ji=i1,i2
-                        IF( tabres_child(ji,jj,jk,jn) .NE. 0. ) THEN
-                           tsb(ji,jj,jk,jn) = tsb(ji,jj,jk,jn) & 
-                                 & + atfp * ( tabres_child(ji,jj,jk,jn) &
-                                 &          - tsn(ji,jj,jk,jn) ) * tmask(ji,jj,jk)
+            DO jn = 1,jpts
+               DO jk = 1, jpkm1
+                  DO jj = j1, j2
+                     DO ji = i1, i2
+                        IF( tabres_child(ji,jj,jk,jn) /= 0._wp ) THEN
+                           ztb  = tsb(ji,jj,jk,jn) * e3t_b(ji,jj,jk) ! fse3t_b prior update should be used
+                           ztnu = tabres_child(ji,jj,jk,jn) * e3t_n(ji,jj,jk)
+                           ztno = tsn(ji,jj,jk,jn) * e3t_a(ji,jj,jk)
+                           tsb(ji,jj,jk,jn) = ( ztb + atfp * ( ztnu - ztno) )  & 
+                                     &        * tmask(ji,jj,jk) / e3t_b(ji,jj,jk)
                         ENDIF
-                     ENDDO
-                  ENDDO
-               ENDDO
-            ENDDO
-         ENDIF
-         DO jn = n1,n2-1
-            DO jk=1,jpk
-               DO jj=j1,j2
-                  DO ji=i1,i2
-                     IF( tabres_child(ji,jj,jk,jn) .NE. 0. ) THEN 
-                        tsn(ji,jj,jk,jn) = tabres_child(ji,jj,jk,jn) * tmask(ji,jj,jk)
+                     END DO
+                  END DO
+               END DO
+            END DO
+         ENDIF
+         DO jn = 1,jpts
+            DO jk = 1, jpkm1
+               DO jj = j1, j2
+                  DO ji = i1, i2
+                     IF( tabres_child(ji,jj,jk,jn) /= 0._wp ) THEN 
+                        tsn(ji,jj,jk,jn) = tabres_child(ji,jj,jk,jn)
                      END IF
                   END DO
@@ -371,4 +365,8 @@
             END DO
          END DO
+         !
+         IF  ((neuler==0).AND.(Agrif_Nb_Step()==0) ) THEN
+            tsb(i1:i2,j1:j2,1:jpkm1,1:jpts)  = tsn(i1:i2,j1:j2,1:jpkm1,1:jpts)
+         ENDIF
       ENDIF
       ! 
@@ -460,5 +458,5 @@
       !
       INTEGER ::   ji, jj, jk
-      REAL(wp)::   zrhoy
+      REAL(wp)::   zrhoy, zub, zunu, zuno
 ! VERTICAL REFINEMENT BEGIN
       REAL(wp), DIMENSION(i1:i2,j1:j2,1:jpk) :: tabres_child
@@ -527,11 +525,14 @@
             ENDDO
          ENDDO
-
+         !
          DO jk=1,jpk
             DO jj=j1,j2
                DO ji=i1,i2
                   IF (.NOT.(lk_agrif_fstep.AND.(neuler==0))) THEN ! Add asselin part
-                     ub(ji,jj,jk) = ub(ji,jj,jk) & 
-                           & + atfp * ( tabres_child(ji,jj,jk) - un(ji,jj,jk) ) * umask(ji,jj,jk)
+                     zub  = ub(ji,jj,jk) * e3u_b(ji,jj,jk)  ! fse3t_b prior update should be used
+                     zuno = un(ji,jj,jk) * e3u_a(ji,jj,jk)
+                     zunu = tabres_child(ji,jj,jk) * e3u_n(ji,jj,jk)
+                     ub(ji,jj,jk) = ( zub + atfp * ( zunu - zuno) ) &      
+                                    & * umask(ji,jj,jk) / e3u_b(ji,jj,jk)
                   ENDIF
                   !
@@ -540,4 +541,9 @@
             END DO
          END DO
+         !
+         IF  ((neuler==0).AND.(Agrif_Nb_Step()==0) ) THEN
+            ub(i1:i2,j1:j2,1:jpkm1)  = un(i1:i2,j1:j2,1:jpkm1)
+         ENDIF
+         !
       ENDIF
       ! 
@@ -647,5 +653,5 @@
       !
       INTEGER  ::   ji, jj, jk
-      REAL(wp) ::   zrhox
+      REAL(wp) ::   zrhox, zvb, zvnu, zvno
 ! VERTICAL REFINEMENT BEGIN
       REAL(wp), DIMENSION(i1:i2,j1:j2,1:jpk) :: tabres_child
@@ -692,5 +698,5 @@
                   h_diff = sum(h_out(1:N_out))-sum(h_in(1:N_in))
                   IF (h_diff < -1.e-4) then
-!Even if bathy at T points match it's possible for the U points to be deeper in the child grid. 
+!Even if bathy at T points match it's possible for the V points to be deeper in the child grid. 
 !In this case we need to move transport from the child grid cells below bed of parent grid into the bottom cell.
                      excess = 0._wp
@@ -712,12 +718,14 @@
             ENDDO
          ENDDO
-
-         DO jk=1,jpk
+         !
+         DO jk=1,jpkm1
             DO jj=j1,j2
                DO ji=i1,i2
-                  !
-                  IF( .NOT.(lk_agrif_fstep.AND.(neuler==0)) ) THEN ! Add asselin part
-                     vb(ji,jj,jk) = vb(ji,jj,jk) & 
-                           & + atfp * ( tabres_child(ji,jj,jk) - vn(ji,jj,jk) ) * vmask(ji,jj,jk)
+                  IF (.NOT.(lk_agrif_fstep.AND.(neuler==0))) THEN ! Add asselin part
+                     zvb  = vb(ji,jj,jk) * e3v_b(ji,jj,jk) ! fse3t_b prior update should be used
+                     zvno = vn(ji,jj,jk) * e3v_a(ji,jj,jk)
+                     zvnu = tabres_child(ji,jj,jk) * e3v_n(ji,jj,jk)
+                     vb(ji,jj,jk) = ( zvb + atfp * ( zvnu - zvno) ) &      
+                                    & * vmask(ji,jj,jk) / e3v_b(ji,jj,jk)
                   ENDIF
                   !
@@ -726,4 +734,9 @@
             END DO
          END DO
+         !
+         IF  ((neuler==0).AND.(Agrif_Nb_Step()==0) ) THEN
+            vb(i1:i2,j1:j2,1:jpkm1)  = vn(i1:i2,j1:j2,1:jpkm1)
+         ENDIF
+         !
       ENDIF
       ! 
Index: NEMO/branches/2019/dev_r11233_AGRIF-05_jchanut_vert_coord_interp/src/NST/agrif_top_update.F90
===================================================================
--- NEMO/branches/2019/dev_r11233_AGRIF-05_jchanut_vert_coord_interp/src/NST/agrif_top_update.F90	(revision 11605)
+++ NEMO/branches/2019/dev_r11233_AGRIF-05_jchanut_vert_coord_interp/src/NST/agrif_top_update.F90	(revision 11607)
@@ -124,15 +124,17 @@
             ENDDO
          ENDDO
-
+         !
          IF (.NOT.(lk_agrif_fstep.AND.(neuler==0))) THEN
             ! Add asselin part
             DO jn = 1,jptra
-               DO jk=1,jpk
+               DO jk=1,jpkm1
                   DO jj=j1,j2
                      DO ji=i1,i2
                         IF( tabres_child(ji,jj,jk,jn) .NE. 0. ) THEN
-                           trb(ji,jj,jk,jn) = trb(ji,jj,jk,jn) & 
-                                 & + atfp * ( tabres_child(ji,jj,jk,jn) &
-                                 &          - trn(ji,jj,jk,jn) ) * tmask(ji,jj,jk)
+                           ztb  = trb(ji,jj,jk,jn) * e3t_b(ji,jj,jk) ! fse3t_b prior update should be used
+                           ztnu = tabres_child(ji,jj,jk,jn) * e3t_n(ji,jj,jk)
+                           ztno = trn(ji,jj,jk,jn) * e3t_a(ji,jj,jk)
+                           trb(ji,jj,jk,jn) = ( ztb + atfp * ( ztnu - ztno) )  & 
+                                     &        * tmask(ji,jj,jk) / e3t_b(ji,jj,jk)
                         ENDIF
                      ENDDO
@@ -142,9 +144,9 @@
          ENDIF
          DO jn = 1,jptra
-            DO jk=1,jpk
+            DO jk=1,jpkm1
                DO jj=j1,j2
                   DO ji=i1,i2
                      IF( tabres_child(ji,jj,jk,jn) .NE. 0. ) THEN 
-                        trn(ji,jj,jk,jn) = tabres_child(ji,jj,jk,jn) * tmask(ji,jj,jk)
+                        trn(ji,jj,jk,jn) = tabres_child(ji,jj,jk,jn)
                      END IF
                   END DO
@@ -152,4 +154,10 @@
             END DO
          END DO
+         !
+         IF  ((neuler==0).AND.(Agrif_Nb_Step()==0) ) THEN
+            trb(i1:i2,j1:j2,1:jpkm1,1:jptra)  = trn(i1:i2,j1:j2,1:jpkm1,1:jptra)
+         ENDIF
+         !
+
       ENDIF
       ! 
