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 8770 for branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90 – NEMO

Ignore:
Timestamp:
2017-11-21T17:21:22+01:00 (6 years ago)
Author:
andmirek
Message:

#1953 and #1962 merged (and some modifications) with write branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90

    r8668 r8770  
    2828   USE iom             ! I/O module 
    2929   USE diurnal_bulk 
    30     
     30   USE iom_def, ONLY : lwxios 
     31 
    3132   IMPLICIT NONE 
    3233   PRIVATE 
     
    6162      CHARACTER(LEN=50)   ::   clname   ! ocean output restart file name 
    6263      CHARACTER(lc)       ::   clpath   ! full path to ocean output restart file 
     64      CHARACTER(LEN=52)   ::   clpname   ! ocean output restart file name including prefix for AGRIF 
    6365      !!---------------------------------------------------------------------- 
    6466      ! 
     
    9496            IF(lwp) THEN 
    9597               WRITE(numout,*) 
    96                SELECT CASE ( jprstlib ) 
    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 
     98               IF(.NOT.lwxios) THEN 
     99                  SELECT CASE ( jprstlib ) 
     100                  CASE DEFAULT         ;   WRITE(numout,*)                            & 
     101                      '             open ocean restart NetCDF file: ',TRIM(clpath)//TRIM(clname) 
     102                  END SELECT 
     103                  IF ( snc4set%luse )      WRITE(numout,*) '             opened for NetCDF4 chunking and compression' 
     104                  IF( kt == nitrst - 1 ) THEN   ;   WRITE(numout,*) '             kt = nitrst - 1 = ', kt 
     105                  ELSE                          ;   WRITE(numout,*) '             kt = '             , kt 
     106                  ENDIF 
    103107               ENDIF 
    104108            ENDIF 
    105109            ! 
    106             CALL iom_open( TRIM(clpath)//TRIM(clname), numrow, ldwrt = .TRUE., kiolib = jprstlib ) 
     110            IF(.NOT.lwxios) THEN 
     111               CALL iom_open( TRIM(clpath)//TRIM(clname), numrow, ldwrt = .TRUE., kiolib = jprstlib ) 
     112            ELSE 
     113               cwxios_context = "rstw_"//TRIM(ADJUSTL(clkt)) 
     114               IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
     115                  clpname = clname 
     116               ELSE 
     117                  clpname = TRIM(Agrif_CFixed())//"_"//clname    
     118               ENDIF 
     119               CALL iom_init( cwxios_context, TRIM(clpath)//TRIM(clpname)) 
     120               CALL xios_update_calendar(nitrst) 
     121               CALL iom_swap(      cxios_context          ) 
     122            ENDIF 
    107123            lrst_oce = .TRUE. 
    108124         ENDIF 
     
    123139      INTEGER, INTENT(in) ::   kt   ! ocean time-step 
    124140      !!---------------------------------------------------------------------- 
    125  
    126                      CALL iom_rstput( kt, nitrst, numrow, 'rdt'    , rdt       )   ! dynamics and tracer time step 
     141                     IF(lwxios) CALL iom_swap(      cwxios_context          ) 
     142                     CALL iom_rstput( kt, nitrst, numrow, 'rdt'    , rdt       , ldxios = lwxios)   ! dynamics time step 
    127143 
    128144      IF ( .NOT. ln_diurnal_only ) THEN 
    129                      CALL iom_rstput( kt, nitrst, numrow, 'ub'     , ub        )     ! before fields 
    130                      CALL iom_rstput( kt, nitrst, numrow, 'vb'     , vb        ) 
    131                      CALL iom_rstput( kt, nitrst, numrow, 'tb'     , tsb(:,:,:,jp_tem) ) 
    132                      CALL iom_rstput( kt, nitrst, numrow, 'sb'     , tsb(:,:,:,jp_sal) ) 
    133                      CALL iom_rstput( kt, nitrst, numrow, 'sshb'   , sshb      ) 
     145                     CALL iom_rstput( kt, nitrst, numrow, 'ub'     , ub, ldxios = lwxios        )     ! before fields 
     146                     CALL iom_rstput( kt, nitrst, numrow, 'vb'     , vb, ldxios = lwxios        ) 
     147                     CALL iom_rstput( kt, nitrst, numrow, 'tb'     , tsb(:,:,:,jp_tem), ldxios = lwxios ) 
     148                     CALL iom_rstput( kt, nitrst, numrow, 'sb'     , tsb(:,:,:,jp_sal), ldxios = lwxios ) 
     149                     CALL iom_rstput( kt, nitrst, numrow, 'sshb'   , sshb, ldxios = lwxios      ) 
    134150                     ! 
    135                      CALL iom_rstput( kt, nitrst, numrow, 'un'     , un        )     ! now fields 
    136                      CALL iom_rstput( kt, nitrst, numrow, 'vn'     , vn        ) 
    137                      CALL iom_rstput( kt, nitrst, numrow, 'tn'     , tsn(:,:,:,jp_tem) ) 
    138                      CALL iom_rstput( kt, nitrst, numrow, 'sn'     , tsn(:,:,:,jp_sal) ) 
    139                      CALL iom_rstput( kt, nitrst, numrow, 'sshn'   , sshn      ) 
    140                      CALL iom_rstput( kt, nitrst, numrow, 'rhop'   , rhop      ) 
    141  
     151                     CALL iom_rstput( kt, nitrst, numrow, 'un'     , un, ldxios = lwxios        )     ! now fields 
     152                     CALL iom_rstput( kt, nitrst, numrow, 'vn'     , vn, ldxios = lwxios        ) 
     153                     CALL iom_rstput( kt, nitrst, numrow, 'tn'     , tsn(:,:,:,jp_tem), ldxios = lwxios ) 
     154                     CALL iom_rstput( kt, nitrst, numrow, 'sn'     , tsn(:,:,:,jp_sal), ldxios = lwxios ) 
     155                     CALL iom_rstput( kt, nitrst, numrow, 'sshn'   , sshn, ldxios = lwxios      ) 
     156                     CALL iom_rstput( kt, nitrst, numrow, 'rhop'   , rhop, ldxios = lwxios      ) 
    142157                  ! extra variable needed for the ice sheet coupling 
    143158                  IF ( ln_iscpl ) THEN  
    144                      CALL iom_rstput( kt, nitrst, numrow, 'tmask'  , tmask    ) ! need to extrapolate T/S 
    145                      CALL iom_rstput( kt, nitrst, numrow, 'umask'  , umask    ) ! need to correct barotropic velocity 
    146                      CALL iom_rstput( kt, nitrst, numrow, 'vmask'  , vmask    ) ! need to correct barotropic velocity 
    147                      CALL iom_rstput( kt, nitrst, numrow, 'smask'  , ssmask    ) ! need to correct barotropic velocity 
    148                      CALL iom_rstput( kt, nitrst, numrow, 'e3t_n', e3t_n(:,:,:) )   ! need to compute temperature correction 
    149                      CALL iom_rstput( kt, nitrst, numrow, 'e3u_n', e3u_n(:,:,:) )   ! need to compute bt conservation 
    150                      CALL iom_rstput( kt, nitrst, numrow, 'e3v_n', e3v_n(:,:,:) )   ! need to compute bt conservation 
    151                      CALL iom_rstput( kt, nitrst, numrow, 'gdepw_n', gdepw_n(:,:,:) ) ! need to compute extrapolation if vvl 
     159                     CALL iom_rstput( kt, nitrst, numrow, 'tmask'  , tmask, ldxios = lwxios ) ! need to extrapolate T/S 
     160                     CALL iom_rstput( kt, nitrst, numrow, 'umask'  , umask, ldxios = lwxios ) ! need to correct barotropic velocity 
     161                     CALL iom_rstput( kt, nitrst, numrow, 'vmask'  , vmask, ldxios = lwxios ) ! need to correct barotropic velocity 
     162                     CALL iom_rstput( kt, nitrst, numrow, 'smask'  , ssmask, ldxios = lwxios) ! need to correct barotropic velocity 
     163                     CALL iom_rstput( kt, nitrst, numrow, 'e3t_n', e3t_n(:,:,:), ldxios = lwxios )   ! need to compute temperature correction 
     164                     CALL iom_rstput( kt, nitrst, numrow, 'e3u_n', e3u_n(:,:,:), ldxios = lwxios )   ! need to compute bt conservation 
     165                     CALL iom_rstput( kt, nitrst, numrow, 'e3v_n', e3v_n(:,:,:), ldxios = lwxios )   ! need to compute bt conservation 
     166                     CALL iom_rstput( kt, nitrst, numrow, 'gdepw_n', gdepw_n(:,:,:), ldxios = lwxios ) ! need to compute extrapolation if vvl 
    152167                  END IF 
    153168      ENDIF 
    154169       
    155       IF (ln_diurnal) CALL iom_rstput( kt, nitrst, numrow, 'Dsst', x_dsst    
    156  
     170      IF (ln_diurnal) CALL iom_rstput( kt, nitrst, numrow, 'Dsst', x_dsst, ldxios = lwxios 
     171      IF(lwxios) CALL iom_swap(      cxios_context          ) 
    157172      IF( kt == nitrst ) THEN 
    158          CALL iom_close( numrow )     ! close the restart file (only at last time step) 
     173         IF(.NOT.lwxios) THEN 
     174            CALL iom_close( numrow )     ! close the restart file (only at last time step) 
     175         ELSE 
     176            CALL iom_context_finalize(      cwxios_context          ) 
     177         ENDIF 
    159178!!gm         IF( .NOT. lk_trdmld )   lrst_oce = .FALSE. 
    160179!!gm  not sure what to do here   ===>>>  ask to Sebastian 
     
    164183               nitrst = nstocklist( nrst_lst ) 
    165184            ENDIF 
    166             lrst_oce = .FALSE. 
    167185      ENDIF 
    168186      ! 
Note: See TracChangeset for help on using the changeset viewer.