Index: NEMO/branches/2020/dev_12905_xios_restart/src/ICE/ice.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/ICE/ice.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/ICE/ice.F90	(revision 13871)
@@ -179,5 +179,4 @@
    LOGICAL , PUBLIC ::   ln_cndflx        !: use conduction flux as surface boundary condition (instead of qsr and qns) 
    LOGICAL , PUBLIC ::   ln_cndemulate    !: emulate conduction flux (if not provided) 
-   LOGICAL , PUBLIC ::   lrixios          !: use xios to read restart in SI3
    !                                      ! Conduction flux as surface forcing or not
    INTEGER, PUBLIC, PARAMETER ::   np_cnd_OFF = 0  !: no forcing from conduction flux (ice thermodynamics forced via qsr and qns)
Index: NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icedia.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icedia.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icedia.F90	(revision 13871)
@@ -221,18 +221,18 @@
          IF( ln_rstart ) THEN                   !* Read the restart file
             !
-            IF(lrixios) CALL iom_swap(crixios_context)
-            CALL iom_get( numrir, 'kt_ice' , ziter, ldxios = lrixios )
+            IF(lrxios) CALL iom_swap(cr_icerst_cxt)
+            CALL iom_get( numrir, 'kt_ice' , ziter, ldxios = lrxios )
             IF(lwp) WRITE(numout,*)
             IF(lwp) WRITE(numout,*) 'ice_dia_rst read at time step = ', ziter
             IF(lwp) WRITE(numout,*) '~~~~~~~~~~'
-            CALL iom_get( numrir, 'frc_voltop' , frc_voltop, ldxios = lrixios  )
-            CALL iom_get( numrir, 'frc_volbot' , frc_volbot, ldxios = lrixios  )
-            CALL iom_get( numrir, 'frc_temtop' , frc_temtop, ldxios = lrixios  )
-            CALL iom_get( numrir, 'frc_tembot' , frc_tembot, ldxios = lrixios  )
-            CALL iom_get( numrir, 'frc_sal'    , frc_sal,    ldxios = lrixios  )
-            CALL iom_get( numrir, jpdom_auto, 'vol_loc_ini', vol_loc_ini, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'tem_loc_ini', tem_loc_ini, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'sal_loc_ini', sal_loc_ini, ldxios = lrixios )
-            IF(lrixios) CALL iom_swap(cxios_context)
+            CALL iom_get( numrir, 'frc_voltop' , frc_voltop, ldxios = lrxios  )
+            CALL iom_get( numrir, 'frc_volbot' , frc_volbot, ldxios = lrxios  )
+            CALL iom_get( numrir, 'frc_temtop' , frc_temtop, ldxios = lrxios  )
+            CALL iom_get( numrir, 'frc_tembot' , frc_tembot, ldxios = lrxios  )
+            CALL iom_get( numrir, 'frc_sal'    , frc_sal,    ldxios = lrxios  )
+            CALL iom_get( numrir, jpdom_auto, 'vol_loc_ini', vol_loc_ini, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'tem_loc_ini', tem_loc_ini, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'sal_loc_ini', sal_loc_ini, ldxios = lrxios )
+            IF(lrxios) CALL iom_swap(cxios_context)
          ELSE
             IF(lwp) WRITE(numout,*)
@@ -263,5 +263,5 @@
          ! Write in numriw (if iter == nitrst)
          ! ------------------ 
-         IF( lwxios ) CALL iom_swap(      cwixios_context         )
+         IF( lwxios ) CALL iom_swap(      cw_icerst_cxt         )
          CALL iom_rstput( iter, nitrst, numriw, 'frc_voltop' , frc_voltop,  ldxios = lwxios )
          CALL iom_rstput( iter, nitrst, numriw, 'frc_volbot' , frc_volbot,  ldxios = lwxios )
Index: NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icedyn_adv_pra.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icedyn_adv_pra.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icedyn_adv_pra.F90	(revision 13871)
@@ -955,49 +955,49 @@
          !
          IF( id1 > 0 ) THEN                     !**  Read the restart file  **!
-            IF(lrixios) CALL iom_swap(crixios_context)
+            IF(lrxios) CALL iom_swap(cr_icerst_cxt)
             !
             !                                                        ! ice thickness
-            CALL iom_get( numrir, jpdom_auto, 'sxice' , sxice , psgn = -1._wp, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'syice' , syice , psgn = -1._wp, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'sxxice', sxxice, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'syyice', syyice, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'sxyice', sxyice, ldxios = lrixios )
+            CALL iom_get( numrir, jpdom_auto, 'sxice' , sxice , psgn = -1._wp, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'syice' , syice , psgn = -1._wp, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'sxxice', sxxice, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'syyice', syyice, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'sxyice', sxyice, ldxios = lrxios )
             !                                                        ! snow thickness
-            CALL iom_get( numrir, jpdom_auto, 'sxsn'  , sxsn  , psgn = -1._wp, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'sysn'  , sysn  , psgn = -1._wp, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'sxxsn' , sxxsn, ldxios = lrixios  )
-            CALL iom_get( numrir, jpdom_auto, 'syysn' , syysn, ldxios = lrixios  )
-            CALL iom_get( numrir, jpdom_auto, 'sxysn' , sxysn, ldxios = lrixios  )
+            CALL iom_get( numrir, jpdom_auto, 'sxsn'  , sxsn  , psgn = -1._wp, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'sysn'  , sysn  , psgn = -1._wp, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'sxxsn' , sxxsn, ldxios = lrxios  )
+            CALL iom_get( numrir, jpdom_auto, 'syysn' , syysn, ldxios = lrxios  )
+            CALL iom_get( numrir, jpdom_auto, 'sxysn' , sxysn, ldxios = lrxios  )
             !                                                        ! ice concentration
-            CALL iom_get( numrir, jpdom_auto, 'sxa'   , sxa   , psgn = -1._wp, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'sya'   , sya   , psgn = -1._wp, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'sxxa'  , sxxa, ldxios = lrixios   )
-            CALL iom_get( numrir, jpdom_auto, 'syya'  , syya, ldxios = lrixios   )
-            CALL iom_get( numrir, jpdom_auto, 'sxya'  , sxya, ldxios = lrixios   )
+            CALL iom_get( numrir, jpdom_auto, 'sxa'   , sxa   , psgn = -1._wp, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'sya'   , sya   , psgn = -1._wp, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'sxxa'  , sxxa, ldxios = lrxios   )
+            CALL iom_get( numrir, jpdom_auto, 'syya'  , syya, ldxios = lrxios   )
+            CALL iom_get( numrir, jpdom_auto, 'sxya'  , sxya, ldxios = lrxios   )
             !                                                        ! ice salinity
-            CALL iom_get( numrir, jpdom_auto, 'sxsal' , sxsal , psgn = -1._wp, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'sysal' , sysal , psgn = -1._wp, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'sxxsal', sxxsal, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'syysal', syysal, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'sxysal', sxysal, ldxios = lrixios )
+            CALL iom_get( numrir, jpdom_auto, 'sxsal' , sxsal , psgn = -1._wp, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'sysal' , sysal , psgn = -1._wp, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'sxxsal', sxxsal, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'syysal', syysal, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'sxysal', sxysal, ldxios = lrxios )
             !                                                        ! ice age
-            CALL iom_get( numrir, jpdom_auto, 'sxage' , sxage , psgn = -1._wp, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'syage' , syage , psgn = -1._wp, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'sxxage', sxxage, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'syyage', syyage, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'sxyage', sxyage, ldxios = lrixios )
+            CALL iom_get( numrir, jpdom_auto, 'sxage' , sxage , psgn = -1._wp, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'syage' , syage , psgn = -1._wp, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'sxxage', sxxage, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'syyage', syyage, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'sxyage', sxyage, ldxios = lrxios )
             !                                                        ! snow layers heat content
             DO jk = 1, nlay_s
                WRITE(zchar1,'(I2.2)') jk
                znam = 'sxc0'//'_l'//zchar1  
-               CALL iom_get( numrir, jpdom_auto, znam , z3d, psgn = -1._wp, ldxios = lrixios )   ;   sxc0 (:,:,jk,:) = z3d(:,:,:)
+               CALL iom_get( numrir, jpdom_auto, znam , z3d, psgn = -1._wp, ldxios = lrxios )   ;   sxc0 (:,:,jk,:) = z3d(:,:,:)
                znam = 'syc0'//'_l'//zchar1  
-               CALL iom_get( numrir, jpdom_auto, znam , z3d, psgn = -1._wp, ldxios = lrixios )   ;   syc0 (:,:,jk,:) = z3d(:,:,:)
+               CALL iom_get( numrir, jpdom_auto, znam , z3d, psgn = -1._wp, ldxios = lrxios )   ;   syc0 (:,:,jk,:) = z3d(:,:,:)
                znam = 'sxxc0'//'_l'//zchar1 
-               CALL iom_get( numrir, jpdom_auto, znam , z3d, ldxios = lrixios )   ;   sxxc0(:,:,jk,:) = z3d(:,:,:)
+               CALL iom_get( numrir, jpdom_auto, znam , z3d, ldxios = lrxios )   ;   sxxc0(:,:,jk,:) = z3d(:,:,:)
                znam = 'syyc0'//'_l'//zchar1 
-               CALL iom_get( numrir, jpdom_auto, znam , z3d, ldxios = lrixios )   ;   syyc0(:,:,jk,:) = z3d(:,:,:)
+               CALL iom_get( numrir, jpdom_auto, znam , z3d, ldxios = lrxios )   ;   syyc0(:,:,jk,:) = z3d(:,:,:)
                znam = 'sxyc0'//'_l'//zchar1 
-               CALL iom_get( numrir, jpdom_auto, znam , z3d, ldxios = lrixios )   ;   sxyc0(:,:,jk,:) = z3d(:,:,:)
+               CALL iom_get( numrir, jpdom_auto, znam , z3d, ldxios = lrxios )   ;   sxyc0(:,:,jk,:) = z3d(:,:,:)
             END DO
             !                                                        ! ice layers heat content
@@ -1005,28 +1005,28 @@
                WRITE(zchar1,'(I2.2)') jk
                znam = 'sxe'//'_l'//zchar1   
-               CALL iom_get( numrir, jpdom_auto, znam , z3d, psgn = -1._wp, ldxios = lrixios )   ;   sxe (:,:,jk,:) = z3d(:,:,:)
+               CALL iom_get( numrir, jpdom_auto, znam , z3d, psgn = -1._wp, ldxios = lrxios )   ;   sxe (:,:,jk,:) = z3d(:,:,:)
                znam = 'sye'//'_l'//zchar1   
-               CALL iom_get( numrir, jpdom_auto, znam , z3d, psgn = -1._wp, ldxios = lrixios )   ;   sye (:,:,jk,:) = z3d(:,:,:)
+               CALL iom_get( numrir, jpdom_auto, znam , z3d, psgn = -1._wp, ldxios = lrxios )   ;   sye (:,:,jk,:) = z3d(:,:,:)
                znam = 'sxxe'//'_l'//zchar1  
-               CALL iom_get( numrir, jpdom_auto, znam , z3d, ldxios = lrixios )   ;   sxxe(:,:,jk,:) = z3d(:,:,:)
+               CALL iom_get( numrir, jpdom_auto, znam , z3d, ldxios = lrxios )   ;   sxxe(:,:,jk,:) = z3d(:,:,:)
                znam = 'syye'//'_l'//zchar1  
-               CALL iom_get( numrir, jpdom_auto, znam , z3d, ldxios = lrixios )   ;   syye(:,:,jk,:) = z3d(:,:,:)
+               CALL iom_get( numrir, jpdom_auto, znam , z3d, ldxios = lrxios )   ;   syye(:,:,jk,:) = z3d(:,:,:)
                znam = 'sxye'//'_l'//zchar1  
-               CALL iom_get( numrir, jpdom_auto, znam , z3d, ldxios = lrixios )   ;   sxye(:,:,jk,:) = z3d(:,:,:)
+               CALL iom_get( numrir, jpdom_auto, znam , z3d, ldxios = lrxios )   ;   sxye(:,:,jk,:) = z3d(:,:,:)
             END DO
             !
             IF( ln_pnd_LEV ) THEN                                    ! melt pond fraction
                IF( iom_varid( numrir, 'sxap', ldstop = .FALSE. ) > 0 ) THEN
-                  CALL iom_get( numrir, jpdom_auto, 'sxap' , sxap , psgn = -1._wp, ldxios = lrixios )
-                  CALL iom_get( numrir, jpdom_auto, 'syap' , syap , psgn = -1._wp, ldxios = lrixios )
-                  CALL iom_get( numrir, jpdom_auto, 'sxxap', sxxap, ldxios = lrixios )
-                  CALL iom_get( numrir, jpdom_auto, 'syyap', syyap, ldxios = lrixios )
-                  CALL iom_get( numrir, jpdom_auto, 'sxyap', sxyap, ldxios = lrixios )
+                  CALL iom_get( numrir, jpdom_auto, 'sxap' , sxap , psgn = -1._wp, ldxios = lrxios )
+                  CALL iom_get( numrir, jpdom_auto, 'syap' , syap , psgn = -1._wp, ldxios = lrxios )
+                  CALL iom_get( numrir, jpdom_auto, 'sxxap', sxxap, ldxios = lrxios )
+                  CALL iom_get( numrir, jpdom_auto, 'syyap', syyap, ldxios = lrxios )
+                  CALL iom_get( numrir, jpdom_auto, 'sxyap', sxyap, ldxios = lrxios )
                   !                                                     ! melt pond volume
-                  CALL iom_get( numrir, jpdom_auto, 'sxvp' , sxvp , psgn = -1._wp, ldxios = lrixios )
-                  CALL iom_get( numrir, jpdom_auto, 'syvp' , syvp , psgn = -1._wp, ldxios = lrixios )
-                  CALL iom_get( numrir, jpdom_auto, 'sxxvp', sxxvp, ldxios = lrixios )
-                  CALL iom_get( numrir, jpdom_auto, 'syyvp', syyvp, ldxios = lrixios )
-                  CALL iom_get( numrir, jpdom_auto, 'sxyvp', sxyvp, ldxios = lrixios )
+                  CALL iom_get( numrir, jpdom_auto, 'sxvp' , sxvp , psgn = -1._wp, ldxios = lrxios )
+                  CALL iom_get( numrir, jpdom_auto, 'syvp' , syvp , psgn = -1._wp, ldxios = lrxios )
+                  CALL iom_get( numrir, jpdom_auto, 'sxxvp', sxxvp, ldxios = lrxios )
+                  CALL iom_get( numrir, jpdom_auto, 'syyvp', syyvp, ldxios = lrxios )
+                  CALL iom_get( numrir, jpdom_auto, 'sxyvp', sxyvp, ldxios = lrxios )
                ELSE
                   sxap = 0._wp ;   syap = 0._wp    ;   sxxap = 0._wp    ;   syyap = 0._wp    ;   sxyap = 0._wp   ! melt pond fraction
@@ -1036,9 +1036,9 @@
                IF ( ln_pnd_lids ) THEN                               ! melt pond lid volume
                   IF( iom_varid( numrir, 'sxvl', ldstop = .FALSE. ) > 0 ) THEN
-                     CALL iom_get( numrir, jpdom_auto, 'sxvl' , sxvl , psgn = -1._wp, ldxios = lrixios )
-                     CALL iom_get( numrir, jpdom_auto, 'syvl' , syvl , psgn = -1._wp, ldxios = lrixios )
-                     CALL iom_get( numrir, jpdom_auto, 'sxxvl', sxxvl, ldxios = lrixios )
-                     CALL iom_get( numrir, jpdom_auto, 'syyvl', syyvl, ldxios = lrixios )
-                     CALL iom_get( numrir, jpdom_auto, 'sxyvl', sxyvl, ldxios = lrixios )
+                     CALL iom_get( numrir, jpdom_auto, 'sxvl' , sxvl , psgn = -1._wp, ldxios = lrxios )
+                     CALL iom_get( numrir, jpdom_auto, 'syvl' , syvl , psgn = -1._wp, ldxios = lrxios )
+                     CALL iom_get( numrir, jpdom_auto, 'sxxvl', sxxvl, ldxios = lrxios )
+                     CALL iom_get( numrir, jpdom_auto, 'syyvl', syyvl, ldxios = lrxios )
+                     CALL iom_get( numrir, jpdom_auto, 'sxyvl', sxyvl, ldxios = lrxios )
                   ELSE
                      sxvl = 0._wp; syvl = 0._wp    ;   sxxvl = 0._wp    ;   syyvl = 0._wp    ;   sxyvl = 0._wp   ! melt pond lid volume
@@ -1046,5 +1046,5 @@
                ENDIF
             ENDIF
-            IF(lrixios) CALL iom_swap(cxios_context)
+            IF(lrxios) CALL iom_swap(cxios_context)
             !
          ELSE                                   !**  start rheology from rest  **!
@@ -1079,5 +1079,5 @@
          !
          !                                                           ! ice thickness
-         IF( lwxios ) CALL iom_swap(      cwixios_context         )
+         IF( lwxios ) CALL iom_swap(      cw_icerst_cxt         )
          CALL iom_rstput( iter, nitrst, numriw, 'sxice' , sxice,  ldxios = lwxios)
          CALL iom_rstput( iter, nitrst, numriw, 'syice' , syice,  ldxios = lwxios)
Index: NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icedyn_rhg_evp.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icedyn_rhg_evp.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icedyn_rhg_evp.F90	(revision 13871)
@@ -1005,5 +1005,5 @@
          IF( ln_rstart ) THEN                   !* Read the restart file
             !
-            IF(lrixios) CALL iom_swap(crixios_context)
+            IF(lrxios) CALL iom_swap(cr_icerst_cxt)
             id1 = iom_varid( numrir, 'stress1_i' , ldstop = .FALSE. )
             id2 = iom_varid( numrir, 'stress2_i' , ldstop = .FALSE. )
