Index: /trunk/DOC/chantiers/commit_importants.log
===================================================================
--- /trunk/DOC/chantiers/commit_importants.log	(revision 1574)
+++ /trunk/DOC/chantiers/commit_importants.log	(revision 1575)
@@ -1844,2 +1844,17 @@
 routine.
 
+**********************
+**** commit_v1575 ****
+**********************
+Ehouarn: Further adaptations to keep up with changes in LMDZ5 concerning
+physics/dynamics separation (up to rev r2575 of LMDZ5)
+
+* dyn3d_common:
+- infotrac.F90 : propagate initialisations for INCA (Earth GCM)
+
+* misc:
+- wxios.F90: updates to use the XIOS2 library
+
+* dynphy_lonlat:
+- grid_atob_m.F90: fix for some zoomed grid interpolation cases
+
Index: /trunk/LMDZ.COMMON/libf/dyn3d_common/infotrac.F90
===================================================================
--- /trunk/LMDZ.COMMON/libf/dyn3d_common/infotrac.F90	(revision 1574)
+++ /trunk/LMDZ.COMMON/libf/dyn3d_common/infotrac.F90	(revision 1575)
@@ -86,4 +86,7 @@
     INTEGER, ALLOCATABLE, DIMENSION(:) :: hadv  ! index of horizontal trasport schema
     INTEGER, ALLOCATABLE, DIMENSION(:) :: vadv  ! index of vertical trasport schema
+
+    INTEGER, ALLOCATABLE, DIMENSION(:) :: hadv_inca  ! index of horizontal trasport schema
+    INTEGER, ALLOCATABLE, DIMENSION(:) :: vadv_inca  ! index of vertical trasport schema
 
     CHARACTER(len=15), ALLOCATABLE, DIMENSION(:) :: tnom_0  ! tracer short name
@@ -196,4 +199,7 @@
 #endif
        nqtrue=nbtr+nqo
+
+       ALLOCATE(hadv_inca(nbtr), vadv_inca(nbtr)) 
+
      END IF   ! type_trac
 
@@ -375,22 +381,69 @@
 !>jyg
 ! le module de chimie fournit les noms des traceurs
-! et les schemas d'advection associes.
+! et les schemas d'advection associes. excepte pour ceux lus 
+! dans traceur.def 
+       IF (ierr .eq. 0) then 
+          DO iq=1,nqo
+
+             write(*,*) 'infotrac 237: iq=',iq
+             ! CRisi: ajout du nom du fluide transporteur
+             ! mais rester retro compatible
+             READ(90,'(I2,X,I2,X,A)',IOSTAT=IOstatus) hadv(iq),vadv(iq),tchaine
+             write(lunout,*) 'iq,hadv(iq),vadv(iq)=',iq,hadv(iq),vadv(iq)
+             write(lunout,*) 'tchaine=',trim(tchaine)
+             write(*,*) 'infotrac 238: IOstatus=',IOstatus
+             if (IOstatus.ne.0) then
+                CALL abort_gcm('infotrac_init','Pb dans la lecture de traceur.def',1)
+             endif
+             ! Y-a-t-il 1 ou 2 noms de traceurs? -> On regarde s'il y a un
+             ! espace ou pas au milieu de la chaine.
+             continu=.true.
+             nouveau_traceurdef=.false.
+             iiq=1
+             do while (continu)
+                if (tchaine(iiq:iiq).eq.' ') then
+                  nouveau_traceurdef=.true.
+                  continu=.false.
+                else if (iiq.lt.LEN_TRIM(tchaine)) then
+                  iiq=iiq+1
+                else
+                  continu=.false.
+                endif
+             enddo
+             write(*,*) 'iiq,nouveau_traceurdef=',iiq,nouveau_traceurdef
+             if (nouveau_traceurdef) then
+                write(lunout,*) 'C''est la nouvelle version de traceur.def'
+                tnom_0(iq)=tchaine(1:iiq-1)
+                tnom_transp(iq)=tchaine(iiq+1:15)
+             else
+                write(lunout,*) 'C''est l''ancienne version de traceur.def'
+                write(lunout,*) 'On suppose que les traceurs sont tous d''air'
+                tnom_0(iq)=tchaine
+                tnom_transp(iq) = 'air'
+             endif
+             write(lunout,*) 'tnom_0(iq)=<',trim(tnom_0(iq)),'>'
+             write(lunout,*) 'tnom_transp(iq)=<',trim(tnom_transp(iq)),'>'
+
+          END DO !DO iq=1,nqtrue
+          CLOSE(90)  
+       ELSE  !! if traceur.def doesn't exist 
+          tnom_0(1)='H2Ov'
+          tnom_transp(1) = 'air'
+          tnom_0(2)='H2Ol'
+          tnom_transp(2) = 'air'
+          hadv(1) = 10
+          hadv(2) = 10 
+          vadv(1) = 10 
+          vadv(2) = 10 
+       ENDIF
      
 #ifdef INCA
        CALL init_transport( &
-            hadv, &
-            vadv, &
+            hadv_inca, &
+            vadv_inca, &
             conv_flg, &
             pbl_flg,  &
             tracnam)
 #endif
