Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/CONFIG/SHARED/namelist_ref
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/CONFIG/SHARED/namelist_ref	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/CONFIG/SHARED/namelist_ref	(revision 8870)
@@ -108,11 +108,15 @@
 /
 !-----------------------------------------------------------------------
-&namwad        !   Wetting and drying                                   (default F)
-!-----------------------------------------------------------------------
-   ln_wd       = .false.   !  T/F activation of wetting and drying
-   rn_wdmin1   =  0.1      !  Minimum wet depth on dried cells
-   rn_wdmin2   =  0.01     !  Tolerance of min wet depth on dried cells
-   rn_wdld     =  20.0     !  Land elevation below which wetting/drying is allowed
-   nn_wdit     =  10       !  Max iterations for W/D limiter
+&namwad  !   Wetting and drying  default it no WAD
+!-----------------------------------------------------------------------
+   ln_wd_il          = .false   ! T/F activation of iterative limiter for  wetting and drying scheme
+   ln_wd_dl          = .false.   ! T/F activation of directional llimiter for wetting drying scheme
+   ln_wd_dl_bc       = .false.   ! T/F Directional limiteer Baroclinic option
+   ln_wd_dl_rmp      = .false.   ! T/F Turn on directional limiter ramp
+   rn_wdmin0         =  0.30    ! dpoth at which wetting/drying starts
+   rn_wdmin1         =  0.2     ! Minimum wet depth on dried cells
+   rn_wdmin2         =  0.0001  ! Tolerance of min wet depth on dried cells
+   rn_wdld           =  2.5     ! Land elevation below which wetting/drying is allowed
+   nn_wdit           =   20     ! Max iterations for W/D limiter
 /
 !-----------------------------------------------------------------------
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/CONFIG/TEST_CASES/WAD/EXP00/namelist_cfg
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/CONFIG/TEST_CASES/WAD/EXP00/namelist_cfg	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/CONFIG/TEST_CASES/WAD/EXP00/namelist_cfg	(revision 8870)
@@ -444,16 +444,12 @@
 &namwad  !   Wetting and drying
 !-----------------------------------------------------------------------
-   ln_wd             = .false  ! T/F activation of NOC  wetting and drying scheme
-   ln_rwd            = .true.   ! T/F activation of ROMS wetting and drying scheme
-   ln_rwd_bc         = .true.
-   ln_rwd_rmp        = .true.   ! Turn on the limiter
-   ln_wd_diag        = .false.   ! T/F activation of diagnostics for ROMS wd scheme
-   rn_wdmin0         =  0.30     ! Minimum wet depth on dried cells
+   ln_wd_il          = .false   ! T/F activation of iterative limiter for  wetting and drying scheme
+   ln_wd_dl          = .true.   ! T/F activation of directional llimiter for wetting drying scheme
+   ln_wd_dl_bc       = .true.   ! T/F Directional limiteer Baroclinic option
+   ln_wd_dl_rmp      = .true.   ! T/F Turn on directional limiter ramp
+   rn_wdmin0         =  0.30    ! dpoth at which wetting/drying starts
    rn_wdmin1         =  0.2     ! Minimum wet depth on dried cells
    rn_wdmin2         =  0.0001  ! Tolerance of min wet depth on dried cells
    rn_wdld           =  2.5     ! Land elevation below which wetting/drying is allowed
    nn_wdit           =   20     ! Max iterations for W/D limiter
-   jn_wd_i           =  22      ! i index of diagnostics
-   jn_wd_j           =   3      ! j index of diagnostics
- 
-/
+/
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/CONFIG/TEST_CASES/WAD/MY_SRC/domain.F90
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/CONFIG/TEST_CASES/WAD/MY_SRC/domain.F90	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/CONFIG/TEST_CASES/WAD/MY_SRC/domain.F90	(revision 8870)
@@ -674,6 +674,5 @@
       ENDIF
       !
-      !IF( ln_wd  .or. ln_rwd ) THEN              ! wetting and drying domain
-      IF( ln_wd   ) THEN              ! wetting and drying domain
+      IF( ln_wd_il .or. ln_wd_dl   ) THEN              ! wetting and drying domain
          CALL iom_rstput( 0, 0, inum, 'ht_0'   , ht_0   , ktype = jp_r8 )
       ENDIF
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/CONFIG/TEST_CASES/WAD/MY_SRC/stpctl.F90
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/CONFIG/TEST_CASES/WAD/MY_SRC/stpctl.F90	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/CONFIG/TEST_CASES/WAD/MY_SRC/stpctl.F90	(revision 8870)
@@ -22,5 +22,4 @@
    USE lib_mpp         ! distributed memory computing
    USE lib_fortran     ! Fortran routines library 
-!   USE wet_dry,  ONLY: ln_wd, ln_rwd , rn_ssh_ref    ! reference depth for negative bathy
 
    IMPLICIT NONE
@@ -151,9 +150,5 @@
       DO jj = 1, jpj
          DO ji = 1, jpi
-!            IF( (ln_wd .OR. ln_rwd)) THEN
-!               IF( tmask(ji,jj,1) == 1) zsshmax = MAX( zsshmax, ABS(sshn(ji,jj)+rn_ssh_ref) )
-!            ELSE
                IF( tmask(ji,jj,1) == 1) zsshmax = MAX( zsshmax, ABS(sshn(ji,jj)) )
-!            ENDIF
          END DO
       END DO
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/CONFIG/TEST_CASES/WAD/MY_SRC/usrdef_istate.F90
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/CONFIG/TEST_CASES/WAD/MY_SRC/usrdef_istate.F90	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/CONFIG/TEST_CASES/WAD/MY_SRC/usrdef_istate.F90	(revision 8870)
@@ -178,6 +178,6 @@
       do jj = 1,jpj
          do ji = 1,jpi
-            IF( ht_wd(ji,jj) + pssh(ji,jj) < rn_wdmin1 ) THEN
-               pssh(ji,jj) = ptmask(ji,jj,1)*( rn_wdmin1 - ht_wd(ji,jj) )
+            IF( ht_0(ji,jj) + pssh(ji,jj) < rn_wdmin1 ) THEN
+               pssh(ji,jj) = ptmask(ji,jj,1)*( rn_wdmin1 - ht_0(ji,jj) )
             ENDIF
          end do
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/CONFIG/TEST_CASES/cfg.txt
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/CONFIG/TEST_CASES/cfg.txt	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/CONFIG/TEST_CASES/cfg.txt	(revision 8870)
@@ -4,9 +4,2 @@
 SAS_BIPER OPA_SRC SAS_SRC LIM_SRC_3 NST_SRC
 ISOMIP OPA_SRC
