Index: branches/2017/dev_r7963_nemo_v3_6_AGRIF-3_AGRIFVVL/NEMOGCM/NEMO/NST_SRC/agrif_opa_interp.F90
===================================================================
--- branches/2017/dev_r7963_nemo_v3_6_AGRIF-3_AGRIFVVL/NEMOGCM/NEMO/NST_SRC/agrif_opa_interp.F90	(revision 7964)
+++ branches/2017/dev_r7963_nemo_v3_6_AGRIF-3_AGRIFVVL/NEMOGCM/NEMO/NST_SRC/agrif_opa_interp.F90	(revision 7971)
@@ -137,5 +137,5 @@
          DO jk=1,jpkm1
             DO jj=1,jpj
-               spgu(2,jj)=spgu(2,jj)+fse3u(2,jj,jk)*ua(2,jj,jk)
+               spgu(2,jj)=spgu(2,jj)+fse3u_a(2,jj,jk)*ua(2,jj,jk)
             END DO
          END DO
@@ -143,5 +143,5 @@
          DO jj=1,jpj
             IF (umask(2,jj,1).NE.0.) THEN
-               spgu(2,jj)=spgu(2,jj)/hu(2,jj)
+               spgu(2,jj)=spgu(2,jj)*hur_a(2,jj)
             ENDIF
          END DO
@@ -161,5 +161,5 @@
          DO jk=1,jpkm1
             DO jj=1,jpj
-               spgu1(2,jj)=spgu1(2,jj)+fse3u(2,jj,jk)*ua(2,jj,jk)
+               spgu1(2,jj)=spgu1(2,jj)+fse3u_a(2,jj,jk)*ua(2,jj,jk)
             END DO
          END DO
@@ -167,5 +167,5 @@
          DO jj=1,jpj
             IF (umask(2,jj,1).NE.0.) THEN
-               spgu1(2,jj)=spgu1(2,jj)/hu(2,jj)
+               spgu1(2,jj)=spgu1(2,jj)*hur_a(2,jj)
             ENDIF
          END DO
@@ -207,10 +207,10 @@
          DO jk=1,jpkm1
             DO jj=1,jpj
-               spgu(nlci-2,jj)=spgu(nlci-2,jj)+fse3u(nlci-2,jj,jk)*ua(nlci-2,jj,jk)
+               spgu(nlci-2,jj)=spgu(nlci-2,jj)+fse3u_a(nlci-2,jj,jk)*ua(nlci-2,jj,jk)
             ENDDO
          ENDDO
          DO jj=1,jpj
             IF (umask(nlci-2,jj,1).NE.0.) THEN
-               spgu(nlci-2,jj)=spgu(nlci-2,jj)/hu(nlci-2,jj)
+               spgu(nlci-2,jj)=spgu(nlci-2,jj)*hur_a(nlci-2,jj)
             ENDIF
          END DO
@@ -229,10 +229,10 @@
          DO jk=1,jpkm1
             DO jj=1,jpj
-               spgu1(nlci-2,jj)=spgu1(nlci-2,jj)+fse3u(nlci-2,jj,jk)*ua(nlci-2,jj,jk)*umask(nlci-2,jj,jk)
+               spgu1(nlci-2,jj)=spgu1(nlci-2,jj)+fse3u_a(nlci-2,jj,jk)*ua(nlci-2,jj,jk)*umask(nlci-2,jj,jk)
             END DO
          END DO
          DO jj=1,jpj
             IF (umask(nlci-2,jj,1).NE.0.) THEN
-               spgu1(nlci-2,jj)=spgu1(nlci-2,jj)/hu(nlci-2,jj)
+               spgu1(nlci-2,jj)=spgu1(nlci-2,jj)*hur_a(nlci-2,jj)
             ENDIF
          END DO
@@ -278,5 +278,5 @@
          DO jk=1,jpkm1
             DO ji=1,jpi
-               spgv(ji,2)=spgv(ji,2)+fse3v(ji,2,jk)*va(ji,2,jk)
+               spgv(ji,2)=spgv(ji,2)+fse3v_a(ji,2,jk)*va(ji,2,jk)
             END DO
          END DO
