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 5341 for trunk/NEMOGCM/NEMO/OPA_SRC – NEMO

Ignore:
Timestamp:
2015-06-03T16:59:46+02:00 (9 years ago)
Author:
davestorkey
Message:

Merge of 2014/dev_r4650_UKMO11_restart_functionality branch into the trunk
as part of 3.6_stable build. See ticket #1347.

Location:
trunk/NEMOGCM/NEMO/OPA_SRC
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90

    r4990 r5341  
    135135      !!---------------------------------------------------------------------- 
    136136      USE ioipsl 
    137       NAMELIST/namrun/ nn_no   , cn_exp    , cn_ocerst_in, cn_ocerst_out, ln_rstart , nn_rstctl,   & 
     137      NAMELIST/namrun/ cn_ocerst_indir, cn_ocerst_outdir, nn_stocklist, ln_rst_list,               & 
     138         &             nn_no   , cn_exp    , cn_ocerst_in, cn_ocerst_out, ln_rstart , nn_rstctl,   & 
    138139         &             nn_it000, nn_itend  , nn_date0    , nn_leapy     , nn_istate , nn_stock ,   & 
    139140         &             nn_write, ln_dimgnnn, ln_mskland  , ln_clobber   , nn_chunksz, nn_euler 
     
    169170         WRITE(numout,*) '      experiment name for output      cn_exp     = ', cn_exp 
    170171         WRITE(numout,*) '      file prefix restart input       cn_ocerst_in= ', cn_ocerst_in 
     172         WRITE(numout,*) '      restart input directory         cn_ocerst_indir= ', cn_ocerst_indir 
    171173         WRITE(numout,*) '      file prefix restart output      cn_ocerst_out= ', cn_ocerst_out 
     174         WRITE(numout,*) '      restart output directory        cn_ocerst_outdir= ', cn_ocerst_outdir 
    172175         WRITE(numout,*) '      restart logical                 ln_rstart  = ', ln_rstart 
    173176         WRITE(numout,*) '      start with forward time step    nn_euler   = ', nn_euler 
     
    178181         WRITE(numout,*) '      leap year calendar (0/1)        nn_leapy   = ', nn_leapy 
    179182         WRITE(numout,*) '      initial state output            nn_istate  = ', nn_istate 
    180          WRITE(numout,*) '      frequency of restart file       nn_stock   = ', nn_stock 
     183         IF( ln_rst_list ) THEN 
     184            WRITE(numout,*) '      list of restart dump times      nn_stocklist   =', nn_stocklist 
     185         ELSE 
     186            WRITE(numout,*) '      frequency of restart file       nn_stock   = ', nn_stock 
     187         ENDIF 
    181188         WRITE(numout,*) '      frequency of output file        nn_write   = ', nn_write 
    182189         WRITE(numout,*) '      multi file dimgout              ln_dimgnnn = ', ln_dimgnnn 
     
    195202      ninist = nn_istate 
    196203      nstock = nn_stock 
     204      nstocklist = nn_stocklist 
    197205      nwrite = nn_write 
    198206      neuler = nn_euler 
    199       IF ( neuler == 1 .AND. .NOT.ln_rstart ) THEN 
     207      IF ( neuler == 1 .AND. .NOT. ln_rstart ) THEN 
    200208         WRITE(ctmp1,*) 'ln_rstart =.FALSE., nn_euler is forced to 0 ' 
    201209         CALL ctl_warn( ctmp1 ) 
  • trunk/NEMOGCM/NEMO/OPA_SRC/ICB/icbrst.F90

    r5215 r5341  
    6464                                                                                            ! start and count arrays 
    6565      LOGICAL                      ::   ll_found_restart 
     66      CHARACTER(len=256)           ::   cl_path 
    6667      CHARACTER(len=256)           ::   cl_filename 
    6768      CHARACTER(len=NF90_MAX_NAME) ::   cl_dname 
     
    7071      !!---------------------------------------------------------------------- 
    7172 
    72       ! Find a restart file 
     73      ! Find a restart file. Assume iceberg restarts in same directory as ocean restarts.  
     74      cl_path = TRIM(cn_ocerst_indir) 
     75      IF( cl_path(LEN_TRIM(cl_path):) /= '/' ) cl_path = TRIM(cl_path) // '/' 
    7376      cl_filename = ' ' 
    7477      IF ( lk_mpp ) THEN 
    7578         cl_filename = ' ' 
    7679         WRITE( cl_filename, '("restart_icebergs_",I4.4,".nc")' ) narea-1 
    77          INQUIRE( file=TRIM(cl_filename), exist=ll_found_restart ) 
     80         INQUIRE( file=TRIM(cl_path)//TRIM(cl_filename), exist=ll_found_restart ) 
    7881      ELSE 
    7982         cl_filename = 'restart_icebergs.nc' 
    80          INQUIRE( file=TRIM(cl_filename), exist=ll_found_restart ) 
     83         INQUIRE( file=TRIM(cl_path)//TRIM(cl_filename), exist=ll_found_restart ) 
    8184      ENDIF 
    8285 
     
    8689 
    8790      IF (nn_verbose_level >= 0 .AND. lwp)  & 
    88          WRITE(numout,'(2a)') 'icebergs, read_restart_bergs: found restart file = ',TRIM(cl_filename) 
    89  
    90       nret = NF90_OPEN(TRIM(cl_filename), NF90_NOWRITE, ncid) 
     91         WRITE(numout,'(2a)') 'icebergs, read_restart_bergs: found restart file = ',TRIM(cl_path)//TRIM(cl_filename) 
     92 
     93      nret = NF90_OPEN(TRIM(cl_path)//TRIM(cl_filename), NF90_NOWRITE, ncid) 
    9194      IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, read_restart_bergs: nf_open failed') 
    9295 
     
    228231      INTEGER ::   jn   ! dummy loop index 
    229232      INTEGER ::   ix_dim, iy_dim, ik_dim, in_dim 
     233      CHARACTER(len=256)     :: cl_path 
    230234      CHARACTER(len=256)     :: cl_filename 
    231235      TYPE(iceberg), POINTER :: this 
     
    233237      !!---------------------------------------------------------------------- 
    234238 
     239      ! Assume we write iceberg restarts to same directory as ocean restarts. 
     240      cl_path = TRIM(cn_ocerst_outdir) 
     241      IF( cl_path(LEN_TRIM(cl_path):) /= '/' ) cl_path = TRIM(cl_path) // '/' 
    235242      IF( lk_mpp ) THEN 
    236          WRITE(cl_filename,'("icebergs_",I8.8,"_restart_",I4.4,".nc")') kt, narea-1 
     243         WRITE(cl_filename,'(A,"_icebergs_",I8.8,"_restart_",I4.4,".nc")') TRIM(cexper), kt, narea-1 
    237244      ELSE 
    238          WRITE(cl_filename,'("icebergs_",I8.8,"_restart.nc")') kt 
    239       ENDIF 
    240       IF (nn_verbose_level >= 0) WRITE(numout,'(2a)') 'icebergs, write_restart: creating ',TRIM(cl_filename) 
    241  
    242       nret = NF90_CREATE(TRIM(cl_filename), NF90_CLOBBER, ncid) 
     245         WRITE(cl_filename,'(A,"_icebergs_",I8.8,"_restart.nc")') TRIM(cexper), kt 
     246      ENDIF 
     247      IF (nn_verbose_level >= 0) WRITE(numout,'(2a)') 'icebergs, write_restart: creating ',TRIM(cl_path)//TRIM(cl_filename) 
     248 
     249      nret = NF90_CREATE(TRIM(cl_path)//TRIM(cl_filename), NF90_CLOBBER, ncid) 
    243250      IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, write_restart: nf_create failed') 
    244251 
     
    372379         ENDIF 
    373380      ENDDO 
    374       IF( lwp ) WRITE(numout,*) 'file: ',TRIM(cl_filename),' var: stored_ice  written' 
     381      IF( lwp ) WRITE(numout,*) 'file: ',TRIM(cl_path)//TRIM(cl_filename),' var: stored_ice  written' 
    375382 
    376383      nret = NF90_PUT_VAR( ncid, nkountid, num_bergs(:) ) 
     
    379386      nret = NF90_PUT_VAR( ncid, nsheatid, berg_grid%stored_heat(:,:) ) 
    380387      IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, write_restart: nf_put_var stored_heat failed') 
    381       IF( lwp ) WRITE(numout,*) 'file: ',TRIM(cl_filename),' var: stored_heat written' 
     388      IF( lwp ) WRITE(numout,*) 'file: ',TRIM(cl_path)//TRIM(cl_filename),' var: stored_heat written' 
    382389 
    383390      nret = NF90_PUT_VAR( ncid, ncalvid , src_calving(:,:) ) 
     
    385392      nret = NF90_PUT_VAR( ncid, ncalvhid, src_calving_hflx(:,:) ) 
    386393      IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, write_restart: nf_put_var calving_hflx failed') 
    387       IF( lwp ) WRITE(numout,*) 'file: ',TRIM(cl_filename),' var: calving written' 
     394      IF( lwp ) WRITE(numout,*) 'file: ',TRIM(cl_path)//TRIM(cl_filename),' var: calving written' 
    388395 
    389396      IF ( ASSOCIATED(first_berg) ) THEN 
  • trunk/NEMOGCM/NEMO/OPA_SRC/IOM/in_out_manager.F90

    r4990 r5341  
    2626   CHARACTER(lc) ::   cn_exp           !: experiment name used for output filename 
    2727   CHARACTER(lc) ::   cn_ocerst_in     !: suffix of ocean restart name (input) 
     28   CHARACTER(lc) ::   cn_ocerst_indir  !: restart input directory 
    2829   CHARACTER(lc) ::   cn_ocerst_out    !: suffix of ocean restart name (output) 
     30   CHARACTER(lc) ::   cn_ocerst_outdir !: restart output directory 
    2931   LOGICAL       ::   ln_rstart        !: start from (F) rest or (T) a restart file 
     32   LOGICAL       ::   ln_rst_list      !: output restarts at list of times (T) or by frequency (F) 
    3033   INTEGER       ::   nn_no            !: job number 
    3134   INTEGER       ::   nn_rstctl        !: control of the time step (0, 1 or 2) 
     
    3841   INTEGER       ::   nn_write         !: model standard output frequency 
    3942   INTEGER       ::   nn_stock         !: restart file frequency 
     43   INTEGER, DIMENSION(10) :: nn_stocklist  !: restart dump times 
    4044   LOGICAL       ::   ln_dimgnnn       !: type of dimgout. (F): 1 file for all proc 
    4145                                                       !:                  (T): 1 file per proc 
     
    7882   INTEGER       ::   nwrite                      !: model standard output frequency 
    7983   INTEGER       ::   nstock                      !: restart file frequency 
     84   INTEGER, DIMENSION(10) :: nstocklist           !: restart dump times 
    8085 
    8186   !!---------------------------------------------------------------------- 
     
    8590   LOGICAL ::   lrst_oce              !: logical to control the oce restart write  
    8691   INTEGER ::   numror, numrow        !: logical unit for cean restart (read and write) 
     92   INTEGER ::   nrst_lst              !: number of restart to output next 
    8793 
    8894   !!---------------------------------------------------------------------- 
  • trunk/NEMOGCM/NEMO/OPA_SRC/IOM/iom_nf90.F90

    r4689 r5341  
    6161      INTEGER, DIMENSION(2,5), INTENT(in   ), OPTIONAL ::   kdompar     ! domain parameters:  
    6262 
    63       CHARACTER(LEN=100) ::   clinfo           ! info character 
    64       CHARACTER(LEN=100) ::   cltmp            ! temporary character 
     63      CHARACTER(LEN=256) ::   clinfo           ! info character 
     64      CHARACTER(LEN=256) ::   cltmp            ! temporary character 
    6565      INTEGER            ::   iln              ! lengths of character 
    6666      INTEGER            ::   istop            ! temporary storage of nstop 
     
    393393      INTEGER, DIMENSION(4) :: idimsz               ! dimensions size   
    394394      INTEGER, DIMENSION(4) :: idimid               ! dimensions id 
    395       CHARACTER(LEN=100)    :: clinfo               ! info character 
     395      CHARACTER(LEN=256)    :: clinfo               ! info character 
    396396      CHARACTER(LEN= 12), DIMENSION(4) :: cltmp     ! temporary character 
    397397      INTEGER               :: if90id               ! nf90 file identifier 
  • trunk/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90

    r4990 r5341  
    5757      !! 
    5858      CHARACTER(LEN=20)   ::   clkt     ! ocean time-step deine as a character 
    59       CHARACTER(LEN=50)   ::   clname   ! ice output restart file name 
     59      CHARACTER(LEN=50)   ::   clname   ! ocean output restart file name 
     60      CHARACTER(lc)       ::   clpath   ! full path to ocean output restart file 
    6061      !!---------------------------------------------------------------------- 
    6162      ! 
    6263      IF( kt == nit000 ) THEN   ! default definitions 
    6364         lrst_oce = .FALSE.    
    64          nitrst = nitend 
    65       ENDIF 
    66       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    
    6775         ! we use kt - 1 and not kt - nit000 to keep the same periodicity from the beginning of the experiment 
    6876         nitrst = kt + nstock - 1                  ! define the next value of nitrst for restart writing 
     
    7381      ! except if we write ocean restart files every time step or if an ocean restart file was writen at nitend - 1 
    7482      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 
     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 
    9087            ENDIF 
    91          ENDIF 
    92          ! 
    93          CALL iom_open( clname, numrow, ldwrt = .TRUE., kiolib = jprstlib ) 
    94          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 
    95109      ENDIF 
    96110      ! 
     
    142156!!gm  not sure what to do here   ===>>>  ask to Sebastian 
    143157         lrst_oce = .FALSE. 
     158            IF( ln_rst_list ) THEN 
     159               nrst_lst = MIN(nrst_lst + 1, SIZE(nstocklist,1)) 
     160               nitrst = nstocklist( nrst_lst ) 
     161            ENDIF 
     162            lrst_oce = .FALSE. 
    144163      ENDIF 
    145164      ! 
     
    156175      !!                the file has already been opened 
    157176      !!---------------------------------------------------------------------- 
    158       INTEGER  ::   jlibalt = jprstlib 
    159       LOGICAL  ::   llok 
     177      INTEGER        ::   jlibalt = jprstlib 
     178      LOGICAL        ::   llok 
     179      CHARACTER(lc)  ::   clpath   ! full path to ocean output restart file 
    160180      !!---------------------------------------------------------------------- 
    161181      ! 
     
    171191         ENDIF 
    172192 
     193         clpath = TRIM(cn_ocerst_indir) 
     194         IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 
    173195         IF ( jprstlib == jprstdimg ) THEN 
    174196           ! eventually read netcdf file (monobloc)  for restarting on different number of processors 
    175197           ! if {cn_ocerst_in}.nc exists, then set jlibalt to jpnf90 
    176            INQUIRE( FILE = TRIM(cn_ocerst_in)//'.nc', EXIST = llok ) 
     198           INQUIRE( FILE = TRIM(cn_ocerst_indir)//'/'//TRIM(cn_ocerst_in)//'.nc', EXIST = llok ) 
    177199           IF ( llok ) THEN ; jlibalt = jpnf90  ; ELSE ; jlibalt = jprstlib ; ENDIF 
    178200         ENDIF 
    179          CALL iom_open( cn_ocerst_in, numror, kiolib = jlibalt ) 
     201         CALL iom_open( TRIM(clpath)//cn_ocerst_in, numror, kiolib = jlibalt ) 
    180202      ENDIF 
    181203   END SUBROUTINE rst_read_open 
  • trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim.F90

    r5167 r5341  
    346346      !!------------------------------------------------------------------- 
    347347      INTEGER  ::   ios                 ! Local integer output status for namelist read 
    348       NAMELIST/namicerun/ jpl, nlay_i, nlay_s, cn_icerst_in, cn_icerst_out,   & 
     348      NAMELIST/namicerun/ jpl, nlay_i, nlay_s, cn_icerst_in, cn_icerst_indir, cn_icerst_out, cn_icerst_outdir,  & 
    349349         &                ln_limdyn, rn_amax, ln_limdiahsb, ln_limdiaout, ln_icectl, iiceprt, jiceprt   
    350350      !!------------------------------------------------------------------- 
  • trunk/NEMOGCM/NEMO/OPA_SRC/TRD/trdmxl_rst.F90

    r5215 r5341  
    2727   !!--------------------------------------------------------------------------------- 
    2828   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    29    !! $Id$  
     29   !! $Id$ 
    3030   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    3131   !!--------------------------------------------------------------------------------- 
     
    4343      INTEGER ::   jk                 ! loop indice 
    4444      CHARACTER(LEN=20)   ::   clkt     ! ocean time-step deine as a character 
    45       CHARACTER(LEN=50)   ::   clname   ! ice output restart file name 
     45      CHARACTER(LEN=50)   ::   clname   ! output restart file name 
     46      CHARACTER(LEN=256)  ::   clpath   ! full path to restart file 
    4647      !!-------------------------------------------------------------------------------- 
    4748 
     
    5657         ! create the file 
    5758         clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_trdrst_out) 
     59         clpath = TRIM(cn_ocerst_outdir) 
     60         IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 
    5861         IF(lwp) THEN 
    5962            WRITE(numout,*) 
     
    6770         ENDIF 
    6871 
    69          CALL iom_open( clname, nummxlw, ldwrt = .TRUE., kiolib = jprstlib ) 
     72         CALL iom_open( TRIM(clpath)//TRIM(clname), nummxlw, ldwrt = .TRUE., kiolib = jprstlib ) 
    7073      ENDIF 
    7174 
     
    133136      INTEGER ::   jlibalt = jprstlib 
    134137      LOGICAL ::   llok 
     138      CHARACTER(LEN=256)  ::   clpath   ! full path to restart file 
    135139      !!----------------------------------------------------------------------------- 
    136140 
     
    140144         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~' 
    141145      ENDIF 
     146 
     147      clpath = TRIM(cn_ocerst_indir) 
     148      IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 
     149 
    142150      IF ( jprstlib == jprstdimg ) THEN 
    143151         ! eventually read netcdf file (monobloc)  for restarting on different number of processors 
    144152         ! if {cn_trdrst_in}.nc exists, then set jlibalt to jpnf90 
    145          INQUIRE( FILE = TRIM(cn_trdrst_in)//'.nc', EXIST = llok ) 
     153         INQUIRE( FILE = TRIM(clpath)//TRIM(cn_trdrst_in)//'.nc', EXIST = llok ) 
    146154         IF ( llok ) THEN   ;   jlibalt = jpnf90    
    147155         ELSE               ;   jlibalt = jprstlib    
     
    149157      ENDIF 
    150158 
    151       CALL iom_open( cn_trdrst_in, inum, kiolib = jlibalt )  
     159      CALL iom_open( TRIM(clpath)//TRIM(cn_trdrst_in), inum, kiolib = jlibalt )  
    152160 
    153161      IF( ln_trdmxl_instant ) THEN  
Note: See TracChangeset for help on using the changeset viewer.