Index: branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRD/trdvor.F90
===================================================================
--- branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRD/trdvor.F90	(revision 2633)
+++ branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRD/trdvor.F90	(revision 2690)
@@ -4,6 +4,6 @@
    !! Ocean diagnostics:  momentum trends
    !!=====================================================================
-   !! History :  9.0  !  04-06  (L. Brunier, A-M. Treguier) Original code 
-   !!                 !  04-08  (C. Talandier) New trends organization
+   !! History :  1.0  !  04-2006  (L. Brunier, A-M. Treguier) Original code 
+   !!            2.0  !  04-2008  (C. Talandier) New trends organization
    !!----------------------------------------------------------------------
 #if defined key_trdvor   ||   defined key_esopa
@@ -41,16 +41,15 @@
 
    INTEGER ::   nh_t, nmoydpvor, nidvor, nhoridvor, ndimvor1, icount   ! needs for IOIPSL output
-   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndexvor1 ! needed for IOIPSL output
+   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) ::   ndexvor1   ! needed for IOIPSL output
    INTEGER ::   ndebug     ! (0/1) set it to 1 in case of problem to have more print
 
-   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,  :) ::   vor_avr      ! average
-   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,  :) ::   vor_avrb     ! before vorticity (kt-1)
-   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,  :) ::   vor_avrbb    ! vorticity at begining of the nwrite-1 timestep averaging period
-   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,  :) ::   vor_avrbn    ! after vorticity at time step after the
-   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,  :) ::   rotot        ! begining of the NWRITE-1 timesteps
-   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,  :) ::   vor_avrtot   !
-   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,  :) ::   vor_avrres   !
-
-   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:,:) ::   vortrd  ! curl of trends
+   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::   vor_avr      ! average
+   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::   vor_avrb     ! before vorticity (kt-1)
+   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::   vor_avrbb    ! vorticity at begining of the nwrite-1 timestep averaging period
+   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::   vor_avrbn    ! after vorticity at time step after the
+   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::   rotot        ! begining of the NWRITE-1 timesteps
+   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::   vor_avrtot   !
+   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::   vor_avrres   !
+   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:,:) ::   vortrd       ! curl of trends
          
    CHARACTER(len=12) ::   cvort
@@ -71,8 +70,8 @@
       !!                  ***  ROUTINE trd_vor_alloc  ***
       !!----------------------------------------------------------------------------
-      ALLOCATE( vor_avr(jpi,jpj),    vor_avrb(jpi,jpj), vor_avrbb(jpi,jpj),  &
-         &      vor_avrbn(jpi,jpj),  rotot(jpi,jpj),    vor_avrtot(jpi,jpj), &
-         &      vor_avrres(jpi,jpj), vortrd(jpi,jpj,jpltot_vor),             &
-         &      ndexvor1(jpi*jpj),   STAT=trd_vor_alloc)
+      ALLOCATE( vor_avr   (jpi,jpj) , vor_avrb(jpi,jpj) , vor_avrbb (jpi,jpj) ,   &
+         &      vor_avrbn (jpi,jpj) , rotot   (jpi,jpj) , vor_avrtot(jpi,jpj) ,   &
+         &      vor_avrres(jpi,jpj) , vortrd  (jpi,jpj,jpltot_vor) ,              &
+         &      ndexvor1  (jpi*jpj)                                ,   STAT= trd_vor_alloc )
          !
       IF( lk_mpp             )   CALL mpp_sum ( trd_vor_alloc )
@@ -108,27 +107,23 @@
       !!      trends output in netCDF format using ioipsl
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY: zudpvor => wrk_2d_1, &   ! total cmulative trends
-                          zvdpvor => wrk_2d_2
-      !!
+      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
+      USE wrk_nemo, ONLY:   zudpvor => wrk_2d_1 , zvdpvor => wrk_2d_2   ! total cmulative trends
+      !
       INTEGER                     , INTENT(in   ) ::   ktrd       ! ocean trend index
       REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) ::   putrdvor   ! u vorticity trend 
       REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) ::   pvtrdvor   ! v vorticity trend
-      !!
+      !
       INTEGER ::   ji, jj       ! dummy loop indices
       INTEGER ::   ikbu, ikbv   ! local integers
       !!----------------------------------------------------------------------
 
-      IF(wrk_in_use(2, 1,2))THEN
-         CALL ctl_stop('trd_vor_zint_2d : requested workspace arrays unavailable.')
-         RETURN
-      END IF
+      IF( wrk_in_use(2, 1,2) ) THEN
+         CALL ctl_stop('trd_vor_zint_2d: requested workspace arrays unavailable')   ;   RETURN
+      ENDIF
 
       ! Initialization
