Index: trunk/NEMOGCM/NEMO/OPA_SRC/TRA/trabbl.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/TRA/trabbl.F90	(revision 3294)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/TRA/trabbl.F90	(revision 3598)
@@ -8,6 +8,6 @@
    !!   NEMO     1.0  ! 2002-08  (G. Madec)  free form + modules
    !!             -   ! 2004-01  (A. de Miranda, G. Madec, J.M. Molines ) add advective bbl
-   !!            3.3  ! 2009-11  (G. Madec)  merge trabbl and trabbl_adv + style + optimization 
-   !!             -   ! 2010-04  (G. Madec)  Campin & Goosse advective bbl 
+   !!            3.3  ! 2009-11  (G. Madec)  merge trabbl and trabbl_adv + style + optimization
+   !!             -   ! 2010-04  (G. Madec)  Campin & Goosse advective bbl
    !!             -   ! 2010-06  (C. Ethe, G. Madec)  merge TRA-TRC
    !!             -   ! 2010-11  (G. Madec) add mbk. arrays associated to the deepest ocean level
@@ -30,5 +30,5 @@
    USE trdmod_oce     ! trends: ocean variables
    USE trdtra         ! trends: active tracers
-   USE iom            ! IOM server               
+   USE iom            ! IOM server
    USE in_out_manager ! I/O manager
    USE lbclnk         ! ocean lateral boundary conditions
@@ -49,5 +49,5 @@
    LOGICAL, PUBLIC, PARAMETER ::   lk_trabbl = .TRUE.    !: bottom boundary layer flag
 
-   !                                           !!* Namelist nambbl * 
+   !                                           !!* Namelist nambbl *
    INTEGER , PUBLIC ::   nn_bbl_ldf = 0         !: =1   : diffusive bbl or not (=0)
    INTEGER , PUBLIC ::   nn_bbl_adv = 0         !: =1/2 : advective bbl or not (=0)
@@ -58,13 +58,13 @@
 
    LOGICAL , PUBLIC ::   l_bbl                  !: flag to compute bbl diffu. flux coef and transport
-   
+
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:), PUBLIC ::   utr_bbl  , vtr_bbl   ! u- (v-) transport in the bottom boundary layer
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:), PUBLIC ::   ahu_bbl  , ahv_bbl   ! masked diffusive bbl coeff. at u & v-pts
 
-   INTEGER , ALLOCATABLE, SAVE, DIMENSION(:,:) ::   mbku_d   , mbkv_d      ! vertical index of the "lower" bottom ocean U/V-level
-   INTEGER , ALLOCATABLE, SAVE, DIMENSION(:,:) ::   mgrhu    , mgrhv       ! = +/-1, sign of grad(H) in u-(v-)direction
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ahu_bbl_0, ahv_bbl_0   ! diffusive bbl flux coefficients at u and v-points
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   e3u_bbl_0, e3v_bbl_0   ! thichness of the bbl (e3) at u and v-points
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   r1_e1e2t               ! inverse of the cell surface at t-point      [1/m2]
+   INTEGER , ALLOCATABLE, SAVE, DIMENSION(:,:), PUBLIC ::   mbku_d   , mbkv_d      ! vertical index of the "lower" bottom ocean U/V-level (PUBLIC for TAM)
+   INTEGER , ALLOCATABLE, SAVE, DIMENSION(:,:), PUBLIC ::   mgrhu    , mgrhv       ! = +/-1, sign of grad(H) in u-(v-)direction (PUBLIC for TAM)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)         ::   ahu_bbl_0, ahv_bbl_0   ! diffusive bbl flux coefficients at u and v-points
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:), PUBLIC ::   e3u_bbl_0, e3v_bbl_0   ! thichness of the bbl (e3) at u and v-points (PUBLIC for TAM)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:), PUBLIC ::   r1_e1e2t               ! inverse of the cell surface at t-point      [1/m2] (PUBLIC for TAM)
 
    !! * Substitutions
@@ -95,6 +95,6 @@
       !!----------------------------------------------------------------------
       !!                  ***  ROUTINE bbl  ***
-      !!                   
-      !! ** Purpose :   Compute the before tracer (t & s) trend associated 
+      !!
+      !! ** Purpose :   Compute the before tracer (t & s) trend associated
       !!              with the bottom boundary layer and add it to the general
       !!              trend of tracer equations.
