Index: LMDZ.3.3/branches/rel-LF/libf/phylmd/physiq.F
===================================================================
--- LMDZ.3.3/branches/rel-LF/libf/phylmd/physiq.F	(revision 340)
+++ 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,
