Index: branches/2013/dev_r4050_NOC_WaD/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90
===================================================================
--- branches/2013/dev_r4050_NOC_WaD/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90	(revision 4384)
+++ branches/2013/dev_r4050_NOC_WaD/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90	(revision 4385)
@@ -398,5 +398,5 @@
             ij_bump = jpjdta / 2 + 1                       ! j-index of the basin center
             r_bump  = 430620._wp                           ! basin radius (meters)       
-            h_bump  =     50._wp                           ! basin depth  (meters)
+            h_bump  =     50._wp                           ! basin centre depth  (meters)
             h_oce   = gdepw_0(jpk)                         ! background ocean depth (meters)
             IF(lwp) WRITE(numout,*) '           basin characteristics: '
Index: branches/2013/dev_r4050_NOC_WaD/NEMOGCM/NEMO/OPA_SRC/DYN/wadlmt.F90
===================================================================
--- branches/2013/dev_r4050_NOC_WaD/NEMOGCM/NEMO/OPA_SRC/DYN/wadlmt.F90	(revision 4384)
+++ branches/2013/dev_r4050_NOC_WaD/NEMOGCM/NEMO/OPA_SRC/DYN/wadlmt.F90	(revision 4385)
@@ -43,16 +43,18 @@
       !! ** Method  : - Prevent negative depth occurring (Not ready for Agrif) 
       !!
-      !! ** Action  : - update: uwdlmt(:,:), vwdlmt(:,:) 
+      !! ** Action  : - calculate flux limiter and W/D flag
       !!----------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt       ! ocean time-step index
       !
       INTEGER  ::   ji, jj, jk, jk1     ! dummy loop indices
-      INTEGER  ::   zflag, z2dt         ! local scalar
+      INTEGER  ::   z2dt, zflag         ! local scalar
       REAL(wp) ::   zcoef, zdep1, zdep2 ! local scalars
+      REAL(wp) ::   zzflxp, zzflxn      ! local scalars
       REAL(wp) ::   ztmp                ! local scalars
-      REAL(wp), POINTER,  DIMENSION(:,:) ::   zflxp,  zflxn   ! specific 2D workspace
-      REAL(wp), POINTER,  DIMENSION(:,:) ::   zflxu,  zflxv   ! specific 2D workspace
-      REAL(wp), POINTER,  DIMENSION(:,:) ::   zflxu1, zflxv1  ! specific 2D workspace
-      REAL(wp), POINTER,  DIMENSION(:,:) ::   wdlmt           !: W/D flux limiters
+      INTEGER,  POINTER,  DIMENSION(:,:) ::   iwdflg                   !: W/D cell flag
+      REAL(wp), POINTER,  DIMENSION(:,:) ::   zwdlmtu, zwdlmtv         !: W/D flux limiters
+      REAL(wp), POINTER,  DIMENSION(:,:) ::   zflxp,  zflxn            ! specific 2D workspace
+      REAL(wp), POINTER,  DIMENSION(:,:) ::   zflxu,  zflxv            ! specific 2D workspace
+      REAL(wp), POINTER,  DIMENSION(:,:) ::   zflxu1, zflxv1           ! specific 2D workspace
 
       !!----------------------------------------------------------------------
@@ -63,5 +65,7 @@
       IF(ln_wad) THEN
 
-        CALL wrk_alloc( jpi, jpj, zflxp, zflxn, zflxu, zflxv, zflxu1, zflxv1, wdlmt )
+        CALL wrk_alloc( jpi, jpj, zflxp, zflxn, zflxu, zflxv, zflxu1, zflxv1 )
+        CALL wrk_alloc( jpi, jpj, zwdlmtu, zwdlmtv)
+        CALL wrk_alloc( jpi, jpj, iwdflg )
         !
        
@@ -72,9 +76,11 @@
         IF( neuler == 0 .AND. kt == nit000 )  z2dt = rdt
        
