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 4780 for branches/2014/dev_r4650_UKMO11_restart_functionality/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90 – NEMO

Ignore:
Timestamp:
2014-09-19T18:45:49+02:00 (10 years ago)
Author:
edblockley
Message:

Second commit in UKMO11 development branch.

This change allows the user to replace the nn_stock frequency-based restart dump writing functionality with a list-based version (nn_stocklist).
This is conterolled using the logical ln_rst_list which defaults to false.
At present the list is hard-wired to have maximum 10 entries but this could be modified if required.

Ed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2014/dev_r4650_UKMO11_restart_functionality/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90

    r4775 r4780  
    6363      IF( kt == nit000 ) THEN   ! default definitions 
    6464         lrst_oce = .FALSE.    
    65          nitrst = nitend 
    66       ENDIF 
    67       IF( MOD( kt - 1, nstock ) == 0 ) THEN    
     65         IF( ln_rst_list ) THEN 
     66            nrst_lst = 1 
     67            nitrst = nstocklist( nrst_lst ) 
     68         ELSE 
     69            nitrst = nitend 
     70         ENDIF 
     71      ENDIF 
     72 
     73      ! frequency-based restart dumping (nn_stock) 
     74      IF( .NOT. ln_rst_list .AND. MOD( kt - 1, nstock ) == 0 ) THEN    
    6875         ! we use kt - 1 and not kt - nit000 to keep the same periodicity from the beginning of the experiment 
    6976         nitrst = kt + nstock - 1                  ! define the next value of nitrst for restart writing 
     
    7481      ! except if we write ocean restart files every time step or if an ocean restart file was writen at nitend - 1 
    7582      IF( kt == nitrst - 1 .OR. nstock == 1 .OR. ( kt == nitend .AND. .NOT. lrst_oce ) ) THEN 
    76          ! beware of the format used to write kt (default is i8.8, that should be large enough...) 
    77          IF( nitrst > 999999999 ) THEN   ;   WRITE(clkt, *       ) nitrst 
    78          ELSE                            ;   WRITE(clkt, '(i8.8)') nitrst 
    79          ENDIF 
    80          ! create the file 
    81          clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_ocerst_out) 
    82          clpath = TRIM(cn_ocerst_outdir) 
    83          IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 
    84          IF(lwp) THEN 
    85             WRITE(numout,*) 
    86             SELECT CASE ( jprstlib ) 
    87             CASE ( jprstdimg )   ;   WRITE(numout,*)                            & 
    88                 '             open ocean restart binary file: ',TRIM(clpath)//clname 
    89             CASE DEFAULT         ;   WRITE(numout,*)                            & 
    90                 '             open ocean restart NetCDF file: ',TRIM(clpath)//clname 
    91             END SELECT 
    92             IF ( snc4set%luse )      WRITE(numout,*) '             opened for NetCDF4 chunking and compression' 
    93             IF( kt == nitrst - 1 ) THEN   ;   WRITE(numout,*) '             kt = nitrst - 1 = ', kt 
    94             ELSE                          ;   WRITE(numout,*) '             kt = '             , kt 
     83         IF( nitrst <= nitend .AND. nitrst > 0 ) THEN  
     84            ! beware of the format used to write kt (default is i8.8, that should be large enough...) 
     85            IF( nitrst > 999999999 ) THEN   ;   WRITE(clkt, *       ) nitrst 
     86            ELSE                            ;   WRITE(clkt, '(i8.8)') nitrst 
    9587            ENDIF 
    96          ENDIF 
    97          ! 
    98          CALL iom_open( TRIM(clpath)//TRIM(clname), numrow, ldwrt = .TRUE., kiolib = jprstlib ) 
    99          lrst_oce = .TRUE. 
     88            ! create the file 
     89            clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_ocerst_out) 
     90            clpath = TRIM(cn_ocerst_outdir) 
     91            IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 
     92            IF(lwp) THEN 
     93               WRITE(numout,*) 
     94               SELECT CASE ( jprstlib ) 
     95               CASE ( jprstdimg )   ;   WRITE(numout,*)                            & 
     96                   '             open ocean restart binary file: ',TRIM(clpath)//clname 
     97               CASE DEFAULT         ;   WRITE(numout,*)                            & 
     98                   '             open ocean restart NetCDF file: ',TRIM(clpath)//clname 
     99               END SELECT 
     100               IF ( snc4set%luse )      WRITE(numout,*) '             opened for NetCDF4 chunking and compression' 
     101               IF( kt == nitrst - 1 ) THEN   ;   WRITE(numout,*) '             kt = nitrst - 1 = ', kt 
     102               ELSE                          ;   WRITE(numout,*) '             kt = '             , kt 
     103               ENDIF 
     104            ENDIF 
     105            ! 
     106            CALL iom_open( TRIM(clpath)//TRIM(clname), numrow, ldwrt = .TRUE., kiolib = jprstlib ) 
     107            lrst_oce = .TRUE. 
     108         ENDIF 
    100109      ENDIF 
    101110      ! 
     
    144153      IF( kt == nitrst ) THEN 
    145154         CALL iom_close( numrow )     ! close the restart file (only at last time step) 
    146          IF( .NOT. lk_trdmld )   lrst_oce = .FALSE. 
     155         IF( .NOT. lk_trdmld ) THEN 
     156            IF( ln_rst_list ) THEN 
     157               nrst_lst = nrst_lst + 1 
     158               nitrst = nstocklist( nrst_lst ) 
     159            ENDIF 
     160            lrst_oce = .FALSE. 
     161         ENDIF 
    147162      ENDIF 
    148163      ! 
Note: See TracChangeset for help on using the changeset viewer.