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 14017 for NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/src/ICE/icerst.F90 – NEMO

Ignore:
Timestamp:
2020-12-02T16:32:24+01:00 (4 years ago)
Author:
laurent
Message:

Keep up with trunk revision 13999

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/src/ICE/icerst.F90

    r13472 r14017  
    1111   !!---------------------------------------------------------------------- 
    1212   !!   ice_rst_opn   : open  restart file 
    13    !!   ice_rst_write : write restart file  
    14    !!   ice_rst_read  : read  restart file  
     13   !!   ice_rst_write : write restart file 
     14   !!   ice_rst_read  : read  restart file 
    1515   !!---------------------------------------------------------------------- 
    1616   USE ice            ! sea-ice: variables 
     
    5454      CHARACTER(len=20)   ::   clkt     ! ocean time-step define as a character 
    5555      CHARACTER(len=50)   ::   clname   ! ice output restart file name 
    56       CHARACTER(len=256)  ::   clpath   ! full path to ice output restart file  
     56      CHARACTER(len=256)  ::   clpath   ! full path to ice output restart file 
     57      CHARACTER(LEN=52)   ::   clpname   ! ocean output restart file name including prefix for AGRIF 
    5758      !!---------------------------------------------------------------------- 
    5859      ! 
     
    6061 
    6162      IF( ln_rst_list .OR. nn_stock /= -1 ) THEN 
    62       ! in order to get better performances with NetCDF format, we open and define the ice restart file  
    63       ! one ice time step before writing the data (-> at nitrst - 2*nn_fsbc + 1), except if we write ice  
     63      ! in order to get better performances with NetCDF format, we open and define the ice restart file 
     64      ! one ice time step before writing the data (-> at nitrst - 2*nn_fsbc + 1), except if we write ice 
    6465      ! restart files every ice time step or if an ice restart file was writen at nitend - 2*nn_fsbc + 1 
    6566      IF( kt == nitrst - 2*nn_fsbc + 1 .OR. nn_stock == nn_fsbc    & 
     
    7273            ! create the file 
    7374            clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_icerst_out) 
    74             clpath = TRIM(cn_icerst_outdir)  
     75            clpath = TRIM(cn_icerst_outdir) 
    7576            IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath)//'/' 
    7677            IF(lwp) THEN 
     
    8485            ENDIF 
    8586            ! 
    86             CALL iom_open( TRIM(clpath)//TRIM(clname), numriw, ldwrt = .TRUE., kdlev = jpl, cdcomp = 'ICE' ) 
     87            IF(.NOT.lwxios) THEN 
     88               CALL iom_open( TRIM(clpath)//TRIM(clname), numriw, ldwrt = .TRUE., kdlev = jpl, cdcomp = 'ICE' ) 
     89            ELSE 
     90#if defined key_iomput 
     91               cw_icerst_cxt = "rstwi_"//TRIM(ADJUSTL(clkt)) 
     92               IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
     93                  clpname = clname 
     94               ELSE 
     95                  clpname = TRIM(Agrif_CFixed())//"_"//clname 
     96               ENDIF 
     97               numriw = iom_xios_setid(TRIM(clpath)//TRIM(clpname)) 
     98               CALL iom_init( cw_icerst_cxt, kdid = numriw, ld_closedef = .FALSE. ) 
     99               CALL iom_swap( cxios_context ) 
     100#else 
     101               clinfo = 'Can not use XIOS in rst_opn' 
     102               CALL ctl_stop(TRIM(clinfo)) 
     103#endif 
     104            ENDIF 
    87105            lrst_ice = .TRUE. 
    88106         ENDIF 
     
    115133         IF(lwp) WRITE(numout,*) 
    116134         IF(lwp) WRITE(numout,*) 'ice_rst_write : write ice restart file  kt =', kt 
    117          IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~'          
     135         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~' 
    118136      ENDIF 
    119137 
    120138      ! Write in numriw (if iter == nitrst) 
    121       ! ------------------  
     139      ! ------------------ 
    122140      !                                                                        ! calendar control 
    123       CALL iom_rstput( iter, nitrst, numriw, 'nn_fsbc', REAL( nn_fsbc, wp ) )      ! time-step  
     141      CALL iom_rstput( iter, nitrst, numriw, 'nn_fsbc', REAL( nn_fsbc, wp ) )      ! time-step 
    124142      CALL iom_rstput( iter, nitrst, numriw, 'kt_ice' , REAL( iter   , wp ) )      ! date 
    125       CALL iom_delay_rst( 'WRITE', 'ICE', numriw )   ! save only ice delayed global communication variables 
     143 
     144      IF(.NOT.lwxios) CALL iom_delay_rst( 'WRITE', 'ICE', numriw )   ! save only ice delayed global communication variables 
    126145 
    127146      ! Prognostic variables 
     
    138157      CALL iom_rstput( iter, nitrst, numriw, 'v_il' , v_il  ) 
    139158      ! Snow enthalpy 
    140       DO jk = 1, nlay_s  
     159      DO jk = 1, nlay_s 
    141160         WRITE(zchar1,'(I2.2)') jk 
    142161         znam = 'e_s'//'_l'//zchar1 
     
    145164      END DO 
    146165      ! Ice enthalpy 
    147       DO jk = 1, nlay_i  
     166      DO jk = 1, nlay_i 
    148167         WRITE(zchar1,'(I2.2)') jk 
    149168         znam = 'e_i'//'_l'//zchar1 
     
    154173      IF( ln_cpl ) THEN 
    155174         CALL iom_rstput( iter, nitrst, numriw, 'cnd_ice', cnd_ice ) 
    156          CALL iom_rstput( iter, nitrst, numriw, 't1_ice' , t1_ice  ) 
     175         CALL iom_rstput( iter, nitrst, numriw, 't1_ice' , t1_ice ) 
    157176      ENDIF 
    158177      ! 
     
    161180      ! ------------------ 
    162181      IF( iter == nitrst ) THEN 
    163          CALL iom_close( numriw ) 
     182         IF(.NOT.lwxios) THEN 
     183            CALL iom_close( numriw ) 
     184         ELSE 
     185            CALL iom_context_finalize(      cw_icerst_cxt          ) 
     186            iom_file(numriw)%nfid       = 0 
     187            numriw = 0 
     188         ENDIF 
    164189         lrst_ice = .FALSE. 
    165190      ENDIF 
     
    181206      CHARACTER(len=2)  ::   zchar, zchar1 
    182207      REAL(wp)          ::   zfice, ziter 
     208      CHARACTER(lc)     ::   clpname 
    183209      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   z3d   ! 3D workspace 
    184210      !!---------------------------------------------------------------------- 
     
    190216      ENDIF 
    191217 
     218      lxios_sini = .FALSE. 
    192219      CALL iom_open ( TRIM(cn_icerst_indir)//'/'//cn_icerst_in, numrir ) 
    193220 
    194       ! test if v_i exists  
     221      IF( lrxios) THEN 
     222          cr_icerst_cxt = 'si3_rst' 
     223          IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS for SI3' 
     224!         IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
     225!            clpname = cn_icerst_in 
     226!         ELSE 
     227!            clpname = TRIM(Agrif_CFixed())//"_"//cn_icerst_in 
     228!         ENDIF 
     229          CALL iom_init( cr_icerst_cxt, kdid = numrir, ld_closedef = .TRUE. ) 
     230      ENDIF 
     231 
     232      ! test if v_i exists 
    195233      id0 = iom_varid( numrir, 'v_i' , ldstop = .FALSE. ) 
    196234 
     
    198236      IF( id0 > 0 ) THEN   ! == case of a normal restart == ! 
    199237         !                 ! ------------------------------ ! 
    200           
    201238         ! Time info 
    202239         CALL iom_get( numrir, 'nn_fsbc', zfice ) 
    203          CALL iom_get( numrir, 'kt_ice' , ziter )     
     240         CALL iom_get( numrir, 'kt_ice' , ziter ) 
    204241         IF(lwp) WRITE(numout,*) '   read ice restart file at time step    : ', ziter 
    205242         IF(lwp) WRITE(numout,*) '   in any case we force it to nit000 - 1 : ', nit000 - 1 
     
    215252            &                   '   control of time parameter  nrstdt' ) 
    216253 
    217          ! --- mandatory fields --- !  
     254         ! --- mandatory fields --- ! 
    218255         CALL iom_get( numrir, jpdom_auto, 'v_i'  , v_i   ) 
    219256         CALL iom_get( numrir, jpdom_auto, 'v_s'  , v_s   ) 
     
    278315         ENDIF 
    279316 
    280          CALL iom_delay_rst( 'READ', 'ICE', numrir )   ! read only ice delayed global communication variables 
    281  
     317         IF(.NOT.lrxios) CALL iom_delay_rst( 'READ', 'ICE', numrir )   ! read only ice delayed global communication variables 
    282318         !                 ! ---------------------------------- ! 
    283319      ELSE                 ! == case of a simplified restart == ! 
Note: See TracChangeset for help on using the changeset viewer.