Index: branches/2016/dev_r6393_NOC_WAD/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90
===================================================================
--- branches/2016/dev_r6393_NOC_WAD/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90	(revision 6995)
+++ branches/2016/dev_r6393_NOC_WAD/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90	(revision 7016)
@@ -156,6 +156,4 @@
       REAL(wp), POINTER, DIMENSION(:,:) :: zhf
       REAL(wp), POINTER, DIMENSION(:,:) :: zcpx, zcpy                 ! Wetting/Dying gravity filter coef.
-      REAL(wp), POINTER, DIMENSION(:,:) :: wduflt1, wdvflt1           ! Wetting/Dying velocity filter coef.
-      REAL(wp), POINTER, DIMENSION(:,:) :: sshai                      ! Wetting/Dying velocity filter coef.
       !!----------------------------------------------------------------------
       !
@@ -169,5 +167,5 @@
       CALL wrk_alloc( jpi,jpj,   zsshu_a, zsshv_a                  )
       CALL wrk_alloc( jpi,jpj,   zhf )
-      IF( ln_wd ) CALL wrk_alloc( jpi, jpj, zcpx, zcpy, wduflt1, wdvflt1,sshai )
+      IF( ln_wd ) CALL wrk_alloc( jpi, jpj, zcpx, zcpy )
       !
       zmdi=1.e+20                               !  missing data indicator for masking
@@ -375,6 +373,4 @@
       IF( .NOT.ln_linssh ) THEN                 ! Variable volume : remove surface pressure gradient
         IF( ln_wd ) THEN                        ! Calculating and applying W/D gravity filters
-          wduflt1(:,:) = 1.0_wp
-          wdvflt1(:,:) = 1.0_wp
           DO jj = 2, jpjm1
              DO ji = 2, jpim1
@@ -392,5 +388,4 @@
                 ELSE
                   zcpx(ji,jj)    = 0._wp
-                  wduflt1(ji,jj) = 0.0_wp
                 END IF
 
@@ -408,5 +403,4 @@
                 ELSE
                   zcpy(ji,jj)    = 0._wp
-                  wdvflt1(ji,jj) = 0.0_wp
                 ENDIF
 
@@ -414,12 +408,11 @@
            END DO
 
-           CALL lbc_lnk( zcpx, 'U', 1._wp )    ;   CALL lbc_lnk( zcpy, 'V', 1._wp )
 
            DO jj = 2, jpjm1
               DO ji = 2, jpim1
                  zu_trd(ji,jj) = ( zu_trd(ji,jj) - grav * ( sshn(ji+1,jj  ) - sshn(ji  ,jj ) )   &
-                        &                        * r1_e1u(ji,jj) ) * zcpx(ji,jj) * wduflt1(ji,jj)
+                        &                        * r1_e1u(ji,jj) ) * zcpx(ji,jj)
                  zv_trd(ji,jj) = ( zv_trd(ji,jj) - grav * ( sshn(ji  ,jj+1) - sshn(ji  ,jj ) )   &
-                        &                        * r1_e2v(ji,jj) ) * zcpy(ji,jj) * wdvflt1(ji,jj)
+                        &                        * r1_e2v(ji,jj) ) * zcpy(ji,jj)
               END DO
            END DO
@@ -568,9 +561,4 @@
       ENDIF
 
-      IF( ln_wd ) THEN      !preserve the positivity of water depth
-                          !ssh[b,n,a] should have already been processed for this
-         sshbb_e(:,:) = MAX(sshbb_e(:,:), rn_wdmin1 - bathy(:,:))
-         sshb_e(:,:)  = MAX(sshb_e(:,:) , rn_wdmin1 - bathy(:,:))
-      ENDIF
       !
       IF (ln_bt_fw) THEN                  ! FORWARD integration: start from NOW fields                    
@@ -597,5 +585,4 @@
       !
       ! Initialize sums:
-      IF(ln_wd) sshai(:,:) = ssha(:,:)
       ua_b  (:,:) = 0._wp       ! After barotropic velocities (or transport if flux form)          
       va_b  (:,:) = 0._wp
@@ -648,8 +635,4 @@
             zhup2_e (:,:) = hu_0(:,:) + zwx(:,:)                ! Ocean depth at U- and V-points
             zhvp2_e (:,:) = hv_0(:,:) + zwy(:,:)
