Index: branches/2011/dev_r2802_MERCATOR10_diadct/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90
===================================================================
--- branches/2011/dev_r2802_MERCATOR10_diadct/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90	(revision 2848)
+++ branches/2011/dev_r2802_MERCATOR10_diadct/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90	(revision 2854)
@@ -6,4 +6,11 @@
   !! History : 
   !!
+  !!         original  : 02/99 (Y Drillet)
+  !!         addition  : 10/01 (Y Drillet, R Bourdalle Badie)
+  !!                   : 10/05 (M Laborie) F90
+  !!         addition  : 04/07 (G Garric) Ice sections
+  !!         bugfix    : 04/07 (C Bricaud) test on sec%nb_point
+  !!                                      initialisation of ztransp1,ztransp2,...
+  !!         nemo_v_3_4: 09/2011 (C Bricaud)
   !!
   !!
@@ -14,11 +21,11 @@
   !!----------------------------------------------------------------------
   !!----------------------------------------------------------------------
-  !!   dia_dct      :  Compute the transport trough a sec.
-  !!   dia_dct_init :
-  !!   readsec      :
-  !!   removepoints :
-  !!   transport    :
-  !!   dia_dct_wri  :
-  !!   interp       :
+  !!   dia_dct      :  compute the transport trough a sec.
+  !!   dia_dct_init :  read namelist.
+  !!   readsec      :  read sections description and pathway
+  !!   removepoints :  remove points which are common to 2 procs
+  !!   transport    :  Compute transport for each sections
+  !!   dia_dct_wri  :  write tranports results in ascii files
+  !!   interp       :  compute Temperature/Salinity/density on U-point or V-point
   !!   
   !!----------------------------------------------------------------------
@@ -100,16 +107,7 @@
      !!               ***  ROUTINE diadct  ***  
      !!
-     !!  ** Purpose: Read the namelist parametres and the 
-     !!              file containing the sections definitions
-     !!
-     !!  ** Input : Read a binary file generated by the tools "????"
-     !!   
-     !!  ** Output:  secs array
-     !!  
-     !! History :
-     !!         !  03-09 (JM. Lellouche and E. Durand) mpprsum modified
-     !!         !  04-01 (C.Derval) bugfix
-     !!         !  04-2007 (C.Bricaud) bugfix 
-     !!         !          mise à zéro de secs(jsec)%transport(:,:) apres chaque ecriture
+     !!  ** Purpose: Read the namelist parametres
+     !!              Open output files
+     !!
      !!---------------------------------------------------------------------
      NAMELIST/namdct/nn_dct,nn_dctwri,nn_secdebug
@@ -206,5 +204,9 @@
      !!               ***  ROUTINE readsec  ***
      !!
-     !!  ** Purpose: Read the sections definitions 
+     !!  ** Purpose:
+     !!            Read a binary file(section_ijglobal.diadct) 
+     !!            generated by the tools "NEMOGCM/TOOLS/SECTIONS_DIADCT"
+     !!
+     !!
      !!---------------------------------------------------------------------
      !! * Local variables
@@ -387,4 +389,8 @@
      !!             *** function removepoints
      !!
+     !!   ** Purpose ::
+     !!              remove points which are common to 2 procs
+     !!
+     !!
      !----------------------------------------------------------------------------
      !! * arguments
@@ -471,11 +477,6 @@
      !! ** Output: sec%transport: transport in the 2 direction and temperature, 
      !!                       salinity, density meaned by the transport
-     !! ** History :
-     !!         original : 02/99 (Y Drillet)
-     !!         addition : 10/01 (Y Drillet, R Bourdalle Badie)
-     !!                  : 10/05 (M Laborie) F90
-     !!         addition : 04/07 (G Garric) Ice sections
-     !!         bugfix   : 04/07 (C Bricaud) test on sec%nb_point
-     !!                                      initialisation of ztransp1,ztransp2,...
+     !!
+     !!
      !!-------------------------------------------------------------------
      !! * Arguments
@@ -785,6 +786,8 @@
               sec%transport(3,jclass)=sec%transport(3,jclass)+zsum(3,jclass)/zsum(1,jclass)
               sec%transport(5,jclass)=sec%transport(5,jclass)+zsum(5,jclass)/zsum(1,jclass)