@@ -1011,7 +1011,7 @@
             !
             IF( MIN( id1, id2, id3 ) > 0 ) THEN      ! fields exist
-               CALL iom_get( numrir, jpdom_auto, 'stress1_i' , stress1_i , cd_type = 'T', ldxios = lrixios )
-               CALL iom_get( numrir, jpdom_auto, 'stress2_i' , stress2_i , cd_type = 'T', ldxios = lrixios )
-               CALL iom_get( numrir, jpdom_auto, 'stress12_i', stress12_i, cd_type = 'F', ldxios = lrixios )
+               CALL iom_get( numrir, jpdom_auto, 'stress1_i' , stress1_i , cd_type = 'T', ldxios = lrxios )
+               CALL iom_get( numrir, jpdom_auto, 'stress2_i' , stress2_i , cd_type = 'T', ldxios = lrxios )
+               CALL iom_get( numrir, jpdom_auto, 'stress12_i', stress12_i, cd_type = 'F', ldxios = lrxios )
             ELSE                                     ! start rheology from rest
                IF(lwp) WRITE(numout,*)
@@ -1021,5 +1021,5 @@
                stress12_i(:,:) = 0._wp
             ENDIF
-            IF(lrixios) CALL iom_swap(cxios_context)
+            IF(lrxios) CALL iom_swap(cxios_context)
          ELSE                                   !* Start from rest
             IF(lwp) WRITE(numout,*)
@@ -1035,5 +1035,5 @@
          iter = kt + nn_fsbc - 1             ! ice restarts are written at kt == nitrst - nn_fsbc + 1
          !
-         IF( lwxios ) CALL iom_swap(      cwixios_context         )
+         IF( lwxios ) CALL iom_swap(      cw_icerst_cxt         )
          CALL iom_rstput( iter, nitrst, numriw, 'stress1_i' , stress1_i,  ldxios = lwxios )
          CALL iom_rstput( iter, nitrst, numriw, 'stress2_i' , stress2_i,  ldxios = lwxios )
Index: NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icerst.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icerst.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icerst.F90	(revision 13871)
@@ -89,5 +89,5 @@
             ELSE
 #if defined key_iomput
-               cwixios_context = "rstwi_"//TRIM(ADJUSTL(clkt))
+               cw_icerst_cxt = "rstwi_"//TRIM(ADJUSTL(clkt))
                IF( TRIM(Agrif_CFixed()) == '0' ) THEN
                   clpname = clname
@@ -95,5 +95,5 @@
                   clpname = TRIM(Agrif_CFixed())//"_"//clname
                ENDIF
