Index: LMDZ.3.3/trunk/libf/bibio/writedynav.F
===================================================================
--- LMDZ.3.3/trunk/libf/bibio/writedynav.F	(revision 2)
+++ LMDZ.3.3/trunk/libf/bibio/writedynav.F	(revision 29)
@@ -58,5 +58,5 @@
 C   Variables locales
 C
-      integer ndex(1),iq, ii, ll
+      integer ndex2d(iip1*jjp1),ndex3d(iip1*jjp1*llm),iq, ii, ll
       character*3 str
       real us(ip1jmp1*llm), vs(ip1jmp1*llm)
@@ -68,5 +68,6 @@
 C
       str='q  '
-      ndex(1) = 0
+      ndex3d = 0
+      ndex2d = 0
       ok_sync = .TRUE.
 
@@ -81,5 +82,5 @@
       call gr_u_scal(llm, unat, us)
       call histwrite(histid, 'u', time, us, 
-     .               iip1*jjp1*llm, ndex)
+     .               iip1*jjp1*llm, ndex3d)
 C
 C  Vents V scalaire
@@ -87,5 +88,5 @@
       call gr_v_scal(llm, vnat, vs)
       call histwrite(histid, 'v', time, vs, 
-     .               iip1*jjp1*llm, ndex)
+     .               iip1*jjp1*llm, ndex3d)
 C
 C  Temperature moyennee
@@ -95,10 +96,10 @@
       enddo
       call histwrite(histid, 'temp', time, tm, 
-     .                iip1*jjp1*llm, ndex)
+     .                iip1*jjp1*llm, ndex3d)
 C
 C  Geopotentiel
 C
       call histwrite(histid, 'phi', time, phi, 
-     .                iip1*jjp1*llm, ndex)
+     .                iip1*jjp1*llm, ndex3d)
 C
 C  Traceurs
@@ -112,5 +113,5 @@
           ENDIF
           call histwrite(histid, str, time, q(:,:,iq), 
-     .                   iip1*jjp1*llm, ndex)
+     .                   iip1*jjp1*llm, ndex3d)
         enddo
       endif
@@ -118,17 +119,17 @@
 C  Masse
 C
-       call histwrite(histid, 'masse', time, masse, iip1*jjp1, ndex)
+       call histwrite(histid, 'masse', time, masse, iip1*jjp1, ndex2d)
 C
 C  Pression au sol
 C
-       call histwrite(histid, 'ps', time, ps, iip1*jjp1, ndex)
+       call histwrite(histid, 'ps', time, ps, iip1*jjp1, ndex2d)
 C
 C  Geopotentiel au sol
 C
-       call histwrite(histid, 'phis', time, phis, iip1*jjp1, ndex)
+       call histwrite(histid, 'phis', time, phis, iip1*jjp1, ndex2d)
 C
 C  Fin
 C
-      if (ok_sync) call histsync
+      if (ok_sync) call histsync(histid)
       return
       end
Index: LMDZ.3.3/trunk/libf/bibio/writehist.F
===================================================================
--- LMDZ.3.3/trunk/libf/bibio/writehist.F	(revision 2)
+++ LMDZ.3.3/trunk/libf/bibio/writehist.F	(revision 29)
@@ -59,5 +59,6 @@
 C   Variables locales
 C
-      integer ndex(1),iq, ii, ll
+      integer iq, ii, ll
+      integer ndexu(ip1jmp1,llm),ndexv(ip1jm,llm),ndex2d(ip1jmp1)
       character*3 str
       logical ok_sync
@@ -66,5 +67,7 @@
 C
       str='q  '
-      ndex(1) = 0
+      ndexu = 0
+      ndexv = 0
+      ndex2d = 0
       ok_sync =.TRUE.
 C
@@ -74,5 +77,5 @@
 C
       call histwrite(histid, 'ucov', time, ucov, 
-     .               iip1*jjp1*llm, ndex)
+     .               iip1*jjp1*llm, ndexu)
 
 C
@@ -80,5 +83,5 @@
 C
       call histwrite(histvid, 'vcov', time, vcov, 
-     .               iip1*jjm*llm, ndex)
+     .               iip1*jjm*llm, ndexv)
 
 C
@@ -86,10 +89,10 @@
 C
       call histwrite(histid, 'teta', time, teta, 
-     .                iip1*jjp1*llm, ndex)
+     .                iip1*jjp1*llm, ndexu)
 C
 C  Geopotentiel
 C
       call histwrite(histid, 'phi', time, phi, 
-     .                iip1*jjp1*llm, ndex)
+     .                iip1*jjp1*llm, ndexu)
 C
 C  Traceurs
@@ -103,5 +106,5 @@
           ENDIF
           call histwrite(histid, str, time, q(:,:,iq), 
-     .                   iip1*jjp1*llm, ndex)
+     .                   iip1*jjp1*llm, ndexu)
         enddo
       endif
@@ -109,17 +112,20 @@
 C  Masse
 C
-      call histwrite(histid, 'masse', time, masse, iip1*jjp1, ndex)
+      call histwrite(histid, 'masse', time, masse, iip1*jjp1, ndex2d)
 C
 C  Pression au sol
 C
-      call histwrite(histid, 'ps', time, ps, iip1*jjp1, ndex)
+      call histwrite(histid, 'ps', time, ps, iip1*jjp1, ndex2d)
 C
 C  Geopotentiel au sol
 C
-      call histwrite(histid, 'phis', time, phis, iip1*jjp1, ndex)
+      call histwrite(histid, 'phis', time, phis, iip1*jjp1, ndex2d)
 C
 C  Fin
 C
-      if (ok_sync) call histsync
+      if (ok_sync) then
+        call histsync(histid)
+        call histsync(histvid)
+      endif
       return
       end
