Index: NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/IOM/iom.F90
===================================================================
--- NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/IOM/iom.F90	(revision 14219)
+++ NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/IOM/iom.F90	(revision 14644)
@@ -36,5 +36,5 @@
    USE phycst          ! physical constants
    USE dianam          ! build name of file
-#if defined key_iomput
+#if defined key_xios
    USE xios
 # endif
@@ -52,5 +52,5 @@
    PUBLIC   !   must be public to be able to access iom_def through iom
 
-#if defined key_iomput
+#if defined key_xios
    LOGICAL, PUBLIC, PARAMETER ::   lk_iomput = .TRUE.        !: iom_put flag
 #else
@@ -69,5 +69,5 @@
    PRIVATE iom_p1d_sp, iom_p2d_sp, iom_p3d_sp, iom_p4d_sp
    PRIVATE iom_p1d_dp, iom_p2d_dp, iom_p3d_dp, iom_p4d_dp
-#if defined key_iomput
+#if defined key_xios
    PRIVATE iom_set_domain_attr, iom_set_axis_attr, iom_set_field_attr, iom_set_file_attr, iom_get_file_attr, iom_set_grid_attr
    PRIVATE set_grid, set_grid_bounds, set_scalar, set_xmlatt, set_mooring, iom_sdate
@@ -116,5 +116,5 @@
       INTEGER         , OPTIONAL, INTENT(in)  :: kdid
       LOGICAL         , OPTIONAL, INTENT(in)  :: ld_closedef
-#if defined key_iomput
+#if defined key_xios
       !
       TYPE(xios_duration) :: dtime    = xios_duration(0, 0, 0, 0, 0, 0)
@@ -144,8 +144,10 @@
 
       llrstr = (cdname == cr_ocerst_cxt) .OR. (cdname == cr_icerst_cxt)
+      llrstr = llrstr .OR. (cdname == cr_ablrst_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_ablrst_cxt)
       llrstw = llrstw .OR. (cdname == cw_toprst_cxt)
       llrstw = llrstw .OR. (cdname == cw_sedrst_cxt)
@@ -309,5 +311,5 @@
       !!----------------------------------------------------------------------
       CHARACTER(len=*), OPTIONAL, INTENT(IN) :: cdname
-#if defined key_iomput
+#if defined key_xios
       LOGICAL :: llrstw
 
@@ -316,4 +318,5 @@
          llrstw = (cdname == cw_ocerst_cxt)
          llrstw = llrstw .OR. (cdname == cw_icerst_cxt)
+         llrstw = llrstw .OR. (cdname == cw_ablrst_cxt)
          llrstw = llrstw .OR. (cdname == cw_toprst_cxt)
          llrstw = llrstw .OR. (cdname == cw_sedrst_cxt)
@@ -344,5 +347,5 @@
       INTEGER, INTENT(IN) :: idnum
 
-#if defined key_iomput
+#if defined key_xios
       INTEGER                                    :: ndims, nvars, natts, unlimitedDimId, dimlen, xtype,mdims
       TYPE(xios_field)                           :: field_hdl
@@ -358,5 +361,5 @@
       LOGICAL                                    :: lmeta
 !metadata in restart file for restart read with XIOS
-      INTEGER, PARAMETER                         :: NMETA = 10
+      INTEGER, PARAMETER                         :: NMETA = 11
       CHARACTER(LEN=lc)                          :: meta(NMETA)
 
@@ -372,4 +375,5 @@
       meta(9) = "y"
       meta(10) = "numcat"
+      meta(11) = "nav_hgt"
 
       clinfo = '          iom_set_vars_active, file: '//TRIM(iom_file(idnum)%name)
@@ -450,5 +454,5 @@
       !!---------------------------------------------------------------------
       CHARACTER(len=*) :: cdrst_file
-#if defined key_iomput
+#if defined key_xios
       TYPE(xios_file) :: file_hdl
       TYPE(xios_filegroup) :: filegroup_hdl
@@ -489,5 +493,5 @@
       REAL(dp), OPTIONAL, INTENT(IN), DIMENSION(:, :, :) :: rd3
       REAL(sp), OPTIONAL, INTENT(IN), DIMENSION(:, :, :) :: rs3
-#if defined key_iomput
+#if defined key_xios
       TYPE(xios_field) :: field_hdl
       TYPE(xios_file) :: file_hdl
@@ -549,4 +553,6 @@
       IF(idlev == jpk) THEN
          axis_ref="nav_lev"
+      ELSEIF(idlev == jpka) THEN
+         axis_ref="nav_hgt"
 #if defined key_si3
       ELSEIF(idlev == jpl) THEN
@@ -594,5 +600,5 @@
       LOGICAL, INTENT(IN)               :: ld_rstr
       INTEGER :: ji
-#if defined key_iomput
+#if defined key_xios
       TYPE(xios_domaingroup)            :: domaingroup_hdl
       TYPE(xios_domain)                 :: domain_hdl