-              sec%transport(7,jclass)=sec%transport(7,jclass)+zsum(7,jclass)/zsum(1,jclass)
-              sec%transport(9,jclass)=sec%transport(9,jclass)+zsum(9,jclass)/zsum(1,jclass)
+!              sec%transport(7,jclass)=sec%transport(7,jclass)+zsum(7,jclass)/zsum(1,jclass)
+!              sec%transport(9,jclass)=sec%transport(9,jclass)+zsum(9,jclass)/zsum(1,jclass)
+              sec%transport(7,jclass)=sec%transport(7,jclass)+zsum(7,jclass)
+              sec%transport(9,jclass)=sec%transport(9,jclass)+zsum(9,jclass)
            ELSE
               sec%transport(3,jclass)=0.
@@ -796,6 +799,8 @@
               sec%transport( 4,jclass)=sec%transport( 4,jclass)+zsum( 4,jclass)/zsum(2,jclass)
               sec%transport( 6,jclass)=sec%transport( 6,jclass)+zsum( 6,jclass)/zsum(2,jclass)
-              sec%transport( 8,jclass)=sec%transport( 8,jclass)+zsum( 8,jclass)/zsum(2,jclass)
-              sec%transport(10,jclass)=sec%transport(10,jclass)+zsum(10,jclass)/zsum(2,jclass)
+!              sec%transport( 8,jclass)=sec%transport( 8,jclass)+zsum( 8,jclass)/zsum(2,jclass)
+!              sec%transport(10,jclass)=sec%transport(10,jclass)+zsum(10,jclass)/zsum(2,jclass)
+              sec%transport( 8,jclass)=sec%transport( 8,jclass)+zsum( 8,jclass)
+              sec%transport(10,jclass)=sec%transport(10,jclass)+zsum(10,jclass)
            ELSE
               sec%transport( 4,jclass)=0.
@@ -828,5 +833,16 @@
      !! Write transport output in numdct 
      !! 
-     !! Author: 10/05 Matthieu Laborie
+     !! Purpose: Write  transports in ascii files
+     !! 
+     !! Method:
+     !!        1. Write volume transports in "volume_transport"
+     !!           Unit: Sv : Surface * Velocity / 1.e6 
+     !! 
+     !!        2. Write heat transports in "heat_transport"
+     !!           Unit: Peta W : Surface * Velocity * T * rhau * Cp / 1.e15
+     !! 
+     !!        3. Write salt transports in "salt_transport"
+     !!           Unit: Mega m^3 / s : Surface * Velocity * S / 1.e6
+     !!
      !!------------------------------------------------------------- 
      !!arguments
@@ -836,7 +852,6 @@
 
      !!local declarations
-     REAL(wp) ,DIMENSION(2):: zsumclass
+     REAL(wp) ,DIMENSION(nb_type_class):: zsumclass
      INTEGER               :: jcl,ji        !Dummy loop
-!     CHARACTER(len=35)     :: zcritere
      CHARACTER(len=2)      :: classe
      REAL(wp)              :: zbnd1,zbnd2
@@ -853,6 +868,5 @@
         zbnd1   = 0._wp
         zbnd2   = 0._wp
-        zsumclass(1)=zsumclass(1)+sec%transport(1,jcl)
-        zsumclass(2)=zsumclass(2)+sec%transport(2,jcl)
+        zsumclass(1:nb_type_class)=zsumclass(1:nb_type_class)+sec%transport(1:nb_type_class,jcl)
 
    
@@ -893,12 +907,4 @@
         ENDIF
                   
-!        ! Delate spaces and blank:
-!        zcritere = ADJUSTL(zcritere)
-!        ji = SCAN(TRIM(zcritere)," ")
-!        DO WHILE( ji .NE. 0 )
-!           zcritere(ji:ji) = "_"
-!           ji = SCAN(TRIM(zcritere)," ")
-!        ENDDO   
-
         !write volume transport per class
         WRITE(numdct_vol,118) ndastp,kt,jsec,sec%name,sec%slopeSection, &
@@ -909,19 +915,22 @@
         IF( sec%llstrpond )THEN
 
-           !write heat transport per class
+           !write heat transport per class:
            WRITE(numdct_heat,119) ndastp,kt,jsec,sec%name,sec%slopeSection,  &
                               jcl,classe,zbnd1,zbnd2,&
