Index: /NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/src/OFF/nemogcm.F90
===================================================================
--- /NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/src/OFF/nemogcm.F90	(revision 11762)
+++ /NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/src/OFF/nemogcm.F90	(revision 11763)
@@ -341,5 +341,5 @@
 #endif
 
-                           CALL     trc_init                         ! Passive tracers initialization
+                           CALL     trc_init( Nbb, Nnn, Naa )        ! Passive tracers initialization
                            CALL dia_ptr_init   ! Poleward TRansports initialization
                            
Index: /NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/tests/WAD/EXPREF/makebdy_tc7.py
===================================================================
--- /NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/tests/WAD/EXPREF/makebdy_tc7.py	(revision 11762)
+++ /NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/tests/WAD/EXPREF/makebdy_tc7.py	(revision 11763)
@@ -4,5 +4,5 @@
 pathout = "bdyssh_tc7"
 
-nx = 34 
+nx = 23 
 ny = 1
 nt = 24
@@ -18,5 +18,5 @@
  ssh = np.zeros((nt,ny,nx))
  for nnt in range(nd*nt,(nd+1)*nt):
-   tx = 2.5*np.cos((3.141592654/6.0)*(nnt+1.0))
+   tx = 2.5*np.cos((3.141592654/6.0)*(nnt))
    print nnt, tx
    for nnx in range(nx):
Index: /NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/tests/WAD/EXPREF/namelist_cfg
===================================================================
--- /NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/tests/WAD/EXPREF/namelist_cfg	(revision 11762)
+++ /NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/tests/WAD/EXPREF/namelist_cfg	(revision 11763)
@@ -169,7 +169,7 @@
 !-----------------------------------------------------------------------
     ctypebdy = 'E'
-    nbdyind  = 50
+    nbdyind  = 33
     nbdybeg  = 1
-    nbdyend  = 34
+    nbdyend  = 23
     !ctypebdy = 'W'
     !nbdyind  = 2
Index: /NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/tests/WAD/MY_DOCS/Namelists/nam_wad_tc7
===================================================================
--- /NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/tests/WAD/MY_DOCS/Namelists/nam_wad_tc7	(revision 11762)
+++ /NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/tests/WAD/MY_DOCS/Namelists/nam_wad_tc7	(revision 11763)
@@ -15,7 +15,2 @@
     nb_bdy         = 1                    !  number of open boundary sets
 /
-!-----------------------------------------------------------------------
-&namwad  !   Wetting and drying
-!-----------------------------------------------------------------------
-   rn_wdmin1         =  0.150   ! Minimum wet depth on dried cells
-/
Index: /NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/tests/WAD/MY_SRC/bdyini.F90
===================================================================
--- /NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/tests/WAD/MY_SRC/bdyini.F90	(revision 11762)
+++ /NEMO/branches/2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps/tests/WAD/MY_SRC/bdyini.F90	(revision 11763)
@@ -133,5 +133,4 @@
       INTEGER  ::   i_offset, j_offset                     !   -       -
       INTEGER , POINTER  ::  nbi, nbj, nbr                 ! short cuts
-      REAL(wp), POINTER  ::  flagu, flagv                  !    -   -
       REAL(wp), POINTER, DIMENSION(:,:)       ::   pmask    ! pointer to 2D mask fields
       REAL(wp) ::   zefl, zwfl, znfl, zsfl                 ! local scalars
@@ -385,4 +384,13 @@
           END SELECT
           IF(lwp) WRITE(numout,*)
+          !
+          ! sanity check if used with tides        
+          IF( ln_tide ) THEN 
+             IF(lwp) WRITE(numout,*) ' The total volume correction is not working with tides. '
+             IF(lwp) WRITE(numout,*) ' Set ln_vol to .FALSE. '
+             IF(lwp) WRITE(numout,*) ' or '
+             IF(lwp) WRITE(numout,*) ' equilibriate your bdy input files '
+             CALL ctl_stop( 'The total volume correction is not working with tides.' )
+          END IF
         ELSE
           IF(lwp) WRITE(numout,*) 'No volume correction applied at open boundaries'
@@ -1203,10 +1211,8 @@
             END DO
             IF( icount /= 0 ) THEN
-               IF(lwp) WRITE(numout,*)
-               IF(lwp) WRITE(numout,*) ' E R R O R : Some ',cgrid(igrd),' grid points,',   &
+               WRITE(ctmp1,*) ' E R R O R : Some ',cgrid(igrd),' grid points,',   &
                   ' are not boundary points (flagu calculation). Check nbi, nbj, indices for boundary set ',ib_bdy