@@ -616,4 +622,6 @@
       CALL iom_set_axis_attr( "numcat", (/ (REAL(ji,wp), ji=1,jpl) /) )
 #endif
+      CALL xios_add_child(axisgroup_hdl, axis_hdl, "nav_hgt")
+      CALL iom_set_axis_attr( "nav_hgt", (/ (REAL(ji,wp), ji=1,jpka) /) )
       CALL xios_get_handle("scalar_definition", scalargroup_hdl)
       CALL xios_add_child(scalargroup_hdl, scalar_hdl, "grid_scalar")
@@ -639,4 +647,6 @@
          ELSEIF(kdid == numrir) THEN
             cdcont = cr_icerst_cxt
+         ELSEIF(kdid == numrar) THEN
+            cdcont = cr_ablrst_cxt
          ELSEIF(kdid == numrtr) THEN
             cdcont = cr_toprst_cxt
@@ -651,4 +661,6 @@
          ELSEIF(kdid == numriw) THEN
             cdcont = cw_icerst_cxt
+         ELSEIF(kdid == numraw) THEN
+            cdcont = cw_ablrst_cxt
          ELSEIF(kdid == numrtw) THEN
             cdcont = cw_toprst_cxt
@@ -667,5 +679,5 @@
       !!---------------------------------------------------------------------
       CHARACTER(len=*), INTENT(in) :: cdname
-#if defined key_iomput
+#if defined key_xios
       TYPE(xios_context) :: nemo_hdl
       IF( TRIM(Agrif_CFixed()) == '0' ) THEN
@@ -956,5 +968,5 @@
          ENDIF
       ELSE
-#if defined key_iomput
+#if defined key_xios
          IF(lwp) WRITE(numout,*) 'XIOS RST READ (0D): ', trim(cdvar)
          CALL iom_swap(context)
@@ -1004,5 +1016,5 @@
          ENDIF
       ELSE
-#if defined key_iomput
+#if defined key_xios
          IF(lwp) WRITE(numout,*) 'XIOS RST READ (0D): ', trim(cdvar)
          CALL iom_swap(context)
@@ -1368,5 +1380,5 @@
          !
       ELSE        ! read using XIOS. Only if KEY_IOMPUT is defined
-#if defined key_iomput
+#if defined key_xios
 !would be good to be able to check which context is active and swap only if current is not restart
          idvar = iom_varid( kiomid, cdvar )
@@ -1423,5 +1435,5 @@
       CHARACTER(LEN=*), INTENT(in ) ::   cdname
       REAL(wp), DIMENSION(jpi,jpj) ::   z2d
-#if defined key_iomput
+#if defined key_xios
       IF( xios_field_is_active( cdname, at_current_timestep_arg = .TRUE. ) ) THEN
          z2d(:,:) = 0._wp
@@ -1606,5 +1618,5 @@
 
       IF( llx ) THEN
-#ifdef key_iomput
+#ifdef key_xios
          IF( kt == kwrite ) THEN
             IF(lwp) write(numout,*) 'RESTART: write (XIOS 0D) ',trim(cdvar)
@@ -1646,5 +1658,5 @@
 
       IF( llx ) THEN
-#ifdef key_iomput
+#ifdef key_xios
          IF( kt == kwrite ) THEN
             IF(lwp) write(numout,*) 'RESTART: write (XIOS 0D) ',trim(cdvar)
@@ -1687,5 +1699,5 @@
 
       IF( llx ) THEN
-#ifdef key_iomput
+#ifdef key_xios
          IF( kt == kwrite ) THEN
             IF(lwp) write(numout,*) 'RESTART: write (XIOS 1D) ',trim(cdvar)
@@ -1727,5 +1739,5 @@
 
       IF( llx ) THEN
-#ifdef key_iomput
+#ifdef key_xios
          IF( kt == kwrite ) THEN
             IF(lwp) write(numout,*) 'RESTART: write (XIOS 1D) ',trim(cdvar)
@@ -1768,5 +1780,5 @@
 
       IF( llx ) THEN
-#ifdef key_iomput
+#ifdef key_xios
          IF( kt == kwrite ) THEN
             IF(lwp) write(numout,*) 'RESTART: write (XIOS 2D) ',trim(cdvar)
@@ -1808,5 +1820,5 @@
 
       IF( llx ) THEN
-#ifdef key_iomput
+#ifdef key_xios
          IF( kt == kwrite ) THEN
             IF(lwp) write(numout,*) 'RESTART: write (XIOS 2D) ',trim(cdvar)
@@ -1849,5 +1861,5 @@
 
       IF( llx ) THEN
-#ifdef key_iomput
+#ifdef key_xios
          IF( kt == kwrite ) THEN
             IF(lwp) write(numout,*) 'RESTART: write (XIOS 3D) ',trim(cdvar)
@@ -1889,5 +1901,5 @@
 
       IF( llx ) THEN
