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

Changeset 15596


Ignore:
Timestamp:
2021-12-13T17:28:47+01:00 (2 years ago)
Author:
acc
Message:

Changes to restart.F90 and trcrst.F90 to address #2735 and cope with requests in nn_stocklist outside the simulation period. These changes also enable a restart file to be generated on nit000, if requested, and will force a restart at nitend even if it is not explicitly listed in nn_stocklist. This closes #2735

Location:
NEMO/releases/r4.0/r4.0-HEAD/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/releases/r4.0/r4.0-HEAD/src/OCE/IOM/restart.F90

    r11536 r15596  
    6969         lrst_oce = .FALSE.    
    7070         IF( ln_rst_list ) THEN 
    71             nrst_lst = 1 
    72             nitrst = nn_stocklist( nrst_lst ) 
     71            ! Protect against user requests outside of simulation period (#2735) 
     72            nitrst   = MIN( nitend, MINVAL( nn_stocklist, MASK=nn_stocklist.ge.nit000) )   
     73            nrst_lst = MAX( 1, FINDLOC( nn_stocklist, nitrst, DIM=1 ) ) 
    7374         ELSE 
    7475            nitrst = nitend 
     
    8788      ! we open and define the ocean restart file one time step before writing the data (-> at nitrst - 1) 
    8889      ! except if we write ocean restart files every time step or if an ocean restart file was writen at nitend - 1 
    89       IF( kt == nitrst - 1 .OR. nn_stock == 1 .OR. ( kt == nitend .AND. .NOT. lrst_oce ) ) THEN 
     90      ! or if nit000 is requested in the nn_stocklist 
     91      IF( kt == nitrst - 1 .OR. nn_stock == 1 .OR. ( kt == nitend .AND. .NOT. lrst_oce ) & 
     92      &                                       .OR. ( kt == nit000 .AND. nitrst == nit000 ) ) THEN 
    9093         IF( nitrst <= nitend .AND. nitrst > 0 ) THEN  
    9194            ! beware of the format used to write kt (default is i8.8, that should be large enough...) 
     
    188191               nrst_lst = MIN(nrst_lst + 1, SIZE(nn_stocklist,1)) 
    189192               nitrst = nn_stocklist( nrst_lst ) 
     193               IF( nitrst == 0 ) nitrst = nitend    ! Force a restart at the end of the run 
    190194            ENDIF 
    191195      ENDIF 
  • NEMO/releases/r4.0/r4.0-HEAD/src/TOP/trcrst.F90

    r11536 r15596  
    5757            lrst_trc = .FALSE. 
    5858            IF( ln_rst_list ) THEN 
    59                nrst_lst = 1 
    60                nitrst = nn_stocklist( nrst_lst ) 
     59               ! Protect against user requests outside of simulation period (#2735) 
     60               nitrst   = MIN( nitend, MINVAL( nn_stocklist, MASK=nn_stocklist.ge.nit000) ) 
     61               nrst_lst = MAX( 1, FINDLOC( nn_stocklist, nitrst, DIM=1 ) ) 
    6162            ELSE 
    6263               nitrst = nitend 
     
    7879      ! we open and define the tracer restart file one tracer time step before writing the data (-> at nitrst - 2*nn_dttrc + 1) 
    7980      ! 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      ! or if nit000 is requested in the nn_stocklist 
     82      IF( kt == nitrst - 2*nn_dttrc .OR. nn_stock == nn_dttrc .OR. ( kt == nitend - nn_dttrc .AND. .NOT. lrst_trc ) & 
     83      &                                                       .OR. ( kt == nit000 .AND. nitrst == nit000 ) ) THEN 
    8184         ! beware of the format used to write kt (default is i8.8, that should be large enough) 
    8285         IF( nitrst > 1.0e9 ) THEN   ;   WRITE(clkt,*       ) nitrst 
Note: See TracChangeset for help on using the changeset viewer.