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 5621 for branches/2015/dev_r5151_UKMO_ISF/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90 – NEMO

Ignore:
Timestamp:
2015-07-21T13:25:36+02:00 (9 years ago)
Author:
mathiot
Message:

UKMO_ISF: upgrade to NEMO_3.6_STABLE (r5554)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2015/dev_r5151_UKMO_ISF/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90

    r4990 r5621  
    2424   USE trdmxl_oce      ! ocean active mixed layer tracers trends variables 
    2525   USE divcur          ! hor. divergence and curl      (div & cur routines) 
    26    USE sbc_ice, ONLY : lk_lim3 
    2726 
    2827   IMPLICIT NONE 
     
    5756      !! 
    5857      CHARACTER(LEN=20)   ::   clkt     ! ocean time-step deine as a character 
    59       CHARACTER(LEN=50)   ::   clname   ! ice output restart file name 
     58      CHARACTER(LEN=50)   ::   clname   ! ocean output restart file name 
     59      CHARACTER(lc)       ::   clpath   ! full path to ocean output restart file 
    6060      !!---------------------------------------------------------------------- 
    6161      ! 
    6262      IF( kt == nit000 ) THEN   ! default definitions 
    6363         lrst_oce = .FALSE.    
    64          nitrst = nitend 
    65       ENDIF 
    66       IF( MOD( kt - 1, nstock ) == 0 ) THEN    
     64         IF( ln_rst_list ) THEN 
     65            nrst_lst = 1 
     66            nitrst = nstocklist( nrst_lst ) 
     67         ELSE 
     68            nitrst = nitend 
     69         ENDIF 
     70      ENDIF 
     71 
     72      ! frequency-based restart dumping (nn_stock) 
     73      IF( .NOT. ln_rst_list .AND. MOD( kt - 1, nstock ) == 0 ) THEN    
    6774         ! we use kt - 1 and not kt - nit000 to keep the same periodicity from the beginning of the experiment 
    6875         nitrst = kt + nstock - 1                  ! define the next value of nitrst for restart writing 
     
    7380      ! except if we write ocean restart files every time step or if an ocean restart file was writen at nitend - 1 
    7481      IF( kt == nitrst - 1 .OR. nstock == 1 .OR. ( kt == nitend .AND. .NOT. lrst_oce ) ) THEN 
    75          ! beware of the format used to write kt (default is i8.8, that should be large enough...) 
    76          IF( nitrst > 999999999 ) THEN   ;   WRITE(clkt, *       ) nitrst 
    77          ELSE                            ;   WRITE(clkt, '(i8.8)') nitrst 
    78          ENDIF 
    79          ! create the file 
    80          clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_ocerst_out) 
    81          IF(lwp) THEN 
    82             WRITE(numout,*) 
    83             SELECT CASE ( jprstlib ) 
    84             CASE ( jprstdimg )   ;   WRITE(numout,*) '             open ocean restart binary file: '//clname 
    85             CASE DEFAULT         ;   WRITE(numout,*) '             open ocean restart NetCDF file: '//clname 
    86             END SELECT 
    87             IF ( snc4set%luse )      WRITE(numout,*) '             opened for NetCDF4 chunking and compression' 
    88             IF( kt == nitrst - 1 ) THEN   ;   WRITE(numout,*) '             kt = nitrst - 1 = ', kt 
    89             ELSE                          ;   WRITE(numout,*) '             kt = '             , kt 
     82         IF( nitrst <= nitend .AND. nitrst > 0 ) THEN  
     83            ! beware of the format used to write kt (default is i8.8, that should be large enough...) 
     84            IF( nitrst > 999999999 ) THEN   ;   WRITE(clkt, *       ) nitrst 
     85            ELSE                            ;   WRITE(clkt, '(i8.8)') nitrst 
    9086            ENDIF 
    91          ENDIF 
    92          ! 
    93          CALL iom_open( clname, numrow, ldwrt = .TRUE., kiolib = jprstlib ) 
    94          lrst_oce = .TRUE. 
     87            ! create the file 
     88            clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_ocerst_out) 
     89            clpath = TRIM(cn_ocerst_outdir) 
     90            IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 
     91            IF(lwp) THEN 
     92               WRITE(numout,*) 
     93               SELECT CASE ( jprstlib ) 
     94               CASE ( jprstdimg )   ;   WRITE(numout,*)                            & 
     95                   '             open ocean restart binary file: ',TRIM(clpath)//clname 
     96               CASE DEFAULT         ;   WRITE(numout,*)                            & 
     97                   '             open ocean restart NetCDF file: ',TRIM(clpath)//clname 
     98               END SELECT 
     99               IF ( snc4set%luse )      WRITE(numout,*) '             opened for NetCDF4 chunking and compression' 
     100               IF( kt == nitrst - 1 ) THEN   ;   WRITE(numout,*) '             kt = nitrst - 1 = ', kt 
     101               ELSE                          ;   WRITE(numout,*) '             kt = '             , kt 
     102               ENDIF 
     103            ENDIF 
     104            ! 
     105            CALL iom_open( TRIM(clpath)//TRIM(clname), numrow, ldwrt = .TRUE., kiolib = jprstlib ) 
     106            lrst_oce = .TRUE. 
     107         ENDIF 
    95108      ENDIF 
    96109      ! 
     
    120133                     CALL iom_rstput( kt, nitrst, numrow, 'hdivb'  , hdivb     ) 
    121134                     CALL iom_rstput( kt, nitrst, numrow, 'sshb'   , sshb      ) 
    122                      ! 
    123       IF( lk_lim3 )  CALL iom_rstput( kt, nitrst, numrow, 'fse3t_b', fse3t_b(:,:,:) ) 
    124135                     ! 
    125136                     CALL iom_rstput( kt, nitrst, numrow, 'un'     , un        )     ! now fields 
     
    134145                     CALL iom_rstput( kt, nitrst, numrow, 'rhd'    , rhd       ) 
    135146#endif 
    136                   IF( lk_lim3 ) THEN 
    137                      CALL iom_rstput( kt, nitrst, numrow, 'fraqsr_1lev'  , fraqsr_1lev     ) !clem modif 
    138                   ENDIF 
    139147      IF( kt == nitrst ) THEN 
    140148         CALL iom_close( numrow )     ! close the restart file (only at last time step) 
     
    142150!!gm  not sure what to do here   ===>>>  ask to Sebastian 
    143151         lrst_oce = .FALSE. 
     152            IF( ln_rst_list ) THEN 
     153               nrst_lst = MIN(nrst_lst + 1, SIZE(nstocklist,1)) 
     154               nitrst = nstocklist( nrst_lst ) 
     155            ENDIF 
     156            lrst_oce = .FALSE. 
    144157      ENDIF 
    145158      ! 
     
    156169      !!                the file has already been opened 
    157170      !!---------------------------------------------------------------------- 
    158       INTEGER  ::   jlibalt = jprstlib 
    159       LOGICAL  ::   llok 
     171      INTEGER        ::   jlibalt = jprstlib 
     172      LOGICAL        ::   llok 
     173      CHARACTER(lc)  ::   clpath   ! full path to ocean output restart file 
    160174      !!---------------------------------------------------------------------- 
    161175      ! 
     
    171185         ENDIF 
    172186 
     187         clpath = TRIM(cn_ocerst_indir) 
     188         IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 
    173189         IF ( jprstlib == jprstdimg ) THEN 
    174190           ! eventually read netcdf file (monobloc)  for restarting on different number of processors 
    175191           ! if {cn_ocerst_in}.nc exists, then set jlibalt to jpnf90 
    176            INQUIRE( FILE = TRIM(cn_ocerst_in)//'.nc', EXIST = llok ) 
     192           INQUIRE( FILE = TRIM(cn_ocerst_indir)//'/'//TRIM(cn_ocerst_in)//'.nc', EXIST = llok ) 
    177193           IF ( llok ) THEN ; jlibalt = jpnf90  ; ELSE ; jlibalt = jprstlib ; ENDIF 
    178194         ENDIF 
    179          CALL iom_open( cn_ocerst_in, numror, kiolib = jlibalt ) 
     195         CALL iom_open( TRIM(clpath)//cn_ocerst_in, numror, kiolib = jlibalt ) 
    180196      ENDIF 
    181197   END SUBROUTINE rst_read_open 
     
    214230         CALL iom_get( numror, jpdom_autoglo, 'hdivb'  , hdivb   ) 
    215231         CALL iom_get( numror, jpdom_autoglo, 'sshb'   , sshb    ) 
    216          IF( lk_lim3 )   CALL iom_get( numror, jpdom_autoglo, 'fse3t_b', fse3t_b(:,:,:) ) 
    217232      ELSE 
    218233         neuler = 0 
     
    257272         ENDIF 
    258273 
    259          IF( lk_lim3 .AND. .NOT. lk_vvl ) THEN 
    260             DO jk = 1, jpk 
    261                fse3t_b(:,:,jk) = fse3t_n(:,:,jk) 
    262             END DO 
    263          ENDIF 
    264  
    265       ENDIF 
    266       ! 
    267       IF( lk_lim3 ) THEN 
    268          CALL iom_get( numror, jpdom_autoglo, 'fraqsr_1lev' , fraqsr_1lev ) 
    269274      ENDIF 
    270275      ! 
Note: See TracChangeset for help on using the changeset viewer.