Index: trunk/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_iso.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_iso.F90	(revision 6140)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_iso.F90	(revision 7646)
@@ -24,4 +24,5 @@
    USE ldfslp         ! iso-neutral slopes
    USE diaptr         ! poleward transport diagnostics
+   USE diaar5         ! AR5 diagnostics
    !
    USE in_out_manager ! I/O manager
@@ -36,4 +37,7 @@
 
    PUBLIC   tra_ldf_iso   ! routine called by step.F90
+
+   LOGICAL  ::   l_ptr   ! flag to compute poleward transport
+   LOGICAL  ::   l_hst   ! flag to compute heat transport
 
    !! * Substitutions
@@ -107,7 +111,4 @@
       REAL(wp) ::  zmskv, zahv_w, zabe2, zcof2, zcoef4   !   -      -
       REAL(wp) ::  zcoef0, ze3w_2, zsign, z2dt, z1_2dt   !   -      -
-#if defined key_diaar5
-      REAL(wp) ::   zztmp   ! local scalar
-#endif
       REAL(wp), POINTER, DIMENSION(:,:)   ::   zdkt, zdk1t, z2d
       REAL(wp), POINTER, DIMENSION(:,:,:) ::   zdit, zdjt, zftu, zftv, ztfw 
@@ -127,5 +128,12 @@
          ah_wslp2(:,:,:) = 0._wp
       ENDIF
-      !                                               ! set time step size (Euler/Leapfrog)
+      !   
+      l_hst = .FALSE.
+      l_ptr = .FALSE.
+      IF( cdtype == 'TRA' .AND. ln_diaptr )                                                 l_ptr = .TRUE. 
+      IF( cdtype == 'TRA' .AND. ( iom_use("uadv_heattr") .OR. iom_use("vadv_heattr") .OR. &
+         &                        iom_use("uadv_salttr") .OR. iom_use("vadv_salttr")  ) )   l_hst = .TRUE.
+      !
+      !                                            ! set time step size (Euler/Leapfrog)
       IF( neuler == 0 .AND. kt == nit000 ) THEN   ;   z2dt =     rdt      ! at nit000   (Euler)
       ELSE                                        ;   z2dt = 2.* rdt      !             (Leapfrog)
@@ -369,41 +377,8 @@
             !
             !                             ! "Poleward" diffusive heat or salt transports (T-S case only)
-            IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN
-               ! note sign is reversed to give down-gradient diffusive transports (#1043)
-               IF( jn == jp_tem)   htr_ldf(:) = ptr_sj( -zftv(:,:,:) )
-               IF( jn == jp_sal)   str_ldf(:) = ptr_sj( -zftv(:,:,:) )
-            ENDIF
-            !
-            IF( iom_use("udiff_heattr") .OR. iom_use("vdiff_heattr") ) THEN
-              !
-              IF( cdtype == 'TRA' .AND. jn == jp_tem  ) THEN
-                  z2d(:,:) = zftu(ji,jj,1) 
-                  DO jk = 2, jpkm1
-                     DO jj = 2, jpjm1
-                        DO ji = fs_2, fs_jpim1   ! vector opt.
-                           z2d(ji,jj) = z2d(ji,jj) + zftu(ji,jj,jk) 
-                        END DO
-                     END DO
-                  END DO
-!!gm CAUTION I think there is an error of sign when using BLP operator....
-!!gm         a multiplication by zsign is required (to be checked twice !)
-                  z2d(:,:) = - rau0_rcp * z2d(:,:)     ! note sign is reversed to give down-gradient diffusive transports (#1043)
-                  CALL lbc_lnk( z2d, 'U', -1. )
-                  CALL iom_put( "udiff_heattr", z2d )                  ! heat transport in i-direction
-                  !
-                  z2d(:,:) = zftv(ji,jj,1) 
-                  DO jk = 2, jpkm1
-                     DO jj = 2, jpjm1
-                        DO ji = fs_2, fs_jpim1   ! vector opt.
-                           z2d(ji,jj) = z2d(ji,jj) + zftv(ji,jj,jk) 
-                        END DO
-                     END DO
-                  END DO
-                  z2d(:,:) = - rau0_rcp * z2d(:,:)     ! note sign is reversed to give down-gradient diffusive transports (#1043)
-                  CALL lbc_lnk( z2d, 'V', -1. )
-                  CALL iom_put( "vdiff_heattr", z2d )                  !  heat transport in i-direction
-               END IF
-               !
-            ENDIF
+               ! note sign is reversed to give down-gradient diffusive transports )
+            IF( l_ptr )  CALL dia_ptr_hst( jn, 'ldf', -zftv(:,:,:)  )
+            !                          ! Diffusive heat transports
+            IF( l_hst )  CALL dia_ar5_hst( jn, 'ldf', -zftu(:,:,:), -zftv(:,:,:) )
             !
          ENDIF                                                    !== end pass selection  ==!