-WAD7_SCOORD
-WAD7_SCOORD
-WAD7SCOORD
-WAD7SCOORD OPA_SRC
-WAD7 OPA_SRC
-WAD7LONG OPA_SRC
-WAD2 OPA_SRC
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn2d.F90
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn2d.F90	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn2d.F90	(revision 8870)
@@ -170,5 +170,5 @@
          ii = idx%nbi(jb,igrd)
          ij = idx%nbj(jb,igrd)
-         IF( ln_wd .OR. ln_rwd ) THEN
+         IF( ln_wd_il .OR. ln_wd_dl ) THEN
             spgu(ii, ij) = dta%ssh(jb)  - rn_ssh_ref 
          ELSE
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90	(revision 8870)
@@ -154,5 +154,5 @@
          CALL iom_put( "e3tdef"  , ( ( e3t_n(:,:,:) - e3t_0(:,:,:) ) / e3t_0(:,:,:) * 100 * tmask(:,:,:) ) ** 2 )
 
-      IF( (ln_wd .OR. ln_rwd)) THEN
+      IF( (ln_wd_il .OR. ln_wd_dl )) THEN
          CALL iom_put( "ssh" , sshn+rn_ssh_ref )                 ! sea surface height !bring it back to the reference need wad if here
       ELSE
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 8870)
@@ -39,5 +39,5 @@
    USE domc1d         ! 1D configuration: column location
    USE dyncor_c1d     ! 1D configuration: Coriolis term    (cor_c1d routine)
-   USE wet_dry        ! wetting and drying
+   USE wet_dry,   ONLY :   ln_wd_il, ln_wd_dl
    !
    USE in_out_manager ! I/O manager
@@ -674,5 +674,5 @@
       ENDIF
       !
-      IF( ln_wd  .or. ln_rwd ) THEN              ! wetting and drying domain
+      IF( ln_wd_il  .or. ln_wd_dl ) THEN              ! wetting and drying domain
          CALL iom_rstput( 0, 0, inum, 'ht_0'   , ht_0   , ktype = jp_r8 )
       ENDIF
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90	(revision 8870)
@@ -680,10 +680,10 @@
       !
       INTEGER ::   ji, jj, jk                                       ! dummy loop indices
-      REAL(wp) ::  zlnwd                                            ! =1./0. when ln_wd = T/F
+      REAL(wp) ::  zlnwd                                            ! =1./0. when ln_wd_il = T/F
       !!----------------------------------------------------------------------
       !
       IF( nn_timing == 1 )   CALL timing_start('dom_vvl_interpol')
       !
-      IF(ln_wd) THEN
+      IF(ln_wd_il) THEN
         zlnwd = 1.0_wp
       ELSE
@@ -877,7 +877,7 @@
             !
 
-! MJB ln_rwd edits start here - these are essential 
-
-            IF( (ln_wd .OR. ln_rwd)) THEN 
+! MJB ln_wd edits start here - these are essential 
+
+            IF( (ln_wd_il .OR. ln_wd_dl)) THEN 
 
               ! Wetting and drying test case
@@ -888,5 +888,5 @@
                   un   (:,:,:)   = ub  (:,:,:)
                   vn   (:,:,:)   = vb  (:,:,:)
-               ELSEIF( ln_wd .or. ln_rwd   ) THEN ! if not test case
+               ELSEIF( ln_wd_il .or. ln_wd_dl   ) THEN ! if not test case
                   sshn(:,:) = -rn_ssh_ref
                   sshb(:,:) = -rn_ssh_ref
@@ -902,5 +902,5 @@
                      ENDDO
                   ENDDO
-               ENDIF !If wad elseif ln_wd or ln_rwd
+               ENDIF !If wad elseif ln_wd_il or ln_wd_dl
 
                ! Adjust vertical metrics for all wad
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DOM/domwri.F90
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DOM/domwri.F90	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DOM/domwri.F90	(revision 8870)
@@ -18,5 +18,5 @@
    USE dom_oce         ! ocean space and time domain
    USE phycst ,   ONLY :   rsmall
-   USE wet_dry,   ONLY :   ln_wd, ln_rwd
+   USE wet_dry,   ONLY :   ln_wd_il, ln_wd_dl
    !
    USE in_out_manager  ! I/O manager
@@ -198,5 +198,5 @@
       ENDIF
       !
-      IF( ln_wd .OR. ln_rwd ) CALL iom_rstput( 0, 0, inum, 'ht_0'   , ht_0   , ktype = jp_r8 )
+      IF( ln_wd_il .OR. ln_wd_dl ) CALL iom_rstput( 0, 0, inum, 'ht_0'   , ht_0   , ktype = jp_r8 )
 
       !                                     ! ============================
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90	(revision 8870)
@@ -30,5 +30,5 @@
    USE usrdef_zgr     ! user defined vertical coordinate system
    USE depth_e3       ! depth <=> e3
-   USE wet_dry, ONLY: ln_wd, ln_rwd, rn_ssh_ref
+   USE wet_dry, ONLY: ln_wd_il, ln_wd_dl, rn_ssh_ref
    !
    USE in_out_manager ! I/O manager
@@ -259,5 +259,5 @@
       !
       ! reference depth for negative bathy (wetting and drying only)
-      IF( ln_wd .OR. ln_rwd )  CALL iom_get( inum,  'rn_wd_ref_depth' , rn_ssh_ref   )
+      IF( ln_wd_il .OR. ln_wd_dl )  CALL iom_get( inum,  'rn_wd_ref_depth' , rn_ssh_ref   )
       !
       CALL iom_close( inum )
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DYN/dynhpg.F90
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DYN/dynhpg.F90	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DYN/dynhpg.F90	(revision 8870)
@@ -438,5 +438,5 @@
       !
       CALL wrk_alloc( jpi,jpj,jpk, zhpi, zhpj )
-      IF( ln_wd ) CALL wrk_alloc( jpi,jpj, zcpx, zcpy )
+      IF( ln_wd_il ) CALL wrk_alloc( jpi,jpj, zcpx, zcpy )
       !
       IF( kt == nit000 ) THEN
