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 1830 for branches/CMIP5_IPSL/NEMO/TOP_SRC/trcdia.F90 – NEMO

Ignore:
Timestamp:
2010-04-12T15:03:51+02:00 (14 years ago)
Author:
cetlod
Message:

Computation of additional diagnostics for PISCES model ( under CPP key key_diaar5 )

  • needed for AR5 outputs (vertical inventories, passive tracers at surface,... )
  • new output file with suffix dbio_T
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/CMIP5_IPSL/NEMO/TOP_SRC/trcdia.F90

    r1715 r1830  
    2121   !! trcdib_wr   : outputs of biological fields 
    2222   !!---------------------------------------------------------------------- 
    23    USE dom_oce         ! ocean space and time domain variables  
     23   USE dom_oce         ! ocean space and time domain variables 
    2424   USE oce_trc 
     25   USE trp_trc 
    2526   USE trc 
    26    USE trp_trc 
     27   USE par_trc 
     28   USE trctrp 
    2729   USE trdmld_trc_oce, ONLY : luttrd 
     30   USE iom 
    2831   USE dianam    ! build name of file (routine) 
    2932   USE in_out_manager  ! I/O manager 
     
    4144   INTEGER  ::   ndimt50   !: number of ocean points in index array 
    4245   INTEGER  ::   ndimt51   !: number of ocean points in index array 
    43    REAL(wp) ::   xjulian   !: ????   not DOCTOR ! 
     46   REAL(wp) ::   zjulian   !: ????   not DOCTOR ! 
    4447   INTEGER , DIMENSION (jpij*jpk) ::   ndext50   !: integer arrays for ocean 3D index 
    4548   INTEGER , DIMENSION (jpij)     ::   ndext51   !: integer arrays for ocean surface index 
     
    6467   !!---------------------------------------------------------------------- 
    6568   !! NEMO/TOP 1.0 , LOCEAN-IPSL (2005)  
    66    !! $Id$  
     69   !! $Header:$  
    6770   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
    6871   !!---------------------------------------------------------------------- 
     
    7073CONTAINS 
    7174 
    72    SUBROUTINE trc_dia( kt 
     75   SUBROUTINE trc_dia( kt, kindic 
    7376      !!--------------------------------------------------------------------- 
    7477      !!                     ***  ROUTINE trc_dia  *** 
     
    7780      !!--------------------------------------------------------------------- 
    7881      INTEGER, INTENT( in ) :: kt 
    79       INTEGER               :: kindic 
     82      INTEGER         :: kindic 
    8083      !!--------------------------------------------------------------------- 
    8184       
     
    110113      LOGICAL ::   ll_print = .FALSE. 
    111114      CHARACTER (len=40) :: clhstnam, clop 
    112 #if defined key_off_tra 
    113       INTEGER ::   inum = 11             ! temporary logical unit 
    114 #endif 
    115115      CHARACTER (len=20) :: cltra, cltrau 
    116116      CHARACTER (len=80) :: cltral 
    117117      REAL(wp) :: zsto, zout, zdt 
    118       INTEGER  :: iimi, iima, ijmi, ijma, ipk, it, itmod 
     118      INTEGER  :: iimi, iima, ijmi, ijma, ipk, it 
    119119      !!---------------------------------------------------------------------- 
    120120 
     
    128128      ! Define frequency of output and means 
    129129      zdt = rdt 
    130       IF( ln_mskland )   THEN   ;   clop = "only(x)"   ! put 1.e+20 on land (very expensive!!) 
    131       ELSE                      ;   clop = "x"         ! no use of the mask value (require less cpu time) 
    132       ENDIF 
    133130# if defined key_diainstant 
    134131      zsto = nwritetrc * rdt 
    135       clop = "inst("//TRIM(clop)//")" 
     132      clop = 'inst(only(x))' 
    136133# else 
    137134      zsto = zdt 
    138       clop = "ave("//TRIM(clop)//")" 
     135      clop = 'ave(only(x))' 
    139136# endif 
    140137      zout = nwritetrc * zdt 
     
    146143 
    147144      ! define time axis 
    148       itmod = kt - nittrc000 + 1 
    149       it    = kt 
     145      it = kt - nittrc000 + 1 
    150146 
    151147      ! Define NETCDF files and fields at beginning of first time step 
     
    157153 
    158154         ! Compute julian date from starting date of the run 
    159          CALL ymds2ju( nyear, nmonth, nday, rdt, xjulian ) 
    160          xjulian = xjulian - adatrj   !   set calendar origin to the beginning of the experiment 
     155         CALL ymds2ju( nyear, nmonth, nday, 0.0, zjulian ) 
    161156         IF(lwp)WRITE(numout,*)' '   
    162157         IF(lwp)WRITE(numout,*)' Date 0 used :', nittrc000                         & 
    163158            &                 ,' YEAR ', nyear, ' MONTH ', nmonth, ' DAY ', nday   & 
    164             &                 ,'Julian day : ', xjulian   
    165    
     159            &                 ,'Julian day : ', zjulian     
    166160         IF(lwp) WRITE(numout,*) ' indexes of zoom = ', iimi, iima, ijmi, ijma,  & 
    167161            &                    ' limit storage in depth = ', ipk 
    168162 
    169 #if defined key_off_tra 
    170         ! WRITE root name in date.file for use by postpro 
    171          IF(lwp) THEN 
    172             CALL dia_nam( clhstnam, nwritetrc,' ' ) 
    173             CALL ctl_opn( inum, 'date.file', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 
    174             WRITE(inum,*) clhstnam 
    175             CLOSE(inum) 
    176          ENDIF 
    177 #endif 
    178  
    179          ! Define the NETCDF files for passive tracer concentration 
     163 
     164! Define the NETCDF files for passive tracer concentration 
     165 
    180166         CALL dia_nam( clhstnam, nwritetrc, 'ptrc_T' ) 
    181167         IF(lwp)WRITE(numout,*)" Name of NETCDF file ", clhstnam 
    182  
    183          ! Horizontal grid : glamt and gphit 
     168! Horizontal grid : glamt and gphit 
    184169         CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,     & 
    185170            &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,         &  
    186             &          nittrc000-ndttrc, xjulian, zdt, nhorit5, nit5 , domain_id=nidom) 
    187  
    188          ! Vertical grid for tracer : gdept 
    189          CALL histvert( nit5, 'deptht', 'Vertical T levels', 'm', ipk, gdept_0, ndepit5) 
    190  
    191          ! Index of ocean points in 3D and 2D (surface) 
    192          CALL wheneq( jpi*jpj*ipk, tmask, 1, 1., ndext50, ndimt50 ) 
    193          CALL wheneq( jpi*jpj    , tmask, 1, 1., ndext51, ndimt51 ) 
    194  
    195          ! Declare all the output fields as NETCDF variables 
     171            &          0, zjulian, zdt, nhorit5, nit5 , domain_id=nidom) 
     172! Vertical grid for tracer : gdept 
     173         CALL histvert( nit5, 'deptht', 'Vertical T levels', & 
     174            &            'm', ipk, gdept_0, ndepit5) 
     175 
     176! Index of ocean points in 3D and 2D (surface) 
     177         CALL wheneq( jpi*jpj*ipk,tmask,1,1.,ndext50,ndimt50 ) 
     178         CALL wheneq( jpi*jpj,tmask,1,1.,ndext51,ndimt51 ) 
     179 
     180! Declare all the output fields as NETCDF variables 
     181 
     182! tracer concentrations 
    196183         DO jn = 1, jptra 
    197184            IF( lutsav(jn) ) THEN 
     
    200187               cltrau = ctrcun(jn)   ! UNIT for tracer 
    201188               CALL histdef( nit5, cltra, cltral, cltrau, jpi, jpj, nhorit5,  & 
    202                   &          ipk, 1, ipk,  ndepit5, 32, clop, zsto, zout )  
     189                  &               ipk, 1, ipk,  ndepit5, 32, clop, zsto, zout)  
    203190            ENDIF 
    204191         END DO 
     
    215202      ! --------------------------------------- 
    216203 
    217       IF( lwp .AND. MOD( itmod, nwritetrc ) == 0 ) THEN 
     204      IF( lwp .AND. MOD( kt, nwritetrc ) == 0 ) THEN 
    218205         WRITE(numout,*) 'trcdit_wr : write NetCDF passive tracer concentrations at ', kt, 'time-step' 
    219206         WRITE(numout,*) '~~~~~~~~~ ' 
     
    221208 
    222209      DO jn = 1, jptra 
    223          cltra = ctrcnm(jn)      ! short title for tracer 
    224          IF( lutsav(jn) ) CALL histwrite( nit5, cltra, it, trn(:,:,:,jn), ndimt50, ndext50 ) 
     210         IF( lutsav(jn) ) THEN 
     211            cltra = ctrcnm(jn)      ! short title for tracer 
     212            CALL histwrite( nit5, cltra, it, trn(:,:,:,jn), ndimt50, ndext50 ) 
     213         ENDIF 
    225214      END DO 
     215 
     216      ! synchronise file 
     217      IF( MOD( kt, nwritetrc ) == 0 .OR. kindic < 0 )   CALL histsync( nit5 ) 
     218 
    226219 
    227220      ! close the file  
     
    229222      IF( kt == nitend .OR. kindic < 0 )   CALL histclo( nit5 ) 
    230223      ! 
    231  
    232224   END SUBROUTINE trcdit_wr 
    233225 
     
    244236      !! 
    245237      !!        At each time step call histdef to compute the mean if necessary 
    246       !!        Each nwritetrd time step, output the instantaneous or mean fields 
     238      !!        Each nwritetrc time step, output the instantaneous or mean fields 
    247239      !! 
    248240      !!        IF kindic <0, output of fields before the model interruption. 
     
    258250      CHARACTER (len=80) ::   cltral 
    259251      CHARACTER (len=10) ::   csuff 
    260       INTEGER  ::   jn, jl 
    261       INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it, itmod 
     252      INTEGER  ::   jn, jl, ikn 
     253      INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it 
    262254      REAL(wp) ::   zsto, zout, zdt 
    263255      !!---------------------------------------------------------------------- 
     
    265257      ! 0. Initialisation 
    266258      ! ----------------- 
    267        
    268259 
    269260      ! local variable for debugging 
     
    273264      ! Define frequency of output and means 
    274265      zdt = rdt 
    275       IF( ln_mskland )   THEN   ;   clop = "only(x)"   ! put 1.e+20 on land (very expensive!!) 
    276       ELSE                      ;   clop = "x"         ! no use of the mask value (require less cpu time) 
    277       ENDIF 
    278266#  if defined key_diainstant 
    279267      zsto = nwritetrd * rdt 
    280       clop = "inst("//TRIM(clop)//")" 
     268      clop = 'inst(only(x))' 
    281269#  else 
    282270      zsto = zdt 
    283       clop = "ave("//TRIM(clop)//")" 
     271      clop = 'ave(only(x))' 
    284272#  endif 
    285273      zout = nwritetrd * zdt 
     
    291279 
    292280      ! define time axis 
    293       itmod = kt - nittrc000 + 1 
    294       it    = kt 
     281      it = kt - nittrc000 + 1 
    295282 
    296283      ! Define the NETCDF files (one per tracer) 
     
    313300               CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,       & 
    314301                  &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,   & 
    315                   &          nittrc000-ndttrc, xjulian, zdt, nhorit6(jn),  & 
     302                  &          0, zjulian, rdt, nhorit6(jn),           & 
    316303                  &          nit6(jn) , domain_id=nidom ) 
    317304 
    318305               ! Vertical grid for tracer trend - one per each tracer IF needed 
    319                CALL histvert( nit6(jn), 'deptht', 'Vertical T levels', 'm', ipk, gdept_0, ndepit6(jn) )  
     306               CALL histvert( nit6(jn), 'deptht', 'Vertical T levels',   & 
     307                  &           'm', ipk, gdept_0, ndepit6(jn) )  
    320308             END IF 
    321309          END DO 
    322310 
    323311          ! Declare all the output fields as NETCDF variables 
    324  
    325           ! trends for tracer concentrations 
    326312          DO jn = 1, jptra 
    327313            IF( luttrd(jn) ) THEN 
    328314                DO jl = 1, jpdiatrc 
    329                   IF( jl == 1 ) THEN 
     315                  IF( jl == jptrc_xad ) THEN 
    330316                      ! short and long title for x advection for tracer 
    331317                      WRITE (cltra,'("XAD_",16a)') ctrcnm(jn) 
    332                       WRITE (cltral,'("X advective trend for ",58a)')  & 
    333                          &      ctrcnl(jn)(1:58) 
    334                   END IF 
    335                   IF( jl == 2 ) THEN 
     318                      WRITE (cltral,'("X advective trend for ",58a)') ctrcnl(jn)(1:58) 
     319                  END IF 
     320                  IF( jl == jptrc_yad ) THEN 
    336321                      ! short and long title for y advection for tracer 
    337322                      WRITE (cltra,'("YAD_",16a)') ctrcnm(jn) 
    338                       WRITE (cltral,'("Y advective trend for ",58a)')  & 
    339                          &      ctrcnl(jn)(1:58) 
    340                   END IF 
    341                   IF( jl == 3 ) THEN 
     323                      WRITE (cltral,'("Y advective trend for ",58a)') ctrcnl(jn)(1:58) 
     324                  END IF 
     325                  IF( jl == jptrc_zad ) THEN 
    342326                      ! short and long title for Z advection for tracer 
    343327                      WRITE (cltra,'("ZAD_",16a)') ctrcnm(jn) 
    344                       WRITE (cltral,'("Z advective trend for ",58a)')  & 
    345                          &      ctrcnl(jn)(1:58) 
    346                   END IF 
    347                   IF( jl == 4 ) THEN 
     328                      WRITE (cltral,'("Z advective trend for ",58a)') ctrcnl(jn)(1:58) 
     329                  END IF 
     330                  IF( jl == jptrc_xdf ) THEN 
    348331                      ! short and long title for X diffusion for tracer 
    349332                      WRITE (cltra,'("XDF_",16a)') ctrcnm(jn) 
    350                       WRITE (cltral,'("X diffusion trend for ",58a)')  & 
    351                          &      ctrcnl(jn)(1:58) 
    352                   END IF 
    353                   IF( jl == 5 ) THEN 
     333                      WRITE (cltral,'("X diffusion trend for ",58a)') ctrcnl(jn)(1:58) 
     334                  END IF 
     335                  IF( jl == jptrc_ydf ) THEN 
    354336                      ! short and long title for Y diffusion for tracer 
    355337                      WRITE (cltra,'("YDF_",16a)') ctrcnm(jn) 
    356                       WRITE (cltral,'("Y diffusion trend for ",58a)')  & 
    357                          &      ctrcnl(jn)(1:58) 
    358                   END IF 
    359                   IF( jl == 6 ) THEN 
     338                      WRITE (cltral,'("Y diffusion trend for ",58a)') ctrcnl(jn)(1:58) 
     339                  END IF 
     340                  IF( jl == jptrc_zdf ) THEN 
    360341                      ! short and long title for Z diffusion for tracer 
    361342                      WRITE (cltra,'("ZDF_",16a)') ctrcnm(jn) 
    362                       WRITE (cltral,'("Z diffusion trend for ",58a)')  & 
    363                          &      ctrcnl(jn)(1:58) 
     343                      WRITE (cltral,'("Z diffusion trend for ",58a)') ctrcnl(jn)(1:58) 
    364344                  END IF 
    365345# if defined key_trcldf_eiv 
    366                   IF( jl == 7 ) THEN 
     346                  IF( jl == jptrc_xei ) THEN 
    367347                      ! short and long title for x gent velocity for tracer 
    368348                      WRITE (cltra,'("XGV_",16a)') ctrcnm(jn) 
    369                       WRITE (cltral,'("X gent velocity trend for ",53a)')  & 
    370                          &      ctrcnl(jn)(1:53) 
    371                   END IF 
    372                   IF( jl == 8 ) THEN 
     349                      WRITE (cltral,'("X gent velocity trend for ",53a)') ctrcnl(jn)(1:53) 
     350                  END IF 
     351                  IF( jl == jptrc_yei ) THEN 
    373352                      ! short and long title for y gent velocity for tracer 
    374353                      WRITE (cltra,'("YGV_",16a)') ctrcnm(jn) 
    375                       WRITE (cltral,'("Y gent velocity trend for ",53a)')  & 
    376                          &      ctrcnl(jn)(1:53) 
    377                   END IF 
    378                   IF( jl == 9 ) THEN 
     354                      WRITE (cltral,'("Y gent velocity trend for ",53a)') ctrcnl(jn)(1:53) 
     355                  END IF 
     356                  IF( jl == jptrc_zei ) THEN 
    379357                      ! short and long title for Z gent velocity for tracer 
    380358                      WRITE (cltra,'("ZGV_",16a)') ctrcnm(jn) 
    381                       WRITE (cltral,'("Z gent velocity trend for ",53a)')  & 
    382                          &      ctrcnl(jn)(1:53) 
     359                      WRITE (cltral,'("Z gent velocity trend for ",53a)') ctrcnl(jn)(1:53) 
    383360                  END IF 
    384361# endif 
    385362# if defined key_trcdmp 
    386                   IF( jl == jpdiatrc - 1 ) THEN 
     363                  IF( jl == jptrc_dmp ) THEN 
    387364                      ! last trends for tracer damping : short and long title 
    388365                      WRITE (cltra,'("TDM_",16a)') ctrcnm(jn) 
    389                       WRITE (cltral,'("Tracer damping trend for ",55a)')  & 
    390                          &      ctrcnl(jn)(1:55) 
    391                   END IF 
    392 # endif 
    393                   IF( jl == jpdiatrc ) THEN 
     366                      WRITE (cltral,'("Tracer damping trend for ",55a)') ctrcnl(jn)(1:55) 
     367                  END IF 
     368# endif 
     369                  IF( jl == jptrc_sbc ) THEN 
    394370                      ! last trends for tracer damping : short and long title 
    395371                      WRITE (cltra,'("SBC_",16a)') ctrcnm(jn) 
    396                       WRITE (cltral,'("Surface boundary flux ",58a)')  & 
    397                       &      ctrcnl(jn)(1:58) 
    398                   END IF 
    399  
     372                      WRITE (cltral,'("Surface boundary flux ",58a)') ctrcnl(jn)(1:55) 
     373                  END IF 
     374                      WRITE (cltral,'("Surface boundary flux ",58a)') ctrcnl(jn)(1:55) 
     375                  END IF 
    400376                  CALL FLUSH( numout ) 
    401377                  cltrau = ctrcun(jn)      ! UNIT for tracer /trends 
     
    425401      ! trends for tracer concentrations 
    426402 
    427       IF( lwp .AND. MOD( itmod, nwritetrd ) == 0 ) THEN 
     403      IF( lwp .AND. MOD( kt, nwritetrd ) == 0 ) THEN 
    428404         WRITE(numout,*) 'trcdid_wr : write NetCDF dynamical trends at ', kt, 'time-step' 
    429405         WRITE(numout,*) '~~~~~~ ' 
     
    432408      DO jn = 1, jptra 
    433409         IF( luttrd(jn) ) THEN 
     410            ikn = ikeep(jn) 
    434411            DO jl = 1, jpdiatrc 
    435                ! short titles  
    436                IF( jl == 1)   WRITE (cltra,'("XAD_",16a)') ctrcnm(jn)      ! x advection for tracer 
    437                IF( jl == 2)   WRITE (cltra,'("YAD_",16a)') ctrcnm(jn)      ! z advection for tracer 
    438                IF( jl == 3)   WRITE (cltra,'("ZAD_",16a)') ctrcnm(jn)      ! z advection for tracer 
    439                IF( jl == 4)   WRITE (cltra,'("XDF_",16a)') ctrcnm(jn)      ! x diffusion for tracer 
    440                IF( jl == 5)   WRITE (cltra,'("YDF_",16a)') ctrcnm(jn)      ! y diffusion for tracer 
    441                IF( jl == 6)   WRITE (cltra,'("ZDF_",16a)') ctrcnm(jn)      ! z diffusion for tracer 
     412               ! short titles 
     413               IF( jl == jptrc_xad)   WRITE (cltra,'("XAD_",16a)') ctrcnm(jn) 
     414               IF( jl == jptrc_yad)   WRITE (cltra,'("YAD_",16a)') ctrcnm(jn) 
     415               IF( jl == jptrc_zad)   WRITE (cltra,'("ZAD_",16a)') ctrcnm(jn) 
     416               IF( jl == jptrc_xdf)   WRITE (cltra,'("XDF_",16a)') ctrcnm(jn) 
     417               IF( jl == jptrc_ydf)   WRITE (cltra,'("YDF_",16a)') ctrcnm(jn) 
     418               IF( jl == jptrc_zdf)   WRITE (cltra,'("ZDF_",16a)') ctrcnm(jn) 
    442419# if defined key_trcldf_eiv 
    443                IF( jl == 7)   WRITE (cltra,'("XGV_",16a)') ctrcnm(jn)      ! x gent velocity for tracer 
    444                IF( jl == 8)   WRITE (cltra,'("YGV_",16a)') ctrcnm(jn)      ! y gent velocity for tracer 
    445                IF( jl == 9)   WRITE (cltra,'("ZGV_",16a)') ctrcnm(jn)      ! z gent velocity for tracer 
     420               IF( jl == jptrc_xei)   WRITE (cltra,'("XGV_",16a)') ctrcnm(jn) 
     421               IF( jl == jptrc_yei)   WRITE (cltra,'("YGV_",16a)') ctrcnm(jn) 
     422               IF( jl == jptrc_zei)   WRITE (cltra,'("ZGV_",16a)') ctrcnm(jn) 
    446423# endif 
    447424# if defined key_trcdmp 
    448                IF( jl == jpdiatrc - 1 )   WRITE (cltra,'("TDM_",16a)') ctrcnm(jn)      ! damping 
    449 # endif 
    450                IF( jl == jpdiatrc )   WRITE (cltra,'("SBC_",a)') ctrcnm(jn)      ! surface boundary conditions 
     425               IF( jl == jptrc_dmp )  WRITE (cltra,'("TDM_",16a)') ctrcnm(jn) 
     426# endif 
     427               IF( jl == jptrc_sbc )  WRITE (cltra,'("SBC_",16a)') ctrcnm(jn) 
    451428               ! 
    452                CALL histwrite(nit6(jn), cltra, it, trtrd(:,:,:,ikeep(jn),jl),ndimt50, ndext50) 
     429               CALL histwrite(nit6(jn), cltra, it, trtrd(:,:,:,ikn,jl),ndimt50, ndext50) 
    453430            END DO 
    454431         END IF 
    455432      END DO 
     433 
     434      ! synchronise FILE 
     435      IF( MOD( kt, nwritetrd ) == 0 .OR. kindic < 0 ) THEN 
     436         DO jn = 1, jptra 
     437            IF (luttrd(jn))   CALL histsync( nit6(jn) ) 
     438         END DO 
     439      ENDIF 
    456440 
    457441      ! Closing all files 
     
    463447      ENDIF 
    464448      ! 
    465  
    466449   END SUBROUTINE trcdid_wr 
    467450 
     
    486469      !! 
    487470      !!        At each time step call histdef to compute the mean if necessary 
    488       !!        Each nwritedia time step, output the instantaneous or mean fields 
     471      !!        Each nwritetrc time step, output the instantaneous or mean fields 
    489472      !! 
    490473      !!        IF kindic <0, output of fields before the model interruption. 
     
    499482      CHARACTER (len=20) ::   cltra, cltrau 
    500483      CHARACTER (len=80) ::   cltral 
    501       INTEGER  ::   jl 
    502       INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it, itmod 
     484      INTEGER  ::   jn 
     485      INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it 
    503486      REAL(wp) ::   zsto, zout, zdt 
    504487      !!---------------------------------------------------------------------- 
     
    506489      ! Initialisation 
    507490      ! -------------- 
    508        
     491 
    509492      ! local variable for debugging 
    510493      ll_print = .FALSE. 
     
    513496      ! Define frequency of output and means 
    514497      zdt = rdt 
    515       IF( ln_mskland )   THEN   ;   clop = "only(x)"   ! put 1.e+20 on land (very expensive!!) 
    516       ELSE                      ;   clop = "x"         ! no use of the mask value (require less cpu time) 
    517       ENDIF 
    518498#  if defined key_diainstant 
    519       zsto = nwritedia * zdt 
    520       clop = "inst("//TRIM(clop)//")" 
     499      zsto=nwritedia*zdt 
     500      clop='inst(only(x))' 
    521501#  else 
    522       zsto = zdt 
    523       clop = "ave("//TRIM(clop)//")" 
     502      zsto=zdt 
     503      clop='ave(only(x))' 
    524504#  endif 
    525       zout = nwritedia * zdt 
     505      zout=nwritedia*zdt 
    526506 
    527507      ! Define indices of the horizontal output zoom and vertical limit storage 
     
    531511 
    532512      ! define time axis 
    533       itmod = kt - nittrc000 + 1 
    534       it    = kt 
     513      it = kt - nittrc000 + 1 
    535514 
    536515      ! 1. Define NETCDF files and fields at beginning of first time step 
     
    545524         ! Define the T grid file for tracer auxiliary files 
    546525 
    547          CALL dia_nam( clhstnam, nwritedia, 'diad_T' ) 
     526         CALL dia_nam( clhstnam, nwrite, 'diad_T' ) 
    548527         IF(lwp) WRITE(numout,*) " Name of NETCDF file ", clhstnam 
    549528 
     
    552531         CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,             & 
    553532            &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,         & 
    554             &          nittrc000-ndttrc, xjulian, zdt, nhoritd, nitd , domain_id=nidom ) 
     533            &          0, zjulian, zdt, nhoritd, nitd , domain_id=nidom ) 
    555534 
    556535         ! Vertical grid for 2d and 3d arrays 
    557536 
    558          CALL histvert( nitd, 'deptht', 'Vertical T levels','m', ipk, gdept_0, ndepitd) 
     537         CALL histvert( nitd, 'deptht', 'Vertical T levels',   & 
     538            &           'm', ipk, gdept_0, ndepitd) 
    559539 
    560540         ! Declare all the output fields as NETCDF variables 
    561541 
    562542         ! more 3D horizontal arrays 
    563          DO jl = 1, jpdia3d 
    564             cltra  = ctrc3d(jl)   ! short title for 3D diagnostic 
    565             cltral = ctrc3l(jl)   ! long title for 3D diagnostic 
    566             cltrau = ctrc3u(jl)   ! UNIT for 3D diagnostic 
     543         DO jn = 1, jpdia3d 
     544            cltra  = ctrc3d(jn)   ! short title for 3D diagnostic 
     545            cltral = ctrc3l(jn)   ! long title for 3D diagnostic 
     546            cltrau = ctrc3u(jn)   ! UNIT for 3D diagnostic 
    567547            CALL histdef( nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd,   & 
    568548               &          ipk, 1, ipk,  ndepitd, 32, clop, zsto, zout ) 
     
    570550 
    571551         ! more 2D horizontal arrays 
    572          DO jl = 1, jpdia2d 
    573             cltra  = ctrc2d(jl)    ! short title for 2D diagnostic 
    574             cltral = ctrc2l(jl)   ! long title for 2D diagnostic 
    575             cltrau = ctrc2u(jl)   ! UNIT for 2D diagnostic 
     552         DO jn = 1, jpdia2d 
     553            cltra  = ctrc2d(jn)    ! short title for 2D diagnostic 
     554            cltral = ctrc2l(jn)   ! long title for 2D diagnostic 
     555            cltrau = ctrc2u(jn)   ! UNIT for 2D diagnostic 
    576556            CALL histdef( nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd,  & 
    577557               &          1, 1, 1,  -99, 32, clop, zsto, zout ) 
     
    592572      ! --------------------- 
    593573 
    594       IF( lwp .AND. MOD( itmod, nwritedia ) == 0 ) THEN 
     574      IF( lwp .AND. MOD( kt, nwritedia ) == 0 ) THEN 
    595575         WRITE(numout,*) 'trcdii_wr : write NetCDF additional arrays at ', kt, 'time-step' 
    596576         WRITE(numout,*) '~~~~~~ ' 
     
    598578 
    599579      ! more 3D horizontal arrays 
    600       DO jl = 1, jpdia3d 
    601          cltra = ctrc3d(jl)   ! short title for 3D diagnostic 
    602          CALL histwrite( nitd, cltra, it, trc3d(:,:,:,jl), ndimt50 ,ndext50) 
     580      DO jn = 1, jpdia3d 
     581         cltra = ctrc3d(jn)   ! short title for 3D diagnostic 
     582         CALL histwrite( nitd, cltra, it, trc3d(:,:,:,jn), ndimt50 ,ndext50) 
    603583      END DO 
    604584 
    605585      ! more 2D horizontal arrays 
    606       DO jl = 1, jpdia2d 
    607          cltra = ctrc2d(jl)   ! short title for 2D diagnostic 
    608          CALL histwrite(nitd, cltra, it, trc2d(:,:,jl), ndimt51  ,ndext51) 
     586      DO jn = 1, jpdia2d 
     587         cltra = ctrc2d(jn)   ! short title for 2D diagnostic 
     588         CALL histwrite(nitd, cltra, it, trc2d(:,:,jn), ndimt51  ,ndext51) 
    609589      END DO 
     590 
     591      ! synchronise FILE 
     592      IF( MOD( kt, nwritedia ) == 0 .OR. kindic < 0 )   CALL histsync( nitd ) 
    610593 
    611594      ! Closing all files 
     
    613596      IF( kt == nitend .OR. kindic < 0 )   CALL histclo(nitd) 
    614597      ! 
    615  
    616598   END SUBROUTINE trcdii_wr 
    617599 
     
    636618      !! 
    637619      !!        At each time step call histdef to compute the mean if necessary 
    638       !!        Each nwritebio time step, output the instantaneous or mean fields 
     620      !!        Each nwritetrc time step, output the instantaneous or mean fields 
    639621      !! 
    640622      !!        IF kindic <0, output of fields before the model interruption. 
     
    650632      CHARACTER (len=20) ::   cltra, cltrau 
    651633      CHARACTER (len=80) ::   cltral 
    652       INTEGER  ::   ji, jj, jk, jl 
    653       INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it, itmod 
     634      INTEGER  ::   ji, jj, jk, jn 
     635      INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it 
    654636      REAL(wp) ::   zsto, zout, zdt 
    655637      !!---------------------------------------------------------------------- 
     
    658640      ! -------------- 
    659641 
    660        
    661642      ! local variable for debugging 
    662643      ll_print = .FALSE. 
     
    665646      ! Define frequency of output and means 
    666647      zdt = rdt 
    667       IF( ln_mskland )   THEN   ;   clop = "only(x)"   ! put 1.e+20 on land (very expensive!!) 
    668       ELSE                      ;   clop = "x"         ! no use of the mask value (require less cpu time) 
    669       ENDIF 
    670648#        if defined key_diainstant 
    671       zsto = nwritebio * zdt 
    672       clop = "inst("//TRIM(clop)//")" 
     649      zsto=nwritebio*zdt 
     650      clop='inst(only(x))' 
    673651#        else 
    674       zsto = zdt 
    675       clop = "ave("//TRIM(clop)//")" 
     652      zsto=zdt 
     653      clop='ave(only(x))' 
    676654#        endif 
    677       zout = nwritebio * zdt 
    678  
    679       ! Define indices of the horizontal output zoom and vertical limit storage 
     655      zout=nwritebio*zdt 
     656 
     657      ! Define indices of the horizontal output zoom and vertical limit storage      iimi = 1      ;      iima = jpi 
    680658      iimi = 1      ;      iima = jpi 
    681659      ijmi = 1      ;      ijma = jpj 
     
    683661 
    684662      ! define time axis 
    685       itmod = kt - nittrc000 + 1 
    686       it    = kt 
     663      it = kt - nittrc000 + 1 
    687664 
    688665      ! Define NETCDF files and fields at beginning of first time step 
     
    695672         ! Define the NETCDF files for biological trends 
    696673 
    697          CALL dia_nam(clhstnam,nwritebio,'biolog') 
     674         CALL dia_nam(clhstnam,nwrite,'biolog') 
    698675         IF(lwp)WRITE(numout,*) " Name of NETCDF file for biological trends ", clhstnam 
    699676         ! Horizontal grid : glamt and gphit 
    700          CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,      & 
     677         CALL histbeg(clhstnam, jpi, glamt, jpj, gphit,      & 
    701678            &    iimi, iima-iimi+1, ijmi, ijma-ijmi+1,          & 
    702             &    nittrc000-ndttrc, xjulian, zdt, nhoritb, nitb , domain_id=nidom ) 
     679            &    0, zjulian, rdt, nhoritb, nitb , domain_id=nidom) 
    703680         ! Vertical grid for biological trends 
    704          CALL histvert(nitb, 'deptht', 'Vertical T levels', 'm', ipk, gdept_0, ndepitb) 
     681         CALL histvert(nitb, 'deptht', 'Vertical T levels',  & 
     682            &    'm', ipk, gdept_0, ndepitb) 
    705683 
    706684         ! Declare all the output fields as NETCDF variables 
    707685         ! biological trends 
    708          DO jl = 1, jpdiabio 
    709             cltra  = ctrbio(jl)   ! short title for biological diagnostic 
    710             cltral = ctrbil(jl)   ! long title for biological diagnostic 
    711             cltrau = ctrbiu(jl)   ! UNIT for biological diagnostic 
    712             CALL histdef( nitb, cltra, cltral, cltrau, jpi, jpj, nhoritb,  & 
     686         DO jn = 1, jpdiabio 
     687            cltra  = ctrbio(jn)   ! short title for biological diagnostic 
     688            cltral = ctrbil(jn)   ! long title for biological diagnostic 
     689            cltrau = ctrbiu(jn)   ! UNIT for biological diagnostic 
     690            CALL histdef(nitb, cltra, cltral, cltrau, jpi, jpj, nhoritb,  & 
    713691               &         ipk, 1, ipk,  ndepitb, 32, clop, zsto, zout) 
    714692         END DO 
    715693 
    716694         ! CLOSE netcdf Files 
    717           CALL histend( nitb ) 
     695          CALL histend(nitb) 
    718696 
    719697         IF(lwp) WRITE(numout,*) 
     
    727705 
    728706      ! biological trends 
    729       IF( lwp .AND. MOD( itmod, nwritebio ) == 0 ) THEN 
     707      IF( lwp .AND. MOD( kt, nwritebio ) == 0 ) THEN 
    730708         WRITE(numout,*) 'trcdit_wr : write NetCDF biological trends at ', kt, 'time-step' 
    731709         WRITE(numout,*) '~~~~~~ ' 
    732710      ENDIF 
    733711 
    734       DO jl = 1, jpdiabio 
    735          cltra = ctrbio(jl)  ! short title for biological diagnostic 
    736          CALL histwrite(nitb, cltra, it, trbio(:,:,:,jl), ndimt50,ndext50) 
     712      DO jn = 1, jpdiabio 
     713         cltra=ctrbio(jn)  ! short title for biological diagnostic 
     714         CALL histwrite(nitb, cltra, it, trbio(:,:,:,jn), ndimt50,ndext50) 
    737715      END DO 
     716 
     717      ! synchronise FILE 
     718      IF( MOD( kt, nwritebio ) == 0 .OR. kindic < 0 )   CALL histsync( nitb ) 
    738719 
    739720      ! Closing all files 
     
    741722      IF( kt == nitend .OR. kindic < 0 )   CALL histclo( nitb ) 
    742723      ! 
    743  
    744724   END SUBROUTINE trcdib_wr 
    745725 
     
    757737   !!---------------------------------------------------------------------- 
    758738CONTAINS 
    759    SUBROUTINE trc_dia( kt )                      ! Empty routine    
     739   SUBROUTINE trc_dia( kt )                      ! Empty routine 
    760740      INTEGER, INTENT(in) :: kt 
    761    END SUBROUTINE trc_dia    
     741   END SUBROUTINE trc_dia 
    762742 
    763743#endif 
Note: See TracChangeset for help on using the changeset viewer.