Index: /LMDZ.3.3/branches/rel-LF/libf/bibio/initdynav.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/bibio/initdynav.F	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/bibio/initdynav.F	(revision 353)
@@ -1,2 +1,5 @@
+c
+c $Header$
+c
       subroutine initdynav(infile,day0,anne0,tstep,t_ops,t_wrt
      .                     ,nq,fileid)
Index: /LMDZ.3.3/branches/rel-LF/libf/bibio/initfluxsto.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/bibio/initfluxsto.F	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/bibio/initfluxsto.F	(revision 353)
@@ -66,5 +66,5 @@
       integer uhoriid, vhoriid, thoriid, zvertiid,dhoriid,dvertiid
       integer ii,jj
-      integer zan
+      integer zan, idayref
       logical ok_sync
 C
@@ -79,8 +79,8 @@
 C         
 
-      zan = anne_ini
-      CALL ymds2ju(zan, 1, 1, 0.0, zjulian)
-      zjulian = zjulian + day_ini
-      tau0 = 0
+      zan = annee_ref
+      idayref = day_ref
+      CALL ymds2ju(zan, 1, idayref, 0.0, zjulian)
+      tau0 = itau_dyn
 	
 	do jj = 1, jjp1
@@ -91,5 +91,5 @@
       enddo
  
