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 15798 – NEMO

Changeset 15798


Ignore:
Timestamp:
2022-04-25T11:40:55+02:00 (2 years ago)
Author:
hadjt
Message:

Updated blankspace and comments

Location:
branches/UKMO/CO6_shelfclimate_fabm_noos/NEMOGCM/NEMO/OPA_SRC
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/CO6_shelfclimate_fabm_noos/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn2d.F90

    r7566 r15798  
    147147      TYPE(OBC_DATA),               INTENT(in) ::   dta  ! OBC external data 
    148148      INTEGER,                      INTENT(in) ::   ib_bdy  ! BDY set index 
    149       REAL(wp), DIMENSION(:,:), INTENT(inout) :: pua2d, pva2d 
    150       REAL(wp), DIMENSION(:,:), INTENT(in) ::   pssh, phur, phvr  
     149      REAL(wp), DIMENSION(:,:), INTENT(inout) :: pua2d, pva2d ! JT After barotropic velocities 
     150      REAL(wp), DIMENSION(:,:), INTENT(in) ::   pssh, phur, phvr ! JT SSH after, and phur, phvr = inverse of depth of water  
    151151 
    152152      INTEGER  ::   jb, igrd                         ! dummy loop indices 
  • branches/UKMO/CO6_shelfclimate_fabm_noos/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90

    r11264 r15798  
    55  !! Ocean diagnostics: Compute the transport trough a sec. 
    66  !!=============================================================== 
    7   !! History :  
     7  !! History : 
    88  !! 
    99  !!         original  : 02/99 (Y Drillet) 
     
    2929  !!   dia_dct_wri  :  Write tranports results in ascii files 
    3030  !!   interp       :  Compute temperature/salinity/density at U-point or V-point 
    31   !!    
     31  !! 
    3232  !!---------------------------------------------------------------------- 
    3333  !! * Modules used 
     
    4949  USE timing          ! preformance summary 
    5050  USE wrk_nemo        ! working arrays 
    51    
     51 
    5252 
    5353  IMPLICIT NONE 
     
    8383  INTEGER :: nn_dct_h      ! Frequency of computation for NOOS hourly files 
    8484  INTEGER :: nn_dctwri_h   ! Frequency of output for NOOS hourly files 
    85     
     85 
    8686  INTEGER, PARAMETER :: nb_class_max  = 11   ! maximum number of classes, i.e. depth levels or density classes 
    8787  ! JT INTEGER, PARAMETER :: nb_sec_max    = 30   ! maximum number of sections 
     
    9595  INTEGER, PARAMETER :: nb_3d_vars    = 5 
    9696  INTEGER, PARAMETER :: nb_2d_vars    = 2 
    97   INTEGER            :: nb_sec  
     97  INTEGER            :: nb_sec 
    9898 
    9999  TYPE POINT_SECTION 
     
    145145     !!---------------------------------------------------------------------- 
    146146     ! 
    147       
     147 
    148148     !JT not sure why this is in nemogcm.F90(?) rather than diadct_init... 
    149149     !JT it would be good if the nb_sec_max and nb_point_max were controlled by name list variable. 
    150       
    151       
     150 
     151 
    152152     ALLOCATE(transports_3d(nb_3d_vars,nb_sec_max,nb_point_max,jpk),   STAT=ierr(1) ) 
    153153     ALLOCATE(transports_2d(nb_2d_vars,nb_sec_max,nb_point_max)    ,   STAT=ierr(2) ) 
     
    156156     !JT ALLOCATE(z_hr_output(nb_sec_max,24,nb_class_max)                , STAT=ierr(5) ) 
    157157     ALLOCATE(z_hr_output(nb_sec_max,3,nb_class_max)                , STAT=ierr(5) ) 
    158      
     158 
    159159     diadct_alloc = MAXVAL( ierr ) 
    160160     IF( diadct_alloc /= 0 )   CALL ctl_warn('diadct_alloc: failed to allocate arrays') 
     
    165165  SUBROUTINE dia_dct_init 
    166166     !!--------------------------------------------------------------------- 
    167      !!               ***  ROUTINE diadct  ***   
     167     !!               ***  ROUTINE diadct  *** 
    168168     !! 
    169169     !!  ** Purpose: Read the namelist parameters 
     
    186186902  IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdct in configuration namelist', lwp ) 
    187187     IF(lwm) WRITE ( numond, namdct ) 
    188       
     188 
    189189 
    190190     IF( ln_NOOS ) THEN 
     
    200200        ! 
    201201        ! 
    202         !nn_dct_h=1       ! hard coded for NOOS transects, to give hourly data     
     202        !nn_dct_h=1       ! hard coded for NOOS transects, to give hourly data 
    203203        ! If you want hourly instantaneous values, you only do the calculation every 12 timesteps (if rdt = 300) 
    204204        ! and output it every 12 time steps. For this, you set the ln_dct_h to be True, and it calcuates it automatically 
     
    206206        ! 
    207207        !SELECT CASE( ln_dct_h ) 
    208         !   CASE(.TRUE.)   
     208        !   CASE(.TRUE.) 
    209209        !      nn_dct_h=3600./rdt 
    210210        !   CASE(.FALSE.) 
    211211        !      nn_dct_h=1 
    212212        !END SELECT 
    213          
     213 
    214214        IF ( ln_dct_h ) THEN 
    215215            nn_dct_h=3600./rdt 
    216216        ELSE 
    217217            nn_dct_h=1. 
    218         ENDIF     
    219          
     218        ENDIF 
     219 
    220220        !JT write out hourly calculation every hour 
    221221        nn_dctwri_h=3600./rdt 
     
    244244 
    245245        IF      ( nn_secdebug .GE. 1 .AND. nn_secdebug .LE. nb_sec_max )THEN 
    246                                             WRITE(numout,*)"       Debug section number: ", nn_secdebug  
     246                                            WRITE(numout,*)"       Debug section number: ", nn_secdebug 
    247247        ELSE IF ( nn_secdebug ==  0 )THEN ; WRITE(numout,*)"       No section to debug" 
    248248        ELSE IF ( nn_secdebug == -1 )THEN ; WRITE(numout,*)"       Debug all sections" 
     
    254254 
    255255     ENDIF 
    256       
    257       
     256 
     257 
    258258     IF ( ln_NOOS ) THEN 
    259259        IF ( ln_dct_calc_noos_25h .or. ln_dct_calc_noos_hr ) CALL readsec 
     
    298298            WRITE(numout,*) "" 
    299299            WRITE(numout,*) "" 
    300        
     300 
    301301            WRITE(numout,*)  '      <field_group id="noos_cross_section" domain_ref="1point" axis_ref="noos" operation="average">' 
    302302 
    303303            DO jsec=1,nb_sec 
    304304               WRITE (jsec_str, "(I3.3)") jsec 
    305                 
     305 
    306306               WRITE(numout,*)  '          <field id="noos_'//jsec_str//'_trans" long_name="' // TRIM(secs(jsec)%name) // ' 25h mean NOOS transport cross-section number: '//jsec_str//' (total, positive, negative)" unit="m^3/s" />' 
    307307               WRITE(numout,*)  '          <field id="noos_'//jsec_str//'_heat" long_name="' // TRIM(secs(jsec)%name) // ' 25h mean NOOS heat cross-section number: '//jsec_str//' (total, positive, negative)" unit="J/s" />' 
    308308               WRITE(numout,*)  '          <field id="noos_'//jsec_str//'_salt" long_name="' // TRIM(secs(jsec)%name) // ' 25h mean NOOS salt cross-section number: '//jsec_str//' (total, positive, negative)" unit="g/s" />' 
    309                 
     309 
    310310            ENDDO 
    311              
     311 
    312312            WRITE(numout,*)  '      </field_group>' 
    313              
     313 
    314314            WRITE(numout,*) "" 
    315315            WRITE(numout,*) "" 
     
    318318            WRITE(numout,*) "" 
    319319            WRITE(numout,*) "" 
    320              
     320 
    321321            WRITE(numout,*)  '      <file_group id="1d" output_freq="1d" output_level="10" enabled=".TRUE.">' 
    322322            WRITE(numout,*) "" 
     
    324324            DO jsec=1,nb_sec 
    325325               WRITE (jsec_str, "(I3.3)") jsec 
    326                 
     326 
    327327               WRITE(numout,*)  '              <field field_ref="noos_'//jsec_str//'_trans" />' 
    328328               WRITE(numout,*)  '              <field field_ref="noos_'//jsec_str//'_heat" />' 
    329329               WRITE(numout,*)  '              <field field_ref="noos_'//jsec_str//'_salt" />' 
    330                 
     330 
    331331            ENDDO 
    332332            WRITE(numout,*)  '          </file>' 
    333333            WRITE(numout,*) "" 
    334334            WRITE(numout,*)  '      </file_group>' 
    335              
     335 
    336336            WRITE(numout,*) "" 
    337337            WRITE(numout,*) "" 
    338338            WRITE(numout,*) "~~~~~~~~~~~~~~~~~~~~~" 
    339339            WRITE(numout,*) "" 
    340          
     340 
    341341        ENDIF 
    342342     ENDIF 
     
    345345     ! 
    346346  END SUBROUTINE dia_dct_init 
    347   
    348   
     347 
     348 
    349349  SUBROUTINE dia_dct(kt) 
    350350     !!--------------------------------------------------------------------- 
    351      !!               ***  ROUTINE diadct  ***   
     351     !!               ***  ROUTINE diadct  *** 
    352352     !! 
    353353     !!  Purpose :: Compute section transports and write it in numdct files 
    354      !!   
     354     !! 
    355355     !!  Method  :: All arrays initialised to zero in dct_init 
    356356     !!             Each nn_dct time step call subroutine 'transports' for 
     
    370370     INTEGER             :: jsec,            &! loop on sections 
    371371                            itotal            ! nb_sec_max*nb_type*nb_class_max 
    372      LOGICAL             :: lldebug =.FALSE.  ! debug a section   
    373  
    374       
     372     LOGICAL             :: lldebug =.FALSE.  ! debug a section 
     373 
     374 
    375375     INTEGER , DIMENSION(1)             :: ish      ! tmp array for mpp_sum 
    376376     INTEGER , DIMENSION(3)             :: ish2     !   " 
    377      REAL(wp), POINTER, DIMENSION(:)    :: zwork    !   "  
     377     REAL(wp), POINTER, DIMENSION(:)    :: zwork    !   " 
    378378     REAL(wp), POINTER, DIMENSION(:,:,:):: zsum     !   " 
    379      !!---------------------------------------------------------------------     
    380       
    381       
    382       
     379     !!--------------------------------------------------------------------- 
     380 
     381 
     382 
    383383     IF( nn_timing == 1 )   CALL timing_start('dia_dct') 
    384384 
    385385     IF( lk_mpp ) THEN 
    386386        itotal = nb_sec_max*nb_type*nb_class_max 
    387         CALL wrk_alloc( itotal                          , zwork )  
     387        CALL wrk_alloc( itotal                          , zwork ) 
    388388        CALL wrk_alloc( nb_sec_max,nb_type,nb_class_max , zsum  ) 
    389      ENDIF     
    390   
     389     ENDIF 
     390 
    391391     ! Initialise arrays 
    392      zwork(:) = 0.0  
     392     zwork(:) = 0.0 
    393393     zsum(:,:,:) = 0.0 
    394394 
     
    405405         WRITE(numout,*) "nb_class_max = ",nb_class_max 
    406406     ENDIF 
    407      
    408      
     407 
     408 
    409409    IF ( ln_dct_calc_noos_25h ) THEN 
    410   
     410 
    411411        ! Compute transport and write only at nn_dctwri 
    412412        IF ( MOD(kt,nn_dct)==0 .or. &               ! compute transport every nn_dct time steps 
    413413            (ln_NOOS .and. kt==nn_it000 ) )  THEN   ! also include first time step when calculating NOOS 25 hour averages 
    414              
    415              
     414 
     415 
    416416 
    417417            DO jsec=1,nb_sec 
    418418 
    419419              lldebug=.FALSE. 
    420               IF( (jsec==nn_secdebug .OR. nn_secdebug==-1) .AND.  kt==nit000+nn_dct-1 .AND. lwp ) lldebug=.TRUE.  
    421  
    422               !Compute transport through section   
    423               CALL transport(secs(jsec),lldebug,jsec)  
    424                
     420              IF( (jsec==nn_secdebug .OR. nn_secdebug==-1) .AND.  kt==nit000+nn_dct-1 .AND. lwp ) lldebug=.TRUE. 
     421 
     422              !Compute transport through section 
     423              CALL transport(secs(jsec),lldebug,jsec) 
     424 
    425425 
    426426            ENDDO 
    427                  
     427 
    428428            IF( MOD(kt,nn_dctwri)==0 )THEN 
    429              
    430              
     429 
     430 
    431431 
    432432              IF( lwp .AND. kt==nit000+nn_dctwri-1 ) WRITE(numout,*)"      diadct: average and write at kt = ",kt 
    433433 
    434434 
    435               !JT    
    436               !JT    
     435              !JT 
     436              !JT 
    437437              !JT   !! divide arrays by nn_dctwri/nn_dct to obtain average 
    438438              !JT   transports_3d(:,:,:,:)=transports_3d(:,:,:,:)/(nn_dctwri/nn_dct) 
    439439              !JT   transports_2d(:,:,:)  =transports_2d(:,:,:)  /(nn_dctwri/nn_dct) 
    440               !JT    
    441               !JT    
    442  
    443  
    444               !JT    
     440              !JT 
     441              !JT 
     442 
     443 
     444              !JT 
    445445              !JT Not 24 values, but 25! divide by ((nn_dctwri/nn_dct) +1) 
    446446              !! divide arrays by nn_dctwri/nn_dct  to obtain average 
     
    452452                  CALL dia_dct_sum(secs(jsec),jsec) 
    453453              ENDDO 
    454      
    455               !Sum on all procs  
     454 
     455              !Sum on all procs 
    456456              IF( lk_mpp )THEN 
    457457                  zsum(:,:,:)=0.0_wp 
    458                   ish(1)  =  nb_sec_max*nb_type*nb_class_max  
     458                  ish(1)  =  nb_sec_max*nb_type*nb_class_max 
    459459                  ish2    = (/nb_sec_max,nb_type,nb_class_max/) 
    460460                  DO jsec=1,nb_sec ; zsum(jsec,:,:) = secs(jsec)%transport(:,:) ; ENDDO 
     
    471471                  !IF( lwp .and.       ln_NOOS )CALL dia_dct_wri_NOOS(kt,jsec,secs(jsec))   ! use NOOS specific formatting 
    472472                  IF(  ln_NOOS )CALL dia_dct_wri_NOOS(kt,jsec,secs(jsec))   ! use NOOS specific formatting 
    473                  
    474                  
     473 
     474 
    475475                  !nullify transports values after writing 
    476476                  transports_3d(:,jsec,:,:)=0.0 
    477477                  transports_2d(:,jsec,:  )=0.0 
    478                   secs(jsec)%transport(:,:)=0.   
    479                    
    480                    
     478                  secs(jsec)%transport(:,:)=0. 
     479 
     480 
    481481                  IF ( ln_NOOS ) CALL transport(secs(jsec),lldebug,jsec)  ! reinitialise for next 25 hour instantaneous average (overlapping values) 
    482482 
     
    485485              ENDDO 
    486486 
    487             ENDIF  
     487            ENDIF 
    488488 
    489489        ENDIF 
    490          
     490 
    491491    ENDIF 
    492492    IF ( ln_dct_calc_noos_hr ) THEN 
     
    496496 
    497497              lldebug=.FALSE. 
    498               IF( (jsec==nn_secdebug .OR. nn_secdebug==-1) .AND.  kt==nit000+nn_dct_h-1 .AND. lwp ) lldebug=.TRUE.  
    499  
    500               !Compute transport through section   
    501               CALL transport_h(secs(jsec),lldebug,jsec)  
     498              IF( (jsec==nn_secdebug .OR. nn_secdebug==-1) .AND.  kt==nit000+nn_dct_h-1 .AND. lwp ) lldebug=.TRUE. 
     499 
     500              !Compute transport through section 
     501              CALL transport_h(secs(jsec),lldebug,jsec) 
    502502 
    503503            ENDDO 
    504                  
     504 
    505505            IF( MOD(kt,nn_dctwri_h)==0 )THEN 
    506506 
    507               IF( lwp .AND. kt==nit000+nn_dctwri_h-1 )WRITE(numout,*)"      diadct: average and write hourly files at kt = ",kt          
    508        
     507              IF( lwp .AND. kt==nit000+nn_dctwri_h-1 )WRITE(numout,*)"      diadct: average and write hourly files at kt = ",kt 
     508 
    509509              !! divide arrays by nn_dctwri/nn_dct to obtain average 
    510510                ! 
     
    520520              ENDDO 
    521521 
    522               !Sum on all procs  
     522              !Sum on all procs 
    523523              IF( lk_mpp )THEN 
    524                   ish(1)  =  nb_sec_max*nb_type*nb_class_max  
     524                  ish(1)  =  nb_sec_max*nb_type*nb_class_max 
    525525                  ish2    = (/nb_sec_max,nb_type,nb_class_max/) 
    526526                  DO jsec=1,nb_sec ; zsum(jsec,:,:) = secs(jsec)%transport_h(:,:) ; ENDDO 
     
    541541                  transports_2d_h(:,jsec,:)=0.0 
    542542                  secs(jsec)%transport_h(:,:)=0.0 
    543                    
     543 
    544544                  ! for hourly mean or hourly instantaneous, you don't initialise! start with zero! 
    545545                  !IF ( ln_NOOS ) CALL transport_h(secs(jsec),lldebug,jsec)  ! reinitialise for next 25 hour instantaneous average (overlapping values) 
     
    547547              ENDDO 
    548548 
    549             ENDIF  
    550  
    551         ENDIF     
    552          
     549            ENDIF 
     550 
     551        ENDIF 
     552 
    553553     ENDIF 
    554554 
    555555     IF( lk_mpp )THEN 
    556556        itotal = nb_sec_max*nb_type*nb_class_max 
    557         CALL wrk_dealloc( itotal                          , zwork )  
     557        CALL wrk_dealloc( itotal                          , zwork ) 
    558558        CALL wrk_dealloc( nb_sec_max,nb_type,nb_class_max , zsum  ) 
    559      ENDIF     
     559     ENDIF 
    560560 
    561561     IF( nn_timing == 1 )   CALL timing_stop('dia_dct') 
     
    563563  END SUBROUTINE dia_dct 
    564564 
    565   SUBROUTINE readsec  
     565  SUBROUTINE readsec 
    566566     !!--------------------------------------------------------------------- 
    567567     !!               ***  ROUTINE readsec  *** 
    568568     !! 
    569569     !!  ** Purpose: 
    570      !!            Read a binary file(section_ijglobal.diadct)  
     570     !!            Read a binary file(section_ijglobal.diadct) 
    571571     !!            generated by the tools "NEMOGCM/TOOLS/SECTIONS_DIADCT" 
    572572     !! 
     
    579579                                                              ! heat/salt tranport is actived 
    580580 
    581      INTEGER, DIMENSION(2) :: icoord  
     581     INTEGER, DIMENSION(2) :: icoord 
    582582     CHARACTER(len=160)    :: clname                          !filename 
    583583     CHARACTER(len=200)    :: cltmp 
    584584     CHARACTER(len=200)    :: clformat                        !automatic format 
    585      TYPE(POINT_SECTION),DIMENSION(nb_point_max)  ::coordtemp !contains listpoints coordinates  
     585     TYPE(POINT_SECTION),DIMENSION(nb_point_max)  ::coordtemp !contains listpoints coordinates 
    586586                                                              !read in the file 
    587587     INTEGER, POINTER, DIMENSION(:) :: directemp              !contains listpoints directions 
     
    596596     !write(numout,*) 'dct low-level pre open: little endian ' 
    597597     !OPEN(UNIT=107,FILE='section_ijglobal.diadct', FORM='UNFORMATTED', ACCESS='SEQUENTIAL', STATUS='OLD',convert='LITTLE_ENDIAN') 
    598       
     598 
    599599     write(numout,*) 'dct low-level pre open: big endian :',nproc,narea 
    600600     OPEN(UNIT=107,FILE='section_ijglobal.diadct', FORM='UNFORMATTED', ACCESS='SEQUENTIAL', STATUS='OLD',convert='BIG_ENDIAN') 
    601       
     601 
    602602     !write(numout,*) 'dct low-level pre open: SWAP ' 
    603603     !OPEN(UNIT=107,FILE='section_ijglobal.diadct', FORM='UNFORMATTED', ACCESS='SEQUENTIAL', STATUS='OLD',convert='SWAP') 
    604       
     604 
    605605     !write(numout,*) 'dct low-level pre open: NATIVE ' 
    606606     !OPEN(UNIT=107,FILE='section_ijglobal.diadct', FORM='UNFORMATTED', ACCESS='SEQUENTIAL', STATUS='OLD',convert='NATIVE') 
    607       
     607 
    608608     READ(107) isec 
    609609     CLOSE(107) 
    610       
     610 
    611611     CALL ctl_opn( numdct_in, 'section_ijglobal.diadct', 'OLD', 'UNFORMATTED', 'SEQUENTIAL', -1, numout, .TRUE. ) 
    612   
    613       
     612 
     613 
    614614     !--------------- 
    615615     !Read input file 
    616616     !--------------- 
    617       
     617 
    618618     DO jsec=1,nb_sec_max      !loop on the nb_sec sections 
    619619 
    620620        IF ( lwp .AND. ( jsec==nn_secdebug .OR. nn_secdebug==-1 ) ) & 
    621            & WRITE(numout,*)'debugging for section number: ',jsec  
     621           & WRITE(numout,*)'debugging for section number: ',jsec 
    622622 
    623623        !initialization 
     
    639639        !read section's number / name / computing choices / classes / slopeSection / points number 
    640640        !----------------------------------------------------------------------------------------- 
    641          
     641 
    642642        READ(numdct_in,iostat=iost) isec 
    643643        IF (iost .NE. 0 ) then 
    644644          write(numout,*) 'unable to read section_ijglobal.diadct. iost = ',iost 
    645           EXIT !end of file  
     645          EXIT !end of file 
    646646        ENDIF 
    647          
    648          
     647 
     648 
    649649        WRITE(cltmp,'(a,i4.4,a,i4.4)')'diadct: read sections : Problem of section number: isec= ',isec,' and jsec= ',jsec 
    650          
    651          
     650 
     651 
    652652        IF( jsec .NE. isec )  CALL ctl_stop( cltmp ) 
    653653 
     
    670670 
    671671        IF( lwp .AND. ( jsec==nn_secdebug .OR. nn_secdebug==-1 ) )THEN 
    672            
    673             WRITE(clformat,'(a,i2,a)') '(A40,', nb_class_max,'(f8.3,1X))'  
     672 
     673            WRITE(clformat,'(a,i2,a)') '(A40,', nb_class_max,'(f8.3,1X))' 
    674674 
    675675            WRITE(numout,*)       "   Section name :                       ",TRIM(secs(jsec)%name) 
     
    685685            WRITE(numout,clformat)"      Temperature classes :             ",secs(jsec)%ztem 
    686686            WRITE(numout,clformat)"      Depth classes :                   ",secs(jsec)%zlay 
    687         ENDIF      
    688          
     687        ENDIF 
     688 
    689689 
    690690        IF( iptglo .NE. 0 )THEN 
    691               
    692            !read points'coordinates and directions  
     691 
     692           !read points'coordinates and directions 
    693693           !-------------------------------------- 
    694694           coordtemp(:) = POINT_SECTION(0,0) !list of points read 
     
    696696           DO jpt=1,iptglo 
    697697              READ(numdct_in)i1,i2 
    698               coordtemp(jpt)%I = i1  
     698              coordtemp(jpt)%I = i1 
    699699              coordtemp(jpt)%J = i2 
    700700           ENDDO 
    701701           READ(numdct_in)directemp(1:iptglo) 
    702      
     702 
    703703           !debug 
    704704           !----- 
     
    707707              DO jpt=1,iptglo 
    708708                 WRITE(numout,*)'        # I J ',jpt,coordtemp(jpt),directemp(jpt) 
    709               ENDDO                   
     709              ENDDO 
    710710           ENDIF 
    711   
     711 
    712712           !Now each proc selects only points that are in its domain: 
    713713           !-------------------------------------------------------- 
    714714           iptloc = 0                    !initialize number of points selected 
    715715           DO jpt=1,iptglo               !loop on listpoint read in the file 
    716                      
     716 
    717717              iiglo=coordtemp(jpt)%I          ! global coordinates of the point 
    718               ijglo=coordtemp(jpt)%J          !  "  
     718              ijglo=coordtemp(jpt)%J          !  " 
    719719 
    720720              IF( iiglo==jpidta .AND. nimpp==1 ) iiglo = 2 
    721                
     721 
    722722              iiloc=iiglo-jpizoom+1-nimpp+1   ! local coordinates of the point 
    723723              ijloc=ijglo-jpjzoom+1-njmpp+1   !  " 
     
    728728 
    729729                  WRITE(*,*)"diadct readsec: assigned proc!",narea,nproc,jpt 
    730                    
    731                    
     730 
     731 
    732732                 iptloc = iptloc + 1                                                 ! count local points 
    733733                 secs(jsec)%listPoint(iptloc) = POINT_SECTION(mi0(iiglo),mj0(ijglo)) ! store local coordinates 
     
    736736 
    737737           ENDDO 
    738       
     738 
    739739           secs(jsec)%nb_point=iptloc !store number of section's points 
    740740 
     
    792792 
    793793     ENDDO !end of the loop on jsec 
    794       
     794 
    795795     nb_sec = jsec-1   !number of section read in the file 
    796796 
     
    812812     CHARACTER(len=1),INTENT(IN) :: cdind   ! = 'I'/'J' 
    813813     CHARACTER(len=8),INTENT(IN) :: cdextr  ! = 'top_list'/'bot_list' 
    814      LOGICAL,INTENT(IN)          :: ld_debug                      
     814     LOGICAL,INTENT(IN)          :: ld_debug 
    815815 
    816816     !! * Local variables 
    817817     INTEGER :: iextr         ,& !extremity of listpoint that we verify 
    818818                iind          ,& !coord     of listpoint that we verify 
    819                 itest         ,& !indice value of the side of the domain  
     819                itest         ,& !indice value of the side of the domain 
    820820                                 !where points could be redundant 
    821821                isgn          ,& ! isgn= 1 : scan listpoint from start to end 
    822                                  ! isgn=-1 : scan listpoint from end to start  
     822                                 ! isgn=-1 : scan listpoint from end to start 
    823823                istart,iend      !first and last points selected in listpoint 
    824824     INTEGER :: jpoint           !loop on list points 
     
    837837     ELSE    ; CALL ctl_stop("removepoints :Wrong value for cdextr") 
    838838     ENDIF 
    839   
     839 
    840840     !which coordinate shall we verify ? 
    841841     IF      ( cdind=='I' )THEN   ; itest=nlei ; iind=1 
    842842     ELSE IF ( cdind=='J' )THEN   ; itest=nlej ; iind=2 
    843      ELSE    ; CALL ctl_stop("removepoints :Wrong value for cdind")  
     843     ELSE    ; CALL ctl_stop("removepoints :Wrong value for cdind") 
    844844     ENDIF 
    845845 
     
    861861         ELSE                                                                               ; EXIT 
    862862         ENDIF 
    863      ENDDO  
     863     ENDDO 
    864864 
    865865     IF( cdextr=='bot_list')THEN ; istart=jpoint-1 ; iend=sec%nb_point 
     
    871871     sec%direction(1:1+iend-istart)   = idirec(istart:iend) 
    872872     sec%nb_point                     = iend-istart+1 
    873       
     873 
    874874     IF( ld_debug )THEN 
    875875        WRITE(numout,*)'      Number of points after removepoints :',sec%nb_point 
     
    889889     !! 
    890890     !!  Method  ::  Loop over each segment, and each vertical level and add the transport 
    891      !!              Be aware :           
     891     !!              Be aware : 
    892892     !!              One section is a sum of segments 
    893893     !!              One segment is defined by 2 consecutive points in sec%listPoint 
    894894     !!              All points of sec%listPoint are positioned on the F-point of the cell 
    895      !!  
    896      !!              There are two loops:                  
     895     !! 
     896     !!              There are two loops: 
    897897     !!              loop on the segment between 2 nodes 
    898898     !!              loop on the level jk 
     
    906906     LOGICAL      ,INTENT(IN)    :: ld_debug 
    907907     INTEGER      ,INTENT(IN)    :: jsec        ! numeric identifier of section 
    908      
     908 
    909909     !! * Local variables 
    910      INTEGER             :: jk,jseg,jclass,    &!loop on level/segment/classes  
     910     INTEGER             :: jk,jseg,jclass,    &!loop on level/segment/classes 
    911911                            isgnu  , isgnv      ! 
    912912     REAL(wp):: zumid        , zvmid        ,  &!U/V velocity on a cell segment 
     
    934934        !    Making sign of the velocities used to calculate the volume transport a function of direction, not slopesection 
    935935        !    (isgnu, isgnv) 
    936         !     
    937         !    They vary for each segment of the section.  
     936        ! 
     937        !    They vary for each segment of the section. 
    938938        ! 
    939939        !---------------------------------------------------------------------------------------------------- 
     
    950950        !       ----------------      -----------------     ---------------             -------------- 
    951951        ! 
    952         !   isgnv=1         direction +       
    953         !  ______         _____             ______                                                    
    954         !        |           //|            |                  |                         direction +    
     952        !   isgnv=1         direction + 
     953        !  ______         _____             ______ 
     954        !        |           //|            |                  |                         direction + 
    955955        !        | isgnu=1  // |            |isgnu=1           |isgnu=1                     /|\ 
    956956        !        |_______  //         ______|    \\            | ---\                        | 
    957957        !               |             | isgnv=-1  \\ |         | ---/ direction +       ____________ 
    958         !               |             |          __\\|         |                     
    959         !               |             |     direction +        |                      isgnv=1                                  
    960         !                                                       
     958        !               |             |          __\\|         | 
     959        !               |             |     direction +        |                      isgnv=1 
     960        ! 
    961961        !---------------------------------------------------------------------------------------------------- 
    962962        ! JT      isgnu = 1 
    963         ! JT      IF( sec%slopeSection .GT. 0 ) THEN  ; isgnv = -1  
     963        ! JT      IF( sec%slopeSection .GT. 0 ) THEN  ; isgnv = -1 
    964964        ! JT      ELSE                                ; isgnv =  1 
    965965        ! JT      ENDIF 
     
    972972        !--------------------------------------! 
    973973        DO jseg=1,MAX(sec%nb_point-1,0) 
    974             
    975             
     974 
     975 
    976976           !JT: Compute sign for velocities: 
    977             
     977 
    978978           !isgnu =  1 
    979979           !isgnv =  1 
    980980           ! 
    981            ! JT changing sign of u and v is dependent on the direction of the section.  
     981           ! JT changing sign of u and v is dependent on the direction of the section. 
    982982           !isgnu =  1 
    983983           !isgnv =  1 
     
    986986           !CASE(3)  ;   isgnu = -1 
    987987           !END SELECT 
    988             
    989             
     988 
     989 
    990990           SELECT CASE( sec%direction(jseg) ) 
    991            CASE(0)   
     991           CASE(0) 
    992992              isgnu =  1 
    993993              isgnv = -1 
     
    995995              isgnu =  1 
    996996              isgnv =  1 
    997            CASE(2)   
     997           CASE(2) 
    998998              isgnu =  1 
    999999              isgnv =  1 
    1000            CASE(3)   
     1000           CASE(3) 
    10011001              isgnu = -1 
    10021002              isgnv =  1 
    10031003           END SELECT 
    1004             
     1004 
    10051005           !------------------------------------------------------------------------------------------- 
    10061006           ! Select the appropriate coordinate for computing the velocity of the segment 
     
    10091009           !                      CASE(0)                                    Case (2) 
    10101010           !                      -------                                    -------- 
    1011            !  listPoint(jseg)                 listPoint(jseg+1)       listPoint(jseg)  F(i,j)       
     1011           !  listPoint(jseg)                 listPoint(jseg+1)       listPoint(jseg)  F(i,j) 
    10121012           !      F(i,j)---------#V(i,j)-------F(i+1,j)                                 | 
    10131013           !                     -------->                                              | 
     
    10211021           !                        |                                                   | 
    10221022           !                        |                                 listPoint(jseg+1) F(i,j-1) 
    1023            !                   ^    |                                             
    1024            !                   |    |                                             
    1025            !                   | U(i,j+1)                                             
    1026            !                   |    |                                       Case(1)      
    1027            !                   |    |                                       ------       
    1028            !                        |                                             
    1029            !                        |                 listPoint(jseg+1)             listPoint(jseg)                            
    1030            !                        |                 F(i-1,j)----------#V(i-1,j) ------#f(i,j)                            
     1023           !                   ^    | 
     1024           !                   |    | 
     1025           !                   | U(i,j+1) 
     1026           !                   |    |                                       Case(1) 
     1027           !                   |    |                                       ------ 
     1028           !                        | 
     1029           !                        |                 listPoint(jseg+1)             listPoint(jseg) 
     1030           !                        |                 F(i-1,j)----------#V(i-1,j) ------#f(i,j) 
    10311031           ! listPoint(jseg)     F(i,j)                                 <------- 
    1032            !  
     1032           ! 
    10331033           !------------------------------------------------------------------------------------------- 
    10341034 
     
    10431043           !     LOOP ON THE LEVEL     | 
    10441044           !---------------------------| 
    1045            !Sum of the transport on the vertical  
     1045           !Sum of the transport on the vertical 
    10461046           DO jk=1,mbathy(k%I,k%J) 
    10471047 
     
    10591059                 zrhop = interp(k%I,k%J,jk,'U',rhop) 
    10601060                 zrhoi = interp(k%I,k%J,jk,'U',rhd*rau0+rau0) 
    1061                  zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I+1,k%J)    ) * umask(k%I,k%J,1)  
     1061                 zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I+1,k%J)    ) * umask(k%I,k%J,1) 
    10621062              END SELECT 
    10631063 
    10641064              zfsdep= fsdept(k%I,k%J,jk) 
    1065   
     1065 
    10661066              !compute velocity with the correct direction 
    10671067              SELECT CASE( sec%direction(jseg) ) 
    1068               CASE(0,1)   
     1068              CASE(0,1) 
    10691069                 zumid=0. 
    10701070                 zvmid=isgnv*vn(k%I,k%J,jk)*vmask(k%I,k%J,jk) 
     
    10861086              ENDIF 
    10871087#endif 
    1088               !COMPUTE TRANSPORT  
     1088              !COMPUTE TRANSPORT 
    10891089 
    10901090              transports_3d(1,jsec,jseg,jk) = transports_3d(1,jsec,jseg,jk) + zTnorm 
    1091   
     1091 
    10921092              IF ( sec%llstrpond ) THEN 
    10931093                 transports_3d(2,jsec,jseg,jk) = transports_3d(2,jsec,jseg,jk)  + zTnorm * zrhoi 
     
    11011101#if defined key_lim2 || defined key_lim3 
    11021102 
    1103            !ICE CASE     
     1103           !ICE CASE 
    11041104           !------------ 
    11051105           IF( sec%ll_ice_section )THEN 
     
    11181118                 zumid_ice =  isgnu*0.5*(u_ice(k%I+1,k%J)+u_ice(k%I+1,k%J+1)) 
    11191119              END SELECT 
    1120     
     1120 
    11211121              zTnorm=zumid_ice*e2u(k%I,k%J)+zvmid_ice*e1v(k%I,k%J) 
    1122     
     1122 
    11231123              transports_2d(1,jsec,jseg) = transports_2d(1,jsec,jseg) + (zTnorm)*   & 
    11241124                                   (1.0 - frld(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J))  & 
     
    11291129                                    (1.0 -  frld(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J))  & 
    11301130                                   +zice_surf_pos 
    1131     
     1131 
    11321132           ENDIF !end of ice case 
    11331133#endif 
    1134   
     1134 
    11351135        ENDDO !end of loop on the segment 
    11361136 
     
    11491149     !! 
    11501150     !!  Method  ::  Loop over each segment, and each vertical level and add the transport 
    1151      !!              Be aware :           
     1151     !!              Be aware : 
    11521152     !!              One section is a sum of segments 
    11531153     !!              One segment is defined by 2 consecutive points in sec%listPoint 
    11541154     !!              All points of sec%listPoint are positioned on the F-point of the cell 
    1155      !!  
    1156      !!              There are two loops:                  
     1155     !! 
     1156     !!              There are two loops: 
    11571157     !!              loop on the segment between 2 nodes 
    11581158     !!              loop on the level jk 
     
    11661166     LOGICAL      ,INTENT(IN)    :: ld_debug 
    11671167     INTEGER      ,INTENT(IN)    :: jsec        ! numeric identifier of section 
    1168      
     1168 
    11691169     !! * Local variables 
    1170      INTEGER             :: jk,jseg,jclass,    &!loop on level/segment/classes  
     1170     INTEGER             :: jk,jseg,jclass,    &!loop on level/segment/classes 
    11711171                            isgnu  , isgnv      ! 
    11721172     REAL(wp):: zumid        , zvmid        ,  &!U/V velocity on a cell segment 
     
    11941194        !    Making sign of the velocities used to calculate the volume transport a function of direction, not slopesection 
    11951195        !    (isgnu, isgnv) 
    1196         !     
    1197         !    They vary for each segment of the section.  
     1196        ! 
     1197        !    They vary for each segment of the section. 
    11981198        ! 
    11991199        !---------------------------------------------------------------------------------------------------- 
     
    12101210        !       ----------------      -----------------     ---------------             -------------- 
    12111211        ! 
    1212         !   isgnv=1         direction +       
    1213         !  ______         _____             ______                                                    
    1214         !        |           //|            |                  |                         direction +    
     1212        !   isgnv=1         direction + 
     1213        !  ______         _____             ______ 
     1214        !        |           //|            |                  |                         direction + 
    12151215        !        | isgnu=1  // |            |isgnu=1           |isgnu=1                     /|\ 
    12161216        !        |_______  //         ______|    \\            | ---\                        | 
    12171217        !               |             | isgnv=-1  \\ |         | ---/ direction +       ____________ 
    1218         !               |             |          __\\|         |                     
    1219         !               |             |     direction +        |                      isgnv=1                                  
    1220         !                                                       
     1218        !               |             |          __\\|         | 
     1219        !               |             |     direction +        |                      isgnv=1 
     1220        ! 
    12211221        !---------------------------------------------------------------------------------------------------- 
    12221222        ! JT      isgnu = 1 
    1223         ! JT      IF( sec%slopeSection .GT. 0 ) THEN  ; isgnv = -1  
     1223        ! JT      IF( sec%slopeSection .GT. 0 ) THEN  ; isgnv = -1 
    12241224        ! JT      ELSE                                ; isgnv =  1 
    12251225        ! JT      ENDIF 
     
    12321232        !--------------------------------------! 
    12331233        DO jseg=1,MAX(sec%nb_point-1,0) 
    1234             
    1235             
     1234 
     1235 
    12361236           !JT: Compute sign for velocities: 
    1237             
     1237 
    12381238           !isgnu =  1 
    12391239           !isgnv =  1 
    12401240           ! 
    1241            ! JT changing sign of u and v is dependent on the direction of the section.  
     1241           ! JT changing sign of u and v is dependent on the direction of the section. 
    12421242           !isgnu =  1 
    12431243           !isgnv =  1 
     
    12461246           !CASE(3)  ;   isgnu = -1 
    12471247           !END SELECT 
    1248             
    1249             
     1248 
     1249 
    12501250           SELECT CASE( sec%direction(jseg) ) 
    1251            CASE(0)   
     1251           CASE(0) 
    12521252              isgnu =  1 
    12531253              isgnv = -1 
     
    12551255              isgnu =  1 
    12561256              isgnv =  1 
    1257            CASE(2)   
     1257           CASE(2) 
    12581258              isgnu =  1 
    12591259              isgnv =  1 
    1260            CASE(3)   
     1260           CASE(3) 
    12611261              isgnu = -1 
    12621262              isgnv =  1 
    12631263           END SELECT 
    1264             
     1264 
    12651265           !------------------------------------------------------------------------------------------- 
    12661266           ! Select the appropriate coordinate for computing the velocity of the segment 
     
    12691269           !                      CASE(0)                                    Case (2) 
    12701270           !                      -------                                    -------- 
    1271            !  listPoint(jseg)                 listPoint(jseg+1)       listPoint(jseg)  F(i,j)       
     1271           !  listPoint(jseg)                 listPoint(jseg+1)       listPoint(jseg)  F(i,j) 
    12721272           !      F(i,j)---------#V(i,j)-------F(i+1,j)                                 | 
    12731273           !                     -------->                                              | 
     
    12811281           !                        |                                                   | 
    12821282           !                        |                                 listPoint(jseg+1) F(i,j-1) 
    1283            !                   ^    |                                             
    1284            !                   |    |                                             
    1285            !                   | U(i,j+1)                                             
    1286            !                   |    |                                       Case(1)      
    1287            !                   |    |                                       ------       
    1288            !                        |                                             
    1289            !                        |                 listPoint(jseg+1)             listPoint(jseg)                            
    1290            !                        |                 F(i-1,j)----------#V(i-1,j) ------#f(i,j)                            
     1283           !                   ^    | 
     1284           !                   |    | 
     1285           !                   | U(i,j+1) 
     1286           !                   |    |                                       Case(1) 
     1287           !                   |    |                                       ------ 
     1288           !                        | 
     1289           !                        |                 listPoint(jseg+1)             listPoint(jseg) 
     1290           !                        |                 F(i-1,j)----------#V(i-1,j) ------#f(i,j) 
    12911291           ! listPoint(jseg)     F(i,j)                                 <------- 
    1292            !  
     1292           ! 
    12931293           !------------------------------------------------------------------------------------------- 
    12941294 
     
    13031303           !     LOOP ON THE LEVEL     | 
    13041304           !---------------------------| 
    1305            !Sum of the transport on the vertical  
     1305           !Sum of the transport on the vertical 
    13061306           DO jk=1,mbathy(k%I,k%J) 
    13071307 
     
    13191319                 zrhop = interp(k%I,k%J,jk,'U',rhop) 
    13201320                 zrhoi = interp(k%I,k%J,jk,'U',rhd*rau0+rau0) 
    1321                  zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I+1,k%J)    ) * umask(k%I,k%J,1)  
     1321                 zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I+1,k%J)    ) * umask(k%I,k%J,1) 
    13221322              END SELECT 
    13231323 
    13241324              zfsdep= fsdept(k%I,k%J,jk) 
    1325   
     1325 
    13261326              !compute velocity with the correct direction 
    13271327              SELECT CASE( sec%direction(jseg) ) 
    1328               CASE(0,1)   
     1328              CASE(0,1) 
    13291329                 zumid=0. 
    13301330                 zvmid=isgnv*vn(k%I,k%J,jk)*vmask(k%I,k%J,jk) 
     
    13461346              ENDIF 
    13471347#endif 
    1348               !COMPUTE TRANSPORT  
     1348              !COMPUTE TRANSPORT 
    13491349 
    13501350              transports_3d_h(1,jsec,jseg,jk) = transports_3d_h(1,jsec,jseg,jk) + zTnorm 
    1351   
     1351 
    13521352              IF ( sec%llstrpond ) THEN 
    13531353                 transports_3d_h(2,jsec,jseg,jk) = transports_3d_h(2,jsec,jseg,jk)  + zTnorm * zrhoi 
     
    13611361#if defined key_lim2 || defined key_lim3 
    13621362 
    1363            !ICE CASE     
     1363           !ICE CASE 
    13641364           !------------ 
    13651365           IF( sec%ll_ice_section )THEN 
     
    13781378                 zumid_ice =  isgnu*0.5*(u_ice(k%I+1,k%J)+u_ice(k%I+1,k%J+1)) 
    13791379              END SELECT 
    1380     
     1380 
    13811381              zTnorm=zumid_ice*e2u(k%I,k%J)+zvmid_ice*e1v(k%I,k%J) 
    1382     
     1382 
    13831383              transports_2d_h(1,jsec,jseg) = transports_2d_h(1,jsec,jseg) + (zTnorm)*   & 
    13841384                                   (1.0 - frld(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J))  & 
     
    13891389                                    (1.0 -  frld(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J))  & 
    13901390                                   +zice_surf_pos 
    1391     
     1391 
    13921392           ENDIF !end of ice case 
    13931393#endif 
    1394   
     1394 
    13951395        ENDDO !end of loop on the segment 
    13961396 
     
    13981398     ! 
    13991399  END SUBROUTINE transport_h 
    1400   
     1400 
    14011401  SUBROUTINE dia_dct_sum(sec,jsec) 
    14021402     !!------------------------------------------------------------- 
    1403      !! Purpose: Average the transport over nn_dctwri time steps  
     1403     !! Purpose: Average the transport over nn_dctwri time steps 
    14041404     !! and sum over the density/salinity/temperature/depth classes 
    14051405     !! 
    1406      !! Method:  
     1406     !! Method: 
    14071407     !!           Sum over relevant grid cells to obtain values 
    14081408     !!           for each 
    1409      !!              There are several loops:                  
     1409     !!              There are several loops: 
    14101410     !!              loop on the segment between 2 nodes 
    14111411     !!              loop on the level jk 
     
    14161416     !!              computed on each proc. 
    14171417     !!              On each proc,transport is equal to the sum of transport computed through 
    1418      !!              segments linking each point of sec%listPoint  with the next one.    
     1418     !!              segments linking each point of sec%listPoint  with the next one. 
    14191419     !! 
    14201420     !!------------------------------------------------------------- 
     
    14241424 
    14251425     TYPE(POINT_SECTION) :: k 
    1426      INTEGER  :: jk,jseg,jclass                        !loop on level/segment/classes  
     1426     INTEGER  :: jk,jseg,jclass                        !loop on level/segment/classes 
    14271427     REAL(wp) :: ztn, zsn, zrhoi, zrhop, zsshn, zfsdep ! temperature/salinity/ssh/potential density /depth at u/v point 
    14281428     !!------------------------------------------------------------- 
    14291429 
    14301430     !! Sum the relevant segments to obtain values for each class 
    1431      IF(sec%nb_point .NE. 0)THEN    
     1431     IF(sec%nb_point .NE. 0)THEN 
    14321432 
    14331433        !--------------------------------------! 
     
    14351435        !--------------------------------------! 
    14361436        DO jseg=1,MAX(sec%nb_point-1,0) 
    1437             
     1437 
    14381438           !------------------------------------------------------------------------------------------- 
    14391439           ! Select the appropriate coordinate for computing the velocity of the segment 
     
    14411441           !                      CASE(0)                                    Case (2) 
    14421442           !                      -------                                    -------- 
    1443            !  listPoint(jseg)                 listPoint(jseg+1)       listPoint(jseg)  F(i,j)       
     1443           !  listPoint(jseg)                 listPoint(jseg+1)       listPoint(jseg)  F(i,j) 
    14441444           !      F(i,j)----------V(i+1,j)-------F(i+1,j)                               | 
    14451445           !                                                                            | 
     
    14531453           !                        |                                                   | 
    14541454           !                        |                                 listPoint(jseg+1) F(i,j-1) 
    1455            !                        |                                             
    1456            !                        |                                             
    1457            !                     U(i,j+1)                                             
    1458            !                        |                                       Case(1)      
    1459            !                        |                                       ------       
    1460            !                        |                                             
    1461            !                        |                 listPoint(jseg+1)             listPoint(jseg)                            
    1462            !                        |                 F(i-1,j)-----------V(i,j) -------f(jseg)                            
     1455           !                        | 
     1456           !                        | 
     1457           !                     U(i,j+1) 
     1458           !                        |                                       Case(1) 
     1459           !                        |                                       ------ 
     1460           !                        | 
     1461           !                        |                 listPoint(jseg+1)             listPoint(jseg) 
     1462           !                        |                 F(i-1,j)-----------V(i,j) -------f(jseg) 
    14631463           ! listPoint(jseg)     F(i,j) 
    1464            !  
     1464           ! 
    14651465           !------------------------------------------------------------------------------------------- 
    14661466 
     
    14751475           !     LOOP ON THE LEVEL     | 
    14761476           !---------------------------| 
    1477            !Sum of the transport on the vertical  
     1477           !Sum of the transport on the vertical 
    14781478           DO jk=1,mbathy(k%I,k%J) 
    14791479 
     
    14911491                 zrhop = interp(k%I,k%J,jk,'U',rhop) 
    14921492                 zrhoi = interp(k%I,k%J,jk,'U',rhd*rau0+rau0) 
    1493                  zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I+1,k%J)    ) * umask(k%I,k%J,1)  
     1493                 zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I+1,k%J)    ) * umask(k%I,k%J,1) 
    14941494              END SELECT 
    14951495 
    1496               zfsdep= fsdept(k%I,k%J,jk)  
    1497   
     1496              zfsdep= fsdept(k%I,k%J,jk) 
     1497 
    14981498              !------------------------------- 
    14991499              !  LOOP ON THE DENSITY CLASSES | 
     
    15011501              !The computation is made for each density/temperature/salinity/depth class 
    15021502              DO jclass=1,MAX(1,sec%nb_class-1) 
    1503   
     1503 
    15041504                 !----------------------------------------------! 
    1505                  !TEST ON THE DENSITY/SALINITY/TEMPERATURE/LEVEL!  
     1505                 !TEST ON THE DENSITY/SALINITY/TEMPERATURE/LEVEL! 
    15061506                 !----------------------------------------------! 
    1507   
     1507 
    15081508                 IF ( (                                                    & 
    15091509                    ((( zrhop .GE. (sec%zsigp(jclass)+1000.  )) .AND.      & 
     
    15301530                    !SUM THE TRANSPORTS FOR EACH CLASSES FOR THE POSITIVE AND NEGATIVE DIRECTIONS 
    15311531                    !---------------------------------------------------------------------------- 
    1532                     IF (transports_3d(1,jsec,jseg,jk) .GE. 0.0) THEN  
     1532                    IF (transports_3d(1,jsec,jseg,jk) .GE. 0.0) THEN 
    15331533                       sec%transport(1,jclass) = sec%transport(1,jclass)+transports_3d(1,jsec,jseg,jk) 
    15341534                    ELSE 
     
    15771577 
    15781578                 ENDIF ! end of test if point is in class 
    1579     
     1579 
    15801580              ENDDO ! end of loop on the classes 
    15811581 
     
    15841584#if defined key_lim2 || defined key_lim3 
    15851585 
    1586            !ICE CASE     
     1586           !ICE CASE 
    15871587           IF( sec%ll_ice_section )THEN 
    15881588 
     
    16011601           ENDIF !end of ice case 
    16021602#endif 
    1603   
     1603 
    16041604        ENDDO !end of loop on the segment 
    16051605 
     
    16111611 
    16121612  END SUBROUTINE dia_dct_sum 
    1613   
     1613 
    16141614  SUBROUTINE dia_dct_sum_h(sec,jsec) 
    16151615     !!------------------------------------------------------------- 
    16161616     !! Exactly as dia_dct_sum but for hourly files containing data summed at each time step 
    16171617     !! 
    1618      !! Purpose: Average the transport over nn_dctwri time steps  
     1618     !! Purpose: Average the transport over nn_dctwri time steps 
    16191619     !! and sum over the density/salinity/temperature/depth classes 
    16201620     !! 
    1621      !! Method:  
     1621     !! Method: 
    16221622     !!           Sum over relevant grid cells to obtain values 
    16231623     !!           for each 
    1624      !!              There are several loops:                  
     1624     !!              There are several loops: 
    16251625     !!              loop on the segment between 2 nodes 
    16261626     !!              loop on the level jk 
     
    16311631     !!              computed on each proc. 
    16321632     !!              On each proc,transport is equal to the sum of transport computed through 
    1633      !!              segments linking each point of sec%listPoint  with the next one.    
     1633     !!              segments linking each point of sec%listPoint  with the next one. 
    16341634     !! 
    16351635     !!------------------------------------------------------------- 
     
    16391639 
    16401640     TYPE(POINT_SECTION) :: k 
    1641      INTEGER  :: jk,jseg,jclass                        !loop on level/segment/classes  
     1641     INTEGER  :: jk,jseg,jclass                        !loop on level/segment/classes 
    16421642     REAL(wp) :: ztn, zsn, zrhoi, zrhop, zsshn, zfsdep ! temperature/salinity/ssh/potential density /depth at u/v point 
    16431643     !!------------------------------------------------------------- 
    16441644 
    16451645     !! Sum the relevant segments to obtain values for each class 
    1646      IF(sec%nb_point .NE. 0)THEN    
     1646     IF(sec%nb_point .NE. 0)THEN 
    16471647 
    16481648        !--------------------------------------! 
     
    16501650        !--------------------------------------! 
    16511651        DO jseg=1,MAX(sec%nb_point-1,0) 
    1652             
     1652 
    16531653           !------------------------------------------------------------------------------------------- 
    16541654           ! Select the appropriate coordinate for computing the velocity of the segment 
     
    16561656           !                      CASE(0)                                    Case (2) 
    16571657           !                      -------                                    -------- 
    1658            !  listPoint(jseg)                 listPoint(jseg+1)       listPoint(jseg)  F(i,j)       
     1658           !  listPoint(jseg)                 listPoint(jseg+1)       listPoint(jseg)  F(i,j) 
    16591659           !      F(i,j)----------V(i+1,j)-------F(i+1,j)                               | 
    16601660           !                                                                            | 
     
    16681668           !                        |                                                   | 
    16691669           !                        |                                 listPoint(jseg+1) F(i,j-1) 
    1670            !                        |                                             
    1671            !                        |                                             
    1672            !                     U(i,j+1)                                             
    1673            !                        |                                       Case(1)      
    1674            !                        |                                       ------       
    1675            !                        |                                             
    1676            !                        |                 listPoint(jseg+1)             listPoint(jseg)                            
    1677            !                        |                 F(i-1,j)-----------V(i,j) -------f(jseg)                            
     1670           !                        | 
     1671           !                        | 
     1672           !                     U(i,j+1) 
     1673           !                        |                                       Case(1) 
     1674           !                        |                                       ------ 
     1675           !                        | 
     1676           !                        |                 listPoint(jseg+1)             listPoint(jseg) 
     1677           !                        |                 F(i-1,j)-----------V(i,j) -------f(jseg) 
    16781678           ! listPoint(jseg)     F(i,j) 
    1679            !  
     1679           ! 
    16801680           !------------------------------------------------------------------------------------------- 
    16811681 
     
    16901690           !     LOOP ON THE LEVEL     | 
    16911691           !---------------------------| 
    1692            !Sum of the transport on the vertical  
     1692           !Sum of the transport on the vertical 
    16931693           DO jk=1,mbathy(k%I,k%J) 
    16941694 
     
    17061706                 zrhop = interp(k%I,k%J,jk,'U',rhop) 
    17071707                 zrhoi = interp(k%I,k%J,jk,'U',rhd*rau0+rau0) 
    1708                  zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I+1,k%J)    ) * umask(k%I,k%J,1)  
     1708                 zsshn =  0.5*( sshn(k%I,k%J)    + sshn(k%I+1,k%J)    ) * umask(k%I,k%J,1) 
    17091709              END SELECT 
    17101710 
    17111711              zfsdep= fsdept(k%I,k%J,jk) 
    1712   
     1712 
    17131713              !------------------------------- 
    17141714              !  LOOP ON THE DENSITY CLASSES | 
     
    17181718 
    17191719                 !----------------------------------------------! 
    1720                  !TEST ON THE DENSITY/SALINITY/TEMPERATURE/LEVEL!  
     1720                 !TEST ON THE DENSITY/SALINITY/TEMPERATURE/LEVEL! 
    17211721                 !----------------------------------------------! 
    1722   
     1722 
    17231723                 IF ( (                                                    & 
    17241724                    ((( zrhop .GE. (sec%zsigp(jclass)+1000.  )) .AND.      & 
     
    17451745                    !SUM THE TRANSPORTS FOR EACH CLASSES FOR THE POSITIVE AND NEGATIVE DIRECTIONS 
    17461746                    !---------------------------------------------------------------------------- 
    1747                     IF (transports_3d_h(1,jsec,jseg,jk) .GE. 0.0) THEN  
     1747                    IF (transports_3d_h(1,jsec,jseg,jk) .GE. 0.0) THEN 
    17481748                       sec%transport_h(1,jclass) = sec%transport_h(1,jclass)+transports_3d_h(1,jsec,jseg,jk) 
    17491749                    ELSE 
     
    17921792 
    17931793                 ENDIF ! end of test if point is in class 
    1794     
     1794 
    17951795              ENDDO ! end of loop on the classes 
    17961796 
     
    17991799#if defined key_lim2 || defined key_lim3 
    18001800 
    1801            !ICE CASE     
     1801           !ICE CASE 
    18021802           IF( sec%ll_ice_section )THEN 
    18031803 
     
    18161816           ENDIF !end of ice case 
    18171817#endif 
    1818   
     1818 
    18191819        ENDDO !end of loop on the segment 
    18201820 
     
    18261826 
    18271827  END SUBROUTINE dia_dct_sum_h 
    1828   
     1828 
    18291829  SUBROUTINE dia_dct_wri_NOOS(kt,ksec,sec) 
    18301830     !!------------------------------------------------------------- 
    1831      !! Write transport output in numdct using NOOS formatting  
    1832      !!  
     1831     !! Write transport output in numdct using NOOS formatting 
     1832     !! 
    18331833     !! Purpose: Write  transports in ascii files 
    1834      !!  
     1834     !! 
    18351835     !! Method: 
    18361836     !!        1. Write volume transports in "volume_transport" 
    1837      !!           Unit: Sv : area * Velocity / 1.e6  
    1838      !!  
     1837     !!           Unit: Sv : area * Velocity / 1.e6 
     1838     !! 
    18391839     !!        2. Write heat transports in "heat_transport" 
    18401840     !!           Unit: Peta W : area * Velocity * T * rhau * Cp / 1.e15 
    1841      !!  
     1841     !! 
    18421842     !!        3. Write salt transports in "salt_transport" 
    18431843     !!           Unit: 10^9 g m^3 / s : area * Velocity * S / 1.e6 
    18441844     !! 
    1845      !!-------------------------------------------------------------  
     1845     !!------------------------------------------------------------- 
    18461846     !!arguments 
    18471847     INTEGER, INTENT(IN)          :: kt          ! time-step 
    1848      TYPE(SECTION), INTENT(INOUT) :: sec         ! section to write    
     1848     TYPE(SECTION), INTENT(INOUT) :: sec         ! section to write 
    18491849     INTEGER ,INTENT(IN)          :: ksec        ! section number 
    18501850 
    18511851     !!local declarations 
    18521852     INTEGER               :: jclass,ji             ! Dummy loop 
    1853      CHARACTER(len=2)      :: classe             ! Classname  
    1854       
     1853     CHARACTER(len=2)      :: classe             ! Classname 
     1854 
    18551855     REAL(wp)              :: zbnd1,zbnd2        ! Class bounds 
    18561856     REAL(wp)              :: zslope             ! section's slope coeff 
    18571857     ! 
    1858      REAL(wp), POINTER, DIMENSION(:):: zsumclasses ! 1D workspace  
    1859      CHARACTER(len=3)      :: noos_sect_name             ! Classname  
     1858     REAL(wp), POINTER, DIMENSION(:):: zsumclasses ! 1D workspace 
     1859     CHARACTER(len=3)      :: noos_sect_name             ! Classname 
    18601860     CHARACTER(len=25)      :: noos_var_sect_name 
    18611861     REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   noos_iom_dummy 
    18621862     INTEGER               :: IERR 
    1863       
     1863 
    18641864     REAL(wp), DIMENSION(3) :: tmp_iom_output 
    18651865     REAL(wp)               :: max_iom_val 
    1866       
    1867      !!-------------------------------------------------------------  
    1868       
    1869       
    1870       
     1866 
     1867     !!------------------------------------------------------------- 
     1868 
     1869 
     1870 
    18711871     IF( lwp ) THEN 
    18721872        WRITE(numout,*) " " 
    18731873        WRITE(numout,*) "dia_dct_wri_NOOS: write transports through sections at timestep: ", kt 
    18741874        WRITE(numout,*) "~~~~~~~~~~~~~~~~~~~~~" 
    1875      ENDIF    
    1876          
    1877      CALL wrk_alloc(nb_type , zsumclasses )   
     1875     ENDIF 
     1876 
     1877     CALL wrk_alloc(nb_type , zsumclasses ) 
    18781878 
    18791879     zsumclasses(:)=0._wp 
    1880      zslope = sec%slopeSection        
    1881       
     1880     zslope = sec%slopeSection 
     1881 
    18821882     IF( lwp ) THEN 
    18831883         IF  ( ln_dct_ascii ) THEN 
     
    18851885         ELSE 
    18861886             WRITE(numdct_NOOS) nyear,nmonth,nday,ksec-1,sec%nb_class-1,sec%name 
    1887          ENDIF   
     1887         ENDIF 
    18881888     ENDIF 
    1889      
    1890      ! Sum all classes together, to give one values per type (pos tran, neg vol trans etc...).  
     1889 
     1890     ! Sum all classes together, to give one values per type (pos tran, neg vol trans etc...). 
    18911891     DO jclass=1,MAX(1,sec%nb_class-1) 
    18921892        zsumclasses(1:nb_type)=zsumclasses(1:nb_type)+sec%transport(1:nb_type,jclass) 
    18931893     ENDDO 
    1894   
     1894 
    18951895     classe   = 'total   ' 
    18961896     zbnd1   = 0._wp 
    18971897     zbnd2   = 0._wp 
    1898       
    1899       
    1900       
     1898 
     1899 
     1900 
    19011901     write (noos_sect_name, "(I0.3)")  ksec 
    1902       
     1902 
    19031903     IF ( ln_dct_iom_cont ) THEN 
    19041904         max_iom_val = 1.e10 
     
    19061906            IF( ierr /= 0 )   CALL ctl_stop( 'dia_dct_wri_NOOS: failed to allocate noos_iom_dummy array' ) 
    19071907     ENDIF 
    1908       
     1908 
    19091909!     JT 
    19101910!     JT 
     
    19201920! 
    19211921!     IF ( zslope .gt. 0._wp .and. zslope .ne. 10000._wp ) THEN 
    1922 !          
     1922! 
    19231923!         IF( lwp ) THEN 
    19241924!             WRITE(numdct_NOOS,'(9e12.4E2)') -(zsumclasses( 1)+zsumclasses( 2)), -zsumclasses( 2),-zsumclasses( 1),   & 
    19251925!                                            -(zsumclasses( 7)+zsumclasses( 8)), -zsumclasses( 8),-zsumclasses( 7),   & 
    19261926!                                            -(zsumclasses( 9)+zsumclasses(10)), -zsumclasses(10),-zsumclasses( 9) 
    1927 !             CALL FLUSH(numdct_NOOS)  
     1927!             CALL FLUSH(numdct_NOOS) 
    19281928!         endif 
    19291929 
    1930 !          
     1930! 
    19311931!         IF ( ln_dct_iom_cont ) THEN 
    1932 !          
     1932! 
    19331933!             noos_iom_dummy(:,:,:) = 0. 
    1934 !              
     1934! 
    19351935!             tmp_iom_output(:) = 0. 
    19361936!             tmp_iom_output(1) = -(zsumclasses( 1)+zsumclasses( 2)) 
    19371937!             tmp_iom_output(2) = -zsumclasses( 2) 
    19381938!             tmp_iom_output(3) = -zsumclasses( 1) 
    1939 !              
    1940 !             ! Convert to Sv  
     1939! 
     1940!             ! Convert to Sv 
    19411941!             tmp_iom_output(1) = tmp_iom_output(1)*1.E-6 
    19421942!             tmp_iom_output(2) = tmp_iom_output(2)*1.E-6 
    19431943!             tmp_iom_output(3) = tmp_iom_output(3)*1.E-6 
    1944 !              
     1944! 
    19451945!             ! limit maximum and minimum values in iom_put 
    19461946!             if ( tmp_iom_output(1) .gt.  max_iom_val ) tmp_iom_output(1) =  max_iom_val 
     
    19501950!             if ( tmp_iom_output(3) .gt.  max_iom_val ) tmp_iom_output(3) =  max_iom_val 
    19511951!             if ( tmp_iom_output(3) .lt. -max_iom_val ) tmp_iom_output(3) = -max_iom_val 
    1952 !              
    1953 !             ! Set NaN's to Zero          
     1952! 
     1953!             ! Set NaN's to Zero 
    19541954!             if ( tmp_iom_output(1) .ne.  tmp_iom_output(1) ) tmp_iom_output(1) =  max_iom_val*2 
    19551955!             if ( tmp_iom_output(2) .ne.  tmp_iom_output(2) ) tmp_iom_output(1) =  max_iom_val*2 
    19561956!             if ( tmp_iom_output(3) .ne.  tmp_iom_output(3) ) tmp_iom_output(1) =  max_iom_val*2 
    1957 !              
     1957! 
    19581958!             noos_iom_dummy(:,:,1) = tmp_iom_output(1) 
    19591959!             noos_iom_dummy(:,:,2) = tmp_iom_output(2) 
    19601960!             noos_iom_dummy(:,:,3) = tmp_iom_output(3) 
    1961 !              
     1961! 
    19621962!             noos_var_sect_name = "noos_" // trim(noos_sect_name) // '_trans' 
    19631963!             if ( lwp ) WRITE(numout,*) 'dia_dct_wri_NOOS iom_put: ', kt,ksec, noos_var_sect_name 
    19641964!             CALL iom_put( noos_var_sect_name,  noos_iom_dummy ) 
    1965 !             noos_iom_dummy(:,:,:) = 0.          
     1965!             noos_iom_dummy(:,:,:) = 0. 
    19661966!             tmp_iom_output(:) = 0. 
    19671967!             tmp_iom_output(1) = -(zsumclasses( 7)+zsumclasses( 8)) 
    19681968!             tmp_iom_output(2) = -zsumclasses( 8) 
    19691969!             tmp_iom_output(3) = -zsumclasses( 7) 
    1970 !              
     1970! 
    19711971!             ! Convert to TJ/s 
    19721972!             tmp_iom_output(1) = tmp_iom_output(1)*1.E-12 
    19731973!             tmp_iom_output(2) = tmp_iom_output(2)*1.E-12 
    19741974!             tmp_iom_output(3) = tmp_iom_output(3)*1.E-12 
    1975 !              
     1975! 
    19761976!             ! limit maximum and minimum values in iom_put 
    19771977!             if ( tmp_iom_output(1) .gt.  max_iom_val ) tmp_iom_output(1) =  max_iom_val 
     
    19811981!             if ( tmp_iom_output(3) .gt.  max_iom_val ) tmp_iom_output(3) =  max_iom_val 
    19821982!             if ( tmp_iom_output(3) .lt. -max_iom_val ) tmp_iom_output(3) = -max_iom_val 
    1983 !              
    1984 !             ! Set NaN's to Zero          
     1983! 
     1984!             ! Set NaN's to Zero 
    19851985!             if ( tmp_iom_output(1) .ne.  tmp_iom_output(1) ) tmp_iom_output(1) =  max_iom_val*2 
    19861986!             if ( tmp_iom_output(2) .ne.  tmp_iom_output(2) ) tmp_iom_output(1) =  max_iom_val*2 
    19871987!             if ( tmp_iom_output(3) .ne.  tmp_iom_output(3) ) tmp_iom_output(1) =  max_iom_val*2 
    1988 !              
     1988! 
    19891989!             noos_iom_dummy(:,:,1) = tmp_iom_output(1) 
    19901990!             noos_iom_dummy(:,:,2) = tmp_iom_output(2) 
    19911991!             noos_iom_dummy(:,:,3) = tmp_iom_output(3) 
    1992 !              
     1992! 
    19931993!             !noos_iom_dummy(:,:,1) = -(zsumclasses( 7)+zsumclasses( 8)) 
    19941994!             !noos_iom_dummy(:,:,2) = -zsumclasses( 8) 
    19951995!             !noos_iom_dummy(:,:,3) = -zsumclasses( 7) 
    1996 !              
     1996! 
    19971997!             noos_var_sect_name =  "noos_" // trim(noos_sect_name) // '_heat' 
    19981998!             if ( lwp ) WRITE(numout,*) 'dia_dct_wri_NOOS iom_put: ', kt,ksec, noos_var_sect_name 
    19991999!             CALL iom_put( noos_var_sect_name,  noos_iom_dummy ) 
    2000 !               
    2001 !             noos_iom_dummy(:,:,:) = 0.          
    2002 !             tmp_iom_output(:) = 0.          
     2000! 
     2001!             noos_iom_dummy(:,:,:) = 0. 
     2002!             tmp_iom_output(:) = 0. 
    20032003!             tmp_iom_output(1) = -(zsumclasses( 9)+zsumclasses( 10)) 
    20042004!             tmp_iom_output(2) = -zsumclasses( 10) 
    20052005!             tmp_iom_output(3) = -zsumclasses( 9) 
    2006 !              
     2006! 
    20072007!             ! Convert to  MT/s 
    20082008!             tmp_iom_output(1) = tmp_iom_output(1)*1.E-6 
    20092009!             tmp_iom_output(2) = tmp_iom_output(2)*1.E-6 
    20102010!             tmp_iom_output(3) = tmp_iom_output(3)*1.E-6 
    2011 !              
     2011! 
    20122012!             ! limit maximum and minimum values in iom_put 
    20132013!             if ( tmp_iom_output(1) .gt.  max_iom_val ) tmp_iom_output(1) =  max_iom_val 
     
    20172017!             if ( tmp_iom_output(3) .gt.  max_iom_val ) tmp_iom_output(3) =  max_iom_val 
    20182018!             if ( tmp_iom_output(3) .lt. -max_iom_val ) tmp_iom_output(3) = -max_iom_val 
    2019 !              
    2020 !             ! Set NaN's to Zero          
     2019! 
     2020!             ! Set NaN's to Zero 
    20212021!             if ( tmp_iom_output(1) .ne.  tmp_iom_output(1) ) tmp_iom_output(1) =  max_iom_val*2 
    20222022!             if ( tmp_iom_output(2) .ne.  tmp_iom_output(2) ) tmp_iom_output(1) =  max_iom_val*2 
    20232023!             if ( tmp_iom_output(3) .ne.  tmp_iom_output(3) ) tmp_iom_output(1) =  max_iom_val*2 
    2024 !              
     2024! 
    20252025!             noos_iom_dummy(:,:,1) = tmp_iom_output(1) 
    20262026!             noos_iom_dummy(:,:,2) = tmp_iom_output(2) 
    20272027!             noos_iom_dummy(:,:,3) = tmp_iom_output(3) 
    2028 !              
     2028! 
    20292029!             !noos_iom_dummy(:,:,1) = -(zsumclasses( 9)+zsumclasses( 10)) 
    20302030!             !noos_iom_dummy(:,:,2) = -zsumclasses( 10) 
    20312031!             !noos_iom_dummy(:,:,3) = -zsumclasses( 9) 
    2032 !              
     2032! 
    20332033!             noos_var_sect_name =  "noos_" // trim(noos_sect_name) // '_salt' 
    20342034!             if ( lwp ) WRITE(numout,*) 'dia_dct_wri_NOOS iom_put: ', kt,ksec, noos_var_sect_name 
    20352035!             CALL iom_put( noos_var_sect_name,  noos_iom_dummy ) 
    2036 !             noos_iom_dummy(:,:,:) = 0.      
    2037 !             tmp_iom_output(:) = 0.     
     2036!             noos_iom_dummy(:,:,:) = 0. 
     2037!             tmp_iom_output(:) = 0. 
    20382038!         ENDIF 
    20392039!     ELSE 
     
    20422042!                                            zsumclasses( 7)+zsumclasses( 8) ,  zsumclasses( 7), zsumclasses( 8),   & 
    20432043!                                            zsumclasses( 9)+zsumclasses(10) ,  zsumclasses( 9), zsumclasses(10) 
    2044 !            CALL FLUSH(numdct_NOOS)  
     2044!            CALL FLUSH(numdct_NOOS) 
    20452045!        endif 
    2046 !          
    2047 !          
     2046! 
     2047! 
    20482048!        IF ( ln_dct_iom_cont ) THEN 
    2049 !             
     2049! 
    20502050!             noos_iom_dummy(:,:,:) = 0. 
    20512051!             tmp_iom_output(:) = 0. 
    2052 !              
     2052! 
    20532053!             tmp_iom_output(1) = (zsumclasses( 1)+zsumclasses( 2)) 
    20542054!             tmp_iom_output(2) = zsumclasses( 1) 
    20552055!             tmp_iom_output(3) = zsumclasses( 2) 
    2056 !              
     2056! 
    20572057!             ! Convert to Sv 
    20582058!             tmp_iom_output(1) = tmp_iom_output(1)*1.E-6 
    20592059!             tmp_iom_output(2) = tmp_iom_output(2)*1.E-6 
    20602060!             tmp_iom_output(3) = tmp_iom_output(3)*1.E-6 
    2061 !              
     2061! 
    20622062!             ! limit maximum and minimum values in iom_put 
    20632063!             if ( tmp_iom_output(1) .gt.  max_iom_val ) tmp_iom_output(1) =  max_iom_val 
     
    20672067!             if ( tmp_iom_output(3) .gt.  max_iom_val ) tmp_iom_output(3) =  max_iom_val 
    20682068!             if ( tmp_iom_output(3) .lt. -max_iom_val ) tmp_iom_output(3) = -max_iom_val 
    2069 !              
    2070 !             ! Set NaN's to Zero          
     2069! 
     2070!             ! Set NaN's to Zero 
    20712071!             if ( tmp_iom_output(1) .ne.  tmp_iom_output(1) ) tmp_iom_output(1) =  max_iom_val*2 
    20722072!             if ( tmp_iom_output(2) .ne.  tmp_iom_output(2) ) tmp_iom_output(1) =  max_iom_val*2 
    20732073!             if ( tmp_iom_output(3) .ne.  tmp_iom_output(3) ) tmp_iom_output(1) =  max_iom_val*2 
    2074 !              
     2074! 
    20752075!             noos_iom_dummy(:,:,1) = tmp_iom_output(1) 
    20762076!             noos_iom_dummy(:,:,2) = tmp_iom_output(2) 
    20772077!             noos_iom_dummy(:,:,3) = tmp_iom_output(3) 
    2078 !              
     2078! 
    20792079!             !noos_iom_dummy(:,:,1) = (zsumclasses( 1)+zsumclasses( 2)) 
    20802080!             !noos_iom_dummy(:,:,2) = zsumclasses( 1) 
    20812081!             !noos_iom_dummy(:,:,3) = zsumclasses( 2) 
    2082 !              
    2083 !              
    2084 !              
     2082! 
     2083! 
     2084! 
    20852085!             noos_var_sect_name = "noos_" // trim(noos_sect_name) // '_trans' 
    20862086!             if ( lwp ) WRITE(numout,*) 'dia_dct_wri_NOOS iom_put: ', kt,ksec, noos_var_sect_name 
     
    20882088!             noos_iom_dummy(:,:,:) = 0. 
    20892089!             tmp_iom_output(:) = 0. 
    2090 !              
     2090! 
    20912091!             tmp_iom_output(1) = (zsumclasses( 7)+zsumclasses( 8)) 
    20922092!             tmp_iom_output(2) = zsumclasses( 7) 
    20932093!             tmp_iom_output(3) = zsumclasses( 8) 
    2094 !              
     2094! 
    20952095!             ! Convert to TJ/s 
    20962096!             tmp_iom_output(1) = tmp_iom_output(1)*1.E-12 
    20972097!             tmp_iom_output(2) = tmp_iom_output(2)*1.E-12 
    20982098!             tmp_iom_output(3) = tmp_iom_output(3)*1.E-12 
    2099 !              
     2099! 
    21002100!             ! limit maximum and minimum values in iom_put 
    21012101!             if ( tmp_iom_output(1) .gt.  max_iom_val ) tmp_iom_output(1) =  max_iom_val 
     
    21052105!             if ( tmp_iom_output(3) .gt.  max_iom_val ) tmp_iom_output(3) =  max_iom_val 
    21062106!             if ( tmp_iom_output(3) .lt. -max_iom_val ) tmp_iom_output(3) = -max_iom_val 
    2107 !              
    2108 !             ! Set NaN's to Zero          
     2107! 
     2108!             ! Set NaN's to Zero 
    21092109!             if ( tmp_iom_output(1) .ne.  tmp_iom_output(1) ) tmp_iom_output(1) =  max_iom_val*2 
    21102110!             if ( tmp_iom_output(2) .ne.  tmp_iom_output(2) ) tmp_iom_output(1) =  max_iom_val*2 
    21112111!             if ( tmp_iom_output(3) .ne.  tmp_iom_output(3) ) tmp_iom_output(1) =  max_iom_val*2 
    2112 !              
     2112! 
    21132113!             noos_iom_dummy(:,:,1) = tmp_iom_output(1) 
    21142114!             noos_iom_dummy(:,:,2) = tmp_iom_output(2) 
    21152115!             noos_iom_dummy(:,:,3) = tmp_iom_output(3) 
    2116 !              
     2116! 
    21172117!             !noos_iom_dummy(:,:,1) = (zsumclasses( 7)+zsumclasses( 8)) 
    21182118!             !noos_iom_dummy(:,:,2) = zsumclasses( 7) 
    21192119!             !noos_iom_dummy(:,:,3) = zsumclasses( 8) 
    2120 !              
     2120! 
    21212121!             noos_var_sect_name =  "noos_" // trim(noos_sect_name) // '_heat' 
    21222122!             if ( lwp ) WRITE(numout,*) 'dia_dct_wri_NOOS iom_put: ', kt,ksec, noos_var_sect_name 
    2123 !             CALL iom_put(noos_var_sect_name,  noos_iom_dummy )   
     2123!             CALL iom_put(noos_var_sect_name,  noos_iom_dummy ) 
    21242124!             noos_iom_dummy(:,:,:) = 0. 
    21252125!             tmp_iom_output(:) = 0. 
    2126 !              
     2126! 
    21272127!             tmp_iom_output(1) = (zsumclasses( 9)+zsumclasses( 10)) 
    21282128!             tmp_iom_output(2) = zsumclasses( 9) 
    21292129!             tmp_iom_output(3) = zsumclasses( 10) 
    2130 !              
     2130! 
    21312131!             ! Convert to  MT/s 
    21322132!             tmp_iom_output(1) = tmp_iom_output(1)*1.E-6 
    21332133!             tmp_iom_output(2) = tmp_iom_output(2)*1.E-6 
    21342134!             tmp_iom_output(3) = tmp_iom_output(3)*1.E-6 
    2135 !              
    2136 !              
     2135! 
     2136! 
    21372137!             ! limit maximum and minimum values in iom_put 
    21382138!             if ( tmp_iom_output(1) .gt.  max_iom_val ) tmp_iom_output(1) =  max_iom_val 
     
    21422142!             if ( tmp_iom_output(3) .gt.  max_iom_val ) tmp_iom_output(3) =  max_iom_val 
    21432143!             if ( tmp_iom_output(3) .lt. -max_iom_val ) tmp_iom_output(3) = -max_iom_val 
    2144 !              
    2145 !             ! Set NaN's to Zero          
     2144! 
     2145!             ! Set NaN's to Zero 
    21462146!             if ( tmp_iom_output(1) .ne.  tmp_iom_output(1) ) tmp_iom_output(1) =  max_iom_val*2 
    21472147!             if ( tmp_iom_output(2) .ne.  tmp_iom_output(2) ) tmp_iom_output(1) =  max_iom_val*2 
    21482148!             if ( tmp_iom_output(3) .ne.  tmp_iom_output(3) ) tmp_iom_output(1) =  max_iom_val*2 
    2149 !              
     2149! 
    21502150!             noos_iom_dummy(:,:,1) = tmp_iom_output(1) 
    21512151!             noos_iom_dummy(:,:,2) = tmp_iom_output(2) 
    21522152!             noos_iom_dummy(:,:,3) = tmp_iom_output(3) 
    2153 !              
     2153! 
    21542154!             !noos_iom_dummy(:,:,1) = (zsumclasses( 9)+zsumclasses( 10)) 
    21552155!             !noos_iom_dummy(:,:,2) = zsumclasses( 9) 
    21562156!             !noos_iom_dummy(:,:,3) = zsumclasses( 10) 
    2157 !              
     2157! 
    21582158!             noos_var_sect_name = "noos_" // trim(noos_sect_name) // '_salt' 
    21592159!             if ( lwp ) WRITE(numout,*) 'dia_dct_wri_NOOS iom_put: ', kt,ksec, noos_var_sect_name 
    21602160!             CALL iom_put(noos_var_sect_name,  noos_iom_dummy ) 
    2161 !             noos_iom_dummy(:,:,:) = 0.          
     2161!             noos_iom_dummy(:,:,:) = 0. 
    21622162!             tmp_iom_output(:) = 0. 
    21632163!         ENDIF 
    2164 !          
    2165 !     ENDIF  
    2166       
    2167  
    2168  
    2169  
    2170  
    2171  
    2172  
    2173  
    2174       
    2175       
     2164! 
     2165!     ENDIF 
     2166 
     2167 
     2168 
     2169 
     2170 
     2171 
     2172 
     2173 
     2174 
     2175 
    21762176     IF( lwp ) THEN 
    21772177        IF  ( ln_dct_ascii ) THEN 
     
    21852185                                  zsumclasses( 7)+zsumclasses( 8) ,  zsumclasses( 7), zsumclasses( 8),   & 
    21862186                                  zsumclasses( 9)+zsumclasses(10) ,  zsumclasses( 9), zsumclasses(10) 
    2187              CALL FLUSH(numdct_NOOS)  
     2187             CALL FLUSH(numdct_NOOS) 
    21882188         ENDIF 
    21892189     ENDIF 
    2190           
     2190 
    21912191    IF ( ln_dct_iom_cont ) THEN 
    2192          
     2192 
    21932193         noos_iom_dummy(:,:,:) = 0. 
    21942194         tmp_iom_output(:) = 0. 
    2195           
     2195 
    21962196         tmp_iom_output(1) = (zsumclasses( 1)+zsumclasses( 2)) 
    21972197         tmp_iom_output(2) = zsumclasses( 1) 
    21982198         tmp_iom_output(3) = zsumclasses( 2) 
    2199           
     2199 
    22002200         ! Convert to Sv 
    22012201         tmp_iom_output(1) = tmp_iom_output(1)*1.E-6 
    22022202         tmp_iom_output(2) = tmp_iom_output(2)*1.E-6 
    22032203         tmp_iom_output(3) = tmp_iom_output(3)*1.E-6 
    2204           
     2204 
    22052205         ! limit maximum and minimum values in iom_put 
    22062206         if ( tmp_iom_output(1) .gt.  max_iom_val ) tmp_iom_output(1) =  max_iom_val 
     
    22102210         if ( tmp_iom_output(3) .gt.  max_iom_val ) tmp_iom_output(3) =  max_iom_val 
    22112211         if ( tmp_iom_output(3) .lt. -max_iom_val ) tmp_iom_output(3) = -max_iom_val 
    2212           
    2213          ! Set NaN's to Zero          
     2212 
     2213         ! Set NaN's to Zero 
    22142214         if ( tmp_iom_output(1) .ne.  tmp_iom_output(1) ) tmp_iom_output(1) =  max_iom_val*2 
    22152215         if ( tmp_iom_output(2) .ne.  tmp_iom_output(2) ) tmp_iom_output(1) =  max_iom_val*2 
    22162216         if ( tmp_iom_output(3) .ne.  tmp_iom_output(3) ) tmp_iom_output(1) =  max_iom_val*2 
    2217           
     2217 
    22182218         noos_iom_dummy(:,:,1) = tmp_iom_output(1) 
    22192219         noos_iom_dummy(:,:,2) = tmp_iom_output(2) 
    22202220         noos_iom_dummy(:,:,3) = tmp_iom_output(3) 
    2221           
     2221 
    22222222         !noos_iom_dummy(:,:,1) = (zsumclasses( 1)+zsumclasses( 2)) 
    22232223         !noos_iom_dummy(:,:,2) = zsumclasses( 1) 
    22242224         !noos_iom_dummy(:,:,3) = zsumclasses( 2) 
    2225           
    2226           
    2227           
     2225 
     2226 
     2227 
    22282228         noos_var_sect_name = "noos_" // trim(noos_sect_name) // '_trans' 
    22292229         if ( lwp ) WRITE(numout,*) 'dia_dct_wri_NOOS iom_put: ', kt,ksec, noos_var_sect_name 
     
    22312231         noos_iom_dummy(:,:,:) = 0. 
    22322232         tmp_iom_output(:) = 0. 
    2233           
     2233 
    22342234         tmp_iom_output(1) = (zsumclasses( 7)+zsumclasses( 8)) 
    22352235         tmp_iom_output(2) = zsumclasses( 7) 
    22362236         tmp_iom_output(3) = zsumclasses( 8) 
    2237           
     2237 
    22382238         ! Convert to TJ/s 
    22392239         tmp_iom_output(1) = tmp_iom_output(1)*1.E-12 
    22402240         tmp_iom_output(2) = tmp_iom_output(2)*1.E-12 
    22412241         tmp_iom_output(3) = tmp_iom_output(3)*1.E-12 
    2242           
     2242 
    22432243         ! limit maximum and minimum values in iom_put 
    22442244         if ( tmp_iom_output(1) .gt.  max_iom_val ) tmp_iom_output(1) =  max_iom_val 
     
    22482248         if ( tmp_iom_output(3) .gt.  max_iom_val ) tmp_iom_output(3) =  max_iom_val 
    22492249         if ( tmp_iom_output(3) .lt. -max_iom_val ) tmp_iom_output(3) = -max_iom_val 
    2250           
    2251          ! Set NaN's to Zero          
     2250 
     2251         ! Set NaN's to Zero 
    22522252         if ( tmp_iom_output(1) .ne.  tmp_iom_output(1) ) tmp_iom_output(1) =  max_iom_val*2 
    22532253         if ( tmp_iom_output(2) .ne.  tmp_iom_output(2) ) tmp_iom_output(1) =  max_iom_val*2 
    22542254         if ( tmp_iom_output(3) .ne.  tmp_iom_output(3) ) tmp_iom_output(1) =  max_iom_val*2 
    2255           
     2255 
    22562256         noos_iom_dummy(:,:,1) = tmp_iom_output(1) 
    22572257         noos_iom_dummy(:,:,2) = tmp_iom_output(2) 
    22582258         noos_iom_dummy(:,:,3) = tmp_iom_output(3) 
    2259           
     2259 
    22602260         !noos_iom_dummy(:,:,1) = (zsumclasses( 7)+zsumclasses( 8)) 
    22612261         !noos_iom_dummy(:,:,2) = zsumclasses( 7) 
    22622262         !noos_iom_dummy(:,:,3) = zsumclasses( 8) 
    2263           
     2263 
    22642264         noos_var_sect_name =  "noos_" // trim(noos_sect_name) // '_heat' 
    22652265         if ( lwp ) WRITE(numout,*) 'dia_dct_wri_NOOS iom_put: ', kt,ksec, noos_var_sect_name 
    2266          CALL iom_put(noos_var_sect_name,  noos_iom_dummy )   
     2266         CALL iom_put(noos_var_sect_name,  noos_iom_dummy ) 
    22672267         noos_iom_dummy(:,:,:) = 0. 
    22682268         tmp_iom_output(:) = 0. 
    2269           
     2269 
    22702270         tmp_iom_output(1) = (zsumclasses( 9)+zsumclasses( 10)) 
    22712271         tmp_iom_output(2) = zsumclasses( 9) 
    22722272         tmp_iom_output(3) = zsumclasses( 10) 
    2273           
     2273 
    22742274         ! Convert to  MT/s 
    22752275         tmp_iom_output(1) = tmp_iom_output(1)*1.E-6 
    22762276         tmp_iom_output(2) = tmp_iom_output(2)*1.E-6 
    22772277         tmp_iom_output(3) = tmp_iom_output(3)*1.E-6 
    2278           
    2279           
     2278 
     2279 
    22802280         ! limit maximum and minimum values in iom_put 
    22812281         if ( tmp_iom_output(1) .gt.  max_iom_val ) tmp_iom_output(1) =  max_iom_val 
     
    22852285         if ( tmp_iom_output(3) .gt.  max_iom_val ) tmp_iom_output(3) =  max_iom_val 
    22862286         if ( tmp_iom_output(3) .lt. -max_iom_val ) tmp_iom_output(3) = -max_iom_val 
    2287           
    2288          ! Set NaN's to Zero          
     2287 
     2288         ! Set NaN's to Zero 
    22892289         if ( tmp_iom_output(1) .ne.  tmp_iom_output(1) ) tmp_iom_output(1) =  max_iom_val*2 
    22902290         if ( tmp_iom_output(2) .ne.  tmp_iom_output(2) ) tmp_iom_output(1) =  max_iom_val*2 
    22912291         if ( tmp_iom_output(3) .ne.  tmp_iom_output(3) ) tmp_iom_output(1) =  max_iom_val*2 
    2292           
     2292 
    22932293         noos_iom_dummy(:,:,1) = tmp_iom_output(1) 
    22942294         noos_iom_dummy(:,:,2) = tmp_iom_output(2) 
    22952295         noos_iom_dummy(:,:,3) = tmp_iom_output(3) 
    2296           
     2296 
    22972297         !noos_iom_dummy(:,:,1) = (zsumclasses( 9)+zsumclasses( 10)) 
    22982298         !noos_iom_dummy(:,:,2) = zsumclasses( 9) 
    22992299         !noos_iom_dummy(:,:,3) = zsumclasses( 10) 
    2300           
     2300 
    23012301         noos_var_sect_name = "noos_" // trim(noos_sect_name) // '_salt' 
    23022302         if ( lwp ) WRITE(numout,*) 'dia_dct_wri_NOOS iom_put: ', kt,ksec, noos_var_sect_name 
    23032303         CALL iom_put(noos_var_sect_name,  noos_iom_dummy ) 
    2304          noos_iom_dummy(:,:,:) = 0.          
     2304         noos_iom_dummy(:,:,:) = 0. 
    23052305         tmp_iom_output(:) = 0. 
    23062306 
     
    23082308        DEALLOCATE(noos_iom_dummy) 
    23092309     ENDIF 
    2310       
     2310 
    23112311 
    23122312     DO jclass=1,MAX(1,sec%nb_class-1) 
    2313     
     2313 
    23142314        classe   = 'N       ' 
    23152315        zbnd1   = 0._wp 
     
    23322332        !depth classes transports 
    23332333        IF( ( sec%zlay(jclass)    .NE. 99._wp ) .AND. & 
    2334             ( sec%zlay(jclass+1)  .NE. 99._wp )       )THEN  
     2334            ( sec%zlay(jclass+1)  .NE. 99._wp )       )THEN 
    23352335           classe = 'Z       ' 
    23362336           zbnd1 = sec%zlay(jclass) 
     
    23422342           classe = 'S       ' 
    23432343           zbnd1 = sec%zsal(jclass) 
    2344            zbnd2 = sec%zsal(jclass+1)    
     2344           zbnd2 = sec%zsal(jclass+1) 
    23452345        ENDIF 
    23462346        !temperature classes transports 
     
    23512351           zbnd2 = sec%ztem(jclass+1) 
    23522352        ENDIF 
    2353                    
     2353 
    23542354        !write volume transport per class 
    23552355        IF( lwp ) THEN 
    2356              
     2356 
    23572357            IF  ( ln_dct_ascii ) THEN 
    23582358                CALL FLUSH(numdct_NOOS) ! JT crash 
     
    23872387 
    23882388     ENDDO 
    2389       
     2389 
    23902390     !IF  ( ln_dct_ascii ) THEN 
    23912391        if ( lwp ) CALL FLUSH(numdct_NOOS) 
    23922392     !ENDIF 
    23932393 
    2394      CALL wrk_dealloc(nb_type , zsumclasses )   
     2394     CALL wrk_dealloc(nb_type , zsumclasses ) 
    23952395 
    23962396  END SUBROUTINE dia_dct_wri_NOOS 
     
    24002400     !! As routine dia_dct_wri_NOOS but for hourly output files 
    24012401     !! 
    2402      !! Write transport output in numdct using NOOS formatting  
    2403      !!  
     2402     !! Write transport output in numdct using NOOS formatting 
     2403     !! 
    24042404     !! Purpose: Write  transports in ascii files 
    2405      !!  
     2405     !! 
    24062406     !! Method: 
    24072407     !!        1. Write volume transports in "volume_transport" 
    2408      !!           Unit: Sv : area * Velocity / 1.e6  
    2409      !! 
    2410      !!-------------------------------------------------------------  
     2408     !!           Unit: Sv : area * Velocity / 1.e6 
     2409     !! 
     2410     !!------------------------------------------------------------- 
    24112411     !!arguments 
    24122412     INTEGER, INTENT(IN)          :: hr          ! hour => effectively kt/12 
    2413      TYPE(SECTION), INTENT(INOUT) :: sec         ! section to write    
     2413     TYPE(SECTION), INTENT(INOUT) :: sec         ! section to write 
    24142414     INTEGER ,INTENT(IN)          :: ksec        ! section number 
    24152415 
    24162416     !!local declarations 
    24172417     INTEGER               :: jclass,jhr            ! Dummy loop 
    2418      CHARACTER(len=2)      :: classe             ! Classname  
     2418     CHARACTER(len=2)      :: classe             ! Classname 
    24192419     REAL(wp)              :: zbnd1,zbnd2        ! Class bounds 
    24202420     REAL(wp)              :: zslope             ! section's slope coeff 
    24212421     ! 
    2422      REAL(wp), POINTER, DIMENSION(:):: zsumclasses ! 1D workspace  
    2423      CHARACTER(len=3)      :: noos_sect_name             ! Classname  
     2422     REAL(wp), POINTER, DIMENSION(:):: zsumclasses ! 1D workspace 
     2423     CHARACTER(len=3)      :: noos_sect_name             ! Classname 
    24242424     CHARACTER(len=25)      :: noos_var_sect_name 
    24252425     REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   noos_iom_dummy 
    24262426     INTEGER               :: IERR 
    2427       
    2428      !!-------------------------------------------------------------  
     2427 
     2428     !!------------------------------------------------------------- 
    24292429 
    24302430     IF( lwp ) THEN 
     
    24322432        WRITE(numout,*) "dia_dct_wri_NOOS_h: write transports through section Transect:",ksec-1," at timestep: ", hr 
    24332433        WRITE(numout,*) "~~~~~~~~~~~~~~~~~~~~~" 
    2434      ENDIF    
    2435       
    2436      CALL wrk_alloc(nb_type , zsumclasses )  
    2437       
    2438       
     2434     ENDIF 
     2435 
     2436     CALL wrk_alloc(nb_type , zsumclasses ) 
     2437 
     2438 
    24392439     write (noos_sect_name, "(I03)")  ksec 
    2440       
     2440 
    24412441     ALLOCATE( noos_iom_dummy(jpi,jpj,3),  STAT= ierr ) 
    24422442        IF( ierr /= 0 )   CALL ctl_stop( 'dia_dct_wri_NOOS_h: failed to allocate noos_iom_dummy array' ) 
     
    24442444 
    24452445 
    2446       
     2446 
    24472447 
    24482448     zsumclasses(:)=0._wp 
    2449      zslope = sec%slopeSection        
     2449     zslope = sec%slopeSection 
    24502450 
    24512451     ! Sum up all classes, to give the total per type (pos vol trans, neg vol trans etc...) 
     
    24532453        zsumclasses(1:nb_type)=zsumclasses(1:nb_type)+sec%transport_h(1:nb_type,jclass) 
    24542454     ENDDO 
    2455          
    2456       
     2455 
     2456 
    24572457     ! JT 
    24582458     ! JT 
     
    24852485     ! JT        ENDIF 
    24862486     ! JT     ENDDO 
    2487       
     2487 
    24882488     !write volume transport per class 
    24892489     ! Sum positive and vol trans for all classes in first cell of array 
     
    25002500     ENDDO 
    25012501 
    2502      
     2502 
    25032503    IF( lwp )  THEN 
    25042504        ! JT IF ( hr .eq. 48._wp ) THEN 
     
    25262526 
    25272527 
    2528      ENDIF  
     2528     ENDIF 
    25292529 
    25302530 
    25312531     CALL wrk_dealloc(nb_type , zsumclasses ) 
    2532       
     2532 
    25332533     DEALLOCATE(noos_iom_dummy) 
    25342534 
     
    25392539  SUBROUTINE dia_dct_wri(kt,ksec,sec) 
    25402540     !!------------------------------------------------------------- 
    2541      !! Write transport output in numdct  
    2542      !!  
     2541     !! Write transport output in numdct 
     2542     !! 
    25432543     !! Purpose: Write  transports in ascii files 
    2544      !!  
     2544     !! 
    25452545     !! Method: 
    25462546     !!        1. Write volume transports in "volume_transport" 
    2547      !!           Unit: Sv : area * Velocity / 1.e6  
    2548      !!  
     2547     !!           Unit: Sv : area * Velocity / 1.e6 
     2548     !! 
    25492549     !!        2. Write heat transports in "heat_transport" 
    25502550     !!           Unit: Peta W : area * Velocity * T * rhau * Cp / 1.e15 
    2551      !!  
     2551     !! 
    25522552     !!        3. Write salt transports in "salt_transport" 
    25532553     !!           Unit: 10^9 g m^3 / s : area * Velocity * S / 1.e6 
    25542554     !! 
    2555      !!-------------------------------------------------------------  
     2555     !!------------------------------------------------------------- 
    25562556     !!arguments 
    25572557     INTEGER, INTENT(IN)          :: kt          ! time-step 
    2558      TYPE(SECTION), INTENT(INOUT) :: sec         ! section to write    
     2558     TYPE(SECTION), INTENT(INOUT) :: sec         ! section to write 
    25592559     INTEGER ,INTENT(IN)          :: ksec        ! section number 
    25602560 
    25612561     !!local declarations 
    25622562     INTEGER               :: jclass             ! Dummy loop 
    2563      CHARACTER(len=2)      :: classe             ! Classname  
     2563     CHARACTER(len=2)      :: classe             ! Classname 
    25642564     REAL(wp)              :: zbnd1,zbnd2        ! Class bounds 
    25652565     REAL(wp)              :: zslope             ! section's slope coeff 
    25662566     ! 
    2567      REAL(wp), POINTER, DIMENSION(:):: zsumclasses ! 1D workspace  
    2568      !!-------------------------------------------------------------  
    2569      CALL wrk_alloc(nb_type , zsumclasses )   
     2567     REAL(wp), POINTER, DIMENSION(:):: zsumclasses ! 1D workspace 
     2568     !!------------------------------------------------------------- 
     2569     CALL wrk_alloc(nb_type , zsumclasses ) 
    25702570 
    25712571     zsumclasses(:)=0._wp 
    2572      zslope = sec%slopeSection        
    2573  
    2574   
     2572     zslope = sec%slopeSection 
     2573 
     2574 
    25752575     DO jclass=1,MAX(1,sec%nb_class-1) 
    25762576 
     
    25802580        zsumclasses(1:nb_type)=zsumclasses(1:nb_type)+sec%transport(1:nb_type,jclass) 
    25812581 
    2582     
     2582 
    25832583        !insitu density classes transports 
    25842584        IF( ( sec%zsigi(jclass)   .NE. 99._wp ) .AND. & 
     
    25972597        !depth classes transports 
    25982598        IF( ( sec%zlay(jclass)    .NE. 99._wp ) .AND. & 
    2599             ( sec%zlay(jclass+1)  .NE. 99._wp )       )THEN  
     2599            ( sec%zlay(jclass+1)  .NE. 99._wp )       )THEN 
    26002600           classe = 'Z       ' 
    26012601           zbnd1 = sec%zlay(jclass) 
     
    26072607           classe = 'S       ' 
    26082608           zbnd1 = sec%zsal(jclass) 
    2609            zbnd2 = sec%zsal(jclass+1)    
     2609           zbnd2 = sec%zsal(jclass+1) 
    26102610        ENDIF 
    26112611        !temperature classes transports 
     
    26162616           zbnd2 = sec%ztem(jclass+1) 
    26172617        ENDIF 
    2618                    
     2618 
    26192619        !write volume transport per class 
    26202620        WRITE(numdct_vol,118) ndastp,kt,ksec,sec%name,zslope, & 
     
    26622662     ENDIF 
    26632663 
    2664        
     2664 
    26652665     IF ( sec%ll_ice_section) THEN 
    26662666        !write total ice volume transport 
     
    26732673                              jclass,"ice_surf",zbnd1,zbnd2,& 
    26742674                              sec%transport(13,1),sec%transport(14,1), & 
    2675                               sec%transport(13,1)+sec%transport(14,1)  
     2675                              sec%transport(13,1)+sec%transport(14,1) 
    26762676     ENDIF 
    2677                                                
     2677 
    26782678118 FORMAT(I8,1X,I8,1X,I4,1X,A30,1X,f9.2,1X,I4,3X,A8,1X,2F12.4,5X,3F12.4) 
    26792679119 FORMAT(I8,1X,I8,1X,I4,1X,A30,1X,f9.2,1X,I4,3X,A8,1X,2F12.4,5X,3E15.6) 
    26802680 
    2681      CALL wrk_dealloc(nb_type , zsumclasses )   
     2681     CALL wrk_dealloc(nb_type , zsumclasses ) 
    26822682  END SUBROUTINE dia_dct_wri 
    26832683 
     
    26922692  !! 
    26932693  !!   ====> full step and partial step 
    2694   !!  
     2694  !! 
    26952695  !! 
    26962696  !!    |    I          |    I+1           |    Z=Temperature/Salinity/density at U-poinT 
     
    26982698  !!  ----------------------------------------  1. Veritcale interpolation: compute zbis 
    26992699  !!    |               |                  |       interpolation between ptab(I,J,K) and ptab(I,J,K+1) 
    2700   !!    |               |                  |       zbis =  
     2700  !!    |               |                  |       zbis = 
    27012701  !!    |               |                  |      [ e3w(I+1,J,K)*ptab(I,J,K) + ( e3w(I,J,K) - e3w(I+1,J,K) ) * ptab(I,J,K-1) ] 
    2702   !!    |               |                  |      /[ e3w(I+1,J,K) + e3w(I,J,K) - e3w(I+1,J,K) ]  
    2703   !!    |               |                  |  
     2702  !!    |               |                  |      /[ e3w(I+1,J,K) + e3w(I,J,K) - e3w(I+1,J,K) ] 
     2703  !!    |               |                  | 
    27042704  !!    |               |                  |    2. Horizontal interpolation: compute value at U/V point 
    2705   !!K-1 | ptab(I,J,K-1) |                  |       interpolation between zbis and ptab(I+1,J,K)   
     2705  !!K-1 | ptab(I,J,K-1) |                  |       interpolation between zbis and ptab(I+1,J,K) 
    27062706  !!    |     .         |                  | 
    2707   !!    |     .         |                  |       interp = ( 0.5*zet2*zbis + 0.5*zet1*ptab(I+1,J,K) )/(0.5*zet2+0.5*zet1)  
     2707  !!    |     .         |                  |       interp = ( 0.5*zet2*zbis + 0.5*zet1*ptab(I+1,J,K) )/(0.5*zet2+0.5*zet1) 
    27082708  !!    |     .         |                  | 
    27092709  !!  ------------------------------------------ 
     
    27222722  !! 
    27232723  !!   ====>  s-coordinate 
    2724   !!      
     2724  !! 
    27252725  !!    |                |                  |   1. Compute distance between T1 and U points: SQRT( zdep1^2 + (0.5 * zet1 )^2 
    27262726  !!    |                |                  |      Compute distance between T2 and U points: SQRT( zdep2^2 + (0.5 * zet2 )^2 
    2727   !!    |                | ptab(I+1,J,K)    |  
    2728   !!    |                |      T2          |   2. Interpolation between  T1 and T2 values at U point  
    2729   !!    |                |      ^           |     
    2730   !!    |                |      | zdep2     |     
    2731   !!    |                |      |           |     
     2727  !!    |                | ptab(I+1,J,K)    | 
     2728  !!    |                |      T2          |   2. Interpolation between  T1 and T2 values at U point 
     2729  !!    |                |      ^           | 
     2730  !!    |                |      | zdep2     | 
     2731  !!    |                |      |           | 
    27322732  !!    |       ^        U      v           | 
    27332733  !!    |       |        |                  | 
    2734   !!    |       | zdep1  |                  |     
     2734  !!    |       | zdep1  |                  | 
    27352735  !!    |       v        |                  | 
    27362736  !!    |      T1        |                  | 
    2737   !!    | ptab(I,J,K)    |                  |  
    2738   !!    |                |                  |  
    2739   !!    |                |                  |  
     2737  !!    | ptab(I,J,K)    |                  | 
     2738  !!    |                |                  | 
     2739  !!    |                |                  | 
    27402740  !! 
    27412741  !!    <----zet1--------><----zet2---------> 
     
    27462746  CHARACTER(len=1), INTENT(IN)                 :: cd_point     ! type of point (U, V) 
    27472747  REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(IN) :: ptab         ! variable to compute at (ki, kj, kk ) 
    2748   REAL(wp)                                     :: interp       ! interpolated variable  
     2748  REAL(wp)                                     :: interp       ! interpolated variable 
    27492749 
    27502750  !*local declations 
    27512751  INTEGER :: ii1, ij1, ii2, ij2                                ! local integer 
    27522752  REAL(wp):: ze3t, zfse3, zwgt1, zwgt2, zbis, zdepu            ! local real 
    2753   REAL(wp):: zet1, zet2                                        ! weight for interpolation  
     2753  REAL(wp):: zet1, zet2                                        ! weight for interpolation 
    27542754  REAL(wp):: zdep1,zdep2                                       ! differences of depth 
    27552755  !!---------------------------------------------------------------------- 
    27562756 
    2757   IF( cd_point=='U' )THEN  
    2758      ii1 = ki    ; ij1 = kj  
    2759      ii2 = ki+1  ; ij2 = kj  
     2757  IF( cd_point=='U' )THEN 
     2758     ii1 = ki    ; ij1 = kj 
     2759     ii2 = ki+1  ; ij2 = kj 
    27602760 
    27612761     zet1=e1t(ii1,ij1) 
    27622762     zet2=e1t(ii2,ij2) 
    2763    
    2764  
    2765   ELSE ! cd_point=='V'  
    2766      ii1 = ki    ; ij1 = kj  
    2767      ii2 = ki    ; ij2 = kj+1   
     2763 
     2764 
     2765  ELSE ! cd_point=='V' 
     2766     ii1 = ki    ; ij1 = kj 
     2767     ii2 = ki    ; ij2 = kj+1 
    27682768 
    27692769     zet1=e2t(ii1,ij1) 
     
    27742774  IF( ln_sco )THEN   ! s-coordinate case 
    27752775 
    2776      zdepu = ( fsdept(ii1,ij1,kk) +  fsdept(ii2,ij2,kk) ) /2  
     2776     zdepu = ( fsdept(ii1,ij1,kk) +  fsdept(ii2,ij2,kk) ) /2 
    27772777     zdep1 = fsdept(ii1,ij1,kk) - zdepu 
    27782778     zdep2 = fsdept(ii2,ij2,kk) - zdepu 
     
    27812781     zwgt1 = SQRT( ( 0.5 * zet1 ) * ( 0.5 * zet1 ) + ( zdep1 * zdep1 ) ) 
    27822782     zwgt2 = SQRT( ( 0.5 * zet2 ) * ( 0.5 * zet2 ) + ( zdep2 * zdep2 ) ) 
    2783    
     2783 
    27842784     ! result 
    2785      interp = umask(ii1,ij1,kk) * ( zwgt2 *  ptab(ii1,ij1,kk) + zwgt1 *  ptab(ii1,ij1,kk) ) / ( zwgt2 + zwgt1 )    
    2786  
    2787  
    2788   ELSE       ! full step or partial step case  
     2785     interp = umask(ii1,ij1,kk) * ( zwgt2 *  ptab(ii1,ij1,kk) + zwgt1 *  ptab(ii1,ij1,kk) ) / ( zwgt2 + zwgt1 ) 
     2786 
     2787 
     2788  ELSE       ! full step or partial step case 
    27892789 
    27902790#if defined key_vvl 
    27912791 
    2792      ze3t  = fse3t_n(ii2,ij2,kk) - fse3t_n(ii1,ij1,kk)  
     2792     ze3t  = fse3t_n(ii2,ij2,kk) - fse3t_n(ii1,ij1,kk) 
    27932793     zwgt1 = ( fse3w_n(ii2,ij2,kk) - fse3w_n(ii1,ij1,kk) ) / fse3w_n(ii2,ij2,kk) 
    27942794     zwgt2 = ( fse3w_n(ii1,ij1,kk) - fse3w_n(ii2,ij2,kk) ) / fse3w_n(ii1,ij1,kk) 
     
    27962796#else 
    27972797 
    2798      ze3t  = fse3t(ii2,ij2,kk)   - fse3t(ii1,ij1,kk)  
     2798     ze3t  = fse3t(ii2,ij2,kk)   - fse3t(ii1,ij1,kk) 
    27992799     zwgt1 = ( fse3w(ii2,ij2,kk) - fse3w(ii1,ij1,kk) ) / fse3w(ii2,ij2,kk) 
    28002800     zwgt2 = ( fse3w(ii1,ij1,kk) - fse3w(ii2,ij2,kk) ) / fse3w(ii1,ij1,kk) 
     
    28042804     IF(kk .NE. 1)THEN 
    28052805 
    2806         IF( ze3t >= 0. )THEN  
     2806        IF( ze3t >= 0. )THEN 
    28072807           ! zbis 
    2808            zbis = ptab(ii2,ij2,kk) + zwgt1 * ( ptab(ii2,ij2,kk-1) - ptab(ii2,ij2,kk) )  
     2808           zbis = ptab(ii2,ij2,kk) + zwgt1 * ( ptab(ii2,ij2,kk-1) - ptab(ii2,ij2,kk) ) 
    28092809           ! result 
    28102810            interp = umask(ii1,ij1,kk) * ( zet2 * ptab(ii1,ij1,kk) + zet1 * zbis )/( zet1 + zet2 ) 
     
    28142814           ! result 
    28152815           interp = umask(ii1,ij1,kk) * ( zet2 * zbis + zet1 * ptab(ii2,ij2,kk) )/( zet1 + zet2 ) 
    2816         ENDIF     
     2816        ENDIF 
    28172817 
    28182818     ELSE 
     
    28302830   !!---------------------------------------------------------------------- 
    28312831   LOGICAL, PUBLIC, PARAMETER ::   lk_diadct = .FALSE.    !: diamht flag 
    2832    PUBLIC  
     2832   PUBLIC 
    28332833   !! $Id$ 
    28342834CONTAINS 
  • branches/UKMO/CO6_shelfclimate_fabm_noos/NEMOGCM/NEMO/OPA_SRC/SBC/tide_mod.F90

    r7566 r15798  
    7070      !!---------------------------------------------------------------------- 
    7171      ! 
    72       zqy = AINT( (nyear-1901.)/4. ) 
    73       zsy = nyear - 1900. 
    74       ! 
    75       zdj  = dayjul( nyear, nmonth, nday ) 
    76       zday = zdj + zqy - 1. 
    77       ! 
    78       zhfrac = nsec_day / 3600. 
     72      zqy = AINT( (nyear-1901.)/4. )        ! leap years since 1901 
     73      zsy = nyear - 1900.                   ! years since 1900 
     74      ! 
     75      zdj  = dayjul( nyear, nmonth, nday )  ! day number of year 
     76      zday = zdj + zqy - 1.                 ! day number of year + No of leap yrs 
     77                                            ! i.e. what would doy if every year = 365 day?? 
     78      ! 
     79      zhfrac = nsec_day / 3600.             ! The seconds of the day/3600 
    7980      ! 
    8081      !---------------------------------------------------------------------- 
  • branches/UKMO/CO6_shelfclimate_fabm_noos/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfgls.F90

    r7566 r15798  
    178178            !    
    179179            ! bottom friction (explicit before friction)         
    180             ! Note that we chose here not to bound the friction as in dynbfr)    
     180            ! Note that we chose here not to bound the friction as in dynbfr) 
    181181            ztx2 = (  bfrua(ji,jj)  * ub(ji,jj,mbku(ji,jj)) + bfrua(ji-1,jj) * ub(ji-1,jj,mbku(ji-1,jj))  )   &          
    182182               & * ( 1._wp - 0.5_wp * umask(ji,jj,1) * umask(ji-1,jj,1)  )       
Note: See TracChangeset for help on using the changeset viewer.