Index: /trunk/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90
===================================================================
--- /trunk/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90	(revision 4760)
+++ /trunk/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90	(revision 4761)
@@ -45,5 +45,4 @@
    USE diadimg         ! dimg direct access file format output
    USE diaar5, ONLY :   lk_diaar5
-   USE dynadv, ONLY :   ln_dynadv_vec
    USE iom
    USE ioipsl
@@ -131,5 +130,6 @@
       REAL(wp)                     ::   zztmp, zztmpx, zztmpy   ! 
       !!
-      REAL(wp), POINTER, DIMENSION(:,:)   :: z2d       ! 2D workspace
+      REAL(wp), POINTER, DIMENSION(:,:)   :: z2d      ! 2D workspace
+      REAL(wp), POINTER, DIMENSION(:,:)   :: z2ds     ! 2D workspace
       REAL(wp), POINTER, DIMENSION(:,:,:) :: z3d      ! 3D workspace
       !!----------------------------------------------------------------------
@@ -137,5 +137,5 @@
       IF( nn_timing == 1 )   CALL timing_start('dia_wri')
       ! 
-      CALL wrk_alloc( jpi , jpj      , z2d )
+      CALL wrk_alloc( jpi , jpj      , z2d , z2ds )
       CALL wrk_alloc( jpi , jpj, jpk , z3d )
       !
@@ -193,38 +193,67 @@
       CALL iom_put( "sstgrad" ,  z2d               )    ! module of sst gradient
 
+      ! clem: heat and salt content
+      z2d(:,:)  = 0._wp 
+      z2ds(:,:) = 0._wp 
+      DO jk = 1, jpkm1
+         DO jj = 2, jpjm1
+            DO ji = fs_2, fs_jpim1   ! vector opt.
+               z2d(ji,jj) = z2d(ji,jj) + rau0 * rcp * fse3t(ji,jj,jk) * tsn(ji,jj,jk,jp_tem) * tmask(ji,jj,jk)
+               z2ds(ji,jj) = z2ds(ji,jj) + rau0 * fse3t(ji,jj,jk) * tsn(ji,jj,jk,jp_sal) * tmask(ji,jj,jk)
+            END DO
+         END DO
+      END DO
+      CALL lbc_lnk( z2d, 'T', 1. )
+      CALL lbc_lnk( z2ds, 'T', 1. )
+      CALL iom_put( "heatc", z2d )    ! vertically integrated heat content (J/m2)
+      CALL iom_put( "saltc", z2ds )   ! vertically integrated salt content (PSU*kg/m2)
+      
+
       IF( lk_diaar5 ) THEN
          z3d(:,:,jpk) = 0.e0
          DO jk = 1, jpkm1
-            z3d(:,:,jk) = rau0 * un(:,:,jk) * e2u(:,:) * fse3u(:,:,jk)
+            z3d(:,:,jk) = rau0 * un(:,:,jk) * e2u(:,:) * fse3u(:,:,jk) * umask(:,:,jk)
          END DO
          CALL iom_put( "u_masstr", z3d )                  ! mass transport in i-direction
+
          zztmp = 0.5 * rcp
          z2d(:,:) = 0.e0 
+         z2ds(:,:) = 0.e0 
          DO jk = 1, jpkm1
             DO jj = 2, jpjm1
                DO ji = fs_2, fs_jpim1   ! vector opt.
                   z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * zztmp * ( tsn(ji,jj,jk,jp_tem) + tsn(ji+1,jj,jk,jp_tem) )
+                  z2ds(ji,jj) = z2ds(ji,jj) + z3d(ji,jj,jk) * 0.5_wp * ( tsn(ji,jj,jk,jp_sal) + tsn(ji+1,jj,jk,jp_sal) )
                END DO
             END DO
          END DO
          CALL lbc_lnk( z2d, 'U', -1. )
+         CALL lbc_lnk( z2ds, 'U', -1. )
          CALL iom_put( "u_heattr", z2d )                  ! heat transport in i-direction
+         CALL iom_put( "u_salttr", z2ds )                 ! salt transport in i-direction
+
+         z3d(:,:,jpk) = 0.e0
          DO jk = 1, jpkm1
-            z3d(:,:,jk) = rau0 * vn(:,:,jk) * e1v(:,:) * fse3v(:,:,jk)
+            z3d(:,:,jk) = rau0 * vn(:,:,jk) * e1v(:,:) * fse3v(:,:,jk) * vmask(:,:,jk)
          END DO
          CALL iom_put( "v_masstr", z3d )                  ! mass transport in j-direction
+
          z2d(:,:) = 0.e0 
+         z2ds(:,:) = 0.e0 
          DO jk = 1, jpkm1
             DO jj = 2, jpjm1
                DO ji = fs_2, fs_jpim1   ! vector opt.
                   z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * zztmp * ( tsn(ji,jj,jk,jp_tem) + tsn(ji,jj+1,jk,jp_tem) )
+                  z2ds(ji,jj) = z2ds(ji,jj) + z3d(ji,jj,jk) * 0.5_wp * ( tsn(ji,jj,jk,jp_sal) + tsn(ji,jj+1,jk,jp_sal) )
                END DO
             END DO
          END DO
          CALL lbc_lnk( z2d, 'V', -1. )
-         CALL iom_put( "v_heattr", z2d )                  !  heat transport in i-direction
-      ENDIF
-      !
-      CALL wrk_dealloc( jpi , jpj      , z2d )
+         CALL lbc_lnk( z2ds, 'V', -1. )
+         CALL iom_put( "v_heattr", z2d )                  !  heat transport in j-direction
+         CALL iom_put( "v_salttr", z2ds )                 !  salt transport in j-direction
+      ENDIF
+      !
+      CALL wrk_dealloc( jpi , jpj      , z2d , z2ds )
       CALL wrk_dealloc( jpi , jpj, jpk , z3d )
       !
