Index: branches/UKMO/dev_r5518_GO6_package_XIOS_read/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90
===================================================================
--- branches/UKMO/dev_r5518_GO6_package_XIOS_read/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90	(revision 8014)
+++ branches/UKMO/dev_r5518_GO6_package_XIOS_read/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90	(revision 8038)
@@ -260,91 +260,97 @@
 !set names for variables in restart file
 
-        rst_fields(:)="NO_NAME"
-
-        rst_fields(1)="rdt"
-        rst_fields(2)="rdttra1"
-        rst_fields(3)="un"
-        rst_fields(4)="ub"
-        rst_fields(5)="vn"
-        rst_fields(6)="vb"
-        rst_fields(7)="tn"
-        rst_fields(8)="tb"
-        rst_fields(9)="sn"
-        rst_fields(10)="sb"
-        rst_fields(11)="sshn"
-        rst_fields(12)="sshb"
-        rst_fields(13)="hdivn"
-        rst_fields(14)="hdivb"
-        rst_fields(15)="rhop"
-        rst_fields(16)="rotn"
-        rst_fields(17)="rotb"
-        rst_fields(18)="kt"
-        rst_fields(19)="ndastp"
-        rst_fields(20)="adatrj"
-        rst_fields(21)="utau_b"
-        rst_fields(22)="vtau_b"
-        rst_fields(23)="qns_b"
-        rst_fields(24)="emp_b"
-        rst_fields(25)="sfx_b"
-        rst_fields(26)="en" 
-        rst_fields(27)="avt"
-        rst_fields(28)="avm"
-        rst_fields(29)="avmu"
-        rst_fields(30)="avmv"
-        rst_fields(31)="dissl"
-        rst_fields(32)="sbc_hc_b"
-        rst_fields(33)="sbc_sc_b"
-        rst_fields(34)="qsr_hc_b"
-        rst_fields(35)="gcx"
-        rst_fields(36)="gcxb"
-        rst_fields(37)="fraqsr_1lev"
-        rst_fields(38)="greenland_icesheet_mass"
-        rst_fields(39)="greenland_icesheet_timelapsed"
-        rst_fields(40)="greenland_icesheet_mass_roc"
-        rst_fields(41)="antarctica_icesheet_mass"
-        rst_fields(42)="antarctica_icesheet_timelapsed"
-        rst_fields(43)="antarctica_icesheet_mass_roc"
-        rst_fields(44)="rhd"
-        rst_fields(45)="frc_v"
-        rst_fields(46)="frc_t"
-        rst_fields(47)="frc_s"
-        rst_fields(48)="frc_wn_t"
-        rst_fields(49)="frc_wn_s"
-        rst_fields(50)="ssh_ini"
-        rst_fields(51)="e3t_ini"
-        rst_fields(52)="hc_loc_ini"
-        rst_fields(53)="sc_loc_ini"
-        rst_fields(54)="ssh_hc_loc_ini"
-        rst_fields(55)="ssh_sc_loc_ini"
-        rst_fields(56)="fse3t_b"
-        rst_fields(57)="fse3t_n"
-        rst_fields(58)="tilde_e3t_b"
-        rst_fields(59)="tilde_e3t_n"
-        rst_fields(60)="hdiv_lf"
-        rst_fields(61)="ub2_b"
-        rst_fields(62)="vb2_b"
-        rst_fields(63)="sshbb_e"
-        rst_fields(64)="ubb_e"
-        rst_fields(65)="vbb_e"
-        rst_fields(66)="sshb_e"
-        rst_fields(67)="ub_e"
-        rst_fields(68)="vb_e"
-        rst_fields(69)="fwf_isf_b"
-        rst_fields(70)="isf_sc_b"
-        rst_fields(71)="isf_hc_b"
-        rst_fields(72)="ssh_ibb"
-        rst_fields(73)="rnf_b"
-        rst_fields(74)="rnf_hc_b"
-        rst_fields(75)="rnf_sc_b"
-        rst_fields(76)="nn_fsbc"
-        rst_fields(77)="ssu_m"
-        rst_fields(78)="ssv_m"
-        rst_fields(79)="sst_m"
-        rst_fields(80)="sss_m"
-        rst_fields(81)="ssh_m"
-        rst_fields(82)="e3t_m"
-        rst_fields(83)="frq_m"
-        rst_fields(84)="avmb"
-        rst_fields(85)="avtb"
+        rst_fields(:)%vname="NO_NAME";         rst_fields(:)%grid="NO_GRID"
+
+        rst_fields(1)%vname="rdt";             rst_fields(1)% grid="grid_scalar"
+        rst_fields(2)%vname="rdttra1";         rst_fields(2)% grid="grid_scalar"      
+        rst_fields(3)%vname="un";              rst_fields(3)% grid="grid_N_3D"
+        rst_fields(4)%vname="ub";              rst_fields(4)% grid="grid_N_3D"
+        rst_fields(5)%vname="vn";              rst_fields(5)% grid="grid_N_3D"
+        rst_fields(6)%vname="vb";              rst_fields(6)% grid="grid_N_3D"  
+        rst_fields(7)%vname="tn";              rst_fields(7)% grid="grid_N_3D"
+        rst_fields(8)%vname="tb";              rst_fields(8)% grid="grid_N_3D"
+        rst_fields(9)%vname="sn";              rst_fields(9)% grid="grid_N_3D"
+        rst_fields(10)%vname="sb";             rst_fields(10)%grid="grid_N_3D"
+        rst_fields(11)%vname="sshn";           rst_fields(11)%grid="grid_N"
+        rst_fields(12)%vname="sshb";           rst_fields(12)%grid="grid_N"
+        rst_fields(13)%vname="hdivn";          rst_fields(13)%grid="grid_N_3D"
+        rst_fields(14)%vname="hdivb";          rst_fields(14)%grid="grid_N_3D"
+        rst_fields(15)%vname="rhop";           rst_fields(15)%grid="grid_N_3D"
+        rst_fields(16)%vname="rotn";           rst_fields(16)%grid="grid_N_3D"
+        rst_fields(17)%vname="rotb";           rst_fields(17)%grid="grid_N_3D"
+        rst_fields(18)%vname="kt";             rst_fields(18)%grid="grid_scalar"
+        rst_fields(19)%vname="ndastp";         rst_fields(19)%grid="grid_scalar"
+        rst_fields(20)%vname="adatrj";         rst_fields(20)%grid="grid_scalar"
+        rst_fields(21)%vname="utau_b";         rst_fields(21)%grid="grid_N"
+        rst_fields(22)%vname="vtau_b";         rst_fields(22)%grid="grid_N"
+        rst_fields(23)%vname="qns_b";          rst_fields(23)%grid="grid_N"
+        rst_fields(24)%vname="emp_b";          rst_fields(24)%grid="grid_N"
+        rst_fields(25)%vname="sfx_b";          rst_fields(25)%grid="grid_N"
+        rst_fields(26)%vname="en" ;            rst_fields(26)%grid="grid_N_3D" 
+        rst_fields(27)%vname="avt";            rst_fields(27)%grid="grid_N_3D"
+        rst_fields(28)%vname="avm";            rst_fields(28)%grid="grid_N_3D"
+        rst_fields(29)%vname="avmu";           rst_fields(29)%grid="grid_N_3D"
+        rst_fields(30)%vname="avmv";           rst_fields(30)%grid="grid_N_3D"
+        rst_fields(31)%vname="dissl";          rst_fields(31)%grid="grid_N_3D"
+        rst_fields(32)%vname="sbc_hc_b";       rst_fields(32)%grid="grid_N"
+        rst_fields(33)%vname="sbc_sc_b";       rst_fields(33)%grid="grid_N"
+        rst_fields(34)%vname="qsr_hc_b";       rst_fields(34)%grid="grid_N_3D"
+        rst_fields(35)%vname="gcx";            rst_fields(35)%grid="grid_N"
+        rst_fields(36)%vname="gcxb";           rst_fields(36)%grid="grid_N"
+        rst_fields(37)%vname="fraqsr_1lev";    rst_fields(37)%grid="grid_N"
+        rst_fields(38)%vname="greenland_icesheet_mass"
+                                               rst_fields(38)%grid="grid_scalar"
+        rst_fields(39)%vname="greenland_icesheet_timelapsed"
+                                               rst_fields(39)%grid="grid_scalar"
+        rst_fields(40)%vname="greenland_icesheet_mass_roc"
+                                               rst_fields(40)%grid="grid_scalar"
+        rst_fields(41)%vname="antarctica_icesheet_mass"
+                                               rst_fields(41)%grid="grid_scalar"
+        rst_fields(42)%vname="antarctica_icesheet_timelapsed"
+                                               rst_fields(42)%grid="grid_scalar"
+        rst_fields(43)%vname="antarctica_icesheet_mass_roc"
+                                               rst_fields(43)%grid="grid_scalar"
+        rst_fields(44)%vname="rhd";            rst_fields(44)%grid="grid_N_3D"
+        rst_fields(45)%vname="frc_v";          rst_fields(45)%grid="grid_scalar"
+        rst_fields(46)%vname="frc_t";          rst_fields(46)%grid="grid_scalar"
+        rst_fields(47)%vname="frc_s";          rst_fields(47)%grid="grid_scalar"
+        rst_fields(48)%vname="frc_wn_t";       rst_fields(48)%grid="grid_scalar"
+        rst_fields(49)%vname="frc_wn_s";       rst_fields(49)%grid="grid_scalar"
+        rst_fields(50)%vname="ssh_ini";        rst_fields(50)%grid="grid_N"
+        rst_fields(51)%vname="e3t_ini";        rst_fields(51)%grid="grid_N_3D"
+        rst_fields(52)%vname="hc_loc_ini";     rst_fields(52)%grid="grid_N_3D"
+        rst_fields(53)%vname="sc_loc_ini";     rst_fields(53)%grid="grid_N_3D"
+        rst_fields(54)%vname="ssh_hc_loc_ini"; rst_fields(54)%grid="grid_N"
+        rst_fields(55)%vname="ssh_sc_loc_ini"; rst_fields(55)%grid="grid_N"
+        rst_fields(56)%vname="fse3t_b";        rst_fields(56)%grid="grid_N_3D"
+        rst_fields(57)%vname="fse3t_n";        rst_fields(57)%grid="grid_N_3D"
+        rst_fields(58)%vname="tilde_e3t_b";    rst_fields(58)%grid="grid_N"
+        rst_fields(59)%vname="tilde_e3t_n";    rst_fields(59)%grid="grid_N"
+        rst_fields(60)%vname="hdiv_lf";        rst_fields(60)%grid="grid_N"
+        rst_fields(61)%vname="ub2_b";          rst_fields(61)%grid="grid_N"
+        rst_fields(62)%vname="vb2_b";          rst_fields(62)%grid="grid_N"
+        rst_fields(63)%vname="sshbb_e";        rst_fields(63)%grid="grid_N"
+        rst_fields(64)%vname="ubb_e";          rst_fields(64)%grid="grid_N"
+        rst_fields(65)%vname="vbb_e";          rst_fields(65)%grid="grid_N"
+        rst_fields(66)%vname="sshb_e";         rst_fields(66)%grid="grid_N"
+        rst_fields(67)%vname="ub_e";           rst_fields(67)%grid="grid_N"
+        rst_fields(68)%vname="vb_e";           rst_fields(68)%grid="grid_N"
+        rst_fields(69)%vname="fwf_isf_b";      rst_fields(69)%grid="grid_N"
+        rst_fields(70)%vname="isf_sc_b";       rst_fields(70)%grid="grid_N"
+        rst_fields(71)%vname="isf_hc_b";       rst_fields(71)%grid="grid_N"
+        rst_fields(72)%vname="ssh_ibb";        rst_fields(72)%grid="grid_N"
+        rst_fields(73)%vname="rnf_b";          rst_fields(73)%grid="grid_N"
+        rst_fields(74)%vname="rnf_hc_b";       rst_fields(74)%grid="grid_N"
+        rst_fields(75)%vname="rnf_sc_b";       rst_fields(75)%grid="grid_N"
+        rst_fields(76)%vname="nn_fsbc";        rst_fields(76)%grid="grid_scalar"
+        rst_fields(77)%vname="ssu_m";          rst_fields(77)%grid="grid_N"
+        rst_fields(78)%vname="ssv_m";          rst_fields(78)%grid="grid_N"
+        rst_fields(79)%vname="sst_m";          rst_fields(79)%grid="grid_N"
+        rst_fields(80)%vname="sss_m";          rst_fields(80)%grid="grid_N"
+        rst_fields(81)%vname="ssh_m";          rst_fields(81)%grid="grid_N"
+        rst_fields(82)%vname="e3t_m";          rst_fields(82)%grid="grid_N"
+        rst_fields(83)%vname="frq_m";          rst_fields(83)%grid="grid_N"
+        rst_fields(84)%vname="avmb";           rst_fields(84)%grid="Vgrid"
+        rst_fields(85)%vname="avtb";           rst_fields(85)%grid="Vgrid"
 
    END SUBROUTINE set_rst_vars