-       tnom_0(1)='H2Ov'
-       tnom_transp(1) = 'air'
-       tnom_0(2)='H2Ol'
-       tnom_transp(2) = 'air'
-       IF (nqo == 3) then
-         tnom_0(3)='H2Oi'     !! jyg
-         tnom_transp(3) = 'air'
-       endif
 
 !jyg<
Index: /trunk/LMDZ.COMMON/libf/dynphy_lonlat/grid_atob_m.F90
===================================================================
--- /trunk/LMDZ.COMMON/libf/dynphy_lonlat/grid_atob_m.F90	(revision 1574)
+++ /trunk/LMDZ.COMMON/libf/dynphy_lonlat/grid_atob_m.F90	(revision 1575)
@@ -6,5 +6,4 @@
 
   USE assert_eq_m, ONLY: assert_eq
-  REAL, SAVE :: pi, deg2rad
 
   PRIVATE
@@ -22,29 +21,34 @@
 ! Arguments:
   REAL,              INTENT(IN)  :: x_i(:), y_i(:) !-- INPUT  X&Y COOR. (mi)(ni)
-  REAL,              INTENT(IN)  :: x_o(:), y_o(:) !-- OUTPUT X&Y COOR. (mi)(ni)
+  REAL,              INTENT(IN)  :: x_o(:), y_o(:) !-- OUTPUT X&Y COOR. (mo)(no)
   REAL,              INTENT(OUT) :: d_o1(:,:)      !-- OUTPUT FIELD     (mo,no)
   REAL,    OPTIONAL, INTENT(IN)  :: d_i (:,:)      !-- INPUT FIELD      (mi,ni)
-  LOGICAL, OPTIONAL, INTENT(IN)  :: msk (:,:)      !-- MASK             (mi,ni)
+  LOGICAL, OPTIONAL, INTENT(IN)  :: msk (:,:)      !-- MASK             (mo,no)
   REAL,    OPTIONAL, INTENT(OUT) :: d_o2(:,:)      !-- OUTPUT FOR d_i^2 (mo,no)
 !-------------------------------------------------------------------------------
 ! Local variables:
   CHARACTER(LEN=256) :: modname="fine2coarse"
