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 5602 for branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/trcrst.F90 – NEMO

Ignore:
Timestamp:
2015-07-16T13:55:15+02:00 (9 years ago)
Author:
cbricaud
Message:

merge change from trunk rev 5003 to 5519 ( rev where branche 3.6_stable were created )

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/trcrst.F90

    r5105 r5602  
    5454      CHARACTER(LEN=20)   ::   clkt     ! ocean time-step define as a character 
    5555      CHARACTER(LEN=50)   ::   clname   ! trc output restart file name 
     56      CHARACTER(LEN=256)  ::   clpath   ! full path to ocean output restart file 
    5657      !!---------------------------------------------------------------------- 
    5758      ! 
     
    5960         IF( kt == nittrc000 ) THEN 
    6061            lrst_trc = .FALSE. 
    61             nitrst = nitend 
    62          ENDIF 
    63  
    64          IF( MOD( kt - 1, nstock ) == 0 ) THEN 
     62            IF( ln_rst_list ) THEN 
     63               nrst_lst = 1 
     64               nitrst = nstocklist( nrst_lst ) 
     65            ELSE 
     66               nitrst = nitend 
     67            ENDIF 
     68         ENDIF 
     69 
     70         IF( .NOT. ln_rst_list .AND. MOD( kt - 1, nstock ) == 0 ) THEN 
    6571            ! we use kt - 1 and not kt - nittrc000 to keep the same periodicity from the beginning of the experiment 
    6672            nitrst = kt + nstock - 1                  ! define the next value of nitrst for restart writing 
     
    8288         IF(lwp) WRITE(numout,*) 
    8389         clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_trcrst_out) 
    84          IF(lwp) WRITE(numout,*) '             open trc restart.output NetCDF file: '//clname 
    85          CALL iom_open( clname, numrtw, ldwrt = .TRUE., kiolib = jprstlib ) 
     90         clpath = TRIM(cn_trcrst_outdir) 
     91         IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 
     92         IF(lwp) WRITE(numout,*) & 
     93             '             open trc restart.output NetCDF file: ',TRIM(clpath)//clname 
     94         CALL iom_open( TRIM(clpath)//TRIM(clname), numrtw, ldwrt = .TRUE., kiolib = jprstlib ) 
    8695         lrst_trc = .TRUE. 
    8796      ENDIF 
     
    143152          lrst_trc = .FALSE. 
    144153#endif 
     154          IF( lk_offline .AND. ln_rst_list ) THEN 
     155             nrst_lst = nrst_lst + 1 
     156             nitrst = nstocklist( nrst_lst ) 
     157          ENDIF 
    145158      ENDIF 
    146159      ! 
     
    193206           ! eventually read netcdf file (monobloc)  for restarting on different number of processors 
    194207           ! if {cn_trcrst_in}.nc exists, then set jlibalt to jpnf90  
    195            INQUIRE( FILE = TRIM(cn_trcrst_in)//'.nc', EXIST = llok ) 
     208           INQUIRE( FILE = TRIM(cn_trcrst_indir)//'/'//TRIM(cn_trcrst_in)//'.nc', EXIST = llok ) 
    196209           IF ( llok ) THEN ; jlibalt = jpnf90  ; ELSE ; jlibalt = jprstlib ; ENDIF 
    197210         ENDIF 
    198211 
    199          CALL iom_open( cn_trcrst_in, numrtr, kiolib = jlibalt ) 
    200  
    201          CALL iom_get ( numrtr, 'kt', zkt )   ! last time-step of previous run 
    202  
    203          IF(lwp) THEN 
    204             WRITE(numout,*) ' *** Info read in restart : ' 
    205             WRITE(numout,*) '   previous time-step                               : ', NINT( zkt ) 
    206             WRITE(numout,*) ' *** restart option' 
    207             SELECT CASE ( nn_rsttr ) 
    208             CASE ( 0 )   ;   WRITE(numout,*) ' nn_rsttr = 0 : no control of nittrc000' 
    209             CASE ( 1 )   ;   WRITE(numout,*) ' nn_rsttr = 1 : no control the date at nittrc000 (use ndate0 read in the namelist)' 
    210             CASE ( 2 )   ;   WRITE(numout,*) ' nn_rsttr = 2 : calendar parameters read in restart' 
    211             END SELECT 
    212             WRITE(numout,*) 
    213          ENDIF 
    214          ! Control of date  
    215          IF( nittrc000  - NINT( zkt ) /= nn_dttrc .AND.  nn_rsttr /= 0 )                                  & 
    216             &   CALL ctl_stop( ' ===>>>> : problem with nittrc000 for the restart',                 & 
    217             &                  ' verify the restart file or rerun with nn_rsttr = 0 (namelist)' ) 
    218          IF( lk_offline ) THEN      ! set the date in offline mode 
    219             ! Check dynamics and tracer time-step consistency and force Euler restart if changed 
    220             IF( iom_varid( numrtr, 'rdttrc1', ldstop = .FALSE. ) > 0 )   THEN 
    221                CALL iom_get( numrtr, 'rdttrc1', zrdttrc1 ) 
    222                IF( zrdttrc1 /= rdt * nn_dttrc )   neuler = 0 
    223             ENDIF 
    224             !                          ! define ndastp and adatrj 
    225             IF( nn_rsttr == 2 ) THEN 
     212         IF( ln_rsttr ) THEN 
     213            CALL iom_open( TRIM(cn_trcrst_indir)//'/'//cn_trcrst_in, numrtr, kiolib = jlibalt ) 
     214            CALL iom_get ( numrtr, 'kt', zkt )   ! last time-step of previous run 
     215 
     216            IF(lwp) THEN 
     217               WRITE(numout,*) ' *** Info read in restart : ' 
     218               WRITE(numout,*) '   previous time-step                               : ', NINT( zkt ) 
     219               WRITE(numout,*) ' *** restart option' 
     220               SELECT CASE ( nn_rsttr ) 
     221               CASE ( 0 )   ;   WRITE(numout,*) ' nn_rsttr = 0 : no control of nittrc000' 
     222               CASE ( 1 )   ;   WRITE(numout,*) ' nn_rsttr = 1 : no control the date at nittrc000 (use ndate0 read in the namelist)' 
     223               CASE ( 2 )   ;   WRITE(numout,*) ' nn_rsttr = 2 : calendar parameters read in restart' 
     224               END SELECT 
     225               WRITE(numout,*) 
     226            ENDIF 
     227            ! Control of date  
     228            IF( nittrc000  - NINT( zkt ) /= nn_dttrc .AND.  nn_rsttr /= 0 )                                  & 
     229               &   CALL ctl_stop( ' ===>>>> : problem with nittrc000 for the restart',                 & 
     230               &                  ' verify the restart file or rerun with nn_rsttr = 0 (namelist)' ) 
     231         ENDIF 
     232         ! 
     233         IF( lk_offline ) THEN     
     234            !                                          ! set the date in offline mode 
     235            IF( ln_rsttr .AND. nn_rsttr == 2 ) THEN 
    226236               CALL iom_get( numrtr, 'ndastp', zndastp )  
    227237               ndastp = NINT( zndastp ) 
    228238               CALL iom_get( numrtr, 'adatrj', adatrj  ) 
    229             ELSE 
     239             ELSE 
    230240               ndastp = ndate0 - 1     ! ndate0 read in the namelist in dom_nam 
    231241               adatrj = ( REAL( nittrc000-1, wp ) * rdttra(1) ) / rday 
     
    238248              WRITE(numout,*) '   number of elapsed days since the begining of run : ', adatrj 
    239249              WRITE(numout,*) 
     250            ENDIF 
     251            ! 
     252            IF( ln_rsttr )  THEN   ;    neuler = 1 
     253            ELSE                   ;    neuler = 0 
    240254            ENDIF 
    241255            ! 
     
    268282      INTEGER  :: jk, jn 
    269283      REAL(wp) :: ztraf, zmin, zmax, zmean, zdrift 
     284      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zvol 
    270285      !!---------------------------------------------------------------------- 
    271286 
     
    276291      ENDIF 
    277292      ! 
    278       DO jn = 1, jptra 
    279          ztraf = glob_sum( trn(:,:,:,jn) * cvol(:,:,:) ) 
     293      DO jk = 1, jpk 
     294         zvol(:,:,jk) = e1e2t(:,:) * fse3t_a(:,:,jk) * tmask(:,:,jk) 
     295      END DO 
     296      ! 
     297      DO jn = 1, jptra 
     298         ztraf = glob_sum( trn(:,:,:,jn) * zvol(:,:,:) ) 
    280299         zmin  = MINVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) 
    281300         zmax  = MAXVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) 
     
    309328   !!---------------------------------------------------------------------- 
    310329   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    311    !! $Id$  
     330   !! $Id$ 
    312331   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    313332   !!====================================================================== 
Note: See TracChangeset for help on using the changeset viewer.