New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 3602 for branches/2012/dev_UKMO_2012/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90 – NEMO

Ignore:
Timestamp:
2012-11-19T15:13:26+01:00 (11 years ago)
Author:
rfurner
Message:

Changes from dev_r3452_UKMO2_DIADCT, revision 3452 to 3530 merged in

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2012/dev_UKMO_2012/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90

    r3601 r3602  
    2121  !!---------------------------------------------------------------------- 
    2222  !!---------------------------------------------------------------------- 
    23   !!   dia_dct      :  compute the transport through a sec. 
    24   !!   dia_dct_init :  read namelist. 
    25   !!   readsec      :  read sections description and pathway 
    26   !!   removepoints :  remove points which are common to 2 procs 
     23  !!   dia_dct      :  Compute the transport through a sec. 
     24  !!   dia_dct_init :  Read namelist. 
     25  !!   readsec      :  Read sections description and pathway 
     26  !!   removepoints :  Remove points which are common to 2 procs 
    2727  !!   transport    :  Compute transport for each sections 
    28   !!   dia_dct_wri  :  write tranports results in ascii files 
    29   !!   interp       :  compute Temperature/Salinity/density on U-point or V-point 
     28  !!   dia_dct_wri  :  Write tranports results in ascii files 
     29  !!   interp       :  Compute temperature/salinity/density at U-point or V-point 
    3030  !!    
    3131  !!---------------------------------------------------------------------- 
     
    5252 
    5353  !! * Routine accessibility 
    54   PUBLIC   dia_dct     ! routine called by step.F90 
    55   PUBLIC   dia_dct_init! routine called by opa.F90 
     54  PUBLIC   dia_dct      ! routine called by step.F90 
     55  PUBLIC   dia_dct_init ! routine called by opa.F90 
     56  PUBLIC   diadct_alloc ! routine called by nemo_init in nemogcm.F90  
    5657  PRIVATE  readsec 
    5758  PRIVATE  removepoints 
     
    7273  INTEGER, PARAMETER :: nb_sec_max    = 150 
    7374  INTEGER, PARAMETER :: nb_point_max  = 2000 
    74   INTEGER, PARAMETER :: nb_type_class = 14 
     75  INTEGER, PARAMETER :: nb_type_class = 10 
     76  INTEGER, PARAMETER :: nb_3d_vars    = 3  
     77  INTEGER, PARAMETER :: nb_2d_vars    = 2  
    7578  INTEGER            :: nb_sec  
    7679 
     
    9295     INTEGER                                      :: nb_class          ! number of boundaries for density classes 
    9396     INTEGER, DIMENSION(nb_point_max)             :: direction         ! vector direction of the point in the section 
    94      CHARACTER(len=40),DIMENSION(nb_class_max)    :: classname         ! caracteristics of the class 
     97     CHARACTER(len=40),DIMENSION(nb_class_max)    :: classname         ! characteristics of the class 
    9598     REAL(wp), DIMENSION(nb_class_max)            :: zsigi           ,&! in-situ   density classes    (99 if you don't want) 
    9699                                                     zsigp           ,&! potential density classes    (99 if you don't want) 
     
    106109  TYPE(SECTION),DIMENSION(nb_sec_max) :: secs ! Array of sections 
    107110  
    108   
     111  REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::  transports_3d  
     112  REAL(wp), ALLOCATABLE, DIMENSION(:,:,:)   ::  transports_2d   
     113 
    109114CONTAINS 
     115 
     116  
     117  INTEGER FUNCTION diadct_alloc()  
     118     !!----------------------------------------------------------------------  
     119     !!                   ***  FUNCTION diadct_alloc  ***  
     120     !!----------------------------------------------------------------------  
     121     INTEGER :: ierr(2)  
     122     !!----------------------------------------------------------------------  
     123 
     124     ALLOCATE(transports_3d(nb_3d_vars,nb_sec_max,nb_point_max,jpk), STAT=ierr(1) )  
     125     ALLOCATE(transports_2d(nb_2d_vars,nb_sec_max,nb_point_max)    , STAT=ierr(2) )  
     126 
     127     diadct_alloc = MAXVAL( ierr )  
     128     IF( diadct_alloc /= 0 )   CALL ctl_warn('diadct_alloc: failed to allocate arrays')  
     129  
     130  END FUNCTION diadct_alloc  
    110131 
    111132  SUBROUTINE dia_dct_init 
     
    113134     !!               ***  ROUTINE diadct  ***   
    114135     !! 
    115      !!  ** Purpose: Read the namelist parametres 
     136     !!  ** Purpose: Read the namelist parameters 
    116137     !!              Open output files 
    117138     !! 
     
    154175     ENDIF 
    155176 
     177     ! Initialise arrays to zero  
     178     transports_3d(:,:,:,:)=0.0  
     179     transports_2d(:,:,:)  =0.0  
     180 
    156181     IF( nn_timing == 1 )   CALL timing_stop('dia_dct_init') 
    157182     ! 
     
    163188     !!               ***  ROUTINE diadct  ***   
    164189     !! 
    165      !!  ** Purpose: Compute sections tranport and write it in numdct file 
     190     !!  Purpose :: Compute section transports and write it in numdct files  
     191     !!    
     192     !!  Method  :: All arrays initialised to zero in dct_init  
     193     !!             Each nn_dct time step call subroutine 'transports' for  
     194     !!               each section to sum the transports over each grid cell.  
     195     !!             Each nn_dctwri time step:  
     196     !!               Divide the arrays by the number of summations to gain  
     197     !!               an average value  
     198     !!               Call dia_dct_sum to sum relevant grid boxes to obtain  
     199     !!               totals for each class (density, depth, temp or sal)  
     200     !!               Call dia_dct_wri to write the transports into file  
     201     !!               Reinitialise all relevant arrays to zero  
    166202     !!--------------------------------------------------------------------- 
    167203     !! * Arguments 
     
    170206     !! * Local variables 
    171207     INTEGER             :: jsec,            &! loop on sections 
    172                             iost,            &! error for opening fileout 
    173208                            itotal            ! nb_sec_max*nb_type_class*nb_class_max 
    174209     LOGICAL             :: lldebug =.FALSE.  ! debug a section   
    175      CHARACTER(len=160)  :: clfileout         ! fileout name 
    176  
    177210      
    178211     INTEGER , DIMENSION(1)             :: ish   ! tmp array for mpp_sum 
     
    190223     ENDIF     
    191224  
     225     ! Initialise arrays 
     226     zwork(:) = 0.0  
     227     zsum(:,:,:) = 0.0 
     228 
    192229     IF( lwp .AND. kt==nit000+nn_dct-1 ) THEN 
    193230         WRITE(numout,*) " " 
     
    208245 
    209246           !Compute transport through section   
    210            CALL transport(secs(jsec),lldebug)  
     247           CALL transport(secs(jsec),lldebug,jsec)  
    211248 
    212249        ENDDO 
     
    214251        IF( MOD(kt,nn_dctwri)==0 )THEN 
    215252 
    216            IF( lwp .AND. kt==nit000+nn_dctwri-1 )WRITE(numout,*)"      diadct: write at kt = ",kt          
     253           IF( lwp .AND. kt==nit000+nn_dctwri-1 )WRITE(numout,*)"      diadct: average transports and write at kt = ",kt          
    217254   
     255           !! divide arrays by nn_dctwri/nn_dct to obtain average  
     256           transports_3d(:,:,:,:)=transports_3d(:,:,:,:)/(nn_dctwri/nn_dct)  
     257           transports_2d(:,:,:)  =transports_2d(:,:,:)  /(nn_dctwri/nn_dct)  
     258  
     259           ! Sum over each class  
     260           DO jsec=1,nb_sec  
     261              CALL dia_dct_sum(secs(jsec),jsec)  
     262           ENDDO  
     263 
    218264           !Sum on all procs  
    219265           IF( lk_mpp )THEN 
     
    233279             
    234280              !nullify transports values after writing 
     281              transports_3d(:,jsec,:,:)=0. 
     282              transports_2d(:,jsec,:  )=0. 
    235283              secs(jsec)%transport(:,:)=0.   
    236284 
     
    265313     INTEGER :: isec, iiglo, ijglo, iiloc, ijloc,iost,i1 ,i2  ! temporary  integer 
    266314     INTEGER :: jsec, jpt                                     ! dummy loop indices 
    267                                                               ! heat/salt tranport is actived 
    268315 
    269316     INTEGER, DIMENSION(2) :: icoord  
     
    457504     !!             *** function removepoints 
    458505     !! 
    459      !!   ** Purpose :: 
    460      !!              remove points which are common to 2 procs 
    461      !! 
     506     !!   ** Purpose :: Remove points which are common to 2 procs 
    462507     !! 
    463508     !---------------------------------------------------------------------------- 
     
    535580  END SUBROUTINE removepoints 
    536581 
    537   SUBROUTINE transport(sec,ld_debug) 
     582  SUBROUTINE transport(sec,ld_debug,jsec) 
    538583     !!------------------------------------------------------------------------------------------- 
    539584     !!                     ***  ROUTINE transport  *** 
    540585     !! 
    541      !!  ** Purpose : Compute the transport through a section 
    542      !! 
    543      !!  ** Method  :Transport through a given section is equal to the sum of transports 
    544      !!              computed on each proc. 
    545      !!              On each proc,transport is equal to the sum of transport computed through 
    546      !!               segments linking each point of sec%listPoint  with the next one.    
    547      !! 
    548      !!              !BE carefull :           
    549      !!              one section is a sum of segments 
    550      !!              one segment is defined by 2 consectuve points in sec%listPoint 
    551      !!              all points of sec%listPoint are positioned on the F-point of the cell.  
     586     !!  Purpose ::  Compute the transport for each point in a section  
    552587     !!  
    553      !!              There are several loops:                  
    554      !!              loop on the density/temperature/salinity/level classes 
    555      !!              loop on the segment between 2 nodes 
    556      !!              loop on the level jk 
    557      !!              test on the density/temperature/salinity/level 
    558      !! 
    559      !! ** Output: sec%transport: volume/mass/ice/heat/salt transport in the 2 directions 
    560      !! 
     588     !!  Method  ::  Loop over each segment, and each vertical level and add the transport  
     589     !!              Be aware :            
     590     !!              One section is a sum of segments  
     591     !!              One segment is defined by 2 consecutive points in sec%listPoint  
     592     !!              All points of sec%listPoint are positioned on the F-point of the cell  
     593     !!  
     594     !!              There are two loops:                   
     595     !!              loop on the segment between 2 nodes  
     596     !!              loop on the level jk !! 
     597     !!  
     598     !!  Output  ::  Arrays containing the volume,density,heat,salt transports for each i 
     599     !!              point in a section, summed over each nn_dct.  
    561600     !! 
    562601     !!------------------------------------------------------------------------------------------- 
     
    564603     TYPE(SECTION),INTENT(INOUT) :: sec 
    565604     LOGICAL      ,INTENT(IN)    :: ld_debug 
     605     INTEGER      ,INTENT(IN)    :: jsec        ! numeric identifier of section 
    566606     
    567607     !! * Local variables 
    568      INTEGER             :: jk,jseg,jclass,   &!loop on level/segment/classes  
    569                             isgnu  , isgnv     ! 
    570      INTEGER :: ii, ij ! local integer 
    571      REAL(wp):: zumid        , zvmid        ,&!U/V velocity on a cell segment 
    572                 zumid_ice    , zvmid_ice    ,&!U/V ice velocity 
    573                 zTnorm                      ,&!transport of velocity through one cell's sides 
    574                 ztransp1     , ztransp2     ,&!total        transport in directions 1 and 2 
    575                 ztemp1       , ztemp2       ,&!temperature  transport     " 
    576                 zrhoi1       , zrhoi2       ,&!mass         transport     " 
    577                 zrhop1       , zrhop2       ,&!mass         transport     " 
    578                 zsal1        , zsal2        ,&!salinity     transport     " 
    579                 zice_vol_pos , zice_vol_neg ,&!volume  ice  transport     " 
    580                 zice_surf_pos, zice_surf_neg  !surface ice  transport     " 
    581      REAL(wp):: ztn, zsn, zrhoi, zrhop, zsshn, zfsdep ! temperature/salinity/ssh/potential density /depth at u/v point 
     608     INTEGER             :: jk, jseg, jclass,                    &!loop on level/segment/classes   
     609                            isgnu, isgnv                          !  
     610     REAL(wp)            :: zumid, zvmid,                        &!U/V velocity on a cell segment  
     611                            zumid_ice, zvmid_ice,                &!U/V ice velocity  
     612                            zTnorm                                !transport of velocity through one cell's sides  
     613     REAL(wp)            :: ztn, zsn, zrhoi, zrhop, zsshn, zfsdep !temperature/salinity/potential density/ssh/depth at u/v point 
    582614 
    583615     TYPE(POINT_SECTION) :: k 
    584      REAL(wp), POINTER, DIMENSION(:,:):: zsum ! 2D work array 
    585616     !!-------------------------------------------------------- 
    586      CALL wrk_alloc( nb_type_class , nb_class_max , zsum   ) 
    587617 
    588618     IF( ld_debug )WRITE(numout,*)'      Compute transport' 
    589  
    590      !----------------! 
    591      ! INITIALIZATION ! 
    592      !----------------! 
    593      zsum    = 0._wp 
    594      zice_surf_neg = 0._wp ; zice_surf_pos = 0._wp 
    595      zice_vol_pos  = 0._wp ; zice_vol_neg  = 0._wp 
    596619 
    597620     !---------------------------! 
     
    670693           END SELECT 
    671694 
    672            !------------------------------- 
    673            !  LOOP ON THE DENSITY CLASSES | 
    674            !------------------------------- 
    675            !The computation is made for each density class 
    676            DO jclass=1,MAX(1,sec%nb_class-1) 
    677  
    678               ztransp1=0._wp ; zrhoi1=0._wp ; zrhop1=0._wp ; ztemp1=0._wp ;zsal1=0._wp 
    679               ztransp2=0._wp ; zrhoi2=0._wp ; zrhop2=0._wp ; ztemp2=0._wp ;zsal2=0._wp 
    680      
    681               !---------------------------| 
    682               !     LOOP ON THE LEVEL     | 
    683               !---------------------------| 
    684               !Sum of the transport on the vertical  
    685               DO jk=1,jpk 
    686                      
    687  
    688                  ! compute temparature, salinity, insitu & potential density, ssh and depth at U/V point 
    689                  SELECT CASE( sec%direction(jseg) ) 
    690                  CASE(0,1) 
    691                     ztn   = interp(k%I,k%J,jk,'V',tsn(:,:,:,jp_tem) ) 
    692                     zsn   = interp(k%I,k%J,jk,'V',tsn(:,:,:,jp_sal) ) 
    693                     zrhop = interp(k%I,k%J,jk,'V',rhop) 
    694                     zrhoi = interp(k%I,k%J,jk,'V',rhd*rau0+rau0) 
    695                     zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I,k%J+1)    ) * vmask(k%I,k%J,1) 
    696                  CASE(2,3) 
    697                     ztn   = interp(k%I,k%J,jk,'U',tsn(:,:,:,jp_tem) ) 
    698                     zsn   = interp(k%I,k%J,jk,'U',tsn(:,:,:,jp_sal) ) 
    699                     zrhop = interp(k%I,k%J,jk,'U',rhop) 
    700                     zrhoi = interp(k%I,k%J,jk,'U',rhd*rau0+rau0) 
    701                     zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I+1,k%J)    ) * umask(k%I,k%J,1)  
    702                  END SELECT 
    703  
    704                  zfsdep= gdept(k%I,k%J,jk) 
    705   
    706                  !----------------------------------------------! 
    707                  !TEST ON THE DENSITY/SALINITY/TEMPERATURE/LEVEL!  
    708                  !----------------------------------------------! 
    709   
    710                  IF ( (    ((( zrhop .GE. (sec%zsigp(jclass)+1000.  )) .AND.    & 
    711                            (   zrhop .LE. (sec%zsigp(jclass+1)+1000. ))) .OR.    & 
    712                            ( sec%zsigp(jclass) .EQ. 99.)) .AND.                 & 
    713                            ((( zrhoi .GE. (sec%zsigi(jclass) + 1000.  )) .AND.    & 
    714                            (   zrhoi .LE. (sec%zsigi(jclass+1)+1000. ))) .OR.    & 
    715                            ( sec%zsigi(jclass) .EQ. 99.)) .AND.                 & 
    716                            ((( zsn .GT. sec%zsal(jclass)) .AND.                & 
    717                            (   zsn .LE. sec%zsal(jclass+1))) .OR.              & 
    718                            ( sec%zsal(jclass) .EQ. 99.)) .AND.                 & 
    719                            ((( ztn .GE. sec%ztem(jclass)) .AND.                & 
    720                            (   ztn .LE. sec%ztem(jclass+1))) .OR.              & 
    721                            ( sec%ztem(jclass) .EQ.99.)) .AND.                  & 
    722                            ((( zfsdep .GE. sec%zlay(jclass)) .AND.            & 
    723                            (   zfsdep .LE. sec%zlay(jclass+1))) .OR.          & 
    724                            ( sec%zlay(jclass) .EQ. 99. ))))   THEN 
    725  
    726  
    727                     !compute velocity with the correct direction 
    728                     SELECT CASE( sec%direction(jseg) ) 
    729                     CASE(0,1)   
    730                        zumid=0. 
    731                        zvmid=isgnv*vn(k%I,k%J,jk)*vmask(k%I,k%J,jk) 
    732                     CASE(2,3) 
    733                        zumid=isgnu*un(k%I,k%J,jk)*umask(k%I,k%J,jk) 
    734                        zvmid=0. 
    735                     END SELECT 
    736  
    737                     !velocity* cell's length * cell's thickness 
    738                     zTnorm=zumid*e2u(k%I,k%J)*  fse3u(k%I,k%J,jk)+     & 
    739                            zvmid*e1v(k%I,k%J)*  fse3v(k%I,k%J,jk) 
     695           !---------------------------|  
     696           !     LOOP ON THE LEVEL     |  
     697           !---------------------------|  
     698           !Sum of the transport on the vertical   
     699           DO jk=1,mbathy(k%I,k%J)  
     700  
     701              ! compute temperature, salinity, insitu & potential density, ssh and depth at U/V point  
     702              SELECT CASE( sec%direction(jseg) )  
     703              CASE(0,1)  
     704                 ztn   = interp(k%I,k%J,jk,'V',tsn(:,:,:,jp_tem) )  
     705                 zsn   = interp(k%I,k%J,jk,'V',tsn(:,:,:,jp_sal) )  
     706                 zrhop = interp(k%I,k%J,jk,'V',rhop)  
     707                 zrhoi = interp(k%I,k%J,jk,'V',rhd*rau0+rau0)  
     708                 zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I,k%J+1)    ) * vmask(k%I,k%J,1)  
     709              CASE(2,3)  
     710                 ztn   = interp(k%I,k%J,jk,'U',tsn(:,:,:,jp_tem) )  
     711                 zsn   = interp(k%I,k%J,jk,'U',tsn(:,:,:,jp_sal) )  
     712                 zrhop = interp(k%I,k%J,jk,'U',rhop)  
     713                 zrhoi = interp(k%I,k%J,jk,'U',rhd*rau0+rau0)  
     714                 zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I+1,k%J)    ) * umask(k%I,k%J,1)   
     715              END SELECT  
     716  
     717              zfsdep= gdept(k%I,k%J,jk)  
     718   
     719              !compute velocity with the correct direction  
     720              SELECT CASE( sec%direction(jseg) )  
     721              CASE(0,1)    
     722                 zumid=0.  
     723                 zvmid=isgnv*vn(k%I,k%J,jk)*vmask(k%I,k%J,jk)  
     724              CASE(2,3)  
     725                 zumid=isgnu*un(k%I,k%J,jk)*umask(k%I,k%J,jk)  
     726                 zvmid=0.  
     727              END SELECT  
     728  
     729              !zTnorm=transport through one cell;  
     730              !velocity* cell's length * cell's thickness  
     731              zTnorm=zumid*e2u(k%I,k%J)*  fse3u(k%I,k%J,jk)+     &  
     732                     zvmid*e1v(k%I,k%J)*  fse3v(k%I,k%J,jk)  
    740733 
    741734#if ! defined key_vvl 
    742                     !add transport due to free surface 
    743                     IF( jk==1 )THEN 
    744                        zTnorm = zTnorm + zumid* e2u(k%I,k%J) * zsshn * umask(k%I,k%J,jk) + & 
    745                                          zvmid* e1v(k%I,k%J) * zsshn * vmask(k%I,k%J,jk) 
    746                     ENDIF 
     735              !add transport due to free surface  
     736              IF( jk==1 )THEN  
     737                 zTnorm = zTnorm + zumid* e2u(k%I,k%J) * zsshn * umask(k%I,k%J,jk) + &  
     738                                   zvmid* e1v(k%I,k%J) * zsshn * vmask(k%I,k%J,jk)  
     739              ENDIF  
    747740#endif 
    748                     !COMPUTE TRANSPORT  
    749                     !zTnorm=transport through one cell for one class 
    750                     !ztransp1 or ztransp2=transport through one cell i 
    751                     !                     for one class for one direction 
    752                     IF( zTnorm .GE. 0 )THEN 
    753  
    754                        ztransp1=zTnorm+ztransp1 
    755   
    756                        IF ( sec%llstrpond ) THEN 
    757                           ztemp1 = ztemp1  + zTnorm * ztn  
    758                           zsal1  = zsal1   + zTnorm * zsn 
    759                           zrhoi1 = zrhoi1  + zTnorm * zrhoi 
    760                           zrhop1 = zrhop1  + zTnorm * zrhop 
    761                        ENDIF 
    762  
    763                     ELSE 
    764  
    765                        ztransp2=(zTnorm)+ztransp2 
    766  
    767                        IF ( sec%llstrpond ) THEN 
    768                           ztemp2 = ztemp2  + zTnorm * ztn  
    769                           zsal2  = zsal2   + zTnorm * zsn 
    770                           zrhoi2 = zrhoi2  + zTnorm * zrhoi 
    771                           zrhop2 = zrhop2  + zTnorm * zrhop 
    772                        ENDIF 
    773                     ENDIF 
    774   
    775              
    776                  ENDIF ! end of density test 
    777               ENDDO!end of loop on the level 
    778  
    779               !ZSUM=TRANSPORT FOR EACH CLASSES FOR THE  DIRECTIONS 
    780               !--------------------------------------------------- 
    781               zsum(1,jclass)     = zsum(1,jclass)+ztransp1 
    782               zsum(2,jclass)     = zsum(2,jclass)+ztransp2 
    783               IF( sec%llstrpond )THEN 
    784                  zsum(3 ,jclass) = zsum( 3,jclass)+zrhoi1 
    785                  zsum(4 ,jclass) = zsum( 4,jclass)+zrhoi2 
    786                  zsum(5 ,jclass) = zsum( 5,jclass)+zrhop1 
    787                  zsum(6 ,jclass) = zsum( 6,jclass)+zrhop2 
    788                  zsum(7 ,jclass) = zsum( 7,jclass)+ztemp1 
    789                  zsum(8 ,jclass) = zsum( 8,jclass)+ztemp2 
    790                  zsum(9 ,jclass) = zsum( 9,jclass)+zsal1 
    791                  zsum(10,jclass) = zsum(10,jclass)+zsal2 
     741              !COMPUTE TRANSPORT   
     742  
     743              transports_3d(1,jsec,jseg,jk) = transports_3d(1,jsec,jseg,jk) + zTnorm  
     744   
     745              IF ( sec%llstrpond ) THEN  
     746                 transports_3d(2,jsec,jseg,jk) = transports_3d(2,jsec,jseg,jk)  + zTnorm * ztn * zrhop * rcp 
     747                 transports_3d(3,jsec,jseg,jk) = transports_3d(3,jsec,jseg,jk)  + zTnorm * zsn * zrhop * 0.001 
    792748              ENDIF 
    793749    
    794            ENDDO !end of loop on the density classes 
     750           ENDDO !end of loop on the level 
    795751 
    796752#if defined key_lim2 || defined key_lim3 
     
    816772              zTnorm=zumid_ice*e2u(k%I,k%J)+zvmid_ice*e1v(k%I,k%J) 
    817773    
    818               IF( zTnorm .GE. 0)THEN 
    819                  zice_vol_pos = (zTnorm)*   & 
    820                                       (1.0 - frld(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J))  & 
    821                                      *(hsnif(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J) +  & 
    822                                        hicif(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J)) & 
    823                                       +zice_vol_pos 
    824                  zice_surf_pos = (zTnorm)*   & 
    825                                        (1.0 -  frld(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J))  & 
    826                                       +zice_surf_pos 
    827               ELSE 
    828                  zice_vol_neg=(zTnorm)*   & 
    829                                    (1.0 - frld(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J))  & 
    830                                   *(hsnif(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J) +  & 
    831                                     hicif(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J)) & 
    832                                   +zice_vol_neg 
    833                  zice_surf_neg=(zTnorm)*   & 
    834                                     (1.0 - frld(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J))  & 
    835                                      +zice_surf_neg 
    836               ENDIF 
    837     
    838               zsum(11,1) = zsum(11,1)+zice_vol_pos 
    839               zsum(12,1) = zsum(12,1)+zice_vol_neg 
    840               zsum(13,1) = zsum(13,1)+zice_surf_pos 
    841               zsum(14,1) = zsum(14,1)+zice_surf_neg 
     774              transports_2d(1,jsec,jseg) = transports_2d(1,jsec,jseg) + (zTnorm)*   &  
     775                                   (1.0 - frld(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J))  &  
     776                                  *(hsnif(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J) +  &  
     777                                    hicif(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J)) 
     778              transports_2d(2,jsec,jseg) = transports_2d(2,jsec,jseg) + (zTnorm)*   &  
     779                                    (1.0 -  frld(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J)) 
    842780    
    843781           ENDIF !end of ice case 
     
    846784        ENDDO !end of loop on the segment 
    847785 
    848  
    849      ELSE  !if sec%nb_point =0 
    850         zsum(1:2,:)=0. 
    851         IF (sec%llstrpond) zsum(3:10,:)=0. 
    852         zsum( 11:14,:)=0. 
    853      ENDIF   !end of sec%nb_point =0 case 
    854  
    855      !-------------------------------| 
    856      !FINISH COMPUTING TRANSPORTS    | 
    857      !-------------------------------| 
    858      DO jclass=1,MAX(1,sec%nb_class-1) 
    859         sec%transport(1,jclass)=sec%transport(1,jclass)+zsum(1,jclass)*1.E-6 
    860         sec%transport(2,jclass)=sec%transport(2,jclass)+zsum(2,jclass)*1.E-6 
    861         IF( sec%llstrpond ) THEN 
    862            IF( zsum(1,jclass) .NE. 0._wp ) THEN 
    863               sec%transport( 3,jclass) = sec%transport( 3,jclass) + zsum( 3,jclass)/zsum(1,jclass) 
    864               sec%transport( 5,jclass) = sec%transport( 5,jclass) + zsum( 5,jclass)/zsum(1,jclass) 
    865               sec%transport( 7,jclass) = sec%transport( 7,jclass) + zsum( 7,jclass) 
    866               sec%transport( 9,jclass) = sec%transport( 9,jclass) + zsum( 9,jclass) 
    867            ENDIF 
    868            IF( zsum(2,jclass) .NE. 0._wp )THEN 
    869               sec%transport( 4,jclass) = sec%transport( 4,jclass) + zsum( 4,jclass)/zsum(2,jclass) 
    870               sec%transport( 6,jclass) = sec%transport( 6,jclass) + zsum( 6,jclass)/zsum(2,jclass) 
    871               sec%transport( 8,jclass) = sec%transport( 8,jclass) + zsum( 8,jclass) 
    872               sec%transport(10,jclass) = sec%transport(10,jclass) + zsum(10,jclass) 
    873            ENDIF 
    874         ELSE 
    875            sec%transport( 3,jclass) = 0._wp 
    876            sec%transport( 4,jclass) = 0._wp 
    877            sec%transport( 5,jclass) = 0._wp 
    878            sec%transport( 6,jclass) = 0._wp 
    879            sec%transport( 7,jclass) = 0._wp 
    880            sec%transport( 8,jclass) = 0._wp 
    881            sec%transport(10,jclass) = 0._wp 
    882         ENDIF 
    883      ENDDO    
    884  
    885      IF( sec%ll_ice_section ) THEN 
    886         sec%transport( 9,1)=sec%transport( 9,1)+zsum( 9,1)*1.E-6 
    887         sec%transport(10,1)=sec%transport(10,1)+zsum(10,1)*1.E-6 
    888         sec%transport(11,1)=sec%transport(11,1)+zsum(11,1)*1.E-6 
    889         sec%transport(12,1)=sec%transport(12,1)+zsum(12,1)*1.E-6 
    890      ENDIF 
    891  
    892      CALL wrk_dealloc( nb_type_class , nb_class_max , zsum   ) 
     786     ENDIF !end of sec%nb_point =0 case 
    893787     ! 
    894788  END SUBROUTINE transport 
     789   
     790  SUBROUTINE dia_dct_sum(sec,jsec)  
     791     !!-------------------------------------------------------------  
     792     !! Purpose: Average the transport over nn_dctwri time steps   
     793     !! and sum over the density/salinity/temperature/depth classes  
     794     !!  
     795     !! Method:   Sum over relevant grid cells to obtain values   
     796     !!           for each class 
     797     !!              There are several loops:                   
     798     !!              loop on the segment between 2 nodes  
     799     !!              loop on the level jk  
     800     !!              loop on the density/temperature/salinity/level classes  
     801     !!              test on the density/temperature/salinity/level  
     802     !!  
     803     !!  Note:    Transport through a given section is equal to the sum of transports  
     804     !!           computed on each proc.  
     805     !!           On each proc,transport is equal to the sum of transport computed through  
     806     !!           segments linking each point of sec%listPoint  with the next one.     
     807     !!  
     808     !!-------------------------------------------------------------  
     809     !! * arguments  
     810     TYPE(SECTION),INTENT(INOUT) :: sec  
     811     INTEGER      ,INTENT(IN)    :: jsec        ! numeric identifier of section  
     812  
     813     TYPE(POINT_SECTION) :: k  
     814     INTEGER  :: jk,jseg,jclass                        ! dummy variables for looping on level/segment/classes   
     815     REAL(wp) :: ztn, zsn, zrhoi, zrhop, zsshn, zfsdep ! temperature/salinity/ssh/potential density /depth at u/v point  
     816     !!-------------------------------------------------------------  
     817  
     818     !! Sum the relevant segments to obtain values for each class  
     819     IF(sec%nb_point .NE. 0)THEN     
     820  
     821        !--------------------------------------!  
     822        ! LOOP ON THE SEGMENT BETWEEN 2 NODES  !  
     823        !--------------------------------------!  
     824        DO jseg=1,MAX(sec%nb_point-1,0)  
     825             
     826           !-------------------------------------------------------------------------------------------  
     827           ! Select the appropriate coordinate for computing the velocity of the segment  
     828           !  
     829           !                      CASE(0)                                    Case (2)  
     830           !                      -------                                    --------  
     831           !  listPoint(jseg)                 listPoint(jseg+1)       listPoint(jseg)  F(i,j)        
     832           !      F(i,j)----------V(i+1,j)-------F(i+1,j)                               |  
     833           !                                                                            |  
     834           !                                                                            |  
     835           !                                                                            |  
     836           !                      Case (3)                                            U(i,j)  
     837           !                      --------                                              |  
     838           !                                                                            |  
     839           !  listPoint(jseg+1) F(i,j+1)                                                |  
     840           !                        |                                                   |  
     841           !                        |                                                   |  
     842           !                        |                                 listPoint(jseg+1) F(i,j-1)  
     843           !                        |                                              
     844           !                        |                                              
     845           !                     U(i,j+1)                                              
     846           !                        |                                       Case(1)       
     847           !                        |                                       ------        
     848           !                        |                                              
     849           !                        |                 listPoint(jseg+1)             listPoint(jseg)                             
     850           !                        |                 F(i-1,j)-----------V(i,j) -------f(jseg)                             
     851           ! listPoint(jseg)     F(i,j)  
     852           !   
     853           !-------------------------------------------------------------------------------------------  
     854  
     855           SELECT CASE( sec%direction(jseg) )  
     856           CASE(0)  ;   k = sec%listPoint(jseg)  
     857           CASE(1)  ;   k = POINT_SECTION(sec%listPoint(jseg)%I+1,sec%listPoint(jseg)%J)  
     858           CASE(2)  ;   k = sec%listPoint(jseg)  
     859           CASE(3)  ;   k = POINT_SECTION(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J+1)  
     860           END SELECT  
     861  
     862           !---------------------------|  
     863           !     LOOP ON THE LEVEL     |  
     864           !---------------------------|  
     865           !Sum of the transport on the vertical   
     866           DO jk=1,mbathy(k%I,k%J)  
     867  
     868              ! compute temperature, salinity, insitu & potential density, ssh and depth at U/V point  
     869              SELECT CASE( sec%direction(jseg) )  
     870              CASE(0,1)  
     871                 ztn   = interp(k%I,k%J,jk,'V',tsn(:,:,:,jp_tem) )  
     872                 zsn   = interp(k%I,k%J,jk,'V',tsn(:,:,:,jp_sal) )  
     873                 zrhop = interp(k%I,k%J,jk,'V',rhop)  
     874                 zrhoi = interp(k%I,k%J,jk,'V',rhd*rau0+rau0)  
     875 
     876              CASE(2,3)  
     877                 ztn   = interp(k%I,k%J,jk,'U',tsn(:,:,:,jp_tem) )  
     878                 zsn   = interp(k%I,k%J,jk,'U',tsn(:,:,:,jp_sal) )  
     879                 zrhop = interp(k%I,k%J,jk,'U',rhop)  
     880                 zrhoi = interp(k%I,k%J,jk,'U',rhd*rau0+rau0)  
     881                 zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I+1,k%J)    ) * umask(k%I,k%J,1)   
     882              END SELECT  
     883  
     884              zfsdep= gdept(k%I,k%J,jk)  
     885   
     886              !-------------------------------  
     887              !  LOOP ON THE DENSITY CLASSES |  
     888              !-------------------------------  
     889              !The computation is made for each density/temperature/salinity/depth class  
     890              DO jclass=1,MAX(1,sec%nb_class-1)  
     891  
     892                 !----------------------------------------------!  
     893                 !TEST ON THE DENSITY/SALINITY/TEMPERATURE/LEVEL!   
     894                 !----------------------------------------------!  
     895 
     896                 IF ( (                                                    &  
     897                    ((( zrhop .GE. (sec%zsigp(jclass)+1000.  )) .AND.      &  
     898                    (   zrhop .LE. (sec%zsigp(jclass+1)+1000. ))) .OR.     &  
     899                    ( sec%zsigp(jclass) .EQ. 99.)) .AND.                   &  
     900  
     901                    ((( zrhoi .GE. (sec%zsigi(jclass) + 1000.  )) .AND.    &  
     902                    (   zrhoi .LE. (sec%zsigi(jclass+1)+1000. ))) .OR.     &  
     903                    ( sec%zsigi(jclass) .EQ. 99.)) .AND.                   &  
     904  
     905                    ((( zsn .GT. sec%zsal(jclass)) .AND.                   &  
     906                    (   zsn .LE. sec%zsal(jclass+1))) .OR.                 &  
     907                    ( sec%zsal(jclass) .EQ. 99.)) .AND.                    &  
     908  
     909                    ((( ztn .GE. sec%ztem(jclass)) .AND.                   &  
     910                    (   ztn .LE. sec%ztem(jclass+1))) .OR.                 &  
     911                    ( sec%ztem(jclass) .EQ.99.)) .AND.                     &  
     912  
     913                    ((( zfsdep .GE. sec%zlay(jclass)) .AND.                &  
     914                    (   zfsdep .LE. sec%zlay(jclass+1))) .OR.              &  
     915                    ( sec%zlay(jclass) .EQ. 99. ))                         &  
     916                                                                   ))   THEN  
     917  
     918                    !SUM THE TRANSPORTS FOR EACH CLASSES FOR THE POSITIVE AND NEGATIVE DIRECTIONS  
     919                    !----------------------------------------------------------------------------  
     920                    IF (transports_3d(1,jsec,jseg,jk) .GE. 0.0) THEN   
     921                       sec%transport(1,jclass) = sec%transport(1,jclass)+transports_3d(1,jsec,jseg,jk)*1.E-6  
     922                    ELSE  
     923                       sec%transport(2,jclass) = sec%transport(2,jclass)+transports_3d(1,jsec,jseg,jk)*1.E-6  
     924                    ENDIF  
     925                    IF( sec%llstrpond )THEN  
     926  
     927                       IF ( transports_3d(2,jsec,jseg,jk) .GE. 0.0 ) THEN  
     928                          sec%transport(3,jclass) = sec%transport(3,jclass)+transports_3d(2,jsec,jseg,jk)  
     929                       ELSE  
     930                          sec%transport(4,jclass) = sec%transport(4,jclass)+transports_3d(2,jsec,jseg,jk)  
     931                       ENDIF  
     932  
     933                       IF ( transports_3d(3,jsec,jseg,jk) .GE. 0.0 ) THEN  
     934                          sec%transport(5,jclass) = sec%transport(5,jclass)+transports_3d(3,jsec,jseg,jk)  
     935                       ELSE  
     936                          sec%transport(6,jclass) = sec%transport(6,jclass)+transports_3d(3,jsec,jseg,jk)  
     937                       ENDIF  
     938  
     939                    ELSE  
     940                       sec%transport( 3,jclass) = 0._wp  
     941                       sec%transport( 4,jclass) = 0._wp  
     942                       sec%transport( 5,jclass) = 0._wp  
     943                       sec%transport( 6,jclass) = 0._wp  
     944                    ENDIF  
     945  
     946                 ENDIF ! end of test if point is in class  
     947     
     948              ENDDO ! end of loop on the classes  
     949  
     950           ENDDO ! loop over jk  
     951  
     952#if defined key_lim2 || defined key_lim3  
     953  
     954           !ICE CASE      
     955           IF( sec%ll_ice_section )THEN  
     956  
     957              IF ( transports_2d(1,jsec,jseg) .GE. 0.0 ) THEN  
     958                 sec%transport( 7,1) = sec%transport( 7,1)+transports_2d(1,jsec,jseg)*1.E-6  
     959              ELSE  
     960                 sec%transport( 8,1) = sec%transport( 8,1)+transports_2d(1,jsec,jseg)*1.E-6  
     961              ENDIF  
     962  
     963              IF ( transports_2d(3,jsec,jseg) .GE. 0.0 ) THEN  
     964                 sec%transport( 9,1) = sec%transport( 9,1)+transports_2d(2,jsec,jseg)*1.E-6  
     965              ELSE  
     966                 sec%transport(10,1) = sec%transport(10,1)+transports_2d(2,jsec,jseg)*1.E-6  
     967              ENDIF  
     968  
     969           ENDIF !end of ice case  
     970#endif  
     971   
     972        ENDDO !end of loop on the segment  
     973  
     974     ELSE  !if sec%nb_point =0  
     975        sec%transport(1:2,:)=0.  
     976        IF (sec%llstrpond) sec%transport(3:6,:)=0.  
     977        IF (sec%ll_ice_section) sec%transport(7:10,:)=0.  
     978     ENDIF !end of sec%nb_point =0 case  
     979  
     980  END SUBROUTINE dia_dct_sum  
    895981   
    896982  SUBROUTINE dia_dct_wri(kt,ksec,sec) 
     
    905991     !!  
    906992     !!        2. Write heat transports in "heat_transport" 
    907      !!           Unit: Peta W : area * Velocity * T * rhau * Cp / 1.e15 
     993     !!           Unit: Peta W : area * Velocity * T * rhop * Cp * 1.e-15 
    908994     !!  
    909995     !!        3. Write salt transports in "salt_transport" 
    910      !!           Unit: 10^9 g m^3 / s : area * Velocity * S / 1.e6 
     996     !!           Unit: 10^9 Kg/m^2/s : area * Velocity * S * rhop * 1.e-9  
    911997     !! 
    912998     !!-------------------------------------------------------------  
     
    9171003 
    9181004     !!local declarations 
    919      INTEGER               :: jcl,ji             ! Dummy loop 
     1005     INTEGER               :: jclass             ! Dummy loop 
    9201006     CHARACTER(len=2)      :: classe             ! Classname  
    9211007     REAL(wp)              :: zbnd1,zbnd2        ! Class bounds 
    9221008     REAL(wp)              :: zslope             ! section's slope coeff 
    9231009     ! 
    924      REAL(wp), POINTER, DIMENSION(:):: zsumclass ! 1D workspace  
     1010     REAL(wp), POINTER, DIMENSION(:):: zsumclasses ! 1D workspace  
    9251011     !!-------------------------------------------------------------  
    926      CALL wrk_alloc(nb_type_class , zsumclass 
    927  
    928      zsumclass(:)=0._wp 
     1012     CALL wrk_alloc(nb_type_class , zsumclasses 
     1013 
     1014     zsumclasses(:)=0._wp 
    9291015     zslope = sec%slopeSection        
    9301016 
    9311017  
    932      DO jcl=1,MAX(1,sec%nb_class-1) 
    933  
    934         ! Mean computation 
    935         sec%transport(:,jcl)=sec%transport(:,jcl)/(nn_dctwri/nn_dct) 
     1018     DO jclass=1,MAX(1,sec%nb_class-1) 
     1019 
    9361020        classe   = 'N       ' 
    9371021        zbnd1   = 0._wp 
    9381022        zbnd2   = 0._wp 
    939         zsumclass(1:nb_type_class)=zsumclass(1:nb_type_class)+sec%transport(1:nb_type_class,jcl) 
     1023        zsumclasses(1:nb_type_class)=zsumclasses(1:nb_type_class)+sec%transport(1:nb_type_class,jclass) 
    9401024 
    9411025    
    9421026        !insitu density classes transports 
    943         IF( ( sec%zsigi(jcl)   .NE. 99._wp ) .AND. & 
    944             ( sec%zsigi(jcl+1) .NE. 99._wp )       )THEN 
     1027        IF( ( sec%zsigi(jclass)   .NE. 99._wp ) .AND. & 
     1028            ( sec%zsigi(jclass+1) .NE. 99._wp )       )THEN 
    9451029           classe = 'DI       ' 
    946            zbnd1 = sec%zsigi(jcl) 
    947            zbnd2 = sec%zsigi(jcl+1) 
     1030           zbnd1 = sec%zsigi(jclass) 
     1031           zbnd2 = sec%zsigi(jclass+1) 
    9481032        ENDIF 
    9491033        !potential density classes transports 
    950         IF( ( sec%zsigp(jcl)   .NE. 99._wp ) .AND. & 
    951             ( sec%zsigp(jcl+1) .NE. 99._wp )       )THEN 
     1034        IF( ( sec%zsigp(jclass)   .NE. 99._wp ) .AND. & 
     1035            ( sec%zsigp(jclass+1) .NE. 99._wp )       )THEN 
    9521036           classe = 'DP      ' 
    953            zbnd1 = sec%zsigp(jcl) 
    954            zbnd2 = sec%zsigp(jcl+1) 
     1037           zbnd1 = sec%zsigp(jclass) 
     1038           zbnd2 = sec%zsigp(jclass+1) 
    9551039        ENDIF 
    9561040        !depth classes transports 
    957         IF( ( sec%zlay(jcl)    .NE. 99._wp ) .AND. & 
    958             ( sec%zlay(jcl+1)  .NE. 99._wp )       )THEN  
     1041        IF( ( sec%zlay(jclass)    .NE. 99._wp ) .AND. & 
     1042            ( sec%zlay(jclass+1)  .NE. 99._wp )       )THEN  
    9591043           classe = 'Z       ' 
    960            zbnd1 = sec%zlay(jcl) 
    961            zbnd2 = sec%zlay(jcl+1) 
     1044           zbnd1 = sec%zlay(jclass) 
     1045           zbnd2 = sec%zlay(jclass+1) 
    9621046        ENDIF 
    9631047        !salinity classes transports 
    964         IF( ( sec%zsal(jcl) .NE. 99._wp    ) .AND. & 
    965             ( sec%zsal(jcl+1) .NE. 99._wp  )       )THEN 
     1048        IF( ( sec%zsal(jclass) .NE. 99._wp    ) .AND. & 
     1049            ( sec%zsal(jclass+1) .NE. 99._wp  )       )THEN 
    9661050           classe = 'S       ' 
    967            zbnd1 = sec%zsal(jcl) 
    968            zbnd2 = sec%zsal(jcl+1)    
     1051           zbnd1 = sec%zsal(jclass) 
     1052           zbnd2 = sec%zsal(jclass+1)    
    9691053        ENDIF 
    9701054        !temperature classes transports 
    971         IF( ( sec%ztem(jcl) .NE. 99._wp     ) .AND. & 
    972             ( sec%ztem(jcl+1) .NE. 99._wp     )       ) THEN 
     1055        IF( ( sec%ztem(jclass) .NE. 99._wp     ) .AND. & 
     1056            ( sec%ztem(jclass+1) .NE. 99._wp     )       ) THEN 
    9731057           classe = 'T       ' 
    974            zbnd1 = sec%ztem(jcl) 
    975            zbnd2 = sec%ztem(jcl+1) 
     1058           zbnd1 = sec%ztem(jclass) 
     1059           zbnd2 = sec%ztem(jclass+1) 
    9761060        ENDIF 
    9771061                   
    9781062        !write volume transport per class 
    9791063        WRITE(numdct_vol,118) ndastp,kt,ksec,sec%name,zslope, & 
    980                               jcl,classe,zbnd1,zbnd2,& 
    981                               sec%transport(1,jcl),sec%transport(2,jcl), & 
    982                               sec%transport(1,jcl)+sec%transport(2,jcl) 
     1064                              jclass,classe,zbnd1,zbnd2,& 
     1065                              sec%transport(1,jclass),sec%transport(2,jclass), & 
     1066                              sec%transport(1,jclass)+sec%transport(2,jclass) 
    9831067 
    9841068        IF( sec%llstrpond )THEN 
     
    9861070           !write heat transport per class: 
    9871071           WRITE(numdct_heat,119) ndastp,kt,ksec,sec%name,zslope,  & 
    988                               jcl,classe,zbnd1,zbnd2,& 
    989                               sec%transport(7,jcl)*1000._wp*rcp/1.e15,sec%transport(8,jcl)*1000._wp*rcp/1.e15, & 
    990                               ( sec%transport(7,jcl)+sec%transport(8,jcl) )*1000._wp*rcp/1.e15 
     1072                              jclass,classe,zbnd1,zbnd2,& 
     1073                              sec%transport(3,jclass)*1.e-15,sec%transport(4,jclass)*1.e-15, & 
     1074                              ( sec%transport(3,jclass)+sec%transport(4,jclass) )*1.e-15 
    9911075           !write salt transport per class 
    9921076           WRITE(numdct_salt,119) ndastp,kt,ksec,sec%name,zslope,  & 
    993                               jcl,classe,zbnd1,zbnd2,& 
    994                               sec%transport(9,jcl)*1000._wp/1.e9,sec%transport(10,jcl)*1000._wp/1.e9,& 
    995                               (sec%transport(9,jcl)+sec%transport(10,jcl))*1000._wp/1.e9 
     1077                              jclass,classe,zbnd1,zbnd2,& 
     1078                              sec%transport(5,jclass)*1.e-9,sec%transport(6,jclass)*1.e-9,& 
     1079                              (sec%transport(5,jclass)+sec%transport(6,jclass))*1.e-9 
    9961080        ENDIF 
    9971081 
     
    10001084     zbnd1 = 0._wp 
    10011085     zbnd2 = 0._wp 
    1002      jcl=0 
     1086     jclass=0 
    10031087 
    10041088     !write total volume transport 
    10051089     WRITE(numdct_vol,118) ndastp,kt,ksec,sec%name,zslope, & 
    1006                            jcl,"total",zbnd1,zbnd2,& 
    1007                            zsumclass(1),zsumclass(2),zsumclass(1)+zsumclass(2) 
     1090                           jclass,"total",zbnd1,zbnd2,& 
     1091                           zsumclasses(1),zsumclasses(2),zsumclasses(1)+zsumclasses(2) 
    10081092 
    10091093     IF( sec%llstrpond )THEN 
     
    10111095        !write total heat transport 
    10121096        WRITE(numdct_heat,119) ndastp,kt,ksec,sec%name,zslope, & 
    1013                            jcl,"total",zbnd1,zbnd2,& 
    1014                            zsumclass(7)* 1000._wp*rcp/1.e15,zsumclass(8)* 1000._wp*rcp/1.e15,& 
    1015                            (zsumclass(7)+zsumclass(8) )* 1000._wp*rcp/1.e15 
     1097                           jclass,"total",zbnd1,zbnd2,& 
     1098                           zsumclasses(3)*1.e-15,zsumclasses(4)*1.e-15,& 
     1099                           (zsumclasses(3)+zsumclasses(4) )*1.e-15 
    10161100        !write total salt transport 
    10171101        WRITE(numdct_salt,119) ndastp,kt,ksec,sec%name,zslope, & 
    1018                            jcl,"total",zbnd1,zbnd2,& 
    1019                            zsumclass(9)*1000._wp/1.e9,zsumclass(10)*1000._wp/1.e9,& 
    1020                            (zsumclass(9)+zsumclass(10))*1000._wp/1.e9 
     1102                           jclass,"total",zbnd1,zbnd2,& 
     1103                           zsumclasses(5)*1.e-9,zsumclasses(6)*1.e-9,& 
     1104                           (zsumclasses(5)+zsumclasses(6))*1.e-9 
    10211105     ENDIF 
    10221106 
     
    10251109        !write total ice volume transport 
    10261110        WRITE(numdct_vol,118) ndastp,kt,ksec,sec%name,zslope,& 
    1027                               jcl,"ice_vol",zbnd1,zbnd2,& 
    1028                               sec%transport(9,1),sec%transport(10,1),& 
    1029                               sec%transport(9,1)+sec%transport(10,1) 
     1111                              jclass,"ice_vol",zbnd1,zbnd2,& 
     1112                              sec%transport(7,1),sec%transport(8,1),& 
     1113                              sec%transport(7,1)+sec%transport(8,1) 
    10301114        !write total ice surface transport 
    10311115        WRITE(numdct_vol,118) ndastp,kt,ksec,sec%name,zslope,& 
    1032                               jcl,"ice_surf",zbnd1,zbnd2,& 
    1033                               sec%transport(11,1),sec%transport(12,1), & 
    1034                               sec%transport(11,1)+sec%transport(12,1)  
     1116                              jclass,"ice_surf",zbnd1,zbnd2,& 
     1117                              sec%transport(9,1),sec%transport(10,1), & 
     1118                              sec%transport(9,1)+sec%transport(10,1)  
    10351119     ENDIF 
    10361120                                               
     
    10381122119 FORMAT(I8,1X,I8,1X,I4,1X,A30,1X,f9.2,1X,I4,3X,A8,1X,2F12.4,5X,3E15.6) 
    10391123 
    1040      CALL wrk_dealloc(nb_type_class , zsumclass 
     1124     CALL wrk_dealloc(nb_type_class , zsumclasses 
    10411125  END SUBROUTINE dia_dct_wri 
    10421126 
     
    10441128  !!---------------------------------------------------------------------- 
    10451129  !! 
    1046   !!   Purpose: compute Temperature/Salinity/density at U-point or V-point 
     1130  !!   Purpose: compute temperature/salinity/density at U-point or V-point 
    10471131  !!   -------- 
    10481132  !! 
     
    10531137  !!  
    10541138  !! 
    1055   !!    |    I          |    I+1           |    Z=Temperature/Salinity/density at U-poinT 
     1139  !!    |    I          |    I+1           |    Z=temperature/salinity/density at U-poinT 
    10561140  !!    |               |                  | 
    1057   !!  ----------------------------------------  1. Veritcale interpolation: compute zbis 
     1141  !!  ----------------------------------------  1. Veritcal interpolation: compute zbis 
    10581142  !!    |               |                  |       interpolation between ptab(I,J,K) and ptab(I,J,K+1) 
    10591143  !!    |               |                  |       zbis =  
     
    11361220     zdep2 = fsdept(ii2,ij2,kk) - zdepu 
    11371221 
    1138      !weights 
     1222     ! weights 
    11391223     zwgt1 = SQRT( ( 0.5 * zet1 ) * ( 0.5 * zet1 ) + ( zdep1 * zdep1 ) ) 
    11401224     zwgt2 = SQRT( ( 0.5 * zet2 ) * ( 0.5 * zet2 ) + ( zdep2 * zdep2 ) ) 
     
    11631247 
    11641248        IF( ze3t >= 0. )THEN  
    1165            !zbis 
     1249           ! zbis 
    11661250           zbis = ptab(ii2,ij2,kk) + zwgt1 * ( ptab(ii2,ij2,kk-1) - ptab(ii2,ij2,kk) )  
    11671251           ! result 
    11681252            interp = umask(ii1,ij1,kk) * ( zet2 * ptab(ii1,ij1,kk) + zet1 * zbis )/( zet1 + zet2 ) 
    11691253        ELSE 
    1170            !zbis 
     1254           ! zbis 
    11711255           zbis = ptab(ii1,ij1,kk) + zwgt2 * ( ptab(ii1,ij1,kk-1) - ptab(ii1,ij2,kk) ) 
    11721256           ! result 
     
    11951279   END SUBROUTINE dia_dct_init 
    11961280 
    1197    SUBROUTINE dia_dct( kt )           ! Dummy routine 
    1198       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index 
     1281   SUBROUTINE dia_dct( kt )         ! Dummy routine 
     1282      INTEGER, INTENT( in ) :: kt   ! ocean time-step index 
    11991283      WRITE(*,*) 'dia_dct: You should not have seen this print! error?', kt 
    12001284   END SUBROUTINE dia_dct 
Note: See TracChangeset for help on using the changeset viewer.