Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DYN/dynbfr.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DYN/dynbfr.F90	(revision 9255)
+++ 	(revision )
@@ -1,111 +1,0 @@
-MODULE dynbfr
-   !!==============================================================================
-   !!                 ***  MODULE  dynbfr  ***
-   !! Ocean dynamics :  bottom friction component of the momentum mixing trend
-   !!==============================================================================
-   !! History :  3.2  ! 2008-11  (A. C. Coward)  Original code
-   !!            3.4  ! 2011-09  (H. Liu) Make it consistent with semi-implicit Bottom friction (ln_drgimp =T) 
-   !!            4.0  ! 2017-05  (G. Madec)  drag coef. defined at t-point (zdfdrg.F90)
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   dyn_bfr       : Update the momentum trend with the bottom friction contribution
-   !!----------------------------------------------------------------------
-   USE oce            ! ocean dynamics and tracers variables
-   USE dom_oce        ! ocean space and time domain variables 
-   USE zdf_oce        ! vertical physics: variables
-   USE zdfdrg         ! vertical physics: top/bottom drag coef.
-   USE trd_oce        ! trends: ocean variables
-   USE trddyn         ! trend manager: dynamics
-   !
-   USE in_out_manager ! I/O manager
-   USE prtctl         ! Print control
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   dyn_bfr   !  routine called by step.F90
-
-   !! * Substitutions
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 4.0 , NEMO Consortium (2017)
-   !! $Id$
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-   
-   SUBROUTINE dyn_bfr( kt )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE dyn_bfr  ***
-      !!
-      !! ** Purpose :   compute the bottom friction ocean dynamics physics.
-      !!
-      !!              only for explicit bottom friction form
-      !!              implicit bfr is implemented in dynzdf_imp
-      !!
-      !! ** Action  :   (ua,va)   momentum trend increased by bottom friction trend
-      !!---------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
-      !! 
-      INTEGER  ::   ji, jj       ! dummy loop indexes
-      INTEGER  ::   ikbu, ikbv   ! local integers
-      REAL(wp) ::   zm1_2dt      ! local scalar
-      REAL(wp) ::   zCdu, zCdv   !   -      -
-      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrdu, ztrdv
-      !!---------------------------------------------------------------------
-      !
-!!gm bug : time step is only rdt (not 2 rdt if euler start !)
-         zm1_2dt = - 1._wp / ( 2._wp * rdt )
-
-      IF( l_trddyn ) THEN      ! trends: store the input trends
-         ALLOCATE( ztrdu(jpi,jpj,jpk) , ztrdv(jpi,jpj,jpk) )
-         ztrdu(:,:,:) = ua(:,:,:)
-         ztrdv(:,:,:) = va(:,:,:)
-      ENDIF
-
-
-      DO jj = 2, jpjm1
-         DO ji = 2, jpim1
-            ikbu = mbku(ji,jj)          ! deepest wet ocean u- & v-levels
-            ikbv = mbkv(ji,jj)
-            !
-            ! Apply stability criteria on absolute value  : abs(bfr/e3) < 1/(2dt) => bfr/e3 > -1/(2dt)
-            zCdu = 0.5*( rCdU_bot(ji+1,jj)+rCdU_bot(ji,jj) ) / e3u_n(ji,jj,ikbu)
-            zCdv = 0.5*( rCdU_bot(ji,jj+1)+rCdU_bot(ji,jj) ) / e3v_n(ji,jj,ikbv)
-            !
-            ua(ji,jj,ikbu) = ua(ji,jj,ikbu) + MAX(  zCdu , zm1_2dt  ) * ub(ji,jj,ikbu)
-            va(ji,jj,ikbv) = va(ji,jj,ikbv) + MAX(  zCdv , zm1_2dt  ) * vb(ji,jj,ikbv)
-         END DO
-      END DO
-      !
-      IF( ln_isfcav ) THEN        ! ocean cavities
-         DO jj = 2, jpjm1
-            DO ji = 2, jpim1
-               ikbu = miku(ji,jj)          ! first wet ocean u- & v-levels
-               ikbv = mikv(ji,jj)
-               !
-               ! Apply stability criteria on absolute value  : abs(bfr/e3) < 1/(2dt) => bfr/e3 > -1/(2dt)
-               zCdu = 0.5*( rCdU_top(ji+1,jj)+rCdU_top(ji,jj) ) / e3u_n(ji,jj,ikbu)    ! NB: Cdtop masked
-               zCdv = 0.5*( rCdU_top(ji,jj+1)+rCdU_top(ji,jj) ) / e3v_n(ji,jj,ikbv)
-               !
-               ua(ji,jj,ikbu) = ua(ji,jj,ikbu) + MAX(  zCdu , zm1_2dt  ) * ub(ji,jj,ikbu)
-               va(ji,jj,ikbv) = va(ji,jj,ikbv) + MAX(  zCdv , zm1_2dt  ) * vb(ji,jj,ikbv)
-           END DO
-         END DO
-      ENDIF
-      !
-      IF( l_trddyn ) THEN      ! trends: send trends to trddyn for further diagnostics
-         ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:)
-         ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:)
-         CALL trd_dyn( ztrdu(:,:,:), ztrdv(:,:,:), jpdyn_bfr, kt )
-         DEALLOCATE( ztrdu, ztrdv )
-      ENDIF
-      !                                          ! print mean trends (used for debugging)
-      IF(ln_ctl)   CALL prt_ctl( tab3d_1=ua, clinfo1=' bfr  - Ua: ', mask1=umask,               &
-         &                       tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
-      !
-   END SUBROUTINE dyn_bfr
-
-   !!==============================================================================
-END MODULE dynbfr
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRD/trddyn.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRD/trddyn.F90	(revision 9255)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRD/trddyn.F90	(revision 9256)
@@ -18,5 +18,5 @@
    USE sbc_oce        ! surface boundary condition: ocean
    USE zdf_oce        ! ocean vertical physics: variables
-   USE zdfdrg         ! ocean vertical physics: bottom friction
+!!gm   USE zdfdrg         ! ocean vertical physics: bottom friction
    USE trd_oce        ! trends: ocean variables
    USE trdken         ! trends: Kinetic ENergy 
@@ -147,25 +147,28 @@
                               CALL iom_put( "vtrd_tau", z2dy )
                               DEALLOCATE( z2dx , z2dy )
-                              !                                    ! bottom stress tends (implicit case)
-                              IF( ln_drgimp ) THEN
-                                 ALLOCATE( z3dx(jpi,jpj,jpk) , z3dy(jpi,jpj,jpk) )
-                             z3dx(:,:,:) = 0._wp   ;   z3dy(:,:,:) = 0._wp  ! after velocity known (now filed at this stage)
-                            DO jk = 1, jpkm1
-                                    DO jj = 2, jpjm1
-                                       DO ji = 2, jpim1
-                                      ikbu = mbku(ji,jj)          ! deepest ocean u- & v-levels
-                                          ikbv = mbkv(ji,jj)
-                                          z3dx(ji,jj,jk) = 0.5 * ( rCdU_bot(ji+1,jj) + rCdU_bot(ji,jj) ) & 
-                                               &         * un(ji,jj,ikbu) / e3u_n(ji,jj,ikbu)
-                                          z3dy(ji,jj,jk) = 0.5 * ( rCdU_bot(ji,jj+1) + rCdU_bot(ji,jj) ) &
-                                               &         * vn(ji,jj,ikbv) / e3v_n(ji,jj,ikbv)
-                                    END DO
-                                 END DO
-                              END DO
-                              CALL lbc_lnk_multi( z3dx, 'U', -1., z3dy, 'V', -1. )
-                              CALL iom_put( "utrd_bfr", z3dx )
-                              CALL iom_put( "vtrd_bfr", z3dy )
-                                 DEALLOCATE( z3dx , z3dy )
-                              ENDIF
+!!gm  to be changed : computation should be done in dynzdf.F90
+!!gm                + missing the top friction 
+!                              !                                    ! bottom stress tends (implicit case)
+!                              IF( ln_drgimp ) THEN
+!                                 ALLOCATE( z3dx(jpi,jpj,jpk) , z3dy(jpi,jpj,jpk) )
+!                             z3dx(:,:,:) = 0._wp   ;   z3dy(:,:,:) = 0._wp  ! after velocity known (now filed at this stage)
+!                            DO jk = 1, jpkm1
+!                                    DO jj = 2, jpjm1
+!                                       DO ji = 2, jpim1
+!                                      ikbu = mbku(ji,jj)          ! deepest ocean u- & v-levels
+!                                          ikbv = mbkv(ji,jj)
+!                                          z3dx(ji,jj,jk) = 0.5 * ( rCdU_bot(ji+1,jj) + rCdU_bot(ji,jj) ) & 
+!                                               &         * un(ji,jj,ikbu) / e3u_n(ji,jj,ikbu)
+!                                          z3dy(ji,jj,jk) = 0.5 * ( rCdU_bot(ji,jj+1) + rCdU_bot(ji,jj) ) &
+!                                               &         * vn(ji,jj,ikbv) / e3v_n(ji,jj,ikbv)
+!                                    END DO
+!                                 END DO
+!                              END DO
+!                              CALL lbc_lnk_multi( z3dx, 'U', -1., z3dy, 'V', -1. )
+!                              CALL iom_put( "utrd_bfr", z3dx )
+!                              CALL iom_put( "vtrd_bfr", z3dy )
+!                                 DEALLOCATE( z3dx , z3dy )
+!                              ENDIF
+!!gm end
       CASE( jpdyn_bfr )       ! called if ln_drgimp=F
                               CALL iom_put( "utrd_bfr", putrd )    ! bottom friction (explicit case)
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRD/trdglo.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRD/trdglo.F90	(revision 9255)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRD/trdglo.F90	(revision 9256)
@@ -22,5 +22,5 @@
    USE ldfdyn         ! ocean dynamics: lateral physics
    USE zdf_oce        ! ocean vertical physics
-   USE zdfdrg         ! ocean vertical physics: bottom friction
+!!gm   USE zdfdrg         ! ocean vertical physics: bottom friction
    USE zdfddm         ! ocean vertical physics: double diffusion
    USE eosbn2         ! equation of state
@@ -146,29 +146,33 @@
             ENDIF
             !                       
-            IF( ktrd == jpdyn_atf ) THEN     ! last trend (asselin time filter)
-               !
-               IF( ln_drgimp ) THEN                   ! implicit drag case: compute separately the bottom friction 
-                  z1_2rau0 = 0.5_wp / rau0
-                  DO jj = 1, jpjm1
-                     DO ji = 1, jpim1
-                        ikbu = mbku(ji,jj)                  ! deepest ocean u- & v-levels
-                        ikbv = mbkv(ji,jj)
-                        zvt = 0.5*( rCdU_bot(ji+1,jj)+rCdU_bot(ji,jj) ) * un(ji,jj,ikbu) * e1e2u(ji,jj)
-                        zvs = 0.5*( rCdU_bot(ji,jj+1)+rCdU_bot(ji,jj) ) * vn(ji,jj,ikbv) * e1e2v(ji,jj)
-                        umo(jpdyn_bfri) = umo(jpdyn_bfri) + zvt
-                        vmo(jpdyn_bfri) = vmo(jpdyn_bfri) + zvs
-                        hke(jpdyn_bfri) = hke(jpdyn_bfri) + un(ji,jj,ikbu) * zvt + vn(ji,jj,ikbv) * zvs
-                     END DO
-                  END DO
-               ENDIF
+!!gm  miss placed calculation   ===>>>> to be done in dynzdf.F90
+!            IF( ktrd == jpdyn_atf ) THEN     ! last trend (asselin time filter)
+!               !
+!               IF( ln_drgimp ) THEN                   ! implicit drag case: compute separately the bottom friction 
+!                  z1_2rau0 = 0.5_wp / rau0
+!                  DO jj = 1, jpjm1
+!                     DO ji = 1, jpim1
+!                        ikbu = mbku(ji,jj)                  ! deepest ocean u- & v-levels
+!                        ikbv = mbkv(ji,jj)
+!                        zvt = 0.5*( rCdU_bot(ji+1,jj)+rCdU_bot(ji,jj) ) * un(ji,jj,ikbu) * e1e2u(ji,jj)
+!                        zvs = 0.5*( rCdU_bot(ji,jj+1)+rCdU_bot(ji,jj) ) * vn(ji,jj,ikbv) * e1e2v(ji,jj)
+!                        umo(jpdyn_bfri) = umo(jpdyn_bfri) + zvt
+!                        vmo(jpdyn_bfri) = vmo(jpdyn_bfri) + zvs
+!                        hke(jpdyn_bfri) = hke(jpdyn_bfri) + un(ji,jj,ikbu) * zvt + vn(ji,jj,ikbv) * zvs
+!                     END DO
+!                  END DO
+!               ENDIF
+!
 !!gm top drag case is missing 
-               ! 
-               CALL glo_dyn_wri( kt )                 ! print the results in ocean.output
-               !                
-               umo(:) = 0._wp                         ! reset for the next time step
-               vmo(:) = 0._wp
-               hke(:) = 0._wp
-               !
-            ENDIF
+!
+!               ! 
+!               CALL glo_dyn_wri( kt )                 ! print the results in ocean.output
+!               !                
+!               umo(:) = 0._wp                         ! reset for the next time step
+!               vmo(:) = 0._wp
+!               hke(:) = 0._wp
+!               !
+!            ENDIF
+!!gm end
             !
          END SELECT
@@ -277,5 +281,5 @@
             &      + vmo(jpdyn_bfr) + vmo(jpdyn_atf) ) / tvolv
             WRITE (numout,9513) umo(jpdyn_tau) / tvolu, vmo(jpdyn_tau) / tvolv