-            IF( ln_wd ) THEN
-              zhup2_e(:,:) = MAX(zhup2_e (:,:), rn_wdmin1)
-              zhvp2_e(:,:) = MAX(zhvp2_e (:,:), rn_wdmin1)
-            END IF
          ELSE
             zhup2_e (:,:) = hu_n(:,:)
@@ -689,5 +672,5 @@
          ENDIF
 #endif
-         !IF( ln_wd ) CALL wad_lmt_bt(zwx, zwy, sshn_e, zssh_frc, rdtbt)
+         IF( ln_wd ) CALL wad_lmt_bt(zwx, zwy, sshn_e, zssh_frc, rdtbt)
          !
          ! Sum over sub-time-steps to compute advective velocities
@@ -704,10 +687,5 @@
          END DO
 
-         IF(ln_wd) THEN
-           ssha_e(:,:) = (  sshn_e(:,:) - rdtbt * ( zssh_frc(:,:) + zhdiv(:,:) ) * wdmask(:,:)    &
-           &             + ( 1._wp - wdmask(:,:) ) * ( sshai(:,:) - sshn_e(:,:) ) ) * ssmask(:,:)
-         ELSE
-           ssha_e(:,:) = (  sshn_e(:,:) - rdtbt * ( zssh_frc(:,:) + zhdiv(:,:) )  ) * ssmask(:,:)
-         END IF
+         ssha_e(:,:) = (  sshn_e(:,:) - rdtbt * ( zssh_frc(:,:) + zhdiv(:,:) )  ) * ssmask(:,:)
          
          CALL lbc_lnk( ssha_e, 'T',  1._wp )
@@ -758,6 +736,4 @@
           &            + za2 *  sshb_e(:,:) + za3 *  sshbb_e(:,:)
          IF( ln_wd ) THEN                   ! Calculating and applying W/D gravity filters
-           wduflt1(:,:) = 1._wp
-           wdvflt1(:,:) = 1._wp
            DO jj = 2, jpjm1
               DO ji = 2, jpim1
@@ -775,5 +751,4 @@
                  ELSE
                     zcpx(ji,jj)    = 0._wp
-                    wduflt1(ji,jj) = 0._wp
                  END IF
 
@@ -791,9 +766,7 @@
                  ELSE
                     zcpy(ji,jj)    = 0._wp
-                    wdvflt1(ji,jj) = 0._wp
                  END IF
               END DO
             END DO
-            CALL lbc_lnk( zcpx, 'U', 1._wp )    ;   CALL lbc_lnk( zcpy, 'V', 1._wp )
          ENDIF
          !
@@ -813,9 +786,4 @@
                END DO
             END DO
-
-            IF( ln_wd ) THEN
-              zhust_e(:,:) = MAX(zhust_e (:,:), rn_wdmin1 )
-              zhvst_e(:,:) = MAX(zhvst_e (:,:), rn_wdmin1 )
-            END IF
 
          ENDIF
@@ -935,11 +903,6 @@
                DO ji = fs_2, fs_jpim1   ! vector opt.
 
-                  IF( ln_wd ) THEN
-                    zhura = MAX(hu_0(ji,jj) + zsshu_a(ji,jj), rn_wdmin1)
-                    zhvra = MAX(hv_0(ji,jj) + zsshv_a(ji,jj), rn_wdmin1)
-                  ELSE
-                    zhura = hu_0(ji,jj) + zsshu_a(ji,jj)
-                    zhvra = hv_0(ji,jj) + zsshv_a(ji,jj)
-                  END IF
+                  zhura = hu_0(ji,jj) + zsshu_a(ji,jj)
+                  zhvra = hv_0(ji,jj) + zsshv_a(ji,jj)
                   zhura = ssumask(ji,jj)/(zhura + 1._wp - ssumask(ji,jj))
                   zhvra = ssvmask(ji,jj)/(zhvra + 1._wp - ssvmask(ji,jj))
@@ -961,11 +924,6 @@
          !
          IF( .NOT.ln_linssh ) THEN                     !* Update ocean depth (variable volume case only)
