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 1450 for trunk/NEMO – NEMO

Changeset 1450 for trunk/NEMO


Ignore:
Timestamp:
2009-05-15T16:12:12+02:00 (15 years ago)
Author:
cetlod
Message:

implementation of iom_put in TOP, see ticket:432

Location:
trunk/NEMO
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMO/OFF_SRC/IOM/iom.F90

    r1324 r1450  
    2626   USE iom_rstdimg     ! restarts access direct format "dimg" style... 
    2727 
     28#if defined key_iomput 
     29   USE mod_event_client 
     30# endif 
     31 
    2832   IMPLICIT NONE 
    2933   PUBLIC   !   must be public to be able to access iom_def through iom 
    3034    
    31    PUBLIC iom_open, iom_close, iom_varid, iom_get, iom_gettime, iom_rstput 
     35   PUBLIC iom_init, iom_open, iom_close, iom_setkt, iom_varid, iom_get, iom_gettime, iom_rstput, iom_put 
    3236 
    3337   PRIVATE iom_rp0d, iom_rp1d, iom_rp2d, iom_rp3d 
    3438   PRIVATE iom_g0d, iom_g1d, iom_g2d, iom_g3d, iom_get_123d 
     39   PRIVATE iom_p2d, iom_p3d 
     40#if defined key_iomput 
     41   PRIVATE iom_init_chkcpp 
     42   PRIVATE set_grid 
     43# endif 
    3544 
    3645   INTERFACE iom_get 
     
    4049      MODULE PROCEDURE iom_rp0d, iom_rp1d, iom_rp2d, iom_rp3d 
    4150   END INTERFACE 
     51  INTERFACE iom_put 
     52     MODULE PROCEDURE iom_p2d, iom_p3d 
     53  END INTERFACE 
     54#if defined key_iomput 
     55   INTERFACE iom_setkt 
     56      MODULE PROCEDURE event__set_timestep 
     57   END INTERFACE 
     58# endif 
    4259 
    4360   !!---------------------------------------------------------------------- 
     
    4966CONTAINS 
    5067 
    51    SUBROUTINE iom_open( cdname, kiomid, ldwrt, kdom, kiolib, ldstop ) 
     68   SUBROUTINE iom_init( pjulian ) 
     69      !!---------------------------------------------------------------------- 
     70      !!                     ***  ROUTINE   *** 
     71      !! 
     72      !! ** Purpose :    
     73      !! 
     74      !!---------------------------------------------------------------------- 
     75      REAL(wp), INTENT(in) ::  pjulian   !: julian day at nit000 = 0 
     76#if defined key_iomput 
     77      !!---------------------------------------------------------------------- 
     78      ! read the xml file 
     79      CALL event__parse_xml_file( 'iodef.xml' )   ! <- to get from the nameliste (namrun)... 
     80 
     81      ! calendar parameters 
     82      CALL event__set_time_parameters( nit000 - 1, pjulian, rdt ) 
     83 
     84      ! horizontal grid definition 
     85      CALL set_grid( "grid_T", glamt, gphit ) 
     86      CALL set_grid( "grid_U", glamu, gphiu ) 
     87      CALL set_grid( "grid_V", glamv, gphiv ) 
     88      CALL set_grid( "grid_W", glamt, gphit ) 
     89 
     90      ! vertical grid definition 
     91      CALL event__set_vert_axis( "deptht", gdept_0 ) 
     92      CALL event__set_vert_axis( "depthu", gdept_0 ) 
     93      CALL event__set_vert_axis( "depthv", gdept_0 ) 
     94      CALL event__set_vert_axis( "depthw", gdepw_0 ) 
     95 
     96      ! consistency regarding CPP keys... 
     97      CALL iom_init_chkcpp 
     98 
     99      ! end file definition 
     100      CALL event__close_io_definition 
     101#endif 
     102 
     103   END SUBROUTINE iom_init 
     104 
     105 
     106   SUBROUTINE iom_open( cdname, kiomid, ldwrt, kdom, kiolib, ldstop, ldiof ) 
    52107      !!--------------------------------------------------------------------- 
    53108      !!                   ***  SUBROUTINE  iom_open  *** 
     
    61116      INTEGER         , INTENT(in   ), OPTIONAL ::   kiolib   ! library used to open the file (default = jpnf90)  
    62117      LOGICAL         , INTENT(in   ), OPTIONAL ::   ldstop   ! stop if open to read a non-existing file (default = .TRUE.) 
     118      LOGICAL         , INTENT(in   ), OPTIONAL ::   ldiof    ! Interp On the Fly, needed for AGRIF (default = .FALSE.) 
    63119 
    64120      CHARACTER(LEN=100)    ::   clname    ! the name of the file based on cdname [[+clcpu]+clcpu] 
     
    71127      LOGICAL               ::   llnoov    ! local definition to read overlap 
    72128      LOGICAL               ::   llstop    ! local definition of ldstop 
     129      LOGICAL               ::   lliof     ! local definition of ldiof 
    73130      INTEGER               ::   iolib     ! library do we use to open the file 
    74131      INTEGER               ::   icnt      ! counter for digits in clcpu (max = jpmax_digits) 
     
    85142      ! Initializations and control 
    86143      ! ============= 
     144      kiomid = -1 
    87145      clinfo = '                    iom_open ~~~  ' 
    88146      istop = nstop 
    89147      ! if iom_open is called for the first time: initialize iom_file(:)%nfid to 0 
    90148      ! (could be done when defining iom_file in f95 but not in f90) 
    91       IF( iom_init == 0 ) THEN 
     149#if ! defined key_agrif 
     150      IF( iom_open_init == 0 ) THEN 
    92151         iom_file(:)%nfid = 0 
    93          iom_init = 1 
    94       ENDIF 
     152         iom_open_init = 1 
     153      ENDIF 
     154#else 
     155      IF( Agrif_Root() ) THEN 
     156         IF( iom_open_init == 0 ) THEN 
     157            iom_file(:)%nfid = 0 
     158            iom_open_init = 1 
     159         ENDIF 
     160      ENDIF 
     161#endif 
    95162      ! do we read or write the file? 
    96163      IF( PRESENT(ldwrt) ) THEN   ;   llwrt = ldwrt 
     
    105172      ELSE                         ;   iolib = jpnf90 
    106173      ENDIF 
     174      ! are we using interpolation on the fly? 
     175      IF( PRESENT(ldiof) ) THEN   ;   lliof = ldiof 
     176      ELSE                        ;   lliof = .FALSE. 
     177      ENDIF 
    107178      ! do we read the overlap  
    108179      ! ugly patch SM+JMM+RB to overwrite global definition in some cases 
    109 #if ! defined key_agrif 
    110       llnoov = (jpni * jpnj ) == jpnij 
    111 #endif 
     180      llnoov = (jpni * jpnj ) == jpnij  
    112181      ! create the file name by added, if needed, TRIM(Agrif_CFixed()) and TRIM(clsuffix) 
    113182      ! ============= 
    114183      clname   = trim(cdname) 
    115184#if defined key_agrif 
    116       IF ( .NOT. Agrif_Root() ) THEN 
     185      IF ( .NOT. Agrif_Root() .AND. .NOT. lliof ) THEN 
    117186         iln    = INDEX(clname,'/')  
    118187         cltmpn = clname(1:iln) 
     
    239308         i_s = 1 
    240309         i_e = jpmax_files 
     310#if defined key_iomput 
     311         CALL event__stop_ioserver 
     312#endif 
    241313      ENDIF 
    242314 
     
    451523      ! do we read the overlap  
    452524      ! ugly patch SM+JMM+RB to overwrite global definition in some cases 
    453 #if ! defined key_agrif 
    454       llnoov = (jpni * jpnj ) == jpnij 
    455 #endif 
     525      llnoov = (jpni * jpnj ) == jpnij  
    456526      ! check kcount and kstart optionals parameters... 
    457527      IF( PRESENT(kcount) .AND. (.NOT. PRESENT(kstart)) ) CALL ctl_stop(trim(clinfo), 'kcount present needs kstart present') 
     
    819889      ENDIF 
    820890   END SUBROUTINE iom_rp3d 
     891 
     892 
    821893   !!---------------------------------------------------------------------- 
     894   !!                   INTERFACE iom_rstput 
     895   !!---------------------------------------------------------------------- 
     896   SUBROUTINE iom_p2d( cdname, pfield2d ) 
     897      CHARACTER(LEN=*)            , INTENT(in) ::   cdname 
     898      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pfield2d 
     899#if defined key_iomput 
     900      CALL event__write_field2D( cdname, pfield2d(nldi:nlei, nldj:nlej) ) 
     901#endif 
     902   END SUBROUTINE iom_p2d 
     903 
     904   SUBROUTINE iom_p3d( cdname, pfield3d ) 
     905      CHARACTER(LEN=*)                , INTENT(in) ::   cdname 
     906      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in) ::   pfield3d 
     907#if defined key_iomput 
     908      CALL event__write_field3D( cdname, pfield3d(nldi:nlei, nldj:nlej, :) ) 
     909#endif 
     910   END SUBROUTINE iom_p3d 
     911   !!---------------------------------------------------------------------- 
     912 
     913 
     914#if defined key_iomput 
     915 
     916   SUBROUTINE set_grid( cdname, plon, plat ) 
     917      !!---------------------------------------------------------------------- 
     918      !!                     ***  ROUTINE   *** 
     919      !! 
     920      !! ** Purpose :    
     921      !! 
     922      !!---------------------------------------------------------------------- 
     923      CHARACTER(LEN=*)            , INTENT(in) ::   cdname 
     924      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   plon 
     925      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   plat 
     926 
     927      CALL event__set_grid_dimension( cdname, jpiglo, jpjglo) 
     928      CALL event__set_grid_domain( cdname, nlei-nldi+1, nlej-nldj+1, nimpp+nldi-1, njmpp+nldj-1, & 
     929         &                         plon(nldi:nlei, nldj:nlej), plat(nldi:nlei, nldj:nlej) ) 
     930      CALL event__set_grid_type_nemo( cdname ) 
     931 
     932   END SUBROUTINE set_grid 
     933 
     934 
     935   SUBROUTINE iom_init_chkcpp 
     936      !!--------------------------------------------------------------------- 
     937      !!                   ***  SUBROUTINE    *** 
     938      !! 
     939      !! ** Purpose :   
     940      !!--------------------------------------------------------------------- 
     941      USE zdfddm, ONLY :   lk_zdfddm      ! vertical  physics: double diffusion 
     942 
     943#if ! defined key_off_tra       
     944#if defined key_dynspg_rl 
     945      CALL event__disable_field( "sossheig" ) 
     946#else 
     947      CALL event__disable_field( "sobarstf" ) 
     948#endif 
     949 
     950      !!#if ! ( ! defined key_dynspg_rl && defined key_ice_lim) 
     951      !!        CALL disable_field( "iowaflup" ) 
     952      !!         CALL disable_field( "sowaflep" ) 
     953      !!#endif 
     954 
     955#if ! defined key_coupled 
     956      CALL event__enable_field( "sohefldp" ) 
     957      CALL event__enable_field( "sowafldp" ) 
     958      CALL event__enable_field( "sosafldp" ) 
     959#endif 
     960 
     961#if ( defined key_coupled && ! defined key_lim3 && ! defined key_lim2 )  
     962      CALL event__enable_field( "sohefldp" ) 
     963      CALL event__enable_field( "sowafldp" ) 
     964      CALL event__enable_field( "sosafldp" ) 
     965#endif 
     966 
     967#if ! defined key_diaspr 
     968      CALL event__disable_field( "sosurfps" ) 
     969#endif 
     970 
     971#if ! defined key_diahth 
     972      CALL event__disable_field( "sothedep" ) 
     973      CALL event__disable_field( "so20chgt" ) 
     974      CALL event__disable_field( "so28chgt" ) 
     975      CALL event__disable_field( "sohtc300" ) 
     976#endif 
     977 
     978#if defined key_coupled  
     979# if defined key_lim3 
     980      Must be adapted to LIM3 
     981# else 
     982      CALL event__enable_field( "soicetem" ) 
     983      CALL event__enable_field( "soicealb" ) 
     984# endif  
     985#endif  
     986 
     987#if ! defined key_diaeiv 
     988      CALL event__disable_field( "vozoeivu" ) 
     989      CALL event__disable_field( "vomeeivv" ) 
     990      CALL event__disable_field( "voveeivw" ) 
     991#endif 
     992 
     993#if ! defined key_dynspg_rl 
     994      CALL event__disable_field( "sozospgx" ) 
     995      CALL event__disable_field( "somespgy" ) 
     996#endif 
     997 
     998      IF( lk_zdfddm ) CALL event__enable_field( "voddmavs" ) 
     999 
     1000#if ! defined key_traldf_c2d 
     1001      CALL event__disable_field( "soleahtw" ) 
     1002#endif 
     1003 
     1004#if ! defined key_traldf_eiv  
     1005      CALL event__disable_field( "soleaeiw" ) 
     1006#endif 
     1007#endif 
     1008 
     1009   END SUBROUTINE iom_init_chkcpp 
     1010 
     1011#else 
     1012 
     1013   SUBROUTINE iom_setkt( kt ) 
     1014      INTEGER, INTENT(in   )::   kt  
     1015   END SUBROUTINE iom_setkt 
     1016 
     1017#endif 
    8221018 
    8231019 
  • trunk/NEMO/OFF_SRC/IOM/iom_def.F90

    r1324 r1450  
    4949 
    5050!$AGRIF_DO_NOT_TREAT 
    51    INTEGER, PUBLIC            ::   iom_init = 0        !: used to initialize iom_file(:)%nfid to 0 
     51   INTEGER, PUBLIC            ::   iom_open_init = 0   !: used to initialize iom_file(:)%nfid to 0 
    5252 
    5353   TYPE, PUBLIC ::   file_descriptor 
  • trunk/NEMO/OFF_SRC/daymod.F90

    r1291 r1450  
    3030   USE in_out_manager  ! I/O manager 
    3131   USE prtctl          ! Print control 
     32   USE ioipsl, ONLY :   ymds2ju        ! for calendar 
    3233 
    3334   IMPLICIT NONE 
     
    4647   REAL(wp), PUBLIC ::   rsec_day    !: current time step counted in second since 00h of the current day 
    4748 
     49   REAL(wp), PUBLIC ::   fjulday     !: julian day 
    4850   REAL(wp), PUBLIC ::   adatrj      !: number of elapsed days since the begining of the run 
    4951   !                                 !: it is the accumulated duration of previous runs 
     
    9597      nmonth  = ( ndastp - (nyear * 10000) ) / 100 
    9698      nday    =   ndastp - (nyear * 10000) - ( nmonth * 100 )  
     99 
     100      CALL ymds2ju( nyear, nmonth, nday, 0.0, fjulday )  ! we assume that we start run at 00:00 
     101      fjulday = fjulday + 1.                             ! move back to the day at nit000 (and not at nit000 - 1) 
     102 
    97103 
    98104      sec1jan000 = 0.e0 
     
    203209      rsec_day   = rsec_day   + rdttra(1)                  
    204210      adatrj = adatrj + rdttra(1) / rday 
    205        
     211      fjulday = fjulday + rdttra(1) / rday 
     212    
    206213      IF( rsec_day > rday ) THEN                        ! NEW day 
    207214         ! 
  • trunk/NEMO/OFF_SRC/opa.F90

    r1350 r1450  
    2929   USE trcini          ! Initilization of the passive tracers 
    3030   USE step            ! OPA time-stepping                  (stp     routine) 
     31 
     32   USE iom 
     33#if defined key_iomput 
     34   USE  mod_ioclient 
     35#endif  
    3136 
    3237   IMPLICIT NONE 
     
    130135      !!---------------------------------------------------------------------- 
    131136      !! * Local declarations 
     137#if defined key_iomput 
     138      INTEGER :: localComm 
     139#endif 
    132140      CHARACTER (len=20) ::   namelistname 
    133141      CHARACTER (len=28) ::   file_out 
     142      NAMELIST/namctl/ ln_ctl, nprint, nictls, nictle,   & 
     143         &             isplt , jsplt , njctls, njctle, nbench 
    134144 
    135145      !!---------------------------------------------------------------------- 
     
    156166      WRITE(numout,*) 
    157167 
     168      ! Namelist namctl : Control prints & Benchmark 
     169      REWIND( numnam ) 
     170      READ  ( numnam, namctl ) 
     171 
     172#if defined key_iomput 
     173      CALL init_ioclient(localcomm) 
     174      narea = mynode(localComm) 
     175#else 
    158176      ! Nodes selection 
    159177      narea = mynode() 
     178#endif 
     179 
     180      ! Nodes selection 
    160181      narea = narea + 1    ! mynode return the rank of proc (0 --> jpnij -1 ) 
    161182      lwp   = narea == 1 
     
    180201      ENDIF 
    181202 
     203      CALL opa_flg                          ! Control prints & Benchmark 
     204 
    182205      !                                     ! ============================== ! 
    183206      !                                     !  Model general initialization  ! 
     
    212235      CALL ldf_tra_init                         ! Lateral ocean tracer physics 
    213236#endif  
     237      CALL iom_init( fjulday - adatrj )     ! iom_put initialization 
    214238      !                                     ! =============== ! 
    215239      !                                     !  time stepping  ! 
     
    220244   END SUBROUTINE opa_init 
    221245 
     246   SUBROUTINE opa_flg 
     247      !!---------------------------------------------------------------------- 
     248      !!                     ***  ROUTINE opa  *** 
     249      !! 
     250      !! ** Purpose :   Initialize logical flags that control the choice of 
     251      !!      some algorithm or control print 
     252      !! 
     253      !! ** Method  :    Read in namilist namflg logical flags 
     254      !! 
     255      !! History : 
     256      !!   9.0  !  03-11  (G. Madec)  Original code 
     257      !!---------------------------------------------------------------------- 
     258      !! * Local declarations 
     259 
     260      ! Parameter control and print 
     261      ! --------------------------- 
     262      IF(lwp) THEN 
     263         WRITE(numout,*) 
     264         WRITE(numout,*) 'opa_flg: Control prints & Benchmark' 
     265         WRITE(numout,*) '~~~~~~~ ' 
     266         WRITE(numout,*) '          Namelist namctl' 
     267         WRITE(numout,*) '             run control (for debugging)     ln_ctl    = ', ln_ctl 
     268         WRITE(numout,*) '             level of print                  nprint    = ', nprint 
     269         WRITE(numout,*) '             Start i indice for SUM control  nictls    = ', nictls 
     270         WRITE(numout,*) '             End i indice for SUM control    nictle    = ', nictle 
     271         WRITE(numout,*) '             Start j indice for SUM control  njctls    = ', njctls 
     272         WRITE(numout,*) '             End j indice for SUM control    njctle    = ', njctle 
     273         WRITE(numout,*) '             number of proc. following i     isplt     = ', isplt 
     274         WRITE(numout,*) '             number of proc. following j     jsplt     = ', jsplt 
     275         WRITE(numout,*) '             benchmark parameter (0/1)       nbench    = ', nbench 
     276      ENDIF 
     277 
     278      ! ... Control the sub-domain area indices for the control prints 
     279      IF( ln_ctl )   THEN 
     280         IF( lk_mpp )   THEN 
     281            ! the domain is forced to the real splitted domain in MPI 
     282            isplt = jpni ; jsplt = jpnj ; ijsplt = jpni*jpnj 
     283         ELSE 
     284            IF( isplt == 1 .AND. jsplt == 1  ) THEN 
     285               CALL ctl_warn( '          - isplt & jsplt are equal to 1',   & 
     286                    &         '          - the print control will be done over the whole domain' ) 
     287            ENDIF 
     288 
     289            ! compute the total number of processors ijsplt 
     290            ijsplt = isplt*jsplt 
     291         ENDIF 
     292 
     293         IF(lwp) WRITE(numout,*)'          - The total number of processors over which the' 
     294         IF(lwp) WRITE(numout,*)'            print control will be done is ijsplt : ', ijsplt 
     295 
     296         ! Control the indices used for the SUM control 
     297         IF( nictls+nictle+njctls+njctle == 0 )   THEN 
     298            ! the print control is done over the default area 
     299            lsp_area = .FALSE. 
     300         ELSE 
     301            ! the print control is done over a specific  area 
     302            lsp_area = .TRUE. 
     303            IF( nictls < 1 .OR. nictls > jpiglo )   THEN 
     304               CALL ctl_warn( '          - nictls must be 1<=nictls>=jpiglo, it is forced to 1' ) 
     305               nictls = 1 
     306            ENDIF 
     307 
     308            IF( nictle < 1 .OR. nictle > jpiglo )   THEN 
     309               CALL ctl_warn( '          - nictle must be 1<=nictle>=jpiglo, it is forced to jpiglo' ) 
     310               nictle = jpiglo 
     311            ENDIF 
     312 
     313            IF( njctls < 1 .OR. njctls > jpjglo )   THEN 
     314               CALL ctl_warn( '          - njctls must be 1<=njctls>=jpjglo, it is forced to 1' ) 
     315               njctls = 1 
     316            ENDIF 
     317 
     318            IF( njctle < 1 .OR. njctle > jpjglo )   THEN 
     319               CALL ctl_warn( '          - njctle must be 1<=njctle>=jpjglo, it is forced to jpjglo' ) 
     320               njctle = jpjglo 
     321            ENDIF 
     322 
     323         ENDIF          ! IF( nictls+nictle+njctls+njctle == 0 ) 
     324       ENDIF            ! IF(ln_ctl) 
     325 
     326      IF( nbench == 1 )   THEN 
     327         SELECT CASE ( cp_cfg ) 
     328         CASE ( 'gyre' ) 
     329            CALL ctl_warn( '          The Benchmark is activated ' ) 
     330         CASE DEFAULT 
     331            CALL ctl_stop( '          The Benchmark is based on the GYRE configuration: key_gyre must & 
     332               &                      be used or set nbench = 0' ) 
     333         END SELECT 
     334      ENDIF 
     335 
     336   END SUBROUTINE opa_flg 
     337 
    222338   SUBROUTINE opa_closefile 
    223339      !!---------------------------------------------------------------------- 
     
    243359      IF(lwp) CLOSE( numstp )   ! time-step file 
    244360 
     361      CALL iom_close            ! close all input/output files 
     362 
    245363   END SUBROUTINE opa_closefile 
    246364 
  • trunk/NEMO/TOP_SRC/trcdia.F90

    r1391 r1450  
    2929   USE lib_mpp 
    3030   USE ioipsl 
     31   USE iom 
    3132 
    3233   IMPLICIT NONE 
     
    117118      ! -------------- 
    118119 
     120      CALL iom_setkt( kt + ndttrc - 1 ) 
     121 
    119122      ! local variable for debugging 
    120123      ll_print = .FALSE.                  ! change it to true for more control print 
     
    207210 
    208211      DO jn = 1, jptra 
    209          IF( lutsav(jn) ) THEN 
    210             cltra = ctrcnm(jn)      ! short title for tracer 
    211             CALL histwrite( nit5, cltra, it, trn(:,:,:,jn), ndimt50, ndext50 ) 
    212          ENDIF 
     212         cltra = ctrcnm(jn)      ! short title for tracer 
     213         IF( lutsav(jn) ) CALL histwrite( nit5, cltra, it, trn(:,:,:,jn), ndimt50, ndext50 ) 
     214         CALL iom_put( ctrcnm(jn), trn(:,:,:,jn) ) 
    213215      END DO 
    214216 
     
    217219      IF( kt == nitend .OR. kindic < 0 )   CALL histclo( nit5 ) 
    218220      ! 
     221      CALL iom_setkt( kt ) 
     222 
    219223   END SUBROUTINE trcdit_wr 
    220224 
     
    252256      ! 0. Initialisation 
    253257      ! ----------------- 
     258       
     259      CALL iom_setkt( kt + ndttrc - 1 ) 
    254260 
    255261      ! local variable for debugging 
     
    439445            END DO 
    440446         END IF 
     447         CALL iom_put( ctrcnm(jn), trn(:,:,:,jn) ) 
    441448      END DO 
    442449 
     
    449456      ENDIF 
    450457      ! 
     458      CALL iom_setkt( kt ) 
     459 
    451460   END SUBROUTINE trcdid_wr 
    452461 
     
    484493      CHARACTER (len=20) ::   cltra, cltrau 
    485494      CHARACTER (len=80) ::   cltral 
    486       INTEGER  ::   jn 
     495      INTEGER  ::   jl 
    487496      INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it, itmod 
    488497      REAL(wp) ::   zsto, zout, zdt 
     
    491500      ! Initialisation 
    492501      ! -------------- 
    493  
     502    
     503      CALL iom_setkt( kt + ndttrc - 1 ) 
     504       
    494505      ! local variable for debugging 
    495506      ll_print = .FALSE. 
     
    546557 
    547558         ! more 3D horizontal arrays 
    548          DO jn = 1, jpdia3d 
    549             cltra  = ctrc3d(jn)   ! short title for 3D diagnostic 
    550             cltral = ctrc3l(jn)   ! long title for 3D diagnostic 
    551             cltrau = ctrc3u(jn)   ! UNIT for 3D diagnostic 
     559         DO jl = 1, jpdia3d 
     560            cltra  = ctrc3d(jl)   ! short title for 3D diagnostic 
     561            cltral = ctrc3l(jl)   ! long title for 3D diagnostic 
     562            cltrau = ctrc3u(jl)   ! UNIT for 3D diagnostic 
    552563            CALL histdef( nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd,   & 
    553564               &          ipk, 1, ipk,  ndepitd, 32, clop, zsto, zout ) 
     
    555566 
    556567         ! more 2D horizontal arrays 
    557          DO jn = 1, jpdia2d 
    558             cltra  = ctrc2d(jn)    ! short title for 2D diagnostic 
    559             cltral = ctrc2l(jn)   ! long title for 2D diagnostic 
    560             cltrau = ctrc2u(jn)   ! UNIT for 2D diagnostic 
     568         DO jl = 1, jpdia2d 
     569            cltra  = ctrc2d(jl)    ! short title for 2D diagnostic 
     570            cltral = ctrc2l(jl)   ! long title for 2D diagnostic 
     571            cltrau = ctrc2u(jl)   ! UNIT for 2D diagnostic 
    561572            CALL histdef( nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd,  & 
    562573               &          1, 1, 1,  -99, 32, clop, zsto, zout ) 
     
    583594 
    584595      ! more 3D horizontal arrays 
    585       DO jn = 1, jpdia3d 
    586          cltra = ctrc3d(jn)   ! short title for 3D diagnostic 
    587          CALL histwrite( nitd, cltra, it, trc3d(:,:,:,jn), ndimt50 ,ndext50) 
     596      DO jl = 1, jpdia3d 
     597         cltra = ctrc3d(jl)   ! short title for 3D diagnostic 
     598         CALL histwrite( nitd, cltra, it, trc3d(:,:,:,jl), ndimt50 ,ndext50) 
     599         CALL iom_put( cltra, trc3d(:,:,:,jl) ) 
    588600      END DO 
    589601 
    590602      ! more 2D horizontal arrays 
    591       DO jn = 1, jpdia2d 
    592          cltra = ctrc2d(jn)   ! short title for 2D diagnostic 
    593          CALL histwrite(nitd, cltra, it, trc2d(:,:,jn), ndimt51  ,ndext51) 
     603      DO jl = 1, jpdia2d 
     604         cltra = ctrc2d(jl)   ! short title for 2D diagnostic 
     605         CALL histwrite(nitd, cltra, it, trc2d(:,:,jl), ndimt51  ,ndext51) 
     606         CALL iom_put( cltra, trc2d(:,:,jl) ) 
    594607      END DO 
    595608 
     
    598611      IF( kt == nitend .OR. kindic < 0 )   CALL histclo(nitd) 
    599612      ! 
     613      CALL iom_setkt( kt ) 
     614 
    600615   END SUBROUTINE trcdii_wr 
    601616 
     
    634649      CHARACTER (len=20) ::   cltra, cltrau 
    635650      CHARACTER (len=80) ::   cltral 
    636       INTEGER  ::   ji, jj, jk, jn 
     651      INTEGER  ::   ji, jj, jk, jl 
    637652      INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it, itmod 
    638653      REAL(wp) ::   zsto, zout, zdt 
     
    642657      ! -------------- 
    643658 
     659      CALL iom_setkt( kt + ndttrc - 1 ) 
     660       
    644661      ! local variable for debugging 
    645662      ll_print = .FALSE. 
     
    689706         ! Declare all the output fields as NETCDF variables 
    690707         ! biological trends 
    691          DO jn = 1, jpdiabio 
    692             cltra  = ctrbio(jn)   ! short title for biological diagnostic 
    693             cltral = ctrbil(jn)   ! long title for biological diagnostic 
    694             cltrau = ctrbiu(jn)   ! UNIT for biological diagnostic 
     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 
    695712            CALL histdef( nitb, cltra, cltral, cltrau, jpi, jpj, nhoritb,  & 
    696713               &         ipk, 1, ipk,  ndepitb, 32, clop, zsto, zout) 
     
    715732      ENDIF 
    716733 
    717       DO jn = 1, jpdiabio 
    718          cltra = ctrbio(jn)  ! short title for biological diagnostic 
    719          CALL histwrite(nitb, cltra, it, trbio(:,:,:,jn), ndimt50,ndext50) 
     734      DO jl = 1, jpdiabio 
     735         cltra = ctrbio(jl)  ! short title for biological diagnostic 
     736         CALL histwrite(nitb, cltra, it, trbio(:,:,:,jl), ndimt50,ndext50) 
     737         CALL iom_put( cltra, trbio(:,:,:,jl) ) 
    720738      END DO 
    721739 
     
    724742      IF( kt == nitend .OR. kindic < 0 )   CALL histclo( nitb ) 
    725743      ! 
     744      CALL iom_setkt( kt ) 
     745 
    726746   END SUBROUTINE trcdib_wr 
    727747 
Note: See TracChangeset for help on using the changeset viewer.