Index: trunk/NEMO/OPA_SRC/TRA/tradmp.F90
===================================================================
--- trunk/NEMO/OPA_SRC/TRA/tradmp.F90	(revision 473)
+++ trunk/NEMO/OPA_SRC/TRA/tradmp.F90	(revision 503)
@@ -4,7 +4,17 @@
    !! Ocean physics: internal restoring trend on active tracers (T and S)
    !!======================================================================
+   !! History :  5.0  !  91-03  (O. Marti, G. Madec)  Original code
+   !!                 !  92-06  (M. Imbard)  doctor norme
+   !!                 !  96-01  (G. Madec)  statement function for e3
+   !!                 !  97-05  (G. Madec)  macro-tasked on jk-slab
+   !!                 !  98-07  (M. Imbard, G. Madec) ORCA version
+   !!            7.0  !  01-02  (M. Imbard)  cofdis, Original code
+   !!            8.1  !  01-02  (G. Madec, E. Durand)  cleaning
+   !!            8.5  !  02-08  (G. Madec, E. Durand)  free form + modules
+   !!----------------------------------------------------------------------
 #if   defined key_tradmp   ||   defined key_esopa
    !!----------------------------------------------------------------------
    !!   key_tradmp                                         internal damping
+   !!----------------------------------------------------------------------
    !!----------------------------------------------------------------------
    !!   tra_dmp      : update the tracer trend with the internal damping
@@ -14,5 +24,4 @@
    !!   cofdis       : compute the distance to the coastline
    !!----------------------------------------------------------------------
-   !! * Modules used
    USE oce             ! ocean dynamics and tracers variables
    USE dom_oce         ! ocean space and time domain variables
@@ -31,27 +40,22 @@
    PRIVATE
 
-   !! * Routine accessibility
-   PUBLIC tra_dmp   ! routine called by step.F90
-
-   !! * Shared module variables
-   LOGICAL , PUBLIC &
+   PUBLIC tra_dmp      ! routine called by step.F90
+
 #if ! defined key_agrif
-   , PARAMETER  &
+   LOGICAL, PUBLIC, PARAMETER ::   lk_tradmp = .TRUE.     !: internal damping flag
+#else
+   LOGICAL, PUBLIC            ::   lk_tradmp = .TRUE.     !: internal damping flag
 #endif
-   ::   lk_tradmp = .TRUE.    !: internal damping flag
-
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   &
-      strdmp,              &  ! damping salinity trend (psu/s)
-      resto                   ! restoring coeff. on T and S (s-1)
-
-   !! * Module variables
-   INTEGER  ::             & !!! * newtonian damping namelist (mandmp) *
-      ndmp   =   -1 ,      &  ! = 0/-1/'latitude' for damping over T and S
-      ndmpf  =    2 ,      &  ! = 1 create a damping.coeff NetCDF file 
-      nmldmp =    0           ! = 0/1/2 flag for damping in the mixed layer
-   REAL(wp) ::             & !!!  * newtonian damping namelist *
-      sdmp   =   50.,      &  ! surface time scale for internal damping (days)
-      bdmp   =  360.,      &  ! bottom time scale for internal damping (days)
-      hdmp   =  800.          ! depth of transition between sdmp and bdmp (meters)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   strdmp   !: damping salinity trend (psu/s)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   resto    !: restoring coeff. on T and S (s-1)
+   
+   !!* newtonian damping namelist (mandmp) 
+   INTEGER  ::   ndmp   =   -1    ! = 0/-1/'latitude' for damping over T and S
+   INTEGER  ::   ndmpf  =    2    ! = 1 create a damping.coeff NetCDF file 
+   INTEGER  ::   nmldmp =    0    ! = 0/1/2 flag for damping in the mixed layer
+   REAL(wp) ::   sdmp   =   50.   ! surface time scale for internal damping (days)
+   REAL(wp) ::   bdmp   =  360.   ! bottom time scale for internal damping (days)
+   REAL(wp) ::   hdmp   =  800.   ! depth of transition between sdmp and bdmp (meters)
+   NAMELIST/namtdp/ ndmp, ndmpf, nmldmp, sdmp, bdmp, hdmp
 
    !! * Substitutions
