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

Ignore:
Timestamp:
2015-07-10T13:28:53+02:00 (9 years ago)
Author:
timgraham
Message:

Merged head of trunk into branch

File:
1 edited

Legend:

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

    r4152 r5581  
    5151      CHARACTER(LEN=20)   ::   clkt     ! ocean time-step define as a character 
    5252      CHARACTER(LEN=50)   ::   clname   ! trc output restart file name 
     53      CHARACTER(LEN=256)  ::   clpath   ! full path to ocean output restart file 
    5354      !!---------------------------------------------------------------------- 
    5455      ! 
     
    5657         IF( kt == nittrc000 ) THEN 
    5758            lrst_trc = .FALSE. 
    58             nitrst = nitend 
    59          ENDIF 
    60  
    61          IF( MOD( kt - 1, nstock ) == 0 ) THEN 
     59            IF( ln_rst_list ) THEN 
     60               nrst_lst = 1 
     61               nitrst = nstocklist( nrst_lst ) 
     62            ELSE 
     63               nitrst = nitend 
     64            ENDIF 
     65         ENDIF 
     66 
     67         IF( .NOT. ln_rst_list .AND. MOD( kt - 1, nstock ) == 0 ) THEN 
    6268            ! we use kt - 1 and not kt - nittrc000 to keep the same periodicity from the beginning of the experiment 
    6369            nitrst = kt + nstock - 1                  ! define the next value of nitrst for restart writing 
     
    7985         IF(lwp) WRITE(numout,*) 
    8086         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 ) 
     87         clpath = TRIM(cn_trcrst_outdir) 
     88         IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 
     89         IF(lwp) WRITE(numout,*) & 
     90             '             open trc restart.output NetCDF file: ',TRIM(clpath)//clname 
     91         CALL iom_open( TRIM(clpath)//TRIM(clname), numrtw, ldwrt = .TRUE., kiolib = jprstlib ) 
    8392         lrst_trc = .TRUE. 
    8493      ENDIF 
     
    137146          CALL trc_rst_stat            ! statistics 
    138147          CALL iom_close( numrtw )     ! close the restart file (only at last time step) 
    139 #if ! defined key_trdmld_trc 
     148#if ! defined key_trdmxl_trc 
    140149          lrst_trc = .FALSE. 
    141150#endif 
     151          IF( lk_offline .AND. ln_rst_list ) THEN 
     152             nrst_lst = nrst_lst + 1 
     153             nitrst = nstocklist( nrst_lst ) 
     154          ENDIF 
    142155      ENDIF 
    143156      ! 
     
    190203           ! eventually read netcdf file (monobloc)  for restarting on different number of processors 
    191204           ! if {cn_trcrst_in}.nc exists, then set jlibalt to jpnf90  
    192            INQUIRE( FILE = TRIM(cn_trcrst_in)//'.nc', EXIST = llok ) 
     205           INQUIRE( FILE = TRIM(cn_trcrst_indir)//'/'//TRIM(cn_trcrst_in)//'.nc', EXIST = llok ) 
    193206           IF ( llok ) THEN ; jlibalt = jpnf90  ; ELSE ; jlibalt = jprstlib ; ENDIF 
    194207         ENDIF 
    195208 
    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 
     209         IF( ln_rsttr ) THEN 
     210            CALL iom_open( TRIM(cn_trcrst_indir)//'/'//cn_trcrst_in, numrtr, kiolib = jlibalt ) 
     211            CALL iom_get ( numrtr, 'kt', zkt )   ! last time-step of previous run 
     212 
     213            IF(lwp) THEN 
     214               WRITE(numout,*) ' *** Info read in restart : ' 
     215               WRITE(numout,*) '   previous time-step                               : ', NINT( zkt ) 
     216               WRITE(numout,*) ' *** restart option' 
     217               SELECT CASE ( nn_rsttr ) 
     218               CASE ( 0 )   ;   WRITE(numout,*) ' nn_rsttr = 0 : no control of nittrc000' 
     219               CASE ( 1 )   ;   WRITE(numout,*) ' nn_rsttr = 1 : no control the date at nittrc000 (use ndate0 read in the namelist)' 
     220               CASE ( 2 )   ;   WRITE(numout,*) ' nn_rsttr = 2 : calendar parameters read in restart' 
     221               END SELECT 
     222               WRITE(numout,*) 
     223            ENDIF 
     224            ! Control of date  
     225            IF( nittrc000  - NINT( zkt ) /= nn_dttrc .AND.  nn_rsttr /= 0 )                                  & 
     226               &   CALL ctl_stop( ' ===>>>> : problem with nittrc000 for the restart',                 & 
     227               &                  ' verify the restart file or rerun with nn_rsttr = 0 (namelist)' ) 
     228         ENDIF 
     229         ! 
     230         IF( lk_offline ) THEN     
     231            !                                          ! set the date in offline mode 
     232            IF( ln_rsttr .AND. nn_rsttr == 2 ) THEN 
    223233               CALL iom_get( numrtr, 'ndastp', zndastp )  
    224234               ndastp = NINT( zndastp ) 
    225235               CALL iom_get( numrtr, 'adatrj', adatrj  ) 
    226             ELSE 
     236             ELSE 
    227237               ndastp = ndate0 - 1     ! ndate0 read in the namelist in dom_nam 
    228238               adatrj = ( REAL( nittrc000-1, wp ) * rdttra(1) ) / rday 
     
    235245              WRITE(numout,*) '   number of elapsed days since the begining of run : ', adatrj 
    236246              WRITE(numout,*) 
     247            ENDIF 
     248            ! 
     249            IF( ln_rsttr )  THEN   ;    neuler = 1 
     250            ELSE                   ;    neuler = 0 
    237251            ENDIF 
    238252            ! 
     
    265279      INTEGER  :: jk, jn 
    266280      REAL(wp) :: ztraf, zmin, zmax, zmean, zdrift 
     281      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zvol 
    267282      !!---------------------------------------------------------------------- 
    268283 
     
    273288      ENDIF 
    274289      ! 
    275       DO jn = 1, jptra 
    276          ztraf = glob_sum( trn(:,:,:,jn) * cvol(:,:,:) ) 
     290      DO jk = 1, jpk 
     291         zvol(:,:,jk) = e1e2t(:,:) * fse3t_a(:,:,jk) * tmask(:,:,jk) 
     292      END DO 
     293      ! 
     294      DO jn = 1, jptra 
     295         ztraf = glob_sum( trn(:,:,:,jn) * zvol(:,:,:) ) 
    277296         zmin  = MINVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) 
    278297         zmax  = MAXVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) 
     
    306325   !!---------------------------------------------------------------------- 
    307326   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
    308    !! $Id$  
     327   !! $Id$ 
    309328   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    310329   !!====================================================================== 
Note: See TracChangeset for help on using the changeset viewer.