@@ -353,20 +359,26 @@
    SUBROUTINE set_rstr_active()
 !sets enabled = .TRUE. for each field in restart file
-        CHARACTER(len=256) :: rst_file
-        INTEGER :: i
+   CHARACTER(len=256) :: rst_file
+   TYPE(xios_field) :: field_hdl
+   TYPE(xios_file) :: file_hdl
+   TYPE(xios_filegroup) :: filegroup_hdl
+   INTEGER :: i
 
         rst_file = TRIM(cn_ocerst_indir)//TRIM(cn_ocerst_in)
 !set name of the restart file and enable available fields
         if(lwp) WRITE(numout,*) 'Setting restart filename (for XIOS) to: ',rst_file
-        CALL xios_set_file_attr( "rrestart", enabled = .TRUE.)
-        CALL xios_set_file_attr( "rrestart", name=trim(rst_file))
-!eneble fields in restart file 
+        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(rst_file), type="one_file", &
+             par_access="collective", enabled=.TRUE., mode="read",                 &
+             output_freq=xios_timestep)
+!defin files for restart context
         DO i = 1, max_rst_fields
-         IF( TRIM(rst_fields(i)) /= "NO_NAME") THEN
-           IF( iom_varid( numror, TRIM(rst_fields(i)), ldstop = .FALSE. ) > 0 ) THEN
-             IF ( xios_is_valid_field( TRIM(rst_fields(i)) ) ) THEN
-                CALL xios_set_field_attr ( TRIM(rst_fields(i)), enabled = .TRUE. ) 
-                if(lwp) WRITE(numout,*) TRIM(rst_fields(i)), ' enabled'
-             ENDIF
+         IF( TRIM(rst_fields(i)%vname) /= "NO_NAME") THEN
+           IF( iom_varid( numror, TRIM(rst_fields(i)%vname), ldstop = .FALSE. ) > 0 ) THEN
+                CALL xios_add_child(file_hdl, field_hdl, TRIM(rst_fields(i)%vname))
+                CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_fields(i)%vname), &
+                     grid_ref = TRIM(rst_fields(i)%grid ), operation = "instant")
+                if(lwp) WRITE(numout,*) TRIM(rst_fields(i)%vname), ' enabled'
            ENDIF
          ENDIF