-      call histbeg(infile, iip1, rlong, jjp1, rlat,
+      call histbeg(infile, iip1, rlong(:,1), jjp1, rlat(1,:),
      .             1, iip1, 1, jjp1,
      .             tau0, zjulian, tstep, uhoriid, fileid)
@@ -107,5 +107,5 @@
       enddo
 
-      call histbeg('fluxstokev.nc', iip1, rlong, jjm, rlat,
+      call histbeg('fluxstokev.nc', iip1, rlong(:,1), jjm, rlat(1,:),
      .             1, iip1, 1, jjm,
      .             tau0, zjulian, tstep, vhoriid, filevid)
Index: /LMDZ.3.3/branches/rel-LF/libf/bibio/inithist.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/bibio/inithist.F	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/bibio/inithist.F	(revision 353)
@@ -64,5 +64,5 @@
       integer uhoriid, vhoriid, thoriid, zvertiid
       integer ii,jj
-      integer zan
+      integer zan, dayref
 C
 C  Initialisations
@@ -76,7 +76,7 @@
 
       zan = anne0
-      CALL ymds2ju(zan, 1, 1, 0.0, zjulian)
-      zjulian = zjulian + day0
-      tau0 = 0
+      dayref = day0
+      CALL ymds2ju(zan, 1, dayref, 0.0, zjulian)
+      tau0 = itau_dyn
       
       do jj = 1, jjp1
@@ -87,5 +87,5 @@
       enddo
        
-      call histbeg(infile, iip1, rlong, jjp1, rlat,
+      call histbeg(infile, iip1, rlong(:,1), jjp1, rlat(1,:),
      .             1, iip1, 1, jjp1,
      .             tau0, zjulian, tstep, uhoriid, fileid)
@@ -102,5 +102,5 @@
       enddo
 
-      call histbeg('dyn_histv.nc', iip1, rlong, jjm, rlat,
+      call histbeg('dyn_histv.nc', iip1, rlong(:,1), jjm, rlat(1,:),
      .             1, iip1, 1, jjm,
      .             tau0, zjulian, tstep, vhoriid, filevid)
Index: /LMDZ.3.3/branches/rel-LF/libf/bibio/writedynav.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/bibio/writedynav.F	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/bibio/writedynav.F	(revision 353)
@@ -64,4 +64,5 @@
       REAL vnat(ip1jm,llm),unat(ip1jmp1,llm) 
       logical ok_sync
+      integer itau_w
 C
 C  Initialisations
@@ -76,4 +77,5 @@
       vnat = 999.999
       unat = 999.999
+      itau_w = itau_dyn + time
 
 C Passage aux composantes naturelles du vent
@@ -86,5 +88,5 @@
 C
       call gr_u_scal(llm, unat, us)
-      call histwrite(histid, 'u', time, us, 
+      call histwrite(histid, 'u', itau_w, us, 
      .               iip1*jjp1*llm, ndex3d)
 C
@@ -92,10 +94,10 @@
 C
       call gr_v_scal(llm, vnat, vs)
-      call histwrite(histid, 'v', time, vs, 
+      call histwrite(histid, 'v', itau_w, vs, 
      .               iip1*jjp1*llm, ndex3d)
 C
 C  Temperature potentielle moyennee
 C
-      call histwrite(histid, 'theta', time, teta, 
+      call histwrite(histid, 'theta', itau_w, teta, 
      .                iip1*jjp1*llm, ndex3d)
 C
@@ -105,10 +107,10 @@
         tm(ii) = teta(ii) * ppk(ii)/cpp
       enddo
-      call histwrite(histid, 'temp', time, tm, 
+      call histwrite(histid, 'temp', itau_w, tm, 
      .                iip1*jjp1*llm, ndex3d)
 C
 C  Geopotentiel
 C
-      call histwrite(histid, 'phi', time, phi, 
+      call histwrite(histid, 'phi', itau_w, phi, 
      .                iip1*jjp1*llm, ndex3d)
 C
@@ -122,5 +124,5 @@
             WRITE(str(2:3),'(i2.2)') iq
           ENDIF
-          call histwrite(histid, str, time, q(:,:,iq), 
+          call histwrite(histid, str, itau_w, q(:,:,iq), 
      .                   iip1*jjp1*llm, ndex3d)
         enddo
@@ -129,13 +131,13 @@
 C  Masse
 C
-       call histwrite(histid, 'masse', time, masse, iip1*jjp1, ndex2d)
+       call histwrite(histid, 'masse', itau_w, masse, iip1*jjp1, ndex2d)
 C
 C  Pression au sol
 C
-       call histwrite(histid, 'ps', time, ps, iip1*jjp1, ndex2d)
+       call histwrite(histid, 'ps', itau_w, ps, iip1*jjp1, ndex2d)
 C
 C  Geopotentiel au sol
 C
-       call histwrite(histid, 'phis', time, phis, iip1*jjp1, ndex2d)
+       call histwrite(histid, 'phis', itau_w, phis, iip1*jjp1, ndex2d)
 C
 C  Fin
Index: /LMDZ.3.3/branches/rel-LF/libf/bibio/writehist.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/bibio/writehist.F	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/bibio/writehist.F	(revision 353)
@@ -63,4 +63,5 @@
       character*3 str
       logical ok_sync
+      integer itau_w
 C
 C  Initialisations
@@ -71,4 +72,5 @@
       ndex2d = 0
       ok_sync =.TRUE.
+      itau_w = itau_dyn + time
 C
 C  Appels a histwrite pour l'ecriture des variables a sauvegarder
@@ -76,5 +78,5 @@
 C  Vents U
 C
-      call histwrite(histid, 'ucov', time, ucov, 
+      call histwrite(histid, 'ucov', itau_w, ucov, 
      .               iip1*jjp1*llm, ndexu)
 
@@ -82,5 +84,5 @@
 C  Vents V
 C
-      call histwrite(histvid, 'vcov', time, vcov, 
+      call histwrite(histvid, 'vcov', itau_w, vcov, 
      .               iip1*jjm*llm, ndexv)
 
@@ -88,10 +90,10 @@
 C  Temperature potentielle
 C
-      call histwrite(histid, 'teta', time, teta, 
+      call histwrite(histid, 'teta', itau_w, teta, 
      .                iip1*jjp1*llm, ndexu)
 C
 C  Geopotentiel
 C
-      call histwrite(histid, 'phi', time, phi, 
+      call histwrite(histid, 'phi', itau_w, phi, 
      .                iip1*jjp1*llm, ndexu)
 C
@@ -105,5 +107,5 @@
             WRITE(str(2:3),'(i2.2)') iq
           ENDIF
-          call histwrite(histid, str, time, q(:,:,iq), 
+          call histwrite(histid, str, itau_w, q(:,:,iq), 
      .                   iip1*jjp1*llm, ndexu)
         enddo
@@ -112,13 +114,13 @@
 C  Masse
 C
-      call histwrite(histid, 'masse', time, masse, iip1*jjp1, ndex2d)
+      call histwrite(histid, 'masse', itau_w, masse, iip1*jjp1, ndex2d)
 C
 C  Pression au sol
 C
-      call histwrite(histid, 'ps', time, ps, iip1*jjp1, ndex2d)
+      call histwrite(histid, 'ps', itau_w, ps, iip1*jjp1, ndex2d)
 C
 C  Geopotentiel au sol
 C
-      call histwrite(histid, 'phis', time, phis, iip1*jjp1, ndex2d)
+      call histwrite(histid, 'phis', itau_w, phis, iip1*jjp1, ndex2d)
 C
 C  Fin
Index: /LMDZ.3.3/branches/rel-LF/libf/bibio/writephys.F90
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/bibio/writephys.F90	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/bibio/writephys.F90	(revision 353)
@@ -93,4 +93,5 @@
   real, dimension(llm) :: zlev
   real                 :: date0, dtime
+  integer              :: itau_deb
 !
 ! Variables locales
@@ -121,6 +122,6 @@
 ! Initialisation du fichier
 !
-  call histbeg(nom_fichier, iim, temp_lon, jjm, temp_lat, &
-     &                 1, iim, 1, jjm, 0, date0, dtime, &
+  call histbeg(nom_fichier, iim, temp_lon(:,1), jjm, temp_lat(1,:), &
+     &                 1, iim, 1, jjm, itau_deb, date0, dtime, &
      &                 nhori, file_id)
   call histvert(file_id, "presnivs", "Vertical levels", "mb", &
Index: /LMDZ.3.3/branches/rel-LF/libf/dyn3d/create_etat0_limit.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/dyn3d/create_etat0_limit.F	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/dyn3d/create_etat0_limit.F	(revision 353)
@@ -18,5 +18,5 @@
 
       LOGICAL interbar, extrap , oldice
-      PARAMETER ( interbar = .TRUE. , extrap = .FALSE. , oldice=.TRUE.)
+      PARAMETER ( interbar = .TRUE. , extrap = .FALSE. , oldice=.true.)
 #include "dimensions.h"
 #include "paramet.h"
Index: /LMDZ.3.3/branches/rel-LF/libf/dyn3d/dynetat0.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/dyn3d/dynetat0.F	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/dyn3d/dynetat0.F	(revision 353)
@@ -82,6 +82,6 @@
       jm         = tab_cntrl(2)
       lllm       = tab_cntrl(3)
-      day_ini    = tab_cntrl(4)
-      anne_ini   = tab_cntrl(5)
+      day_ref    = tab_cntrl(4)
+      annee_ref  = tab_cntrl(5)
       rad        = tab_cntrl(6)
       omeg       = tab_cntrl(7)
@@ -115,4 +115,7 @@
         IF( tab_cntrl(27).EQ.1. ) ysinus = . TRUE. 
       ENDIF
+
+      day_ini = tab_cntrl(30)
+      itau_dyn = tab_cntrl(31)
 c   .................................................................
 c
Index: /LMDZ.3.3/branches/rel-LF/libf/dyn3d/dynredem.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/dyn3d/dynredem.F	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/dyn3d/dynredem.F	(revision 353)
@@ -1,5 +1,5 @@
 c $Header$
 c
-      SUBROUTINE dynredem0(fichnom,idayref,anneeref,phis,nq)
+      SUBROUTINE dynredem0(fichnom,iday_end,phis,nq)
       USE IOIPSL
       IMPLICIT NONE
@@ -23,5 +23,5 @@
 c   Arguments:
 c   ----------
-      INTEGER*4 idayref,anneeref
+      INTEGER iday_end
       REAL phis(ip1jmp1)
       CHARACTER*(*) fichnom
@@ -56,6 +56,6 @@
       modname='dynredem'
 
-      call ymds2ju(anneeref,1,idayref,0.0, zjulian)
-      call ju2ymds(zjulian, yyears0,mmois0,jjour0,hours)
+      call ymds2ju(annee_ref, 1, iday_end, 0.0, zjulian)
+      call ju2ymds(zjulian, yyears0, mmois0, jjour0, hours)
         
 
@@ -66,6 +66,6 @@
        tab_cntrl(2)  = FLOAT(jjm)
        tab_cntrl(3)  = FLOAT(llm)
-       tab_cntrl(4)  = FLOAT(idayref)
-       tab_cntrl(5)  = FLOAT(anneeref)
+       tab_cntrl(4)  = FLOAT(day_ref)
+       tab_cntrl(5)  = FLOAT(annee_ref)
        tab_cntrl(6)  = rad
        tab_cntrl(7)  = omeg
@@ -106,4 +106,7 @@
        IF( ysinus )  tab_cntrl(27) = 1.
       ENDIF
+
+       tab_cntrl(30) = FLOAT(iday_end)
+       tab_cntrl(31) = FLOAT(itau_dyn + itaufin)
 c
 c    .........................................................
@@ -378,5 +381,5 @@
       ierr = NF_CLOSE(nid) ! fermer le fichier
 
-      PRINT*,'iim,jjm,llm,idayref',iim,jjm,llm,idayref
+      PRINT*,'iim,jjm,llm,iday_end',iim,jjm,llm,iday_end
       PRINT*,'rad,omeg,g,cpp,kappa',
      ,        rad,omeg,g,cpp,kappa
Index: /LMDZ.3.3/branches/rel-LF/libf/dyn3d/gcm.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/dyn3d/gcm.F	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/dyn3d/gcm.F	(revision 353)
@@ -299,5 +299,5 @@
       PRINT 300, itau,itaufin,day_ini,day_end
 
-      CALL dynredem0("restart.nc",day_end,anne_ini,phis,nqmx)
+      CALL dynredem0("restart.nc", day_end, phis, nqmx)
 
       ecripar = .TRUE.
@@ -306,10 +306,10 @@
       t_ops = iecri * daysec
       t_wrt = iecri * daysec
-C      CALL inithist(dynhist_file,day_ini,anne_ini,time_step,
+C      CALL inithist(dynhist_file,day_ref,annee_ref,time_step,
 c     .              t_ops, t_wrt, nqmx, histid, histvid)
 
       t_ops = iperiod * time_step
       t_wrt = periodav * daysec
-      CALL initdynav(dynhistave_file,day_ini,anne_ini,time_step,
+      CALL initdynav(dynhistave_file,day_ref,annee_ref,time_step,
      .              t_ops, t_wrt, nqmx, histaveid)
 
Index: /LMDZ.3.3/branches/rel-LF/libf/dyn3d/limit_netcdf.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/dyn3d/limit_netcdf.F	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/dyn3d/limit_netcdf.F	(revision 353)
@@ -226,17 +226,9 @@
      . dlon_msk, dlat_msk, champ_msk, interbar  )
 
-      CALL mask_c_o(imdep, jmdep, dlon_msk, dlat_msk,champ_msk,
-     .             iim, jjp1, rlonv, rlatu, champint)
-c      CALL gr_int_dyn(champint, masque, iim, jjp1)
-c      DO i = 1, iim
-c         masque(i,1) = FLOAT(NINT(masque(i,1)))
-c         masque(i,jjp1) = FLOAT(NINT(masque(i,jjp1)))
-c      ENDDO
       DO i = 1, iim
       DO j = 1, jjp1
-         mask(i,j) = champint(i,j)
-      ENDDO
-      ENDDO
-c      CALL gr_dyn_fi(1, iip1, jjp1, klon, masque, phy_nat0)
+         mask(i,j) = masque(i,j)
+      ENDDO
+      ENDDO
       ierr = NF_CLOSE(ncid)
 c
Index: /LMDZ.3.3/branches/rel-LF/libf/dyn3d/offlinenc.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/dyn3d/offlinenc.F	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/dyn3d/offlinenc.F	(revision 353)
@@ -200,5 +200,5 @@
       else
          day_ini=0
-         anne_ini=0
+         annee_ref=0
       endif
 
@@ -347,5 +347,5 @@
       close(98)
 
-      CALL dynredem0("restart.nc",day_end,anne_ini,phis,nq)
+      CALL dynredem0("restart.nc",day_end,phis,nq)
 
 c-----------------------------------------------------------------------
@@ -398,5 +398,5 @@
          dynhistave_file = 'histmoy.nc'
          day_ini=0
-         anne_ini=0
+         annee_ref=0
          t_ops =(1./48.)*daysec
          t_wrt =(1./48.)*daysec
@@ -404,5 +404,5 @@
          mode=1
 
-c        CALL initdynav(dynhistave_file,day_ini,anne_ini,dtav,
+c        CALL initdynav(dynhistave_file,day_ini,annee_ref,dtav,
 c    .              t_ops, t_wrt, nq,mode, histaveid)
 
Index: DZ.3.3/branches/rel-LF/libf/dyn3d/physdem.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/dyn3d/physdem.F	(revision 352)
+++ 	(revision )
@@ -1,631 +1,0 @@
-      SUBROUTINE physdem (fichnom,dtime,radpas,co2_ppm,solaire,
-     .           rlat,rlon, pctsrf,tsol,tsoil,deltat,qsol,snow,
-     .           albedo, evap, rain_fall, snow_fall,
-     .           solsw, sollw,
-     .           radsol,frugs,agesno,
-     .           zmea,zstd,zsig,zgam,zthe,zpic,zval,rugsrel,
-     .           t_ancien, q_ancien)
-      IMPLICIT none
-c======================================================================
-c Auteur(s) Z.X. Li (LMD/CNRS) date: 19930818
-c Objet: Ecriture de l'etat de redemarrage pour la physique
-c======================================================================
-#include "dimensions.h"
-#include "dimphy.h"
-#include "netcdf.inc"
-#include "indicesol.h"
-#include "dimsoil.h"
-#include "clesph0.h"
-#include "control.h"
-#include "temps.h"
-c======================================================================
-      CHARACTER*(*) fichnom
-      REAL dtime
-      INTEGER radpas
-      REAL rlat(klon), rlon(klon)
-      REAL co2_ppm
-      REAL solaire
-      REAL tsol(klon,nbsrf)
-      REAL tsoil(klon,nsoilmx,nbsrf)
-      REAL deltat(klon)
-      REAL qsol(klon,nbsrf)
-      REAL snow(klon,nbsrf)
-      REAL albedo(klon,nbsrf)
-      REAL evap(klon,nbsrf)
-      REAL rain_fall(klon)
-      REAL snow_fall(klon)
-      real solsw(klon)
-      real sollw(klon)
-      REAL radsol(klon)
-      REAL frugs(klon,nbsrf)
-      REAL agesno(klon)
-      REAL zmea(klon)
-      REAL zstd(klon)
-      REAL zsig(klon)
-      REAL zgam(klon)
-      REAL zthe(klon)
-      REAL zpic(klon)
-      REAL zval(klon)
-      REAL rugsrel(klon)
-      REAL pctsrf(klon, nbsrf)
-      REAL t_ancien(klon,klev), q_ancien(klon,klev)
-c
-      INTEGER nid, nvarid, idim1, idim2, idim3
-      INTEGER ierr
-      INTEGER length
-      PARAMETER (length=100)
-      REAL tab_cntrl(length)
-c
-      INTEGER isoil, nsrf
-      CHARACTER*7 str7
-      CHARACTER*2 str2
-c
-      ierr = NF_CREATE(fichnom, NF_CLOBBER, nid)
-      IF (ierr.NE.NF_NOERR) THEN
-        write(6,*)' Pb d''ouverture du fichier '//fichnom
-        write(6,*)' ierr = ', ierr
-        CALL ABORT
-      ENDIF
-c
-      ierr = NF_PUT_ATT_TEXT (nid, NF_GLOBAL, "title", 28,
-     .                       "Fichier redemmarage physique")
-c
-      ierr = NF_DEF_DIM (nid, "index", length, idim1)
-      ierr = NF_DEF_DIM (nid, "points_physiques", klon, idim2)
-      ierr = NF_DEF_DIM (nid, "horizon_vertical", klon*klev, idim3)
-c
-      ierr = NF_ENDDEF(nid)
-c
-      DO ierr = 1, length
-         tab_cntrl(ierr) = 0.0
-      ENDDO
-      tab_cntrl(1) = dtime
-      tab_cntrl(2) = radpas
-      tab_cntrl(3) = co2_ppm
-      tab_cntrl(4) = solaire
-      tab_cntrl(5) = iflag_con
-      tab_cntrl(6) = nbapp_rad
-
-      IF( cycle_diurne ) tab_cntrl( 7 ) = 1.
-      IF(   soil_model ) tab_cntrl( 8 ) = 1.
-      IF(     new_oliq ) tab_cntrl( 9 ) = 1.
-      IF(     ok_orodr ) tab_cntrl(10 ) = 1.
-      IF(     ok_orolf ) tab_cntrl(11 ) = 1.
-
-      tab_cntrl(13) = dayref
-      tab_cntrl(14) = anneeref
-      tab_cntrl(13) = day_end
-      tab_cntrl(14) = anne_ini
-c
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "controle", NF_DOUBLE, 1, idim1,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "controle", NF_FLOAT, 1, idim1,nvarid)
-#endif
-      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 22,
-     .                        "Parametres de controle")
-      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)
-#endif
-c
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "longitude", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "longitude", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 32,
-     .                        "Longitudes de la grille physique")
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlon)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlon)
-#endif
-c
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "latitude", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "latitude", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 31,
-     .                        "Latitudes de la grille physique")
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlat)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlat)
-#endif
-c
-C PB ajout du masque terre/mer
-C
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "masque", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "masque", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 16,
-     .                        "masque terre mer")
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zmasq)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,zmasq)
-#endif      
-c BP ajout des fraction de chaque sous-surface
-C
-C 1. fraction de terre 
-C
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "FTER", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "FTER", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 21,
-     .                        "fraction de continent")
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,pctsrf(1 : klon, is_ter))
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,pctsrf(1 : klon, is_ter))
-#endif
-C 
-C 2. Fraction de glace de terre
-C 
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "FLIC", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "FLIC", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 24,
-     .                        "fraction glace de terre")
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,pctsrf(1 : klon,is_lic))
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,pctsrf(1 : klon, is_lic))
-#endif
-C
-C 3. fraction ocean
-C
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "FOCE", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "FOCE", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 14,
-     .                        "fraction ocean")
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,pctsrf(1 : klon, is_oce))
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,pctsrf(1 : klon, is_oce))
-#endif
-C
-C 4. Fraction glace de mer
-C
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "FSIC", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "FSIC", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 18,
-     .                        "fraction glace mer")
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,pctsrf(1 : klon, is_sic))
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,pctsrf(1 : klon, is_sic))
-#endif
-C
-C
-c
-      DO nsrf = 1, nbsrf
-        IF (nsrf.LE.99) THEN
-        WRITE(str2,'(i2.2)') nsrf
-        ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-        ierr = NF_DEF_VAR (nid, "TS"//str2, NF_DOUBLE, 1, idim2,nvarid)
-#else
-        ierr = NF_DEF_VAR (nid, "TS"//str2, NF_FLOAT, 1, idim2,nvarid)
-#endif
-        ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28,
-     .                        "Temperature de surface No."//str2)
-        ierr = NF_ENDDEF(nid)
-        ELSE
-        PRINT*, "Trop de sous-mailles"
-        CALL abort
-        ENDIF
-#ifdef NC_DOUBLE
-        ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tsol(1,nsrf))
-#else
-        ierr = NF_PUT_VAR_REAL (nid,nvarid,tsol(1,nsrf))
-#endif
-      ENDDO
-c
-      DO nsrf = 1, nbsrf
-      DO isoil=1, nsoilmx
-        IF (isoil.LE.99 .AND. nsrf.LE.99) THEN
-        WRITE(str7,'(i2.2,"srf",i2.2)') isoil,nsrf
-        ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-        ierr = NF_DEF_VAR (nid, "Tsoil"//str7,NF_DOUBLE,1,idim2,nvarid)
-#else
-        ierr = NF_DEF_VAR (nid, "Tsoil"//str7,NF_FLOAT,1,idim2,nvarid)
-#endif
-        ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 29,
-     .                        "Temperature du sol No."//str7)
-        ierr = NF_ENDDEF(nid)
-        ELSE
-        PRINT*, "Trop de couches"
-        CALL abort
-        ENDIF
-#ifdef NC_DOUBLE
-        ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tsoil(1,isoil,nsrf))
-#else
-        ierr = NF_PUT_VAR_REAL (nid,nvarid,tsoil(1,isoil,nsrf))
-#endif
-      ENDDO
-      ENDDO
-c
-c
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "DELTAT", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "DELTAT", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 33,
-     .                        "Ecart de la SST (pour slab-ocean)")
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,deltat)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,deltat)
-#endif
-c
-      DO nsrf = 1, nbsrf
-        IF (nsrf.LE.99) THEN
-        WRITE(str2,'(i2.2)') nsrf
-        ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-        ierr = NF_DEF_VAR (nid,"QS"//str2,NF_DOUBLE,1,idim2,nvarid)
-#else
-        ierr = NF_DEF_VAR (nid,"QS"//str2,NF_FLOAT,1,idim2,nvarid)
-#endif
-        ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 25,
-     .                        "Humidite de surface No."//str2)
-        ierr = NF_ENDDEF(nid)
-        ELSE
-        PRINT*, "Trop de sous-mailles"
-        CALL abort
-        ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,qsol(1,nsrf))
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,qsol(1,nsrf))
-#endif
-      ENDDO
-c
-      DO nsrf = 1, nbsrf
-        IF (nsrf.LE.99) THEN
-        WRITE(str2,'(i2.2)') nsrf
-        ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-        ierr = NF_DEF_VAR (nid,"ALBE"//str2,NF_DOUBLE,1,idim2,nvarid)
-#else
-        ierr = NF_DEF_VAR (nid,"ALBE"//str2,NF_FLOAT,1,idim2,nvarid)
-#endif
-        ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 23,
-     .                        "albedo de surface No."//str2)
-        ierr = NF_ENDDEF(nid)
-        ELSE
-        PRINT*, "Trop de sous-mailles"
-        CALL abort
-        ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,albedo(1,nsrf))
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,albedo(1,nsrf))
-#endif
-      ENDDO
-c
-      DO nsrf = 1, nbsrf
-        IF (nsrf.LE.99) THEN
-        WRITE(str2,'(i2.2)') nsrf
-        ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-        ierr = NF_DEF_VAR (nid,"EVAP"//str2,NF_DOUBLE,1,idim2,nvarid)
-#else
-        ierr = NF_DEF_VAR (nid,"EVAP"//str2,NF_FLOAT,1,idim2,nvarid)
-#endif
-        ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28,
-     .                        "Evaporation de surface No."//str2)
-        ierr = NF_ENDDEF(nid)
-        ELSE
-        PRINT*, "Trop de sous-mailles"
-        CALL abort
-        ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,evap(1,nsrf))
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,evap(1,nsrf))
-#endif
-      ENDDO
-
-c
-      DO nsrf = 1, nbsrf
-        IF (nsrf.LE.99) THEN
-        WRITE(str2,'(i2.2)') nsrf
-        ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-        ierr = NF_DEF_VAR (nid,"SNOW"//str2,NF_DOUBLE,1,idim2,nvarid)
-#else
-        ierr = NF_DEF_VAR (nid,"SNOW"//str2,NF_FLOAT,1,idim2,nvarid)
-#endif
-        ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 22,
-     .                        "Neige de surface No."//str2)
-        ierr = NF_ENDDEF(nid)
-        ELSE
-        PRINT*, "Trop de sous-mailles"
-        CALL abort
-        ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,snow(1,nsrf))
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,snow(1,nsrf))
-#endif
-      ENDDO
-
-c
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "RADS", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "RADS", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28,
-     .                        "Rayonnement net a la surface")
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,radsol)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,radsol)
-#endif
-c
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "solsw", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "solsw", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 32,
-     .                        "Rayonnement solaire a la surface")
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,solsw)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,solsw)
-#endif
-c
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "sollw", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "sollw", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 27,
-     .                        "Rayonnement IF a la surface")
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,sollw)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,sollw)
-#endif
-c
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "rain_f", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "rain_f", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 21,
-     .                        "precipitation liquide")
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rain_fall)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,rain_fall)
-#endif
-c
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "snow_f", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "snow_f", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 20,
-     .                        "precipitation solide")
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,snow_fall)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,snow_fall)
-#endif
-c
-      DO nsrf = 1, nbsrf
-        IF (nsrf.LE.99) THEN
-        WRITE(str2,'(i2.2)') nsrf
-        ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-        ierr = NF_DEF_VAR (nid,"RUG"//str2,NF_DOUBLE,1,idim2,nvarid)
-#else
-        ierr = NF_DEF_VAR (nid,"RUG"//str2,NF_FLOAT,1,idim2,nvarid)
-#endif
-        ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 23,
-     .                        "rugosite de surface No."//str2)
-        ierr = NF_ENDDEF(nid)
-        ELSE
-        PRINT*, "Trop de sous-mailles"
-        CALL abort
-        ENDIF
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,frugs(1,nsrf))
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,frugs(1,nsrf))
-#endif
-      ENDDO
-c
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "AGESNO", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "AGESNO", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 15,
-     .                        "Age de la neige")
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,agesno)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,agesno)
-#endif
-c
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "ZMEA", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "ZMEA", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zmea)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,zmea)
-#endif
-c
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "ZSTD", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "ZSTD", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zstd)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,zstd)
-#endif
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "ZSIG", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "ZSIG", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zsig)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,zsig)
-#endif
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "ZGAM", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "ZGAM", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zgam)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,zgam)
-#endif
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "ZTHE", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "ZTHE", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zthe)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,zthe)
-#endif
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "ZPIC", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "ZPIC", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zpic)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,zpic)
-#endif
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "ZVAL", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "ZVAL", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,zval)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,zval)
-#endif
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "RUGSREL", NF_DOUBLE, 1, idim2,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "RUGSREL", NF_FLOAT, 1, idim2,nvarid)
-#endif
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rugsrel)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,rugsrel)
-#endif
-c
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "TANCIEN", NF_DOUBLE, 1, idim3,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "TANCIEN", NF_FLOAT, 1, idim3,nvarid)
-#endif
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,t_ancien)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,t_ancien)
-#endif
-c
-      ierr = NF_REDEF (nid)
-#ifdef NC_DOUBLE
-      ierr = NF_DEF_VAR (nid, "QANCIEN", NF_DOUBLE, 1, idim3,nvarid)
-#else
-      ierr = NF_DEF_VAR (nid, "QANCIEN", NF_FLOAT, 1, idim3,nvarid)
-#endif
-      ierr = NF_ENDDEF(nid)
-#ifdef NC_DOUBLE
-      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q_ancien)
-#else
-      ierr = NF_PUT_VAR_REAL (nid,nvarid,q_ancien)
-#endif
-c
-      ierr = NF_CLOSE(nid)
-c
-      RETURN
-      END
Index: /LMDZ.3.3/branches/rel-LF/libf/dyn3d/temps.h
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/dyn3d/temps.h	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/dyn3d/temps.h	(revision 353)
@@ -4,9 +4,11 @@
 ! INCLUDE 'temps.h'
 