-               CALL iom_init( cwixios_context, fname = TRIM(clpath)//TRIM(clpname), ld_closedef = .FALSE. )
+               CALL iom_init( cw_icerst_cxt, fname = TRIM(clpath)//TRIM(clpname), ld_closedef = .FALSE. )
                CALL iom_swap(      cxios_context          )
 #else
@@ -138,5 +138,5 @@
       ! ------------------ 
       !                                                                        ! calendar control
-      IF( lwxios ) CALL iom_swap(      cwixios_context         )
+      IF( lwxios ) CALL iom_swap(      cw_icerst_cxt         )
       CALL iom_rstput( iter, nitrst, numriw, 'nn_fsbc', REAL( nn_fsbc, wp ), ldxios = lwxios )      ! time-step 
       CALL iom_rstput( iter, nitrst, numriw, 'kt_ice' , REAL( iter   , wp ), ldxios = lwxios )      ! date
@@ -183,5 +183,5 @@
             CALL iom_close( numriw )
          ELSE
-            CALL iom_context_finalize(      cwixios_context          )
+            CALL iom_context_finalize(      cw_icerst_cxt          )
          ENDIF
          lrst_ice = .FALSE.
@@ -217,7 +217,6 @@
       CALL iom_open ( TRIM(cn_icerst_indir)//'/'//cn_icerst_in, numrir )
 
-      lrixios = lrxios.AND.lxios_sini
-      IF( lrixios) THEN
-          crixios_context = 'si3_rst'
+      IF( lrxios) THEN
+          cr_icerst_cxt = 'si3_rst'
           IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS for SI3'
           IF( TRIM(Agrif_CFixed()) == '0' ) THEN
@@ -226,5 +225,5 @@
              clpname = TRIM(Agrif_CFixed())//"_"//cn_icerst_in   
           ENDIF
-          CALL iom_init( crixios_context, fname = TRIM(cn_icerst_indir)//'/'//TRIM(clpname), &
+          CALL iom_init( cr_icerst_cxt, fname = TRIM(cn_icerst_indir)//'/'//TRIM(clpname), &
                                           idfp = iom_file(numrir)%nfid, ld_closedef = .TRUE. )
       ENDIF
@@ -236,8 +235,8 @@
       IF( id0 > 0 ) THEN   ! == case of a normal restart == !
          !                 ! ------------------------------ !
-         IF(lrixios) CALL iom_swap(crixios_context) 
+         IF(lrxios) CALL iom_swap(cr_icerst_cxt) 
          ! Time info
-         CALL iom_get( numrir, 'nn_fsbc', zfice, ldxios = lrixios )
-         CALL iom_get( numrir, 'kt_ice' , ziter, ldxios = lrixios )    
+         CALL iom_get( numrir, 'nn_fsbc', zfice, ldxios = lrxios )
+         CALL iom_get( numrir, 'kt_ice' , ziter, ldxios = lrxios )    
          IF(lwp) WRITE(numout,*) '   read ice restart file at time step    : ', ziter
          IF(lwp) WRITE(numout,*) '   in any case we force it to nit000 - 1 : ', nit000 - 1
@@ -254,16 +253,16 @@
 
          ! --- mandatory fields --- ! 
-         CALL iom_get( numrir, jpdom_auto, 'v_i'  , v_i  , ldxios = lrixios )
-         CALL iom_get( numrir, jpdom_auto, 'v_s'  , v_s  , ldxios = lrixios )
-         CALL iom_get( numrir, jpdom_auto, 'sv_i' , sv_i , ldxios = lrixios )
-         CALL iom_get( numrir, jpdom_auto, 'a_i'  , a_i  , ldxios = lrixios )
-         CALL iom_get( numrir, jpdom_auto, 't_su' , t_su , ldxios = lrixios )
-         CALL iom_get( numrir, jpdom_auto, 'u_ice', u_ice, cd_type = 'U', psgn = -1._wp, ldxios = lrixios )
-         CALL iom_get( numrir, jpdom_auto, 'v_ice', v_ice, cd_type = 'V', psgn = -1._wp, ldxios = lrixios )
+         CALL iom_get( numrir, jpdom_auto, 'v_i'  , v_i  , ldxios = lrxios )
+         CALL iom_get( numrir, jpdom_auto, 'v_s'  , v_s  , ldxios = lrxios )
+         CALL iom_get( numrir, jpdom_auto, 'sv_i' , sv_i , ldxios = lrxios )
+         CALL iom_get( numrir, jpdom_auto, 'a_i'  , a_i  , ldxios = lrxios )
+         CALL iom_get( numrir, jpdom_auto, 't_su' , t_su , ldxios = lrxios )
+         CALL iom_get( numrir, jpdom_auto, 'u_ice', u_ice, cd_type = 'U', psgn = -1._wp, ldxios = lrxios )
+         CALL iom_get( numrir, jpdom_auto, 'v_ice', v_ice, cd_type = 'V', psgn = -1._wp, ldxios = lrxios )
          ! Snow enthalpy
          DO jk = 1, nlay_s
             WRITE(zchar1,'(I2.2)') jk
             znam = 'e_s'//'_l'//zchar1
-            CALL iom_get( numrir, jpdom_auto, znam , z3d, ldxios = lrixios )
+            CALL iom_get( numrir, jpdom_auto, znam , z3d, ldxios = lrxios )
             e_s(:,:,jk,:) = z3d(:,:,:)
          END DO
@@ -272,5 +271,5 @@
             WRITE(zchar1,'(I2.2)') jk
             znam = 'e_i'//'_l'//zchar1
-            CALL iom_get( numrir, jpdom_auto, znam , z3d, ldxios = lrixios )
+            CALL iom_get( numrir, jpdom_auto, znam , z3d, ldxios = lrxios )
             e_i(:,:,jk,:) = z3d(:,:,:)
          END DO
@@ -279,5 +278,5 @@
          id1 = iom_varid( numrir, 'oa_i' , ldstop = .FALSE. )
          IF( id1 > 0 ) THEN                       ! fields exist
-            CALL iom_get( numrir, jpdom_auto, 'oa_i', oa_i, ldxios = lrixios )
+            CALL iom_get( numrir, jpdom_auto, 'oa_i', oa_i, ldxios = lrxios )
          ELSE                                     ! start from rest
             IF(lwp) WRITE(numout,*) '   ==>>   previous run without ice age output then set it to zero'
@@ -287,6 +286,6 @@
          id2 = iom_varid( numrir, 'a_ip' , ldstop = .FALSE. )
          IF( id2 > 0 ) THEN                       ! fields exist
-            CALL iom_get( numrir, jpdom_auto, 'a_ip' , a_ip, ldxios = lrixios )
-            CALL iom_get( numrir, jpdom_auto, 'v_ip' , v_ip, ldxios = lrixios )
+            CALL iom_get( numrir, jpdom_auto, 'a_ip' , a_ip, ldxios = lrxios )
+            CALL iom_get( numrir, jpdom_auto, 'v_ip' , v_ip, ldxios = lrxios )
          ELSE                                     ! start from rest
             IF(lwp) WRITE(numout,*) '   ==>>   previous run without melt ponds output then set it to zero'
@@ -297,5 +296,5 @@
          id3 = iom_varid( numrir, 'v_il' , ldstop = .FALSE. )
          IF( id3 > 0 ) THEN
-            CALL iom_get( numrir, jpdom_auto, 'v_il', v_il, ldxios = lrixios)
+            CALL iom_get( numrir, jpdom_auto, 'v_il', v_il, ldxios = lrxios)
          ELSE
             IF(lwp) WRITE(numout,*) '   ==>>   previous run without melt ponds lids output then set it to zero'
@@ -307,6 +306,6 @@
             id5 = iom_varid( numrir, 't1_ice'  , ldstop = .FALSE. )
             IF( id4 > 0 .AND. id5 > 0 ) THEN         ! fields exist
-               CALL iom_get( numrir, jpdom_auto, 'cnd_ice', cnd_ice, ldxios = lrixios )
-               CALL iom_get( numrir, jpdom_auto, 't1_ice' , t1_ice , ldxios = lrixios )
+               CALL iom_get( numrir, jpdom_auto, 'cnd_ice', cnd_ice, ldxios = lrxios )
+               CALL iom_get( numrir, jpdom_auto, 't1_ice' , t1_ice , ldxios = lrxios )
             ELSE                                     ! start from rest
                IF(lwp) WRITE(numout,*) '   ==>>   previous run without conductivity output then set it to zero'
@@ -317,5 +316,5 @@
 
          CALL iom_delay_rst( 'READ', 'ICE', numrir )   ! read only ice delayed global communication variables
-         IF(lrixios) CALL iom_swap(cxios_context)
+         IF(lrxios) CALL iom_swap(cxios_context)
          !                 ! ---------------------------------- !
       ELSE                 ! == case of a simplified restart == !
Index: NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icestp.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icestp.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/ICE/icestp.F90	(revision 13871)
@@ -293,5 +293,5 @@
       IF( ln_rstart )  THEN
           CALL iom_close( numrir )  ! close input ice restart file
-          IF(lrixios) CALL iom_context_finalize(      crixios_context         )
+          IF(lrxios) CALL iom_context_finalize(      cr_icerst_cxt         )
       ENDIF
       !
Index: NEMO/branches/2020/dev_12905_xios_restart/src/ICE/iceupdate.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/ICE/iceupdate.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/ICE/iceupdate.F90	(revision 13871)
@@ -427,8 +427,8 @@
             !
             IF( id1 > 0 ) THEN                       ! fields exist
-               IF(lrixios) CALL iom_swap(crixios_context)
-               CALL iom_get( numrir, jpdom_auto, 'snwice_mass'  , snwice_mass  , ldxios = lrixios )
-               CALL iom_get( numrir, jpdom_auto, 'snwice_mass_b', snwice_mass_b, ldxios = lrixios )
-               IF(lrixios) CALL iom_swap(cxios_context)
+               IF(lrxios) CALL iom_swap(cr_icerst_cxt)
+               CALL iom_get( numrir, jpdom_auto, 'snwice_mass'  , snwice_mass  , ldxios = lrxios )
+               CALL iom_get( numrir, jpdom_auto, 'snwice_mass_b', snwice_mass_b, ldxios = lrxios )
+               IF(lrxios) CALL iom_swap(cxios_context)
             ELSE                                     ! start from rest
                IF(lwp) WRITE(numout,*) '   ==>>   previous run without snow-ice mass output then set it'
@@ -447,5 +447,5 @@
          iter = kt + nn_fsbc - 1             ! ice restarts are written at kt == nitrst - nn_fsbc + 1
          !
-         IF( lwxios ) CALL iom_swap(      cwixios_context         )
+         IF( lwxios ) CALL iom_swap(      cw_icerst_cxt         )
          CALL iom_rstput( iter, nitrst, numriw, 'snwice_mass'  , snwice_mass,   ldxios = lwxios )
          CALL iom_rstput( iter, nitrst, numriw, 'snwice_mass_b', snwice_mass_b, ldxios = lwxios )
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/DIA/diahsb.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/DIA/diahsb.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/DIA/diahsb.F90	(revision 13871)
@@ -267,23 +267,23 @@
             IF(lwp) WRITE(numout,*) '   dia_hsb_rst : read hsb restart at it= ', kt,' date= ', ndastp
             IF(lwp) WRITE(numout,*)
-            IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
-            CALL iom_get( numror, 'frc_v', frc_v, ldxios = lroxios )
-            CALL iom_get( numror, 'frc_t', frc_t, ldxios = lroxios )
-            CALL iom_get( numror, 'frc_s', frc_s, ldxios = lroxios )
+            IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
+            CALL iom_get( numror, 'frc_v', frc_v, ldxios = lrxios )
+            CALL iom_get( numror, 'frc_t', frc_t, ldxios = lrxios )
+            CALL iom_get( numror, 'frc_s', frc_s, ldxios = lrxios )
             IF( ln_linssh ) THEN
-               CALL iom_get( numror, 'frc_wn_t', frc_wn_t, ldxios = lroxios )
-               CALL iom_get( numror, 'frc_wn_s', frc_wn_s, ldxios = lroxios )
+               CALL iom_get( numror, 'frc_wn_t', frc_wn_t, ldxios = lrxios )
+               CALL iom_get( numror, 'frc_wn_s', frc_wn_s, ldxios = lrxios )
             ENDIF
-            CALL iom_get( numror, jpdom_auto, 'surf_ini'  , surf_ini  , ldxios = lroxios ) ! ice sheet coupling
-            CALL iom_get( numror, jpdom_auto, 'ssh_ini'   , ssh_ini   , ldxios = lroxios )
-            CALL iom_get( numror, jpdom_auto, 'e3t_ini'   , e3t_ini   , ldxios = lroxios )
-            CALL iom_get( numror, jpdom_auto, 'tmask_ini' , tmask_ini , ldxios = lroxios )
-            CALL iom_get( numror, jpdom_auto, 'hc_loc_ini', hc_loc_ini, ldxios = lroxios )
-            CALL iom_get( numror, jpdom_auto, 'sc_loc_ini', sc_loc_ini, ldxios = lroxios )
+            CALL iom_get( numror, jpdom_auto, 'surf_ini'  , surf_ini  , ldxios = lrxios ) ! ice sheet coupling
+            CALL iom_get( numror, jpdom_auto, 'ssh_ini'   , ssh_ini   , ldxios = lrxios )
+            CALL iom_get( numror, jpdom_auto, 'e3t_ini'   , e3t_ini   , ldxios = lrxios )
+            CALL iom_get( numror, jpdom_auto, 'tmask_ini' , tmask_ini , ldxios = lrxios )
+            CALL iom_get( numror, jpdom_auto, 'hc_loc_ini', hc_loc_ini, ldxios = lrxios )
+            CALL iom_get( numror, jpdom_auto, 'sc_loc_ini', sc_loc_ini, ldxios = lrxios )
             IF( ln_linssh ) THEN
-               CALL iom_get( numror, jpdom_auto, 'ssh_hc_loc_ini', ssh_hc_loc_ini, ldxios = lroxios )
-               CALL iom_get( numror, jpdom_auto, 'ssh_sc_loc_ini', ssh_sc_loc_ini, ldxios = lroxios )
+               CALL iom_get( numror, jpdom_auto, 'ssh_hc_loc_ini', ssh_hc_loc_ini, ldxios = lrxios )
+               CALL iom_get( numror, jpdom_auto, 'ssh_sc_loc_ini', ssh_sc_loc_ini, ldxios = lrxios )
             ENDIF
-            IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+            IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
          ELSE
             IF(lwp) WRITE(numout,*)
@@ -325,5 +325,5 @@
          IF(lwp) WRITE(numout,*)
          !
-         IF( lwxios ) CALL iom_swap(      cwxios_context          )
+         IF( lwxios ) CALL iom_swap(      cw_ocerst_cxt          )
          CALL iom_rstput( kt, nitrst, numrow, 'frc_v', frc_v, ldxios = lwxios )
          CALL iom_rstput( kt, nitrst, numrow, 'frc_t', frc_t, ldxios = lwxios )
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/DOM/daymod.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/DOM/daymod.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/DOM/daymod.F90	(revision 13871)
@@ -316,8 +316,8 @@
 
       IF( TRIM(cdrw) == 'READ' ) THEN
-         IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
+         IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
          IF( iom_varid( numror, 'kt', ldstop = .FALSE. ) > 0 ) THEN
             ! Get Calendar informations
-            CALL iom_get( numror, 'kt', zkt, ldxios = lroxios )   ! last time-step of previous run
+            CALL iom_get( numror, 'kt', zkt, ldxios = lrxios )   ! last time-step of previous run
             IF(lwp) THEN
                WRITE(numout,*) ' *** Info read in restart : '
@@ -338,8 +338,8 @@
             IF ( nrstdt == 2 ) THEN
                ! read the parameters corresponding to nit000 - 1 (last time step of previous run)
-               CALL iom_get( numror, 'ndastp', zndastp, ldxios = lroxios )
+               CALL iom_get( numror, 'ndastp', zndastp, ldxios = lrxios )
                ndastp = NINT( zndastp )
-               CALL iom_get( numror, 'adatrj', adatrj , ldxios = lroxios )
-	       CALL iom_get( numror, 'ntime' , ktime  , ldxios = lroxios )
+               CALL iom_get( numror, 'adatrj', adatrj , ldxios = lrxios )
+	       CALL iom_get( numror, 'ntime' , ktime  , ldxios = lrxios )
                nn_time0 = NINT(ktime)
                ! calculate start time in hours and minutes
@@ -384,5 +384,5 @@
             adatrj = ( REAL( nit000-1, wp ) * rn_Dt ) / rday
          ENDIF
-         IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+         IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
          IF( ABS(adatrj  - REAL(NINT(adatrj),wp)) < 0.1 / rday )   adatrj = REAL(NINT(adatrj),wp)   ! avoid truncation error
          !
@@ -403,5 +403,5 @@
          ENDIF
          ! calendar control
-         IF( lwxios ) CALL iom_swap(      cwxios_context          )
+         IF( lwxios ) CALL iom_swap(      cw_ocerst_cxt          )
          CALL iom_rstput( kt, nitrst, numrow, 'kt'     , REAL( kt    , wp)  , ldxios = lwxios )   ! time-step
          CALL iom_rstput( kt, nitrst, numrow, 'ndastp' , REAL( ndastp, wp)  , ldxios = lwxios )   ! date
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/DOM/domvvl.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/DOM/domvvl.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/DOM/domvvl.F90	(revision 13871)
@@ -785,6 +785,6 @@
          IF( ln_rstart ) THEN                   !* Read the restart file
             CALL rst_read_open                  !  open the restart file if necessary
-            IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
-            CALL iom_get( numror, jpdom_auto, 'sshn'   , ssh(:,:,Kmm), ldxios = lroxios    )
+            IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
+            CALL iom_get( numror, jpdom_auto, 'sshn'   , ssh(:,:,Kmm), ldxios = lrxios    )
             !
             id1 = iom_varid( numror, 'e3t_b', ldstop = .FALSE. )
@@ -799,6 +799,6 @@
             !
             IF( MIN( id1, id2 ) > 0 ) THEN       ! all required arrays exist
-               CALL iom_get( numror, jpdom_auto, 'e3t_b', e3t(:,:,:,Kbb), ldxios = lroxios )
-               CALL iom_get( numror, jpdom_auto, 'e3t_n', e3t(:,:,:,Kmm), ldxios = lroxios )
+               CALL iom_get( numror, jpdom_auto, 'e3t_b', e3t(:,:,:,Kbb), ldxios = lrxios )
+               CALL iom_get( numror, jpdom_auto, 'e3t_n', e3t(:,:,:,Kmm), ldxios = lrxios )
                ! needed to restart if land processor not computed 
                IF(lwp) write(numout,*) 'dom_vvl_rst : e3t(:,:,:,Kbb) and e3t(:,:,:,Kmm) found in restart files'
@@ -814,5 +814,5 @@
                IF(lwp) write(numout,*) 'e3t_n set equal to e3t_b.'
                IF(lwp) write(numout,*) 'l_1st_euler is forced to true'
-               CALL iom_get( numror, jpdom_auto, 'e3t_b', e3t(:,:,:,Kbb), ldxios = lroxios )
+               CALL iom_get( numror, jpdom_auto, 'e3t_b', e3t(:,:,:,Kbb), ldxios = lrxios )
                e3t(:,:,:,Kmm) = e3t(:,:,:,Kbb)
                l_1st_euler = .true.
@@ -821,5 +821,5 @@
                IF(lwp) write(numout,*) 'e3t_b set equal to e3t_n.'
                IF(lwp) write(numout,*) 'l_1st_euler is forced to true'
-               CALL iom_get( numror, jpdom_auto, 'e3t_n', e3t(:,:,:,Kmm), ldxios = lroxios )
+               CALL iom_get( numror, jpdom_auto, 'e3t_n', e3t(:,:,:,Kmm), ldxios = lrxios )
                e3t(:,:,:,Kbb) = e3t(:,:,:,Kmm)
                l_1st_euler = .true.
@@ -846,6 +846,6 @@
                !                          ! ----------------------- !
                IF( MIN( id3, id4 ) > 0 ) THEN  ! all required arrays exist
-                  CALL iom_get( numror, jpdom_auto, 'tilde_e3t_b', tilde_e3t_b(:,:,:), ldxios = lroxios )
-                  CALL iom_get( numror, jpdom_auto, 'tilde_e3t_n', tilde_e3t_n(:,:,:), ldxios = lroxios )
+                  CALL iom_get( numror, jpdom_auto, 'tilde_e3t_b', tilde_e3t_b(:,:,:), ldxios = lrxios )
+                  CALL iom_get( numror, jpdom_auto, 'tilde_e3t_n', tilde_e3t_n(:,:,:), ldxios = lrxios )
                ELSE                            ! one at least array is missing
                   tilde_e3t_b(:,:,:) = 0.0_wp
@@ -856,5 +856,5 @@
                   !                       ! ------------ !
                   IF( id5 > 0 ) THEN  ! required array exists
-                     CALL iom_get( numror, jpdom_auto, 'hdiv_lf', hdiv_lf(:,:,:), ldxios = lroxios )
+                     CALL iom_get( numror, jpdom_auto, 'hdiv_lf', hdiv_lf(:,:,:), ldxios = lrxios )
                   ELSE                ! array is missing
                      hdiv_lf(:,:,:) = 0.0_wp
@@ -862,5 +862,5 @@
                ENDIF
             ENDIF
-            IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+            IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
             !
          ELSE                                   !* Initialize at "rest"
@@ -930,5 +930,5 @@
          !                                   ! ===================
          IF(lwp) WRITE(numout,*) '---- dom_vvl_rst ----'
-         IF( lwxios ) CALL iom_swap(      cwxios_context          )
+         IF( lwxios ) CALL iom_swap(      cw_ocerst_cxt          )
          !                                           ! --------- !
          !                                           ! all cases !
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/DYN/dynspg_ts.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/DYN/dynspg_ts.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/DYN/dynspg_ts.F90	(revision 13871)
@@ -899,23 +899,23 @@
       IF( TRIM(cdrw) == 'READ' ) THEN        ! Read/initialise 
          !                                   ! ---------------
-         IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
+         IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
          IF( ln_rstart .AND. ln_bt_fw .AND. (.NOT.l_1st_euler) ) THEN    !* Read the restart file
-            CALL iom_get( numror, jpdom_auto, 'ub2_b'  , ub2_b  (:,:), cd_type = 'U', psgn = -1._wp, ldxios = lroxios )   
-            CALL iom_get( numror, jpdom_auto, 'vb2_b'  , vb2_b  (:,:), cd_type = 'V', psgn = -1._wp, ldxios = lroxios ) 
-            CALL iom_get( numror, jpdom_auto, 'un_bf'  , un_bf  (:,:), cd_type = 'U', psgn = -1._wp, ldxios = lroxios )   
-            CALL iom_get( numror, jpdom_auto, 'vn_bf'  , vn_bf  (:,:), cd_type = 'V', psgn = -1._wp, ldxios = lroxios ) 
+            CALL iom_get( numror, jpdom_auto, 'ub2_b'  , ub2_b  (:,:), cd_type = 'U', psgn = -1._wp, ldxios = lrxios )   
+            CALL iom_get( numror, jpdom_auto, 'vb2_b'  , vb2_b  (:,:), cd_type = 'V', psgn = -1._wp, ldxios = lrxios ) 
+            CALL iom_get( numror, jpdom_auto, 'un_bf'  , un_bf  (:,:), cd_type = 'U', psgn = -1._wp, ldxios = lrxios )   
+            CALL iom_get( numror, jpdom_auto, 'vn_bf'  , vn_bf  (:,:), cd_type = 'V', psgn = -1._wp, ldxios = lrxios ) 
             IF( .NOT.ln_bt_av ) THEN
-               CALL iom_get( numror, jpdom_auto, 'sshbb_e'  , sshbb_e(:,:), cd_type = 'T', psgn =  1._wp, ldxios = lroxios )   
-               CALL iom_get( numror, jpdom_auto, 'ubb_e'    ,   ubb_e(:,:), cd_type = 'U', psgn = -1._wp, ldxios = lroxios )   
-               CALL iom_get( numror, jpdom_auto, 'vbb_e'    ,   vbb_e(:,:), cd_type = 'V', psgn = -1._wp, ldxios = lroxios )
-               CALL iom_get( numror, jpdom_auto, 'sshb_e'   ,  sshb_e(:,:), cd_type = 'T', psgn =  1._wp, ldxios = lroxios ) 
-               CALL iom_get( numror, jpdom_auto, 'ub_e'     ,    ub_e(:,:), cd_type = 'U', psgn = -1._wp, ldxios = lroxios )   
-               CALL iom_get( numror, jpdom_auto, 'vb_e'     ,    vb_e(:,:), cd_type = 'V', psgn = -1._wp, ldxios = lroxios )
+               CALL iom_get( numror, jpdom_auto, 'sshbb_e'  , sshbb_e(:,:), cd_type = 'T', psgn =  1._wp, ldxios = lrxios )   
+               CALL iom_get( numror, jpdom_auto, 'ubb_e'    ,   ubb_e(:,:), cd_type = 'U', psgn = -1._wp, ldxios = lrxios )   
+               CALL iom_get( numror, jpdom_auto, 'vbb_e'    ,   vbb_e(:,:), cd_type = 'V', psgn = -1._wp, ldxios = lrxios )
+               CALL iom_get( numror, jpdom_auto, 'sshb_e'   ,  sshb_e(:,:), cd_type = 'T', psgn =  1._wp, ldxios = lrxios ) 
+               CALL iom_get( numror, jpdom_auto, 'ub_e'     ,    ub_e(:,:), cd_type = 'U', psgn = -1._wp, ldxios = lrxios )   
+               CALL iom_get( numror, jpdom_auto, 'vb_e'     ,    vb_e(:,:), cd_type = 'V', psgn = -1._wp, ldxios = lrxios )
             ENDIF
 #if defined key_agrif
             ! Read time integrated fluxes
             IF ( .NOT.Agrif_Root() ) THEN
-               CALL iom_get( numror, jpdom_auto, 'ub2_i_b'  , ub2_i_b(:,:), cd_type = 'U', psgn = -1._wp, ldxios = lroxios )   
-               CALL iom_get( numror, jpdom_auto, 'vb2_i_b'  , vb2_i_b(:,:), cd_type = 'V', psgn = -1._wp, ldxios = lroxios )
+               CALL iom_get( numror, jpdom_auto, 'ub2_i_b'  , ub2_i_b(:,:), cd_type = 'U', psgn = -1._wp, ldxios = lrxios )   
+               CALL iom_get( numror, jpdom_auto, 'vb2_i_b'  , vb2_i_b(:,:), cd_type = 'V', psgn = -1._wp, ldxios = lrxios )
             ELSE
                ub2_i_b(:,:) = 0._wp   ;   vb2_i_b(:,:) = 0._wp   ! used in the 1st update of agrif
@@ -932,10 +932,10 @@
 #endif
          ENDIF
-         IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+         IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
          !
       ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN   ! Create restart file
          !                                   ! -------------------
          IF(lwp) WRITE(numout,*) '---- ts_rst ----'
-         IF( lwxios ) CALL iom_swap(      cwxios_context          )
+         IF( lwxios ) CALL iom_swap(      cw_ocerst_cxt          )
          CALL iom_rstput( kt, nitrst, numrow, 'ub2_b'   , ub2_b  (:,:), ldxios = lwxios )
          CALL iom_rstput( kt, nitrst, numrow, 'vb2_b'   , vb2_b  (:,:), ldxios = lwxios )
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/IOM/in_out_manager.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/IOM/in_out_manager.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/IOM/in_out_manager.F90	(revision 13871)
@@ -166,12 +166,12 @@
    LOGICAL       ::   lsp_area = .TRUE.     !: to make a control print over a specific area
    CHARACTER(LEN=lc) ::   cxios_context         !: context name used in xios
-   CHARACTER(LEN=lc) ::   crxios_context        !: context name used in xios to read OCE restart
-   CHARACTER(LEN=lc) ::   cwxios_context        !: context name used in xios to write OCE restart file
-   CHARACTER(LEN=lc) ::   crixios_context       !: context name used in xios to read SI3 restart
-   CHARACTER(LEN=lc) ::   cwixios_context       !: context name used in xios to write SI3 restart file
-   CHARACTER(LEN=lc) ::   crtxios_context       !: context name used in xios to read TOP restart
-   CHARACTER(LEN=lc) ::   cwtxios_context       !: context name used in xios to write TOP restart file
-   CHARACTER(LEN=lc) ::   crsxios_context       !: context name used in xios to read SEDIMENT restart
-   CHARACTER(LEN=lc) ::   cwsxios_context       !: context name used in xios to write SEDIMENT restart file
+   CHARACTER(LEN=lc) ::   cr_ocerst_cxt        !: context name used in xios to read OCE restart
+   CHARACTER(LEN=lc) ::   cw_ocerst_cxt        !: context name used in xios to write OCE restart file
+   CHARACTER(LEN=lc) ::   cr_icerst_cxt       !: context name used in xios to read SI3 restart
+   CHARACTER(LEN=lc) ::   cw_icerst_cxt       !: context name used in xios to write SI3 restart file
+   CHARACTER(LEN=lc) ::   cr_toprst_cxt       !: context name used in xios to read TOP restart
+   CHARACTER(LEN=lc) ::   cw_toprst_cxt       !: context name used in xios to write TOP restart file
+   CHARACTER(LEN=lc) ::   cr_sedrst_cxt       !: context name used in xios to read SEDIMENT restart
+   CHARACTER(LEN=lc) ::   cw_sedrst_cxt       !: context name used in xios to write SEDIMENT restart file
 
 
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/IOM/iom.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/IOM/iom.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/IOM/iom.F90	(revision 13871)
@@ -141,11 +141,11 @@
       CALL iom_swap( cdname )
 
-      llrstr = (TRIM(cdname) == TRIM(crxios_context)) .OR. (TRIM(cdname) == TRIM(crixios_context))
-      llrstr = llrstr .OR. (TRIM(cdname) == TRIM(crtxios_context))
-      llrstr = llrstr .OR. (TRIM(cdname) == TRIM(crsxios_context))
-
-      llrstw = (TRIM(cdname) == TRIM(cwxios_context)) .OR. (TRIM(cdname) == TRIM(cwixios_context))
-      llrstw = llrstw .OR. (TRIM(cdname) == TRIM(cwtxios_context))
-      llrstw = llrstw .OR. (TRIM(cdname) == TRIM(cwsxios_context))
+      llrstr = (cdname == cr_ocerst_cxt) .OR. (cdname == cr_icerst_cxt)
+      llrstr = llrstr .OR. (cdname == cr_toprst_cxt)
+      llrstr = llrstr .OR. (cdname == cr_sedrst_cxt)
+
+      llrstw = (cdname == cw_ocerst_cxt) .OR. (cdname == cw_icerst_cxt)
+      llrstw = llrstw .OR. (cdname == cw_toprst_cxt)
+      llrstw = llrstw .OR. (cdname == cw_sedrst_cxt)
 
       llrst_context = llrstr .OR. llrstw
@@ -168,5 +168,5 @@
       IF(.NOT.llrst_context) CALL set_scalar
       !
-      IF( TRIM(cdname) == TRIM(cxios_context) ) THEN  
+      IF( cdname == cxios_context ) THEN  
          CALL set_grid( "T", glamt, gphit, .FALSE., .FALSE. ) 
          CALL set_grid( "U", glamu, gphiu, .FALSE., .FALSE. )
@@ -212,70 +212,70 @@
       ! vertical grid definition
       IF(.NOT.llrst_context) THEN
-          CALL iom_set_axis_attr(  "deptht", paxis = gdept_1d )
-          CALL iom_set_axis_attr(  "depthu", paxis = gdept_1d )
-          CALL iom_set_axis_attr(  "depthv", paxis = gdept_1d )
-          CALL iom_set_axis_attr(  "depthw", paxis = gdepw_1d )
+         CALL iom_set_axis_attr(  "deptht", paxis = gdept_1d )
+         CALL iom_set_axis_attr(  "depthu", paxis = gdept_1d )
+         CALL iom_set_axis_attr(  "depthv", paxis = gdept_1d )
+         CALL iom_set_axis_attr(  "depthw", paxis = gdepw_1d )
 
           ! ABL
-          IF( .NOT. ALLOCATED(ght_abl) ) THEN   ! force definition for xml files (xios) 
-             ALLOCATE( ght_abl(jpka), ghw_abl(jpka), e3t_abl(jpka), e3w_abl(jpka) )   ! default allocation needed by iom
-             ght_abl(:) = -1._wp   ;   ghw_abl(:) = -1._wp
-             e3t_abl(:) = -1._wp   ;   e3w_abl(:) = -1._wp
-          ENDIF
-          CALL iom_set_axis_attr( "ght_abl", ght_abl(2:jpka) )
-          CALL iom_set_axis_attr( "ghw_abl", ghw_abl(2:jpka) )
+         IF( .NOT. ALLOCATED(ght_abl) ) THEN   ! force definition for xml files (xios) 
+            ALLOCATE( ght_abl(jpka), ghw_abl(jpka), e3t_abl(jpka), e3w_abl(jpka) )   ! default allocation needed by iom
+            ght_abl(:) = -1._wp   ;   ghw_abl(:) = -1._wp
+            e3t_abl(:) = -1._wp   ;   e3w_abl(:) = -1._wp
+         ENDIF
+         CALL iom_set_axis_attr( "ght_abl", ght_abl(2:jpka) )
+         CALL iom_set_axis_attr( "ghw_abl", ghw_abl(2:jpka) )
           
-          ! Add vertical grid bounds
-          zt_bnds(2,:      ) = gdept_1d(:)
-          zt_bnds(1,2:jpk  ) = gdept_1d(1:jpkm1)
-          zt_bnds(1,1      ) = gdept_1d(1) - e3w_1d(1)
-          zw_bnds(1,:      ) = gdepw_1d(:)
-          zw_bnds(2,1:jpkm1) = gdepw_1d(2:jpk)
-          zw_bnds(2,jpk:   ) = gdepw_1d(jpk) + e3t_1d(jpk)
-          CALL iom_set_axis_attr(  "deptht", bounds=zw_bnds )
-          CALL iom_set_axis_attr(  "depthu", bounds=zw_bnds )
-          CALL iom_set_axis_attr(  "depthv", bounds=zw_bnds )
-          CALL iom_set_axis_attr(  "depthw", bounds=zt_bnds )
-
-          ! ABL
-          za_bnds(1,:) = ghw_abl(1:jpkam1)
-          za_bnds(2,:) = ghw_abl(2:jpka  )
-          CALL iom_set_axis_attr( "ght_abl", bounds=za_bnds )
-          za_bnds(1,:) = ght_abl(2:jpka  )
-          za_bnds(2,:) = ght_abl(2:jpka  ) + e3w_abl(2:jpka)
-          CALL iom_set_axis_attr( "ghw_abl", bounds=za_bnds )
-
-          CALL iom_set_axis_attr(  "nfloat", (/ (REAL(ji,wp), ji=1,jpnfl) /) )
+         ! Add vertical grid bounds
+         zt_bnds(2,:      ) = gdept_1d(:)
+         zt_bnds(1,2:jpk  ) = gdept_1d(1:jpkm1)
+         zt_bnds(1,1      ) = gdept_1d(1) - e3w_1d(1)
+         zw_bnds(1,:      ) = gdepw_1d(:)
+         zw_bnds(2,1:jpkm1) = gdepw_1d(2:jpk)
+         zw_bnds(2,jpk:   ) = gdepw_1d(jpk) + e3t_1d(jpk)
+         CALL iom_set_axis_attr(  "deptht", bounds=zw_bnds )
+         CALL iom_set_axis_attr(  "depthu", bounds=zw_bnds )
+         CALL iom_set_axis_attr(  "depthv", bounds=zw_bnds )
+         CALL iom_set_axis_attr(  "depthw", bounds=zt_bnds )
+
+         ! ABL
+         za_bnds(1,:) = ghw_abl(1:jpkam1)
+         za_bnds(2,:) = ghw_abl(2:jpka  )
+         CALL iom_set_axis_attr( "ght_abl", bounds=za_bnds )
+         za_bnds(1,:) = ght_abl(2:jpka  )
+         za_bnds(2,:) = ght_abl(2:jpka  ) + e3w_abl(2:jpka)
+         CALL iom_set_axis_attr( "ghw_abl", bounds=za_bnds )
+
+         CALL iom_set_axis_attr(  "nfloat", (/ (REAL(ji,wp), ji=1,jpnfl) /) )
 # if defined key_si3
-          CALL iom_set_axis_attr( "ncatice", (/ (REAL(ji,wp), ji=1,jpl) /) )
-          ! SIMIP diagnostics (4 main arctic straits)
-          CALL iom_set_axis_attr( "nstrait", (/ (REAL(ji,wp), ji=1,4) /) )
+         CALL iom_set_axis_attr( "ncatice", (/ (REAL(ji,wp), ji=1,jpl) /) )
+         ! SIMIP diagnostics (4 main arctic straits)
+         CALL iom_set_axis_attr( "nstrait", (/ (REAL(ji,wp), ji=1,4) /) )
 # endif
 #if defined key_top
-          IF( ALLOCATED(profsed) ) CALL iom_set_axis_attr( "profsed", paxis = profsed )
-#endif
-          CALL iom_set_axis_attr( "icbcla", class_num )
-          CALL iom_set_axis_attr( "iax_20C", (/ REAL(20,wp) /) )   ! strange syntaxe and idea...
-          CALL iom_set_axis_attr( "iax_26C", (/ REAL(26,wp) /) )   ! strange syntaxe and idea...
-          CALL iom_set_axis_attr( "iax_28C", (/ REAL(28,wp) /) )   ! strange syntaxe and idea...
-          ! for diaprt, we need to define an axis which size can be 1 (default) or 5 (if the file subbasins.nc exists)
-          INQUIRE( FILE = 'subbasins.nc', EXIST = ll_exist )
-          nbasin = 1 + 4 * COUNT( (/ll_exist/) )
-          CALL iom_set_axis_attr( "basin"  , (/ (REAL(ji,wp), ji=1,nbasin) /) )
+         IF( ALLOCATED(profsed) ) CALL iom_set_axis_attr( "profsed", paxis = profsed )
+#endif
+         CALL iom_set_axis_attr( "icbcla", class_num )
+         CALL iom_set_axis_attr( "iax_20C", (/ REAL(20,wp) /) )   ! strange syntaxe and idea...
+         CALL iom_set_axis_attr( "iax_26C", (/ REAL(26,wp) /) )   ! strange syntaxe and idea...
+         CALL iom_set_axis_attr( "iax_28C", (/ REAL(28,wp) /) )   ! strange syntaxe and idea...
+         ! for diaprt, we need to define an axis which size can be 1 (default) or 5 (if the file subbasins.nc exists)
+         INQUIRE( FILE = 'subbasins.nc', EXIST = ll_exist )
+         nbasin = 1 + 4 * COUNT( (/ll_exist/) )
+         CALL iom_set_axis_attr( "basin"  , (/ (REAL(ji,wp), ji=1,nbasin) /) )
       ENDIF
       !
       ! automatic definitions of some of the xml attributs
       IF(llrstr) THEN
-          IF(PRESENT(idfp)) THEN
-             CALL iom_set_rst_context(.TRUE.)
+         IF(PRESENT(idfp)) THEN
+            CALL iom_set_rst_context(.TRUE.)
 !set which fields will be read from restart file
-             CALL iom_set_vars_active(fname, idfp)
-          ELSE
-             CALL ctl_stop( 'iom_init:', 'restart read with XIOS: missing pointer to NETCDF file' )
-          ENDIF
+            CALL iom_set_vars_active(fname, idfp)
+         ELSE
+            CALL ctl_stop( 'iom_init:', 'restart read with XIOS: missing pointer to NETCDF file' )
+         ENDIF
       ELSE IF(llrstw) THEN
-          CALL iom_set_rstw_file(fname)
+         CALL iom_set_rstw_file(fname)
       ELSE
-          CALL set_xmlatt
+         CALL set_xmlatt
       ENDIF
       !
@@ -301,23 +301,23 @@
       !!
       !!----------------------------------------------------------------------
-   CHARACTER(len=*), OPTIONAL, INTENT(IN) :: cdname
+      CHARACTER(len=*), OPTIONAL, INTENT(IN) :: cdname
 #if defined key_iomput
-   LOGICAL :: llrstw
+      LOGICAL :: llrstw
 
       llrstw = .FALSE.
       IF(PRESENT(cdname)) THEN
-         llrstw = (TRIM(cdname) == TRIM(cwxios_context))
-         llrstw = llrstw .OR. (TRIM(cdname) == TRIM(cwixios_context))
-         llrstw = llrstw .OR. (TRIM(cdname) == TRIM(cwtxios_context))
-         llrstw = llrstw .OR. (TRIM(cdname) == TRIM(cwsxios_context))
+         llrstw = (cdname == cw_ocerst_cxt)
+         llrstw = llrstw .OR. (cdname == cw_icerst_cxt)
+         llrstw = llrstw .OR. (cdname == cw_toprst_cxt)
+         llrstw = llrstw .OR. (cdname == cw_sedrst_cxt)
       ENDIF
 
       IF( llrstw ) THEN
 !set names of the fields in restart file IF using XIOS to write data
-          CALL iom_set_rst_context(.FALSE.)
-          CALL xios_close_context_definition()
+         CALL iom_set_rst_context(.FALSE.)
+         CALL xios_close_context_definition()
       ELSE
-          CALL xios_close_context_definition()
-          CALL xios_update_calendar( 0 )
+         CALL xios_close_context_definition()
+         CALL xios_update_calendar( 0 )
       ENDIF
 #else
@@ -335,85 +335,92 @@
       !!               id of the file is assumed to be rrestart.
       !!---------------------------------------------------------------------
-
-   CHARACTER(len=*), INTENT(IN) :: cdfname
-   INTEGER         , INTENT(IN) :: idnum 
+      CHARACTER(len=*), INTENT(IN) :: cdfname
+      INTEGER         , INTENT(IN) :: idnum 
 #if defined key_iomput
-   INTEGER                                    :: ndims, nvars, natts, unlimitedDimId, dimlen, xtype,mdims
-   TYPE(xios_field)                           :: field_hdl
-   TYPE(xios_file)                            :: file_hdl
-   TYPE(xios_filegroup)                       :: filegroup_hdl
-   INTEGER                                    :: dimids(4), jv,i, idim
-   CHARACTER(LEN=256)                         :: clinfo               ! info character
-   INTEGER, ALLOCATABLE                       :: indimlens(:)
-   CHARACTER(LEN=nf90_max_name), ALLOCATABLE  :: indimnames(:)
-   CHARACTER(LEN=nf90_max_name)               :: dimname, varname
-   LOGICAL                                    :: lmeta
-
-        meta(1) = "nav_lat"
-        meta(2) = "nav_lon"
-        meta(3) = "nav_lev"
-        meta(4) = "time_instant"
-        meta(5) = "time_instant_bounds"
-        meta(6) = "time_counter"
-        meta(7) = "time_counter_bounds"
-        meta(8) = "x"
-        meta(9) = "y"
-        meta(10) = "numcat"
-
-        clinfo = '          iom_set_vars_active, file: '//TRIM(cdfname)
+      INTEGER                                    :: ndims, nvars, natts, unlimitedDimId, dimlen, xtype,mdims
+      TYPE(xios_field)                           :: field_hdl
+      TYPE(xios_file)                            :: file_hdl
+      TYPE(xios_filegroup)                       :: filegroup_hdl
+      INTEGER                                    :: dimids(4), jv,i, idim
+      CHARACTER(LEN=256)                         :: clinfo               ! info character
+      INTEGER, ALLOCATABLE                       :: indimlens(:)
+      CHARACTER(LEN=nf90_max_name), ALLOCATABLE  :: indimnames(:)
+      CHARACTER(LEN=nf90_max_name)               :: dimname, varname
+      LOGICAL                                    :: lmeta
+!metadata in restart file for restart read with XIOS
+      INTEGER, PARAMETER :: NMETA = 10
+      CHARACTER(LEN=lc)  :: meta(NMETA)
+
+
+      meta(1) = "nav_lat"
+      meta(2) = "nav_lon"
+      meta(3) = "nav_lev"
+      meta(4) = "time_instant"
+      meta(5) = "time_instant_bounds"
+      meta(6) = "time_counter"
+      meta(7) = "time_counter_bounds"
+      meta(8) = "x"
+      meta(9) = "y"
+      meta(10) = "numcat"
+
+      clinfo = '          iom_set_vars_active, file: '//TRIM(cdfname)
 
 !set name of the restart file and enable available fields
-        CALL xios_get_handle("file_definition", filegroup_hdl )
-        CALL xios_add_child(filegroup_hdl, file_hdl, 'rrestart')
-        CALL xios_set_file_attr( "rrestart", name=trim(cdfname), type="one_file", &
-             par_access="collective", enabled=.TRUE., mode="read",                 &
-             output_freq=xios_timestep)
-
-        CALL iom_nf90_check( nf90_inquire(idnum, ndims, nvars, natts ), clinfo )
-        ALLOCATE(indimlens(ndims), indimnames(ndims))
-        CALL iom_nf90_check( nf90_inquire(idnum, unlimitedDimId = unlimitedDimId ), clinfo )
-
-        DO idim = 1, ndims
-           CALL iom_nf90_check( nf90_inquire_dimension(idnum, idim, dimname, dimlen ), clinfo )
-           indimlens(idim) = dimlen
-           indimnames(idim) = dimname
-        ENDDO
-
-        DO jv =1, nvars
-            lmeta = .FALSE.
-            CALL iom_nf90_check( nf90_inquire_variable(idnum, jv, varname, xtype, ndims, dimids, natts ), clinfo )
-            DO i = 1, NMETA
-               IF(TRIM(varname) == TRIM(meta(i))) THEN
-                  lmeta = .TRUE.
-               ENDIF
-            ENDDO
-            IF(.NOT.lmeta) THEN
-               CALL xios_add_child(file_hdl, field_hdl, TRIM(varname))
-               mdims = ndims
-
-               IF(ANY(dimids(1:ndims) == unlimitedDimId)) THEN
-                mdims = mdims - 1
-               ENDIF
-
-               IF(mdims == 3) THEN
-                      CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(varname),   &
-                                   domain_ref="grid_N", axis_ref=TRIM(iom_axis(indimlens(dimids(mdims)))), &
-                                   prec = 8, operation = "instant")
-               ELSEIF(mdims == 2) THEN
-                      CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(varname), &
-                                          domain_ref="grid_N", prec = 8, operation = "instant") 
-               ELSEIF(mdims == 1) THEN
-                      CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(varname), &
-                                          axis_ref=TRIM(iom_axis(indimlens(dimids(mdims)))), prec = 8, operation = "instant")
-               ELSEIF(mdims == 0) THEN
-                      CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(varname), &
-                                                scalar_ref = "grid_scalar", prec = 8, operation = "instant")
-               ELSE
-                      WRITE(ctmp1,*) 'iom_set_vars_active: variable ', TRIM(varname) ,' incorrect number of dimensions' 
-                      CALL ctl_stop( 'iom_set_vars_active:', ctmp1 )
-               ENDIF
+      CALL xios_get_handle("file_definition", filegroup_hdl )
+      CALL xios_add_child(filegroup_hdl, file_hdl, 'rrestart')
+      CALL xios_set_file_attr( "rrestart", name=trim(cdfname), type="one_file", &
+           par_access="collective", enabled=.TRUE., mode="read",                &
+                                                    output_freq=xios_timestep   )
+
+      CALL iom_nf90_check( nf90_inquire(idnum, ndims, nvars, natts ), clinfo )
+      ALLOCATE(indimlens(ndims), indimnames(ndims))
+      CALL iom_nf90_check( nf90_inquire(idnum, unlimitedDimId = unlimitedDimId ), clinfo )
+
+      DO idim = 1, ndims
+         CALL iom_nf90_check( nf90_inquire_dimension(idnum, idim, dimname, dimlen ), clinfo )
+         indimlens(idim) = dimlen
+         indimnames(idim) = dimname
+      ENDDO
+
+      DO jv =1, nvars
+         lmeta = .FALSE.
+         CALL iom_nf90_check( nf90_inquire_variable(idnum, jv, varname, xtype, ndims, dimids, natts ), clinfo )
+         DO i = 1, NMETA
+           IF(varname == meta(i)) THEN
+             lmeta = .TRUE.
+           ENDIF
+         ENDDO
+         IF(.NOT.lmeta) THEN
+            CALL xios_add_child(file_hdl, field_hdl, varname)
+            mdims = ndims
+
+            IF(ANY(dimids(1:ndims) == unlimitedDimId)) THEN
+               mdims = mdims - 1
             ENDIF
