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 783 for trunk/NEMO/OPA_SRC/TRD – NEMO

Changeset 783 for trunk/NEMO/OPA_SRC/TRD


Ignore:
Timestamp:
2008-01-07T15:29:41+01:00 (16 years ago)
Author:
smasson
Message:

write multiple restarts, see ticket:44

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMO/OPA_SRC/TRD/trdmld_rst.F90

    r719 r783  
    4646      !!-------------------------------------------------------------------------------- 
    4747 
    48       IF( kt == nitrst-1 ) THEN 
    49          IF( nitrst > 1.0e9 ) THEN    
    50             WRITE(clkt,*) nitrst 
    51          ELSE 
    52             WRITE(clkt,'(i8.8)') nitrst 
     48      ! to get better performances with NetCDF format: 
     49      ! we open and define the ocean restart_mld file one time step before writing the data (-> at nitrst - 1) 
     50      ! except if we write ocean restart_mld files every time step or if an ocean restart_mld file was writen at nitend - 1 
     51      IF( kt == nitrst - 1 .OR. nstock == 1 .OR. ( kt == nitend .AND. MOD( nitend - 1, nstock ) == 0 ) ) THEN 
     52         ! beware of the format used to write kt (default is i8.8, that should be large enough...) 
     53         IF( nitrst > 999999999 ) THEN   ;   WRITE(clkt, *       ) nitrst 
     54         ELSE                            ;   WRITE(clkt, '(i8.8)') nitrst 
    5355         ENDIF 
     56         ! create the file 
    5457         clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_restart_mld" 
    55          IF(lwp) WRITE(numout,*) '             open ocean restart_mld NetCDF file: '//clname 
     58         IF(lwp) THEN 
     59            WRITE(numout,*) 
     60            SELECT CASE ( jprstlib ) 
     61            CASE ( jprstdimg )   ;   WRITE(numout,*) '             open ocean restart_mld binary file: '//clname 
     62            CASE DEFAULT         ;   WRITE(numout,*) '             open ocean restart_mld NetCDF file: '//clname 
     63            END SELECT 
     64            IF( kt == nitrst - 1 ) THEN   ;   WRITE(numout,*) '             kt = nitrst - 1 = ', kt,' date= ', ndastp 
     65            ELSE                          ;   WRITE(numout,*) '             kt = '             , kt,' date= ', ndastp 
     66            ENDIF 
     67         ENDIF 
     68 
    5669         CALL iom_open( clname, nummldw, ldwrt = .TRUE., kiolib = jprstlib ) 
    5770      ENDIF 
     
    5972      IF( kt == nitrst .AND. lwp ) THEN 
    6073         WRITE(numout,*) 
    61          WRITE(numout,*) 'trdmld_rst: output for ML diags. restart, with trd_mld_rst_write routine' 
     74         WRITE(numout,*) 'trdmld_rst: output for ML diags. restart, with trd_mld_rst_write routine kt =', kt 
    6275         WRITE(numout,*) '~~~~~~~~~~' 
    6376         WRITE(numout,*) 
     
    8194         CALL iom_rstput( kt, nitrst, nummldw, 'tml_sumb'        , tml_sumb        ) 
    8295         DO jk = 1, jpltrd 
    83             IF( jk < 10 )   THEN 
    84                WRITE(charout,FMT="('tmltrd_csum_ub_', I1)") jk 
    85             ELSE 
    86                WRITE(charout,FMT="('tmltrd_csum_ub_', I2)") jk 
     96            IF( jk < 10 ) THEN   ;   WRITE(charout,FMT="('tmltrd_csum_ub_', I1)") jk 
     97            ELSE                 ;   WRITE(charout,FMT="('tmltrd_csum_ub_', I2)") jk 
    8798            ENDIF 
    8899            CALL iom_rstput( kt, nitrst, nummldw, charout,  tmltrd_csum_ub(:,:,jk) ) 
     
    94105         CALL iom_rstput( kt, nitrst, nummldw, 'sml_sumb'        , sml_sumb        ) 
    95106         DO jk = 1, jpltrd 
    96             IF( jk < 10 )   THEN 
    97                WRITE(charout,FMT="('smltrd_csum_ub_', I1)") jk 
    98             ELSE 
    99                WRITE(charout,FMT="('smltrd_csum_ub_', I2)") jk 
     107            IF( jk < 10 ) THEN   ;   WRITE(charout,FMT="('smltrd_csum_ub_', I1)") jk 
     108            ELSE                 ;   WRITE(charout,FMT="('smltrd_csum_ub_', I2)") jk 
    100109            ENDIF 
    101110            CALL iom_rstput( kt, nitrst, nummldw, charout , smltrd_csum_ub(:,:,jk) ) 
Note: See TracChangeset for help on using the changeset viewer.