-        zflxp(:,:)  = 0._wp
-        zflxn(:,:)  = 0._wp
-        zflxu(:,:)  = 0._wp
-        zflxv(:,:)  = 0._wp
-        wdlmt(:,:)  = 1._wp
+        zflxp(:,:)   = 0._wp
+        zflxn(:,:)   = 0._wp
+        zflxu(:,:)   = 0._wp
+        zflxv(:,:)   = 0._wp
+
+        zwdlmtu(:,:)  = 1._wp
+        zwdlmtv(:,:)  = 1._wp
        
         ! Horizontal Flux in u and v direction
@@ -110,11 +116,11 @@
 
       
-        !! start limiter iteration 
+        !! start limiter iterations 
         DO jk1 = 1, nn_waditr
        
            zflag = 0     ! flag indicating if any further iteration is needed?
           
-           zflxu1(:,:) = zflxu(:,:) * wdlmt(:,:)
-           zflxv1(:,:) = zflxv(:,:) * wdlmt(:,:)
+           zflxu1(:,:) = zflxu(:,:) * zwdlmtu(:,:)
+           zflxv1(:,:) = zflxv(:,:) * zwdlmtv(:,:)
           
            DO jj = 2, jpjm1
@@ -123,47 +129,50 @@
                  IF(tmask(ji, jj, 1) < 0.5_wp) CYCLE 
         
-                 ztmp = e1t(ji,jj) * e2t(ji,jj)
+                 ztmp = e1t(ji,jj) * e2t(ji,jj)     !there must be an array ready for this
 
-                 zflxn(ji,jj) = min(zflxu1(ji,jj), 0._wp) - max(zflxu1(ji-1,jj),   0._wp) + &
-                              & min(zflxv1(ji,jj), 0._wp) - max(zflxv1(ji,  jj-1), 0._wp) 
+                 zzflxp = max(zflxu1(ji,jj), 0._wp) - min(zflxu1(ji-1,jj),   0._wp) + &
+                        & max(zflxv1(ji,jj), 0._wp) - min(zflxv1(ji,  jj-1), 0._wp) 
+                 zzflxn = min(zflxu1(ji,jj), 0._wp) - max(zflxu1(ji-1,jj),   0._wp) + &
+                        & min(zflxv1(ji,jj), 0._wp) - max(zflxv1(ji,  jj-1), 0._wp) 
           
-                 zdep1 = (zflxp(ji,jj) * wdlmt(ji,jj) + zflxn(ji,jj)) * z2dt / ztmp
-                 zdep2 = bathy(ji,jj) + sshb(ji,jj) - rn_wadmin 
+                 zdep1 = (zzflxp + zzflxn) * z2dt / ztmp
+                 zdep2 = bathy(ji,jj) + sshb(ji,jj) - rn_wadmin   ! this one can be moved out of the loops
           
                  IF(zdep1 > zdep2) THEN
                    zflag = 1
-                   zcoef = ( ( zdep2 - rn_wadmine ) * ztmp - zflxn(ji,jj) * z2dt ) / ( zflxp(ji,jj) * z2dt )
+                   zcoef = ( ( zdep2 - rn_wadmine ) * ztmp - zzflxn * z2dt ) / ( zflxp(ji,jj) * z2dt )
                    zcoef = max(zcoef, 0._wp)
-                   IF(zflxu1(ji,  jj  ) >= 0._wp) wdlmt(ji,  jj  ) = zcoef
-                   IF(zflxu1(ji-1,jj  ) <  0._wp) wdlmt(ji-1,jj  ) = zcoef
-                   IF(zflxv1(ji,  jj  ) >= 0._wp) wdlmt(ji,  jj  ) = zcoef
-                   IF(zflxv1(ji,  jj-1) <  0._wp) wdlmt(ji,  jj-1) = zcoef
+                   iwdflg(ji, jj) = 1
+                   IF(zflxu1(ji,  jj) > 0._wp) zwdlmtu(ji  ,jj) = zcoef
+                   IF(zflxu1(ji-1,jj) < 0._wp) zwdlmtu(ji-1,jj) = zcoef
+                   IF(zflxv1(ji,  jj) > 0._wp) zwdlmtv(ji  ,jj) = zcoef
+                   IF(zflxv1(ji,jj-1) < 0._wp) zwdlmtv(ji-1,jj) = zcoef
                  END IF
               END DO ! ji loop
            END DO  ! jj loop
           
