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

Changeset 6939


Ignore:
Timestamp:
2016-09-19T16:36:50+02:00 (8 years ago)
Author:
deazer
Message:

Updated to include bug bix restart date label with respect to truncation error.

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

Legend:

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

    r6332 r6939  
    2121   USE dom_oce        ! NEMO domain 
    2222   USE in_out_manager ! NEMO IO routines 
     23   USE ioipsl, ONLY : ju2ymds    ! for calendar 
    2324   USE lib_mpp        ! NEMO MPI library, lk_mpp in particular 
    24    USE ioipsl, ONLY : ju2ymds    ! for calendar  
    2525   USE netcdf         ! netcdf routines for IO 
    2626   USE icb_oce        ! define iceberg arrays 
     
    6666                                                                                            ! start and count arrays 
    6767      LOGICAL                      ::   ll_found_restart 
    68       CHARACTER(len=256)  :: cl_path  
    69       CHARACTER(len=256)  :: cl_filename  
     68      CHARACTER(len=256)           ::   cl_path 
     69      CHARACTER(len=256)           ::   cl_filename 
    7070      CHARACTER(len=NF90_MAX_NAME) ::   cl_dname 
    7171      TYPE(iceberg)                ::   localberg ! NOT a pointer but an actual local variable 
     
    233233      INTEGER ::   jn   ! dummy loop index 
    234234      INTEGER ::   ix_dim, iy_dim, ik_dim, in_dim 
    235       CHARACTER(len=256)     :: cl_path 
    236       CHARACTER(len=256)     :: cl_filename 
    237       INTEGER             ::   iyear, imonth, iday  
    238       REAL (wp)           ::   zsec  
    239       CHARACTER(len=256)  :: cl_path  
    240       CHARACTER(len=256)  :: cl_filename  
     235      INTEGER             ::   iyear, imonth, iday 
     236      REAL (wp)           ::   zsec 
     237      REAL (wp)           ::   zfjulday 
     238      CHARACTER(len=256)  :: cl_path 
     239      CHARACTER(len=256)  :: cl_filename 
    241240      CHARACTER(LEN=20)   ::   clkt     ! ocean time-step deine as a character 
    242241      TYPE(iceberg), POINTER :: this 
     
    247246      cl_path = TRIM(cn_ocerst_outdir) 
    248247      IF( cl_path(LEN_TRIM(cl_path):) /= '/' ) cl_path = TRIM(cl_path) // '/' 
    249       IF ( ln_rstdate ) THEN  
    250          CALL ju2ymds( fjulday + rdttra(1) / rday, iyear, imonth, iday, zsec )             
    251          WRITE(clkt, '(i4.4,2i2.2)') iyear, imonth, iday  
    252       ELSE  
    253          IF( kt > 999999999 ) THEN   ;   WRITE(clkt, *       ) kt  
    254          ELSE                        ;   WRITE(clkt, '(i8.8)') kt  
    255          ENDIF  
    256       ENDIF  
     248      IF ( ln_rstdate ) THEN 
     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 )            
     252         WRITE(clkt, '(i4.4,2i2.2)') iyear, imonth, iday 
     253      ELSE 
     254         IF( kt > 999999999 ) THEN   ;   WRITE(clkt, *       ) kt 
     255         ELSE                        ;   WRITE(clkt, '(i8.8)') kt 
     256         ENDIF 
     257      ENDIF 
    257258      IF( lk_mpp ) THEN 
    258          WRITE(cl_filename,'(A,"_icebergs_",A,"_restart_",I4.4,".nc")') TRIM(cexper), TRIM(ADJUSTL(clkt)), narea-1  
     259         WRITE(cl_filename,'(A,"_icebergs_",A,"_restart_",I4.4,".nc")') TRIM(cexper), TRIM(ADJUSTL(clkt)), narea-1 
    259260      ELSE 
    260          WRITE(cl_filename,'(A,"_icebergs_",A,"_restart.nc")') TRIM(cexper), TRIM(ADJUSTL(clkt))  
     261         WRITE(cl_filename,'(A,"_icebergs_",A,"_restart.nc")') TRIM(cexper), TRIM(ADJUSTL(clkt)) 
    261262      ENDIF 
    262263      IF (nn_verbose_level >= 0) WRITE(numout,'(2a)') 'icebergs, write_restart: creating ',TRIM(cl_path)//TRIM(cl_filename) 
  • branches/UKMO/CO6_KD490/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90

    r6332 r6939  
    5555      !!---------------------------------------------------------------------- 
    5656      INTEGER, INTENT(in) ::   kt     ! ocean time-step 
    57       INTEGER             ::   iyear, imonth, iday  
    58       REAL (wp)           ::   zsec  
     57      INTEGER             ::   iyear, imonth, iday 
     58      REAL (wp)           ::   zsec 
     59      REAL (wp)           ::   zfjulday 
    5960      !! 
    6061      CHARACTER(LEN=20)   ::   clkt     ! ocean time-step deine as a character 
     
    8485      IF( kt == nitrst - 1 .OR. nstock == 1 .OR. ( kt == nitend .AND. .NOT. lrst_oce ) ) THEN 
    8586         IF( nitrst <= nitend .AND. nitrst > 0 ) THEN  
    86             IF ( ln_rstdate ) THEN  
    87               CALL ju2ymds( fjulday + rdttra(1) / rday, iyear, imonth, iday, zsec )             
    88               WRITE(clkt, '(i4.4,2i2.2)') iyear, imonth, iday  
    89             ELSE  
    90               ! beware of the format used to write kt (default is i8.8, that should be large enough...)  
    91               IF( nitrst > 999999999 ) THEN   ;   WRITE(clkt, *       ) nitrst  
    92               ELSE                            ;   WRITE(clkt, '(i8.8)') nitrst  
    93               ENDIF  
     87            IF ( ln_rstdate ) THEN 
     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 )            
     91               WRITE(clkt, '(i4.4,2i2.2)') iyear, imonth, iday 
     92            ELSE 
     93               ! beware of the format used to write kt (default is i8.8, that should be large enough...) 
     94               IF( nitrst > 999999999 ) THEN   ;   WRITE(clkt, *       ) nitrst 
     95               ELSE                            ;   WRITE(clkt, '(i8.8)') nitrst 
     96               ENDIF 
    9497            ENDIF 
    9598            ! create the file 
Note: See TracChangeset for help on using the changeset viewer.