-                              sec%transport(7,jcl)*rau0*rcp,sec%transport(8,jcl)* rau0*rcp, &
-                              ( sec%transport(7,jcl)+sec%transport(8,jcl) )*rau0*rcp
+                              !sec%transport(7,jcl)*rau0*rcp,sec%transport(8,jcl)* rau0*rcp, &
+                              !( sec%transport(7,jcl)+sec%transport(8,jcl) )*rau0*rcp
+                              sec%transport(7,jcl)*1000._wp*rcp/1.e15,sec%transport(8,jcl)*1000._wp*rcp/1.e15, &
+                              ( sec%transport(7,jcl)+sec%transport(8,jcl) )*1000._wp*rcp/1.e15
            !write salt transport per class
            WRITE(numdct_salt,119) ndastp,kt,jsec,sec%name,sec%slopeSection,  &
                               jcl,classe,zbnd1,zbnd2,&
-                              sec%transport(9,jcl)*rau0,sec%transport(10,jcl)*rau0,&
-                              (sec%transport(9,jcl)+sec%transport(10,jcl))*rau0
+                              !sec%transport(9,jcl)*rau0,sec%transport(10,jcl)*rau0,&
+                              !(sec%transport(9,jcl)+sec%transport(10,jcl))*rau0
+                              sec%transport(9,jcl)/1.e6,sec%transport(10,jcl)/1.e6,&
+                              (sec%transport(9,jcl)+sec%transport(10,jcl))/1.e6
         ENDIF
 
      ENDDO
 
-!     zcritere = "total"
      zbnd1 = 0._wp
      zbnd2 = 0._wp
@@ -938,9 +947,11 @@
         WRITE(numdct_heat,119) ndastp,kt,jsec,sec%name,sec%slopeSection, &
                            jcl,"total",zbnd1,zbnd2,&
-                           zsumclass(7)* rau0*rcp,zsumclass(8)* rau0*rcp,(zsumclass(7)+zsumclass(8) )* rau0*rcp
+                           !zsumclass(7)* rau0*rcp,zsumclass(8)* rau0*rcp,(zsumclass(7)+zsumclass(8) )* rau0*rcp
+                           zsumclass(7)* 1000._wp*rcp/1.e15,zsumclass(8)* 1000._wp*rcp/1.e15,(zsumclass(7)+zsumclass(8) )* 1000._wp*rcp/1.e15
         !write total salt transport
         WRITE(numdct_salt,119) ndastp,kt,jsec,sec%name,sec%slopeSection, &
                            jcl,"total",zbnd1,zbnd2,&
-                           zsumclass(9)*rau0,zsumclass(10)*rau0,(zsumclass(9)+zsumclass(10))*rau0
+                           !zsumclass(9)*rau0,zsumclass(10)*rau0,(zsumclass(9)+zsumclass(10))*rau0
+                           zsumclass(9)/1.e6,zsumclass(10)/1.e6,(zsumclass(9)+zsumclass(10))/1.e6
      ENDIF
 
@@ -959,12 +970,6 @@
      ENDIF
                                               
-!---------
-!117 format means: X bound1 bound2
-!with X=T/S/D/Z for Temperature/Salinity/Density/Depth classes
-!or   X=N if there is No class 
-!or   X=total/ice_surf/ice_vol
 118 FORMAT(I8,1X,I8,1X,I4,1X,A30,1X,f9.2,1X,I4,3X,A8,1X,2F12.4,5X,3F12.4)
 119 FORMAT(I8,1X,I8,1X,I4,1X,A30,1X,f9.2,1X,I4,3X,A8,1X,2F12.4,5X,3E15.6)
-!---------
 
   END SUBROUTINE dia_dct_wri
@@ -973,6 +978,27 @@
   !!----------------------------------------------------------------------
   !!
+  !!   Purpose: compute Temperature/Salinity/density on U-point or V-point
   !!
-  !!
+  !!    |    I       |    I+1     |
+  !!    |            |            |
+  !!  --------------------------------     1.Compute Tbis:
+  !!    |            |            |          interpolate T(I,J,K) et T(I,J,K+1)
+  !!    |            |            |
+  !!    |            |            |        2. 1.Compute Temp/Salt/Rho à U point: 
+  !! K  |    T       |            |          interpolate Tbis et T(I+U,J,K+1)  
+  !!    |            |            |
+  !!    |            |            |
+  !!    |            |            |
+  !!  --------------------------------
+  !!    |            |            |
+  !!    |            |            |
+  !!    |            |            |
+  !!K+1 |    Tbis    U     T      |
+  !!    |            |            |
+  !!    |    T       |            |
+  !!    |            |------------|
+  !!    |            | partials   |
+  !!    |            |  steps     |
+  !!  --------------------------------
   !!
   !!----------------------------------------------------------------------
