Index: NEMO/branches/2020/dev_12905_xios_restart/src/TOP/C14/trcini_c14.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/TOP/C14/trcini_c14.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/TOP/C14/trcini_c14.F90	(revision 13871)
@@ -68,11 +68,11 @@
         IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
         ! 
-        IF(lrtxios) CALL iom_swap(crtxios_context)
-        CALL iom_get( numrtr, 'co2sbc', co2sbc, ldxios = lrtxios ) 
-        CALL iom_get( numrtr, jpdom_auto, 'c14sbc', c14sbc, ldxios = lrtxios ) 
-        CALL iom_get( numrtr, jpdom_auto, 'exch_co2', exch_co2, ldxios = lrtxios ) 
-        CALL iom_get( numrtr, jpdom_auto, 'exch_c14', exch_c14, ldxios = lrtxios ) 
-        CALL iom_get( numrtr, jpdom_auto, 'qtr_c14', qtr_c14, ldxios = lrtxios )
-        IF(lrtxios) CALL iom_swap(cxios_context)
+        IF(lrxios) CALL iom_swap(cr_toprst_cxt)
+        CALL iom_get( numrtr, 'co2sbc', co2sbc, ldxios = lrxios ) 
+        CALL iom_get( numrtr, jpdom_auto, 'c14sbc', c14sbc, ldxios = lrxios ) 
+        CALL iom_get( numrtr, jpdom_auto, 'exch_co2', exch_co2, ldxios = lrxios ) 
+        CALL iom_get( numrtr, jpdom_auto, 'exch_c14', exch_c14, ldxios = lrxios ) 
+        CALL iom_get( numrtr, jpdom_auto, 'qtr_c14', qtr_c14, ldxios = lrxios )
+        IF(lrxios) CALL iom_swap(cxios_context)
         !
       END IF
@@ -87,7 +87,7 @@
       ELSE
         !
-        IF(lrtxios) CALL iom_swap(crtxios_context)
-        CALL iom_get( numrtr, jpdom_auto, 'qint_c14', qint_c14, ldxios = lrtxios ) 
-        IF(lrtxios) CALL iom_swap(cxios_context)
+        IF(lrxios) CALL iom_swap(cr_toprst_cxt)
+        CALL iom_get( numrtr, jpdom_auto, 'qint_c14', qint_c14, ldxios = lrxios ) 
+        IF(lrxios) CALL iom_swap(cxios_context)
         !
       ENDIF
Index: NEMO/branches/2020/dev_12905_xios_restart/src/TOP/C14/trcsms_c14.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/TOP/C14/trcsms_c14.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/TOP/C14/trcsms_c14.F90	(revision 13871)
@@ -144,5 +144,5 @@
          IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
          !
-         IF( lwxios ) CALL iom_swap(      cwtxios_context         )
+         IF( lwxios ) CALL iom_swap(      cw_toprst_cxt         )
          CALL iom_rstput( kt, nitrst, numrtw, 'co2sbc', co2sbc,     ldxios = lwxios ) ! These five need      &
          CALL iom_rstput( kt, nitrst, numrtw, 'c14sbc', c14sbc,     ldxios = lwxios ) ! &    to be written   &
Index: NEMO/branches/2020/dev_12905_xios_restart/src/TOP/CFC/trcsms_cfc.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/TOP/CFC/trcsms_cfc.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/TOP/CFC/trcsms_cfc.F90	(revision 13871)
@@ -179,5 +179,5 @@
          IF(lwp) WRITE(numout,*) '~~~~'
          jl = 0
-         IF( lwxios ) CALL iom_swap(      cwtxios_context         )
+         IF( lwxios ) CALL iom_swap(      cw_toprst_cxt         )
          DO jn = jp_cfc0, jp_cfc1
              jl = jl + 1
@@ -298,10 +298,10 @@
          !
          jl = 0
-         IF(lrtxios) CALL iom_swap(crtxios_context)
+         IF(lrxios) CALL iom_swap(cr_toprst_cxt)
          DO jn = jp_cfc0, jp_cfc1
             jl = jl + 1