@@ -451,5 +451,5 @@
       ENDIF
       !
-      IF( ln_wd ) THEN
+      IF( ln_wd_il ) THEN
         DO jj = 2, jpjm1
            DO ji = 2, jpim1 
@@ -509,5 +509,5 @@
 
 
-            IF( ln_wd ) THEN
+            IF( ln_wd_il ) THEN
 
               zhpi(ji,jj,1) = zhpi(ji,jj,1) * zcpx(ji,jj)
@@ -540,5 +540,5 @@
                   &           * ( gde3w_n(ji  ,jj+1,jk) - gde3w_n(ji,jj,jk) ) * r1_e2v(ji,jj)
 
-               IF( ln_wd ) THEN
+               IF( ln_wd_il ) THEN
                  zhpi(ji,jj,jk) = zhpi(ji,jj,jk) * zcpx(ji,jj)
                  zhpj(ji,jj,jk) = zhpj(ji,jj,jk) * zcpy(ji,jj) 
@@ -555,5 +555,5 @@
       !
       CALL wrk_dealloc( jpi,jpj,jpk, zhpi, zhpj )
-      IF( ln_wd ) CALL wrk_dealloc( jpi,jpj, zcpx, zcpy )
+      IF( ln_wd_il ) CALL wrk_dealloc( jpi,jpj, zcpx, zcpy )
       !
    END SUBROUTINE hpg_sco
@@ -700,8 +700,8 @@
       CALL wrk_alloc( jpi, jpj, jpk, drhox, drhoy, drhoz, drhou, drhov, drhow )
       CALL wrk_alloc( jpi, jpj, jpk, rho_i, rho_j, rho_k,  zhpi,  zhpj        )
-      IF( ln_wd ) CALL wrk_alloc( jpi,jpj, zcpx, zcpy )
-      !
-      !
-      IF( ln_wd ) THEN
+      IF( ln_wd_il ) CALL wrk_alloc( jpi,jpj, zcpx, zcpy )
+      !
+      !
+      IF( ln_wd_il ) THEN
         DO jj = 2, jpjm1
            DO ji = 2, jpim1 
@@ -915,5 +915,5 @@
             zhpi(ji,jj,1) = ( rho_k(ji+1,jj  ,1) - rho_k(ji,jj,1) - rho_i(ji,jj,1) ) * r1_e1u(ji,jj)
             zhpj(ji,jj,1) = ( rho_k(ji  ,jj+1,1) - rho_k(ji,jj,1) - rho_j(ji,jj,1) ) * r1_e2v(ji,jj)
-            IF( ln_wd ) THEN
+            IF( ln_wd_il ) THEN
               zhpi(ji,jj,1) = zhpi(ji,jj,1) * zcpx(ji,jj)
               zhpj(ji,jj,1) = zhpj(ji,jj,1) * zcpy(ji,jj) 
@@ -938,5 +938,5 @@
                   &           + (  ( rho_k(ji,jj+1,jk) - rho_k(ji,jj,jk  ) )    &
                   &               -( rho_j(ji,jj  ,jk) - rho_j(ji,jj,jk-1) )  ) * r1_e2v(ji,jj)
-               IF( ln_wd ) THEN
+               IF( ln_wd_il ) THEN
                  zhpi(ji,jj,jk) = zhpi(ji,jj,jk) * zcpx(ji,jj)
                  zhpj(ji,jj,jk) = zhpj(ji,jj,jk) * zcpy(ji,jj) 
@@ -952,5 +952,5 @@
       CALL wrk_dealloc( jpi, jpj, jpk, drhox, drhoy, drhoz, drhou, drhov, drhow )
       CALL wrk_dealloc( jpi, jpj, jpk, rho_i, rho_j, rho_k,  zhpi,  zhpj        )
-      IF( ln_wd ) CALL wrk_dealloc( jpi,jpj, zcpx, zcpy )
+      IF( ln_wd_il ) CALL wrk_dealloc( jpi,jpj, zcpx, zcpy )
       !
    END SUBROUTINE hpg_djc
@@ -989,5 +989,5 @@
       CALL wrk_alloc( jpi,jpj,jpk,   zdept, zrhh )
       CALL wrk_alloc( jpi,jpj,       zsshu_n, zsshv_n )
-      IF( ln_wd ) CALL wrk_alloc( jpi,jpj, zcpx, zcpy )
+      IF( ln_wd_il ) CALL wrk_alloc( jpi,jpj, zcpx, zcpy )
       !
       IF( kt == nit000 ) THEN
@@ -1002,5 +1002,5 @@
       IF( ln_linssh )   znad = 0._wp
 
-      IF( ln_wd ) THEN
+      IF( ln_wd_il ) THEN
         DO jj = 2, jpjm1
            DO ji = 2, jpim1 
@@ -1231,5 +1231,5 @@
                  zdpdx2 = zcoef0 * r1_e1u(ji,jj) * REAL(jis-jid, wp) * (zpwes + zpwed)
                ENDIF
-               IF( ln_wd ) THEN
+               IF( ln_wd_il ) THEN
                   zdpdx1 = zdpdx1 * zcpx(ji,jj) * wdrampu(ji,jj)
                   zdpdx2 = zdpdx2 * zcpx(ji,jj) * wdrampu(ji,jj)
@@ -1290,5 +1290,5 @@
                   zdpdy2 = zcoef0 * r1_e2v(ji,jj) * REAL(jjs-jjd, wp) * (zpnss + zpnsd )
                ENDIF
-               IF( ln_wd ) THEN
+               IF( ln_wd_il ) THEN
                   zdpdy1 = zdpdy1 * zcpy(ji,jj) * wdrampv(ji,jj) 
                   zdpdy2 = zdpdy2 * zcpy(ji,jj) * wdrampv(ji,jj) 
@@ -1305,5 +1305,5 @@
       CALL wrk_dealloc( jpi,jpj,jpk,   zdept, zrhh )
       CALL wrk_dealloc( jpi,jpj,       zsshu_n, zsshv_n )
-      IF( ln_wd ) CALL wrk_dealloc( jpi,jpj, zcpx, zcpy )
+      IF( ln_wd_il ) CALL wrk_dealloc( jpi,jpj, zcpx, zcpy )
       !
    END SUBROUTINE hpg_prj
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90	(revision 8870)
@@ -153,5 +153,5 @@
       REAL(wp) ::   zhura, zhvra         	!   -      -
       REAL(wp) ::   za0, za1, za2, za3		!   -      -
