Index: branches/2017/dev_r8127_AGRIF_LIM3_GHOST/NEMOGCM/NEMO/NST_SRC/agrif_opa_interp.F90
===================================================================
--- branches/2017/dev_r8127_AGRIF_LIM3_GHOST/NEMOGCM/NEMO/NST_SRC/agrif_opa_interp.F90	(revision 8236)
+++ branches/2017/dev_r8127_AGRIF_LIM3_GHOST/NEMOGCM/NEMO/NST_SRC/agrif_opa_interp.F90	(revision 8287)
@@ -160,4 +160,13 @@
          ENDIF
          !
+         ! Mask domain edges:
+         !-------------------
+!         DO jk = 1, jpkm1
+!            DO jj = 1, jpj
+!               ua(1,jj,jk) = 0._wp
+!               va(1,jj,jk) = 0._wp
+!            END DO
+!         END DO
+         !
       ENDIF
 
@@ -223,4 +232,13 @@
          ENDIF
          !
+         ! Mask domain edges:
+         !-------------------
+!         DO jk = 1, jpkm1
+!            DO jj = 1, jpj
+!               ua(nlci-1,jj,jk) = 0._wp
+!               va(nlci  ,jj,jk) = 0._wp
+!            END DO
+!         END DO
+         !
       ENDIF
 
@@ -285,4 +303,13 @@
          ENDIF
          !
+         ! Mask domain edges:
+         !-------------------
+!         DO jk = 1, jpkm1
+!            DO ji = 1, jpi
+!               ua(ji,1,jk) = 0._wp
+!               va(ji,1,jk) = 0._wp
+!            END DO
+!         END DO
+         !
       ENDIF
 
@@ -348,4 +375,13 @@
          ENDIF
          !
+         ! Mask domain edges:
+         !-------------------
+!         DO jk = 1, jpkm1
+!            DO ji = 1, jpi
+!               ua(ji,nlcj  ,jk) = 0._wp
+!               va(ji,nlcj-1,jk) = 0._wp
+!            END DO
+!         END DO
+         !
       ENDIF
       !
@@ -369,12 +405,10 @@
       IF((nbondi == -1).OR.(nbondi == 2)) THEN
          DO jj=1,jpj
-            IF( vmask(2,jj,1) == 1._wp ) THEN !clem: avoid interpolation if coast at the boundary
-               va_e(2:nbghostcells+1,jj) = vbdy_w(jj) * hvr_e(2:nbghostcells+1,jj)
-               ! Specified fluxes:
-               ua_e(2:nbghostcells+1,jj) = ubdy_w(jj) * hur_e(2:nbghostcells+1,jj)
-               ! Characteristics method (only if ghostcells=1):
-               !alt            ua_e(2,jj) = 0.5_wp * ( ubdy_w(jj) * hur_e(2,jj) + ua_e(3,jj) &
-               !alt                       &           - sqrt(grav * hur_e(2,jj)) * (sshn_e(3,jj) - hbdy_w(jj)) )
-            ENDIF
+            va_e(2:nbghostcells+1,jj) = vbdy_w(jj) * hvr_e(2:nbghostcells+1,jj)
+            ! Specified fluxes:
+            ua_e(2:nbghostcells+1,jj) = ubdy_w(jj) * hur_e(2:nbghostcells+1,jj)
+            ! Characteristics method (only if ghostcells=1):
+            !alt            ua_e(2,jj) = 0.5_wp * ( ubdy_w(jj) * hur_e(2,jj) + ua_e(3,jj) &
+            !alt                       &           - sqrt(grav * hur_e(2,jj)) * (sshn_e(3,jj) - hbdy_w(jj)) )
          END DO
       ENDIF
@@ -382,12 +416,10 @@
       IF((nbondi == 1).OR.(nbondi == 2)) THEN
          DO jj=1,jpj
