Index: branches/2014/dev_r4621_NOC4_BDY_VERT_INTERP/NEMOGCM/NEMO/TOP_SRC/TRP/trcdmp.F90
===================================================================
--- branches/2014/dev_r4621_NOC4_BDY_VERT_INTERP/NEMOGCM/NEMO/TOP_SRC/TRP/trcdmp.F90	(revision 5038)
+++ branches/2014/dev_r4621_NOC4_BDY_VERT_INTERP/NEMOGCM/NEMO/TOP_SRC/TRP/trcdmp.F90	(revision 5901)
@@ -18,5 +18,4 @@
    USE oce_trc         ! ocean dynamics and tracers variables
    USE trc             ! ocean passive tracers variables
-   USE trcnam_trp      ! passive tracers transport namelist variables
    USE trcdta
    USE tradmp
@@ -24,11 +23,16 @@
    USE trdtra
    USE trd_oce
+   USE iom
 
    IMPLICIT NONE
    PRIVATE
 
-   PUBLIC trc_dmp            ! routine called by step.F90
-   PUBLIC trc_dmp_clo        ! routine called by step.F90
-   PUBLIC trc_dmp_alloc      ! routine called by nemogcm.F90
+   PUBLIC trc_dmp      
+   PUBLIC trc_dmp_clo   
+   PUBLIC trc_dmp_alloc  
+   PUBLIC trc_dmp_ini    
+
+   INTEGER , PUBLIC ::   nn_zdmp_tr    ! = 0/1/2 flag for damping in the mixed layer
+   CHARACTER(LEN=200) , PUBLIC :: cn_resto_tr    !File containing restoration coefficient
 
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   restotr   ! restoring coeff. on tracers (s-1)
@@ -39,8 +43,9 @@
 
    !! * Substitutions
-#  include "top_substitute.h90"
+#  include "domzgr_substitute.h90"
+#  include "vectopt_loop_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 3.3 , NEMO Consortium (2010)
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/TOP_SRC/TRP/trcdmp.F90,v 1.11 2006/09/01 14:03:49 opalod Exp $ 
+   !! $Id$ 
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -89,8 +94,4 @@
       IF( nn_timing == 1 )  CALL timing_start('trc_dmp')
       !
-      ! 0. Initialization (first time-step only)
-      !    --------------
-      IF( kt == nittrc000 ) CALL trc_dmp_init
-
       IF( l_trdtrc )   CALL wrk_alloc( jpi, jpj, jpk, ztrtrd )   ! temporary save of trends
       !
@@ -125,5 +126,5 @@
                      DO jj = 2, jpjm1
                         DO ji = fs_2, fs_jpim1   ! vector opt.
-                           IF( avt(ji,jj,jk) <= 5.e-4 )  THEN 
+                           IF( avt(ji,jj,jk) <= 5.e-4_wp )  THEN 
                               ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) )
                               tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra
@@ -170,4 +171,66 @@
    END SUBROUTINE trc_dmp
 
+   SUBROUTINE trc_dmp_ini
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE trc_dmp_ini  ***
+      !! 
+      !! ** Purpose :   Initialization for the newtonian damping 
+      !!
+      !! ** Method  :   read the nammbf namelist and check the parameters
+      !!              called by trc_dmp at the first timestep (nittrc000)
+      !!----------------------------------------------------------------------
+      !
+      INTEGER ::  ios                 ! Local integer output status for namelist read
+      INTEGER :: imask  !local file handle
+      !
+      NAMELIST/namtrc_dmp/ nn_zdmp_tr , cn_resto_tr
+      !!----------------------------------------------------------------------
+
+      IF( nn_timing == 1 )  CALL timing_start('trc_dmp_init')
+      !
+
+      REWIND( numnat_ref )              ! Namelist namtrc_dmp in reference namelist : Passive tracers newtonian damping
+      READ  ( numnat_ref, namtrc_dmp, IOSTAT = ios, ERR = 909)
+909   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dmp in reference namelist', lwp )
+
+      REWIND( numnat_cfg )              ! Namelist namtrc_dmp in configuration namelist : Passive tracers newtonian damping
+      READ  ( numnat_cfg, namtrc_dmp, IOSTAT = ios, ERR = 910)
+910   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dmp in configuration namelist', lwp )
+      IF(lwm) WRITE ( numont, namtrc_dmp )
+
+      IF(lwp) THEN                       ! Namelist print
+         WRITE(numout,*)
+         WRITE(numout,*) 'trc_dmp : Passive tracers newtonian damping'
+         WRITE(numout,*) '~~~~~~~'
+         WRITE(numout,*) '   Namelist namtrc_dmp : set damping parameter'
+         WRITE(numout,*) '      mixed layer damping option     nn_zdmp_tr = ', nn_zdmp_tr, '(zoom: forced to 0)'
+         WRITE(numout,*) '      Restoration coeff file    cn_resto_tr = ', cn_resto_tr
+      ENDIF
+      !
+      IF( lzoom .AND. .NOT.lk_c1d )   nn_zdmp_tr = 0           ! restoring to climatology at closed north or south boundaries
+      SELECT CASE ( nn_zdmp_tr )
+      CASE ( 0 )   ;   IF(lwp) WRITE(numout,*) '   tracer damping throughout the water column'
+      CASE ( 1 )   ;   IF(lwp) WRITE(numout,*) '   no tracer damping in the turbocline (avt > 5 cm2/s)'
+      CASE ( 2 )   ;   IF(lwp) WRITE(numout,*) '   no tracer damping in the mixed layer'
+      CASE DEFAULT
+         WRITE(ctmp1,*) 'bad flag value for nn_zdmp_tr = ', nn_zdmp_tr
+         CALL ctl_stop(ctmp1)
+      END SELECT
+
+      IF( .NOT.lk_c1d ) THEN
+         IF( .NOT. ln_tradmp )   &
+            &   CALL ctl_stop( 'passive trace damping need ln_tradmp to compute damping coef.' )
+         !
+         !                          ! Read damping coefficients from file
+         !Read in mask from file
+         CALL iom_open ( cn_resto_tr, imask)
+         CALL iom_get  ( imask, jpdom_autoglo, 'resto', restotr)
+         CALL iom_close( imask )
+         !
+      ENDIF
+      IF( nn_timing == 1 )  CALL timing_stop('trc_dmp_init')
+      !
+   END SUBROUTINE trc_dmp_ini
+
    SUBROUTINE trc_dmp_clo( kt )
       !!---------------------------------------------------------------------