-      REAL(wp) ::   zwdramp                     ! local scalar - only used if ln_rwd = .True. 
+      REAL(wp) ::   zwdramp                     ! local scalar - only used if ln_wd_dl = .True. 
 
       INTEGER  :: iwdg, jwdg, kwdg   ! short-hand values for the indices of the output point
@@ -178,11 +178,7 @@
       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 )
-      IF( ln_rwd ) CALL wrk_alloc( jpi, jpj, ztwdmask, zuwdmask, zvwdmask, zuwdav2, zvwdav2)
-
-      IF ( ln_wd_diag ) THEN 
-         iwdg = jn_wd_i ; jwdg = jn_wd_j ; kwdg = jn_wd_k
-         WRITE(numout,*) 'kt, iwdg, jwdg, kwdg = ', kt, iwdg, jwdg, kwdg 
-      END IF 
+      IF( ln_wd_il ) CALL wrk_alloc( jpi, jpj, zcpx, zcpy )
+      IF( ln_wd_dl ) CALL wrk_alloc( jpi, jpj, ztwdmask, zuwdmask, zvwdmask, zuwdav2, zvwdav2)
+
 
       !
@@ -417,5 +413,5 @@
       !                                   ! ----------------------------------------------------
       IF( .NOT.ln_linssh ) THEN                 ! Variable volume : remove surface pressure gradient
-        IF( ln_wd ) THEN                        ! Calculating and applying W/D gravity filters
+        IF( ln_wd_il ) THEN                        ! Calculating and applying W/D gravity filters
            DO jj = 2, jpjm1
               DO ji = 2, jpim1 
@@ -513,5 +509,5 @@
       !
       ! Note that the "unclipped" bottom friction parameter is used even with explicit drag
-      IF( ln_wd ) THEN
+      IF( ln_wd_il ) THEN
         zu_frc(:,:) = zu_frc(:,:) + MAX(r1_hu_n(:,:) * bfrua(:,:),-1._wp / rdtbt) * zwx(:,:) *  wdrampu(ji,jj)
         zv_frc(:,:) = zv_frc(:,:) + MAX(r1_hv_n(:,:) * bfrva(:,:),-1._wp / rdtbt) * zwy(:,:) *  wdrampv(ji,jj)
@@ -651,5 +647,5 @@
       !                                             ! ==================== !
 
-      IF (ln_rwd) THEN
+      IF (ln_wd_dl) THEN
          zuwdmask(:,:) = 0._wp  ! set to zero for definiteness (not sure this is necessary) 
          zvwdmask(:,:) = 0._wp  ! 
@@ -688,7 +684,7 @@
             
             ! set wetting & drying mask at tracer points for this barotropic sub-step 
-            IF ( ln_rwd ) THEN 
-
-               IF ( ln_rwd_rmp ) THEN 
+            IF ( ln_wd_dl ) THEN 
+
+               IF ( ln_wd_dl_rmp ) THEN 
                   DO jj = 1, jpj                                 
                      DO ji = 1, jpi   ! vector opt.  
@@ -715,8 +711,4 @@
                END IF 
 
-               IF ( ln_wd_diag ) WRITE(numout,*) 'kt, jn = ', kt, jn 
-               IF ( ln_wd_diag ) WRITE(numout, *) 'zsshp2_e: (i,j), (i+1,j), (i,j+1) = ', zsshp2_e(iwdg,jwdg), zsshp2_e(iwdg+1,jwdg), zsshp2_e(iwdg,jwdg+1)
-               IF ( ln_wd_diag ) WRITE(numout, *) 'ht_0:     (i,j), (i+1,j), (i,j+1) = ', ht_0(iwdg,jwdg), ht_0(iwdg+1,jwdg), (iwdg,jwdg+1)
-               IF ( ln_wd_diag ) WRITE(numout, *) 'ztwdmask: (i,j), (i+1,j), (i,j+1) = ', ztwdmask(iwdg,jwdg), ztwdmask(iwdg+1,jwdg), ztwdmask(iwdg,jwdg+1) 
             END IF 
            
@@ -773,12 +765,8 @@
          ENDIF
 #endif
-         IF( ln_wd ) CALL wad_lmt_bt(zwx, zwy, sshn_e, zssh_frc, rdtbt)
-
-         IF ( ln_rwd ) THEN 
-
-            IF ( ln_wd_diag ) THEN 
-               WRITE(numout, *) 'zwx: (i,j), (i+1,j) = ', zwx(iwdg,jwdg), zwx(iwdg+1,jwdg)
-               WRITE(numout, *) 'zwy: (i,j), (i,j+1) = ', zwy(iwdg,jwdg), zwx(iwdg,jwdg+1)
-            END IF 
+         IF( ln_wd_il ) CALL wad_lmt_bt(zwx, zwy, sshn_e, zssh_frc, rdtbt)
+
+         IF ( ln_wd_dl ) THEN 
+
 
 ! un_e and vn_e are set to zero at faces where the direction of the flow is from dry cells 
@@ -804,14 +792,4 @@
             END DO
 
-            IF ( ln_wd_diag ) THEN 
-               WRITE(numout, *) 'zuwdmask: (i,j)     = ', zuwdmask(iwdg,jwdg)
-               WRITE(numout, *) 'zwx: (i,j)          = ', zwx(iwdg,jwdg)
-               WRITE(numout, *) 'e2u: (i,j)          = ', e2u(iwdg,jwdg)
-               WRITE(numout, *) 'ua_e: (i,j)         = ', ua_e(iwdg,jwdg)
-               WRITE(numout, *) 'un_e: (i,j)         = ', un_e(iwdg,jwdg)
-               WRITE(numout, *) 'zhup2_e: (i,j)      = ', zhup2_e(iwdg,jwdg)
-               WRITE(numout, *) 'zvwdmask: (i,j)     = ', zvwdmask(iwdg,jwdg)
-               WRITE(numout, *) 'zwy: (i,j)          = ', zwy(iwdg,jwdg) 
-            END IF 
 
          END IF    
@@ -822,16 +800,8 @@
          vn_adv(:,:) = vn_adv(:,:) + za2 * zwy(:,:) * r1_e1v(:,:)
          
