Index: /trunk/LMDZ.GENERIC/libf/phystd/iniwrite.F
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/iniwrite.F	(revision 3772)
+++ /trunk/LMDZ.GENERIC/libf/phystd/iniwrite.F	(revision 3773)
@@ -2,5 +2,5 @@
 
       use comsoil_h, only: mlayer, nsoilmx
-      USE comcstfi_mod, only: g, mugaz, omeg, rad, rcp, pi 
+      USE comcstfi_mod, only: g, mugaz, omeg, rad, rcp, pi
       USE vertical_layers_mod, ONLY: ap,bp,aps,bps,pseudoalt
 !      USE logic_mod, ONLY: fxyhypb,ysinus
@@ -10,4 +10,5 @@
       USE regular_lonlat_mod, ONLY: lon_reg, lat_reg
       USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev
+      use tabfi_mod, only: tab_cntrl_mod
       IMPLICIT NONE
 
@@ -41,7 +42,7 @@
 c   Local:
 c   ------
-      INTEGER length,l
-      parameter (length = 100)
-      REAL tab_cntrl(length) ! run parameters are stored in this array
+    !   INTEGER length,l
+    !   parameter (length = 100)
+    !   REAL tab_cntrl(length) ! run parameters are stored in this array
       INTEGER ierr
       REAl,ALLOCATABLE :: lon_reg_ext(:) ! extended longitudes
@@ -50,5 +51,5 @@
       integer :: idim_rlatu,idim_llmp1,idim_llm
       integer :: idim_nsoilmx ! "subsurface_layers" dimension ID #
-      integer, dimension(2) :: id  
+      integer, dimension(2) :: id
 c-----------------------------------------------------------------------
 
@@ -61,18 +62,18 @@
       ENDIF
 
-      DO l=1,length
-         tab_cntrl(l)=0.
-      ENDDO
-      tab_cntrl(1)  = real(nbp_lon)
-      tab_cntrl(2)  = real(nbp_lat-1)
-      tab_cntrl(3)  = real(nbp_lev)
-      tab_cntrl(4)  = real(idayref)
-      tab_cntrl(5)  = rad
-      tab_cntrl(6)  = omeg
-      tab_cntrl(7)  = g
-      tab_cntrl(8)  = mugaz
-      tab_cntrl(9)  = rcp
-      tab_cntrl(10) = daysec
-      tab_cntrl(11) = dtphys
+    !   DO l=1,length
+    !      tab_cntrl(l)=0.
+    !   ENDDO
+    !   tab_cntrl(1)  = real(nbp_lon)
+    !   tab_cntrl(2)  = real(nbp_lat-1)
+    !   tab_cntrl(3)  = real(nbp_lev)
+    !   tab_cntrl(4)  = real(idayref)
+    !   tab_cntrl(5)  = rad
+    !   tab_cntrl(6)  = omeg
+    !   tab_cntrl(7)  = g
+    !   tab_cntrl(8)  = mugaz
+    !   tab_cntrl(9)  = rcp
+    !   tab_cntrl(10) = daysec
+    !   tab_cntrl(11) = dtphys
 !      tab_cntrl(12) = etot0
 !      tab_cntrl(13) = ptot0
@@ -82,5 +83,5 @@
 c
 c    ..........    P.Le Van  ( ajout le 8/04/96 )    .........
-c         .....        parametres  pour le zoom          ......   
+c         .....        parametres  pour le zoom          ......
 !      tab_cntrl(17)  = clon
 !      tab_cntrl(18)  = clat
@@ -105,8 +106,8 @@
 
 ! Define dimensions
-    
-      ierr = NF_REDEF (nid)
-
-      ierr = NF_DEF_DIM (nid, "index", length, idim_index)
+
+      ierr = NF_REDEF (nid)
+
+      ierr = NF_DEF_DIM (nid, "index", SIZE(tab_cntrl_mod), idim_index)
 !      ierr = NF_DEF_DIM (nid, "rlonu", iip1, idim_rlonu)
       ierr = NF_DEF_DIM (nid, "latitude", nbp_lat, idim_rlatu)
@@ -126,8 +127,8 @@
       ierr = NF_REDEF (nid)
 #ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "controle", NF_DOUBLE, 1, 
+      ierr = NF_DEF_VAR (nid, "controle", NF_DOUBLE, 1,
      .       idim_index,nvarid)
 #else
-      ierr = NF_DEF_VAR (nid, "controle", NF_FLOAT, 1, 
+      ierr = NF_DEF_VAR (nid, "controle", NF_FLOAT, 1,
      .       idim_index,nvarid)
 #endif
@@ -136,7 +137,7 @@
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl)
+      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl_mod)
+#else
+      ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl_mod)
 #endif
 
@@ -177,5 +178,5 @@
 c
 c --------------------------
-      
+
       lon_reg_ext(1:nbp_lon)=lon_reg(1:nbp_lon)
       IF (nbp_lon*nbp_lat/=1) THEN
@@ -204,8 +205,8 @@
       ierr = NF_REDEF (nid)
 #ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "altitude", NF_DOUBLE, 1, 
+      ierr = NF_DEF_VAR (nid, "altitude", NF_DOUBLE, 1,
      .       idim_llm,nvarid)
 #else
