Index: trunk/NEMO/TOP_SRC/TRP/trcbbl.F90
===================================================================
--- trunk/NEMO/TOP_SRC/TRP/trcbbl.F90	(revision 349)
+++ trunk/NEMO/TOP_SRC/TRP/trcbbl.F90	(revision 403)
@@ -19,5 +19,5 @@
    USE trc                 ! ocean passive tracers variables
    USE prtctl_trc          ! Print control for debbuging
-
+   USE eosbn2
    IMPLICIT NONE
    PRIVATE
@@ -28,6 +28,13 @@
 
    !! * Shared module variables
-   LOGICAL, PUBLIC, PARAMETER ::   &  !:
-      lk_trcbbl_dif = .TRUE.   !: diffusive bottom boundary layer flag
+# if defined key_trcbbl_dif
+   LOGICAL, PUBLIC, PARAMETER ::    &  !:
+      lk_trcbbl_dif = .TRUE.   !: advective bottom boundary layer flag
+
+# else
+   LOGICAL, PUBLIC, PARAMETER ::    &  !:
+      lk_trcbbl_dif = .FALSE.  !: advective bottom boundary layer flag
+# endif
+
 # if defined key_trcbbl_adv
    LOGICAL, PUBLIC, PARAMETER ::    &  !:
@@ -45,4 +52,7 @@
    INTEGER, DIMENSION(jpi,jpj) ::   &  !:
       mbkt, mbku, mbkv                 ! ???
+
+   REAL(wp) ::        &  !!! * trcbbl namelist *
+      atrcbbl = 1.e+3      ! lateral coeff. for bottom boundary layer scheme (m2/s)
 
    !! * Substitutions
@@ -182,6 +192,6 @@
             ze3u = MIN( fse3u(ji,jj,iku1), fse3u(ji,jj,iku2) ) 
             ze3v = MIN( fse3v(ji,jj,ikv1), fse3v(ji,jj,ikv2) ) 
-            zahu(ji,jj) = atrbbl * e2u(ji,jj) * ze3u / e1u(ji,jj) * umask(ji,jj,1)
-            zahv(ji,jj) = atrbbl * e1v(ji,jj) * ze3v / e2v(ji,jj) * vmask(ji,jj,1)
+            zahu(ji,jj) = atrcbbl * e2u(ji,jj) * ze3u / e1u(ji,jj) * umask(ji,jj,1)
+            zahv(ji,jj) = atrcbbl * e1v(ji,jj) * ze3v / e2v(ji,jj) * vmask(ji,jj,1)
 #   if ! defined key_vectopt_loop   ||   defined key_autotasking
          END DO
@@ -198,6 +208,6 @@
             iku = mbku(ji,jj)
             ikv = mbkv(ji,jj)
-            zahu(ji,jj) = atrbbl * e2u(ji,jj) * fse3u(ji,jj,iku) / e1u(ji,jj) * umask(ji,jj,1)
-            zahv(ji,jj) = atrbbl * e1v(ji,jj) * fse3v(ji,jj,ikv) / e2v(ji,jj) * vmask(ji,jj,1)
+            zahu(ji,jj) = atrcbbl * e2u(ji,jj) * fse3u(ji,jj,iku) / e1u(ji,jj) * umask(ji,jj,1)
+            zahv(ji,jj) = atrcbbl * e1v(ji,jj) * fse3v(ji,jj,ikv) / e2v(ji,jj) * vmask(ji,jj,1)
 #   if ! defined key_vectopt_loop   ||   defined key_autotasking
          END DO
@@ -252,4 +262,7 @@
       ! Sign of the local density gradient along the i- and j-slopes
       ! multiplied by the slope of the ocean bottom
+	SELECT CASE ( neos )
+
+      	CASE ( 0 )               ! Jackett and McDougall (1994) formulation
 
 #  if defined key_vectopt_loop   &&   ! defined key_autotasking
@@ -301,4 +314,74 @@
       END DO
 