@@ -103,6 +103,6 @@
       !!              diffusive and/or advective contribution to the tracer trend
       !!              is added to the general tracer trend
-      !!----------------------------------------------------------------------  
-      INTEGER, INTENT( in ) ::   kt   ! ocean time-step 
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT( in ) ::   kt   ! ocean time-step
       !!
       REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrdt, ztrds
@@ -112,11 +112,11 @@
       !
       IF( l_trdtra )   THEN                        !* Save ta and sa trends
-         CALL wrk_alloc( jpi, jpj, jpk, ztrdt, ztrds ) 
-         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) 
+         CALL wrk_alloc( jpi, jpj, jpk, ztrdt, ztrds )
+         ztrdt(:,:,:) = tsa(:,:,:,jp_tem)
          ztrds(:,:,:) = tsa(:,:,:,jp_sal)
       ENDIF
 
       IF( l_bbl )  CALL bbl( kt, nit000, 'TRA' )   !* bbl coef. and transport (only if not already done in trcbbl)
- 
+
       IF( nn_bbl_ldf == 1 ) THEN                   !* Diffusive bbl
          !
@@ -125,7 +125,7 @@
          CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' bbl_ldf  - Ta: ', mask1=tmask, &
          &             tab3d_2=tsa(:,:,:,jp_sal), clinfo2=           ' Sa: ', mask2=tmask, clinfo3='tra' )
-         ! lateral boundary conditions ; just need for outputs                          
+         ! lateral boundary conditions ; just need for outputs
          CALL lbc_lnk( ahu_bbl, 'U', 1. )     ;     CALL lbc_lnk( ahv_bbl, 'V', 1. )
-         CALL iom_put( "ahu_bbl", ahu_bbl )   ! bbl diffusive flux i-coef     
+         CALL iom_put( "ahu_bbl", ahu_bbl )   ! bbl diffusive flux i-coef
          CALL iom_put( "ahv_bbl", ahv_bbl )   ! bbl diffusive flux j-coef
          !
@@ -138,7 +138,7 @@
          CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' bbl_adv  - Ta: ', mask1=tmask,   &
          &             tab3d_2=tsa(:,:,:,jp_sal), clinfo2=           ' Sa: ', mask2=tmask, clinfo3='tra' )
-         ! lateral boundary conditions ; just need for outputs                          
+         ! lateral boundary conditions ; just need for outputs
          CALL lbc_lnk( utr_bbl, 'U', 1. )     ;   CALL lbc_lnk( vtr_bbl, 'V', 1. )
-         CALL iom_put( "uoce_bbl", utr_bbl )  ! bbl i-transport     
+         CALL iom_put( "uoce_bbl", utr_bbl )  ! bbl i-transport
          CALL iom_put( "voce_bbl", vtr_bbl )  ! bbl j-transport
          !
@@ -150,5 +150,5 @@
          CALL trd_tra( kt, 'TRA', jp_tem, jptra_trd_bbl, ztrdt )
          CALL trd_tra( kt, 'TRA', jp_sal, jptra_trd_bbl, ztrds )
-         CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds ) 
+         CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds )
       ENDIF
       !
@@ -161,9 +161,9 @@
       !!----------------------------------------------------------------------
       !!                  ***  ROUTINE tra_bbl_dif  ***
-      !!                   
+      !!
       !! ** Purpose :   Computes the bottom boundary horizontal and vertical
