Index: LMDZ4/branches/LMDZ4_par_0/libf/phylmd/write_histins.h
===================================================================
--- LMDZ4/branches/LMDZ4_par_0/libf/phylmd/write_histins.h	(revision 633)
+++ LMDZ4/branches/LMDZ4_par_0/libf/phylmd/write_histins.h	(revision 634)
@@ -14,186 +14,175 @@
 
          i = NINT(zout/zsto)
-      CALL gr_fi_ecrit(1,klon,iim,jjmp1,pphis,zx_tmp_2d)
-      CALL histwrite(nid_ins,"phis",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1,klon,iim,jjmp1,pphis,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"phis",itau_w,pphis)
 c
          i = NINT(zout/zsto)
-      CALL gr_fi_ecrit(1,klon,iim,jjmp1,airephy,zx_tmp_2d)
-      CALL histwrite(nid_ins,"aire",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1,klon,iim,jjmp1,airephy,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"aire",itau_w,airephy)
 
       DO i = 1, klon
          zx_tmp_fi2d(i) = paprs(i,1)
       ENDDO
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_ins,"psol",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"psol",itau_w,zx_tmp_fi2d)
 c
       DO i = 1, klon
          zx_tmp_fi2d(i) = rain_fall(i) + snow_fall(i)
       ENDDO
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_ins,"precip",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"precip",itau_w,zx_tmp_fi2d)
 c
       DO i = 1, klon
          zx_tmp_fi2d(i) = rain_lsc(i) + snow_lsc(i)
       ENDDO
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_ins,"plul",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)    
+      CALL histwrite_phy(nid_ins,"plul",itau_w,zx_tmp_fi2d)
 c
       DO i = 1, klon
          zx_tmp_fi2d(i) = rain_con(i) + snow_con(i)
       ENDDO
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_ins,"pluc",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"pluc",itau_w,zx_tmp_fi2d)
 
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxtsol,zx_tmp_2d)
-      CALL histwrite(nid_ins,"tsol",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxtsol,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"tsol",itau_w,zxtsol)
 cccIM
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zt2m, zx_tmp_2d)
-      CALL histwrite(nid_ins,"t2m",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zt2m, zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"t2m",itau_w,zt2m)
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zq2m, zx_tmp_2d)
-      CALL histwrite(nid_ins,"q2m",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zq2m, zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"q2m",itau_w,zq2m)
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zu10m, zx_tmp_2d)
-      CALL histwrite(nid_ins,"u10m",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zu10m, zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"u10m",itau_w,zu10m)
 C
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zv10m, zx_tmp_2d)
-      CALL histwrite(nid_ins,"v10m",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zv10m, zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"v10m",itau_w,zv10m)
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, snow_fall,zx_tmp_2d)
-      CALL histwrite(nid_ins,"snow",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, snow_fall,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"snow",itau_w,snow_fall)
 
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cdragm,zx_tmp_2d)
-      CALL histwrite(nid_ins,"cdrm",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cdragm,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"cdrm",itau_w,cdragm)
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cdragh,zx_tmp_2d)
-      CALL histwrite(nid_ins,"cdrh",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cdragh,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"cdrh",itau_w,cdragh)
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, toplw,zx_tmp_2d)
-      CALL histwrite(nid_ins,"topl",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, toplw,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"topl",itau_w,toplw)
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, evap,zx_tmp_2d)
-      CALL histwrite(nid_ins,"evap",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, evap,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"evap",itau_w,evap)
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, solsw,zx_tmp_2d)
-      CALL histwrite(nid_ins,"sols",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, solsw,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"sols",itau_w,solsw)
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, sollw,zx_tmp_2d)
-      CALL histwrite(nid_ins,"soll",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, sollw,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"soll",itau_w,sollw)
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, sollwdown,zx_tmp_2d)
-      CALL histwrite(nid_ins,"solldown",itau_w,zx_tmp_2d,iim*jjmp1,
-     .                ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, sollwdown,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"solldown",itau_w,sollwdown)
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, bils,zx_tmp_2d)
-      CALL histwrite(nid_ins,"bils",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, bils,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"bils",itau_w,bils)
 c
       zx_tmp_fi2d(1:klon)=-1*sens(1:klon)
 c     CALL gr_fi_ecrit(1, klon,iim,jjmp1, sens,zx_tmp_2d)
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_ins,"sens",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"sens",itau_w,zx_tmp_fi2d)
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, fder,zx_tmp_2d)
-      CALL histwrite(nid_ins,"fder",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, fder,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"fder",itau_w,fder)
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, d_ts(1,is_oce),zx_tmp_2d)
-      CALL histwrite(nid_ins,"dtsvdfo",itau_w,zx_tmp_2d,iim*jjmp1,
-     .               ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, d_ts(1,is_oce),zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"dtsvdfo",itau_w,d_ts(:,is_oce))
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, d_ts(1,is_ter),zx_tmp_2d)
-      CALL histwrite(nid_ins,"dtsvdft",itau_w,zx_tmp_2d,iim*jjmp1,
-     .               ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, d_ts(1,is_ter),zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"dtsvdft",itau_w,d_ts(:,is_ter))
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, d_ts(1,is_lic),zx_tmp_2d)
-      CALL histwrite(nid_ins,"dtsvdfg",itau_w,zx_tmp_2d,iim*jjmp1,
-     .               ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, d_ts(1,is_lic),zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"dtsvdfg",itau_w, d_ts(:,is_lic))
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, d_ts(1,is_sic),zx_tmp_2d)
-      CALL histwrite(nid_ins,"dtsvdfi",itau_w,zx_tmp_2d,iim*jjmp1,
-     .               ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, d_ts(1,is_sic),zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"dtsvdfi",itau_w,d_ts(:,is_sic))
 
       DO nsrf = 1, nbsrf
 CXXX
         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),itau_w,