-      COMMON/temps/itaufin,dt, day_ini,day_end,anne_ini
+      COMMON/temps/itaufin, dt, day_ini, day_end, annee_ref, day_ref,
+     .             itau_dyn, itau_phy
 
-      INTEGER  itaufin
-      INTEGER*4 day_ini,day_end,anne_ini
-      REAL     dt
+      INTEGER   itaufin
+      INTEGER*4 itau_dyn, itau_phy
+      INTEGER*4 day_ini, day_end, annee_ref, day_ref
+      REAL      dt
 
 !-----------------------------------------------------------------------
Index: /LMDZ.3.3/branches/rel-LF/libf/dyn3d/temps.inc
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/dyn3d/temps.inc	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/dyn3d/temps.inc	(revision 353)
@@ -1,10 +1,14 @@
+!
+! $Header$
+!
 !-----------------------------------------------------------------------
 ! INCLUDE 'temps.h'
 
-      COMMON/temps/itaufin,dt, &
-     &  day_ini,day_end,anne_ini
+      COMMON/temps/itaufin, dt, &
+     &  day_ini, day_end, annee_ref, day_ref, itau_dyn, itau_phy
 
       INTEGER  itaufin
-      INTEGER*4 day_ini,day_end,anne_ini
+      INTEGER*4 itau_dyn, itau_phy
+      INTEGER*4 day_ini, day_end, annee_ref, day_ref
       REAL     dt
 