-         ! sum over sub-time-steps to decide which baroclinic velocities to set to zero (zuwdav2 is only used when ln_rwd_bc = True) 
-         IF ( ln_rwd_bc ) THEN
+         ! sum over sub-time-steps to decide which baroclinic velocities to set to zero (zuwdav2 is only used when ln_wd_dl_bc = True) 
+         IF ( ln_wd_dl_bc ) THEN
             zuwdav2(:,:) = zuwdav2(:,:) + za2 * zuwdmask(:,:)
             zvwdav2(:,:) = zvwdav2(:,:) + za2 * zvwdmask(:,:)
-
-            IF ( ln_wd_diag ) THEN 
-               WRITE(numout, *) 'za2, r1_e2u(i,j)     = ', za2, r1_e2u(iwdg,jwdg) 
-               WRITE(numout, *) 'un_adv: (i,j)        = ', un_adv(iwdg,jwdg)
-               WRITE(numout, *) 'zuwdav2: (i,j)       = ', zuwdav2(iwdg,jwdg)
-               WRITE(numout, *) 'zvwdav2: (i,j)       = ', zvwdav2(iwdg,jwdg)
-            END IF 
-
          END IF 
 
@@ -889,5 +859,5 @@
          zsshp2_e(:,:) = za0 *  ssha_e(:,:) + za1 *  sshn_e (:,:) &
           &            + za2 *  sshb_e(:,:) + za3 *  sshbb_e(:,:)
-         IF( ln_wd ) THEN                   ! Calculating and applying W/D gravity filters
+         IF( ln_wd_il ) THEN                   ! Calculating and applying W/D gravity filters
            DO jj = 2, jpjm1
               DO ji = 2, jpim1 
@@ -1019,5 +989,5 @@
          ! Surface pressure trend:
 
-         IF( ln_wd ) THEN
+         IF( ln_wd_il ) THEN
            DO jj = 2, jpjm1
               DO ji = 2, jpim1 
@@ -1069,11 +1039,7 @@
                DO ji = fs_2, fs_jpim1   ! vector opt.
 
-                  IF( ln_wd ) THEN
-                    zhura = hu_0(ji,jj) + zsshu_a(ji,jj)
-                    zhvra = hv_0(ji,jj) + zsshv_a(ji,jj)
-                  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))
@@ -1094,28 +1060,8 @@
          ENDIF
 
-! if ln_rwd: ua_e and va_e should not be masked ; they are used to determine the direction of flow into all cells
-
-!         IF ( ln_rwd) THEN 
-!            IF ( ln_wd_diag ) THEN 
-!               WRITE(numout, *) 'ua_e: (i,j)         = ', ua_e(iwdg,jwdg)
-!               WRITE(numout, *) 'va_e: (i,j)         = ', va_e(iwdg,jwdg)
-!            END IF 
-!            ua_e(:,:) = ua_e(:,:) * zuwdmask(:,:) 
-!            va_e(:,:) = va_e(:,:) * zvwdmask(:,:) 
-!            IF ( ln_wd_diag ) THEN 
-!               WRITE(numout, *) 'ua_e: (i,j)         = ', ua_e(iwdg,jwdg)
-!               WRITE(numout, *) 'va_e: (i,j)         = ', va_e(iwdg,jwdg)
-!            END IF 
-!         END IF 
-
          
          IF( .NOT.ln_linssh ) THEN                     !* Update ocean depth (variable volume case only)
-            IF( ln_wd ) THEN
-              hu_e (:,:) = hu_0(:,:) + zsshu_a(:,:)
-              hv_e (:,:) = hv_0(:,:) + zsshv_a(:,:)
-            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(:,:) )
@@ -1151,5 +1097,5 @@
             va_b  (:,:) = va_b  (:,:) + za1 * va_e  (:,:) 
          ELSE                                              ! Sum transports
-            IF (.NOT.ln_rwd) THEN  
+            IF (.NOT.ln_wd_dl) THEN  
                ua_b  (:,:) = ua_b  (:,:) + za1 * ua_e  (:,:) * hu_e (:,:)
                va_b  (:,:) = va_b  (:,:) + za1 * va_e  (:,:) * hv_e (:,:)
@@ -1185,10 +1131,4 @@
       ENDIF
 
-      IF ( ln_wd_diag ) THEN 
-         WRITE(numout, *) 'ub2_b: (i,j)        = ', ub2_b(iwdg,jwdg)
-         WRITE(numout, *) 'r1_hu_n: (i,j)      = ', r1_hu_n(iwdg,jwdg)
-         WRITE(numout, *) 'zwx: (i,j)          = ', zwx(iwdg,jwdg)
-         WRITE(numout, *) 'un_adv: (i,j)        = ', un_adv(iwdg,jwdg)
-      END IF 
 
       !
@@ -1222,22 +1162,4 @@
       ENDIF
 
-      IF ( ln_wd_diag ) THEN 
-         WRITE(numout, *) 'ua_b: (i,j) A        = ', ua_b(iwdg,jwdg)
-         WRITE(numout, *) 'va_b: (i,j) B        = ', va_b(iwdg,jwdg)
-      END IF 
-
-! temporary debugging code 
-      IF ( ln_wd_diag ) THEN 
-         WRITE(numout, *) 'ua: (i,j,k)  B       = ', ua(iwdg,jwdg,kwdg)
-         WRITE(numout, *) 'ua_b: (i,j)  B       = ', ua_b(iwdg,jwdg)
-         WRITE(numout, *) 'un: (i,j,k)          = ', un(iwdg,jwdg,kwdg)
-         WRITE(numout, *) 'un_b: (i,j)          = ', un_b(iwdg,jwdg)
-         WRITE(numout, *) 'un_adv: (i,j)        = ', un_adv(iwdg,jwdg)
-         WRITE(numout, *) 'va: (i,j,k)          = ', va(iwdg,jwdg,kwdg)
-         WRITE(numout, *) 'va_b: (i,j,k)        = ', va_b(iwdg,jwdg)
-         WRITE(numout, *) 'vn: (i,j,k)          = ', vn(iwdg,jwdg,kwdg)
-         WRITE(numout, *) 'vn_b: (i,j)          = ', vn_b(iwdg,jwdg)
-         WRITE(numout, *) 'vn_adv: (i,j)        = ', vn_adv(iwdg,jwdg)
-      END IF 
 
       ! Correct velocities so that the barotropic velocity equals (un_adv, vn_adv) (in all cases)  