-            IF( vmask(nlci-1,jj,1) == 1._wp ) THEN !clem: avoid interpolation if coast at the boundary
-               va_e(nlci-nbghostcells:nlci-1,jj)   = vbdy_e(jj) * hvr_e(nlci-nbghostcells:nlci-1,jj)
-               ! Specified fluxes:
-               ua_e(nlci-nbghostcells-1:nlci-2,jj) = ubdy_e(jj) * hur_e(nlci-nbghostcells-1:nlci-2,jj)
-               ! Characteristics method (only if ghostcells=1):
-               !alt            ua_e(nlci-2,jj) = 0.5_wp * ( ubdy_e(jj) * hur_e(nlci-2,jj) + ua_e(nlci-3,jj) &
-               !alt                            &           + sqrt(grav * hur_e(nlci-2,jj)) * (sshn_e(nlci-2,jj) - hbdy_e(jj)) )
-            ENDIF
+            va_e(nlci-nbghostcells:nlci-1,jj)   = vbdy_e(jj) * hvr_e(nlci-nbghostcells:nlci-1,jj)
+            ! Specified fluxes:
+            ua_e(nlci-nbghostcells-1:nlci-2,jj) = ubdy_e(jj) * hur_e(nlci-nbghostcells-1:nlci-2,jj)
+            ! Characteristics method (only if ghostcells=1):
+            !alt            ua_e(nlci-2,jj) = 0.5_wp * ( ubdy_e(jj) * hur_e(nlci-2,jj) + ua_e(nlci-3,jj) &
+            !alt                            &           + sqrt(grav * hur_e(nlci-2,jj)) * (sshn_e(nlci-2,jj) - hbdy_e(jj)) )
          END DO
       ENDIF
@@ -395,12 +427,10 @@
       IF((nbondj == -1).OR.(nbondj == 2)) THEN
          DO ji=1,jpi
-            IF( umask(ji,2,1) == 1._wp ) THEN !clem: avoid interpolation if coast at the boundary
-               ua_e(ji,2:nbghostcells+1) = ubdy_s(ji) * hur_e(ji,2:nbghostcells+1)
-               ! Specified fluxes:
-               va_e(ji,2:nbghostcells+1) = vbdy_s(ji) * hvr_e(ji,2:nbghostcells+1)
-               ! Characteristics method (only if ghostcells=1):
-               !alt            va_e(ji,2) = 0.5_wp * ( vbdy_s(ji) * hvr_e(ji,2) + va_e(ji,3) &
-               !alt                       &           - sqrt(grav * hvr_e(ji,2)) * (sshn_e(ji,3) - hbdy_s(ji)) )
-            ENDIF
+            ua_e(ji,2:nbghostcells+1) = ubdy_s(ji) * hur_e(ji,2:nbghostcells+1)
+            ! Specified fluxes:
+            va_e(ji,2:nbghostcells+1) = vbdy_s(ji) * hvr_e(ji,2:nbghostcells+1)
+            ! Characteristics method (only if ghostcells=1):
+            !alt            va_e(ji,2) = 0.5_wp * ( vbdy_s(ji) * hvr_e(ji,2) + va_e(ji,3) &
+            !alt                       &           - sqrt(grav * hvr_e(ji,2)) * (sshn_e(ji,3) - hbdy_s(ji)) )
          END DO
       ENDIF
@@ -408,12 +438,10 @@
       IF((nbondj == 1).OR.(nbondj == 2)) THEN
          DO ji=1,jpi
-            IF( umask(ji,nlcj-1,1) == 1._wp ) THEN !clem: avoid interpolation if coast at the boundary
-               ua_e(ji,nlcj-nbghostcells:nlcj-1)   = ubdy_n(ji) * hur_e(ji,nlcj-nbghostcells:nlcj-1)
-               ! Specified fluxes:
-               va_e(ji,nlcj-nbghostcells-1:nlcj-2) = vbdy_n(ji) * hvr_e(ji,nlcj-nbghostcells-1:nlcj-2)
-               ! Characteristics method (only if ghostcells=1):
-               !alt            va_e(ji,nlcj-2) = 0.5_wp * ( vbdy_n(ji) * hvr_e(ji,nlcj-2)  + va_e(ji,nlcj-3) &
-               !alt                            &           + sqrt(grav * hvr_e(ji,nlcj-2)) * (sshn_e(ji,nlcj-2) - hbdy_n(ji)) )
-            ENDIF
+            ua_e(ji,nlcj-nbghostcells:nlcj-1)   = ubdy_n(ji) * hur_e(ji,nlcj-nbghostcells:nlcj-1)
+            ! Specified fluxes:
+            va_e(ji,nlcj-nbghostcells-1:nlcj-2) = vbdy_n(ji) * hvr_e(ji,nlcj-nbghostcells-1:nlcj-2)
+            ! Characteristics method (only if ghostcells=1):
+            !alt            va_e(ji,nlcj-2) = 0.5_wp * ( vbdy_n(ji) * hvr_e(ji,nlcj-2)  + va_e(ji,nlcj-3) &
+            !alt                            &           + sqrt(grav * hvr_e(ji,nlcj-2)) * (sshn_e(ji,nlcj-2) - hbdy_n(ji)) )
          END DO
       ENDIF