-      ierr = NF_DEF_VAR (nid, "altitude", NF_FLOAT, 1, 
+      ierr = NF_DEF_VAR (nid, "altitude", NF_FLOAT, 1,
      .       idim_llm,nvarid)
 #endif
Index: /trunk/LMDZ.GENERIC/libf/phystd/phyetat0_mod.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/phyetat0_mod.F90	(revision 3772)
+++ /trunk/LMDZ.GENERIC/libf/phystd/phyetat0_mod.F90	(revision 3773)
@@ -22,5 +22,5 @@
   use write_field_phy, only: Writefield_phy
 !!
-  use tabfi_mod, only: tabfi
+  use tabfi_mod, only: tabfi,ini_tab_controle_dyn_xios
   USE tracer_h, ONLY: noms, igcm_h2o_vap
   USE radinc_h, ONLY: L_NSPECTV
@@ -485,4 +485,8 @@
    endif
 endif ! of if (startphy_file)
+
+call ini_tab_controle_dyn_xios(day_ini)
+
+
 !
 ! close file:
@@ -492,37 +496,3 @@
 end subroutine phyetat0
 
-!======================================================================
-subroutine ini_tab_controle_dyn_xios(idayref)
-
-use comcstfi_mod,        only: g, mugaz, omeg, rad, rcp
-use time_phylmdz_mod,  only: daysec, dtphys
-use mod_grid_phy_lmdz, only: nbp_lon, nbp_lat, nbp_lev
-
-implicit none
-
-integer*4, intent(in) :: idayref ! date (initial date for this run)
-
-integer :: length, l
-parameter (length = 100)
-real    :: tab_cntrl(length) ! run parameters are stored in this array
-
-do l = 1,length
-    tab_cntrl(l) = 0.
-enddo
-tab_cntrl(1)  = real(nbp_lon)
-tab_cntrl(2)  = real(nbp_lat-1)
-tab_cntrl(3)  = real(nbp_lev)
-tab_cntrl(4)  = real(idayref)
-tab_cntrl(5)  = rad
-tab_cntrl(6)  = omeg
-tab_cntrl(7)  = g
-tab_cntrl(8)  = mugaz
-tab_cntrl(9)  = rcp
-tab_cntrl(10) = daysec
-tab_cntrl(11) = dtphys
-
-tab_cntrl_mod = tab_cntrl
-
-end subroutine ini_tab_controle_dyn_xios
-
 end module phyetat0_mod
Index: /trunk/LMDZ.GENERIC/libf/phystd/physiq_mod.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/physiq_mod.F90	(revision 3772)
+++ /trunk/LMDZ.GENERIC/libf/phystd/physiq_mod.F90	(revision 3773)
@@ -38,5 +38,6 @@
                           igcm_co2_ice, nesp, is_chim, is_condensable,constants_epsi_generic
       use time_phylmdz_mod, only: diagfi_output_rate, nday
-      use phyetat0_mod, only: phyetat0,tab_cntrl_mod
+      use phyetat0_mod, only: phyetat0
+      use tabfi_mod, only: tab_cntrl_mod
       use surfini_mod, only: surfini
       use wstats_mod, only: callstats, wstats, mkstats
@@ -2076,5 +2077,5 @@
   !   VI.7. Radioactive Tracers
   ! -----------------------------
-         
+
          call radioactive_tracers(ngrid,nlayer,nq,ptimestep,pq,zdqradio)
          pdq(1:ngrid,1:nlayer,1:nq) = pdq(1:ngrid,1:nlayer,1:nq) + zdqradio(1:ngrid,1:nlayer,1:nq)
Index: /trunk/LMDZ.GENERIC/libf/phystd/tabfi_mod.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/tabfi_mod.F90	(revision 3772)
+++ /trunk/LMDZ.GENERIC/libf/phystd/tabfi_mod.F90	(revision 3773)
@@ -2,4 +2,8 @@
 
 IMPLICIT NONE
+
+real, save :: tab_cntrl_mod(100)
+!$OMP THREADPRIVATE(tab_cntrl_mod)
+
 
 CONTAINS
@@ -12,5 +16,5 @@
 !   C. Hourdin 15/11/96
 !
-!   Object:        Lecture du tab_cntrl physique dans un fichier 
+!   Object:        Lecture du tab_cntrl physique dans un fichier
 !   ------            et initialisation des constantes physiques
 !
@@ -568,3 +572,37 @@
       END SUBROUTINE tabfi
 
+      subroutine ini_tab_controle_dyn_xios(idayref)
+      ! Initialize controle variable for XIOS & diagfi
+
+        use comcstfi_mod,        only: g, mugaz, omeg, rad, rcp
+        use time_phylmdz_mod,  only: daysec, dtphys
+        use mod_grid_phy_lmdz, only: nbp_lon, nbp_lat, nbp_lev
+
+        implicit none
+
+        integer*4, intent(in) :: idayref ! date (initial date for this run)
+
+        integer :: length, l
+        parameter (length = 100)
+        real    :: tab_cntrl(length) ! run parameters are stored in this array
+
+        do l = 1,length
+            tab_cntrl(l) = 0.
+        enddo
+        tab_cntrl(1)  = real(nbp_lon)
+        tab_cntrl(2)  = real(nbp_lat-1)
+        tab_cntrl(3)  = real(nbp_lev)
+        tab_cntrl(4)  = real(idayref)
+        tab_cntrl(5)  = rad
+        tab_cntrl(6)  = omeg
+        tab_cntrl(7)  = g
+        tab_cntrl(8)  = mugaz
+        tab_cntrl(9)  = rcp
+        tab_cntrl(10) = daysec
+        tab_cntrl(11) = dtphys
+
+        tab_cntrl_mod = tab_cntrl
+
+      end subroutine ini_tab_controle_dyn_xios
+
 end module tabfi_mod