-            IF( ln_wd ) THEN
-              hu_e (:,:) = MAX(hu_0(:,:) + zsshu_a(:,:), rn_wdmin1)
-              hv_e (:,:) = MAX(hv_0(:,:) + zsshv_a(:,:), rn_wdmin1)
-            ELSE
-              hu_e (:,:) = hu_0(:,:) + zsshu_a(:,:)
-              hv_e (:,:) = hv_0(:,:) + zsshv_a(:,:)
-            END IF
+            hu_e (:,:) = hu_0(:,:) + zsshu_a(:,:)
+            hv_e (:,:) = hv_0(:,:) + zsshv_a(:,:)
             hur_e(:,:) = ssumask(:,:) / ( hu_e(:,:) + 1._wp - ssumask(:,:) )
             hvr_e(:,:) = ssvmask(:,:) / ( hv_e(:,:) + 1._wp - ssvmask(:,:) )
@@ -1008,5 +966,4 @@
          !                       			   ! Sum sea level
          ssha(:,:) = ssha(:,:) + za1 * ssha_e(:,:)
-         IF(ln_wd) ssha(:,:) = ssha(:,:) * wdmask(:,:) + (1._wp - wdmask(:,:)) * sshai(:,:)
          !                                                 ! ==================== !
       END DO                                               !        end loop      !
@@ -1126,5 +1083,5 @@
       CALL wrk_dealloc( jpi,jpj,   zsshu_a, zsshv_a                                   )
       CALL wrk_dealloc( jpi,jpj,   zhf )
-      IF( ln_wd ) CALL wrk_dealloc( jpi, jpj, zcpx, zcpy, wduflt1, wdvflt1 )
+      IF( ln_wd ) CALL wrk_dealloc( jpi, jpj, zcpx, zcpy )
       !
       IF ( ln_diatmb ) THEN
Index: branches/2016/dev_r6393_NOC_WAD/NEMOGCM/NEMO/OPA_SRC/DYN/wet_dry.F90
===================================================================
--- branches/2016/dev_r6393_NOC_WAD/NEMOGCM/NEMO/OPA_SRC/DYN/wet_dry.F90	(revision 6995)
+++ branches/2016/dev_r6393_NOC_WAD/NEMOGCM/NEMO/OPA_SRC/DYN/wet_dry.F90	(revision 7016)
@@ -298,6 +298,4 @@
         zflxp(:,:)   = 0._wp
         zflxn(:,:)   = 0._wp
-        !zflxu(:,:)   = 0._wp
-        !zflxv(:,:)   = 0._wp
 
         zwdlmtu(:,:)  = 1._wp
@@ -306,9 +304,6 @@
         ! Horizontal Flux in u and v direction
        
-        !zflxu(:,:) = zflxu(:,:) * e2u(:,:)
-        !zflxv(:,:) = zflxv(:,:) * e1v(:,:)
-       
-        DO jj = 2, jpjm1
-           DO ji = 2, jpim1 
+        DO jj = 2, jpj
+           DO ji = 2, jpi 
 
              IF(tmask(ji, jj, 1) < 0.5_wp) CYCLE   ! we don't care about land cells
@@ -321,8 +316,4 @@
 
               zdep2 = bathy(ji,jj) + sshn_e(ji,jj) - rn_wdmin1
-              IF(zdep2 < 0._wp) THEN  !add more safty, but not necessary
-                !zdep2 = 0._wp
-               sshn_e(ji,jj) = rn_wdmin1 - bathy(ji,jj)
-              END IF
            ENDDO
         END DO
@@ -336,8 +327,7 @@
            zflxv1(:,:) = zflxv(:,:) * zwdlmtv(:,:)
           
-           DO jj = 2, jpjm1
-              DO ji = 2, jpim1 
+           DO jj = 2, jpj
+              DO ji = 2, jpi 
         
-                 !wdmask(ji,jj) = 0
                  IF(tmask(ji, jj, 1) < 0.5_wp) CYCLE 
                  IF(bathy(ji,jj) > zdepwd) CYCLE
@@ -356,5 +346,4 @@
                  IF(zdep1 > zdep2) THEN
                    zflag = 1
-                   !wdmask(ji, jj) = 1
                    zcoef = ( ( zdep2 - rn_wdmin2 ) * ztmp - zzflxn * z2dt ) / ( zflxp(ji,jj) * z2dt )
                    zcoef = max(zcoef, 0._wp)
@@ -386,6 +375,4 @@
         IF(zflag == 1 .AND. lwp) WRITE(numout,*) 'Need more iterations in wad_lmt_bt!!!'
        
-        !IF( ln_rnf      )   CALL sbc_rnf_div( hdivn )          ! runoffs (update hdivn field)
-        !IF( nn_cla == 1 )   CALL cla_div    ( kt )             ! Cross Land Advection (update hdivn field)
         !
         !