-#ifdef key_iomput
+#ifdef key_xios
          IF( kt == kwrite ) THEN
             IF(lwp) write(numout,*) 'RESTART: write (XIOS 3D) ',trim(cdvar)
@@ -1967,5 +1979,5 @@
       REAL(sp)        , INTENT(in) ::   pfield0d
       !!      REAL(wp)        , DIMENSION(jpi,jpj) ::   zz     ! masson
-#if defined key_iomput
+#if defined key_xios
 !!clem      zz(:,:)=pfield0d
 !!clem      CALL xios_send_field(cdname, zz)
@@ -1980,5 +1992,5 @@
       REAL(dp)        , INTENT(in) ::   pfield0d
 !!      REAL(wp)        , DIMENSION(jpi,jpj) ::   zz     ! masson
-#if defined key_iomput
+#if defined key_xios
 !!clem      zz(:,:)=pfield0d
 !!clem      CALL xios_send_field(cdname, zz)
@@ -1993,5 +2005,5 @@
       CHARACTER(LEN=*)          , INTENT(in) ::   cdname
       REAL(sp),     DIMENSION(:), INTENT(in) ::   pfield1d
-#if defined key_iomput
+#if defined key_xios
       CALL xios_send_field( cdname, RESHAPE( (/pfield1d/), (/1,1,SIZE(pfield1d)/) ) )
 #else
@@ -2003,5 +2015,5 @@
       CHARACTER(LEN=*)          , INTENT(in) ::   cdname
       REAL(dp),     DIMENSION(:), INTENT(in) ::   pfield1d
-#if defined key_iomput
+#if defined key_xios
       CALL xios_send_field( cdname, RESHAPE( (/pfield1d/), (/1,1,SIZE(pfield1d)/) ) )
 #else
@@ -2014,5 +2026,5 @@
       REAL(sp),     DIMENSION(:,:), INTENT(in) ::   pfield2d
       IF( iom_use(cdname) ) THEN
-#if defined key_iomput
+#if defined key_xios
          CALL xios_send_field( cdname, pfield2d )
 #else
@@ -2026,5 +2038,5 @@
       REAL(dp),     DIMENSION(:,:), INTENT(in) ::   pfield2d
       IF( iom_use(cdname) ) THEN
-#if defined key_iomput
+#if defined key_xios
          CALL xios_send_field( cdname, pfield2d )
 #else
@@ -2038,5 +2050,5 @@
       REAL(sp),       DIMENSION(:,:,:), INTENT(in) ::   pfield3d
       IF( iom_use(cdname) ) THEN
-#if defined key_iomput
+#if defined key_xios
          CALL xios_send_field( cdname, pfield3d )
 #else
@@ -2050,5 +2062,5 @@
       REAL(dp),       DIMENSION(:,:,:), INTENT(in) ::   pfield3d
       IF( iom_use(cdname) ) THEN
-#if defined key_iomput
+#if defined key_xios
          CALL xios_send_field( cdname, pfield3d )
 #else
@@ -2062,5 +2074,5 @@
       REAL(sp),       DIMENSION(:,:,:,:), INTENT(in) ::   pfield4d
       IF( iom_use(cdname) ) THEN
-#if defined key_iomput
+#if defined key_xios
          CALL xios_send_field (cdname, pfield4d )
 #else
@@ -2074,5 +2086,5 @@
       REAL(dp),       DIMENSION(:,:,:,:), INTENT(in) ::   pfield4d
       IF( iom_use(cdname) ) THEN
-#if defined key_iomput
+#if defined key_xios
          CALL xios_send_field (cdname, pfield4d )
 #else
@@ -2082,7 +2094,7 @@
    END SUBROUTINE iom_p4d_dp
 
-#if defined key_iomput
+#if defined key_xios
    !!----------------------------------------------------------------------
-   !!   'key_iomput'                                         XIOS interface
+   !!   'key_xios'                                         XIOS interface
    !!----------------------------------------------------------------------
 
@@ -2714,5 +2726,5 @@
 #else
    !!----------------------------------------------------------------------
-   !!   NOT 'key_iomput'                               a few dummy routines
+   !!   NOT 'key_xios'                               a few dummy routines
    !!----------------------------------------------------------------------
    SUBROUTINE iom_setkt( kt, cdname )
@@ -2736,5 +2748,5 @@
    LOGICAL FUNCTION iom_use( cdname )
       CHARACTER(LEN=*), INTENT(in) ::   cdname
-#if defined key_iomput
+#if defined key_xios
       iom_use = xios_field_is_active( cdname )
 #else
@@ -2747,5 +2759,5 @@
       REAL(wp)        , INTENT(out) ::   pmiss_val
       REAL(dp)                      ::   ztmp_pmiss_val
-#if defined key_iomput
+#if defined key_xios
       ! get missing value
       CALL xios_get_field_attr( cdname, default_value = ztmp_pmiss_val )