-        ENDDO
-        DEALLOCATE(indimlens, indimnames)
+
+            IF(mdims == 3) THEN
+               CALL xios_set_attr (field_hdl, enabled = .TRUE., name = varname,   &
+                                   domain_ref="grid_N",                           &
+                                   axis_ref=iom_axis(indimlens(dimids(mdims))),   &
+                                   prec = 8, operation = "instant"                )
+            ELSEIF(mdims == 2) THEN
+               CALL xios_set_attr (field_hdl, enabled = .TRUE., name = varname,  &
+                                   domain_ref="grid_N", prec = 8,                &
+                                   operation = "instant"                         ) 
+            ELSEIF(mdims == 1) THEN
+               CALL xios_set_attr (field_hdl, enabled = .TRUE., name = varname, &
+                                   axis_ref=iom_axis(indimlens(dimids(mdims))), &
+                                   prec = 8, operation = "instant"              )
+            ELSEIF(mdims == 0) THEN
+               CALL xios_set_attr (field_hdl, enabled = .TRUE., name = varname, &
+                                   scalar_ref = "grid_scalar", prec = 8,        &
+                                   operation = "instant"                        )
+            ELSE
+               WRITE(ctmp1,*) 'iom_set_vars_active: variable ', TRIM(varname) ,' incorrect number of dimensions' 
+               CALL ctl_stop( 'iom_set_vars_active:', ctmp1 )
+            ENDIF
+         ENDIF
+      ENDDO
+      DEALLOCATE(indimlens, indimnames)
 #endif
    END SUBROUTINE iom_set_vars_active