@@ -284,5 +284,5 @@
          DO ji=1,jpi
             IF (vmask(ji,2,1).NE.0.) THEN
-               spgv(ji,2)=spgv(ji,2)/hv(ji,2)
+               spgv(ji,2)=spgv(ji,2)*hvr_a(ji,2)
             ENDIF
          END DO
@@ -302,5 +302,5 @@
          DO jk=1,jpkm1
             DO ji=1,jpi
-               spgv1(ji,2)=spgv1(ji,2)+fse3v(ji,2,jk)*va(ji,2,jk)*vmask(ji,2,jk)
+               spgv1(ji,2)=spgv1(ji,2)+fse3v_a(ji,2,jk)*va(ji,2,jk)*vmask(ji,2,jk)
             END DO
          END DO
@@ -308,5 +308,5 @@
          DO ji=1,jpi
             IF (vmask(ji,2,1).NE.0.) THEN
-               spgv1(ji,2)=spgv1(ji,2)/hv(ji,2)
+               spgv1(ji,2)=spgv1(ji,2)*hvr_a(ji,2)
             ENDIF
          END DO
@@ -353,5 +353,5 @@
          DO jk=1,jpkm1
             DO ji=1,jpi
-               spgv(ji,nlcj-2)=spgv(ji,nlcj-2)+fse3v(ji,nlcj-2,jk)*va(ji,nlcj-2,jk)
+               spgv(ji,nlcj-2)=spgv(ji,nlcj-2)+fse3v_a(ji,nlcj-2,jk)*va(ji,nlcj-2,jk)
             END DO
          END DO
@@ -359,5 +359,5 @@
          DO ji=1,jpi
             IF (vmask(ji,nlcj-2,1).NE.0.) THEN
-               spgv(ji,nlcj-2)=spgv(ji,nlcj-2)/hv(ji,nlcj-2)
+               spgv(ji,nlcj-2)=spgv(ji,nlcj-2)*hvr_a(ji,nlcj-2)
             ENDIF
          END DO
@@ -378,5 +378,5 @@
          DO jk=1,jpkm1
             DO ji=1,jpi
-               spgv1(ji,nlcj-2)=spgv1(ji,nlcj-2)+fse3v(ji,nlcj-2,jk)*va(ji,nlcj-2,jk)
+               spgv1(ji,nlcj-2)=spgv1(ji,nlcj-2)+fse3v_a(ji,nlcj-2,jk)*va(ji,nlcj-2,jk)
             END DO
          END DO
@@ -384,5 +384,5 @@
          DO ji=1,jpi
             IF (vmask(ji,nlcj-2,1).NE.0.) THEN
-               spgv1(ji,nlcj-2)=spgv1(ji,nlcj-2)/hv(ji,nlcj-2)
+               spgv1(ji,nlcj-2)=spgv1(ji,nlcj-2)*hvr_a(ji,nlcj-2)
             ENDIF
          END DO
@@ -503,10 +503,4 @@
          zt = REAL(Agrif_NbStepint(),wp) / zrhot
       ENDIF
-
-      ! Linear interpolation of sea level
-      Agrif_SpecialValue    = 0.e0
-      Agrif_UseSpecialValue = .TRUE.
-      CALL Agrif_Bc_variable(sshn_id,calledweight=zt, procname=interpsshn )
-      Agrif_UseSpecialValue = .FALSE.
 
       ! Interpolate barotropic fluxes
@@ -539,30 +533,41 @@
    SUBROUTINE Agrif_ssh( kt )
       !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE Agrif_DYN  ***
+      !!                  ***  ROUTINE Agrif_ssh  ***
       !!----------------------------------------------------------------------  
       INTEGER, INTENT(in) ::   kt
       !!
+      INTEGER :: ji, jj
       !!----------------------------------------------------------------------  
 
       IF( Agrif_Root() )   RETURN
 
+      ! Linear interpolation of sea level
+      Agrif_SpecialValue    = 0.e0
+      Agrif_UseSpecialValue = .TRUE.
+      CALL Agrif_Bc_variable(sshn_id, procname=interpsshn )
+      Agrif_UseSpecialValue = .FALSE.
+
       IF((nbondi == -1).OR.(nbondi == 2)) THEN