Index: /LMDZ.3.3/branches/rel-LF/libf/phylmd/clmain.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/phylmd/clmain.F	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/phylmd/clmain.F	(revision 353)
@@ -201,4 +201,5 @@
       SAVE debugindex
       DATA debugindex/.false./
+      integer idayref
 #include "temps.h"
       
@@ -208,6 +209,6 @@
 ! initialisation sorties netcdf
 !
-          CALL ymds2ju(anne_ini, 1, 1, 0.0, zjulian)
-          zjulian = zjulian + day_ini
+          idayref = day_ini
+          CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian)
           CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlon,zx_lon)
           DO i = 1, iim
@@ -217,6 +218,7 @@
           CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlat,zx_lat)
           cldebug='sous_index'
-          CALL histbeg(cldebug, iim,zx_lon,jjm+1,zx_lat,1,iim,1,jjm
-     $        +1, 0,zjulian,dtime,nhoridbg,nidbg) 
+          CALL histbeg(cldebug, iim,zx_lon(:,1),jjm+1,zx_lat(1,:),
+     $        1,iim,1,jjm
+     $        +1, itau_phy,zjulian,dtime,nhoridbg,nidbg) 
 ! no vertical axis
           cl_surf(1)='ter'
Index: /LMDZ.3.3/branches/rel-LF/libf/phylmd/condsurf.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/phylmd/condsurf.F	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/phylmd/condsurf.F	(revision 353)
@@ -67,6 +67,6 @@
 c  .............   modif  (  P. Le Van )  ...........
 
-       anneelim  = anne_ini
-       anneemax  = anne_ini + nannemax
+       anneelim  = annee_ref
+       anneemax  = annee_ref + nannemax
 c
 c
@@ -83,5 +83,5 @@
          PRINT *,' PBS ! Le jour a lire sur le fichier limit ne se '
          PRINT *,' trouve pas sur les ',nannemax,' annees a partir de '
-         PRINT *,' l annee de debut', anne_ini
+         PRINT *,' l annee de debut', annee_ref
            CALL EXIT(1)
 c
Index: /LMDZ.3.3/branches/rel-LF/libf/phylmd/initphysto.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/phylmd/initphysto.F	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/phylmd/initphysto.F	(revision 353)
@@ -68,5 +68,5 @@
       integer uhoriid, vhoriid, thoriid, zvertiid
       integer ii,jj
-      integer zan
+      integer zan, idayref
       logical ok_sync
       REAL zx_lon(iim,jjm+1), zx_lat(iim,jjm+1)
@@ -85,6 +85,6 @@
 
       zan = anneeref
-      CALL ymds2ju(zan, 1, 1, 0.0, zjulian)
-      zjulian = zjulian + dayref
+      idayref = dayref
+      CALL ymds2ju(zan, 1, idayref, 0.0, zjulian)
       tau0 = 0
 	
@@ -97,5 +97,5 @@
 
 
-      call histbeg(infile, iim, zx_lon, jjm+1, zx_lat,
+      call histbeg(infile, iim, zx_lon(:,1), jjm+1, zx_lat(1,:),
      .             1, iim, 1, jjm+1,
      .             tau0, zjulian, tstep, nhoriid, fileid)
Index: /LMDZ.3.3/branches/rel-LF/libf/phylmd/interface_surf.F90
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/phylmd/interface_surf.F90	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/phylmd/interface_surf.F90	(revision 353)
@@ -1239,7 +1239,8 @@
   INTEGER :: ndexct(iim*(jjm+1)),ndexcs(iim*(jjm+1))
   REAL :: zx_lon(iim,jjm+1), zx_lat(iim,jjm+1), zjulian
+  integer :: idayref, itau_w
   include 'param_cou.h'
   include 'inc_cpl.h'
-  include 'temps.h'
+  include 'temps.inc'
 !
 ! Initialisation
@@ -1310,6 +1311,6 @@
 ! initialisation sorties netcdf
 !
-    CALL ymds2ju(anne_ini, 1, 1, 0.0, zjulian)
-    zjulian = zjulian + day_ini
+    idayref = day_ini
+    CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian)
     CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlon,zx_lon)
     DO i = 1, iim
@@ -1319,6 +1320,6 @@
     CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlat,zx_lat)
     clintocplnam="cpl_atm_tauflx"