@@ -425,25 +432,23 @@
       !! ** Purpose :  define file name in XIOS context for writing restart
       !!---------------------------------------------------------------------
-   CHARACTER(len=*) :: cdrst_file
+      CHARACTER(len=*) :: cdrst_file
 #if defined key_iomput
-   TYPE(xios_file) :: file_hdl
-   TYPE(xios_filegroup) :: filegroup_hdl
-   INTEGER :: i
-   CHARACTER(lc)  ::   clpath
+      TYPE(xios_file) :: file_hdl
+      TYPE(xios_filegroup) :: filegroup_hdl
 
 !set name of the restart file and enable available fields
-        IF(lwp) WRITE(numout,*) 'Setting restart filename (for XIOS write) to: ',cdrst_file
-        CALL xios_get_handle("file_definition", filegroup_hdl )
-        CALL xios_add_child(filegroup_hdl, file_hdl, 'wrestart')
-        IF(nxioso.eq.1) THEN 
-           CALL xios_set_file_attr( "wrestart", type="one_file", enabled=.TRUE.,& 
-                                    mode="write", output_freq=xios_timestep) 
-           if(lwp) write(numout,*) 'OPEN ', trim(cdrst_file), ' in one_file mode' 
-        ELSE  
-           CALL xios_set_file_attr( "wrestart", type="multiple_file", enabled=.TRUE.,& 
-                                    mode="write", output_freq=xios_timestep) 
-           if(lwp) write(numout,*) 'OPEN ', trim(cdrst_file), ' in multiple_file mode' 
-        ENDIF 
-        CALL xios_set_file_attr( "wrestart", name=trim(cdrst_file))
+      IF(lwp) WRITE(numout,*) 'Setting restart filename (for XIOS write) to: ',cdrst_file
+      CALL xios_get_handle("file_definition", filegroup_hdl )
+      CALL xios_add_child(filegroup_hdl, file_hdl, 'wrestart')
+      IF(nxioso.eq.1) THEN 
+         CALL xios_set_file_attr( "wrestart", type="one_file", enabled=.TRUE.,& 
+                                       mode="write", output_freq=xios_timestep) 
+         IF(lwp) write(numout,*) 'OPEN ', trim(cdrst_file), ' in one_file mode' 
+      ELSE  
+         CALL xios_set_file_attr( "wrestart", type="multiple_file", enabled=.TRUE.,& 
+                                            mode="write", output_freq=xios_timestep) 
+         IF(lwp) write(numout,*) 'OPEN ', trim(cdrst_file), ' in multiple_file mode' 
+      ENDIF 
+      CALL xios_set_file_attr( "wrestart", name=trim(cdrst_file))
 #endif
    END SUBROUTINE iom_set_rstw_file
@@ -458,52 +463,56 @@
       !!---------------------------------------------------------------------
 !sets enabled = .TRUE. for each field in restart file
-   CHARACTER(len = *), INTENT(IN)                     :: sdfield
-   REAL(dp), OPTIONAL, INTENT(IN)                     :: rd0
-   REAL(sp), OPTIONAL, INTENT(IN)                     :: rs0
-   REAL(dp), OPTIONAL, INTENT(IN), DIMENSION(:)       :: rd1
-   REAL(sp), OPTIONAL, INTENT(IN), DIMENSION(:)       :: rs1
-   REAL(dp), OPTIONAL, INTENT(IN), DIMENSION(:, :)    :: rd2
-   REAL(sp), OPTIONAL, INTENT(IN), DIMENSION(:, :)    :: rs2
-   REAL(dp), OPTIONAL, INTENT(IN), DIMENSION(:, :, :) :: rd3  
-   REAL(sp), OPTIONAL, INTENT(IN), DIMENSION(:, :, :) :: rs3
+      CHARACTER(len = *), INTENT(IN)                     :: sdfield
+      REAL(dp), OPTIONAL, INTENT(IN)                     :: rd0
+      REAL(sp), OPTIONAL, INTENT(IN)                     :: rs0
+      REAL(dp), OPTIONAL, INTENT(IN), DIMENSION(:)       :: rd1
+      REAL(sp), OPTIONAL, INTENT(IN), DIMENSION(:)       :: rs1
+      REAL(dp), OPTIONAL, INTENT(IN), DIMENSION(:, :)    :: rd2
+      REAL(sp), OPTIONAL, INTENT(IN), DIMENSION(:, :)    :: rs2
+      REAL(dp), OPTIONAL, INTENT(IN), DIMENSION(:, :, :) :: rd3  
+      REAL(sp), OPTIONAL, INTENT(IN), DIMENSION(:, :, :) :: rs3
 #if defined key_iomput
-   TYPE(xios_field) :: field_hdl
-   TYPE(xios_file) :: file_hdl
-   INTEGER :: i
-   CHARACTER(lc)  ::   clpath
-   CHARACTER(len=1024) :: fname
-   CHARACTER(len=lc)   :: axis_ref
-
-        CALL xios_get_handle("wrestart", file_hdl)
+      TYPE(xios_field) :: field_hdl
+      TYPE(xios_file) :: file_hdl
+
+      CALL xios_get_handle("wrestart", file_hdl)
 !define fields for restart context
-        CALL xios_add_child(file_hdl, field_hdl, TRIM(sdfield))
-
-        IF(PRESENT(rd3)) THEN
-               CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(sdfield),   &
-                            domain_ref="grid_N", axis_ref=TRIM(iom_axis(size(rd3, 3))), &
-                            prec = 8, operation = "instant")
-        ELSEIF(PRESENT(rs3)) THEN
-               CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(sdfield),   &
-                            domain_ref="grid_N", axis_ref=TRIM(iom_axis(size(rd3, 3))), &
-                            prec = 4, operation = "instant")
-        ELSEIF(PRESENT(rd2)) THEN
-               CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(sdfield), &
-                                   domain_ref="grid_N", prec = 8, operation = "instant") 
-        ELSEIF(PRESENT(rs2)) THEN
-               CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(sdfield), &
-                                   domain_ref="grid_N", prec = 4, operation = "instant")
-        ELSEIF(PRESENT(rd1)) THEN
-               CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(sdfield), &
-                                   axis_ref=TRIM(iom_axis(size(rd1, 1))), prec = 8, operation = "instant")
-        ELSEIF(PRESENT(rs1)) THEN
-               CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(sdfield), &
-                                   axis_ref=TRIM(iom_axis(size(rd1, 1))), prec = 4, operation = "instant")
-        ELSEIF(PRESENT(rd0)) THEN
-               CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(sdfield), &
-                                         scalar_ref = "grid_scalar", prec = 8, operation = "instant")
-        ELSEIF(PRESENT(rs0)) THEN
-               CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(sdfield), &
-                                         scalar_ref = "grid_scalar", prec = 4, operation = "instant")
-        ENDIF
+      CALL xios_add_child(file_hdl, field_hdl, sdfield)
+
+      IF(PRESENT(rd3)) THEN
+         CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, &
+                             domain_ref = "grid_N",                       &
+                             axis_ref = iom_axis(size(rd3, 3)),           &
+                             prec = 8, operation = "instant"              )
+      ELSEIF(PRESENT(rs3)) THEN
+         CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, &
+                             domain_ref = "grid_N",                       &
+                             axis_ref = iom_axis(size(rd3, 3)),           &
+                             prec = 4, operation = "instant"              )
+      ELSEIF(PRESENT(rd2)) THEN
+         CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, &
+                             domain_ref = "grid_N", prec = 8,             &
+                             operation = "instant"                        ) 
+      ELSEIF(PRESENT(rs2)) THEN
+         CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, &
+                             domain_ref = "grid_N", prec = 4,             &
+                             operation = "instant"                        )
+      ELSEIF(PRESENT(rd1)) THEN
+         CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, &
+                             axis_ref = iom_axis(size(rd1, 1)),           &
+                             prec = 8, operation = "instant"              )
+      ELSEIF(PRESENT(rs1)) THEN
+         CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, &
+                             axis_ref = iom_axis(size(rd1, 1)),           &
+                             prec = 4, operation = "instant"              )
+      ELSEIF(PRESENT(rd0)) THEN
+         CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, &
+                             scalar_ref = "grid_scalar", prec = 8,        &
+                             operation = "instant"                        )
+      ELSEIF(PRESENT(rs0)) THEN
+         CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, &
+                             scalar_ref = "grid_scalar", prec = 4,        &
+                             operation = "instant"                        )
+      ENDIF
 #endif
    END SUBROUTINE iom_set_rstw_active
@@ -518,17 +527,17 @@
       !!              iom_set_rst_context
       !!---------------------------------------------------------------------
-    INTEGER, INTENT(IN) :: idlev
-    CHARACTER(len=lc)   :: axis_ref
-    CHARACTER(len=12)   :: str
-       IF(idlev == jpk) THEN
+      INTEGER, INTENT(IN) :: idlev
+      CHARACTER(len=lc)   :: axis_ref
+      CHARACTER(len=12)   :: str
+      IF(idlev == jpk) THEN
          axis_ref="nav_lev"
 #if defined key_si3
-       ELSEIF(idlev == jpl) THEN
+      ELSEIF(idlev == jpl) THEN
          axis_ref="numcat"
 #endif         