Index: branches/UKMO/dev_r5518_GO6_package_XIOS_read/NEMOGCM/NEMO/OPA_SRC/IOM/iom_def.F90
===================================================================
--- branches/UKMO/dev_r5518_GO6_package_XIOS_read/NEMOGCM/NEMO/OPA_SRC/IOM/iom_def.F90	(revision 8014)
+++ branches/UKMO/dev_r5518_GO6_package_XIOS_read/NEMOGCM/NEMO/OPA_SRC/IOM/iom_def.F90	(revision 8038)
@@ -74,6 +74,13 @@
    END TYPE file_descriptor
    TYPE(file_descriptor), DIMENSION(jpmax_files), PUBLIC ::   iom_file !: array containing the info for all opened files
-   INTEGER, PARAMETER, PUBLIC                   :: max_rst_fields = 85  !maximum number of variables in a restart file
-   CHARACTER(len=30),DIMENSION(max_rst_fields), PUBLIC   :: rst_fields ! names of variables in restart file
+
+   INTEGER, PARAMETER, PUBLIC                   :: max_rst_fields = 85  
+!  CHARACTER(len=30),DIMENSION(max_rst_fields), PUBLIC   :: rst_fields ! names of variables in restart file
+
+   TYPE, PUBLIC :: RST_FIELD  
+    CHARACTER(len=30) :: vname ! names of variables in restart file
+    CHARACTER(len=30) :: grid
+   END TYPE RST_FIELD
+   TYPE(RST_FIELD), PUBLIC :: rst_fields(max_rst_fields)
 
 !$AGRIF_END_DO_NOT_TREAT