-    CALL histbeg(clintocplnam, iim,zx_lon,jjm+1,zx_lat,1,iim,1,jjm+1, &
-       & 0,zjulian,dtime,nhoridct,nidct) 
+    CALL histbeg(clintocplnam, iim,zx_lon(:,1),jjm+1,zx_lat(1,:),1,iim,1,jjm+1, &
+       & itau_phy,zjulian,dtime,nhoridct,nidct) 
 ! no vertical axis
     CALL histdef(nidct, 'tauxe','tauxe', &
@@ -1338,5 +1339,5 @@
 
     clfromcplnam="cpl_atm_sst"
-    CALL histbeg(clfromcplnam, iim,zx_lon,jjm+1,zx_lat,1,iim,1,jjm+1, &
+    CALL histbeg(clfromcplnam, iim,zx_lon(:,1),jjm+1,zx_lat(1,:),1,iim,1,jjm+1, &
        & 0,zjulian,dtime,nhoridcs,nidcs) 
 ! no vertical axis
@@ -1419,8 +1420,9 @@
 !
       ndexcs(:)=0
-      CALL histwrite(nidcs,cl_read(1),itime,read_sst,iim*(jjm+1),ndexcs)
-      CALL histwrite(nidcs,cl_read(2),itime,read_sic,iim*(jjm+1),ndexcs)
-      CALL histwrite(nidcs,cl_read(3),itime,read_alb_sic,iim*(jjm+1),ndexcs)
-      CALL histwrite(nidcs,cl_read(4),itime,read_sit,iim*(jjm+1),ndexcs)
+      itau_w = itau_phy + itime
+      CALL histwrite(nidcs,cl_read(1),itau_w,read_sst,iim*(jjm+1),ndexcs)
+      CALL histwrite(nidcs,cl_read(2),itau_w,read_sic,iim*(jjm+1),ndexcs)
+      CALL histwrite(nidcs,cl_read(3),itau_w,read_alb_sic,iim*(jjm+1),ndexcs)
+      CALL histwrite(nidcs,cl_read(4),itau_w,read_sit,iim*(jjm+1),ndexcs)
       CALL histsync(nidcs)
 ! pas utile      IF (npas-itime.LT.nexca )CALL histclo(nidcs)
@@ -1582,8 +1584,8 @@
 !
       ndexct(:)=0
-      CALL histwrite(nidct,'tauxe',itime,wri_taux,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,'tauyn',itime,wri_tauy,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,'tmp_lon',itime,tmp_lon,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,'tmp_lat',itime,tmp_lat,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,'tauxe',itau_w,wri_taux,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,'tauyn',itau_w,wri_tauy,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,'tmp_lon',itau_w,tmp_lon,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,'tmp_lat',itau_w,tmp_lat,iim*(jjm+1),ndexct)
 
 !
@@ -1596,21 +1598,21 @@
 ! envoi au coupleur
 !
-      CALL histwrite(nidct,cl_writ(1),itime,wri_sol_ice,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,cl_writ(2),itime,wri_sol_sea,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,cl_writ(3),itime,wri_nsol_ice,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,cl_writ(4),itime,wri_nsol_sea,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,cl_writ(5),itime,wri_fder_ice,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,cl_writ(6),itime,wri_evap_ice,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,cl_writ(7),itime,wri_evap_sea,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,cl_writ(8),itime,wri_rain,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,cl_writ(9),itime,wri_snow,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,cl_writ(10),itime,wri_rcoa,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,cl_writ(11),itime,wri_rriv,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,cl_writ(12),itime,wri_tauxx,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,cl_writ(13),itime,wri_tauyy,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,cl_writ(14),itime,wri_tauzz,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,cl_writ(15),itime,wri_tauxx,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,cl_writ(16),itime,wri_tauyy,iim*(jjm+1),ndexct)
-      CALL histwrite(nidct,cl_writ(17),itime,wri_tauzz,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(1),itau_w,wri_sol_ice,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(2),itau_w,wri_sol_sea,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(3),itau_w,wri_nsol_ice,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(4),itau_w,wri_nsol_sea,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(5),itau_w,wri_fder_ice,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(6),itau_w,wri_evap_ice,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(7),itau_w,wri_evap_sea,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(8),itau_w,wri_rain,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(9),itau_w,wri_snow,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(10),itau_w,wri_rcoa,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(11),itau_w,wri_rriv,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(12),itau_w,wri_tauxx,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(13),itau_w,wri_tauyy,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(14),itau_w,wri_tauzz,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(15),itau_w,wri_tauxx,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(16),itau_w,wri_tauyy,iim*(jjm+1),ndexct)
+      CALL histwrite(nidct,cl_writ(17),itau_w,wri_tauzz,iim*(jjm+1),ndexct)
       CALL histsync(nidct)
 ! pas utile      IF (lafin) CALL histclo(nidct)
Index: /LMDZ.3.3/branches/rel-LF/libf/phylmd/phyetat0.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/phylmd/phyetat0.F	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/phylmd/phyetat0.F	(revision 353)
@@ -1,2 +1,5 @@
+c
+c $Header$
+c
       SUBROUTINE phyetat0 (fichnom,dtime,co2_ppm,solaire,
      .            rlat,rlon, pctsrf, tsol,tsoil,deltat,qsol,snow,
@@ -16,4 +19,5 @@
 #include "dimsoil.h"
 #include "clesphys.h"
+#include "temps.h"
 c======================================================================
       CHARACTER*(*) fichnom
@@ -37,5 +41,5 @@
       real fder(klon)
       REAL frugs(klon,nbsrf)
-      REAL agesno(klon)
+      REAL agesno(klon,nbsrf)
       REAL zmea(klon)
       REAL zstd(klon)
@@ -161,4 +165,7 @@
 
       ENDIF
+
+      itau_phy = tab_cntrl(15)
+
 c
 c Lecture des latitudes (coordonnees):
@@ -874,5 +881,5 @@
             xmax = MAX(frugs(i,1),xmax)
          ENDDO
-         PRINT*,'Neige du sol <RUG>', xmin, xmax
+         PRINT*,'rugosite <RUG>', xmin, xmax
          DO nsrf = 2, nbsrf
          DO i = 1, klon
@@ -888,16 +895,43 @@
       IF (ierr.NE.NF_NOERR) THEN
          PRINT*, 'phyetat0: Le champ <AGESNO> est absent'
-         PRINT*, "          Valeur par default: 50"
-         DO i = 1, klon
-            agesno(i) = 50.0
-         ENDDO
-      ELSE
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid, nvarid, agesno)
-#else
-         ierr = NF_GET_VAR_REAL(nid, nvarid, agesno)
+         PRINT*, '          Mais je vais essayer de lire AGESNO**'
+         DO nsrf = 1, nbsrf
+           IF (nsrf.GT.99) THEN
+             PRINT*, "Trop de sous-mailles"
+             CALL abort
+           ENDIF
+           WRITE(str2,'(i2.2)') nsrf
+           ierr = NF_INQ_VARID (nid, "AGESNO"//str2, nvarid)
+           IF (ierr.NE.NF_NOERR) THEN
+              PRINT*, "phyetat0: Le champ <AGESNO"//str2//"> est absent"
+              agesno = 50.0
+           ENDIF
+#ifdef NC_DOUBLE
+           ierr = NF_GET_VAR_DOUBLE(nid, nvarid, agesno(1,nsrf))
+#else
+           ierr = NF_GET_VAR_REAL(nid, nvarid, agesno(1,nsrf))
+#endif
+           IF (ierr.NE.NF_NOERR) THEN
+             PRINT*, "phyetat0: Lecture echouee pour <AGESNO"//str2//">"
+             CALL abort
+           ENDIF
+           xmin = 1.0E+20
+           xmax = -1.0E+20
+           DO i = 1, klon
+              xmin = MIN(agesno(i,nsrf),xmin)
+              xmax = MAX(agesno(i,nsrf),xmax)
+           ENDDO
+           PRINT*,'Age de la neige AGESNO**:', nsrf, xmin, xmax
+         ENDDO
+      ELSE
+         PRINT*, 'phyetat0: Le champ <AGESNO> est present'
+         PRINT*, '          J ignore donc les autres AGESNO**'
+#ifdef NC_DOUBLE
+         ierr = NF_GET_VAR_DOUBLE(nid, nvarid, agesno(1,1))
+#else
+         ierr = NF_GET_VAR_REAL(nid, nvarid, agesno(1,1))
 #endif
          IF (ierr.NE.NF_NOERR) THEN
-            PRINT*, 'phyetat0: Lecture echouee pour <AGESNO>'
+            PRINT*, "phyetat0: Lecture echouee pour <AGESNO>"
             CALL abort
          ENDIF
@@ -905,10 +939,15 @@
          xmax = -1.0E+20
          DO i = 1, klon
-            xmin = MIN(agesno(i),xmin)
-            xmax = MAX(agesno(i),xmax)
-         ENDDO
-         PRINT*,'Age de la neige agesno:', xmin, xmax
-      ENDIF
-c
+            xmin = MIN(agesno(i,1),xmin)
+            xmax = MAX(agesno(i,1),xmax)
+         ENDDO
+         PRINT*,'Age de la neige <AGESNO>', xmin, xmax
+         DO nsrf = 2, nbsrf
+         DO i = 1, klon
+            agesno(i,nsrf) = agesno(i,1)
+         ENDDO
+         ENDDO
+      ENDIF
+
 c
       ierr = NF_INQ_VARID (nid, "ZMEA", nvarid)
Index: /LMDZ.3.3/branches/rel-LF/libf/phylmd/physiq.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/phylmd/physiq.F	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/phylmd/physiq.F	(revision 353)
@@ -360,6 +360,4 @@
 c
       INTEGER julien
-      INTEGER idayvrai
-      SAVE idayvrai
 c
       INTEGER lmt_pas
@@ -555,4 +553,5 @@
       SAVE ecrit_reg   ! frequence d'ecriture
 c
+      integer itau_w   ! pas de temps ecriture = itap + itau_phy
 c
 c
@@ -589,4 +588,5 @@
       logical ok_sync
       real date0
+      integer idayref
 
 C essai writephys
@@ -761,12 +761,9 @@
 c Gestion calendrier
 
-         CALL ymds2ju(anne_ini, 1, 1, 0.0, zjulian)
-         zjulian = zjulian + day_ini
-
 c
       IF (ok_journe) THEN
 c
-         CALL ymds2ju(anne_ini, 1, 1, 0.0, zjulian)
-         zjulian = zjulian + day_ini
+         idayref = day_ref
+         CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian)
 c
          CALL gr_fi_ecrit(1,klon,iim,jjmp1,rlon,zx_lon)
@@ -779,7 +776,10 @@
          ENDDO
          CALL gr_fi_ecrit(1,klon,iim,jjmp1,rlat,zx_lat)
+         write(*,*)'zx_lon = ',zx_lon(:,1)
+         write(*,*)'zx_lat = ',zx_lat(1,:)
          CALL histbeg("histday", iim,zx_lon(:,1), jjmp1,zx_lat(1,:),
-     .                 1,iim,1,jjmp1, 0, zjulian, dtime, 
+     .                 1,iim,1,jjmp1, itau_phy, zjulian, dtime, 
      .                 nhori, nid_day)
+         write(*,*)'Journee ', itau_phy, zjulian
          CALL histvert(nid_day, "presnivs", "Vertical levels", "mb",
      .                 klev, presnivs, nvert)
@@ -1002,6 +1002,6 @@
       IF (ok_mensuel) THEN
 c
-         CALL ymds2ju(anne_ini, 1, 1, 0.0, zjulian)
-         zjulian = zjulian + day_ini
+         idayref = day_ref
+         CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian)
 c
          CALL gr_fi_ecrit(1,klon,iim,jjmp1,rlon,zx_lon)
@@ -1015,6 +1015,7 @@
          CALL gr_fi_ecrit(1,klon,iim,jjmp1,rlat,zx_lat)
          CALL histbeg("histmth.nc", iim,zx_lon(:,1), jjmp1,zx_lat(1,:),
-     .                 1,iim,1,jjmp1, 0, zjulian, dtime, 
+     .                 1,iim,1,jjmp1, itau_phy, zjulian, dtime, 
      .                 nhori, nid_mth)
+         write(*,*)'Mensuel ', itau_phy, zjulian
          CALL histvert(nid_mth, "presnivs", "Vertical levels", "mb",
      .                 klev, presnivs, nvert)
@@ -1446,6 +1447,6 @@
       IF (ok_instan) THEN
 c
-         CALL ymds2ju(anne_ini, 1, 1, 0.0, zjulian)
-         zjulian = zjulian + day_ini
+         idayref = day_ref
+         CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian)
 c
          CALL gr_fi_ecrit(1,klon,iim,jjmp1,rlon,zx_lon)
