Index: /trunk/NEMOGCM/NEMO/OFF_SRC/dommsk.F90
===================================================================
--- /trunk/NEMOGCM/NEMO/OFF_SRC/dommsk.F90	(revision 5130)
+++ /trunk/NEMOGCM/NEMO/OFF_SRC/dommsk.F90	(revision 5131)
@@ -15,4 +15,5 @@
    USE in_out_manager  ! I/O manager
    USE wrk_nemo  
+   USE lbclnk  
 
    IMPLICIT NONE
@@ -48,5 +49,5 @@
       !!----------------------------------------------------------------------
       !
-      INTEGER  ::   ji, jk                   ! dummy loop indices
+      INTEGER  ::   ji, jj, jk                   ! dummy loop indices
       INTEGER  ::   iif, iil, ijf, ijl       ! local integers
       INTEGER, POINTER, DIMENSION(:,:) ::  imsk 
@@ -83,4 +84,31 @@
       ENDIF 
       !
+      ! (ISF) MIN(1,SUM(umask)) is here to check if you have effectively at
+      ! least 1 wet u point
+      DO jj = 1, jpjm1
+         DO ji = 1, fs_jpim1   ! vector loop
+            umask_i(ji,jj)  = ssmask(ji,jj) * ssmask(ji+1,jj  )  * MIN(1._wp,SUM(umask(ji,jj,:)))
+            vmask_i(ji,jj)  = ssmask(ji,jj) * ssmask(ji  ,jj+1)  * MIN(1._wp,SUM(vmask(ji,jj,:)))
+         END DO
+         DO ji = 1, jpim1      ! NO vector opt.
+            fmask_i(ji,jj) =  ssmask(ji,jj  ) * ssmask(ji+1,jj  )   &
+               &            * ssmask(ji,jj+1) * ssmask(ji+1,jj+1) * MIN(1._wp,SUM(fmask(ji,jj,:)))
+         END DO
+      END DO
+      CALL lbc_lnk( umask_i, 'U', 1._wp )      ! Lateral boundary conditions
+      CALL lbc_lnk( vmask_i, 'V', 1._wp )
+      CALL lbc_lnk( fmask_i, 'F', 1._wp )
+
+      ! 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)
+      END DO
+      !
       IF( nprint == 1 .AND. lwp ) THEN    ! Control print
          imsk(:,:) = INT( tmask_i(:,:) )
Index: /trunk/NEMOGCM/NEMO/OFF_SRC/dtadyn.F90
===================================================================
--- /trunk/NEMOGCM/NEMO/OFF_SRC/dtadyn.F90	(revision 5130)
+++ /trunk/NEMOGCM/NEMO/OFF_SRC/dtadyn.F90	(revision 5131)
@@ -245,5 +245,10 @@
       tsn(:,:,:,jp_sal) = sf_dyn(jf_sal)%fnow(:,:,:)  * tmask(:,:,:)    ! salinity
       !
-      CALL eos    ( tsn, rhd, rhop, gdept_0(:,:,:) )                                       ! In any case, we need rhop
+      !
+      CALL eos    ( tsn, rhd, rhop, gdept_0(:,:,:) ) ! In any case, we need rhop
+      CALL eos_rab( tsn, rab_n )       ! now    local thermal/haline expension ratio at T-points
+      CALL bn2    ( tsn, rab_n, rn2 ) ! before Brunt-Vaisala frequency need for zdfmxl
+
+      rn2b(:,:,:) = rn2(:,:,:)         ! need for zdfmxl
       CALL zdf_mxl( kt )                                                   ! In any case, we need mxl 
       !
@@ -535,8 +540,9 @@
       !!---------------------------------------------------------------------
 #if defined key_ldfslp && ! defined key_c1d
+      CALL eos    ( pts, rhd, rhop, gdept_0(:,:,:) )
       CALL eos_rab( pts, rab_n )       ! now local thermal/haline expension ratio at T-points
       CALL bn2    ( pts, rab_n, rn2  ) ! now    Brunt-Vaisala
-        ! Partial steps: before Horizontal DErivative
-        ! only gtsu, gtsv, rhd, gru , grv are used 
+
+      ! Partial steps: before Horizontal DErivative
       IF( ln_zps  .AND. .NOT. ln_isfcav)                            &
          &            CALL zps_hde    ( kt, jpts, pts, gtsu, gtsv,  &  ! Partial steps: before horizontal gradient
@@ -547,7 +553,5 @@
          &                                 gtui, gtvi, grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi    ) ! of t, s, rd at the first ocean level
 
-
-
-         !                                                            ! of t, s, rd at the bottom ocean level
+      rn2b(:,:,:) = rn2(:,:,:)         ! need for zdfmxl
       CALL zdf_mxl( kt )            ! mixed layer depth
       CALL ldf_slp( kt, rhd, rn2 )  ! slopes
