Index: trunk/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90	(revision 5552)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90	(revision 5836)
@@ -17,9 +17,9 @@
    !!             -   ! 2005-11  (V. Garnier) Surface pressure gradient organization
    !!            3.2  ! 2009-07  (R. Benshila) Suppression of rigid-lid option
+   !!            3.6  ! 2015-05  (P. Mathiot) ISF: add wmask,wumask and wvmask
    !!----------------------------------------------------------------------
 
    !!----------------------------------------------------------------------
    !!   dom_msk        : compute land/ocean mask
-   !!   dom_msk_nsa    : update land/ocean mask when no-slip accurate option is used.
    !!----------------------------------------------------------------------
    USE oce             ! ocean dynamics and tracers
@@ -36,5 +36,4 @@
 
    PUBLIC   dom_msk         ! routine called by inidom.F90
-   PUBLIC   dom_msk_alloc   ! routine called by nemogcm.F90
 
    !                            !!* Namelist namlbc : lateral boundary condition *
@@ -42,7 +41,4 @@
    LOGICAL, PUBLIC :: ln_vorlat  !  consistency of vorticity boundary condition 
    !                                            with analytical eqs.
-
-
-   INTEGER, ALLOCATABLE, SAVE, DIMENSION(:,:) ::  icoord ! Workspace for dom_msk_nsa()
 
    !! * Substitutions
@@ -54,17 +50,4 @@
    !!----------------------------------------------------------------------
 CONTAINS
-   
-   INTEGER FUNCTION dom_msk_alloc()
-      !!---------------------------------------------------------------------
-      !!                 ***  FUNCTION dom_msk_alloc  ***
-      !!---------------------------------------------------------------------
-      dom_msk_alloc = 0
-#if defined key_noslip_accurate
-      ALLOCATE(icoord(jpi*jpj*jpk,3), STAT=dom_msk_alloc)
-#endif
-      IF( dom_msk_alloc /= 0 )   CALL ctl_warn('dom_msk_alloc: failed to allocate icoord array')
-      !
-   END FUNCTION dom_msk_alloc
-
 
    SUBROUTINE dom_msk
@@ -129,6 +112,5 @@
       !!               tmask_i  : interior ocean mask
       !!----------------------------------------------------------------------
-      !
-      INTEGER  ::   ji, jj, jk      ! dummy loop indices
+      INTEGER  ::   ji, jj, jk               ! dummy loop indices
       INTEGER  ::   iif, iil, ii0, ii1, ii   ! local integers
       INTEGER  ::   ijf, ijl, ij0, ij1       !   -       -
@@ -199,24 +181,4 @@
       END DO  
 
-!!gm  ????
-#if defined key_zdfkpp
-      IF( cp_cfg == 'orca' ) THEN
-         IF( jp_cfg == 2 )   THEN       ! land point on Bab el Mandeb zonal section
-            ij0 =  87   ;   ij1 =  88
-            ii0 = 160   ;   ii1 = 161
-            tmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 1:jpk ) = 0._wp
-         ELSE
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,cform_war)
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*)'          A mask must be applied on Bab el Mandeb strait'
-            IF(lwp) WRITE(numout,*)'          in case of ORCAs configurations'
-            IF(lwp) WRITE(numout,*)'          This is a problem which is not yet solved'
-            IF(lwp) WRITE(numout,*)
-         ENDIF
-      ENDIF
-#endif
-!!gm end
-
       ! Interior domain mask (used for global sum)
       ! --------------------
@@ -284,11 +246,11 @@
       ! 3. Ocean/land mask at wu-, wv- and w points 
       !----------------------------------------------