@@ -1458,7 +1459,8 @@
          ENDDO
          CALL gr_fi_ecrit(1,klon,iim,jjmp1,rlat,zx_lat)
-         CALL histbeg("histins", iim,zx_lon, jjmp1,zx_lat,
-     .                 1,iim,1,jjmp1, 0, zjulian, dtime,
+         CALL histbeg("histins", iim,zx_lon(:,1), jjmp1,zx_lat(1,:),
+     .                 1,iim,1,jjmp1, itau_phy, zjulian, dtime,
      .                 nhori, nid_ins)
+         write(*,*)'Inst ', itau_phy, zjulian
          CALL histvert(nid_ins, "presnivs", "Vertical levels", "mb",
      .                 klev, presnivs, nvert)
@@ -1763,6 +1765,5 @@
 c
       IF (MOD(itap-1,lmt_pas) .EQ. 0) THEN
-         idayvrai = NINT(xjour)
-         PRINT *,' PHYS cond  julien ',julien,idayvrai
+         PRINT *,' PHYS cond  julien ',julien
          CALL ozonecm( FLOAT(julien), rlat, paprs, wo)
       ENDIF
@@ -2398,4 +2399,5 @@
          zsto = dtime
          zout = dtime * FLOAT(ecrit_day)
+         itau_w = itau_phy + itap
 
          i = NINT(zout/zsto)
@@ -2418,5 +2420,5 @@
 C
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxtsol,zx_tmp_2d)
-      CALL histwrite(nid_day,"tsol",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"tsol",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'tsol',zxtsol,
 c    .              'Surface Temperature','K')
@@ -2425,5 +2427,5 @@
       zx_tmp_fi2d(1 : klon) = ftsol(1 : klon, is_ter)
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d ,zx_tmp_2d)
-      CALL histwrite(nid_day,"tter",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"tter",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'tter',ftsol(1 : klon, is_ter),
 c    .              'Surface Temperature','K')
@@ -2431,5 +2433,5 @@
       zx_tmp_fi2d(1 : klon) = ftsol(1 : klon, is_lic)
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxtsol,zx_tmp_2d)
-      CALL histwrite(nid_day,"tlic",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"tlic",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'tlic',ftsol(1 : klon, is_lic),
 c    .              'Surface Temperature','K')
@@ -2437,5 +2439,5 @@
       zx_tmp_fi2d(1 : klon) = ftsol(1 : klon, is_oce)
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxtsol,zx_tmp_2d)
-      CALL histwrite(nid_day,"toce",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"toce",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'toce',ftsol(1 : klon, is_oce),
 c    .              'Surface Temperature','K')
@@ -2443,5 +2445,5 @@
       zx_tmp_fi2d(1 : klon) = ftsol(1 : klon, is_sic)
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxtsol,zx_tmp_2d)
-      CALL histwrite(nid_day,"tsic",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"tsic",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'tsic',ftsol(1 : klon, is_sic),
 c    .              'Surface Temperature','K')
@@ -2451,5 +2453,5 @@
       ENDDO
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_day,"psol",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"psol",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c Essai writephys
       varname = 'psol'
@@ -2463,5 +2465,5 @@
       ENDDO
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_day,"rain",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"rain",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'rain',zx_tmp_fi2d,
 c    .              'Precipitation','mm/day')
@@ -2470,55 +2472,57 @@
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, snow_fall,zx_tmp_2d)
-      CALL histwrite(nid_day,"snow",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"snow",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'snow',snow_fall,
 c    .              'Snow','mm/day')
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxsnow,zx_tmp_2d)
-      CALL histwrite(nid_day,"snow_cov",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"snow_cov",itau_w,zx_tmp_2d,iim*jjmp1,
+     .               ndex2d)
 c     call writephy(fid_day,prof2d_av,'snow_cov',zxsnow,
 c    .              'Snow cover','mm')
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, evap,zx_tmp_2d)
-      CALL histwrite(nid_day,"evap",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"evap",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'evap',evap,
 c    .              'Evaporation','mm/day')
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, topsw,zx_tmp_2d)
-      CALL histwrite(nid_day,"tops",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"tops",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'tops',topsw,
 c    .              'Solar rad. at TOA','W/m2')
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, toplw,zx_tmp_2d)
-      CALL histwrite(nid_day,"topl",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"topl",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'topl',toplw,
 c    .              'IR rad. at TOA','W/m2')
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, solsw,zx_tmp_2d)
-      CALL histwrite(nid_day,"sols",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"sols",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'sols',solsw,
 c    .              'Solar rad. at surf.','W/m2')
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, sollw,zx_tmp_2d)
-      CALL histwrite(nid_day,"soll",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"soll",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'soll',sollw,
 c    .              'IR rad. at surface','W/m2')
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, sollwdown,zx_tmp_2d)
-      CALL histwrite(nid_day,"solldown",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"solldown",itau_w,zx_tmp_2d,iim*jjmp1,
+     .               ndex2d)
 c     call writephy(fid_day,prof2d_av,'solldown',sollwdown,
 c    .              'Down. IR rad. at surface','W/m2')
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, bils,zx_tmp_2d)
-      CALL histwrite(nid_day,"bils",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"bils",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'bils',bils,
 c    .              'Surf. total heat flux','W/m2')
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, sens,zx_tmp_2d)
-      CALL histwrite(nid_day,"sens",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"sens",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'sens',sens,
 c    .              'Sensible heat flux','W/m2')
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, fder,zx_tmp_2d)
-      CALL histwrite(nid_day,"fder",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"fder",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'fder',fder,
 c    .              'Heat flux derivation','W/m2')