-               IF(lwp) WRITE(numout,*) ' ========== '
-               IF(lwp) WRITE(numout,*)
-               nstop = nstop + 1
+               WRITE(ctmp2,*) ' ========== '
+               CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
             ENDIF 
          END DO
@@ -1238,48 +1244,12 @@
             END DO
             IF( icount /= 0 ) THEN
-               IF(lwp) WRITE(numout,*)
-               IF(lwp) WRITE(numout,*) ' E R R O R : Some ',cgrid(igrd),' grid points,',   &
+               WRITE(ctmp1,*) ' E R R O R : Some ',cgrid(igrd),' grid points,',   &
                   ' are not boundary points (flagv calculation). Check nbi, nbj, indices for boundary set ',ib_bdy
-               IF(lwp) WRITE(numout,*) ' ========== '
-               IF(lwp) WRITE(numout,*)
-               nstop = nstop + 1
+               WRITE(ctmp2,*) ' ========== '
+               CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
             ENDIF 
          END DO
          !
       END DO
-
-      ! Compute total lateral surface for volume correction:
-      ! ----------------------------------------------------
-      ! JC: this must be done at each time step with non-linear free surface
-      bdysurftot = 0._wp 
-      IF( ln_vol ) THEN  
-         igrd = 2      ! Lateral surface at U-points
-         DO ib_bdy = 1, nb_bdy
-            DO ib = 1, idx_bdy(ib_bdy)%nblenrim(igrd)
-               nbi => idx_bdy(ib_bdy)%nbi(ib,igrd)
-               nbj => idx_bdy(ib_bdy)%nbj(ib,igrd)
-               flagu => idx_bdy(ib_bdy)%flagu(ib,igrd)
-               bdysurftot = bdysurftot + hu_n   (nbi  , nbj)                           &
-                  &                    * e2u    (nbi  , nbj) * ABS( flagu ) &
-                  &                    * tmask_i(nbi  , nbj)                           &
-                  &                    * tmask_i(nbi+1, nbj)                   
-            END DO
-         END DO
-
-         igrd=3 ! Add lateral surface at V-points
-         DO ib_bdy = 1, nb_bdy
-            DO ib = 1, idx_bdy(ib_bdy)%nblenrim(igrd)
-               nbi => idx_bdy(ib_bdy)%nbi(ib,igrd)
-               nbj => idx_bdy(ib_bdy)%nbj(ib,igrd)
-               flagv => idx_bdy(ib_bdy)%flagv(ib,igrd)
-               bdysurftot = bdysurftot + hv_n   (nbi, nbj  )                           &
-                  &                    * e1v    (nbi, nbj  ) * ABS( flagv ) &
-                  &                    * tmask_i(nbi, nbj  )                           &
-                  &                    * tmask_i(nbi, nbj+1)
-            END DO
-         END DO
-         !
-         CALL mpp_sum( 'bdyini', bdysurftot )      ! sum over the global domain
-      END IF   
       !
       ! Tidy up
@@ -1288,5 +1258,4 @@
       !
    END SUBROUTINE bdy_segs
-
 
    SUBROUTINE bdy_ctl_seg
@@ -1376,19 +1345,15 @@
                      icorns(ib2,1) = npckgw(ib1)
                   ELSEIF ((jpisft(ib2)==jpiwob(ib1)).AND.(jpjwft(ib1)==jpjsob(ib2))) THEN
-                     IF(lwp) WRITE(numout,*)
-                     IF(lwp) WRITE(numout,*) ' E R R O R : Found an acute open boundary corner at point (i,j)= ', &
-                     &                                     jpisft(ib2), jpjwft(ib1)
-                     IF(lwp) WRITE(numout,*) ' ==========  Not allowed yet'
-                     IF(lwp) WRITE(numout,*) '             Crossing problem with West segment: ',npckgw(ib1), & 
-                     &                                                    ' and South segment: ',npckgs(ib2)
-                     IF(lwp) WRITE(numout,*)
-                     nstop = nstop + 1
+                     WRITE(ctmp1,*) ' E R R O R : Found an acute open boundary corner at point (i,j)= ', &
+                        &                                     jpisft(ib2), jpjwft(ib1)
+                     WRITE(ctmp2,*) ' ==========  Not allowed yet'
+                     WRITE(ctmp3,*) '             Crossing problem with West segment: ',npckgw(ib1), & 
+                        &                                        ' and South segment: ',npckgs(ib2)
+                     CALL ctl_stop( ' ', ctmp1, ctmp2, ctmp3, ' ' )
                   ELSE