-  INTEGER :: mi, ni, ii, ji, mo, no, io, jo, nr(2), m1, n1, m2, n2, nn
-  INTEGER :: num_tot(SIZE(x_o),SIZE(y_o))
-  LOGICAL :: found(SIZE(x_o),SIZE(y_o)), li
-  LOGICAL :: mask (SIZE(x_i),SIZE(y_i)), lo
-  REAL    :: dist (SIZE(x_o),SIZE(y_o))
-  REAL    :: a(SIZE(x_o)), b(SIZE(x_o)), c(SIZE(y_o)), d(SIZE(y_o)), inc
-  REAL, PARAMETER :: thresh=1.E-5
-!-------------------------------------------------------------------------------
-  mask(:,:)=.TRUE.; IF(PRESENT(msk)) mask(:,:)=msk(:,:)
-  mi=SIZE(x_i); m1=mi; ni=SIZE(y_i); n1=ni
-  mo=SIZE(x_o); m2=mo; no=SIZE(y_o); n2=no
+  INTEGER :: mi, ni, ii, ji, mo, no, io, jo, nr(2), m1,m2, n1,n2, mx,my, nn, i,j
+  LOGICAL :: li, lo, first=.TRUE.
+  REAL    :: inc, cpa, spa, crlo(SIZE(x_i))
+  REAL, SAVE :: pi, hpi
+  INTEGER, DIMENSION(SIZE(x_o),SIZE(y_o)) :: num_tot
+  LOGICAL, DIMENSION(SIZE(x_o),SIZE(y_o)) :: found, mask
+  REAL,    DIMENSION(SIZE(x_i),SIZE(y_i)) :: dist
+  REAL,    DIMENSION(SIZE(x_o))           :: a, b
+  REAL,    DIMENSION(SIZE(y_o))           :: c, d
+  REAL,    PARAMETER :: thresh=1.E-5
+!-------------------------------------------------------------------------------
+  IF(first) THEN; pi=4.0*ATAN(1.0); hpi=pi/2.0; first=.FALSE.; END IF
+  mi=SIZE(x_i); ni=SIZE(y_i); mo=SIZE(x_o); no=SIZE(y_o)
+  m1=m1; m2=mo; mx=mo; IF(PRESENT(msk)) mx=SIZE(msk,1)
+  n1=ni; n2=no; my=no; IF(PRESENT(msk)) my=SIZE(msk,2)
   li=PRESENT(d_i ); IF(li) THEN; m1=SIZE(d_i ,1); n1=SIZE(d_i ,2); END IF
   lo=PRESENT(d_o2); IF(lo) THEN; m2=SIZE(d_o2,1); n2=SIZE(d_o2,2); END IF
