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 811 for branches/dev_001_SBC/NEMO/OPA_SRC/restart.F90 – NEMO

Ignore:
Timestamp:
2008-02-07T17:00:12+01:00 (16 years ago)
Author:
ctlod
Message:

dev_001_SBC: merge with the trunk last changesets: #780, 782, 783, 784, 785, 788, 789, 793, 794

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/dev_001_SBC/NEMO/OPA_SRC/restart.F90

    r762 r811  
    6363      !!---------------------------------------------------------------------- 
    6464      ! 
    65       IF( kt == nit000 ) THEN   ! default initialization, to do: should be read in the namelist... 
    66          nitrst = nitend        ! to do: should be read in the namelist in a cleaver way... 
    67          lrst_oce = .FALSE. 
    68       ENDIF 
    69  
    70       IF    ( kt == nitrst-1 .AND. lrst_oce         ) THEN 
    71          CALL ctl_stop( 'rst_opn: we cannot create an ocean restart at every time step',    & 
    72             &           'if the run has more than one time step!!!' ) 
    73          numrow = 0 
    74       ELSEIF( kt == nitrst-1 .OR.  nitend == nit000 ) THEN   ! beware if model runs only one time step 
    75          ! beware of the format used to write kt (default is i8.8, that should be large enough) 
    76          IF( nitrst > 1.0e9 ) THEN    
    77             WRITE(clkt,*) nitrst 
    78          ELSE 
    79             WRITE(clkt,'(i8.8)') nitrst 
     65      IF( kt == nit000 ) THEN   ! default definitions 
     66         lrst_oce = .FALSE.    
     67         nitrst = nitend 
     68      ENDIF 
     69      IF( MOD( kt - 1, nstock ) == 0 ) THEN    
     70         ! we use kt - 1 and not kt - nit000 to keep the same periodicity from the beginning of the experiment 
     71         nitrst = kt + nstock - 1                  ! define the next value of nitrst for restart writing 
     72         IF( nitrst > nitend )   nitrst = nitend   ! make sure we write a restart at the end of the run 
     73      ENDIF 
     74 
     75      ! to get better performances with NetCDF format: 
     76      ! we open and define the ocean restart file one time step before writing the data (-> at nitrst - 1) 
     77      ! except if we write ocean restart files every time step or if an ocean restart file was writen at nitend - 1 
     78      IF( kt == nitrst - 1 .OR. nstock == 1 .OR. ( kt == nitend .AND. .NOT. lrst_oce ) ) THEN 
     79         ! beware of the format used to write kt (default is i8.8, that should be large enough...) 
     80         IF( nitrst > 999999999 ) THEN   ;   WRITE(clkt, *       ) nitrst 
     81         ELSE                            ;   WRITE(clkt, '(i8.8)') nitrst 
    8082         ENDIF 
    8183         ! create the file 
     
    8486            WRITE(numout,*) 
    8587            SELECT CASE ( jprstlib ) 
    86             CASE ( jpnf90 ) 
    87                WRITE(numout,*) '             open ocean restart.output NetCDF file: '//clname 
    88             CASE ( jprstdimg ) 
    89                WRITE(numout,*) '             open ocean restart.output binary file: '//clname 
     88            CASE ( jprstdimg )   ;   WRITE(numout,*) '             open ocean restart binary file: '//clname 
     89            CASE DEFAULT         ;   WRITE(numout,*) '             open ocean restart NetCDF file: '//clname 
    9090            END SELECT 
    91             IF( kt == nitrst-1 ) THEN 
    92                WRITE(numout,*) '             kt = nitrst - 1 = ', kt,' date= ', ndastp 
    93             ELSE 
    94                WRITE(numout,*) '             kt = ', kt,' date= ', ndastp 
     91            IF( kt == nitrst - 1 ) THEN   ;   WRITE(numout,*) '             kt = nitrst - 1 = ', kt,' date= ', ndastp 
     92            ELSE                          ;   WRITE(numout,*) '             kt = '             , kt,' date= ', ndastp 
    9593            ENDIF 
    9694         ENDIF 
     
    114112      INTEGER, INTENT(in) ::   kt   ! ocean time-step 
    115113      !!---------------------------------------------------------------------- 
     114 
     115      IF( kt == nitrst ) THEN 
     116         IF(lwp) WRITE(numout,*) 
     117         IF(lwp) WRITE(numout,*) 'rst_write : write oce restart file  kt =', kt 
     118         IF(lwp) WRITE(numout,*) '~~~~~~~'          
     119      ENDIF 
    116120 
    117121      ! calendar control 
Note: See TracChangeset for help on using the changeset viewer.