-                     IF(lwp) WRITE(numout,*)
-                     IF(lwp) WRITE(numout,*) ' E R R O R : Check South and West Open boundary indices'
-                     IF(lwp) WRITE(numout,*) ' ==========  Crossing problem with West segment: ',npckgw(ib1) , &
-                     &                                                    ' and South segment: ',npckgs(ib2)
-                     IF(lwp) WRITE(numout,*)
-                     nstop = nstop+1
+                     WRITE(ctmp1,*) ' E R R O R : Check South and West Open boundary indices'
+                     WRITE(ctmp2,*) ' ==========  Crossing problem with West segment: ',npckgw(ib1) , &
+                        &                                         ' and South segment: ',npckgs(ib2)
+                     CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
                   END IF
                END IF
@@ -1412,19 +1377,15 @@
                      icorns(ib2,2) = npckge(ib1)
                   ELSEIF ((jpjeft(ib1)==jpjsob(ib2)).AND.(jpisdt(ib2)==jpieob(ib1)+1)) THEN
-                     IF(lwp) WRITE(numout,*)
-                     IF(lwp) WRITE(numout,*) ' E R R O R : Found an acute open boundary corner at point (i,j)= ', &
-                     &                                     jpisdt(ib2), jpjeft(ib1)
-                     IF(lwp) WRITE(numout,*) ' ==========  Not allowed yet'
-                     IF(lwp) WRITE(numout,*) '             Crossing problem with East segment: ',npckge(ib1), &
-                     &                                                    ' and South segment: ',npckgs(ib2)
-                     IF(lwp) WRITE(numout,*)
-                     nstop = nstop + 1
+                     WRITE(ctmp1,*) ' E R R O R : Found an acute open boundary corner at point (i,j)= ', &
+                        &                                     jpisdt(ib2), jpjeft(ib1)
+                     WRITE(ctmp2,*) ' ==========  Not allowed yet'
+                     WRITE(ctmp3,*) '             Crossing problem with East segment: ',npckge(ib1), &
+                        &                                        ' and South segment: ',npckgs(ib2)
+                     CALL ctl_stop( ' ', ctmp1, ctmp2, ctmp3, ' ' )
                   ELSE
-                     IF(lwp) WRITE(numout,*)
-                     IF(lwp) WRITE(numout,*) ' E R R O R : Check South and East Open boundary indices'
-                     IF(lwp) WRITE(numout,*) ' ==========  Crossing problem with East segment: ',npckge(ib1), &
-                     &                                                    ' and South segment: ',npckgs(ib2)
-                     IF(lwp) WRITE(numout,*)
-                     nstop = nstop + 1
+                     WRITE(ctmp1,*) ' E R R O R : Check South and East Open boundary indices'
+                     WRITE(ctmp2,*) ' ==========  Crossing problem with East segment: ',npckge(ib1), &
+                     &                                           ' and South segment: ',npckgs(ib2)
+                     CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
                   END IF
                END IF
@@ -1448,19 +1409,15 @@
                      icornn(ib2,1) = npckgw(ib1)
                   ELSEIF ((jpjwdt(ib1)==jpjnob(ib2)+1).AND.(jpinft(ib2)==jpiwob(ib1))) THEN
-                     IF(lwp) WRITE(numout,*)
-                     IF(lwp) WRITE(numout,*) ' E R R O R : Found an acute open boundary corner at point (i,j)= ', &
+                     WRITE(ctmp1,*) ' E R R O R : Found an acute open boundary corner at point (i,j)= ', &
                      &                                     jpinft(ib2), jpjwdt(ib1)
-                     IF(lwp) WRITE(numout,*) ' ==========  Not allowed yet'
-                     IF(lwp) WRITE(numout,*) '             Crossing problem with West segment: ',npckgw(ib1), &
+                     WRITE(ctmp2,*) ' ==========  Not allowed yet'
+                     WRITE(ctmp3,*) '             Crossing problem with West segment: ',npckgw(ib1), &
                      &                                                    ' and North segment: ',npckgn(ib2)
-                     IF(lwp) WRITE(numout,*)
-                     nstop = nstop + 1
+                     CALL ctl_stop( ' ', ctmp1, ctmp2, ctmp3, ' ' )
                   ELSE