+	CASE ( 1 )               ! Linear formulation function of temperature only
+
+#  if defined key_vectopt_loop   &&   ! defined key_autotasking
+      jj = 1
+      DO ji = 1, jpij-jpi   ! vector opt. (forced unrolling)
+#  else
+      DO jj = 1, jpjm1
+         DO ji = 1, jpim1
+#  endif
+            ! local density gradient along i-bathymetric slope
+            zgdrho =  ( ztnb(ji+1,jj) - ztnb(ji,jj) )
+            ! sign of local i-gradient of density multiplied by the i-slope
+            zsign = SIGN( 0.5, - zgdrho * ( zdep(ji+1,jj) - zdep(ji,jj) ) )
+            zki(ji,jj) = ( 0.5 - zsign ) * zahu(ji,jj)
+#  if ! defined key_vectopt_loop   ||   defined key_autotasking
+         END DO
+#  endif
+      END DO
+
+#  if defined key_vectopt_loop   &&   ! defined key_autotasking
+      jj = 1
+      DO ji = 1, jpij-jpi   ! vector opt. (forced unrolling)
+#  else
+      DO jj = 1, jpjm1
+         DO ji = 1, jpim1
+#  endif
+            ! local density gradient along j-bathymetric slope
+            zgdrho =  ( ztnb(ji,jj+1) - ztnb(ji,jj) )
+            ! sign of local j-gradient of density multiplied by the j-slope
+            zsign = sign( 0.5, -zgdrho * ( zdep(ji,jj+1) - zdep(ji,jj) ) )
+            zkj(ji,jj) = ( 0.5 - zsign ) * zahv(ji,jj)
+
+#  if ! defined key_vectopt_loop   ||   defined key_autotasking
+         END DO
+#  endif
+      END DO
+
+      CASE ( 2 )               ! Linear formulation function of temperature and salinity
+
+      DO jj = 1, jpjm1
+        DO ji = 1, fs_jpim1   ! vector opt.
+            ! local density gradient along i-bathymetric slope
+            zgdrho = - ( rbeta*( zsnb(ji+1,jj) - zsnb(ji,jj) )   &
+                     -  ralpha*( ztnb(ji+1,jj) - ztnb(ji,jj) ) )
+            ! sign of local i-gradient of density multiplied by the i-slope
+            zsign = SIGN( 0.5, - zgdrho * ( zdep(ji+1,jj) - zdep(ji,jj) ) )
+ 	    zki(ji,jj) = ( 0.5 - zsign ) * zahu(ji,jj)
+        END DO
+      END DO
+
+      DO jj = 1, jpjm1
+        DO ji = 1, fs_jpim1   ! vector opt.
+            ! local density gradient along j-bathymetric slope
+            zgdrho = - ( rbeta*( zsnb(ji,jj+1) - zsnb(ji,jj) )   &
+                     -  ralpha*( ztnb(ji,jj+1) - ztnb(ji,jj) ) )
+            ! sign of local j-gradient of density multiplied by the j-slope
+            zsign = sign( 0.5, -zgdrho * ( zdep(ji,jj+1) - zdep(ji,jj) ) )
+            zkj(ji,jj) = ( 0.5 - zsign ) * zahv(ji,jj)
+         END DO
+      END DO
+
+
+      CASE DEFAULT
+
+         IF(lwp) WRITE(numout,cform_err)
+         IF(lwp) WRITE(numout,*) '          bad flag value for neos = ', neos
+         nstop = nstop + 1
+
+      END SELECT
+
       ! 2. Additional second order diffusive trends
       ! -------------------------------------------
@@ -333,6 +416,4 @@
 #  endif
          END DO
-
-#endif
 
          IF( cp_cfg == "orca" ) THEN
@@ -425,6 +506,15 @@
       !! * Local declarations
       INTEGER ::   ji, jj      ! dummy loop indices
-
-      !!----------------------------------------------------------------------
+      INTEGER :: numnat=80
+      NAMELIST/namtrcbbl/ atrcbbl
+
+      !!----------------------------------------------------------------------
+      ! Read Namelist namtrcbbl : bottom boundary layer scheme
+      ! --------------------
+
+      OPEN(numnat,FILE='namelist.trp.cfc')
+      REWIND ( numnat )
+      READ   ( numnat, namtrcbbl )
+      CLOSE(numnat)
 
 
@@ -435,4 +525,5 @@
          WRITE(numout,*) 'trc_bbl_init : * Diffusive Bottom Boundary Layer'
          WRITE(numout,*) '~~~~~~~~~~~~'
+         WRITE(numout,*) ' bottom boundary layer coef.    atrcbbl = ', atrcbbl
 # if defined key_trcbbl_adv
             WRITE(numout,*) '               * Advective Bottom Boundary Layer'
