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 5901 for branches/2014/dev_r4621_NOC4_BDY_VERT_INTERP/NEMOGCM/NEMO/TOP_SRC/trcrst.F90 – NEMO

Ignore:
Timestamp:
2015-11-20T09:39:06+01:00 (8 years ago)
Author:
jamesharle
Message:

merging branch with head of the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2014/dev_r4621_NOC4_BDY_VERT_INTERP/NEMOGCM/NEMO/TOP_SRC/trcrst.F90

    r5038 r5901  
    2525   USE oce_trc 
    2626   USE trc 
    27    USE trcnam_trp 
    2827   USE iom 
    2928   USE daymod 
     
    3736 
    3837   !! * Substitutions 
    39 #  include "top_substitute.h90" 
     38#  include "domzgr_substitute.h90" 
    4039    
    4140CONTAINS 
     
    5150      CHARACTER(LEN=20)   ::   clkt     ! ocean time-step define as a character 
    5251      CHARACTER(LEN=50)   ::   clname   ! trc output restart file name 
     52      CHARACTER(LEN=256)  ::   clpath   ! full path to ocean output restart file 
    5353      !!---------------------------------------------------------------------- 
    5454      ! 
     
    5656         IF( kt == nittrc000 ) THEN 
    5757            lrst_trc = .FALSE. 
    58             nitrst = nitend 
    59          ENDIF 
    60  
    61          IF( MOD( kt - 1, nstock ) == 0 ) THEN 
     58            IF( ln_rst_list ) THEN 
     59               nrst_lst = 1 
     60               nitrst = nstocklist( nrst_lst ) 
     61            ELSE 
     62               nitrst = nitend 
     63            ENDIF 
     64         ENDIF 
     65 
     66         IF( .NOT. ln_rst_list .AND. MOD( kt - 1, nstock ) == 0 ) THEN 
    6267            ! we use kt - 1 and not kt - nittrc000 to keep the same periodicity from the beginning of the experiment 
    6368            nitrst = kt + nstock - 1                  ! define the next value of nitrst for restart writing 
     
    7984         IF(lwp) WRITE(numout,*) 
    8085         clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_trcrst_out) 
    81          IF(lwp) WRITE(numout,*) '             open trc restart.output NetCDF file: '//clname 
    82          CALL iom_open( clname, numrtw, ldwrt = .TRUE., kiolib = jprstlib ) 
     86         clpath = TRIM(cn_trcrst_outdir) 
     87         IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 
     88         IF(lwp) WRITE(numout,*) & 
     89             '             open trc restart.output NetCDF file: ',TRIM(clpath)//clname 
     90         CALL iom_open( TRIM(clpath)//TRIM(clname), numrtw, ldwrt = .TRUE., kiolib = jprstlib ) 
    8391         lrst_trc = .TRUE. 
    8492      ENDIF 
     
    140148          lrst_trc = .FALSE. 
    141149#endif 
     150          IF( lk_offline .AND. ln_rst_list ) THEN 
     151             nrst_lst = nrst_lst + 1 
     152             nitrst = nstocklist( nrst_lst ) 
     153          ENDIF 
    142154      ENDIF 
    143155      ! 
     
    190202           ! eventually read netcdf file (monobloc)  for restarting on different number of processors 
    191203           ! if {cn_trcrst_in}.nc exists, then set jlibalt to jpnf90  
    192            INQUIRE( FILE = TRIM(cn_trcrst_in)//'.nc', EXIST = llok ) 
     204           INQUIRE( FILE = TRIM(cn_trcrst_indir)//'/'//TRIM(cn_trcrst_in)//'.nc', EXIST = llok ) 
    193205           IF ( llok ) THEN ; jlibalt = jpnf90  ; ELSE ; jlibalt = jprstlib ; ENDIF 
    194206         ENDIF 
    195207 
    196          CALL iom_open( cn_trcrst_in, numrtr, kiolib = jlibalt ) 
    197  
    198          CALL iom_get ( numrtr, 'kt', zkt )   ! last time-step of previous run 
    199  
    200          IF(lwp) THEN 
    201             WRITE(numout,*) ' *** Info read in restart : ' 
    202             WRITE(numout,*) '   previous time-step                               : ', NINT( zkt ) 
    203             WRITE(numout,*) ' *** restart option' 
    204             SELECT CASE ( nn_rsttr ) 
    205             CASE ( 0 )   ;   WRITE(numout,*) ' nn_rsttr = 0 : no control of nittrc000' 
    206             CASE ( 1 )   ;   WRITE(numout,*) ' nn_rsttr = 1 : no control the date at nittrc000 (use ndate0 read in the namelist)' 
    207             CASE ( 2 )   ;   WRITE(numout,*) ' nn_rsttr = 2 : calendar parameters read in restart' 
    208             END SELECT 
    209             WRITE(numout,*) 
    210          ENDIF 
    211          ! Control of date  
    212          IF( nittrc000  - NINT( zkt ) /= nn_dttrc .AND.  nn_rsttr /= 0 )                                  & 
    213             &   CALL ctl_stop( ' ===>>>> : problem with nittrc000 for the restart',                 & 
    214             &                  ' verify the restart file or rerun with nn_rsttr = 0 (namelist)' ) 
    215          IF( lk_offline ) THEN      ! set the date in offline mode 
    216             ! Check dynamics and tracer time-step consistency and force Euler restart if changed 
    217             IF( iom_varid( numrtr, 'rdttrc1', ldstop = .FALSE. ) > 0 )   THEN 
    218                CALL iom_get( numrtr, 'rdttrc1', zrdttrc1 ) 
    219                IF( zrdttrc1 /= rdt * nn_dttrc )   neuler = 0 
    220             ENDIF 
    221             !                          ! define ndastp and adatrj 
    222             IF( nn_rsttr == 2 ) THEN 
     208         IF( ln_rsttr ) THEN 
     209            CALL iom_open( TRIM(cn_trcrst_indir)//'/'//cn_trcrst_in, numrtr, kiolib = jlibalt ) 
     210            CALL iom_get ( numrtr, 'kt', zkt )   ! last time-step of previous run 
     211 
     212            IF(lwp) THEN 
     213               WRITE(numout,*) ' *** Info read in restart : ' 
     214               WRITE(numout,*) '   previous time-step                               : ', NINT( zkt ) 
     215               WRITE(numout,*) ' *** restart option' 
     216               SELECT CASE ( nn_rsttr ) 
     217               CASE ( 0 )   ;   WRITE(numout,*) ' nn_rsttr = 0 : no control of nittrc000' 
     218               CASE ( 1 )   ;   WRITE(numout,*) ' nn_rsttr = 1 : no control the date at nittrc000 (use ndate0 read in the namelist)' 
     219               CASE ( 2 )   ;   WRITE(numout,*) ' nn_rsttr = 2 : calendar parameters read in restart' 
     220               END SELECT 
     221               WRITE(numout,*) 
     222            ENDIF 
     223            ! Control of date  
     224            IF( nittrc000  - NINT( zkt ) /= nn_dttrc .AND.  nn_rsttr /= 0 )                                  & 
     225               &   CALL ctl_stop( ' ===>>>> : problem with nittrc000 for the restart',                 & 
     226               &                  ' verify the restart file or rerun with nn_rsttr = 0 (namelist)' ) 
     227         ENDIF 
     228         ! 
     229         IF( lk_offline ) THEN     
     230            !                                          ! set the date in offline mode 
     231            IF( ln_rsttr .AND. nn_rsttr == 2 ) THEN 
    223232               CALL iom_get( numrtr, 'ndastp', zndastp )  
    224233               ndastp = NINT( zndastp ) 
    225234               CALL iom_get( numrtr, 'adatrj', adatrj  ) 
    226             ELSE 
     235             ELSE 
    227236               ndastp = ndate0 - 1     ! ndate0 read in the namelist in dom_nam 
    228237               adatrj = ( REAL( nittrc000-1, wp ) * rdttra(1) ) / rday 
     
    235244              WRITE(numout,*) '   number of elapsed days since the begining of run : ', adatrj 
    236245              WRITE(numout,*) 
     246            ENDIF 
     247            ! 
     248            IF( ln_rsttr )  THEN   ;    neuler = 1 
     249            ELSE                   ;    neuler = 0 
    237250            ENDIF 
    238251            ! 
     
    265278      INTEGER  :: jk, jn 
    266279      REAL(wp) :: ztraf, zmin, zmax, zmean, zdrift 
     280      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zvol 
    267281      !!---------------------------------------------------------------------- 
    268282 
     
    273287      ENDIF 
    274288      ! 
    275       DO jn = 1, jptra 
    276          ztraf = glob_sum( trn(:,:,:,jn) * cvol(:,:,:) ) 
     289      DO jk = 1, jpk 
     290         zvol(:,:,jk) = e1e2t(:,:) * fse3t_a(:,:,jk) * tmask(:,:,jk) 
     291      END DO 
     292      ! 
     293      DO jn = 1, jptra 
     294         ztraf = glob_sum( trn(:,:,:,jn) * zvol(:,:,:) ) 
    277295         zmin  = MINVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) 
    278296         zmax  = MAXVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) 
     
    306324   !!---------------------------------------------------------------------- 
    307325   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    308    !! $Id$  
     326   !! $Id$ 
    309327   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    310328   !!====================================================================== 
Note: See TracChangeset for help on using the changeset viewer.