-                     IF(lwp) WRITE(numout,*)
-                     IF(lwp) WRITE(numout,*) ' E R R O R : Check North and West Open boundary indices'
-                     IF(lwp) WRITE(numout,*) ' ==========  Crossing problem with West segment: ',npckgw(ib1), &
+                     WRITE(ctmp1,*) ' E R R O R : Check North and West Open boundary indices'
+                     WRITE(ctmp2,*) ' ==========  Crossing problem with West segment: ',npckgw(ib1), &
                      &                                                    ' and North segment: ',npckgn(ib2)
-                     IF(lwp) WRITE(numout,*)
-                     nstop = nstop + 1
+                     CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
                   END IF
                END IF
@@ -1484,19 +1441,15 @@
                      icornn(ib2,2) = npckge(ib1)
                   ELSEIF ((jpjedt(ib1)==jpjnob(ib2)+1).AND.(jpindt(ib2)==jpieob(ib1)+1)) THEN
-                     IF(lwp) WRITE(numout,*)
-                     IF(lwp) WRITE(numout,*) ' E R R O R : Found an acute open boundary corner at point (i,j)= ', &
+                     WRITE(ctmp1,*) ' E R R O R : Found an acute open boundary corner at point (i,j)= ', &
                      &                                     jpindt(ib2), jpjedt(ib1)
-                     IF(lwp) WRITE(numout,*) ' ==========  Not allowed yet'
-                     IF(lwp) WRITE(numout,*) '             Crossing problem with East segment: ',npckge(ib1), &
-                     &                                                    ' and North segment: ',npckgn(ib2)
-                     IF(lwp) WRITE(numout,*)
-                     nstop = nstop + 1
+                     WRITE(ctmp2,*) ' ==========  Not allowed yet'
+                     WRITE(ctmp3,*) '             Crossing problem with East segment: ',npckge(ib1), &
+                     &                                           ' and North segment: ',npckgn(ib2)
+                     CALL ctl_stop( ' ', ctmp1, ctmp2, ctmp3, ' ' )
                   ELSE
-                     IF(lwp) WRITE(numout,*)
-                     IF(lwp) WRITE(numout,*) ' E R R O R : Check North and East Open boundary indices'
-                     IF(lwp) WRITE(numout,*) ' ==========  Crossing problem with East segment: ',npckge(ib1), &
-                     &                                                    ' and North segment: ',npckgn(ib2)
-                     IF(lwp) WRITE(numout,*)
-                     nstop = nstop + 1
+                     WRITE(ctmp1,*) ' E R R O R : Check North and East Open boundary indices'
+                     WRITE(ctmp2,*) ' ==========  Crossing problem with East segment: ',npckge(ib1), &
+                     &                                           ' and North segment: ',npckgn(ib2)
+                     CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
                   END IF
                END IF
@@ -1524,9 +1477,7 @@
          IF (ztestmask(1)==1) THEN 
             IF (icornw(ib,1)==0) THEN
-               IF(lwp) WRITE(numout,*)
-               IF(lwp) WRITE(numout,*) ' E R R O R : Open boundary segment ', npckgw(ib)
-               IF(lwp) WRITE(numout,*) ' ==========  does not start on land or on a corner'                                                  
-               IF(lwp) WRITE(numout,*)
-               nstop = nstop + 1
+               WRITE(ctmp1,*) ' E R R O R : Open boundary segment ', npckgw(ib)
+               WRITE(ctmp2,*) ' ==========  does not start on land or on a corner'                                                  
+               CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
             ELSE
                ! This is a corner
@@ -1538,9 +1489,7 @@
          IF (ztestmask(2)==1) THEN
             IF (icornw(ib,2)==0) THEN
-               IF(lwp) WRITE(numout,*)
-               IF(lwp) WRITE(numout,*) ' E R R O R : Open boundary segment ', npckgw(ib)
-               IF(lwp) WRITE(numout,*) ' ==========  does not end on land or on a corner'                                                  
-               IF(lwp) WRITE(numout,*)
-               nstop = nstop + 1
+               WRITE(ctmp1,*) ' E R R O R : Open boundary segment ', npckgw(ib)
+               WRITE(ctmp2,*) ' ==========  does not end on land or on a corner'                                                  
+               CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
             ELSE
                ! This is a corner
@@ -1568,9 +1517,7 @@
          IF (ztestmask(1)==1) THEN
             IF (icorne(ib,1)==0) THEN