-      zudpvor(:,:) = 0._wp
-      zvdpvor(:,:) = 0._wp
-      !
-      CALL lbc_lnk( putrdvor,  'U' , -1. )         ! lateral boundary condition on input momentum trends
-      CALL lbc_lnk( pvtrdvor,  'V' , -1. )
+      zudpvor(:,:) = 0._wp                 ;   zvdpvor(:,:) = 0._wp
+      CALL lbc_lnk( putrdvor, 'U', -1. )   ;   CALL lbc_lnk( pvtrdvor, 'V', -1. )      ! lateral boundary condition
+      
 
       !  =====================================
@@ -172,7 +167,5 @@
       ENDIF
       !
-      IF(wrk_not_released(2, 1,2))THEN
-         CALL ctl_stop('trd_vor_zint_2d : failed to release workspace arrays.')
-      END IF
+      IF( wrk_not_released(2, 1,2) )   CALL ctl_stop('trd_vor_zint_2d : failed to release workspace arrays.')
       !
    END SUBROUTINE trd_vor_zint_2d
@@ -206,19 +199,18 @@
       !!      trends output in netCDF format using ioipsl
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY: zubet   => wrk_2d_1,   zvbet => wrk_2d_2   ! Beta.V 
-      USE wrk_nemo, ONLY: zudpvor => wrk_2d_3, zvdpvor => wrk_2d_4   ! total cmulative trends
-      !!
+      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
+      USE wrk_nemo, ONLY:   zubet   => wrk_2d_1,   zvbet => wrk_2d_2   ! Beta.V 
+      USE wrk_nemo, ONLY:   zudpvor => wrk_2d_3, zvdpvor => wrk_2d_4   ! total cmulative trends
+      !
       INTEGER                         , INTENT(in   ) ::   ktrd       ! ocean trend index
       REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   putrdvor   ! u vorticity trend 
       REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pvtrdvor   ! v vorticity trend
-      !!
-      INTEGER ::   ji, jj, jk
+      !
+      INTEGER ::   ji, jj, jk   ! dummy loop indices
       !!----------------------------------------------------------------------
      
-      IF(wrk_in_use(2, 1,2,3,4))THEN
-         CALL ctl_stop('trd_vor_zint_3d : requested workspace arrays unavailable.')
-         RETURN
-      END IF
+      IF( wrk_in_use(2, 1,2,3,4) ) THEN
+         CALL ctl_stop('trd_vor_zint_3d: requested workspace arrays unavailable.')   ;   RETURN
+      ENDIF
 
       ! Initialization
@@ -228,6 +220,6 @@
       zvdpvor(:,:) = 0._wp
       !
-      CALL lbc_lnk( putrdvor, 'U' , -1. )         ! lateral boundary condition on input momentum trends
-      CALL lbc_lnk( pvtrdvor, 'V' , -1. )
+      CALL lbc_lnk( putrdvor, 'U', -1. )         ! lateral boundary condition on input momentum trends
+      CALL lbc_lnk( pvtrdvor, 'V', -1. )
 
       !  =====================================
@@ -284,7 +276,5 @@
       ENDIF
       !
-      IF(wrk_not_released(2, 1,2,3,4))THEN
-         CALL ctl_stop('trd_vor_zint_3d : failed to release workspace arrays.')
-      END IF
+      IF( wrk_not_released(2, 1,2,3,4) )   CALL ctl_stop('trd_vor_zint_3d: failed to release workspace arrays')
       !
    END SUBROUTINE trd_vor_zint_3d
@@ -298,9 +288,9 @@
       !!               and make outputs (NetCDF or DIMG format)
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY: zun => wrk_2d_1, zvn => wrk_2d_2 ! 2D workspace
-      !!
+      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
+      USE wrk_nemo, ONLY:   zun => wrk_2d_1 , zvn => wrk_2d_2 ! 2D workspace
+      !
       INTEGER, INTENT(in) ::   kt   ! ocean time-step index
-      !!
+      !
       INTEGER  ::   ji, jj, jk, jl   ! dummy loop indices
       INTEGER  ::   it, itmod        ! local integers
@@ -308,8 +298,7 @@
       !!----------------------------------------------------------------------
 
-      IF(wrk_in_use(2, 1,2))THEN
-         CALL ctl_stop('trd_vor : requested workspace arrays unavailable.')
-         RETURN
-      END IF
+      IF( wrk_in_use(2, 1,2) ) THEN
+         CALL ctl_stop('trd_vor: requested workspace arrays unavailable.')   ;   RETURN
+      ENDIF
 
       !  =================
@@ -478,5 +467,5 @@
       IF( kt == nitend )   CALL histclo( nidvor )
       !
-      IF(wrk_not_released(2, 1,2) )   CALL ctl_stop('trd_vor : failed to release workspace arrays')
+      IF( wrk_not_released(2, 1,2) )   CALL ctl_stop('trd_vor: failed to release workspace arrays')
       !
    END SUBROUTINE trd_vor