@@ -184,5 +247,6 @@
       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
       !
-      INTEGER :: ji, jj, jk, jn, jl, jc                     ! dummy loop indicesa
+      INTEGER :: ji , jj, jk, jn, jl, jc                     ! dummy loop indicesa
+      INTEGER :: isrow                                      ! local index
       REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta       ! 3D  workspace
 
@@ -200,4 +264,13 @@
             !
             SELECT CASE ( jp_cfg )
+            !                                           ! =======================
+            CASE ( 1 )                                  ! eORCA_R1 configuration
+            !                                           ! =======================
+            isrow = 332 - jpjglo
+            !
+                                                        ! Caspian Sea
+            nctsi1(1)   = 332  ; nctsj1(1)   = 243 - isrow
+            nctsi2(1)   = 344  ; nctsj2(1)   = 275 - isrow
+            !                                        
             !                                           ! =======================
             CASE ( 2 )                                  !  ORCA_R2 configuration
@@ -292,47 +365,4 @@
 
 
-   SUBROUTINE trc_dmp_init
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE trc_dmp_init  ***
-      !! 
-      !! ** Purpose :   Initialization for the newtonian damping 
-      !!
-      !! ** Method  :   read the nammbf namelist and check the parameters
-      !!              called by trc_dmp at the first timestep (nittrc000)
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('trc_dmp_init')
-      !
-      SELECT CASE ( nn_hdmp_tr )
-      CASE (  -1  )   ;   IF(lwp) WRITE(numout,*) '   tracer damping in the Med & Red seas only'
-      CASE ( 1:90 )   ;   IF(lwp) WRITE(numout,*) '   tracer damping poleward of', nn_hdmp_tr, ' degrees'
-      CASE DEFAULT
-         WRITE(ctmp1,*) '          bad flag value for nn_hdmp_tr = ', nn_hdmp_tr
-         CALL ctl_stop(ctmp1)
-      END SELECT
-
-      IF( lzoom )   nn_zdmp_tr = 0           ! restoring to climatology at closed north or south boundaries
-      SELECT CASE ( nn_zdmp_tr )
-      CASE ( 0 )   ;   IF(lwp) WRITE(numout,*) '   tracer damping throughout the water column'
-      CASE ( 1 )   ;   IF(lwp) WRITE(numout,*) '   no tracer damping in the turbocline (avt > 5 cm2/s)'
-      CASE ( 2 )   ;   IF(lwp) WRITE(numout,*) '   no tracer damping in the mixed layer'
-      CASE DEFAULT
-         WRITE(ctmp1,*) 'bad flag value for nn_zdmp_tr = ', nn_zdmp_tr
-         CALL ctl_stop(ctmp1)
-      END SELECT
-
-      IF( .NOT. ln_tradmp )   &
-         &   CALL ctl_stop( 'passive trace damping need key_tradmp to compute damping coef.' )
-      !
-      !                          ! Damping coefficients initialization
-      IF( lzoom ) THEN   ;   CALL dtacof_zoom( restotr )
-      ELSE               ;   CALL dtacof( nn_hdmp_tr, rn_surf_tr, rn_bot_tr, rn_dep_tr,  &
-                             &            nn_file_tr, 'TRC'     , restotr                )
-      ENDIF
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('trc_dmp_init')
-      !
-   END SUBROUTINE trc_dmp_init
-
 #else
    !!----------------------------------------------------------------------