-      wmask (:,:,1) = tmask(:,:,1) ! ????????
-      wumask(:,:,1) = umask(:,:,1) ! ????????
-      wvmask(:,:,1) = vmask(:,:,1) ! ????????
-      DO jk=2,jpk
-         wmask (:,:,jk)=tmask(:,:,jk) * tmask(:,:,jk-1)
-         wumask(:,:,jk)=umask(:,:,jk) * umask(:,:,jk-1)   
-         wvmask(:,:,jk)=vmask(:,:,jk) * vmask(:,:,jk-1)
+      wmask (:,:,1) = tmask(:,:,1)     ! surface
+      wumask(:,:,1) = umask(:,:,1)
+      wvmask(:,:,1) = vmask(:,:,1)
+      DO jk = 2, jpk                   ! interior values
+         wmask (:,:,jk) = tmask(:,:,jk) * tmask(:,:,jk-1)
+         wumask(:,:,jk) = umask(:,:,jk) * umask(:,:,jk-1)   
+         wvmask(:,:,jk) = vmask(:,:,jk) * vmask(:,:,jk-1)
       END DO
 
@@ -339,10 +301,4 @@
       ENDIF
 
-
-      ! mask for second order calculation of vorticity
-      ! ----------------------------------------------
-      CALL dom_msk_nsa
-
-      
       ! Lateral boundary conditions on velocity (modify fmask)
       ! ---------------------------------------     
@@ -377,18 +333,16 @@
       IF( cp_cfg == "orca" .AND. jp_cfg == 2 ) THEN   ! ORCA_R2 configuration
          !                                                 ! Increased lateral friction near of some straits
-         IF( nn_cla == 0 ) THEN
-            !                                ! Gibraltar strait  : partial slip (fmask=0.5)
-            ij0 = 101   ;   ij1 = 101
-            ii0 = 139   ;   ii1 = 140   ;   fmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 1:jpk ) =  0.5_wp
-            ij0 = 102   ;   ij1 = 102
-            ii0 = 139   ;   ii1 = 140   ;   fmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 1:jpk ) =  0.5_wp
-            !
-            !                                ! Bab el Mandeb : partial slip (fmask=1)
-            ij0 =  87   ;   ij1 =  88
-            ii0 = 160   ;   ii1 = 160   ;   fmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 1:jpk ) =  1._wp
-            ij0 =  88   ;   ij1 =  88
-            ii0 = 159   ;   ii1 = 159   ;   fmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 1:jpk ) =  1._wp
-            !
-         ENDIF
+         !                                ! Gibraltar strait  : partial slip (fmask=0.5)
+         ij0 = 101   ;   ij1 = 101
+         ii0 = 139   ;   ii1 = 140   ;   fmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 1:jpk ) =  0.5_wp
+         ij0 = 102   ;   ij1 = 102
+         ii0 = 139   ;   ii1 = 140   ;   fmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 1:jpk ) =  0.5_wp
+         !
+         !                                ! Bab el Mandeb : partial slip (fmask=1)
+         ij0 =  87   ;   ij1 =  88
+         ii0 = 160   ;   ii1 = 160   ;   fmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 1:jpk ) =  1._wp
+         ij0 =  88   ;   ij1 =  88
+         ii0 = 159   ;   ii1 = 159   ;   fmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 1:jpk ) =  1._wp
+         !
          !                                ! Danish straits  : strong slip (fmask > 2)
 ! We keep this as an example but it is instable in this case 
@@ -500,197 +454,4 @@
       !
    END SUBROUTINE dom_msk