@@ -1247,5 +1169,5 @@
       END DO
 
-      IF ( ln_rwd .and. ln_rwd_bc) THEN 
+      IF ( ln_wd_dl .and. ln_wd_dl_bc) THEN 
          DO jk = 1, jpkm1
             un(:,:,jk) = ( un_adv(:,:) + zuwdav2(:,:)*(un(:,:,jk) - un_adv(:,:)) ) * umask(:,:,jk) 
@@ -1254,12 +1176,4 @@
       END IF 
 
-      IF ( ln_wd_diag ) THEN 
-         WRITE(numout, *) 'ua: (i,j,k)          = ', ua(iwdg,jwdg,kwdg)
-         WRITE(numout, *) 'ua_b: (i,j,k)        = ', ua_b(iwdg,jwdg)
-         WRITE(numout, *) 'un: (i,j,k)          = ', un(iwdg,jwdg,kwdg)
-         WRITE(numout, *) 'va: (i,j,k)          = ', va(iwdg,jwdg,kwdg)
-         WRITE(numout, *) 'va_b: (i,j,k)        = ', va_b(iwdg,jwdg)
-         WRITE(numout, *) 'vn: (i,j,k)          = ', vn(iwdg,jwdg,kwdg)
-      END IF 
       
       CALL iom_put(  "ubar", un_adv(:,:)      )    ! barotropic i-current
@@ -1290,6 +1204,6 @@
       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 )
-      IF( ln_rwd ) CALL wrk_dealloc( jpi, jpj, ztwdmask, zuwdmask, zvwdmask, zuwdav2, zvwdav2 )
+      IF( ln_wd_il ) CALL wrk_dealloc( jpi, jpj, zcpx, zcpy )
+      IF( ln_wd_dl ) CALL wrk_dealloc( jpi, jpj, ztwdmask, zuwdmask, zvwdmask, zuwdav2, zvwdav2 )
       !
       IF ( ln_diatmb ) THEN
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DYN/sshwzv.F90
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DYN/sshwzv.F90	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DYN/sshwzv.F90	(revision 8870)
@@ -94,5 +94,5 @@
       !                                           !   After Sea Surface Height   !
       !                                           !------------------------------!
-      IF(ln_wd) THEN
+      IF(ln_wd_il) THEN
          CALL wad_lmt(sshb, zcoef * (emp_b(:,:) + emp(:,:)), z2dt)
       ENDIF
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DYN/wet_dry.F90
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DYN/wet_dry.F90	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/DYN/wet_dry.F90	(revision 8870)
@@ -7,5 +7,5 @@
    !! Wetting and drying includes initialisation routine and routines to
    !! compute and apply flux limiters and preserve water depth positivity
-   !! only effects if wetting/drying is on (ln_wd == .true.)
+   !! only effects if wetting/drying is on (ln_wd_il == .true. or ln_wd_dl==.true. )
    !!==============================================================================
    !! History :  3.6  ! 2014-09  ((H.Liu)  Original code
@@ -38,7 +38,7 @@
    REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:) ::   wdramp, wdrampu, wdrampv ! for hpg limiting
 
-   LOGICAL,  PUBLIC  ::   ln_wd       !: Wetting/drying activation switch (T:on,F:off)
+   LOGICAL,  PUBLIC  ::   ln_wd_il    !: Wetting/drying il activation switch (T:on,F:off)
+   LOGICAL,  PUBLIC  ::   ln_wd_dl    !: Wetting/drying dl activation switch (T:on,F:off)
    REAL(wp), PUBLIC  ::   rn_wdmin0   !: depth at which wetting/drying starts
-   LOGICAL,  PUBLIC  ::   ln_rwd      !: ROMS Wetting/drying activation switch (T:on,F:off)
    REAL(wp), PUBLIC  ::   rn_wdmin1   !: minimum water depth on dried cells
    REAL(wp), PUBLIC  ::   rn_wdmin2   !: tolerance of minimum water depth on dried cells
@@ -46,12 +46,10 @@
                                            !: will be considered
    INTEGER , PUBLIC  ::   nn_wdit     !: maximum number of iteration for W/D limiter
-   LOGICAL,  PUBLIC  ::   ln_rwd_bc   !: ROMS scheme: True implies 3D velocities are set to the barotropic values at points 
+   LOGICAL,  PUBLIC  ::   ln_wd_dl_bc !: DL scheme: True implies 3D velocities are set to the barotropic values at points 
                                       !: where the flow is from wet points on less than half the barotropic sub-steps  
-   LOGICAL,  PUBLIC  ::   ln_rwd_rmp  !: use a ramp for the rwd flux limiter between 2 rn_wdmin1 and rn_wdmin1 (rather than a cut-off at rn_wdmin1)      
+   LOGICAL,  PUBLIC  ::   ln_wd_dl_rmp !: use a ramp for the dl flux limiter between 2 rn_wdmin1 and rn_wdmin1 (rather than a cut-off at rn_wdmin1)      
    REAL(wp), PUBLIC  ::   rn_ssh_ref  !: height of z=0 with respect to the geoid; 
    REAL(wp), PUBLIC  ::   rn_ht_0     !: the height at which ht_0 = 0   
 
-   LOGICAL,  PUBLIC  ::   ln_wd_diag  ! True implies wad diagnostic at chosen point are printed out
-   INTEGER , PUBLIC  ::   jn_wd_i, jn_wd_j, jn_wd_k   ! indices at which diagnostic outputs are generated 
 
    PUBLIC   wad_init                  ! initialisation routine called by step.F90
@@ -71,6 +69,6 @@
       !! ** input   : - namwad namelist
       !!----------------------------------------------------------------------
-      NAMELIST/namwad/ ln_wd, ln_rwd, rn_wdmin0, ln_rwd, rn_wdmin1, rn_wdmin2, rn_wdld, nn_wdit, ln_wd_diag, ln_rwd_bc, &
-                     &  rn_ht_0, jn_wd_i, jn_wd_j, jn_wd_k,ln_rwd_rmp
+      NAMELIST/namwad/ ln_wd_il, ln_wd_dl, rn_wdmin0, ln_wd_dl, rn_wdmin1, rn_wdmin2, rn_wdld, nn_wdit, ln_wd_dl_bc, &
+                     &  rn_ht_0,ln_wd_dl_rmp
 
       INTEGER  ::   ios                 ! Local integer output status for namelist read