-         ssha(2,:)=ssha(3,:)
-         sshn(2,:)=sshn(3,:)
+         DO jj=1,jpj
+            ssha(2,jj) = hbdy_w(jj)
+         END DO
       ENDIF
 
       IF((nbondi == 1).OR.(nbondi == 2)) THEN
-         ssha(nlci-1,:)=ssha(nlci-2,:)
-         sshn(nlci-1,:)=sshn(nlci-2,:)
+         DO jj=1,jpj
+            ssha(nlci-1,jj) = hbdy_e(jj)
+         END DO
       ENDIF
 
       IF((nbondj == -1).OR.(nbondj == 2)) THEN
-         ssha(:,2)=ssha(:,3)
-         sshn(:,2)=sshn(:,3)
+         DO ji=1,jpi
+            ssha(ji,2) = hbdy_s(ji)
+         END DO
       ENDIF
 
       IF((nbondj == 1).OR.(nbondj == 2)) THEN
-         ssha(:,nlcj-1)=ssha(:,nlcj-2)
-         sshn(:,nlcj-1)=sshn(:,nlcj-2)
+         DO ji=1,jpi
+            ssha(ji,nlcj-1) = hbdy_n(ji)
+         END DO
       ENDIF
 
@@ -812,5 +817,5 @@
                DO ji=i1,i2
                   ptab(ji,jj,jk) = e2u(ji,jj) * un(ji,jj,jk)
-                  ptab(ji,jj,jk) = ptab(ji,jj,jk) * fse3u(ji,jj,jk)
+                  ptab(ji,jj,jk) = ptab(ji,jj,jk) * fse3u_n(ji,jj,jk)
                END DO
             END DO
@@ -821,5 +826,5 @@
             DO jj=j1,j2
                ua(i1:i2,jj,jk) = (ptab(i1:i2,jj,jk)/(zrhoy*e2u(i1:i2,jj)))
-               ua(i1:i2,jj,jk) = ua(i1:i2,jj,jk) / fse3u(i1:i2,jj,jk)
+               ua(i1:i2,jj,jk) = ua(i1:i2,jj,jk) / fse3u_a(i1:i2,jj,jk)
             END DO
          END DO
@@ -880,5 +885,5 @@
                DO ji=i1,i2
                   ptab(ji,jj,jk) = e1v(ji,jj) * vn(ji,jj,jk)
-                  ptab(ji,jj,jk) = ptab(ji,jj,jk) * fse3v(ji,jj,jk)
+                  ptab(ji,jj,jk) = ptab(ji,jj,jk) * fse3v_n(ji,jj,jk)
                END DO
             END DO
@@ -889,5 +894,5 @@
             DO jj=j1,j2
                va(i1:i2,jj,jk) = (ptab(i1:i2,jj,jk)/(zrhox*e1v(i1:i2,jj)))
-               va(i1:i2,jj,jk) = va(i1:i2,jj,jk) / fse3v(i1:i2,jj,jk)
+               va(i1:i2,jj,jk) = va(i1:i2,jj,jk) / fse3v_a(i1:i2,jj,jk)
             END DO
          END DO
@@ -1110,5 +1115,5 @@
          ! Polynomial interpolation coefficients:
          zat = zrhot * (  zt1**2._wp * (-2._wp*zt1 + 3._wp)        &
-               &      - zt0**2._wp * (-2._wp*zt0 + 3._wp)        ) 
+                 &      - zt0**2._wp * (-2._wp*zt0 + 3._wp)        ) 
          ! 
          IF(western_side ) ubdy_w(j1:j2) = zat * ptab(i1,j1:j2)  
@@ -1151,5 +1156,5 @@
          ! Polynomial interpolation coefficients:
          zat = zrhot * (  zt1**2._wp * (-2._wp*zt1 + 3._wp)        &
-               &      - zt0**2._wp * (-2._wp*zt0 + 3._wp)        ) 
+                 &      - zt0**2._wp * (-2._wp*zt0 + 3._wp)        ) 
          !
          IF(western_side ) vbdy_w(j1:j2) = zat * ptab(i1,j1:j2)  