@@ -59,7 +63,7 @@
 #  include "vectopt_loop_substitute.h90"
    !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
+   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
    !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 
@@ -85,32 +89,19 @@
       !!                damping trends.
       !!              - save the trends in (ttrd,strd) ('key_trdtra')
-      !!
-      !! History :
-      !!   7.0  !         (G. Madec)  Original code
-      !!        !  96-01  (G. Madec) 
-      !!        !  97-05  (G. Madec)  macro-tasked on jk-slab
-      !!   8.5  !  02-08  (G. Madec)  free form + modules
-      !!   9.0  !  04-08  (C. Talandier) New trends organization
-      !!----------------------------------------------------------------------
-      !! * Modules used     
-      USE oce, ONLY :    ztdta => ua,   & ! use ua as 3D workspace   
-                         ztdsa => va      ! use va as 3D workspace   
-
-      !! * Arguments
-      INTEGER, INTENT( in ) ::   kt       ! ocean time-step index
-
-      !! * Local declarations
+      !!----------------------------------------------------------------------
+      USE oce, ONLY :   ztrdt => ua   ! use ua as 3D workspace   
+      USE oce, ONLY :   ztrds => va   ! use va as 3D workspace   
+      !!
+      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index
+      !!
       INTEGER  ::   ji, jj, jk            ! dummy loop indices
       REAL(wp) ::   ztest, zta, zsa       ! temporary scalars
       !!----------------------------------------------------------------------
 
-      ! 0. Initialization (first time-step only)
-      !    --------------
-      IF( kt == nit000 ) CALL tra_dmp_init
-
-      ! Save ta and sa trends
-      IF( l_trdtra )   THEN
-         ztdta(:,:,:) = ta(:,:,:) 
-         ztdsa(:,:,:) = sa(:,:,:) 
+      IF( kt == nit000 )   CALL tra_dmp_init      ! Initialization
+
+      IF( l_trdtra )   THEN                       ! Save ta and sa trends
+         ztrdt(:,:,:) = ta(:,:,:) 
+         ztrds(:,:,:) = sa(:,:,:) 
       ENDIF
 
@@ -120,5 +111,5 @@
 
       SELECT CASE ( nmldmp )
-
+      !
       CASE( 0 )                ! newtonian damping throughout the water column
          DO jk = 1, jpkm1
@@ -135,5 +126,5 @@
             END DO
          END DO
-
+         !
       CASE ( 1 )                ! no damping in the turbocline (avt > 5 cm2/s)
          DO jk = 1, jpkm1
@@ -156,5 +147,5 @@
             END DO
          END DO
-
+         !
       CASE ( 2 )                ! no damping in the mixed layer 
          DO jk = 1, jpkm1
@@ -176,21 +167,16 @@
             END DO
          END DO
-
+         !
       END SELECT
 
-      ! save the trends for diagnostic
-      ! damping salinity trends
-      IF( l_trdtra )   THEN
-         ztdta(:,:,:) = ta(:,:,:) - ztdta(:,:,:)
-         ztdsa(:,:,:) = sa(:,:,:) - ztdsa(:,:,:)
-         CALL trd_mod(ztdta, ztdsa, jpttddoe, 'TRA', kt)
+      IF( l_trdtra )   THEN          ! save the damping tracer trends for diagnostic
+         ztrdt(:,:,:) = ta(:,:,:) - ztrdt(:,:,:)
+         ztrds(:,:,:) = sa(:,:,:) - ztrds(:,:,:)
+         CALL trd_mod(ztrdt, ztrds, jptra_trd_dmp, 'TRA', kt)
       ENDIF