@@ -497,8 +525,6 @@
          DO jj = 1, jpj
             DO ji = 2, indx
-               IF( tmask(2,jj,1) == 1._wp ) THEN !clem: avoid interpolation if coast at the boundary
-                  ssha(ji,jj)=ssha(indx+1,jj)
-                  sshn(ji,jj)=sshn(indx+1,jj)
-               ENDIF
+               ssha(ji,jj)=ssha(indx+1,jj)
+               sshn(ji,jj)=sshn(indx+1,jj)
             ENDDO
          ENDDO
@@ -510,8 +536,6 @@
          DO jj = 1, jpj
             DO ji = indx, nlci-1
-               IF( tmask(nlci-1,jj,1) == 1._wp ) THEN !clem: avoid interpolation if coast at the boundary
-                  ssha(ji,jj)=ssha(indx-1,jj)
-                  sshn(ji,jj)=sshn(indx-1,jj)
-               ENDIF
+               ssha(ji,jj)=ssha(indx-1,jj)
+               sshn(ji,jj)=sshn(indx-1,jj)
             ENDDO
          ENDDO
@@ -523,8 +547,6 @@
          DO jj = 2, indx
             DO ji = 1, jpi
-               IF( tmask(ji,2,1) == 1._wp ) THEN !clem: avoid interpolation if coast at the boundary
-                  ssha(ji,jj)=ssha(ji,indx+1)
-                  sshn(ji,jj)=sshn(ji,indx+1)
-               ENDIF
+               ssha(ji,jj)=ssha(ji,indx+1)
+               sshn(ji,jj)=sshn(ji,indx+1)
             ENDDO
          ENDDO
@@ -536,8 +558,6 @@
          DO jj = indx, nlcj-1
             DO ji = 1, jpi
-               IF( tmask(ji,nlcj-1,1) == 1._wp ) THEN !clem: avoid interpolation if coast at the boundary
-                  ssha(ji,jj)=ssha(ji,indx-1)
-                  sshn(ji,jj)=sshn(ji,indx-1)
-               ENDIF
+               ssha(ji,jj)=ssha(ji,indx-1)
+               sshn(ji,jj)=sshn(ji,indx-1)
             ENDDO
          ENDDO
@@ -558,7 +578,5 @@
       IF((nbondi == -1).OR.(nbondi == 2)) THEN
          DO jj = 1, jpj
-            IF( tmask(2,jj,1) == 1._wp ) THEN !clem: avoid interpolation if coast at the boundary
-               ssha_e(2:nbghostcells+1,jj) = hbdy_w(jj)
-            ENDIF
+            ssha_e(2:nbghostcells+1,jj) = hbdy_w(jj)
          END DO
       ENDIF
@@ -566,7 +584,5 @@
       IF((nbondi == 1).OR.(nbondi == 2)) THEN
          DO jj = 1, jpj
-            IF( tmask(nlci-1,jj,1) == 1._wp ) THEN !clem: avoid interpolation if coast at the boundary
-               ssha_e(nlci-nbghostcells:nlci-1,jj) = hbdy_e(jj)
-            ENDIF
+            ssha_e(nlci-nbghostcells:nlci-1,jj) = hbdy_e(jj)
          END DO
       ENDIF
@@ -574,7 +590,5 @@
       IF((nbondj == -1).OR.(nbondj == 2)) THEN
          DO ji = 1, jpi
-            IF( tmask(ji,2,1) == 1._wp ) THEN !clem: avoid interpolation if coast at the boundary
-               ssha_e(ji,2:nbghostcells+1) = hbdy_s(ji)
-            ENDIF
+            ssha_e(ji,2:nbghostcells+1) = hbdy_s(ji)
          END DO
       ENDIF
@@ -582,7 +596,5 @@
       IF((nbondj == 1).OR.(nbondj == 2)) THEN
          DO ji = 1, jpi
-            IF( tmask(ji,nlcj-1,1) == 1._wp ) THEN !clem: avoid interpolation if coast at the boundary
-               ssha_e(ji,nlcj-nbghostcells:nlcj-1) = hbdy_n(ji)
-            ENDIF
+            ssha_e(ji,nlcj-nbghostcells:nlcj-1) = hbdy_n(ji)
          END DO
       ENDIF