-  mi=assert_eq(mi,m1,SIZE(mask,1),TRIM(modname)//" mi")
-  ni=assert_eq(ni,n1,SIZE(mask,2),TRIM(modname)//" ni")
-  mo=assert_eq(mo,m2,SIZE(d_o1,1),TRIM(modname)//" mo")
-  no=assert_eq(no,n2,SIZE(d_o1,2),TRIM(modname)//" no")
+  mi=assert_eq(mi,m1,TRIM(modname)//" mi")
+  ni=assert_eq(ni,n1,TRIM(modname)//" ni")
+  mo=assert_eq(mo,m2,mx,SIZE(d_o1,1),TRIM(modname)//" mo")
+  no=assert_eq(no,n2,my,SIZE(d_o1,2),TRIM(modname)//" no")
+  mask(:,:)=.TRUE.; IF(PRESENT(msk)) mask(:,:)=msk(:,:)
 
 !--- COMPUTE CELLS INTERFACES COORDINATES OF OUTPUT GRID
@@ -67,7 +71,7 @@
              (x_i(ii)-a(io)>thresh.OR.x_i(ii)-b(io)<thresh)) CYCLE
           num_tot(io,jo)=num_tot(io,jo)+1
-          IF(mask(ii,ji)) d_o1(io,jo)=d_o1(io,jo)+inc
+          IF(mask(io,jo)) d_o1(io,jo)=d_o1(io,jo)+inc
           IF(.NOT.lo) CYCLE
-          IF(mask(ii,ji)) d_o2(io,jo)=d_o2(io,jo)+inc*inc
+          IF(mask(io,jo)) d_o2(io,jo)=d_o2(io,jo)+inc*inc
         END DO
       END DO
@@ -89,8 +93,10 @@
       IF(found(io,jo)) CYCLE
 !      IF(prt_level>=1) PRINT*, "Problem: point out of domain (i,j)=", io,jo
-      CALL dist_sphe(x_o(io),y_o(jo),x_i,y_i,dist(:,:))
+      crlo(:)=COS(x_o(io)-x_i(:))     !--- COS of points 1 and 2 angle
+      cpa=COS(y_o(jo)); spa=SIN(y_o(jo))
+      DO j=1,ni; dist(:,j)=ACOS(spa*SIN(y_i(j))+cpa*COS(y_i(j))*crlo(:)); END DO
       nr=MINLOC(dist(:,:))!; IF(prt_level>=1) PRINT*, "Solution: ", nr
       inc=1.0; IF(li) inc=d_i(nr(1),nr(2))
-      IF(mask(nr(1),nr(2))) d_o1(io,jo)=inc
+      IF(mask(io,jo)) d_o1(io,jo)=inc
     END DO
   END DO
@@ -250,41 +256,4 @@
 !-------------------------------------------------------------------------------
 
-
-!-------------------------------------------------------------------------------
-!
-SUBROUTINE dist_sphe(rf_lon,rf_lat,rlon,rlat,distance)
-!
-!-------------------------------------------------------------------------------
-! Author:  Laurent Li (december 30th 1996).
-! Purpose: Compute min. distance (along big circle) between 2 points in degrees.
-!-------------------------------------------------------------------------------
-  IMPLICIT NONE
-!-------------------------------------------------------------------------------
-! Arguments:
-  REAL, INTENT(IN) :: rf_lon, rf_lat  !--- Reference point coordinates (degrees)
-  REAL, INTENT(IN) :: rlon(:), rlat(:)!--- Points longitudes/latitudes (degrees)
-  REAL, INTENT(OUT):: distance(SIZE(rlon),SIZE(rlat)) !--- Distance    (degrees)
-!-------------------------------------------------------------------------------
-! Local variables:
-  LOGICAL, SAVE :: first=.TRUE.
-  REAL    :: pa, pb, cpa, cpab, spa, spab, crlo(SIZE(rlon))
-  INTEGER :: i, j
-!-------------------------------------------------------------------------------
-  IF(first) THEN
-    pi=4.0*ATAN(1.0); deg2rad=pi/180.0; first=.FALSE.
-  END IF
-  crlo(:)=COS((rf_lon-rlon(:))*deg2rad)     !--- COS of points 1 and 2 angle
-  pa=(90.0-rf_lat)*deg2rad                  !--- North Pole - Point 1 distance
-  cpa=COS(pa); spa=SIN(pa)
-  DO j=1,SIZE(rlat)
-    pb=(90.0-rlat(j))*deg2rad               !--- North Pole - Point 2 distance
-    cpab=cpa*COS(pb); spab=spa*SIN(pb)
-    distance(:,j)=ACOS(cpab+spab*crlo(:))/deg2rad
-  END DO
-
-END SUBROUTINE dist_sphe
-!
-!-------------------------------------------------------------------------------
-
 END MODULE grid_atob_m
 !
Index: /trunk/LMDZ.COMMON/libf/misc/wxios.F90
===================================================================
--- /trunk/LMDZ.COMMON/libf/misc/wxios.F90	(revision 1574)
+++ /trunk/LMDZ.COMMON/libf/misc/wxios.F90	(revision 1575)
@@ -1,3 +1,3 @@
-! $Id: wxios.F90 $
+! $Id$
 #ifdef CPP_XIOS
 MODULE wxios
@@ -33,5 +33,9 @@
     SUBROUTINE reformadate(odate, ndate)
         CHARACTER(len=*), INTENT(IN) :: odate
+#ifdef XIOS1
         CHARACTER(len=100), INTENT(OUT) :: ndate
+#else
+        TYPE(xios_duration) :: ndate
+#endif
         
         INTEGER :: i = 0
@@ -48,15 +52,27 @@
         i = INDEX(odate, "day")
         IF (i > 0) THEN
+#ifdef XIOS1
             ndate = odate(1:i-1)//"d"
+#else
+            read(odate(1:i-1),*) ndate%day
+#endif
         END IF
 
         i = INDEX(odate, "hr")
         IF (i > 0) THEN
+#ifdef XIOS1
             ndate = odate(1:i-1)//"h"
+#else
+            read(odate(1:i-1),*) ndate%hour
+#endif
         END IF
 
         i = INDEX(odate, "mth")
         IF (i > 0) THEN
+#ifdef XIOS1
             ndate = odate(1:i-1)//"mo"
+#else
+            read(odate(1:i-1),*) ndate%month
+#endif
         END IF
         
@@ -99,6 +115,6 @@
 
     SUBROUTINE wxios_init(xios_ctx_name, locom, outcom, type_ocean)
-        IMPLICIT NONE
-        INCLUDE 'iniprint.h'
+        USE print_control_mod, ONLY : prt_level, lunout
+        IMPLICIT NONE
 
       CHARACTER(len=*), INTENT(IN) :: xios_ctx_name
@@ -140,9 +156,11 @@
 
     SUBROUTINE wxios_context_init()
-        IMPLICIT NONE
-        INCLUDE 'iniprint.h'
+        USE print_control_mod, ONLY : prt_level, lunout
+!        USE mod_phys_lmdz_mpi_data, ONLY : COMM_LMDZ_PHY
+        IMPLICIT NONE
 
         TYPE(xios_context) :: xios_ctx
 
+!$OMP MASTER
         !Initialisation du contexte:
         CALL xios_context_initialize(g_ctx_name, g_comm)
@@ -157,4 +175,5 @@
         !Une première analyse des héritages:
         CALL xios_solve_inheritance()
+!$OMP END MASTER
     END SUBROUTINE wxios_context_init
 
@@ -164,6 +183,6 @@
 
     SUBROUTINE wxios_set_cal(pasdetemps, calendrier, annee, mois, jour, heure, ini_an, ini_mois, ini_jour, ini_heure)
-        IMPLICIT NONE
-        INCLUDE 'iniprint.h'
+        USE print_control_mod, ONLY : prt_level, lunout
+        IMPLICIT NONE
 
      !Paramètres:
@@ -178,10 +197,19 @@
      
      !Variables pour xios:
+#ifdef XIOS1
      TYPE(xios_time) :: mdtime
+#else
+     TYPE(xios_duration) :: mdtime
+#endif
      !REAL(kind = 8) :: year=0, month=0, day=0, hour=0, minute=0, second=0
      
+#ifdef XIOS1
         mdtime = xios_time(0, 0, 0, 0, 0, pasdetemps)
+#else
+        mdtime%second=pasdetemps
+#endif
 
         !Réglage du calendrier:
+#ifdef XIOS1
         SELECT CASE (calendrier)
             CASE('earth_360d')
@@ -198,11 +226,30 @@
                 CALL abort_gcm('Gcm:Xios',abort_message,1)
         END SELECT
+#else
+        SELECT CASE (calendrier)
+            CASE('earth_360d')
+                CALL xios_define_calendar("D360")
+                IF (prt_level >= 10) WRITE(lunout,*) 'wxios_set_cal: Calendrier terrestre a 360 jours/an'
+            CASE('earth_365d')
+                CALL xios_define_calendar("NoLeap")
+                IF (prt_level >= 10) WRITE(lunout,*) 'wxios_set_cal: Calendrier terrestre a 365 jours/an'
+            CASE('gregorian')
+                CALL xios_define_calendar("Gregorian")
+                IF (prt_level >= 10) WRITE(lunout,*) 'wxios_set_cal: Calendrier gregorien'
+            CASE DEFAULT
+                abort_message = 'wxios_set_cal: Mauvais choix de calendrier'
+                CALL abort_gcm('Gcm:Xios',abort_message,1)
+        END SELECT
+#endif
         
         !Formatage de la date d'origine:
-        WRITE(date, "(i4.4,'-',i2.2,'-',i2.2,' ',i2.2,':00:00')") annee, mois, jour, int(heure)
+        WRITE(date, "(i4.4,'-',i2.2,'-',i2.2,' ',i2.2,':00:00')") annee, mois, jour, int(heure) 
         
         IF (prt_level >= 10) WRITE(lunout,*) "wxios_set_cal: Time origin: ", date
-        
+#ifdef XIOS1
         CALL xios_set_context_attr_hdl(g_ctx, time_origin = date)
+#else
+        CALL xios_set_time_origin(xios_date(annee,mois,jour,int(heure),0,0))
+#endif
 
         !Formatage de la date de debut:
@@ -212,5 +259,9 @@
         IF (prt_level >= 10) WRITE(lunout,*) "wxios_set_cal: Start date: ", date
         
+#ifdef XIOS1
         CALL xios_set_context_attr_hdl(g_ctx, start_date = date)
+#else
+        CALL xios_set_start_date(xios_date(ini_an,ini_mois,ini_jour,int(ini_heure),0,0))
+#endif
         
         !Et enfin,le pas de temps:
@@ -221,7 +272,13 @@
     SUBROUTINE wxios_set_timestep(ts)
         REAL, INTENT(IN) :: ts
+#ifdef XIOS1
         TYPE(xios_time) :: mdtime     
 
         mdtime = xios_time(0, 0, 0, 0, 0, ts)
+#else
+        TYPE(xios_duration) :: mdtime     
+
+        mdtime%timestep = ts
+#endif
 
         CALL xios_set_timestep(mdtime)
@@ -237,6 +294,6 @@
          
 
-        IMPLICIT NONE
-        INCLUDE 'iniprint.h'
+        USE print_control_mod, ONLY : prt_level, lunout
+        IMPLICIT NONE
 
         CHARACTER(len=*),INTENT(IN) :: dom_id ! domain identifier
@@ -277,8 +334,13 @@
         
         !On parametrise le domaine:
+#ifdef XIOS1
         CALL xios_set_domain_attr_hdl(dom, ni_glo=ni_glo, ibegin=ibegin, ni=ni)
         CALL xios_set_domain_attr_hdl(dom, nj_glo=nj_glo, jbegin=jbegin, nj=nj, data_dim=2)
         CALL xios_set_domain_attr_hdl(dom, lonvalue=io_lon(ibegin:iend), latvalue=io_lat(jbegin:jend))
-
+#else
+        CALL xios_set_domain_attr_hdl(dom, ni_glo=ni_glo, ibegin=ibegin-1, ni=ni, type="rectilinear")
+        CALL xios_set_domain_attr_hdl(dom, nj_glo=nj_glo, jbegin=jbegin-1, nj=nj, data_dim=2)
+        CALL xios_set_domain_attr_hdl(dom, lonvalue_1d=io_lon(ibegin:iend), latvalue_1d=io_lat(jbegin:jend))
+#endif
         IF (.NOT.is_sequential) THEN
             mask(:,:)=.TRUE.
@@ -291,5 +353,9 @@
               WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," mask(:,nj)=",mask(:,nj)
             ENDIF
+#ifdef XIOS1
             CALL xios_set_domain_attr_hdl(dom, mask=mask)
+#else
+            CALL xios_set_domain_attr_hdl(dom, mask_2d=mask)
+#endif
         END IF
 
@@ -307,6 +373,6 @@
     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     SUBROUTINE wxios_add_vaxis(axis_id, axis_size, axis_value)
-        IMPLICIT NONE
-        INCLUDE 'iniprint.h'
+        USE print_control_mod, ONLY : prt_level, lunout
+        IMPLICIT NONE
 
         CHARACTER (len=*), INTENT(IN) :: axis_id
@@ -335,6 +401,9 @@
         
         ! Ehouarn: New way to declare axis, without axis_group:
+#ifdef XIOS1
         CALL xios_set_axis_attr(trim(axis_id),size=axis_size,value=axis_value)
-        
+#else
+        CALL xios_set_axis_attr(trim(axis_id),n_glo=axis_size,value=axis_value)
+#endif        
         !Vérification:
         IF (xios_is_valid_axis(TRIM(ADJUSTL(axis_id)))) THEN
@@ -351,6 +420,6 @@
     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     SUBROUTINE wxios_add_file(fname, ffreq, flvl)
-        IMPLICIT NONE
-        INCLUDE 'iniprint.h'
+        USE print_control_mod, ONLY : prt_level, lunout
+        IMPLICIT NONE
 
         CHARACTER(len=*), INTENT(IN) :: fname
@@ -360,5 +429,9 @@
         TYPE(xios_file) :: x_file
         TYPE(xios_filegroup) :: x_fg
+#ifdef XIOS1
         CHARACTER(len=100) :: nffreq
+#else
+        TYPE(xios_duration) :: nffreq
+#endif
         
         !On regarde si le fichier n'est pas défini par XML:
@@ -372,15 +445,28 @@
         
             !On configure:
+#ifdef XIOS1
             CALL xios_set_file_attr_hdl(x_file, name="X"//fname,&
                 output_freq=TRIM(ADJUSTL(nffreq)), output_level=flvl, enabled=.TRUE.)
-        
+#else
+            CALL xios_set_file_attr_hdl(x_file, name="X"//fname,&
+                output_freq=nffreq, output_level=flvl, enabled=.TRUE.)
+#endif
+       
             IF (xios_is_valid_file("X"//fname)) THEN
                 IF (prt_level >= 10) THEN
                   WRITE(lunout,*) "wxios_add_file: New file: ", "X"//fname
+#ifdef XIOS1
                   WRITE(lunout,*) "wxios_add_file: output_freq=",TRIM(ADJUSTL(nffreq)),"; output_lvl=",flvl
+#else
+                  WRITE(lunout,*) "wxios_add_file: output_freq=",nffreq,"; output_lvl=",flvl
+#endif
                 ENDIF
             ELSE
                 WRITE(lunout,*) "wxios_add_file: Error, invalid file: ", "X"//trim(fname)
+#ifdef XIOS1
                 WRITE(lunout,*) "wxios_add_file: output_freq=",TRIM(ADJUSTL(nffreq)),"; output_lvl=",flvl
+#else
+                WRITE(lunout,*) "wxios_add_file: output_freq=",nffreq,"; output_lvl=",flvl
+#endif
             END IF
         ELSE
@@ -435,6 +521,6 @@
     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     SUBROUTINE wxios_add_field_to_file(fieldname, fdim, fid, fname, fieldlongname, fieldunit, field_level, op, nam_axvert)
-        IMPLICIT NONE
-        INCLUDE 'iniprint.h'
+        USE print_control_mod, ONLY : prt_level, lunout
+        IMPLICIT NONE
 
         CHARACTER(len=*), INTENT(IN) :: fieldname
@@ -452,4 +538,7 @@
         TYPE(xios_field) :: field
         TYPE(xios_fieldgroup) :: fieldgroup
+#ifndef XIOS1
+        TYPE(xios_duration) :: freq_op
+#endif
         LOGICAL :: bool=.FALSE.
         INTEGER :: lvl =0
@@ -510,5 +599,10 @@
             
             !L'operation, sa frequence:
+#ifdef XIOS1
             CALL xios_set_field_attr_hdl(field, field_ref=fieldname, operation=TRIM(ADJUSTL(operation)), freq_op="1ts", prec=4)
+#else
+            freq_op%timestep=1
+            CALL xios_set_field_attr_hdl(field, field_ref=fieldname, operation=TRIM(ADJUSTL(operation)), freq_op=freq_op, prec=4)
+#endif
 
             
