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 12477 for NEMO/branches/UKMO/r12083_restart_datestamp/src/TOP – NEMO

Ignore:
Timestamp:
2020-02-27T13:20:58+01:00 (4 years ago)
Author:
jcastill
Message:

Changes as in the original branch, plus changes for bgc restart (in branch AMM15_v3_6_STABLE_package_collate)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/UKMO/r12083_restart_datestamp/src/TOP/trcrst.F90

    r11715 r12477  
    2020   !!---------------------------------------------------------------------- 
    2121   USE oce_trc 
     22   USE dom_oce, ONLY: fjulday  
     23   USE phycst, ONLY: rday  
     24   USE in_out_manager, ONLY: ln_rstdate 
    2225   USE trc 
    2326   USE iom 
     27   USE ioipsl, ONLY: ju2ymds 
    2428   USE daymod 
    2529   USE lib_mpp 
     
    4751      !!---------------------------------------------------------------------- 
    4852      INTEGER, INTENT(in) ::   kt       ! number of iteration 
     53      INTEGER             ::   iyear, imonth, iday  
     54      REAL (wp)           ::   zsec  
     55      REAL (wp)           ::   zfjulday 
    4956      ! 
    5057      CHARACTER(LEN=20)   ::   clkt     ! ocean time-step define as a character 
     
    7885      ! we open and define the tracer restart file one tracer time step before writing the data (-> at nitrst - 2*nn_dttrc + 1) 
    7986      ! except if we write tracer restart files every tracer time step or if a tracer restart file was writen at nitend - 2*nn_dttrc + 1 
    80       IF( kt == nitrst - 2*nn_dttrc .OR. nn_stock == nn_dttrc .OR. ( kt == nitend - nn_dttrc .AND. .NOT. lrst_trc ) ) THEN 
    81          ! beware of the format used to write kt (default is i8.8, that should be large enough) 
    82          IF( nitrst > 1.0e9 ) THEN   ;   WRITE(clkt,*       ) nitrst 
    83          ELSE                        ;   WRITE(clkt,'(i8.8)') nitrst 
     87      IF( kt == nitrst - 2*nn_dttrc + 1 .OR. nstock == nn_dttrc .OR. ( kt == nitend - nn_dttrc .AND. .NOT. lrst_trc ) ) THEN  
     88         if ( ln_rstdate ) THEN  
     89            zfjulday = fjulday + rdttrc(1) / rday  
     90            IF( ABS(zfjulday - REAL(NINT(zfjulday),wp)) < 0.1 / rday )   zfjulday = REAL(NINT(zfjulday),wp)   ! avoid truncation error  
     91            CALL ju2ymds( zfjulday, iyear, imonth, iday, zsec )  
     92            WRITE(clkt, '(i4.4,2i2.2)') iyear, imonth, iday  
     93         ELSE  
     94            ! beware of the format used to write kt (default is i8.8, that should be large enough)  
     95            IF( nitrst > 1.0e9 ) THEN   ;   WRITE(clkt,*       ) nitrst  
     96            ELSE                        ;   WRITE(clkt,'(i8.8)') nitrst  
     97            ENDIF 
    8498         ENDIF 
    8599         ! create the file 
Note: See TracChangeset for help on using the changeset viewer.