-
-#if defined key_noslip_accurate
-   !!----------------------------------------------------------------------
-   !!   'key_noslip_accurate' :         accurate no-slip boundary condition
-   !!----------------------------------------------------------------------
-   
-   SUBROUTINE dom_msk_nsa
-      !!---------------------------------------------------------------------
-      !!                 ***  ROUTINE dom_msk_nsa  ***
-      !! 
-      !! ** Purpose :
-      !!
-      !! ** Method  :
-      !!
-      !! ** Action :
-      !!----------------------------------------------------------------------
-      INTEGER  ::   ji, jj, jk, jl      ! dummy loop indices
-      INTEGER  ::   ine, inw, ins, inn, itest, ierror, iind, ijnd
-      REAL(wp) ::   zaa
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('dom_msk_nsa')
-      !
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'dom_msk_nsa : noslip accurate boundary condition'
-      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~   using Schchepetkin and O Brian scheme'
-      IF( lk_mpp )   CALL ctl_stop( ' mpp version is not yet implemented' )
-
-      ! mask for second order calculation of vorticity
-      ! ----------------------------------------------
-      ! noslip boundary condition: fmask=1  at convex corner, store
-      ! index of straight coast meshes ( 'west', refering to a coast,
-      ! means west of the ocean, aso)
-      
-      DO jk = 1, jpk
-         DO jl = 1, 4
-            npcoa(jl,jk) = 0
-            DO ji = 1, 2*(jpi+jpj)
-               nicoa(ji,jl,jk) = 0
-               njcoa(ji,jl,jk) = 0
-            END DO
-         END DO
-      END DO
-      
-      IF( jperio == 2 ) THEN
-         WRITE(numout,*) ' '
-         WRITE(numout,*) ' symetric boundary conditions need special'
-         WRITE(numout,*) ' treatment not implemented. we stop.'
-         STOP
-      ENDIF
-      
-      ! convex corners
-      
-      DO jk = 1, jpkm1
-         DO jj = 1, jpjm1
-            DO ji = 1, jpim1
-               zaa = tmask(ji  ,jj,jk) + tmask(ji  ,jj+1,jk)   &
-                  &+ tmask(ji+1,jj,jk) + tmask(ji+1,jj+1,jk)
-               IF( ABS(zaa-3._wp) <= 0.1_wp )   fmask(ji,jj,jk) = 1._wp
-            END DO
-         END DO
-      END DO
-
-      ! north-south straight coast
-
-      DO jk = 1, jpkm1
-         inw = 0
-         ine = 0
-         DO jj = 2, jpjm1
-            DO ji = 2, jpim1
-               zaa = tmask(ji+1,jj,jk) + tmask(ji+1,jj+1,jk)
-               IF( ABS(zaa-2._wp) <= 0.1_wp .AND. fmask(ji,jj,jk) == 0._wp ) THEN
-                  inw = inw + 1
-                  nicoa(inw,1,jk) = ji
-                  njcoa(inw,1,jk) = jj
-                  IF( nprint == 1 ) WRITE(numout,*) ' west  : ', jk, inw, ji, jj
-               ENDIF
-               zaa = tmask(ji,jj,jk) + tmask(ji,jj+1,jk)
-               IF( ABS(zaa-2._wp) <= 0.1_wp .AND. fmask(ji,jj,jk) == 0._wp ) THEN
-                  ine = ine + 1
-                  nicoa(ine,2,jk) = ji
-                  njcoa(ine,2,jk) = jj
-                  IF( nprint == 1 ) WRITE(numout,*) ' east  : ', jk, ine, ji, jj
-               ENDIF
-            END DO
-         END DO
-         npcoa(1,jk) = inw
-         npcoa(2,jk) = ine
-      END DO
-
-      ! west-east straight coast
-
-      DO jk = 1, jpkm1
-         ins = 0
-         inn = 0
-         DO jj = 2, jpjm1
-            DO ji =2, jpim1
-               zaa = tmask(ji,jj+1,jk) + tmask(ji+1,jj+1,jk)
-               IF( ABS(zaa-2._wp) <= 0.1_wp .AND. fmask(ji,jj,jk) == 0._wp ) THEN
-                  ins = ins + 1
-                  nicoa(ins,3,jk) = ji
-                  njcoa(ins,3,jk) = jj
-                  IF( nprint == 1 ) WRITE(numout,*) ' south : ', jk, ins, ji, jj
-               ENDIF
-               zaa = tmask(ji+1,jj,jk) + tmask(ji,jj,jk)
-               IF( ABS(zaa-2._wp) <= 0.1_wp .AND. fmask(ji,jj,jk) == 0._wp ) THEN
-                  inn = inn + 1
-                  nicoa(inn,4,jk) = ji
-                  njcoa(inn,4,jk) = jj
-                  IF( nprint == 1 ) WRITE(numout,*) ' north : ', jk, inn, ji, jj
-               ENDIF
-            END DO
-         END DO
-         npcoa(3,jk) = ins
-         npcoa(4,jk) = inn
-      END DO
-
-      itest = 2 * ( jpi + jpj )
-      DO jk = 1, jpk
-         IF( npcoa(1,jk) > itest .OR. npcoa(2,jk) > itest .OR.   &
-             npcoa(3,jk) > itest .OR. npcoa(4,jk) > itest ) THEN
-            
-            WRITE(ctmp1,*) ' level jk = ',jk
-            WRITE(ctmp2,*) ' straight coast index arraies are too small.:'
-            WRITE(ctmp3,*) ' npe, npw, nps, npn = ', npcoa(1,jk), npcoa(2,jk),   &
-                &                                     npcoa(3,jk), npcoa(4,jk)
-            WRITE(ctmp4,*) ' 2*(jpi+jpj) = ',itest,'. we stop.'
-            CALL ctl_stop( ctmp1, ctmp2, ctmp3, ctmp4 )
-        ENDIF
-      END DO
-
-      ierror = 0
-      iind = 0
-      ijnd = 0
-      IF( nperio == 1 .OR. nperio == 4 .OR. nperio == 6 )   iind = 2
-      IF( nperio == 3 .OR. nperio == 4 .OR. nperio == 5 .OR. nperio == 6 )   ijnd = 2
-      DO jk = 1, jpk
-         DO jl = 1, npcoa(1,jk)
-            IF( nicoa(jl,1,jk)+3 > jpi+iind ) THEN
-               ierror = ierror+1
-               icoord(ierror,1) = nicoa(jl,1,jk)
-               icoord(ierror,2) = njcoa(jl,1,jk)
-               icoord(ierror,3) = jk
-            ENDIF
-         END DO
-         DO jl = 1, npcoa(2,jk)
-            IF(nicoa(jl,2,jk)-2 < 1-iind ) THEN
-               ierror = ierror + 1
-               icoord(ierror,1) = nicoa(jl,2,jk)
-               icoord(ierror,2) = njcoa(jl,2,jk)
-               icoord(ierror,3) = jk
-            ENDIF
-         END DO
-         DO jl = 1, npcoa(3,jk)
-            IF( njcoa(jl,3,jk)+3 > jpj+ijnd ) THEN
-               ierror = ierror + 1
-               icoord(ierror,1) = nicoa(jl,3,jk)
-               icoord(ierror,2) = njcoa(jl,3,jk)
-               icoord(ierror,3) = jk
-            ENDIF
-         END DO
-         DO jl = 1, npcoa(4,jk)
-            IF( njcoa(jl,4,jk)-2 < 1) THEN
-               ierror=ierror + 1
-               icoord(ierror,1) = nicoa(jl,4,jk)
-               icoord(ierror,2) = njcoa(jl,4,jk)
-               icoord(ierror,3) = jk
-            ENDIF
-         END DO
-      END DO
-      
-      IF( ierror > 0 ) THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) '              Problem on lateral conditions'
-         IF(lwp) WRITE(numout,*) '                 Bad marking off at points:'
-         DO jl = 1, ierror
-            IF(lwp) WRITE(numout,*) 'Level:',icoord(jl,3),   &
-               &                  '  Point(',icoord(jl,1),',',icoord(jl,2),')'
-         END DO
-         CALL ctl_stop( 'We stop...' )
-      ENDIF
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('dom_msk_nsa')
-      !
-   END SUBROUTINE dom_msk_nsa
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option :                                      Empty routine
-   !!----------------------------------------------------------------------
-   SUBROUTINE dom_msk_nsa       
-   END SUBROUTINE dom_msk_nsa
-#endif
    
    !!======================================================================
