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 6336 – NEMO

Changeset 6336


Ignore:
Timestamp:
2016-02-19T14:53:05+01:00 (9 years ago)
Author:
mathiot
Message:

correction of truncation error for rst date stamp

Location:
branches/UKMO/restart_datestamp/NEMOGCM/NEMO/OPA_SRC
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/restart_datestamp/NEMOGCM/NEMO/OPA_SRC/ICB/icbrst.F90

    r5538 r6336  
    235235      INTEGER             ::   iyear, imonth, iday 
    236236      REAL (wp)           ::   zsec 
     237      REAL (wp)           ::   zfjulday 
    237238      CHARACTER(len=256)  :: cl_path 
    238239      CHARACTER(len=256)  :: cl_filename 
     
    246247      IF( cl_path(LEN_TRIM(cl_path):) /= '/' ) cl_path = TRIM(cl_path) // '/' 
    247248      IF ( ln_rstdate ) THEN 
    248          CALL ju2ymds( fjulday + rdttra(1) / rday, iyear, imonth, iday, zsec )            
     249         zfjulday = fjulday + rdttra(1) / rday 
     250         IF( ABS(zfjulday - REAL(NINT(zfjulday),wp)) < 0.1 / rday )   zfjulday = REAL(NINT(zfjulday),wp)   ! avoid truncation error 
     251         CALL ju2ymds( zfjulday, iyear, imonth, iday, zsec )            
    249252         WRITE(clkt, '(i4.4,2i2.2)') iyear, imonth, iday 
    250253      ELSE 
  • branches/UKMO/restart_datestamp/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90

    r6305 r6336  
    5757      INTEGER             ::   iyear, imonth, iday 
    5858      REAL (wp)           ::   zsec 
     59      REAL (wp)           ::   zfjulday 
    5960      !! 
    6061      CHARACTER(LEN=20)   ::   clkt     ! ocean time-step deine as a character 
     
    8586         IF( nitrst <= nitend .AND. nitrst > 0 ) THEN  
    8687            IF ( ln_rstdate ) THEN 
    87                CALL ju2ymds( fjulday + ((kt-nit000)*rdttra(1)) / rday, iyear, imonth, iday, zsec )            
     88               zfjulday = fjulday + rdttra(1) / rday 
     89               IF( ABS(zfjulday - REAL(NINT(zfjulday),wp)) < 0.1 / rday )   zfjulday = REAL(NINT(zfjulday),wp)   ! avoid truncation error 
     90               CALL ju2ymds( zfjulday, iyear, imonth, iday, zsec )            
    8891               WRITE(clkt, '(i4.4,2i2.2)') iyear, imonth, iday 
    8992            ELSE 
Note: See TracChangeset for help on using the changeset viewer.