-
-      IF(ln_ctl) THEN         ! print mean trends (used for debugging)
-         CALL prt_ctl(tab3d_1=ta, clinfo1=' dmp  - Ta: ', mask1=tmask, &
-            &         tab3d_2=sa, clinfo2=' Sa: ', mask2=tmask, clinfo3='tra')
-      ENDIF
-
-
+      !                              ! Control print
+      IF(ln_ctl)   CALL prt_ctl( tab3d_1=ta, clinfo1=' dmp  - Ta: ', mask1=tmask,   &
+         &                       tab3d_2=sa, clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
+      !
    END SUBROUTINE tra_dmp
 
@@ -204,82 +190,50 @@
       !! ** Method  :   read the nammbf namelist and check the parameters
       !!      called by tra_dmp at the first timestep (nit000)
-      !!
-      !! History :
-      !!   8.5  !  02-08  (G. Madec)  Original code
-      !!----------------------------------------------------------------------
-      !! * Local declarations
-      NAMELIST/namtdp/ ndmp, ndmpf, nmldmp, sdmp, bdmp, hdmp
-      !!----------------------------------------------------------------------
-
-      ! Read Namelist namtdp : temperature and salinity damping term
-      ! --------------------
-      REWIND ( numnam )
+      !!----------------------------------------------------------------------
+
+      REWIND ( numnam )                  ! Read Namelist namtdp : temperature and salinity damping term
       READ   ( numnam, namtdp )
       IF( lzoom )   nmldmp = 0           ! restoring to climatology at closed north or south boundaries
 
-      ! Parameter control and print
-      ! ---------------------------
-      IF(lwp) THEN
+      IF(lwp) THEN                       ! Namelist print
          WRITE(numout,*)
          WRITE(numout,*) 'tra_dmp : T and S newtonian damping'
          WRITE(numout,*) '~~~~~~~'
-         WRITE(numout,*) '          Namelist namtdp : set damping parameter'
-         WRITE(numout,*)
-         WRITE(numout,*) '             T and S damping option         ndmp   = ', ndmp
-         WRITE(numout,*) '             create a damping.coeff file    ndmpf  = ', ndmpf
-         WRITE(numout,*) '             mixed layer damping option     nmldmp = ', nmldmp, '(zoom: forced to 0)'
-         WRITE(numout,*) '             surface time scale (days)      sdmp   = ', sdmp
-         WRITE(numout,*) '             bottom time scale (days)       bdmp   = ', bdmp
-         WRITE(numout,*) '             depth of transition (meters)   hdmp   = ', hdmp
-         WRITE(numout,*)
+         WRITE(numout,*) '       Namelist namtdp : set damping parameter'
+         WRITE(numout,*) '          T and S damping option         ndmp   = ', ndmp
+         WRITE(numout,*) '          create a damping.coeff file    ndmpf  = ', ndmpf
+         WRITE(numout,*) '          mixed layer damping option     nmldmp = ', nmldmp, '(zoom: forced to 0)'
+         WRITE(numout,*) '          surface time scale (days)      sdmp   = ', sdmp
+         WRITE(numout,*) '          bottom time scale (days)       bdmp   = ', bdmp
+         WRITE(numout,*) '          depth of transition (meters)   hdmp   = ', hdmp
       ENDIF
 
       SELECT CASE ( ndmp )
-
-      CASE ( -1 )               ! ORCA: damping in Red & Med Seas only
-         IF(lwp) WRITE(numout,*) '          tracer damping in the Med & Red seas only'
-
-      CASE ( 1:90 )             ! Damping poleward of 'ndmp' degrees
-         IF(lwp) WRITE(numout,*) '          tracer damping poleward of', ndmp, ' degrees'
-
+      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', ndmp, ' degrees'
       CASE DEFAULT
          WRITE(ctmp1,*) '          bad flag value for ndmp = ', ndmp
          CALL ctl_stop(ctmp1)
-
       END SELECT
 
-
       SELECT CASE ( nmldmp )
-
-      CASE ( 0 )                ! newtonian damping throughout the water column
-         IF(lwp) WRITE(numout,*) '          tracer damping throughout the water column'
-
-      CASE ( 1 )                ! no damping in the turbocline (avt > 5 cm2/s)
-         IF(lwp) WRITE(numout,*) '          no tracer damping in the turbocline'
-
-      CASE ( 2 )                ! no damping in the mixed layer 
-         IF(lwp) WRITE(numout,*) '          no tracer damping in the mixed layer'
-
+      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 nmldmp = ', nmldmp
          CALL ctl_stop(ctmp1)
-
       END SELECT
 
-      IF( .NOT.lk_dtasal .OR. .NOT.lk_dtatem ) &
-           &   CALL ctl_stop( '          no temperature and/or salinity data ', &
-           &                  '          define key_dtatem and key_dtasal' )
+      IF( .NOT.lk_dtasal .OR. .NOT.lk_dtatem )   &
+         &   CALL ctl_stop( 'no temperature and/or salinity data define key_dtatem and key_dtasal' )
 
       strdmp(:,:,:) = 0.e0       ! internal damping salinity trend (used in ocesbc)
 
-      ! Damping coefficients initialization
-      ! -----------------------------------
-
-      IF( lzoom ) THEN
-         CALL dtacof_zoom
-      ELSE
-         CALL dtacof
+      !                          ! Damping coefficients initialization
+      IF( lzoom ) THEN   ;   CALL dtacof_zoom
+      ELSE               ;   CALL dtacof
       ENDIF
-
+      !
    END SUBROUTINE tra_dmp_init
 
@@ -297,14 +251,8 @@
       !!
       !! ** Action  : - resto, the damping coeff. for T and S
-      !!
-      !! History :
-      !!   9.0  !  03-09  (G. Madec)  Original code
-      !!----------------------------------------------------------------------
-      !! * Local declarations
-      INTEGER ::   ji, jj, jk, jn      ! dummy loop indices
-      REAL(wp) ::   &
-         zlat, zlat0, zlat1, zlat2     ! temporary scalar
-      REAL(wp), DIMENSION(6)  ::   &
-         zfact                         ! temporary workspace
+      !!----------------------------------------------------------------------
+      INTEGER  ::   ji, jj, jk, jn              ! dummy loop indices
+      REAL(wp) ::   zlat, zlat0, zlat1, zlat2   ! temporary scalar
+      REAL(wp), DIMENSION(6)  ::   zfact        ! temporary workspace
       !!----------------------------------------------------------------------
 
@@ -321,15 +269,13 @@
       ! damping along the forced closed boundary over 6 grid-points
       DO jn = 1, 6
-         IF( lzoom_w )   resto( mi0(jn+jpizoom):mi1(jn+jpizoom), : , : ) = zfact(jn) ! west  closed
-         IF( lzoom_s )   resto( : , mj0(jn+jpjzoom):mj1(jn+jpjzoom), : ) = zfact(jn) ! south closed 
-         IF( lzoom_e )   resto( mi0(jpiglo+jpizoom-1-jn):mi1(jpiglo+jpizoom-1-jn) , : , : ) &
-                       &              = zfact(jn)                                 ! east  closed 
-         IF( lzoom_n )   resto( : , mj0(jpjglo+jpjzoom-1-jn):mj1(jpjglo+jpjzoom-1-jn) , : ) &
-                       &              = zfact(jn)                                 ! north closed
+         IF( lzoom_w )   resto( mi0(jn+jpizoom):mi1(jn+jpizoom), : , : )                    = zfact(jn)   ! west  closed
+         IF( lzoom_s )   resto( : , mj0(jn+jpjzoom):mj1(jn+jpjzoom), : )                    = zfact(jn)   ! south closed 
+         IF( lzoom_e )   resto( mi0(jpiglo+jpizoom-1-jn):mi1(jpiglo+jpizoom-1-jn) , : , : ) = zfact(jn)   ! east  closed 
+         IF( lzoom_n )   resto( : , mj0(jpjglo+jpjzoom-1-jn):mj1(jpjglo+jpjzoom-1-jn) , : ) = zfact(jn)   ! north closed
       END DO
 
 
       IF( lzoom_arct .AND. lzoom_anta ) THEN
-
+         !
          ! ====================================================
          !  ORCA configuration : arctic zoom or antarctic zoom
@@ -364,11 +310,12 @@
             END DO
          END DO
-
+         !
       ENDIF
 
       ! ... Mask resto array
       resto(:,:,:) = resto(:,:,:) * tmask(:,:,:)
-
+      !
    END SUBROUTINE dtacof_zoom
+
 
    SUBROUTINE dtacof
@@ -383,34 +330,20 @@
       !!
       !! ** Action  : - resto, the damping coeff. for T and S
-      !!
-      !! History :
-      !!   5.0  !  91-03  (O. Marti, G. Madec)  Original code
-      !!        !  92-06  (M. Imbard)  doctor norme
-      !!        !  96-01  (G. Madec) statement function for e3
-      !!        !  98-07  (M. Imbard, G. Madec) ORCA version
-      !!        !  00-08  (G. Madec, D. Ludicone) 
-      !!----------------------------------------------------------------------
-      !! * Modules used
+      !!----------------------------------------------------------------------
       USE iom
       USE ioipsl
-
-      !! * Local declarations
+      !!
       INTEGER ::   ji, jj, jk     ! dummy loop indices
       INTEGER ::   itime
       INTEGER ::   ii0, ii1, ij0, ij1  !    "          "
-      INTEGER ::   &
-         idmp,     &  ! logical unit for file restoring damping term
-         icot         ! logical unit for file distance to the coast
+      INTEGER ::   idmp         ! logical unit for file restoring damping term
+      INTEGER ::   icot         ! logical unit for file distance to the coast
       CHARACTER (len=32) :: clname3
-      REAL(wp) ::   &
-         zdate0, zinfl, zlon,         & ! temporary scalars
-         zlat, zlat0, zlat1, zlat2,   & !    "         "
-         zsdmp, zbdmp                   !    "         "
-      REAL(wp), DIMENSION(jpk) ::   &
-         zhfac
-      REAL(wp), DIMENSION(jpi,jpj) ::   &
-         zmrs
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   &
-         zdct
+      REAL(wp) ::   zdate0, zinfl, zlon         ! temporary scalars
+      REAL(wp) ::   zlat, zlat0, zlat1, zlat2   !    "         "
+      REAL(wp) ::   zsdmp, zbdmp                !    "         "
+      REAL(wp), DIMENSION(jpk)         ::   zhfac
+      REAL(wp), DIMENSION(jpi,jpj)     ::   zmrs
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zdct
       !!----------------------------------------------------------------------
 
@@ -494,16 +427,12 @@
                DO ji = 1, jpi
                   zdct(ji,jj,jk) = MIN( zinfl, zdct(ji,jj,jk) )
-
                   !   ... Decrease the value in the vicinity of the coast
-                  resto(ji,jj,jk) = resto(ji,jj,1)*0.5   &
-                     &            * ( 1. - COS( rpi*zdct(ji,jj,jk)/zinfl) )
-
+                  resto(ji,jj,jk) = resto(ji,jj,1) * 0.5 * ( 1. - COS( rpi*zdct(ji,jj,jk)/zinfl) )
                   !   ... Vertical variation from zsdmp (sea surface) to zbdmp (bottom)
-                  resto(ji,jj,jk) = resto(ji,jj,jk)   &
-                     &            * ( zbdmp + (zsdmp-zbdmp)*EXP(-fsdept(ji,jj,jk)/hdmp) )
+                  resto(ji,jj,jk) = resto(ji,jj,jk)      * ( zbdmp + (zsdmp-zbdmp)*EXP(-fsdept(ji,jj,jk)/hdmp) )
                END DO
             END DO
          END DO
-
+         !
       ENDIF
 
@@ -524,5 +453,4 @@
          CASE ( 4 )                                  !  ORCA_R4 configuration 
             !                                        ! =======================
-
             ! Mediterranean Sea
             ij0 =  50   ;   ij1 =  56
@@ -539,9 +467,7 @@
                zhfac (jk) = 1./rday
             END DO
-
             !                                        ! =======================
          CASE ( 2 )                                  !  ORCA_R2 configuration 
             !                                        ! =======================
-
             ! Mediterranean Sea
             ij0 =  96   ;   ij1 = 110
@@ -576,9 +502,7 @@
                zhfac (jk) = 1./rday
             END DO
-
             !                                        ! =======================
          CASE ( 05 )                                 !  ORCA_R05 configuration
             !                                        ! =======================
-
             ! Mediterranean Sea
             ii0 = 568   ;   ii1 = 574 
@@ -608,10 +532,9 @@
                zhfac (jk) = ( zbdmp + (zsdmp-zbdmp) * EXP(-fsdept(1,1,jk)/hdmp) )
             END DO
-
             !                                       ! ========================
          CASE ( 025 )                               !  ORCA_R025 configuration 
             !                                       ! ========================
             CALL ctl_stop( ' Not yet implemented in ORCA_R025' )
-
+            !
          END SELECT
 
@@ -644,11 +567,11 @@
          CALL ymds2ju( 0     , 1      , 1      , 0.e0 , zdate0 )
          CALL restini( 'NONE', jpi    , jpj    , glamt, gphit,    &
-                       jpk   , gdept_0, clname3, itime, zdate0,   &
-                       rdt   , idmp, domain_id=nidom )
+            &          jpk   , gdept_0, clname3, itime, zdate0,   &
+            &          rdt   , idmp, domain_id=nidom )
          CALL restput( idmp, 'Resto', jpi, jpj, jpk,   &
-                       0   , resto  )
+            &          0   , resto  )
          CALL restclo( idmp )
       ENDIF