@@ -93,6 +91,6 @@
          WRITE(numout,*) '~~~~~~~~'
          WRITE(numout,*) '   Namelist namwad'
-         WRITE(numout,*) '      Logical for NOC  wd scheme         ln_wd      = ', ln_wd
-         WRITE(numout,*) '      Logical for ROMS wd scheme         ln_rwd     = ', ln_rwd
+         WRITE(numout,*) '      Logical for Iter Lim wd option ln_wd_il       = ', ln_wd_il
+         WRITE(numout,*) '      Logical for Dir. Lim wd option ln_wd_dl       = ', ln_wd_dl
          WRITE(numout,*) '      Depth at which wet/drying starts rn_wdmin0    = ', rn_wdmin0
          WRITE(numout,*) '      Minimum wet depth on dried cells rn_wdmin1    = ', rn_wdmin1
@@ -100,14 +98,10 @@
          WRITE(numout,*) '      land elevation threshold         rn_wdld      = ', rn_wdld
          WRITE(numout,*) '      Max iteration for W/D limiter    nn_wdit      = ', nn_wdit
-         WRITE(numout,*) '      Logical for WAD diagnostics      ln_wd_diag   = ', ln_wd_diag
-         WRITE(numout,*) '      T => baroclinic u,v = 0 at dry pts: ln_rwd_bc = ', ln_rwd_bc     
-         WRITE(numout,*) '      use a ramp for rwd limiter:      ln_rwd_rmp   = ', ln_rwd_rmp
+         WRITE(numout,*) '      T => baroclinic u,v = 0 at dry pts: ln_wd_dl_bc = ', ln_wd_dl_bc     
+         WRITE(numout,*) '      use a ramp for rwd limiter:      ln_wd_dl_rwd_rmp   = ', ln_wd_dl_rmp
          WRITE(numout,*) '      the height (z) at which ht_0 = 0:rn_ht_0      = ', rn_ht_0  
-         WRITE(numout,*) '      i-index for diagnostic point     jn_wd_i      = ', jn_wd_i
-         WRITE(numout,*) '      j-index for diagnostic point     jn_wd_j      = ', jn_wd_j
-         WRITE(numout,*) '      k-index for diagnostic point     jn_wd_k      = ', jn_wd_k
       ENDIF
       !
-      IF(ln_wd .OR. ln_rwd) THEN
+      IF(ln_wd_il .OR. ln_wd_dl) THEN
          ALLOCATE( wdmask(jpi,jpj),   STAT=ierr )
          ALLOCATE( wdramp(jpi,jpj), wdrampu(jpi,jpj), wdrampv(jpi,jpj), STAT=ierr ) 
@@ -147,5 +141,5 @@
       IF( nn_timing == 1 )  CALL timing_start('wad_lmt')
 
-      IF(ln_wd) THEN
+      IF(ln_wd_il) THEN
 
         CALL wrk_alloc( jpi, jpj, zflxp, zflxn, zflxu, zflxv, zflxu1, zflxv1 )
@@ -333,5 +327,5 @@
       IF( nn_timing == 1 )  CALL timing_start('wad_lmt_bt')
 
-      IF(ln_wd) THEN
+      IF(ln_wd_il) THEN
 
         CALL wrk_alloc( jpi, jpj, zflxp, zflxn, zflxu1, zflxv1 )
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90	(revision 8870)
@@ -34,5 +34,5 @@
    USE wrk_nemo       ! Memory Allocation
    USE timing         ! Timing
-   USE wet_dry
+   USE wet_dry,   ONLY :   ln_wd_il, ln_wd_dl, rn_wdmin1
 
    IMPLICIT NONE
@@ -123,5 +123,5 @@
       DO jj = 2, jpj
          DO ji = fs_2, fs_jpim1   ! vector opt.
-            IF ( ln_rwd_rmp ) THEN    ! If near WAD point limite the flux for now
+            IF ( ln_wd_il .or. ln_wd_dl ) THEN    ! If near WAD point limit the flux for now
                IF ( sshn(ji,jj) + ht_0(ji,jj) >  2._wp * rn_wdmin1 ) THEN
                   sbc_tsc(ji,jj,jp_tem) = r1_rau0_rcp * qns(ji,jj)   ! non solar heat flux
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/stpctl.F90
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/stpctl.F90	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/NEMO/OPA_SRC/stpctl.F90	(revision 8870)
@@ -22,5 +22,5 @@
    USE lib_mpp         ! distributed memory computing
    USE lib_fortran     ! Fortran routines library 
-   USE wet_dry,  ONLY: ln_wd, ln_rwd, rn_ssh_ref    ! reference depth for negative bathy
+   USE wet_dry,  ONLY: ln_wd_il, ln_wd_dl, rn_ssh_ref    ! reference depth for negative bathy
 
    IMPLICIT NONE
@@ -151,5 +151,5 @@
       DO jj = 1, jpj
          DO ji = 1, jpi
-            IF( (ln_wd .OR. ln_rwd)) THEN
+            IF( (ln_wd_il .OR. ln_wd_dl)) THEN
                IF( tmask(ji,jj,1) == 1) zsshmax = MAX( zsshmax, ABS(sshn(ji,jj)+rn_ssh_ref) )
             ELSE
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/TOOLS/DOMAINcfg/namelist_cfg
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/TOOLS/DOMAINcfg/namelist_cfg	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/TOOLS/DOMAINcfg/namelist_cfg	(revision 8870)
@@ -58,4 +58,5 @@
    ppkth2      =  999999.              !
    ppacr2      =  999999.              !
+   rn_wd_ref_depth   =    0.0          !  Reference Depth for WAD cases (0 all other cases)
 /
 !-----------------------------------------------------------------------
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/TOOLS/DOMAINcfg/namelist_ref
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/TOOLS/DOMAINcfg/namelist_ref	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/TOOLS/DOMAINcfg/namelist_ref	(revision 8870)
@@ -170,13 +170,6 @@
    ppkth2      =       48.029893720000 !
    ppacr2      =       13.000000000000 !