-            IF( ln_drgimp )   WRITE (numout,9514) umo(jpdyn_bfri) / tvolu, vmo(jpdyn_bfri) / tvolv
+!!gm            IF( ln_drgimp )   WRITE (numout,9514) umo(jpdyn_bfri) / tvolu, vmo(jpdyn_bfri) / tvolv
          ENDIF
 
@@ -316,5 +320,5 @@
             &      + hke(jpdyn_bfr) + hke(jpdyn_atf) ) / tvolt
             WRITE (numout,9533) hke(jpdyn_tau) / tvolt
-            IF( ln_drgimp )   WRITE (numout,9534) hke(jpdyn_bfri) / tvolt
+!!gm            IF( ln_drgimp )   WRITE (numout,9534) hke(jpdyn_bfri) / tvolt
          ENDIF
 
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRD/trdken.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRD/trdken.F90	(revision 9255)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRD/trdken.F90	(revision 9256)
@@ -16,5 +16,5 @@
    USE sbc_oce        ! surface boundary condition: ocean
    USE zdf_oce        ! ocean vertical physics variables
-   USE zdfdrg         ! ocean vertical physics: bottom friction
+!!gm   USE zdfdrg         ! ocean vertical physics: bottom friction
    USE ldftra         ! ocean active tracers lateral physics
    USE trd_oce        ! trends: ocean variables
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRD/trdmxl.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRD/trdmxl.F90	(revision 9255)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/TRD/trdmxl.F90	(revision 9256)
@@ -773,5 +773,5 @@
          WRITE(numout,*) '                N.B. the nitend parameter is also constrained to be a     '
          WRITE(numout,*) '                     multiple of the nn_fsbc parameter '
-         nstop = nstop + 1
+         CALL ctl_stop( 'trd_mxl_init: see comment just above' )
       END IF
 
Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfdrg.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfdrg.F90	(revision 9255)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfdrg.F90	(revision 9256)
@@ -54,5 +54,5 @@
    REAL(wp)         ::   rn_ke0       !: background kinetic energy (non-linear case)                [m2/s2]
    LOGICAL          ::   ln_boost     !: =T regional boost of Cd0 ; =F Cd0 horizontally uniform
-   REAL(wp)         ::     rn_boost      !: local boost factor                                       [ - ]
+   REAL(wp)         ::   rn_boost     !: local boost factor                                         [ - ]
 
    REAL(wp), PUBLIC ::   r_Cdmin_top, r_Cdmax_top, r_z0_top, r_ke0_top   ! set from namdrg_top namelist values