-           CALL lbc_lnk( wdlmt, 'T', 1. )
+           CALL lbc_lnk( zwdlmtu, 'U', 1. )
+           CALL lbc_lnk( zwdlmtv, 'V', 1. )
           
            IF(zflag == 0) EXIT
           
            IF(jk1 == nn_waditr) THEN
-              IF(zflxu1(ji,  jj  ) >= 0._wp) wdlmt(ji,  jj  ) = 0._wp
-              IF(zflxu1(ji-1,jj  ) <  0._wp) wdlmt(ji-1,jj  ) = 0._wp
-              IF(zflxv1(ji,  jj  ) >= 0._wp) wdlmt(ji,  jj  ) = 0._wp
-              IF(zflxv1(ji,  jj-1) <  0._wp) wdlmt(ji,  jj-1) = 0._wp
+              
+              IF(zflxu1(ji,  jj  ) >= 0._wp) zwdlmtu(ji,  jj  ) = 0._wp
+              IF(zflxu1(ji-1,jj  ) <  0._wp) zwdlmtu(ji-1,jj  ) = 0._wp
+              IF(zflxv1(ji,  jj  ) >= 0._wp) zwdlmtv(ji,  jj  ) = 0._wp
+              IF(zflxv1(ji,  jj-1) <  0._wp) zwdlmtv(ji,  jj-1) = 0._wp
+
+              CALL lbc_lnk( zwdlmtu, 'U', 1. )
+              CALL lbc_lnk( zwdlmtv, 'V', 1. )
            END IF
 
         END DO  ! jk1 loop
        
-        DO jk = 1, jpkm1  
-           DO jj = 2, jpjm1
-              DO ji = fs_2, fs_jpim1   ! vector opt.
-               un(ji,  jj,  jk) = ( sign(0.5_wp, un(ji,  jj,  jk))  + 0.5_wp ) * wdlmt(ji  ,jj) 
-               vn(ji,  jj,  jk) = ( sign(0.5_wp, vn(ji,  jj,  jk))  + 0.5_wp ) * wdlmt(ji  ,jj) 
-               un(ji-1,jj,  jk) = (-sign(0.5_wp, un(ji-1,jj,  jk))  + 0.5_wp ) * wdlmt(ji-1,jj) 
-               vn(ji,  jj-1,jk) = (-sign(0.5_wp, vn(ji,  jj-1,jk))  + 0.5_wp ) * wdlmt(ji,  jj-1) 
-              END DO
-           END DO
-        END DO
+        un(:,:,:) = un(:,:,:) * zwdlmtu(ji, jj) 
+        vn(:,:,:) = vn(:,:,:) * zwdlmtv(ji, jj) 
+
+        CALL lbc_lnk( un, 'U', -1. )
+        CALL lbc_lnk( vn, 'V', -1. )
        
         IF(zflag == 1 .AND. lwp) WRITE(numout,*) 'Need more iterations in wad_lmt!!!'
@@ -173,5 +182,7 @@
         !
         !
-        CALL wrk_dealloc( jpi, jpj, zflxp, zflxn, zflxu, zflxv, zflxu1, zflxv1, wdlmt )
+        CALL wrk_dealloc( jpi, jpj, zflxp, zflxn, zflxu, zflxv, zflxu1, zflxv1 )
+        CALL wrk_dealloc( jpi, jpj, zwdlmtu, zwdlmtv)
+        CALL wrk_dealloc( jpi, jpj, iwdflg )
       !
       END IF