-/
-!-----------------------------------------------------------------------
-&namwad        !   Wetting and drying                                   (default F)
-!-----------------------------------------------------------------------
-   ln_wd       = .false.   !  T/F activation of wetting and drying
-   rn_wdmin1   =  0.1      !  Minimum wet depth on dried cells
-   rn_wdmin2   =  0.01     !  Tolerance of min wet depth on dried cells
-   rn_wdld     =  20.0     !  Land elevation below which wetting/drying is allowed
-   nn_wdit     =  10       !  Max iterations for W/D limiter
+   ln_wd       =             .false.   !  T/F activation of wetting and drying
+   rn_wd_ref_depth   =    0.0          !  Reference Depth for WAD cases (0 all other cases)
 /
 !-----------------------------------------------------------------------
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/TOOLS/DOMAINcfg/src/dom_oce.f90
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/TOOLS/DOMAINcfg/src/dom_oce.f90	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/TOOLS/DOMAINcfg/src/dom_oce.f90	(revision 8870)
@@ -31,4 +31,6 @@
    !                                    !!* Namelist namdom : time & space domain *
    INTEGER , PUBLIC ::   nn_bathy        !: = 0/1 ,compute/read the bathymetry file
+   LOGICAL   PUBLIC ::   ln_wd           !: Is it a WAD domain? T/F Default T
+   REAL(wp), PUBLIC ::   rn_wd_ref_depth !: Reference depth for Wet and Dry
    REAL(wp), PUBLIC ::   rn_bathy        !: depth of flat bottom (active if nn_bathy=0; if =0 depth=jpkm1)
    REAL(wp), PUBLIC ::   rn_hmin         !: minimum ocean depth (>0) or minimum number of ocean levels (<0)
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/TOOLS/DOMAINcfg/src/domain.f90
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/TOOLS/DOMAINcfg/src/domain.f90	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/TOOLS/DOMAINcfg/src/domain.f90	(revision 8870)
@@ -160,5 +160,5 @@
          &             ppglam0, ppgphi0, ppe1_deg, ppe2_deg, ppe1_m, ppe2_m,                         &
          &             ppsur, ppa0, ppa1, ppkth, ppacr, ppdzmin, pphmax, ldbletanh,                  &
-         &             ppa2, ppkth2, ppacr2
+         &             ppa2, ppkth2, ppacr2, rn_wd_ref_depth, ln_wd
 
 
@@ -272,4 +272,6 @@
          WRITE(numout,*) '      flag read/compute bathymetry      nn_bathy     = ', nn_bathy
          WRITE(numout,*) '      Depth (if =0 bathy=jpkm1)         rn_bathy     = ', rn_bathy
+         WRITE(numout,*) '      WAD Domain?                       ln_wd        = ', ln_wd
+         WRITE(numout,*) '      WAD Reference depth)              rn_wd_ref_depth     = ', rn_wd_ref_depth
          WRITE(numout,*) '      min depth of the ocean    (>0) or    rn_hmin   = ', rn_hmin
          WRITE(numout,*) '      min number of ocean level (<0)       '
@@ -431,4 +433,14 @@
       IF( ln_isfcav ) THEN   ;   icav = 1   ;   ELSE   ;   icav = 0   ;   ENDIF
       CALL iom_rstput( 0, 0, inum, 'ln_isfcav', REAL( icav, wp), ktype = jp_i4 )
+      z2d(:,:) = hbatt(:,:) ! add back on reference height to get appox dep
+                                 !this is later corrected for with specified min depth bg user for above greoid
+                                 ! WAD points
+      !where (z2d   (:,:).lte.1e-5)  z2d(:,:) = -10.0
+      where (tmask  (:,:,1).eq.0)  z2d(:,:) = 0.0
+      IF( ln_wd ) THEN
+          CALL iom_rstput( 0, 0, inum, 'rn_wd_ref_depth'   , rn_wd_ref_depth  ) ! replace this later with variable
+          CALL iom_rstput( 0, 0, inum, 'ht_wd', z2d )        !    ht_wd
+      ENDIF
+
       !
       !                             !==  horizontal mesh  !
Index: /branches/UKMO/ROMS_WAD_7832/NEMOGCM/TOOLS/DOMAINcfg/src/domzgr.f90
===================================================================
--- /branches/UKMO/ROMS_WAD_7832/NEMOGCM/TOOLS/DOMAINcfg/src/domzgr.f90	(revision 8869)
+++ /branches/UKMO/ROMS_WAD_7832/NEMOGCM/TOOLS/DOMAINcfg/src/domzgr.f90	(revision 8870)
@@ -1957,5 +1957,32 @@
          WRITE(numout,*) '        Bottom cell (Zb) (m) = H*rn_zb_a + rn_zb_b'
       ENDIF
-
+      ! CEOD
+      ! Add on some reference level to make nagative bathy positive to create
+      ! sensible e3t_0's
+! Can used commented code here to force bathy near open bdy not to have any WAD
+! points
+
+!CEOD MAKE points on the perimeter assuming a bondary is here on shallower than
+!10m so that tide can be specified here.
+!      DO jj = 1, jpj
+!         DO ji = 1, jpi
+!            !CEODIF( mig(ji) <= 2 .or. mjg(jj) <= 2  .or. mig(ji) >= jpiglo-2 .or.  mjg(jj) >=jpjglo-2) then
+!            IF( mig(ji) <= 10   .or. mjg(jj) <=10  .or.  mjg(ji) >=jpiglo-10+1 .or. mjg(jj) >=jpjglo-10+1   ) then
+!               IF( bathy(ji,jj) + rn_wd_ref_depth  > 0.0)   then
+!                  bathy(ji,jj) = max(5.0,bathy(ji,jj)) !
+!               ENDIF
+!               IF( bathy(ji,jj)  + rn_wd_ref_depth   <= 0.0)   then
+!                  bathy(ji,jj) =  -rn_wd_ref_depth*2._wp ! Make sure it is land
+!               ENDIF
+!            ENDIF
+!         END DO
+!      END DO
+
+      IF( ln_wd) THEN
+         bathy(:,:) = bathy(:,:) + rn_wd_ref_depth !  Arbitrary reference level for WAD, This needs
+      ELSE
+         bathy(:,:) = bathy(:,:)  !  Arbitrary reference level for WAD, This needs
+      ENDIF
+                                                !  to be accounted for in istate in the actual model and bdys etc.
       hift(:,:) = rn_sbot_min                     ! set the minimum depth for the s-coordinate
       hifu(:,:) = rn_sbot_min