-
+      !
    END SUBROUTINE dtacof
 
@@ -673,32 +596,18 @@
       !! ** Action  : - pdct, distance to the coastline (argument)
       !!              - NetCDF file 'dist.coast.nc' 
-      !!        
-      !! History :
-      !!   7.0  !  01-02  (M. Imbard)  Original code
-      !!   8.1  !  01-02  (G. Madec, E. Durand)
-      !!   8.5  !  02-08  (G. Madec, E. Durand)  Free form, F90
-      !!----------------------------------------------------------------------
-      !! * Modules used
-      USE ioipsl
-
-      !! * Arguments
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( out ) ::   &
-         pdct                     ! distance to the coastline
-
-      !! * local declarations
-      INTEGER :: ji, jj, jk, jl      ! dummy loop indices
-      INTEGER :: iju, ijt            ! temporary integers
-      INTEGER :: icoast, itime
-      INTEGER ::   &
-         icot         ! logical unit for file distance to the coast
-      LOGICAL, DIMENSION(jpi,jpj) ::   &
-         llcotu, llcotv, llcotf   ! ???
+      !!----------------------------------------------------------------------
+      USE ioipsl      ! IOipsl librairy
+      !!
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( out ) ::   pdct   ! distance to the coastline
+      !!
+      INTEGER ::   ji, jj, jk, jl      ! dummy loop indices
+      INTEGER ::   iju, ijt            ! temporary integers
+      INTEGER ::   icoast, itime
+      INTEGER ::   icot         ! logical unit for file distance to the coast
+      LOGICAL, DIMENSION(jpi,jpj) ::   llcotu, llcotv, llcotf   ! ???
       CHARACTER (len=32) ::   clname
       REAL(wp) ::   zdate0