-            CALL iom_get( numrtr, jpdom_auto, 'qint_'//ctrcnm(jn), qint_cfc(:,:,jl), ldxios = lrtxios ) 
+            CALL iom_get( numrtr, jpdom_auto, 'qint_'//ctrcnm(jn), qint_cfc(:,:,jl), ldxios = lrxios ) 
          END DO
-         IF(lrtxios) CALL iom_swap(cxios_context)
+         IF(lrxios) CALL iom_swap(cxios_context)
       ENDIF
       IF(lwp) WRITE(numout,*)
Index: NEMO/branches/2020/dev_12905_xios_restart/src/TOP/PISCES/P2Z/p2zexp.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/TOP/PISCES/P2Z/p2zexp.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/TOP/PISCES/P2Z/p2zexp.F90	(revision 13871)
@@ -134,5 +134,5 @@
             &                    'at it= ', kt,' date= ', ndastp
          IF(lwp) WRITE(numout,*) '~~~~'
-         IF( lwxios ) CALL iom_swap(      cwtxios_context         )
+         IF( lwxios ) CALL iom_swap(      cw_toprst_cxt         )
          CALL iom_rstput( kt, nitrst, numrtw, 'SEDB'//ctrcnm(jpdet), sedpocb(:,:), ldxios = lwxios )
          CALL iom_rstput( kt, nitrst, numrtw, 'SEDN'//ctrcnm(jpdet), sedpocn(:,:), ldxios = lwxios )
@@ -216,8 +216,8 @@
       !
       IF( ln_rsttr ) THEN
-         IF(lrtxios) CALL iom_swap(crtxios_context)
-         CALL iom_get( numrtr, jpdom_auto, 'SEDB'//ctrcnm(jpdet), sedpocb(:,:), ldxios = lrtxios )
-         CALL iom_get( numrtr, jpdom_auto, 'SEDN'//ctrcnm(jpdet), sedpocn(:,:), ldxios = lrtxios )
-         IF(lrtxios) CALL iom_swap(cxios_context)
+         IF(lrxios) CALL iom_swap(cr_toprst_cxt)
+         CALL iom_get( numrtr, jpdom_auto, 'SEDB'//ctrcnm(jpdet), sedpocb(:,:), ldxios = lrxios )
+         CALL iom_get( numrtr, jpdom_auto, 'SEDN'//ctrcnm(jpdet), sedpocn(:,:), ldxios = lrxios )
+         IF(lrxios) CALL iom_swap(cxios_context)
       ELSE
          sedpocb(:,:) = 0._wp
Index: NEMO/branches/2020/dev_12905_xios_restart/src/TOP/PISCES/P4Z/p4zsms.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/TOP/PISCES/P4Z/p4zsms.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/TOP/PISCES/P4Z/p4zsms.F90	(revision 13871)
@@ -332,14 +332,14 @@
          IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
          ! 
-         IF(lrtxios) CALL iom_swap(crtxios_context)
+         IF(lrxios) CALL iom_swap(cr_toprst_cxt)
          IF( iom_varid( numrtr, 'PH', ldstop = .FALSE. ) > 0 ) THEN
-            CALL iom_get( numrtr, jpdom_auto, 'PH' , hi(:,:,:), ldxios = lrtxios  )
+            CALL iom_get( numrtr, jpdom_auto, 'PH' , hi(:,:,:), ldxios = lrxios  )
          ELSE
             CALL p4z_che( Kbb, Kmm )                  ! initialize the chemical constants
             CALL ahini_for_at( hi, Kbb )
          ENDIF
-         CALL iom_get( numrtr, jpdom_auto, 'Silicalim', xksi(:,:), ldxios = lrtxios )
+         CALL iom_get( numrtr, jpdom_auto, 'Silicalim', xksi(:,:), ldxios = lrxios )
          IF( iom_varid( numrtr, 'Silicamax', ldstop = .FALSE. ) > 0 ) THEN
-            CALL iom_get( numrtr, jpdom_auto, 'Silicamax' , xksimax(:,:), ldxios = lrtxios  )
+            CALL iom_get( numrtr, jpdom_auto, 'Silicamax' , xksimax(:,:), ldxios = lrxios  )
          ELSE
             xksimax(:,:) = xksi(:,:)
@@ -347,5 +347,5 @@
          !
          IF( iom_varid( numrtr, 'tcflxcum', ldstop = .FALSE. ) > 0 ) THEN  ! cumulative total flux of carbon
-            CALL iom_get( numrtr, 'tcflxcum' , t_oce_co2_flx_cum, ldxios = lrtxios  )
+            CALL iom_get( numrtr, 'tcflxcum' , t_oce_co2_flx_cum, ldxios = lrxios  )
          ELSE
             t_oce_co2_flx_cum = 0._wp
@@ -354,7 +354,7 @@
          IF( ln_p5z ) THEN
             IF( iom_varid( numrtr, 'sized', ldstop = .FALSE. ) > 0 ) THEN
-               CALL iom_get( numrtr, jpdom_auto, 'sizep' , sizep(:,:,:), ldxios = lrtxios  )
-               CALL iom_get( numrtr, jpdom_auto, 'sizen' , sizen(:,:,:), ldxios = lrtxios  )
-               CALL iom_get( numrtr, jpdom_auto, 'sized' , sized(:,:,:), ldxios = lrtxios  )
+               CALL iom_get( numrtr, jpdom_auto, 'sizep' , sizep(:,:,:), ldxios = lrxios  )
+               CALL iom_get( numrtr, jpdom_auto, 'sizen' , sizen(:,:,:), ldxios = lrxios  )
+               CALL iom_get( numrtr, jpdom_auto, 'sized' , sized(:,:,:), ldxios = lrxios  )
             ELSE
                sizep(:,:,:) = 1.
@@ -363,5 +363,5 @@
             ENDIF
         ENDIF
-        IF(lrtxios) CALL iom_swap(cxios_context)
+        IF(lrxios) CALL iom_swap(cxios_context)
         !
       ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN
@@ -371,5 +371,5 @@
             IF(lwp) WRITE(numout,*) '~~~~~~~'
          ENDIF
-         IF( lwxios ) CALL iom_swap(      cwtxios_context         )
+         IF( lwxios ) CALL iom_swap(      cw_toprst_cxt         )
          CALL iom_rstput( kt, nitrst, numrtw, 'PH', hi(:,:,:),               ldxios = lwxios )
          CALL iom_rstput( kt, nitrst, numrtw, 'Silicalim', xksi(:,:),        ldxios = lwxios )
Index: NEMO/branches/2020/dev_12905_xios_restart/src/TOP/PISCES/SED/sed.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/TOP/PISCES/SED/sed.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/TOP/PISCES/SED/sed.F90	(revision 13871)
@@ -53,5 +53,4 @@
    INTEGER             , PUBLIC   ::  nn_rstsed      !: control of the time step ( 0 or 1 ) for pass. tr.
    INTEGER , PUBLIC               ::  nn_dtsed = 1   !: frequency of step on passive tracers
-   LOGICAL,  PUBLIC               ::  lrsxios        !: use xios to read restart
    CHARACTER(len = 80) , PUBLIC   ::  cn_sedrst_in   !: suffix of pass. tracer restart name (input)
    CHARACTER(len = 256), PUBLIC   ::  cn_sedrst_indir  !: restart input directory
Index: NEMO/branches/2020/dev_12905_xios_restart/src/TOP/PISCES/SED/sedrst.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/TOP/PISCES/SED/sedrst.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/TOP/PISCES/SED/sedrst.F90	(revision 13871)
@@ -85,5 +85,5 @@
          ELSE
 #if defined key_iomput
-            cwsxios_context = "rstws_"//TRIM(ADJUSTL(clkt))
+            cw_sedrst_cxt = "rstws_"//TRIM(ADJUSTL(clkt))
             IF( TRIM(Agrif_CFixed()) == '0' ) THEN
                clpname = clname
@@ -91,5 +91,5 @@
                clpname = TRIM(Agrif_CFixed())//"_"//clname
             ENDIF
-            CALL iom_init( cwsxios_context, fname = TRIM(clpath)//TRIM(clpname), ld_closedef = .FALSE. )
+            CALL iom_init( cw_sedrst_cxt, fname = TRIM(clpath)//TRIM(clpname), ld_closedef = .FALSE. )
             CALL iom_swap(      cxios_context          )
 #else
@@ -138,9 +138,9 @@
       zdta2 = 0.
 
-      IF(lrsxios) CALL iom_swap(crsxios_context)
+      IF(lrxios) CALL iom_swap(cr_sedrst_cxt)
       DO jn = 1, jptrased
          cltra = TRIM(sedtrcd(jn))
          IF( iom_varid( numrsr, TRIM(cltra) , ldstop = .FALSE. ) > 0 ) THEN
-            CALL iom_get( numrsr, jpdom_auto, TRIM(cltra), zdta(:,:,:,jn), ldxios = lrsxios )
+            CALL iom_get( numrsr, jpdom_auto, TRIM(cltra), zdta(:,:,:,jn), ldxios = lrxios )
          ELSE
             zdta(:,:,:,jn) = 0.0
@@ -161,5 +161,5 @@
          cltra = TRIM(seddia3d(jn))
          IF( iom_varid( numrsr, TRIM(cltra) , ldstop = .FALSE. ) > 0 ) THEN
-            CALL iom_get( numrsr, jpdom_auto, TRIM(cltra), zdta1(:,:,:,jn), ldxios = lrsxios )
+            CALL iom_get( numrsr, jpdom_auto, TRIM(cltra), zdta1(:,:,:,jn), ldxios = lrxios )
          ELSE
             zdta1(:,:,:,jn) = 0.0
@@ -188,5 +188,5 @@
       cltra = "dbioturb"
       IF( iom_varid( numrsr, TRIM(cltra) , ldstop = .FALSE. ) > 0 ) THEN
-         CALL iom_get( numrsr, jpdom_auto, TRIM(cltra), zdta2(:,:,:), ldxios = lrsxios )
+         CALL iom_get( numrsr, jpdom_auto, TRIM(cltra), zdta2(:,:,:), ldxios = lrxios )
       ELSE
          zdta2(:,:,:) = 0.0
@@ -198,5 +198,5 @@
       cltra = "irrig"
       IF( iom_varid( numrsr, TRIM(cltra) , ldstop = .FALSE. ) > 0 ) THEN
-         CALL iom_get( numrsr, jpdom_auto, TRIM(cltra), zdta2(:,:,:), ldxios = lrsxios )
+         CALL iom_get( numrsr, jpdom_auto, TRIM(cltra), zdta2(:,:,:), ldxios = lrxios )
       ELSE
          zdta2(:,:,:) = 0.0
@@ -208,5 +208,5 @@
       cltra = "sedligand"
       IF( iom_varid( numrsr, TRIM(cltra) , ldstop = .FALSE. ) > 0 ) THEN
-         CALL iom_get( numrsr, jpdom_auto, TRIM(cltra), zdta2(:,:,:), ldxios = lrsxios )
+         CALL iom_get( numrsr, jpdom_auto, TRIM(cltra), zdta2(:,:,:), ldxios = lrxios )
       ELSE
          zdta2(:,:,:) = 0.0
@@ -215,5 +215,5 @@
       CALL pack_arr( jpoce, sedligand(1:jpoce,1:jpksed), &
          &             zdta2(1:jpi,1:jpj,1:jpksed), iarroce(1:jpoce) )
-      IF(lrsxios) CALL iom_swap(cxios_context)
+      IF(lrxios) CALL iom_swap(cxios_context)
       IF( ln_timing )  CALL timing_stop('sed_rst_read')
      
@@ -259,5 +259,5 @@
       !! 1. WRITE in nutwrs
       !! ------------------
-      IF( lwxios ) CALL iom_swap(      cwsxios_context         )
+      IF( lwxios ) CALL iom_swap(      cw_sedrst_cxt         )
 !     zinfo(1) = REAL( kt)
       CALL iom_rstput( kt, nitrst, numrsw, 'kt', REAL( kt    , wp), ldxios = lwxios )
@@ -322,5 +322,5 @@
              CALL iom_close( numrsw )     ! close the restart file (only at last time step)
           ELSE
-             CALL iom_context_finalize( cwsxios_context ) 
+             CALL iom_context_finalize( cw_sedrst_cxt ) 
           ENDIF
           IF( l_offline .AND. ln_rst_list ) THEN
@@ -381,7 +381,6 @@
             CALL iom_open( TRIM(cn_sedrst_indir)//'/'//cn_sedrst_in, numrsr )
 
-            lrsxios = lrxios.AND.lxios_sini
-            IF( lrsxios) THEN
-                crsxios_context = 'sed_rst'
+            IF( lrxios) THEN
+                cr_sedrst_cxt = 'sed_rst'
                 IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS for SED'
                 IF( TRIM(Agrif_CFixed()) == '0' ) THEN
@@ -390,10 +389,10 @@
                    clpname = TRIM(Agrif_CFixed())//"_"//cn_sedrst_in   
                 ENDIF
-                CALL iom_init( crsxios_context, fname = TRIM(cn_sedrst_indir)//'/'//TRIM(clpname), &
+                CALL iom_init( cr_sedrst_cxt, fname = TRIM(cn_sedrst_indir)//'/'//TRIM(clpname), &
                                                 idfp = iom_file(numrsr)%nfid, ld_closedef = .TRUE. )
             ENDIF
-            IF(lrsxios) CALL iom_swap(crsxios_context)
-            CALL iom_get ( numrsr, 'kt', zkt, ldxios = lrsxios )   ! last time-step of previous run
-            IF(lrsxios) CALL iom_swap(cxios_context)
+            IF(lrxios) CALL iom_swap(cr_sedrst_cxt)
+            CALL iom_get ( numrsr, 'kt', zkt, ldxios = lrxios )   ! last time-step of previous run
+            IF(lrxios) CALL iom_swap(cxios_context)
             IF(lwp) THEN
                WRITE(numsed,*) ' *** Info read in restart : '
@@ -416,9 +415,9 @@
             !                                          ! set the date in offline mode
             IF( ln_rst_sed .AND. nn_rstsed == 2 ) THEN
-               IF(lrsxios) CALL iom_swap(crsxios_context)
-               CALL iom_get( numrsr, 'ndastp', zndastp, ldxios = lrsxios )
+               IF(lrxios) CALL iom_swap(cr_sedrst_cxt)
+               CALL iom_get( numrsr, 'ndastp', zndastp, ldxios = lrxios )
                ndastp = NINT( zndastp )
-               CALL iom_get( numrsr, 'adatrj', adatrj, ldxios = lrsxios  )
-               IF(lrsxios) CALL iom_swap(crxios_context)
+               CALL iom_get( numrsr, 'adatrj', adatrj, ldxios = lrxios  )
+               IF(lrxios) CALL iom_swap(cr_ocerst_cxt)
              ELSE
                ndastp = ndate0 - 1     ! ndate0 read in the namelist in dom_nam
@@ -444,7 +443,7 @@
             IF(lwp) WRITE(numsed,*) 'trc_wri : write the TOP restart file (NetCDF) at it= ', kt, ' date= ', ndastp
             IF(lwp) WRITE(numsed,*) '~~~~~~~'
-            IF( lwxios ) CALL iom_init_closedef(cwsxios_context)
-         ENDIF
-         IF( lwxios ) CALL iom_swap(      cwsxios_context         )
+            IF( lwxios ) CALL iom_init_closedef(cw_sedrst_cxt)
+         ENDIF
+         IF( lwxios ) CALL iom_swap(      cw_sedrst_cxt         )
          CALL iom_rstput( kt, nitrst, numrsw, 'kt'     , REAL( kt    , wp), ldxios = lwxios )   ! time-step
          CALL iom_rstput( kt, nitrst, numrsw, 'ndastp' , REAL( ndastp, wp), ldxios = lwxios )   ! date
Index: NEMO/branches/2020/dev_12905_xios_restart/src/TOP/PISCES/SED/sedstp.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/TOP/PISCES/SED/sedstp.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/TOP/PISCES/SED/sedstp.F90	(revision 13871)
@@ -86,5 +86,5 @@
       IF( kt == nitsed000 ) THEN
           CALL iom_close( numrsr )       ! close input tracer restart file
-          IF(lrsxios) CALL iom_context_finalize(      crsxios_context  )
+          IF(lrxios) CALL iom_context_finalize(      cr_sedrst_cxt  )
 !          IF(lwm) CALL FLUSH( numont )   ! flush namelist output
       ENDIF
Index: NEMO/branches/2020/dev_12905_xios_restart/src/TOP/TRP/trcsbc.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/TOP/TRP/trcsbc.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/TOP/TRP/trcsbc.F90	(revision 13871)
@@ -87,9 +87,9 @@
             IF(lwp) WRITE(numout,*) '          nittrc000-1 surface tracer content forcing fields read in the restart file'
             zfact = 0.5_wp
-            IF(lrtxios) CALL iom_swap(crtxios_context)
+            IF(lrxios) CALL iom_swap(cr_toprst_cxt)
             DO jn = 1, jptra
-               CALL iom_get( numrtr, jpdom_auto, 'sbc_'//TRIM(ctrcnm(jn))//'_b', sbc_trc_b(:,:,jn), ldxios = lrtxios )   ! before tracer content sbc
+               CALL iom_get( numrtr, jpdom_auto, 'sbc_'//TRIM(ctrcnm(jn))//'_b', sbc_trc_b(:,:,jn), ldxios = lrxios )   ! before tracer content sbc
             END DO
-            IF(lrtxios) CALL iom_swap(cxios_context)
+            IF(lrxios) CALL iom_swap(cxios_context)
          ELSE                                         ! No restart or restart not found: Euler forward time stepping
            zfact = 1._wp
@@ -183,5 +183,5 @@
             &                    'at it= ', kt,' date= ', ndastp
          IF(lwp) WRITE(numout,*) '~~~~'
-         IF( lwxios ) CALL iom_swap(      cwtxios_context         )
+         IF( lwxios ) CALL iom_swap(      cw_toprst_cxt         )
          DO jn = 1, jptra
             CALL iom_rstput( kt, nitrst, numrtw, 'sbc_'//TRIM(ctrcnm(jn))//'_b', sbc_trc(:,:,jn), ldxios = lwxios )
Index: NEMO/branches/2020/dev_12905_xios_restart/src/TOP/trc.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/TOP/trc.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/TOP/trc.F90	(revision 13871)
@@ -69,5 +69,4 @@
    INTEGER             , PUBLIC ::   nittrc000          !: first time step of passive tracers model
    LOGICAL             , PUBLIC ::   l_trcdm2dc         !: Diurnal cycle for TOP
-   LOGICAL             , PUBLIC ::   lrtxios            !: read TOP restart with XIOS
 
    !! Information for the ice module for tracers
Index: NEMO/branches/2020/dev_12905_xios_restart/src/TOP/trcrst.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/TOP/trcrst.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/TOP/trcrst.F90	(revision 13871)
@@ -96,5 +96,5 @@
          ELSE
 #if defined key_iomput
-            cwtxios_context = "rstwt_"//TRIM(ADJUSTL(clkt))
+            cw_toprst_cxt = "rstwt_"//TRIM(ADJUSTL(clkt))
             IF( TRIM(Agrif_CFixed()) == '0' ) THEN
                clpname = clname
@@ -102,5 +102,5 @@
                clpname = TRIM(Agrif_CFixed())//"_"//clname
             ENDIF
-            CALL iom_init( cwtxios_context, fname = TRIM(clpath)//TRIM(clpname), ld_closedef = .FALSE. )
+            CALL iom_init( cw_toprst_cxt, fname = TRIM(clpath)//TRIM(clpname), ld_closedef = .FALSE. )
             CALL iom_swap(      cxios_context          )
 #else
@@ -130,15 +130,15 @@
 
       ! READ prognostic variables and computes diagnostic variable
-      IF(lrtxios) CALL iom_swap(crtxios_context)
+      IF(lrxios) CALL iom_swap(cr_toprst_cxt)
       DO jn = 1, jptra
-         CALL iom_get( numrtr, jpdom_auto, 'TRN'//ctrcnm(jn), tr(:,:,:,jn,Kmm), ldxios = lrtxios )
+         CALL iom_get( numrtr, jpdom_auto, 'TRN'//ctrcnm(jn), tr(:,:,:,jn,Kmm), ldxios = lrxios )
       END DO
 
       DO jn = 1, jptra
-         CALL iom_get( numrtr, jpdom_auto, 'TRB'//ctrcnm(jn), tr(:,:,:,jn,Kbb), ldxios = lrtxios )
+         CALL iom_get( numrtr, jpdom_auto, 'TRB'//ctrcnm(jn), tr(:,:,:,jn,Kbb), ldxios = lrxios )
       END DO
       !
       CALL iom_delay_rst( 'READ', 'TOP', numrtr )   ! read only TOP delayed global communication variables
-      IF(lrtxios) CALL iom_swap(cxios_context) 
+      IF(lrxios) CALL iom_swap(cxios_context) 
    END SUBROUTINE trc_rst_read
 
@@ -155,5 +155,5 @@
       !!----------------------------------------------------------------------
       !
-      IF( lwxios ) CALL iom_swap(      cwtxios_context         )
+      IF( lwxios ) CALL iom_swap(      cw_toprst_cxt         )
       CALL iom_rstput( kt, nitrst, numrtw, 'rdttrc1', rn_Dt, ldxios = lwxios )   ! passive tracer time step (= ocean time step)
       ! prognostic variables 
@@ -173,5 +173,5 @@
           CALL trc_rst_stat( Kmm, Krhs )             ! statistics
           IF(lwxios) THEN
-             CALL iom_context_finalize(      cwtxios_context          )
+             CALL iom_context_finalize(      cw_toprst_cxt          )
           ELSE
              CALL iom_close( numrtw )     ! close the restart file (only at last time step)
@@ -234,7 +234,6 @@
             lxios_sini = .FALSE.
             CALL iom_open( TRIM(cn_trcrst_indir)//'/'//cn_trcrst_in, numrtr )
-            lrtxios = lrxios.AND.lxios_sini
-            IF( lrtxios) THEN
-                crtxios_context = 'top_rst'
+            IF( lrxios) THEN
+                cr_toprst_cxt = 'top_rst'
                 IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS for TOP'
                 IF( TRIM(Agrif_CFixed()) == '0' ) THEN
@@ -243,11 +242,11 @@
                    clpname = TRIM(Agrif_CFixed())//"_"//cn_trcrst_in   
                 ENDIF
-                CALL iom_init( crtxios_context, fname = TRIM(cn_trcrst_indir)//'/'//TRIM(clpname), &
+                CALL iom_init( cr_toprst_cxt, fname = TRIM(cn_trcrst_indir)//'/'//TRIM(clpname), &
                                           idfp = iom_file(numrtr)%nfid, ld_closedef = .TRUE. )
             ENDIF
 
-            IF(lrtxios) CALL iom_swap(crtxios_context)
-            CALL iom_get ( numrtr, 'kt', zkt, ldxios = lrtxios )   ! last time-step of previous run
-            IF(lrtxios) CALL iom_swap(cxios_context)
+            IF(lrxios) CALL iom_swap(cr_toprst_cxt)
+            CALL iom_get ( numrtr, 'kt', zkt, ldxios = lrxios )   ! last time-step of previous run
+            IF(lrxios) CALL iom_swap(cxios_context)
 
             IF(lwp) THEN
@@ -271,10 +270,10 @@
             !                                          ! set the date in offline mode
             IF( ln_rsttr .AND. nn_rsttr == 2 ) THEN
-               IF(lrtxios) CALL iom_swap(crtxios_context)
-               CALL iom_get( numrtr, 'ndastp', zndastp, ldxios = lrtxios )
+               IF(lrxios) CALL iom_swap(cr_toprst_cxt)
+               CALL iom_get( numrtr, 'ndastp', zndastp, ldxios = lrxios )
                ndastp = NINT( zndastp )
-               CALL iom_get( numrtr, 'adatrj', adatrj, ldxios = lrtxios  )
-               CALL iom_get( numrtr, 'ntime' , ktime, ldxios = lrtxios   )
-               IF(lrtxios) CALL iom_swap(cxios_context)
+               CALL iom_get( numrtr, 'adatrj', adatrj, ldxios = lrxios  )
+               CALL iom_get( numrtr, 'ntime' , ktime, ldxios = lrxios   )
+               IF(lrxios) CALL iom_swap(cxios_context)
                nn_time0=INT(ktime)
                ! calculate start time in hours and minutes
@@ -336,5 +335,5 @@
             IF(lwp) WRITE(numout,*) '~~~~~~~'
          ENDIF
-         IF( lwxios ) CALL iom_swap(      cwtxios_context         )
+         IF( lwxios ) CALL iom_swap(      cw_toprst_cxt         )
          CALL iom_rstput( kt, nitrst, numrtw, 'kt'     , REAL( kt    , wp)  , ldxios = lwxios )   ! time-step
          CALL iom_rstput( kt, nitrst, numrtw, 'ndastp' , REAL( ndastp, wp)  , ldxios = lwxios )   ! date
Index: NEMO/branches/2020/dev_12905_xios_restart/src/TOP/trcstp.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/TOP/trcstp.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/TOP/trcstp.F90	(revision 13871)
@@ -110,5 +110,5 @@
       IF( kt == nittrc000 ) THEN
          CALL iom_close( numrtr )                         ! close input tracer restart file
-         IF(lrtxios) CALL iom_context_finalize(      crtxios_context          )
+         IF(lrxios) CALL iom_context_finalize(      cr_toprst_cxt          )
          IF(lwm) CALL FLUSH( numont )                     ! flush namelist output
       ENDIF
@@ -197,18 +197,18 @@
            &                              .AND. iom_varid( numrtr, 'ktdcy'    , ldstop = .FALSE. ) > 0  &
            &                              .AND. iom_varid( numrtr, 'nrdcy'    , ldstop = .FALSE. ) > 0  ) THEN
-            IF(lrtxios) CALL iom_swap(crtxios_context)
-            CALL iom_get( numrtr, 'ktdcy', zkt, ldxios = lrtxios )  
+            IF(lrxios) CALL iom_swap(cr_toprst_cxt)
+            CALL iom_get( numrtr, 'ktdcy', zkt, ldxios = lrxios )  
             rsecfst = INT( zkt ) * rn_Dt
             IF(lwp) WRITE(numout,*) 'trc_qsr_mean:   qsr_mean read in the restart file at time-step rsecfst =', rsecfst, ' s '
-            CALL iom_get( numrtr, jpdom_auto, 'qsr_mean', qsr_mean, ldxios = lrtxios )   !  A mean of qsr
-            CALL iom_get( numrtr, 'nrdcy', zrec, ldxios = lrtxios )   !  Number of record per days
+            CALL iom_get( numrtr, jpdom_auto, 'qsr_mean', qsr_mean, ldxios = lrxios )   !  A mean of qsr
+            CALL iom_get( numrtr, 'nrdcy', zrec, ldxios = lrxios )   !  Number of record per days
             IF( INT( zrec ) == nb_rec_per_day ) THEN
                DO jn = 1, nb_rec_per_day 
                   IF( jn <= 9 )  THEN
                     WRITE(cl1,'(i1)') jn
-                    CALL iom_get( numrtr, jpdom_auto, 'qsr_arr_'//cl1, qsr_arr(:,:,jn), ldxios = lrtxios )   !  A mean of qsr
+                    CALL iom_get( numrtr, jpdom_auto, 'qsr_arr_'//cl1, qsr_arr(:,:,jn), ldxios = lrxios )   !  A mean of qsr
                   ELSE
                     WRITE(cl2,'(i2.2)') jn
-                    CALL iom_get( numrtr, jpdom_auto, 'qsr_arr_'//cl2, qsr_arr(:,:,jn), ldxios = lrtxios )   !  A mean of qsr
+                    CALL iom_get( numrtr, jpdom_auto, 'qsr_arr_'//cl2, qsr_arr(:,:,jn), ldxios = lrxios )   !  A mean of qsr
                   ENDIF
               END DO
@@ -218,5 +218,5 @@
                ENDDO
             ENDIF
-            IF(lrtxios) CALL iom_swap(cxios_context)
+            IF(lrxios) CALL iom_swap(cxios_context)
          ELSE                                         !* no restart: set from nit000 values
             IF(lwp) WRITE(numout,*) 'trc_qsr_mean:   qsr_mean set to nit000 values'
@@ -252,5 +252,5 @@
          zkt  = REAL( ktdcy, wp )
          zrec = REAL( nb_rec_per_day, wp )
-         IF( lwxios ) CALL iom_swap(      cwtxios_context         )
+         IF( lwxios ) CALL iom_swap(      cw_toprst_cxt         )
          CALL iom_rstput( kt, nitrst, numrtw, 'ktdcy', zkt, ldxios = lwxios  )
          CALL iom_rstput( kt, nitrst, numrtw, 'nrdcy', zrec, ldxios = lwxios )