@@ -2529,5 +2533,5 @@
         zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_day,"pourc_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_day,"pourc_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d) 
 c       call writephy(fid_day,prof2d_av,'pourc_'//clnsurf(nsrf),
@@ -2537,5 +2541,5 @@
         zx_tmp_fi2d(1 : klon) = ftsol( 1 : klon, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_day,"tsol_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_day,"tsol_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d) 
 c       call writephy(fid_day,prof2d_av,'tsol_'//clnsurf(nsrf),
@@ -2545,5 +2549,5 @@
         zx_tmp_fi2d(1 : klon) = fluxt( 1 : klon, 1, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_day,"sens_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_day,"sens_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d) 
 c       call writephy(fid_day,prof2d_av,'sens_'//clnsurf(nsrf),
@@ -2553,5 +2557,5 @@
         zx_tmp_fi2d(1 : klon) = fluxlat( 1 : klon, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_day,"lat_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_day,"lat_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d) 
 c       call writephy(fid_day,prof2d_av,'lat_'//clnsurf(nsrf),
@@ -2561,5 +2565,5 @@
         zx_tmp_fi2d(1 : klon) = fluxu( 1 : klon, 1, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_day,"taux_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_day,"taux_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d) 
 c       call writephy(fid_day,prof2d_av,'taux_'//clnsurf(nsrf),
@@ -2569,5 +2573,5 @@
         zx_tmp_fi2d(1 : klon) = fluxv( 1 : klon, 1, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_day,"tauy_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_day,"tauy_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d)
 c       call writephy(fid_day,prof2d_av,'tauy_'//clnsurf(nsrf),
@@ -2577,5 +2581,5 @@
         zx_tmp_fi2d(1 : klon) = falbe( 1 : klon, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_day,"albe_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_day,"albe_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d) 
 c       call writephy(fid_day,prof2d_av,'albe_'//clnsurf(nsrf),
@@ -2588,5 +2592,5 @@
         zx_tmp_fi2d(1 : klon) = frugs( 1 : klon, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_day,"rugs_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_day,"rugs_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d) 
 c       call writephy(fid_day,prof2d_av,'rugs_'//clnsurf(nsrf),
@@ -2600,28 +2604,28 @@
 c$$$      ENDDO
 c$$$      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-c$$$      CALL histwrite(nid_day,"sicf",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+c$$$      CALL histwrite(nid_day,"sicf",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldl,zx_tmp_2d)
-      CALL histwrite(nid_day,"cldl",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"cldl",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'cldl',cldl,
 c    .              'Low-level cloudiness','-')
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldm,zx_tmp_2d)
-      CALL histwrite(nid_day,"cldm",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"cldm",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'cldm',cldm,
 c    .              'Mid-level cloudiness','-')
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldh,zx_tmp_2d)
-      CALL histwrite(nid_day,"cldh",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"cldh",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'cldh',cldh,
 c    .              'High-level cloudiness','-')
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldt,zx_tmp_2d)
-      CALL histwrite(nid_day,"cldt",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"cldt",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'cldt',cldt,
 c    .              'Total cloudiness','-')
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldq,zx_tmp_2d)
-      CALL histwrite(nid_day,"cldq",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_day,"cldq",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c     call writephy(fid_day,prof2d_av,'cldq',cldq,
 c    .              'Cloud liquid water path','-')
@@ -2630,5 +2634,5 @@
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, t_seri, zx_tmp_3d)
-      CALL histwrite(nid_day,"temp",itap,zx_tmp_3d,
+      CALL histwrite(nid_day,"temp",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c Essai writephys
@@ -2639,5 +2643,5 @@
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, qx(1,1,ivap), zx_tmp_3d)
-      CALL histwrite(nid_day,"ovap",itap,zx_tmp_3d,
+      CALL histwrite(nid_day,"ovap",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c     call writephy(fid_day,prof3d_av,'ovap',qx(1,1,ivap),
@@ -2645,5 +2649,5 @@
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, zphi, zx_tmp_3d)
-      CALL histwrite(nid_day,"geop",itap,zx_tmp_3d,
+      CALL histwrite(nid_day,"geop",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c     call writephy(fid_day,prof3d_av,'geop',zphi,
@@ -2651,5 +2655,5 @@
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, u_seri, zx_tmp_3d)
-      CALL histwrite(nid_day,"vitu",itap,zx_tmp_3d,
+      CALL histwrite(nid_day,"vitu",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c     call writephy(fid_day,prof3d_av,'vitu',u_seri,
@@ -2657,5 +2661,5 @@
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, v_seri, zx_tmp_3d)
-      CALL histwrite(nid_day,"vitv",itap,zx_tmp_3d,
+      CALL histwrite(nid_day,"vitv",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c     call writephy(fid_day,prof3d_av,'vitv',v_seri,
@@ -2663,5 +2667,5 @@
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, omega, zx_tmp_3d)
-      CALL histwrite(nid_day,"vitw",itap,zx_tmp_3d,
+      CALL histwrite(nid_day,"vitw",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c     call writephy(fid_day,prof3d_av,'vitw',omega,
@@ -2669,5 +2673,5 @@
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, pplay, zx_tmp_3d)
-      CALL histwrite(nid_day,"pres",itap,zx_tmp_3d,
+      CALL histwrite(nid_day,"pres",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c     call writephy(fid_day,prof3d_av,'pres',pplay,
@@ -2690,4 +2694,5 @@
          zsto = dtime
          zout = dtime * ecrit_mth
+         itau_w = itau_phy + itap
 
          i = NINT(zout/zsto)
@@ -2700,5 +2705,5 @@
 
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxtsol,zx_tmp_2d)
-      CALL histwrite(nid_mth,"tsol",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"tsol",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       DO i = 1, klon
@@ -2706,8 +2711,8 @@
       ENDDO
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_mth,"psol",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"psol",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxqsol,zx_tmp_2d)
-      CALL histwrite(nid_mth,"qsol",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"qsol",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       DO i = 1, klon
@@ -2715,5 +2720,5 @@
       ENDDO
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_mth,"rain",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"rain",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       DO i = 1, klon
@@ -2721,5 +2726,5 @@
       ENDDO
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_mth,"plul",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"plul",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       DO i = 1, klon
@@ -2727,50 +2732,52 @@
       ENDDO
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_mth,"pluc",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"pluc",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, snow_fall,zx_tmp_2d)
-      CALL histwrite(nid_mth,"snow",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"snow",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxsnow,zx_tmp_2d)
-      CALL histwrite(nid_mth,"snow_cov",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"snow_cov",itau_w,zx_tmp_2d,iim*jjmp1,
+     .               ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, evap,zx_tmp_2d)
-      CALL histwrite(nid_mth,"evap",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"evap",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, topsw,zx_tmp_2d)
-      CALL histwrite(nid_mth,"tops",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"tops",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, toplw,zx_tmp_2d)
-      CALL histwrite(nid_mth,"topl",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"topl",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, solsw,zx_tmp_2d)
-      CALL histwrite(nid_mth,"sols",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"sols",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, sollw,zx_tmp_2d)
-      CALL histwrite(nid_mth,"soll",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"soll",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, sollwdown,zx_tmp_2d)
-      CALL histwrite(nid_mth,"solldown",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"solldown",itau_w,zx_tmp_2d,iim*jjmp1,
+     .               ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, topsw0,zx_tmp_2d)
-      CALL histwrite(nid_mth,"tops0",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"tops0",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, toplw0,zx_tmp_2d)
-      CALL histwrite(nid_mth,"topl0",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"topl0",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, solsw0,zx_tmp_2d)
-      CALL histwrite(nid_mth,"sols0",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"sols0",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, sollw0,zx_tmp_2d)
-      CALL histwrite(nid_mth,"soll0",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"soll0",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, bils,zx_tmp_2d)
-      CALL histwrite(nid_mth,"bils",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"bils",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, sens,zx_tmp_2d)
-      CALL histwrite(nid_mth,"sens",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"sens",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, fder,zx_tmp_2d)
-      CALL histwrite(nid_mth,"fder",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"fder",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
 c
@@ -2779,5 +2786,5 @@
 c      ENDDO
 c      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-c      CALL histwrite(nid_mth,"frtu",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+c      CALL histwrite(nid_mth,"frtu",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
 c      DO i = 1, klon
@@ -2785,5 +2792,5 @@
 c      ENDDO
 c      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-c      CALL histwrite(nid_mth,"frtv",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+c      CALL histwrite(nid_mth,"frtv",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       DO nsrf = 1, nbsrf
@@ -2791,45 +2798,45 @@
         zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_mth,"pourc_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_mth,"pourc_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d) 
 C 
         zx_tmp_fi2d(1 : klon) = ftsol( 1 : klon, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_mth,"tsol_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_mth,"tsol_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d)
 C
         zx_tmp_fi2d(1 : klon) = fluxt( 1 : klon, 1, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_mth,"sens_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_mth,"sens_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d)
 C
         zx_tmp_fi2d(1 : klon) = fluxlat( 1 : klon, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_mth,"lat_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_mth,"lat_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d) 
 C
         zx_tmp_fi2d(1 : klon) = fluxu( 1 : klon, 1, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_mth,"taux_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_mth,"taux_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d) 
 C      
         zx_tmp_fi2d(1 : klon) = fluxv( 1 : klon, 1, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_mth,"tauy_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_mth,"tauy_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d)
 C 
         zx_tmp_fi2d(1 : klon) = falbe( 1 : klon, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_mth,"albe_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_mth,"albe_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d)
 C
         zx_tmp_fi2d(1 : klon) = frugs( 1 : klon, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_mth,"rugs_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_mth,"rugs_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       zx_tmp_fi2d(1 : klon) = agesno( 1 : klon, nsrf)
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, agesno,zx_tmp_2d)
-      CALL histwrite(nid_mth,"ages_"//clnsurf(nsrf),itap
+      CALL histwrite(nid_mth,"ages_"//clnsurf(nsrf),itau_w
      $    ,zx_tmp_2d,iim*jjmp1,ndex2d)
 
@@ -2839,57 +2846,57 @@
 c$$$      ENDDO
 c$$$      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-c$$$      CALL histwrite(nid_mth,"sicf",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+c$$$      CALL histwrite(nid_mth,"sicf",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, albsol,zx_tmp_2d)
-      CALL histwrite(nid_mth,"albs",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"albs",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, albsollw,zx_tmp_2d)
-      CALL histwrite(nid_mth,"albslw",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"albslw",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, cdragm,zx_tmp_2d)
-      CALL histwrite(nid_mth,"cdrm",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"cdrm",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, cdragh,zx_tmp_2d)
-      CALL histwrite(nid_mth,"cdrh",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"cdrh",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldl,zx_tmp_2d)
-      CALL histwrite(nid_mth,"cldl",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"cldl",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldm,zx_tmp_2d)
-      CALL histwrite(nid_mth,"cldm",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"cldm",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldh,zx_tmp_2d)
-      CALL histwrite(nid_mth,"cldh",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"cldh",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldt,zx_tmp_2d)
-      CALL histwrite(nid_mth,"cldt",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"cldt",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldq,zx_tmp_2d)
-      CALL histwrite(nid_mth,"cldq",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"cldq",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, ue,zx_tmp_2d)
-      CALL histwrite(nid_mth,"ue",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"ue",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, ve,zx_tmp_2d)
-      CALL histwrite(nid_mth,"ve",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"ve",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, uq,zx_tmp_2d)
-      CALL histwrite(nid_mth,"uq",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"uq",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, vq,zx_tmp_2d)
-      CALL histwrite(nid_mth,"vq",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"vq",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 cKE43
       IF (iflag_con .GE. 3) THEN ! sb
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, cape,zx_tmp_2d)
-      CALL histwrite(nid_mth,"cape",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"cape",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1,pbase,zx_tmp_2d)
-      CALL histwrite(nid_mth,"pbase",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"pbase",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1,ema_pct,zx_tmp_2d)
-      CALL histwrite(nid_mth,"ptop",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"ptop",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1,ema_cbmf,zx_tmp_2d)
-      CALL histwrite(nid_mth,"fbase",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_mth,"fbase",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
 c
@@ -2900,130 +2907,130 @@
 C
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, t_seri, zx_tmp_3d)
-      CALL histwrite(nid_mth,"temp",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"temp",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, qx(1,1,ivap), zx_tmp_3d)
-      CALL histwrite(nid_mth,"ovap",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"ovap",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, zphi, zx_tmp_3d)
-      CALL histwrite(nid_mth,"geop",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"geop",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, u_seri, zx_tmp_3d)
-      CALL histwrite(nid_mth,"vitu",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"vitu",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, v_seri, zx_tmp_3d)
-      CALL histwrite(nid_mth,"vitv",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"vitv",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, omega, zx_tmp_3d)
-      CALL histwrite(nid_mth,"vitw",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"vitw",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, pplay, zx_tmp_3d)
-      CALL histwrite(nid_mth,"pres",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"pres",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, cldfra, zx_tmp_3d)
-      CALL histwrite(nid_mth,"rneb",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"rneb",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, zx_rh, zx_tmp_3d)
-      CALL histwrite(nid_mth,"rhum",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"rhum",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, cldliq, zx_tmp_3d)
-      CALL histwrite(nid_mth,"oliq",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"oliq",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_t_dyn, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dtdyn",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dtdyn",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_q_dyn, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dqdyn",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dqdyn",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_t_con, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dtcon",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dtcon",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_q_con, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dqcon",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dqcon",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_t_lsc, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dtlsc",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dtlsc",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_q_lsc, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dqlsc",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dqlsc",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_t_vdf, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dtvdf",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dtvdf",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_q_vdf, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dqvdf",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dqvdf",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_t_eva, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dteva",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dteva",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_q_eva, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dqeva",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dqeva",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, zpt_conv, zx_tmp_3d)
-      CALL histwrite(nid_mth,"ptconv",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"ptconv",itau_w,zx_tmp_3d,
      .                                   iim*(jjmp1)*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, ratqs, zx_tmp_3d)
-      CALL histwrite(nid_mth,"ratqs",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"ratqs",itau_w,zx_tmp_3d,
      .                                   iim*(jjmp1)*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_t_ajs, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dtajs",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dtajs",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_q_ajs, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dqajs",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dqajs",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, heat, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dtswr",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dtswr",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, heat0, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dtsw0",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dtsw0",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, cool, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dtlwr",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dtlwr",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, cool0, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dtlw0",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dtlw0",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_u_vdf, zx_tmp_3d)
-      CALL histwrite(nid_mth,"duvdf",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"duvdf",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_v_vdf, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dvvdf",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dvvdf",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       IF (ok_orodr) THEN
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_u_oro, zx_tmp_3d)
-      CALL histwrite(nid_mth,"duoro",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"duoro",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_v_oro, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dvoro",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dvoro",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
@@ -3032,14 +3039,14 @@
       IF (ok_orolf) THEN
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_u_lif, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dulif",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dulif",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_v_lif, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dvlif",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dvlif",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
       ENDIF
 C
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, wo, zx_tmp_3d)
-      CALL histwrite(nid_mth,"ozone",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"ozone",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
@@ -3049,5 +3056,5 @@
          CALL gr_fi_ecrit(klev,klon,iim,jjmp1, qx(1,1,iq+2), zx_tmp_3d)
          WRITE(str2,'(i2.2)') iq
-         CALL histwrite(nid_mth,"trac"//str2,itap,zx_tmp_3d,
+         CALL histwrite(nid_mth,"trac"//str2,itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
       ELSE
@@ -3061,17 +3068,17 @@
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, upwd, zx_tmp_3d)
-      CALL histwrite(nid_mth,"upwd",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"upwd",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, dnwd, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dnwd",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dnwd",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, dnwd0, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dnwd0",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"dnwd0",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, Ma, zx_tmp_3d)
-      CALL histwrite(nid_mth,"Ma",itap,zx_tmp_3d,
+      CALL histwrite(nid_mth,"Ma",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
@@ -3094,4 +3101,5 @@
          zsto = dtime * ecrit_ins
          zout = dtime * ecrit_ins
+         itau_w = itau_phy + itap
 
          i = NINT(zout/zsto)
@@ -3107,5 +3115,5 @@
       ENDDO
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_ins,"psol",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"psol",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       DO i = 1, klon
@@ -3113,5 +3121,5 @@
       ENDDO
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_ins,"rain",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"rain",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       DO i = 1, klon
@@ -3119,5 +3127,5 @@
       ENDDO
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_ins,"plul",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"plul",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       DO i = 1, klon
@@ -3125,48 +3133,53 @@
       ENDDO
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_ins,"pluc",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"pluc",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxtsol,zx_tmp_2d)
-      CALL histwrite(nid_ins,"tsol",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"tsol",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, snow_fall,zx_tmp_2d)
-      CALL histwrite(nid_ins,"snow",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"snow",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, toplw,zx_tmp_2d)
-      CALL histwrite(nid_ins,"topl",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"topl",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, evap,zx_tmp_2d)
-      CALL histwrite(nid_ins,"evap",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"evap",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, solsw,zx_tmp_2d)
-      CALL histwrite(nid_ins,"sols",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"sols",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, sollw,zx_tmp_2d)
-      CALL histwrite(nid_ins,"soll",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"soll",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, sollwdown,zx_tmp_2d)
-      CALL histwrite(nid_ins,"solldown",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"solldown",itau_w,zx_tmp_2d,iim*jjmp1,
+     .                ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, bils,zx_tmp_2d)
-      CALL histwrite(nid_ins,"bils",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"bils",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, sens,zx_tmp_2d)
-      CALL histwrite(nid_ins,"sens",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"sens",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, fder,zx_tmp_2d)
-      CALL histwrite(nid_ins,"fder",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"fder",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, d_ts(1,is_oce),zx_tmp_2d)
-      CALL histwrite(nid_ins,"dtsvdfo",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"dtsvdfo",itau_w,zx_tmp_2d,iim*jjmp1,
+     .               ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, d_ts(1,is_ter),zx_tmp_2d)
-      CALL histwrite(nid_ins,"dtsvdft",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"dtsvdft",itau_w,zx_tmp_2d,iim*jjmp1,
+     .               ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, d_ts(1,is_lic),zx_tmp_2d)
-      CALL histwrite(nid_ins,"dtsvdfg",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"dtsvdfg",itau_w,zx_tmp_2d,iim*jjmp1,
+     .               ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, d_ts(1,is_sic),zx_tmp_2d)
-      CALL histwrite(nid_ins,"dtsvdfi",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"dtsvdfi",itau_w,zx_tmp_2d,iim*jjmp1,
+     .               ndex2d)
 
       DO nsrf = 1, nbsrf
@@ -3174,82 +3187,83 @@
         zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_ins,"pourc_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_ins,"pourc_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d) 
 C 
         zx_tmp_fi2d(1 : klon) = fluxt( 1 : klon, 1, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_ins,"sens_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_ins,"sens_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d) 
 C
         zx_tmp_fi2d(1 : klon) = fluxlat( 1 : klon, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_ins,"lat_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_ins,"lat_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d) 
 C
         zx_tmp_fi2d(1 : klon) = ftsol( 1 : klon, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_ins,"tsol_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_ins,"tsol_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d) 
 C
         zx_tmp_fi2d(1 : klon) = fluxu( 1 : klon, 1, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_ins,"taux_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_ins,"taux_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d) 
 C      
         zx_tmp_fi2d(1 : klon) = fluxv( 1 : klon, 1, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_ins,"tauy_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_ins,"tauy_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d)
 C
         zx_tmp_fi2d(1 : klon) = frugs( 1 : klon, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_ins,"rugs_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_ins,"rugs_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d) 
 C
         zx_tmp_fi2d(1 : klon) = falbe( 1 : klon, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_ins,"albe_"//clnsurf(nsrf),itap,
+        CALL histwrite(nid_ins,"albe_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d) 
 C 
       END DO  
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, albsol,zx_tmp_2d)
-      CALL histwrite(nid_ins,"albs",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"albs",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, albsollw,zx_tmp_2d)
-      CALL histwrite(nid_ins,"albslw",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"albslw",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxsnow,zx_tmp_2d)
-      CALL histwrite(nid_ins,"snow_cov",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"snow_cov",itau_w,zx_tmp_2d,iim*jjmp1,
+     .               ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxrugs,zx_tmp_2d)
-      CALL histwrite(nid_ins,"rugs",itap,zx_tmp_2d,iim*jjmp1,ndex2d)
+      CALL histwrite(nid_ins,"rugs",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
 c Champs 3D:
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, t_seri, zx_tmp_3d)
-      CALL histwrite(nid_ins,"temp",itap,zx_tmp_3d,
+      CALL histwrite(nid_ins,"temp",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, u_seri, zx_tmp_3d)
-      CALL histwrite(nid_ins,"vitu",itap,zx_tmp_3d,
+      CALL histwrite(nid_ins,"vitu",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, v_seri, zx_tmp_3d)
-      CALL histwrite(nid_ins,"vitv",itap,zx_tmp_3d,
+      CALL histwrite(nid_ins,"vitv",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, zphi, zx_tmp_3d)
-      CALL histwrite(nid_ins,"geop",itap,zx_tmp_3d,
+      CALL histwrite(nid_ins,"geop",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, pplay, zx_tmp_3d)
-      CALL histwrite(nid_ins,"pres",itap,zx_tmp_3d,
+      CALL histwrite(nid_ins,"pres",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_t_vdf, zx_tmp_3d)
-      CALL histwrite(nid_ins,"dtvdf",itap,zx_tmp_3d,
+      CALL histwrite(nid_ins,"dtvdf",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_q_vdf, zx_tmp_3d)
-      CALL histwrite(nid_ins,"dqvdf",itap,zx_tmp_3d,
+      CALL histwrite(nid_ins,"dqvdf",itau_w,zx_tmp_3d,
      .                                   iim*jjmp1*klev,ndex3d)
 
@@ -3339,4 +3353,5 @@
 c
       IF (lafin) THEN
+         itau_phy = itau_phy + itap
 ccc         IF (ok_oasis) CALL quitcpl
          CALL phyredem ("restartphy.nc",dtime,radpas,co2_ppm,solaire,
Index: /LMDZ.3.3/branches/rel-LF/libf/phylmd/phytrac.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/phylmd/phytrac.F	(revision 352)
+++ /LMDZ.3.3/branches/rel-LF/libf/phylmd/phytrac.F	(revision 353)
@@ -235,6 +235,6 @@
 	 itap=0
 C         
-         CALL ymds2ju(anne_ini, 1, 1, 0.0, zjulian)
-         zjulian = zjulian + day_ini
+         CALL ymds2ju(annee_ref, 1, 1, 0.0, zjulian)
+         zjulian = zjulian + day_ref
 c
          CALL gr_fi_ecrit(1,klon,iim,jjm+1,xlon,zx_lon)
@@ -247,6 +247,6 @@
 c         ENDDO
          CALL gr_fi_ecrit(1,klon,iim,jjm+1,xlat,zx_lat)
-         CALL histbeg("histrac", iim,zx_lon, jjm+1,zx_lat,
-     .                 1,iim,1,jjm+1, 0, zjulian, pdtphys,
+         CALL histbeg("histrac", iim,zx_lon(:,1), jjm+1,zx_lat(1,:),
+     .                 1,iim,1,jjm+1, itau_phy, zjulian, pdtphys,
      .                 nhori, nid_tra)
          CALL histvert(nid_tra, "presnivs", "Vertical levels", "mb",