-      REAL(wp), DIMENSION(jpi,jpj) ::   &
-         zxt, zyt, zzt,                 &  ! cartesian coordinates for T-points
-         zmask                             
-      REAL(wp), DIMENSION(3*jpi*jpj) ::   &
-         zxc, zyc, zzc, zdis      ! temporary workspace
+      REAL(wp), DIMENSION(jpi,jpj)   ::   zxt, zyt, zzt, zmask   ! cartesian coordinates for T-points
+      REAL(wp), DIMENSION(3*jpi*jpj) ::   zxc, zyc, zzc, zdis    ! temporary workspace
       !!----------------------------------------------------------------------
 
@@ -832,6 +741,6 @@
                   DO jl = 1, icoast
                      zdis(jl) = ( zxt(ji,jj) - zxc(jl) )**2   &
-                              + ( zyt(ji,jj) - zyc(jl) )**2   &
-                              + ( zzt(ji,jj) - zzc(jl) )**2
+                        &     + ( zyt(ji,jj) - zyc(jl) )**2   &
+                        &     + ( zzt(ji,jj) - zzc(jl) )**2
                   END DO
                   pdct(ji,jj,jk) = ra * SQRT( MINVAL( zdis(1:icoast) ) )
@@ -850,6 +759,6 @@
       CALL ymds2ju( 0     , 1      , 1     , 0.e0 , zdate0 )
       CALL restini( 'NONE', jpi    , jpj   , glamt, gphit ,   &
-                    jpk   , gdept_0, clname, itime, zdate0,   &
-                    rdt   , icot                         )
+         &          jpk   , gdept_0, clname, itime, zdate0,   &
+         &          rdt   , icot                         )
       CALL restput( icot, 'Tcoast', jpi, jpj, jpk, 0, pdct )
       CALL restclo( icot )