-     $      zx_tmp_2d,iim*jjmp1,ndex2d) 
+cym        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
+        CALL histwrite_phy(nid_ins,"pourc_"//clnsurf(nsrf),itau_w,
+     $      zx_tmp_fi2d) 
 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),itau_w,
-     $      zx_tmp_2d,iim*jjmp1,ndex2d) 
+cym        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
+        CALL histwrite_phy(nid_ins,"sens_"//clnsurf(nsrf),itau_w,
+     $      zx_tmp_fi2d) 
 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),itau_w,
-     $      zx_tmp_2d,iim*jjmp1,ndex2d) 
+cym        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
+        CALL histwrite_phy(nid_ins,"lat_"//clnsurf(nsrf),itau_w,
+     $      zx_tmp_fi2d) 
 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),itau_w,
-     $      zx_tmp_2d,iim*jjmp1,ndex2d) 
+cym        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
+        CALL histwrite_phy(nid_ins,"tsol_"//clnsurf(nsrf),itau_w,
+     $      zx_tmp_fi2d) 
 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),itau_w,
-     $      zx_tmp_2d,iim*jjmp1,ndex2d) 
+cym        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
+        CALL histwrite_phy(nid_ins,"taux_"//clnsurf(nsrf),itau_w,
+     $      zx_tmp_fi2d) 
 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),itau_w,
-     $      zx_tmp_2d,iim*jjmp1,ndex2d)
+cym        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
+        CALL histwrite_phy(nid_ins,"tauy_"//clnsurf(nsrf),itau_w,
+     $     zx_tmp_fi2d)
 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),itau_w,
-     $      zx_tmp_2d,iim*jjmp1,ndex2d) 
+cym        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
+        CALL histwrite_phy(nid_ins,"rugs_"//clnsurf(nsrf),itau_w,
+     $      zx_tmp_fi2d) 
 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),itau_w,
-     $      zx_tmp_2d,iim*jjmp1,ndex2d) 
+cym        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
+        CALL histwrite_phy(nid_ins,"albe_"//clnsurf(nsrf),itau_w,
+     $      zx_tmp_fi2d) 
 C 
       END DO  
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, albsol,zx_tmp_2d)
-      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",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, albsol,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"albs",itau_w,albsol)
+      
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, albsollw,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"albslw",itau_w,albsollw)
+
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxsnow,zx_tmp_2d)
-      CALL histwrite(nid_ins,"snow_mass",itau_w,zx_tmp_2d,iim*jjmp1,
-     .               ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxsnow,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"snow_mass",itau_w,zxsnow)
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxrugs,zx_tmp_2d)
-      CALL histwrite(nid_ins,"rugs",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zxrugs,zx_tmp_2d)
+      CALL histwrite_phy(nid_ins,"rugs",itau_w,zxrugs)
 c
 c Champs 3D:
 c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, t_seri, zx_tmp_3d)
-      CALL histwrite(nid_ins,"temp",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
+cym      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, t_seri, zx_tmp_3d)
+      CALL histwrite_phy(nid_ins,"temp",itau_w,t_seri)
 c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, u_seri, zx_tmp_3d)
-      CALL histwrite(nid_ins,"vitu",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
+cym      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, u_seri, zx_tmp_3d)
+      CALL histwrite_phy(nid_ins,"vitu",itau_w,u_seri)
 c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, v_seri, zx_tmp_3d)
-      CALL histwrite(nid_ins,"vitv",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
+cym      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, v_seri, zx_tmp_3d)
+      CALL histwrite_phy(nid_ins,"vitv",itau_w,v_seri)
 c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, zphi, zx_tmp_3d)
-      CALL histwrite(nid_ins,"geop",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
+cym      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, zphi, zx_tmp_3d)
+      CALL histwrite_phy(nid_ins,"geop",itau_w,zphi)
 c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, pplay, zx_tmp_3d)
-      CALL histwrite(nid_ins,"pres",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
+cym      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, pplay, zx_tmp_3d)
+      CALL histwrite_phy(nid_ins,"pres",itau_w,pplay)
 c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_t_vdf, zx_tmp_3d)
-      CALL histwrite(nid_ins,"dtvdf",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
+cym      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_t_vdf, zx_tmp_3d)
+      CALL histwrite_phy(nid_ins,"dtvdf",itau_w,d_t_vdf)
 c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_q_vdf, zx_tmp_3d)
-      CALL histwrite(nid_ins,"dqvdf",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
+cym      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_q_vdf, zx_tmp_3d)
+      CALL histwrite_phy(nid_ins,"dqvdf",itau_w,d_q_vdf)
 
 c