-      !!                advection terms. 
-      !!
-      !! ** Method  :   
+      !!                advection terms.
+      !!
+      !! ** Method  :
       !!        * diffusive bbl (nn_bbl_ldf=1) :
       !!        When the product grad( rho) * grad(h) < 0 (where grad is an
@@ -179,9 +179,9 @@
       !! References : Beckmann, A., and R. Doscher, 1997, J. Phys.Oceanogr., 581-591.
       !!              Campin, J.-M., and H. Goosse, 1999, Tellus, 412-430.
-      !!----------------------------------------------------------------------  
+      !!----------------------------------------------------------------------
       !
       INTEGER                              , INTENT(in   ) ::   kjpt   ! number of tracers
       REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb    ! before and now tracer fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta    ! tracer trend 
+      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta    ! tracer trend
       !
       INTEGER  ::   ji, jj, jn   ! dummy loop indices
@@ -202,5 +202,5 @@
 #else
          DO jj = 1, jpj
-            DO ji = 1, jpi 
+            DO ji = 1, jpi
 #endif
                ik = mbkt(ji,jj)                        ! bottom T-level index
@@ -233,5 +233,5 @@
       !
    END SUBROUTINE tra_bbl_dif
-   
+
 
    SUBROUTINE tra_bbl_adv( ptb, pta, kjpt )
@@ -239,18 +239,18 @@
       !!                  ***  ROUTINE trc_bbl  ***
       !!
-      !! ** Purpose :   Compute the before passive tracer trend associated 
+      !! ** Purpose :   Compute the before passive tracer trend associated
       !!     with the bottom boundary layer and add it to the general trend
       !!     of tracer equations.
       !! ** Method  :   advective bbl (nn_bbl_adv = 1 or 2) :
       !!      nn_bbl_adv = 1   use of the ocean near bottom velocity as bbl velocity
-      !!      nn_bbl_adv = 2   follow Campin and Goosse (1999) implentation i.e. 
-      !!                       transport proportional to the along-slope density gradient                   
+      !!      nn_bbl_adv = 2   follow Campin and Goosse (1999) implentation i.e.
+      !!                       transport proportional to the along-slope density gradient
       !!
       !! References : Beckmann, A., and R. Doscher, 1997, J. Phys.Oceanogr., 581-591.
       !!              Campin, J.-M., and H. Goosse, 1999, Tellus, 412-430.
-      !!----------------------------------------------------------------------  
+      !!----------------------------------------------------------------------
       INTEGER                              , INTENT(in   ) ::   kjpt   ! number of tracers
       REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb    ! before and now tracer fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta    ! tracer trend 
+      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta    ! tracer trend
       !
       INTEGER  ::   ji, jj, jk, jn           ! dummy loop indices
@@ -264,5 +264,5 @@
       !                                                          ! ===========
       DO jn = 1, kjpt                                            ! tracer loop
-         !                                                       ! ===========         
+         !                                                       ! ===========
 # if defined key_vectopt_loop
          DO jj = 1, 1
@@ -282,5 +282,5 @@
                   ztra = zu_bbl * ( ptb(iid,jj,ikus,jn) - ptb(iis,jj,ikus,jn) ) * zbtr
                   pta(iis,jj,ikus,jn) = pta(iis,jj,ikus,jn) + ztra
-                  !                   
+                  !
                   DO jk = ikus, ikud-1                            ! down-slope upper to down T-point (deep column)
                      zbtr = r1_e1e2t(iid,jj) / fse3t(iid,jj,jk)
@@ -288,5 +288,5 @@
                      pta(iid,jj,jk,jn) = pta(iid,jj,jk,jn) + ztra
                   END DO
-                  ! 
+                  !
                   zbtr = r1_e1e2t(iid,jj) / fse3t(iid,jj,ikud)
                   ztra = zu_bbl * ( ptb(iis,jj,ikus,jn) - ptb(iid,jj,ikud,jn) ) * zbtr
@@ -299,10 +299,10 @@
                   ikvd = mbkv_d(ji,jj)                   ;   ikvs = mbkv(ji,jj)
                   zv_bbl = ABS( vtr_bbl(ji,jj) )
-                  ! 
+                  !
                   ! up  -slope T-point (shelf bottom point)
                   zbtr = r1_e1e2t(ji,ijs) / fse3t(ji,ijs,ikvs)
                   ztra = zv_bbl * ( ptb(ji,ijd,ikvs,jn) - ptb(ji,ijs,ikvs,jn) ) * zbtr
                   pta(ji,ijs,ikvs,jn) = pta(ji,ijs,ikvs,jn) + ztra
-                  !                   
+                  !
                   DO jk = ikvs, ikvd-1                            ! down-slope upper to down T-point (deep column)
                      zbtr = r1_e1e2t(ji,ijd) / fse3t(ji,ijd,jk)
@@ -330,9 +330,9 @@
       !!----------------------------------------------------------------------
       !!                  ***  ROUTINE bbl  ***
-      !!                   
+      !!
       !! ** Purpose :   Computes the bottom boundary horizontal and vertical
-      !!                advection terms. 
-      !!
-      !! ** Method  :   
+      !!                advection terms.
+      !!
+      !! ** Method  :
       !!        * diffusive bbl (nn_bbl_ldf=1) :
       !!        When the product grad( rho) * grad(h) < 0 (where grad is an
@@ -353,5 +353,5 @@
       !! References : Beckmann, A., and R. Doscher, 1997, J. Phys.Oceanogr., 581-591.
       !!              Campin, J.-M., and H. Goosse, 1999, Tellus, 412-430.
-      !!----------------------------------------------------------------------  
+      !!----------------------------------------------------------------------
       !
       INTEGER         , INTENT(in   ) ::   kt       ! ocean time-step index
@@ -399,11 +399,11 @@
                                           - 0.121555e-07 ) * pfh
       !!----------------------------------------------------------------------
-      
+
       !
       IF( nn_timing == 1 )  CALL timing_start( 'bbl')
       !
-      CALL wrk_alloc( jpi, jpj, zub, zvb, ztb, zsb, zdep ) 
-      !
-     
+      CALL wrk_alloc( jpi, jpj, zub, zvb, ztb, zsb, zdep )
+      !
+
       IF( kt == kit000 )  THEN
          IF(lwp)  WRITE(numout,*)
@@ -411,5 +411,5 @@
          IF(lwp)  WRITE(numout,*) '~~~~~~~~~~'
       ENDIF
-      
+
       !                                        !* bottom temperature, salinity, velocity and depth
 #if defined key_vectopt_loop
@@ -426,14 +426,14 @@
             !
             zub(ji,jj) = un(ji,jj,mbku(ji,jj))      ! bottom velocity
-            zvb(ji,jj) = vn(ji,jj,mbkv(ji,jj)) 
+            zvb(ji,jj) = vn(ji,jj,mbkv(ji,jj))
          END DO
       END DO
-      
+
       !                                   !-------------------!
       IF( nn_bbl_ldf == 1 ) THEN          !   diffusive bbl   !
          !                                !-------------------!
          DO jj = 1, jpjm1                      ! (criteria for non zero flux: grad(rho).grad(h) < 0 )
-            DO ji = 1, jpim1              
-               !                                                ! i-direction 
+            DO ji = 1, jpim1
+               !                                                ! i-direction
                zt = 0.5 * ( ztb (ji,jj) + ztb (ji+1,jj) )  ! T, S anomalie, and depth
                zs = 0.5 * ( zsb (ji,jj) + zsb (ji+1,jj) ) - 35.0
@@ -442,9 +442,9 @@
                zgdrho = (  fsalbt( zt, zs, zh ) * ( ztb(ji+1,jj) - ztb(ji,jj) )    &
                   &                             - ( zsb(ji+1,jj) - zsb(ji,jj) )  ) * umask(ji,jj,1)
-               !                                                     
+               !
                zsign          = SIGN(  0.5, - zgdrho * REAL( mgrhu(ji,jj) )  )    ! sign of ( i-gradient * i-slope )
                ahu_bbl(ji,jj) = ( 0.5 - zsign ) * ahu_bbl_0(ji,jj)                  ! masked diffusive flux coeff.
                !
-               !                                                ! j-direction 
+               !                                                ! j-direction
                zt = 0.5 * ( ztb (ji,jj+1) + ztb (ji,jj) )                ! T, S anomalie, and depth
                zs = 0.5 * ( zsb (ji,jj+1) + zsb (ji,jj) ) - 35.0
@@ -453,5 +453,5 @@
                zgdrho = (  fsalbt( zt, zs, zh ) * ( ztb(ji,jj+1) - ztb(ji,jj) )    &
                   &                             - ( zsb(ji,jj+1) - zsb(ji,jj) )  ) * vmask(ji,jj,1)
-               !                                                    
+               !
                zsign          = SIGN(  0.5, -zgdrho * REAL( mgrhv(ji,jj) )  )     ! sign of ( j-gradient * j-slope )
                ahv_bbl(ji,jj) = ( 0.5 - zsign ) * ahv_bbl_0(ji,jj)
@@ -475,7 +475,7 @@
                   zh = 0.5 * ( zdep(ji,jj) + zdep(ji+1,jj) )
                   !                                                           ! masked bbl i-gradient of density
-                  zgdrho = (  fsalbt( zt, zs, zh ) * ( ztb(ji+1,jj) - ztb(ji,jj) )    &  
+                  zgdrho = (  fsalbt( zt, zs, zh ) * ( ztb(ji+1,jj) - ztb(ji,jj) )    &
                      &                             - ( zsb(ji+1,jj) - zsb(ji,jj) )  ) * umask(ji,jj,1)
-                  !                                                         
+                  !
                   zsign = SIGN(  0.5, - zgdrho   * REAL( mgrhu(ji,jj) )  )    ! sign of i-gradient * i-slope
                   zsigna= SIGN(  0.5, zub(ji,jj) * REAL( mgrhu(ji,jj) )  )    ! sign of u * i-slope
@@ -489,5 +489,5 @@
                   zh = 0.5 * ( zdep(ji,jj+1) + zdep(ji,jj) )
                   !                                                           ! masked bbl j-gradient of density
-                  zgdrho = (  fsalbt( zt, zs, zh ) * ( ztb(ji,jj+1) - ztb(ji,jj) )    &  
+                  zgdrho = (  fsalbt( zt, zs, zh ) * ( ztb(ji,jj+1) - ztb(ji,jj) )    &
                      &                             - ( zsb(ji,jj+1) - zsb(ji,jj) )  ) * vmask(ji,jj,1)
                   zsign = SIGN(  0.5, - zgdrho   * REAL( mgrhv(ji,jj) )  )    ! sign of j-gradient * j-slope
@@ -513,5 +513,5 @@
                   zh = 0.5 * ( zdep(ji,jj) + zdep(ji+1,jj) )
                   zgdrho =    fsbeta( zt, zs, zh )                                    &
-                     &   * (  fsalbt( zt, zs, zh ) * ( ztb(iid,jj) - ztb(iis,jj) )    &  
+                     &   * (  fsalbt( zt, zs, zh ) * ( ztb(iid,jj) - ztb(iis,jj) )    &
                      &                             - ( zsb(iid,jj) - zsb(iis,jj) )  ) * umask(ji,jj,1)
                   zgdrho = MAX( 0.e0, zgdrho )                         ! only if shelf is denser than deep
@@ -530,5 +530,5 @@
                   zh = 0.5 * ( zdep(ji,jj) + zdep(ji,jj+1) )
                   zgdrho =    fsbeta( zt, zs, zh )                                    &
-                     &   * (  fsalbt( zt, zs, zh ) * ( ztb(ji,ijd) - ztb(ji,ijs) )    &  
+                     &   * (  fsalbt( zt, zs, zh ) * ( ztb(ji,ijd) - ztb(ji,ijs) )    &
                      &                             - ( zsb(ji,ijd) - zsb(ji,ijs) )  ) * vmask(ji,jj,1)
                   zgdrho = MAX( 0.e0, zgdrho )                         ! only if shelf is denser than deep
@@ -542,5 +542,5 @@
       ENDIF
       !
-      CALL wrk_dealloc( jpi, jpj, zub, zvb, ztb, zsb, zdep ) 
+      CALL wrk_dealloc( jpi, jpj, zub, zvb, ztb, zsb, zdep )
       !
       IF( nn_timing == 1 )  CALL timing_stop( 'bbl')
@@ -567,5 +567,5 @@
       IF( nn_timing == 1 )  CALL timing_start( 'tra_bbl_init')
       !
-      CALL wrk_alloc( jpi, jpj, zmbk ) 
+      CALL wrk_alloc( jpi, jpj, zmbk )
       !
 
@@ -588,5 +588,5 @@
       !                              ! allocate trabbl arrays
       IF( tra_bbl_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'tra_bbl_init : unable to allocate arrays' )
-     
+
       IF( nn_bbl_adv == 1 )    WRITE(numout,*) '       * Advective BBL using upper velocity'
       IF( nn_bbl_adv == 2 )    WRITE(numout,*) '       * Advective BBL using velocity = F( delta rho)'
@@ -597,5 +597,5 @@
       !                             !* inverse of surface of T-cells
       r1_e1e2t(:,:) = 1._wp / ( e1t(:,:) * e2t(:,:) )
-      
+
       !                             !* vertical index of  "deep" bottom u- and v-points
       DO jj = 1, jpjm1                    ! (the "shelf" bottom k-indices are mbku and mbkv)
@@ -605,5 +605,5 @@
          END DO
       END DO
-      ! converte into REAL to use lbc_lnk ; impose a min value of 1 as a zero can be set in lbclnk 
+      ! converte into REAL to use lbc_lnk ; impose a min value of 1 as a zero can be set in lbclnk
       zmbk(:,:) = REAL( mbku_d(:,:), wp )   ;   CALL lbc_lnk(zmbk,'U',1.)   ;   mbku_d(:,:) = MAX( INT( zmbk(:,:) ), 1 )
       zmbk(:,:) = REAL( mbkv_d(:,:), wp )   ;   CALL lbc_lnk(zmbk,'V',1.)   ;   mbkv_d(:,:) = MAX( INT( zmbk(:,:) ), 1 )
@@ -611,5 +611,5 @@
                                         !* sign of grad(H) at u- and v-points
       mgrhu(jpi,:) = 0.    ;    mgrhu(:,jpj) = 0.   ;    mgrhv(jpi,:) = 0.    ;    mgrhv(:,jpj) = 0.
-      DO jj = 1, jpjm1                
+      DO jj = 1, jpjm1
          DO ji = 1, jpim1
             mgrhu(ji,jj) = INT(  SIGN( 1.e0, fsdept_0(ji+1,jj,mbkt(ji+1,jj)) - fsdept_0(ji,jj,mbkt(ji,jj)) )  )
@@ -618,13 +618,13 @@
       END DO
 
-      DO jj = 1, jpjm1              !* bbl thickness at u- (v-) point 
+      DO jj = 1, jpjm1              !* bbl thickness at u- (v-) point
          DO ji = 1, jpim1                 ! minimum of top & bottom e3u_0 (e3v_0)
-            e3u_bbl_0(ji,jj) = MIN( fse3u_0(ji,jj,mbkt(ji+1,jj  )), fse3u_0(ji,jj,mbkt(ji,jj)) )  
-            e3v_bbl_0(ji,jj) = MIN( fse3v_0(ji,jj,mbkt(ji  ,jj+1)), fse3v_0(ji,jj,mbkt(ji,jj)) )  
-         END DO 
+            e3u_bbl_0(ji,jj) = MIN( fse3u_0(ji,jj,mbkt(ji+1,jj  )), fse3u_0(ji,jj,mbkt(ji,jj)) )
+            e3v_bbl_0(ji,jj) = MIN( fse3v_0(ji,jj,mbkt(ji  ,jj+1)), fse3v_0(ji,jj,mbkt(ji,jj)) )
+         END DO
       END DO
       CALL lbc_lnk( e3u_bbl_0, 'U', 1. )   ;   CALL lbc_lnk( e3v_bbl_0, 'V', 1. )      ! lateral boundary conditions
 
-      !                             !* masked diffusive flux coefficients 
+      !                             !* masked diffusive flux coefficients
       ahu_bbl_0(:,:) = rn_ahtbbl * e2u(:,:) * e3u_bbl_0(:,:) / e1u(:,:)  * umask(:,:,1)
       ahv_bbl_0(:,:) = rn_ahtbbl * e1v(:,:) * e3v_bbl_0(:,:) / e2v(:,:)  * vmask(:,:,1)
@@ -636,5 +636,5 @@
          CASE ( 2 )                          ! ORCA_R2
             ij0 = 102   ;   ij1 = 102              ! Gibraltar enhancement of BBL
-            ii0 = 139   ;   ii1 = 140  
+            ii0 = 139   ;   ii1 = 140
             ahu_bbl_0(mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1)) =  4.e0*ahu_bbl_0(mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1))
             ahv_bbl_0(mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1)) =  4.e0*ahv_bbl_0(mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1))
@@ -647,5 +647,5 @@
          CASE ( 4 )                          ! ORCA_R4
             ij0 =  52   ;   ij1 =  52              ! Gibraltar enhancement of BBL
-            ii0 =  70   ;   ii1 =  71  
+            ii0 =  70   ;   ii1 =  71
             ahu_bbl_0(mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1)) =  4.e0*ahu_bbl_0(mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1))
             ahv_bbl_0(mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1)) =  4.e0*ahv_bbl_0(mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1))
@@ -654,5 +654,5 @@
       ENDIF
       !
-      CALL wrk_dealloc( jpi, jpj, zmbk ) 
+      CALL wrk_dealloc( jpi, jpj, zmbk )
       !
       IF( nn_timing == 1 )  CALL timing_stop( 'tra_bbl_init')