-       ELSE
+      ELSE
          write(str, *) idlev
          CALL ctl_stop( 'iom_axis', 'Definition for axis with '//TRIM(ADJUSTL(str))//' levels missing')
-       ENDIF
+      ENDIF
    END FUNCTION iom_axis
 
@@ -541,31 +550,30 @@
       !!               
       !!---------------------------------------------------------------------
-   LOGICAL, INTENT(IN)               :: ld_rstr
-   INTEGER :: ji
+      LOGICAL, INTENT(IN)               :: ld_rstr
+      INTEGER :: ji
 #if defined key_iomput
-   TYPE(xios_domaingroup)            :: domaingroup_hdl 
-   TYPE(xios_domain)                 :: domain_hdl 
-   TYPE(xios_axisgroup)              :: axisgroup_hdl 
-   TYPE(xios_axis)                   :: axis_hdl 
-   TYPE(xios_scalar)                 :: scalar_hdl 
-   TYPE(xios_scalargroup)            :: scalargroup_hdl 
-
-     CALL xios_get_handle("domain_definition",domaingroup_hdl) 
-     CALL xios_add_child(domaingroup_hdl, domain_hdl, "grid_N") 
-     CALL set_grid("N", glamt, gphit, .TRUE., ld_rstr) 
+      TYPE(xios_domaingroup)            :: domaingroup_hdl 
+      TYPE(xios_domain)                 :: domain_hdl 
+      TYPE(xios_axisgroup)              :: axisgroup_hdl 
+      TYPE(xios_axis)                   :: axis_hdl 
+      TYPE(xios_scalar)                 :: scalar_hdl 
+      TYPE(xios_scalargroup)            :: scalargroup_hdl 
+
+      CALL xios_get_handle("domain_definition",domaingroup_hdl) 
+      CALL xios_add_child(domaingroup_hdl, domain_hdl, "grid_N") 
+      CALL set_grid("N", glamt, gphit, .TRUE., ld_rstr) 
  
-     CALL xios_get_handle("axis_definition",axisgroup_hdl) 
-     CALL xios_add_child(axisgroup_hdl, axis_hdl, "nav_lev") 
+      CALL xios_get_handle("axis_definition",axisgroup_hdl) 
+      CALL xios_add_child(axisgroup_hdl, axis_hdl, "nav_lev") 
 !AGRIF fails to compile when unit= is in call to xios_set_axis_attr
-!    CALL xios_set_axis_attr( "nav_lev", long_name="Vertical levels",  unit="m", positive="down") 
-     CALL xios_set_axis_attr( "nav_lev", long_name="Vertical levels in meters", positive="down")
-     CALL iom_set_axis_attr( "nav_lev", paxis = gdept_1d ) 
+!     CALL xios_set_axis_attr( "nav_lev", long_name="Vertical levels",  unit="m", positive="down") 
+      CALL xios_set_axis_attr( "nav_lev", long_name = "Vertical levels in meters", positive = "down")
+      CALL iom_set_axis_attr( "nav_lev", paxis = gdept_1d ) 
 #if defined key_si3
-     CALL xios_add_child(axisgroup_hdl, axis_hdl, "numcat")
-     CALL iom_set_axis_attr( "numcat", (/ (REAL(ji,wp), ji=1,jpl) /) )
-#endif
-
-     CALL xios_get_handle("scalar_definition", scalargroup_hdl) 
-     CALL xios_add_child(scalargroup_hdl, scalar_hdl, "grid_scalar") 
+      CALL xios_add_child(axisgroup_hdl, axis_hdl, "numcat")
+      CALL iom_set_axis_attr( "numcat", (/ (REAL(ji,wp), ji=1,jpl) /) )
+#endif
+      CALL xios_get_handle("scalar_definition", scalargroup_hdl) 
+      CALL xios_add_child(scalargroup_hdl, scalar_hdl, "grid_scalar") 
 #endif
    END SUBROUTINE iom_set_rst_context
@@ -1526,9 +1534,9 @@
 #ifdef key_iomput
       IF( kt == kwrite ) THEN
-          IF(lwp) write(numout,*) 'RESTART: write (XIOS 0D) ',trim(cdvar)
-          CALL iom_put(trim(cdvar), pvar)
+         IF(lwp) write(numout,*) 'RESTART: write (XIOS 0D) ',trim(cdvar)
+         CALL iom_put(trim(cdvar), pvar)
       ELSE
-          IF(lwp) write(numout,*) 'RESTART: define (XIOS 0D) ',trim(cdvar)
-          CALL iom_set_rstw_active( trim(cdvar), rs0 = pvar ) 
+         IF(lwp) write(numout,*) 'RESTART: define (XIOS 0D) ',trim(cdvar)
+         CALL iom_set_rstw_active( trim(cdvar), rs0 = pvar ) 
       ENDIF
 #endif
@@ -1559,9 +1567,9 @@
 #ifdef key_iomput
       IF( kt == kwrite ) THEN
-          IF(lwp) write(numout,*) 'RESTART: write (XIOS 0D) ',trim(cdvar)
-          CALL iom_put(trim(cdvar), pvar)
+         IF(lwp) write(numout,*) 'RESTART: write (XIOS 0D) ',trim(cdvar)
+         CALL iom_put(trim(cdvar), pvar)
       ELSE
-          IF(lwp) write(numout,*) 'RESTART: define (XIOS 0D) ',trim(cdvar)
-          CALL iom_set_rstw_active( trim(cdvar), rd0 = pvar ) 
+         IF(lwp) write(numout,*) 'RESTART: define (XIOS 0D) ',trim(cdvar)
+         CALL iom_set_rstw_active( trim(cdvar), rd0 = pvar ) 
       ENDIF
 #endif
@@ -1729,5 +1737,5 @@
          IF(lwp) write(numout,*) 'RESTART: write (XIOS 3D) ',trim(cdvar)
          CALL iom_put(trim(cdvar), pvar)
-     ELSE
+      ELSE
          IF(lwp) write(numout,*) 'RESTART: define (XIOS 3D)',trim(cdvar)
          CALL iom_set_rstw_active( trim(cdvar), rs3 = pvar )
@@ -2135,5 +2143,5 @@
       CALL iom_swap( cdname )   ! swap to cdname context
       CALL xios_update_calendar(kt)
-      IF( cdname /= TRIM(cxios_context) )   CALL iom_swap( TRIM(cxios_context) )   ! return back to nemo context
+      IF( cdname /= TRIM(cxios_context) )   CALL iom_swap( cxios_context )   ! return back to nemo context
    END SUBROUTINE iom_setkt
 
@@ -2149,5 +2157,5 @@
          CALL iom_swap( cdname )   ! swap to cdname context
          CALL xios_context_finalize() ! finalize the context
-         IF( cdname /= TRIM(cxios_context) ) CALL iom_swap( TRIM(cxios_context) )   ! return back to nemo context
+         IF( cdname /= cxios_context ) CALL iom_swap( cxios_context )   ! return back to nemo context
       ENDIF
       !
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/IOM/iom_def.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/IOM/iom_def.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/IOM/iom_def.F90	(revision 13871)
@@ -38,5 +38,4 @@
 !XIOS read restart   
    LOGICAL, PUBLIC            ::   lrxios = .FALSE.     !: read single file restart using XIOS main switch
-   LOGICAL, PUBLIC            ::   lroxios = .FALSE.    !: read single file restart using XIOS for oce      
    LOGICAL, PUBLIC            ::   lxios_sini = .FALSE. ! is restart in a single file
 
@@ -62,7 +61,4 @@
    END TYPE file_descriptor
    TYPE(file_descriptor), DIMENSION(jpmax_files), PUBLIC ::   iom_file !: array containing the info for all opened files
-!metadata in restart file for restart read with XIOS
-   INTEGER, PUBLIC, PARAMETER :: NMETA = 10
-   CHARACTER(LEN=nf90_max_name), PUBLIC :: meta(NMETA)
 !$AGRIF_END_DO_NOT_TREAT
    !
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/IOM/restart.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/IOM/restart.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/IOM/restart.F90	(revision 13871)
@@ -110,5 +110,5 @@
             ELSE
 #if defined key_iomput
-               cwxios_context = "rstw_"//TRIM(ADJUSTL(clkt))
+               cw_ocerst_cxt = "rstw_"//TRIM(ADJUSTL(clkt))
                IF( TRIM(Agrif_CFixed()) == '0' ) THEN
                   clpname = clname
@@ -116,5 +116,5 @@
                   clpname = TRIM(Agrif_CFixed())//"_"//clname   
                ENDIF
-               CALL iom_init( cwxios_context, fname = TRIM(clpath)//TRIM(clpname), ld_closedef = .false. )
+               CALL iom_init( cw_ocerst_cxt, fname = TRIM(clpath)//TRIM(clpname), ld_closedef = .false. )
                CALL iom_swap(      cxios_context          )
 #else
@@ -142,5 +142,5 @@
       INTEGER, INTENT(in) ::   Kbb, Kmm   ! ocean time level indices
       !!----------------------------------------------------------------------
-                     IF(lwxios) CALL iom_swap(      cwxios_context          )
+                     IF(lwxios) CALL iom_swap(      cw_ocerst_cxt          )
                      CALL iom_rstput( kt, nitrst, numrow, 'rdt'    , rn_Dt       , ldxios = lwxios)   ! dynamics time step
                      CALL iom_delay_rst( 'WRITE', 'OCE', numrow )   ! save only ocean delayed global communication variables
@@ -167,5 +167,5 @@
             CALL iom_close( numrow )     ! close the restart file (only at last time step)
          ELSE
-            CALL iom_context_finalize(      cwxios_context          )
+            CALL iom_context_finalize(      cw_ocerst_cxt          )
          ENDIF
 !!gm         IF( .NOT. lk_trdmld )   lrst_oce = .FALSE.
@@ -209,8 +209,8 @@
 ! can handle checking if variable is in the restart file (there will be no need to open
 ! restart)
-         lroxios = lrxios.AND.lxios_sini
-
-         IF( lroxios) THEN
-             crxios_context = 'oce_rst'
+         lrxios = lrxios.AND.lxios_sini
+
+         IF( lrxios) THEN
+             cr_ocerst_cxt = 'oce_rst'
              IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS'
              IF( TRIM(Agrif_CFixed()) == '0' ) THEN
@@ -219,5 +219,5 @@
                 clpname = TRIM(Agrif_CFixed())//"_"//cn_ocerst_in   
              ENDIF
-             CALL iom_init( crxios_context, fname = TRIM(clpath)//TRIM(clpname), &
+             CALL iom_init( cr_ocerst_cxt, fname = TRIM(clpath)//TRIM(clpname), &
                               idfp = iom_file(numror)%nfid, ld_closedef = .TRUE. )
          ENDIF
@@ -245,7 +245,7 @@
 
       ! Check dynamics and tracer time-step consistency and force Euler restart if changed
-      IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
+      IF( lrxios ) CALL iom_swap( cr_ocerst_cxt )
       IF( iom_varid( numror, 'rdt', ldstop = .FALSE. ) > 0 )   THEN
-         CALL iom_get( numror, 'rdt', zrdt, ldxios = lroxios )
+         CALL iom_get( numror, 'rdt', zrdt, ldxios = lrxios )
          IF( zrdt /= rn_Dt ) THEN
             IF(lwp) WRITE( numout,*)
@@ -260,10 +260,10 @@
       
       ! Diurnal DSST 
-      IF( ln_diurnal ) CALL iom_get( numror, jpdom_auto, 'Dsst' , x_dsst, ldxios = lroxios ) 
+      IF( ln_diurnal ) CALL iom_get( numror, jpdom_auto, 'Dsst' , x_dsst, ldxios = lrxios ) 
       IF ( ln_diurnal_only ) THEN 
          IF(lwp) WRITE( numout, * ) &
          &   "rst_read:- ln_diurnal_only set, setting rhop=rho0" 
          rhop = rho0
-         CALL iom_get( numror, jpdom_auto, 'tn'     , w3d, ldxios = lroxios ) 
+         CALL iom_get( numror, jpdom_auto, 'tn'     , w3d, ldxios = lrxios ) 
          ts(:,:,1,jp_tem,Kmm) = w3d(:,:,1)
          RETURN 
@@ -288,9 +288,9 @@
       CALL iom_get( numror, jpdom_auto, 'sshn'   ,ssh(:,:         ,Kmm), ldxios = lrxios )
       IF( iom_varid( numror, 'rhop', ldstop = .FALSE. ) > 0 ) THEN
-         CALL iom_get( numror, jpdom_auto, 'rhop'   , rhop, ldxios = lroxios )   ! now    potential density
+         CALL iom_get( numror, jpdom_auto, 'rhop'   , rhop, ldxios = lrxios )   ! now    potential density
       ELSE
          CALL eos( ts(:,:,:,:,Kmm), rhd, rhop, gdept(:,:,:,Kmm) )   
       ENDIF
-      IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+      IF( lrxios ) CALL iom_swap( cxios_context )
       !
       IF( l_1st_euler ) THEN                                  ! Euler restart 
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ISF/isfcpl.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ISF/isfcpl.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ISF/isfcpl.F90	(revision 13871)
@@ -144,5 +144,5 @@
       END DO 
       !
-      IF( lwxios ) CALL iom_swap( cwxios_context )
+      IF( lwxios ) CALL iom_swap( cw_ocerst_cxt )
       CALL iom_rstput( kt, nitrst, numrow, 'tmask'  , tmask , ldxios = lwxios )
       CALL iom_rstput( kt, nitrst, numrow, 'ssmask' , ssmask, ldxios = lwxios )
@@ -174,7 +174,7 @@
       !!----------------------------------------------------------------------
       !
-      IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
-      CALL iom_get( numror, jpdom_auto, 'ssmask'  , zssmask_b, ldxios = lroxios   ) ! need to extrapolate T/S
-      IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+      IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
+      CALL iom_get( numror, jpdom_auto, 'ssmask'  , zssmask_b, ldxios = lrxios   ) ! need to extrapolate T/S
+      IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
 
       ! compute new ssh if we open a full water column 
@@ -257,9 +257,9 @@
       !!----------------------------------------------------------------------
       ! 
-      IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
-      CALL iom_get( numror, jpdom_auto, 'tmask'  , ztmask_b, ldxios = lroxios   ) ! need to extrapolate T/S
-      !CALL iom_get( numror, jpdom_auto, 'wmask'  , zwmask_b, ldxios = lroxios   ) ! need to extrapolate T/S
-      !CALL iom_get( numror, jpdom_auto, 'gdepw_n', zdepw_b(:,:,:), ldxios = lroxios ) ! need to interpol vertical profile (vvl)
-      IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+      IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
+      CALL iom_get( numror, jpdom_auto, 'tmask'  , ztmask_b, ldxios = lrxios   ) ! need to extrapolate T/S
+      !CALL iom_get( numror, jpdom_auto, 'wmask'  , zwmask_b, ldxios = lrxios   ) ! need to extrapolate T/S
+      !CALL iom_get( numror, jpdom_auto, 'gdepw_n', zdepw_b(:,:,:), ldxios = lrxios ) ! need to interpol vertical profile (vvl)
+      IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
       !
       ! 
@@ -405,9 +405,9 @@
       !!----------------------------------------------------------------------
       !
-      IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
-      CALL iom_get( numror, jpdom_auto, 'tmask'  , ztmask_b, ldxios = lroxios )
-      CALL iom_get( numror, jpdom_auto, 'e3u_n'  , ze3u_b  , ldxios = lroxios )
-      CALL iom_get( numror, jpdom_auto, 'e3v_n'  , ze3v_b  , ldxios = lroxios )
-      IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+      IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
+      CALL iom_get( numror, jpdom_auto, 'tmask'  , ztmask_b, ldxios = lrxios )
+      CALL iom_get( numror, jpdom_auto, 'e3u_n'  , ze3u_b  , ldxios = lrxios )
+      CALL iom_get( numror, jpdom_auto, 'e3v_n'  , ze3v_b  , ldxios = lrxios )
+      IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
       !
       ! 1.0: compute horizontal volume flux divergence difference before-after coupling
@@ -517,10 +517,10 @@
 
       ! get restart variable
-      IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
-      CALL iom_get( numror, jpdom_auto, 'tmask'  , ztmask_b(:,:,:), ldxios = lroxios   ) ! need to extrapolate T/S
-      CALL iom_get( numror, jpdom_auto, 'e3t_n'  , ze3t_b(:,:,:)  , ldxios = lroxios )
-      CALL iom_get( numror, jpdom_auto, 'tn'     , zt_b(:,:,:)    , ldxios = lroxios )
-      CALL iom_get( numror, jpdom_auto, 'sn'     , zs_b(:,:,:)    , ldxios = lroxios )
-      IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+      IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
+      CALL iom_get( numror, jpdom_auto, 'tmask'  , ztmask_b(:,:,:), ldxios = lrxios   ) ! need to extrapolate T/S
+      CALL iom_get( numror, jpdom_auto, 'e3t_n'  , ze3t_b(:,:,:)  , ldxios = lrxios )
+      CALL iom_get( numror, jpdom_auto, 'tn'     , zt_b(:,:,:)    , ldxios = lrxios )
+      CALL iom_get( numror, jpdom_auto, 'sn'     , zs_b(:,:,:)    , ldxios = lrxios )
+      IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
 
       ! compute run length
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ISF/isfrst.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ISF/isfrst.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ISF/isfrst.F90	(revision 13871)
@@ -53,9 +53,9 @@
       IF( iom_varid( numror, cfwf_b, ldstop = .FALSE. ) > 0 ) THEN
          IF(lwp) WRITE(numout,*) '          nit000-1 isf tracer content forcing fields read in the restart file'
-         IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
-         CALL iom_get( numror, jpdom_auto, cfwf_b, pfwf_b(:,:)        , ldxios = lroxios )   ! before ice shelf melt
-         CALL iom_get( numror, jpdom_auto, chc_b , ptsc_b (:,:,jp_tem), ldxios = lroxios )   ! before ice shelf heat flux
-         CALL iom_get( numror, jpdom_auto, csc_b , ptsc_b (:,:,jp_sal), ldxios = lroxios )   ! before ice shelf heat flux
-         IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+         IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
+         CALL iom_get( numror, jpdom_auto, cfwf_b, pfwf_b(:,:)        , ldxios = lrxios )   ! before ice shelf melt
+         CALL iom_get( numror, jpdom_auto, chc_b , ptsc_b (:,:,jp_tem), ldxios = lrxios )   ! before ice shelf heat flux
+         CALL iom_get( numror, jpdom_auto, csc_b , ptsc_b (:,:,jp_sal), ldxios = lrxios )   ! before ice shelf heat flux
+         IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
       ELSE
          pfwf_b(:,:)   = pfwf(:,:)
@@ -91,5 +91,5 @@
       !
       ! write restart variable
-      IF( lwxios ) CALL iom_swap( cwxios_context )
+      IF( lwxios ) CALL iom_swap( cw_ocerst_cxt )
       CALL iom_rstput( kt, nitrst, numrow, cfwf_b, pfwf(:,:)       , ldxios = lwxios )
       CALL iom_rstput( kt, nitrst, numrow, chc_b , ptsc(:,:,jp_tem), ldxios = lwxios )
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/SBC/sbcapr.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/SBC/sbcapr.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/SBC/sbcapr.F90	(revision 13871)
@@ -148,8 +148,8 @@
          !                                      ! ---------------------------------------- !
          !                                            !* Restart: read in restart file
-         IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
+         IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
          IF( ln_rstart .AND. iom_varid( numror, 'ssh_ibb', ldstop = .FALSE. ) > 0 ) THEN 
             IF(lwp) WRITE(numout,*) 'sbc_apr:   ssh_ibb read in the restart file'
-            CALL iom_get( numror, jpdom_auto, 'ssh_ibb', ssh_ibb, ldxios = lroxios )   ! before inv. barometer ssh
+            CALL iom_get( numror, jpdom_auto, 'ssh_ibb', ssh_ibb, ldxios = lrxios )   ! before inv. barometer ssh
             !
          ELSE                                         !* no restart: set from nit000 values
@@ -157,5 +157,5 @@
             ssh_ibb(:,:) = ssh_ib(:,:)
          ENDIF
-         IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+         IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
       ENDIF
       !                                         ! ---------------------------------------- !
@@ -165,5 +165,5 @@
          IF(lwp) WRITE(numout,*) 'sbc_apr : ssh_ib written in ocean restart file at it= ', kt,' date= ', ndastp
          IF(lwp) WRITE(numout,*) '~~~~'
-         IF( lwxios ) CALL iom_swap(      cwxios_context          )
+         IF( lwxios ) CALL iom_swap(      cw_ocerst_cxt          )
          CALL iom_rstput( kt, nitrst, numrow, 'ssh_ibb' , ssh_ib, ldxios = lwxios )
          IF( lwxios ) CALL iom_swap(      cxios_context          )
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/SBC/sbcmod.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/SBC/sbcmod.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/SBC/sbcmod.F90	(revision 13871)
@@ -497,17 +497,17 @@
       IF( kt == nit000 ) THEN                          !   set the forcing field at nit000 - 1    !
          !                                             ! ---------------------------------------- !
-         IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
+         IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
          IF( ln_rstart .AND.    &                               !* Restart: read in restart file
             & iom_varid( numror, 'utau_b', ldstop = .FALSE. ) > 0 ) THEN
             IF(lwp) WRITE(numout,*) '          nit000-1 surface forcing fields red in the restart file'
-            CALL iom_get( numror, jpdom_auto, 'utau_b', utau_b, ldxios = lroxios )   ! before i-stress  (U-point)
-            CALL iom_get( numror, jpdom_auto, 'vtau_b', vtau_b, ldxios = lroxios )   ! before j-stress  (V-point)
-            CALL iom_get( numror, jpdom_auto,  'qns_b',  qns_b, ldxios = lroxios )   ! before non solar heat flux (T-point)
+            CALL iom_get( numror, jpdom_auto, 'utau_b', utau_b, ldxios = lrxios )   ! before i-stress  (U-point)
+            CALL iom_get( numror, jpdom_auto, 'vtau_b', vtau_b, ldxios = lrxios )   ! before j-stress  (V-point)
+            CALL iom_get( numror, jpdom_auto,  'qns_b',  qns_b, ldxios = lrxios )   ! before non solar heat flux (T-point)
             ! The 3D heat content due to qsr forcing is treated in traqsr
-            ! CALL iom_get( numror, jpdom_auto, 'qsr_b' , qsr_b, ldxios = lroxios  ) ! before     solar heat flux (T-point)
-            CALL iom_get( numror, jpdom_auto, 'emp_b', emp_b, ldxios = lroxios  )    ! before     freshwater flux (T-point)
+            ! CALL iom_get( numror, jpdom_auto, 'qsr_b' , qsr_b, ldxios = lrxios  ) ! before     solar heat flux (T-point)
+            CALL iom_get( numror, jpdom_auto, 'emp_b', emp_b, ldxios = lrxios  )    ! before     freshwater flux (T-point)
             ! To ensure restart capability with 3.3x/3.4 restart files    !! to be removed in v3.6
             IF( iom_varid( numror, 'sfx_b', ldstop = .FALSE. ) > 0 ) THEN
-               CALL iom_get( numror, jpdom_auto, 'sfx_b', sfx_b, ldxios = lroxios )  ! before salt flux (T-point)
+               CALL iom_get( numror, jpdom_auto, 'sfx_b', sfx_b, ldxios = lrxios )  ! before salt flux (T-point)
             ELSE
                sfx_b (:,:) = sfx(:,:)
@@ -521,5 +521,5 @@
             sfx_b (:,:) = sfx (:,:)
          ENDIF
-         IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+         IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
       ENDIF
       !                                                ! ---------------------------------------- !
@@ -530,5 +530,5 @@
             &                    'at it= ', kt,' date= ', ndastp
          IF(lwp) WRITE(numout,*) '~~~~'
-         IF( lwxios ) CALL iom_swap(      cwxios_context          )
+         IF( lwxios ) CALL iom_swap(      cw_ocerst_cxt          )
          CALL iom_rstput( kt, nitrst, numrow, 'utau_b' , utau, ldxios = lwxios )
          CALL iom_rstput( kt, nitrst, numrow, 'vtau_b' , vtau, ldxios = lwxios )
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/SBC/sbcrnf.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/SBC/sbcrnf.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/SBC/sbcrnf.F90	(revision 13871)
@@ -157,11 +157,11 @@
       IF( kt == nit000 ) THEN                          !   set the forcing field at nit000 - 1    !
          !                                             ! ---------------------------------------- !
-         IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
+         IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
          IF( ln_rstart .AND.    &                               !* Restart: read in restart file
             & iom_varid( numror, 'rnf_b', ldstop = .FALSE. ) > 0 ) THEN
-            IF(lwp) WRITE(numout,*) '          nit000-1 runoff forcing fields red in the restart file', lroxios
-            CALL iom_get( numror, jpdom_auto, 'rnf_b', rnf_b, ldxios = lroxios )     ! before runoff
-            CALL iom_get( numror, jpdom_auto, 'rnf_hc_b', rnf_tsc_b(:,:,jp_tem), ldxios = lroxios )   ! before heat content of runoff
-            CALL iom_get( numror, jpdom_auto, 'rnf_sc_b', rnf_tsc_b(:,:,jp_sal), ldxios = lroxios )   ! before salinity content of runoff
+            IF(lwp) WRITE(numout,*) '          nit000-1 runoff forcing fields red in the restart file', lrxios
+            CALL iom_get( numror, jpdom_auto, 'rnf_b', rnf_b, ldxios = lrxios )     ! before runoff
+            CALL iom_get( numror, jpdom_auto, 'rnf_hc_b', rnf_tsc_b(:,:,jp_tem), ldxios = lrxios )   ! before heat content of runoff
+            CALL iom_get( numror, jpdom_auto, 'rnf_sc_b', rnf_tsc_b(:,:,jp_sal), ldxios = lrxios )   ! before salinity content of runoff
          ELSE                                                   !* no restart: set from nit000 values
             IF(lwp) WRITE(numout,*) '          nit000-1 runoff forcing fields set to nit000'
@@ -169,5 +169,5 @@
             rnf_tsc_b(:,:,:) = rnf_tsc(:,:,:)
          ENDIF
-         IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+         IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
       ENDIF
       !                                                ! ---------------------------------------- !
@@ -178,5 +178,5 @@
             &                    'at it= ', kt,' date= ', ndastp
          IF(lwp) WRITE(numout,*) '~~~~'
-         IF( lwxios ) CALL iom_swap(      cwxios_context          )
+         IF( lwxios ) CALL iom_swap(      cw_ocerst_cxt          )
          CALL iom_rstput( kt, nitrst, numrow, 'rnf_b' , rnf, ldxios = lwxios )
          CALL iom_rstput( kt, nitrst, numrow, 'rnf_hc_b', rnf_tsc(:,:,jp_tem), ldxios = lwxios )
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/SBC/sbcssm.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/SBC/sbcssm.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/SBC/sbcssm.F90	(revision 13871)
@@ -154,5 +154,5 @@
             IF(lwp) WRITE(numout,*) '~~~~~~~'
             zf_sbc = REAL( nn_fsbc, wp )
-            IF( lwxios ) CALL iom_swap(      cwxios_context          )
+            IF( lwxios ) CALL iom_swap(      cw_ocerst_cxt          )
             CALL iom_rstput( kt, nitrst, numrow, 'nn_fsbc', zf_sbc, ldxios = lwxios )    ! sbc frequency
             CALL iom_rstput( kt, nitrst, numrow, 'ssu_m'  , ssu_m, ldxios = lwxios  )    ! sea surface mean fields
@@ -206,17 +206,17 @@
          IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~ '
          !
-         IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
+         IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
          IF( ln_rstart .AND. iom_varid( numror, 'nn_fsbc', ldstop = .FALSE. ) > 0 ) THEN
             l_ssm_mean = .TRUE.
-            CALL iom_get( numror            , 'nn_fsbc', zf_sbc,ldxios = lroxios )     ! sbc frequency of previous run
-            CALL iom_get( numror, jpdom_auto, 'ssu_m'  , ssu_m, ldxios = lroxios, cd_type = 'U', psgn = -1._wp )    ! sea surface mean velocity    (U-point)
-            CALL iom_get( numror, jpdom_auto, 'ssv_m'  , ssv_m, ldxios = lroxios, cd_type = 'V', psgn = -1._wp )    !   "         "    velocity    (V-point)
-            CALL iom_get( numror, jpdom_auto, 'sst_m'  , sst_m, ldxios = lroxios )    !   "         "    temperature (T-point)
-            CALL iom_get( numror, jpdom_auto, 'sss_m'  , sss_m, ldxios = lroxios )    !   "         "    salinity    (T-point)
-            CALL iom_get( numror, jpdom_auto, 'ssh_m'  , ssh_m, ldxios = lroxios )    !   "         "    height      (T-point)
-            CALL iom_get( numror, jpdom_auto, 'e3t_m'  , e3t_m, ldxios = lroxios )    ! 1st level thickness          (T-point)
+            CALL iom_get( numror            , 'nn_fsbc', zf_sbc,ldxios = lrxios )     ! sbc frequency of previous run
+            CALL iom_get( numror, jpdom_auto, 'ssu_m'  , ssu_m, ldxios = lrxios, cd_type = 'U', psgn = -1._wp )    ! sea surface mean velocity    (U-point)
+            CALL iom_get( numror, jpdom_auto, 'ssv_m'  , ssv_m, ldxios = lrxios, cd_type = 'V', psgn = -1._wp )    !   "         "    velocity    (V-point)
+            CALL iom_get( numror, jpdom_auto, 'sst_m'  , sst_m, ldxios = lrxios )    !   "         "    temperature (T-point)
+            CALL iom_get( numror, jpdom_auto, 'sss_m'  , sss_m, ldxios = lrxios )    !   "         "    salinity    (T-point)
+            CALL iom_get( numror, jpdom_auto, 'ssh_m'  , ssh_m, ldxios = lrxios )    !   "         "    height      (T-point)
+            CALL iom_get( numror, jpdom_auto, 'e3t_m'  , e3t_m, ldxios = lrxios )    ! 1st level thickness          (T-point)
             ! fraction of solar net radiation absorbed in 1st T level
             IF( iom_varid( numror, 'frq_m', ldstop = .FALSE. ) > 0 ) THEN
-               CALL iom_get( numror, jpdom_auto, 'frq_m'  , frq_m, ldxios = lroxios  )
+               CALL iom_get( numror, jpdom_auto, 'frq_m'  , frq_m, ldxios = lrxios  )
             ELSE
                frq_m(:,:) = 1._wp   ! default definition
@@ -237,5 +237,5 @@
             ENDIF
          ENDIF
-         IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+         IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
       ENDIF
       !
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/TRA/traqsr.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/TRA/traqsr.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/TRA/traqsr.F90	(revision 13871)
@@ -135,14 +135,14 @@
       !                         !-----------------------------------!
       IF( kt == nit000 ) THEN          !==  1st time step  ==!
-         IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
+         IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
          IF( ln_rstart .AND. iom_varid( numror, 'qsr_hc_b', ldstop = .FALSE. ) > 0  .AND. .NOT.l_1st_euler ) THEN    ! read in restart
             IF(lwp) WRITE(numout,*) '          nit000-1 qsr tracer content forcing field read in the restart file'
             z1_2 = 0.5_wp
-            CALL iom_get( numror, jpdom_auto, 'qsr_hc_b', qsr_hc_b, ldxios = lroxios )   ! before heat content trend due to Qsr flux
+            CALL iom_get( numror, jpdom_auto, 'qsr_hc_b', qsr_hc_b, ldxios = lrxios )   ! before heat content trend due to Qsr flux
          ELSE                                           ! No restart or restart not found: Euler forward time stepping
             z1_2 = 1._wp
             qsr_hc_b(:,:,:) = 0._wp
          ENDIF
-         IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+         IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
       ELSE                             !==  Swap of qsr heat content  ==!
          z1_2 = 0.5_wp
@@ -294,5 +294,5 @@
       !
       IF( lrst_oce ) THEN     ! write in the ocean restart file
-         IF( lwxios ) CALL iom_swap(      cwxios_context          )
+         IF( lwxios ) CALL iom_swap(      cw_ocerst_cxt          )
          CALL iom_rstput( kt, nitrst, numrow, 'qsr_hc_b'   , qsr_hc     , ldxios = lwxios )
          CALL iom_rstput( kt, nitrst, numrow, 'fraqsr_1lev', fraqsr_1lev, ldxios = lwxios ) 
@@ -432,11 +432,11 @@
       !
       ! 1st ocean level attenuation coefficient (used in sbcssm)
-      IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
+      IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
       IF( iom_varid( numror, 'fraqsr_1lev', ldstop = .FALSE. ) > 0 ) THEN
-         CALL iom_get( numror, jpdom_auto, 'fraqsr_1lev'  , fraqsr_1lev, ldxios = lroxios  )
+         CALL iom_get( numror, jpdom_auto, 'fraqsr_1lev'  , fraqsr_1lev, ldxios = lrxios  )
       ELSE
          fraqsr_1lev(:,:) = 1._wp   ! default : no penetration
       ENDIF
-      IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+      IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
       !
    END SUBROUTINE tra_qsr_init
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/TRA/trasbc.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/TRA/trasbc.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/TRA/trasbc.F90	(revision 13871)
@@ -107,5 +107,5 @@
       !                             !==  Set before sbc tracer content fields  ==!
       IF( kt == nit000 ) THEN             !* 1st time-step
-         IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
+         IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
          IF( ln_rstart .AND.    &               ! Restart: read in restart file
               & iom_varid( numror, 'sbc_hc_b', ldstop = .FALSE. ) > 0 ) THEN
@@ -113,6 +113,6 @@
             zfact = 0.5_wp
             sbc_tsc(:,:,:) = 0._wp
-            CALL iom_get( numror, jpdom_auto, 'sbc_hc_b', sbc_tsc_b(:,:,jp_tem), ldxios = lroxios )   ! before heat content sbc trend
-            CALL iom_get( numror, jpdom_auto, 'sbc_sc_b', sbc_tsc_b(:,:,jp_sal), ldxios = lroxios )   ! before salt content sbc trend
+            CALL iom_get( numror, jpdom_auto, 'sbc_hc_b', sbc_tsc_b(:,:,jp_tem), ldxios = lrxios )   ! before heat content sbc trend
+            CALL iom_get( numror, jpdom_auto, 'sbc_sc_b', sbc_tsc_b(:,:,jp_sal), ldxios = lrxios )   ! before salt content sbc trend
          ELSE                                   ! No restart or restart not found: Euler forward time stepping
             zfact = 1._wp
@@ -120,5 +120,5 @@
             sbc_tsc_b(:,:,:) = 0._wp
          ENDIF
-         IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+         IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
       ELSE                                !* other time-steps: swap of forcing fields
          zfact = 0.5_wp
@@ -147,5 +147,5 @@
       !                  
       IF( lrst_oce ) THEN           !==  write sbc_tsc in the ocean restart file  ==!
-         IF( lwxios ) CALL iom_swap(      cwxios_context          )
+         IF( lwxios ) CALL iom_swap(      cw_ocerst_cxt          )
          CALL iom_rstput( kt, nitrst, numrow, 'sbc_hc_b', sbc_tsc(:,:,jp_tem), ldxios = lwxios )
          CALL iom_rstput( kt, nitrst, numrow, 'sbc_sc_b', sbc_tsc(:,:,jp_sal), ldxios = lwxios )
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ZDF/zdfgls.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ZDF/zdfgls.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ZDF/zdfgls.F90	(revision 13871)
@@ -1084,5 +1084,5 @@
          !                                   ! ---------------
          IF( ln_rstart ) THEN                   !* Read the restart file
-            IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
+            IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
             id1 = iom_varid( numror, 'en'    , ldstop = .FALSE. )
             id2 = iom_varid( numror, 'avt_k' , ldstop = .FALSE. )
@@ -1091,8 +1091,8 @@
             !
             IF( MIN( id1, id2, id3, id4 ) > 0 ) THEN        ! all required arrays exist
-               CALL iom_get( numror, jpdom_auto, 'en'    , en    , ldxios = lroxios )
-               CALL iom_get( numror, jpdom_auto, 'avt_k' , avt_k , ldxios = lroxios )
-               CALL iom_get( numror, jpdom_auto, 'avm_k' , avm_k , ldxios = lroxios )
-               CALL iom_get( numror, jpdom_auto, 'hmxl_n', hmxl_n, ldxios = lroxios )
+               CALL iom_get( numror, jpdom_auto, 'en'    , en    , ldxios = lrxios )
+               CALL iom_get( numror, jpdom_auto, 'avt_k' , avt_k , ldxios = lrxios )
+               CALL iom_get( numror, jpdom_auto, 'avm_k' , avm_k , ldxios = lrxios )
+               CALL iom_get( numror, jpdom_auto, 'hmxl_n', hmxl_n, ldxios = lrxios )
             ELSE                        
                IF(lwp) WRITE(numout,*)
@@ -1102,5 +1102,5 @@
                ! avt_k, avm_k already set to the background value in zdf_phy_init
             ENDIF
-            IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+            IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
          ELSE                                   !* Start from rest
             IF(lwp) WRITE(numout,*)
@@ -1114,5 +1114,5 @@
          !                                   ! -------------------
          IF(lwp) WRITE(numout,*) '---- gls-rst ----'
-         IF( lwxios ) CALL iom_swap(      cwxios_context         )
+         IF( lwxios ) CALL iom_swap(      cw_ocerst_cxt         )
          CALL iom_rstput( kt, nitrst, numrow, 'en'    , en    , ldxios = lwxios )
          CALL iom_rstput( kt, nitrst, numrow, 'avt_k' , avt_k , ldxios = lwxios )
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ZDF/zdfosm.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ZDF/zdfosm.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ZDF/zdfosm.F90	(revision 13871)
@@ -1467,8 +1467,8 @@
      !!-----------------------------------------------------------------------------
      IF( TRIM(cdrw) == 'READ'.AND. ln_rstart) THEN
-        IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
+        IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
         id1 = iom_varid( numror, 'wn'   , ldstop = .FALSE. )
         IF( id1 > 0 ) THEN                       ! 'wn' exists; read
-           CALL iom_get( numror, jpdom_auto, 'wn', ww, ldxios = lroxios )
+           CALL iom_get( numror, jpdom_auto, 'wn', ww, ldxios = lrxios )
            WRITE(numout,*) ' ===>>>> :  ww read from restart file'
         ELSE
@@ -1479,13 +1479,13 @@
         id2 = iom_varid( numror, 'hbli'   , ldstop = .FALSE. )
         IF( id1 > 0 .AND. id2 > 0) THEN                       ! 'hbl' exists; read and return
-           CALL iom_get( numror, jpdom_auto, 'hbl' , hbl , ldxios = lroxios )
-           CALL iom_get( numror, jpdom_auto, 'hbli', hbli, ldxios = lroxios  )
+           CALL iom_get( numror, jpdom_auto, 'hbl' , hbl , ldxios = lrxios )
+           CALL iom_get( numror, jpdom_auto, 'hbli', hbli, ldxios = lrxios  )
            WRITE(numout,*) ' ===>>>> :  hbl & hbli read from restart file'
-           IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+           IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
            RETURN
         ELSE                      ! 'hbl' & 'hbli' not in restart file, recalculate
            WRITE(numout,*) ' ===>>>> : previous run without osmosis scheme, hbl computed from stratification'
         END IF
-        IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+        IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
      END IF
 
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ZDF/zdfric.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ZDF/zdfric.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ZDF/zdfric.F90	(revision 13871)
@@ -206,13 +206,13 @@
          !           !* Read the restart file
          IF( ln_rstart ) THEN
-            IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
+            IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
             id1 = iom_varid( numror, 'avt_k', ldstop = .FALSE. )
             id2 = iom_varid( numror, 'avm_k', ldstop = .FALSE. )
             !
             IF( MIN( id1, id2 ) > 0 ) THEN         ! restart exists => read it
-               CALL iom_get( numror, jpdom_auto, 'avt_k', avt_k, ldxios = lroxios )
-               CALL iom_get( numror, jpdom_auto, 'avm_k', avm_k, ldxios = lroxios )
+               CALL iom_get( numror, jpdom_auto, 'avt_k', avt_k, ldxios = lrxios )
+               CALL iom_get( numror, jpdom_auto, 'avm_k', avm_k, ldxios = lrxios )
             ENDIF
-            IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+            IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
          ENDIF
          !           !* otherwise Kz already set to the background value in zdf_phy_init
@@ -221,5 +221,5 @@
          !                                   ! -------------------
          IF(lwp) WRITE(numout,*) '---- ric-rst ----'
-         IF( lwxios ) CALL iom_swap(      cwxios_context          )
+         IF( lwxios ) CALL iom_swap(      cw_ocerst_cxt          )
          CALL iom_rstput( kt, nitrst, numrow, 'avt_k', avt_k, ldxios = lwxios )
          CALL iom_rstput( kt, nitrst, numrow, 'avm_k', avm_k, ldxios = lwxios)
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ZDF/zdftke.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ZDF/zdftke.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ZDF/zdftke.F90	(revision 13871)
@@ -746,5 +746,5 @@
          !                                   ! ---------------
          IF( ln_rstart ) THEN                   !* Read the restart file
-            IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
+            IF( lrxios ) CALL iom_swap( TRIM(cr_ocerst_cxt) )
             id1 = iom_varid( numror, 'en'   , ldstop = .FALSE. )
             id2 = iom_varid( numror, 'avt_k', ldstop = .FALSE. )
@@ -753,8 +753,8 @@
             !
             IF( MIN( id1, id2, id3, id4 ) > 0 ) THEN      ! fields exist
-               CALL iom_get( numror, jpdom_auto, 'en'   , en   , ldxios = lroxios )
-               CALL iom_get( numror, jpdom_auto, 'avt_k', avt_k, ldxios = lroxios )
-               CALL iom_get( numror, jpdom_auto, 'avm_k', avm_k, ldxios = lroxios )
-               CALL iom_get( numror, jpdom_auto, 'dissl', dissl, ldxios = lroxios )
+               CALL iom_get( numror, jpdom_auto, 'en'   , en   , ldxios = lrxios )
+               CALL iom_get( numror, jpdom_auto, 'avt_k', avt_k, ldxios = lrxios )
+               CALL iom_get( numror, jpdom_auto, 'avm_k', avm_k, ldxios = lrxios )
+               CALL iom_get( numror, jpdom_auto, 'dissl', dissl, ldxios = lrxios )
             ELSE                                          ! start TKE from rest
                IF(lwp) WRITE(numout,*)
@@ -764,5 +764,5 @@
                ! avt_k, avm_k already set to the background value in zdf_phy_init
             ENDIF
-            IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+            IF( lrxios ) CALL iom_swap( TRIM(cxios_context) )
          ELSE                                   !* Start from rest
             IF(lwp) WRITE(numout,*)
@@ -776,5 +776,5 @@
          !                                   ! -------------------
          IF(lwp) WRITE(numout,*) '---- tke_rst ----'
-         IF( lwxios ) CALL iom_swap(      cwxios_context          ) 
+         IF( lwxios ) CALL iom_swap(      cw_ocerst_cxt          ) 
          CALL iom_rstput( kt, nitrst, numrow, 'en'   , en   , ldxios = lwxios )
          CALL iom_rstput( kt, nitrst, numrow, 'avt_k', avt_k, ldxios = lwxios )
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/step.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/step.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/step.F90	(revision 13871)
@@ -125,18 +125,18 @@
       ENDIF
       IF((kstp == nitrst) .AND. lwxios) THEN
-         CALL iom_swap(      cwxios_context          )
-         CALL iom_init_closedef(cwxios_context)
-         CALL iom_setkt( kstp - nit000 + 1,      cwxios_context          )
+         CALL iom_swap(      cw_ocerst_cxt          )
+         CALL iom_init_closedef(cw_ocerst_cxt)
+         CALL iom_setkt( kstp - nit000 + 1,      cw_ocerst_cxt          )
 #if defined key_top
-         CALL iom_swap(      cwtxios_context          )
-         CALL iom_init_closedef(cwtxios_context)
-         CALL iom_setkt( kstp - nit000 + 1,      cwtxios_context          )
+         CALL iom_swap(      cw_toprst_cxt          )
+         CALL iom_init_closedef(cw_toprst_cxt)
+         CALL iom_setkt( kstp - nit000 + 1,      cw_toprst_cxt          )
 #endif
       ENDIF
 #if defined key_si3
       IF(((kstp + nn_fsbc - 1) == nitrst) .AND. lwxios) THEN
-         CALL iom_swap(      cwixios_context          )
-         CALL iom_init_closedef(cwixios_context)
-         CALL iom_setkt( kstp - nit000 + 1,      cwixios_context          )
+         CALL iom_swap(      cw_icerst_cxt          )
+         CALL iom_init_closedef(cw_icerst_cxt)
+         CALL iom_setkt( kstp - nit000 + 1,      cw_icerst_cxt          )
       ENDIF
 #endif
@@ -355,5 +355,5 @@
       IF( kstp == nit000 ) THEN                          ! 1st time step only
                                         CALL iom_close( numror )   ! close input  ocean restart file
-         IF( lroxios )                  CALL iom_context_finalize(      crxios_context         )
+         IF( lrxios )                  CALL iom_context_finalize(      cr_ocerst_cxt         )
          IF(lwm)                        CALL FLUSH    ( numond )   ! flush output namelist oce
          IF(lwm .AND. numoni /= -1 )    CALL FLUSH    ( numoni )   ! flush output namelist ice (if exist)
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/stpMLF.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OCE/stpMLF.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OCE/stpMLF.F90	(revision 13871)
@@ -364,5 +364,5 @@
       IF( kstp == nitend .OR. indic < 0 ) THEN
                       CALL iom_context_finalize(      cxios_context          ) ! needed for XIOS+AGRIF
-         IF(lrxios) CALL iom_context_finalize(      crxios_context          )
+         IF(lrxios) CALL iom_context_finalize(      cr_ocerst_cxt          )
          IF( ln_crs ) CALL iom_context_finalize( trim(cxios_context)//"_crs" ) !
       ENDIF
Index: NEMO/branches/2020/dev_12905_xios_restart/src/OFF/nemogcm.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/OFF/nemogcm.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/OFF/nemogcm.F90	(revision 13871)
@@ -127,7 +127,7 @@
          !
       IF((istp == nitrst) .AND. lwxios) THEN
-         CALL iom_swap(      cwtxios_context          )
-         CALL iom_init_closedef(cwtxios_context)
-         CALL iom_setkt( istp - nit000 + 1,      cwtxios_context          )
+         CALL iom_swap(      cw_toprst_cxt          )
+         CALL iom_init_closedef(cw_toprst_cxt)
+         CALL iom_setkt( istp - nit000 + 1,      cw_toprst_cxt          )
       ENDIF
 
Index: NEMO/branches/2020/dev_12905_xios_restart/src/SAS/step.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/SAS/step.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/SAS/step.F90	(revision 13871)
@@ -91,11 +91,11 @@
                              CALL iom_setkt( kstp - nit000 + 1, cxios_context )   ! tell iom we are at time step kstp
       IF((kstp == nitrst) .AND. lwxios) THEN
-         CALL iom_swap(      cwxios_context          )
-         CALL iom_init_closedef(cwxios_context)
-         CALL iom_setkt( kstp - nit000 + 1,      cwxios_context          )
+         CALL iom_swap(      cw_ocerst_cxt          )
+         CALL iom_init_closedef(cw_ocerst_cxt)
+         CALL iom_setkt( kstp - nit000 + 1,      cw_ocerst_cxt          )
 #if defined key_top
-         CALL iom_swap(      cwtxios_context          )
-         CALL iom_init_closedef(cwtxios_context)
-         CALL iom_setkt( kstp - nit000 + 1,      cwtxios_context          )
+         CALL iom_swap(      cw_toprst_cxt          )
+         CALL iom_init_closedef(cw_toprst_cxt)
+         CALL iom_setkt( kstp - nit000 + 1,      cw_toprst_cxt          )
 #endif
       ENDIF
@@ -104,7 +104,7 @@
 #if defined key_si3
       IF(((kstp + nn_fsbc - 1) == nitrst) .AND. lwxios) THEN
-         CALL iom_swap(      cwixios_context          )
-         CALL iom_init_closedef(cwixios_context)
-         CALL iom_setkt( kstp - nit000 + 1,      cwixios_context          )
+         CALL iom_swap(      cw_icerst_cxt          )
+         CALL iom_init_closedef(cw_icerst_cxt)
+         CALL iom_setkt( kstp - nit000 + 1,      cw_icerst_cxt          )
       ENDIF
 #endif
@@ -148,5 +148,5 @@
       IF( kstp == nit000   ) THEN
             CALL iom_close( numror )                          ! close input  ocean restart file
-            IF( lroxios )     CALL iom_context_finalize(      crxios_context      )
+            IF( lrxios )     CALL iom_context_finalize(      cr_ocerst_cxt      )
       ENDIF
       
@@ -161,5 +161,5 @@
             CALL iom_close( numrow )     
          ELSE
-            CALL iom_context_finalize( cwxios_context )
+            CALL iom_context_finalize( cw_ocerst_cxt )
          ENDIF
          lrst_oce = .FALSE.
Index: NEMO/branches/2020/dev_12905_xios_restart/src/SWE/domvvl.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/SWE/domvvl.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/SWE/domvvl.F90	(revision 13871)
@@ -1251,5 +1251,5 @@
          !                                   ! ===================
          IF(lwp) WRITE(numout,*) '---- dom_vvl_rst ----'
-         IF( lwxios ) CALL iom_swap(      cwxios_context          )
+         IF( lwxios ) CALL iom_swap(      cw_ocerst_cxt          )
          !                                           ! --------- !
          !                                           ! all cases !
Index: NEMO/branches/2020/dev_12905_xios_restart/src/SWE/step.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/SWE/step.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/SWE/step.F90	(revision 13871)
@@ -304,5 +304,5 @@
       IF( kstp == nitend .OR. indic < 0 ) THEN 
                       CALL iom_context_finalize(      cxios_context          ) ! needed for XIOS+AGRIF
-                      IF(lrxios) CALL iom_context_finalize(      crxios_context          )
+                      IF(lrxios) CALL iom_context_finalize(      cr_ocerst_cxt          )
       ENDIF
 #endif
Index: NEMO/branches/2020/dev_12905_xios_restart/src/SWE/stepLF.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/SWE/stepLF.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/SWE/stepLF.F90	(revision 13871)
@@ -318,5 +318,5 @@
       IF( kstp == nitend .OR. indic < 0 ) THEN 
                       CALL iom_context_finalize(      cxios_context          ) ! needed for XIOS+AGRIF
-                      IF(lrxios) CALL iom_context_finalize(      crxios_context          )
+                      IF(lrxios) CALL iom_context_finalize(      cr_ocerst_cxt          )
       ENDIF
 #endif
Index: NEMO/branches/2020/dev_12905_xios_restart/src/SWE/stpRK3.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/src/SWE/stpRK3.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/src/SWE/stpRK3.F90	(revision 13871)
@@ -361,5 +361,5 @@
       IF( kstp == nitend .OR. indic < 0 ) THEN 
                       CALL iom_context_finalize(      cxios_context          ) ! needed for XIOS+AGRIF
-                      IF(lrxios) CALL iom_context_finalize(      crxios_context          )
+                      IF(lrxios) CALL iom_context_finalize(      cr_ocerst_cxt          )
       ENDIF
 #endif
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 )
Index: NEMO/branches/2020/dev_12905_xios_restart/tests/CANAL/MY_SRC/domvvl.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/tests/CANAL/MY_SRC/domvvl.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/tests/CANAL/MY_SRC/domvvl.F90	(revision 13871)
@@ -785,6 +785,6 @@
          IF( ln_rstart ) THEN                   !* Read the restart file
             CALL rst_read_open                  !  open the restart file if necessary
-            IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
-            CALL iom_get( numror, jpdom_auto, 'sshn'   , ssh(:,:,Kmm), ldxios = lroxios    )
+            IF( lrxios ) CALL iom_swap( cr_ocerst_cxt )
+            CALL iom_get( numror, jpdom_auto, 'sshn'   , ssh(:,:,Kmm), ldxios = lrxios    )
             !
             id1 = iom_varid( numror, 'e3t_b', ldstop = .FALSE. )
@@ -799,6 +799,6 @@
             !
             IF( MIN( id1, id2 ) > 0 ) THEN       ! all required arrays exist
-               CALL iom_get( numror, jpdom_auto, 'e3t_b', e3t(:,:,:,Kbb), ldxios = lroxios )
-               CALL iom_get( numror, jpdom_auto, 'e3t_n', e3t(:,:,:,Kmm), ldxios = lroxios )
+               CALL iom_get( numror, jpdom_auto, 'e3t_b', e3t(:,:,:,Kbb), ldxios = lrxios )
+               CALL iom_get( numror, jpdom_auto, 'e3t_n', e3t(:,:,:,Kmm), ldxios = lrxios )
                ! needed to restart if land processor not computed 
                IF(lwp) write(numout,*) 'dom_vvl_rst : e3t(:,:,:,Kbb) and e3t(:,:,:,Kmm) found in restart files'
@@ -814,5 +814,5 @@
                IF(lwp) write(numout,*) 'e3t_n set equal to e3t_b.'
                IF(lwp) write(numout,*) 'l_1st_euler is forced to true'
-               CALL iom_get( numror, jpdom_auto, 'e3t_b', e3t(:,:,:,Kbb), ldxios = lroxios )
+               CALL iom_get( numror, jpdom_auto, 'e3t_b', e3t(:,:,:,Kbb), ldxios = lrxios )
                e3t(:,:,:,Kmm) = e3t(:,:,:,Kbb)
                l_1st_euler = .true.
@@ -821,5 +821,5 @@
                IF(lwp) write(numout,*) 'e3t_b set equal to e3t_n.'
                IF(lwp) write(numout,*) 'l_1st_euler is forced to true'
-               CALL iom_get( numror, jpdom_auto, 'e3t_n', e3t(:,:,:,Kmm), ldxios = lroxios )
+               CALL iom_get( numror, jpdom_auto, 'e3t_n', e3t(:,:,:,Kmm), ldxios = lrxios )
                e3t(:,:,:,Kbb) = e3t(:,:,:,Kmm)
                l_1st_euler = .true.
@@ -846,6 +846,6 @@
                !                          ! ----------------------- !
                IF( MIN( id3, id4 ) > 0 ) THEN  ! all required arrays exist
-                  CALL iom_get( numror, jpdom_auto, 'tilde_e3t_b', tilde_e3t_b(:,:,:), ldxios = lroxios )
-                  CALL iom_get( numror, jpdom_auto, 'tilde_e3t_n', tilde_e3t_n(:,:,:), ldxios = lroxios )
+                  CALL iom_get( numror, jpdom_auto, 'tilde_e3t_b', tilde_e3t_b(:,:,:), ldxios = lrxios )
+                  CALL iom_get( numror, jpdom_auto, 'tilde_e3t_n', tilde_e3t_n(:,:,:), ldxios = lrxios )
                ELSE                            ! one at least array is missing
                   tilde_e3t_b(:,:,:) = 0.0_wp
@@ -856,5 +856,5 @@
                   !                       ! ------------ !
                   IF( id5 > 0 ) THEN  ! required array exists
-                     CALL iom_get( numror, jpdom_auto, 'hdiv_lf', hdiv_lf(:,:,:), ldxios = lroxios )
+                     CALL iom_get( numror, jpdom_auto, 'hdiv_lf', hdiv_lf(:,:,:), ldxios = lrxios )
                   ELSE                ! array is missing
                      hdiv_lf(:,:,:) = 0.0_wp
@@ -862,5 +862,5 @@
                ENDIF
             ENDIF
-            IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+            IF( lrxios ) CALL iom_swap( cxios_context )
             !
          ELSE                                   !* Initialize at "rest"
@@ -931,5 +931,5 @@
          !                                   ! ===================
          IF(lwp) WRITE(numout,*) '---- dom_vvl_rst ----'
-         IF( lwxios ) CALL iom_swap(      cwxios_context          )
+         IF( lwxios ) CALL iom_swap(      cw_ocerst_cxt          )
          !                                           ! --------- !
          !                                           ! all cases !
Index: NEMO/branches/2020/dev_12905_xios_restart/tests/VORTEX/MY_SRC/domvvl.F90
===================================================================
--- NEMO/branches/2020/dev_12905_xios_restart/tests/VORTEX/MY_SRC/domvvl.F90	(revision 13750)
+++ NEMO/branches/2020/dev_12905_xios_restart/tests/VORTEX/MY_SRC/domvvl.F90	(revision 13871)
@@ -785,6 +785,6 @@
          IF( ln_rstart ) THEN                   !* Read the restart file
             CALL rst_read_open                  !  open the restart file if necessary
-            IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
-            CALL iom_get( numror, jpdom_auto, 'sshn'   , ssh(:,:,Kmm), ldxios = lroxios    )
+            IF( lrxios ) CALL iom_swap( cr_ocerst_cxt )
+            CALL iom_get( numror, jpdom_auto, 'sshn'   , ssh(:,:,Kmm), ldxios = lrxios    )
             !
             id1 = iom_varid( numror, 'e3t_b', ldstop = .FALSE. )
@@ -799,6 +799,6 @@
             !
             IF( MIN( id1, id2 ) > 0 ) THEN       ! all required arrays exist
-               CALL iom_get( numror, jpdom_auto, 'e3t_b', e3t(:,:,:,Kbb), ldxios = lroxios )
-               CALL iom_get( numror, jpdom_auto, 'e3t_n', e3t(:,:,:,Kmm), ldxios = lroxios )
+               CALL iom_get( numror, jpdom_auto, 'e3t_b', e3t(:,:,:,Kbb), ldxios = lrxios )
+               CALL iom_get( numror, jpdom_auto, 'e3t_n', e3t(:,:,:,Kmm), ldxios = lrxios )
                ! needed to restart if land processor not computed 
                IF(lwp) write(numout,*) 'dom_vvl_rst : e3t(:,:,:,Kbb) and e3t(:,:,:,Kmm) found in restart files'
@@ -814,5 +814,5 @@
                IF(lwp) write(numout,*) 'e3t_n set equal to e3t_b.'
                IF(lwp) write(numout,*) 'l_1st_euler is forced to true'
-               CALL iom_get( numror, jpdom_auto, 'e3t_b', e3t(:,:,:,Kbb), ldxios = lroxios )
+               CALL iom_get( numror, jpdom_auto, 'e3t_b', e3t(:,:,:,Kbb), ldxios = lrxios )
                e3t(:,:,:,Kmm) = e3t(:,:,:,Kbb)
                l_1st_euler = .true.
@@ -821,5 +821,5 @@
                IF(lwp) write(numout,*) 'e3t_b set equal to e3t_n.'
                IF(lwp) write(numout,*) 'l_1st_euler is forced to true'
-               CALL iom_get( numror, jpdom_auto, 'e3t_n', e3t(:,:,:,Kmm), ldxios = lroxios )
+               CALL iom_get( numror, jpdom_auto, 'e3t_n', e3t(:,:,:,Kmm), ldxios = lrxios )
                e3t(:,:,:,Kbb) = e3t(:,:,:,Kmm)
                l_1st_euler = .true.
@@ -846,6 +846,6 @@
                !                          ! ----------------------- !
                IF( MIN( id3, id4 ) > 0 ) THEN  ! all required arrays exist
-                  CALL iom_get( numror, jpdom_auto, 'tilde_e3t_b', tilde_e3t_b(:,:,:), ldxios = lroxios )
-                  CALL iom_get( numror, jpdom_auto, 'tilde_e3t_n', tilde_e3t_n(:,:,:), ldxios = lroxios )
+                  CALL iom_get( numror, jpdom_auto, 'tilde_e3t_b', tilde_e3t_b(:,:,:), ldxios = lrxios )
+                  CALL iom_get( numror, jpdom_auto, 'tilde_e3t_n', tilde_e3t_n(:,:,:), ldxios = lrxios )
                ELSE                            ! one at least array is missing
                   tilde_e3t_b(:,:,:) = 0.0_wp
@@ -856,5 +856,5 @@
                   !                       ! ------------ !
                   IF( id5 > 0 ) THEN  ! required array exists
-                     CALL iom_get( numror, jpdom_auto, 'hdiv_lf', hdiv_lf(:,:,:), ldxios = lroxios )
+                     CALL iom_get( numror, jpdom_auto, 'hdiv_lf', hdiv_lf(:,:,:), ldxios = lrxios )
                   ELSE                ! array is missing
                      hdiv_lf(:,:,:) = 0.0_wp
@@ -862,5 +862,5 @@
                ENDIF
             ENDIF
-            IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
+            IF( lrxios ) CALL iom_swap( cxios_context )
             !
          ELSE                                   !* Initialize at "rest"
@@ -931,5 +931,5 @@
          !                                   ! ===================
          IF(lwp) WRITE(numout,*) '---- dom_vvl_rst ----'
-         IF( lwxios ) CALL iom_swap(      cwxios_context          )
+         IF( lwxios ) CALL iom_swap(      cw_ocerst_cxt          )
          !                                           ! --------- !
          !                                           ! all cases !