-               IF(lwp) WRITE(numout,*)
-               IF(lwp) WRITE(numout,*) ' E R R O R : Open boundary segment ', npckge(ib)
-               IF(lwp) WRITE(numout,*) ' ==========  does not start on land or on a corner'                                                  
-               IF(lwp) WRITE(numout,*)
-               nstop = nstop + 1 
+               WRITE(ctmp1,*) ' E R R O R : Open boundary segment ', npckge(ib)
+               WRITE(ctmp2,*) ' ==========  does not start on land or on a corner'                                                  
+               CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
             ELSE
                ! This is a corner
@@ -1582,9 +1529,7 @@
          IF (ztestmask(2)==1) THEN
             IF (icorne(ib,2)==0) THEN
-               IF(lwp) WRITE(numout,*)
-               IF(lwp) WRITE(numout,*) ' E R R O R : Open boundary segment ', npckge(ib)
-               IF(lwp) WRITE(numout,*) ' ==========  does not end on land or on a corner'                                                  
-               IF(lwp) WRITE(numout,*)
-               nstop = nstop + 1
+               WRITE(ctmp1,*) ' E R R O R : Open boundary segment ', npckge(ib)
+               WRITE(ctmp2,*) ' ==========  does not end on land or on a corner'                                                  
+               CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
             ELSE
                ! This is a corner
@@ -1611,16 +1556,12 @@
 
          IF ((ztestmask(1)==1).AND.(icorns(ib,1)==0)) THEN
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) ' E R R O R : Open boundary segment ', npckgs(ib)
-            IF(lwp) WRITE(numout,*) ' ==========  does not start on land or on a corner'                                                  
-            IF(lwp) WRITE(numout,*)
-            nstop = nstop + 1
+            WRITE(ctmp1,*) ' E R R O R : Open boundary segment ', npckgs(ib)
+            WRITE(ctmp2,*) ' ==========  does not start on land or on a corner'                                                  
+            CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
          ENDIF
          IF ((ztestmask(2)==1).AND.(icorns(ib,2)==0)) THEN
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) ' E R R O R : Open boundary segment ', npckgs(ib)
-            IF(lwp) WRITE(numout,*) ' ==========  does not end on land or on a corner'                                                  
-            IF(lwp) WRITE(numout,*)
-            nstop = nstop + 1
+            WRITE(ctmp1,*) ' E R R O R : Open boundary segment ', npckgs(ib)
+            WRITE(ctmp2,*) ' ==========  does not end on land or on a corner'                                                  
+            CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
          ENDIF
       END DO
@@ -1641,16 +1582,12 @@
 
          IF ((ztestmask(1)==1).AND.(icornn(ib,1)==0)) THEN
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) ' E R R O R : Open boundary segment ', npckgn(ib)
-            IF(lwp) WRITE(numout,*) ' ==========  does not start on land'                                                  
-            IF(lwp) WRITE(numout,*)
-            nstop = nstop + 1
+            WRITE(ctmp1,*) ' E R R O R : Open boundary segment ', npckgn(ib)
+            WRITE(ctmp2,*) ' ==========  does not start on land'                                                  
+            CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
          ENDIF
          IF ((ztestmask(2)==1).AND.(icornn(ib,2)==0)) THEN
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) ' E R R O R : Open boundary segment ', npckgn(ib)
-            IF(lwp) WRITE(numout,*) ' ==========  does not end on land'                                                  
-            IF(lwp) WRITE(numout,*)
-            nstop = nstop + 1
+            WRITE(ctmp1,*) ' E R R O R : Open boundary segment ', npckgn(ib)
+            WRITE(ctmp2,*) ' ==========  does not end on land'                                                  
+            CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
          ENDIF
       END DO
@@ -1691,8 +1628,7 @@
       !
       IF( itest>0 ) THEN
-         IF(lwp) WRITE(numout,*) ' E R R O R : Segments ', ib1, 'and ', ib2
-         IF(lwp) WRITE(numout,*) ' ==========  have different open bdy schemes'                                                  
-         IF(lwp) WRITE(numout,*)
-         nstop = nstop + 1
+         WRITE(ctmp1,*) ' E R R O R : Segments ', ib1, 'and ', ib2
+         WRITE(ctmp2,*) ' ==========  have different open bdy schemes'                                                  
+         CALL ctl_stop( ' ', ctmp1, ctmp2, ' ' )
       ENDIF
       !
