Index: LMDZ4/branches/LMDZ4_V3_patches/libf/dyn3d/create_etat0_limit.F
===================================================================
--- LMDZ4/branches/LMDZ4_V3_patches/libf/dyn3d/create_etat0_limit.F	(revision 844)
+++ LMDZ4/branches/LMDZ4_V3_patches/libf/dyn3d/create_etat0_limit.F	(revision 845)
@@ -28,7 +28,23 @@
 #include "paramet.h"
 #include "indicesol.h"
+#include "advtrac.h"
 cym#include "dimphy.h" 
       REAL :: masque(iip1,jjp1)
       REAL :: pctsrf(iim*(jjm-1)+2, nbsrf)
+
+c initialisation traceurs
+      hadv_flg(:) = 0.
+      vadv_flg(:) = 0.
+      conv_flg(:) = 0.
+      pbl_flg(:)  = 0. 
+      tracnam(:)  = '        ' 
+      nprath = 1
+      nbtrac = 0
+      mmt_adj(:,:,:,:) = 1
+
+#ifdef INCA
+      call init_const_lmdz(nbtrac,anneeref,dayref,iphysiq,day_step,nday)
+      print *, 'nbtrac =' , nbtrac 
+#endif
 
       CALL Init_Phys_lmdz(iim,jjp1,llm,nqmx-2,1,(jjm-1)*iim+2)
Index: LMDZ4/branches/LMDZ4_V3_patches/libf/dyn3d/dynredem.F
===================================================================
--- LMDZ4/branches/LMDZ4_V3_patches/libf/dyn3d/dynredem.F	(revision 844)
+++ LMDZ4/branches/LMDZ4_V3_patches/libf/dyn3d/dynredem.F	(revision 845)
@@ -530,6 +530,7 @@
      
       REAL time
-      INTEGER nid, nvarid
-      INTEGER ierr
+      INTEGER nid, nvarid, nid_trac, nvarid_trac
+      REAL trac_tmp(ip1jmp1,llm)      
+      INTEGER ierr, ierr_file 
       INTEGER iq
       INTEGER length
@@ -622,6 +623,73 @@
 #endif
 
+#ifdef INCA
+! Ajout Anne pour lecture valeurs traceurs dans un fichier start_trac.nc
+      ierr_file = NF_OPEN ("start_trac.nc", NF_NOWRITE,nid_trac)
+      IF (ierr_file .NE.NF_NOERR) THEN
+        write(6,*)' Pb d''ouverture du fichier start_trac.nc'
+        write(6,*)' ierr = ', ierr_file 
+      ENDIF
+#endif
+
       IF(nq.GE.1) THEN
-       do iq=1,nq   
+       do iq=1,nq 
+#ifdef INCA
+! lecture de la valeur du traceur dans start_trac.nc
+         if (ierr_file .ne. 2) then 
+            ierr = NF_INQ_VARID (nid_trac, tname(iq), nvarid_trac)
+            IF (ierr .NE. NF_NOERR) THEN
+               PRINT*, tname(iq),"est absent de start_trac.nc"
+               ierr = NF_INQ_VARID(nid, tname(iq), nvarid)
+               IF (ierr .NE. NF_NOERR) THEN
+                  PRINT*, "Variable ", tname(iq)," n est pas definie"
+                  CALL abort
+               ENDIF
+#ifdef NC_DOUBLE
+               ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq))
+#else
+               ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq))
+#endif
+
+            ELSE
+               PRINT*, tname(iq), "est present dans start_trac.nc"
+#ifdef NC_DOUBLE
+               ierr = NF_GET_VAR_DOUBLE(nid_trac, nvarid_trac, trac_tmp)
+#else
+               ierr = NF_GET_VAR_REAL(nid_trac, nvarid_trac, trac_tmp)
+#endif
+               IF (ierr .NE. NF_NOERR) THEN
+                  PRINT*, "Lecture echouee pour", tname(iq)
+                  CALL abort
+               ENDIF
+               ierr = NF_INQ_VARID(nid, tname(iq), nvarid)
+               IF (ierr .NE. NF_NOERR) THEN
+                  PRINT*, "Variable ", tname(iq)," n est pas definie"
+                  CALL abort
+               ENDIF
+#ifdef NC_DOUBLE
+               ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,trac_tmp)
+#else
+               ierr = NF_PUT_VAR_REAL (nid,nvarid,trac_tmp)
+#endif
+
+          ENDIF
+! fin lecture du traceur
+          ELSE  ! si il n'y a pas de fichier start_trac.nc
+!             print *, 'il n y a pas de fichier start_trac'
+             ierr = NF_INQ_VARID(nid, tname(iq), nvarid)
+             IF (ierr .NE. NF_NOERR) THEN
+                PRINT*, "Variable  tname(iq) n est pas definie"
+                CALL abort
+             ENDIF
+#ifdef NC_DOUBLE
+             ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq))
+#else
+             ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq))
+#endif
+          ENDIF
+! endif ifdef INCA
+#endif
+          
+#ifndef INCA
         ierr = NF_INQ_VARID(nid, tname(iq), nvarid)
         IF (ierr .NE. NF_NOERR) THEN
@@ -634,4 +702,6 @@
           ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq))
 #endif
+! endif ifndef INCA
+#endif
       ENDDO
       ENDIF
Index: LMDZ4/branches/LMDZ4_V3_patches/libf/dyn3d/leapfrog.F
===================================================================
--- LMDZ4/branches/LMDZ4_V3_patches/libf/dyn3d/leapfrog.F	(revision 844)
+++ LMDZ4/branches/LMDZ4_V3_patches/libf/dyn3d/leapfrog.F	(revision 845)
@@ -185,4 +185,7 @@
       PARAMETER (testita = 9)
 
+      integer itau_w   ! pas de temps ecriture = itap + itau_phy
+
+
       itaufin   = nday*day_step
       itaufinp1 = itaufin +1
Index: LMDZ4/branches/LMDZ4_V3_patches/libf/dyn3d/write_paramLMDZ_dyn.h
===================================================================
--- LMDZ4/branches/LMDZ4_V3_patches/libf/dyn3d/write_paramLMDZ_dyn.h	(revision 844)
+++ LMDZ4/branches/LMDZ4_V3_patches/libf/dyn3d/write_paramLMDZ_dyn.h	(revision 845)
@@ -1,52 +1,52 @@
 c
       ndex2d = 0
-      itau_dyn=itau_dyn+itau
+      itau_w=itau_dyn+itau
 c
       zx_tmp_2d(1:iip1,1:jjp1)=FLOAT(prt_level) 
-      CALL histwrite(nid_ctesGCM, "prt_level", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "prt_level", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=FLOAT(dayref)
-      CALL histwrite(nid_ctesGCM, "dayref", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "dayref", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=FLOAT(anneeref)
-      CALL histwrite(nid_ctesGCM, "anneeref", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "anneeref", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=FLOAT(raz_date)
-      CALL histwrite(nid_ctesGCM, "raz_date", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "raz_date", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=FLOAT(nday)
-      CALL histwrite(nid_ctesGCM, "nday", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "nday", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=FLOAT(day_step)
-      CALL histwrite(nid_ctesGCM, "day_step", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "day_step", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=FLOAT(iperiod)
-      CALL histwrite(nid_ctesGCM, "iperiod", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "iperiod", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=FLOAT(iapp_tracvl)
-      CALL histwrite(nid_ctesGCM, "iapp_tracvl", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "iapp_tracvl", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=FLOAT(iconser)
-      CALL histwrite(nid_ctesGCM, "iconser", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "iconser", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=FLOAT(iecri)
-      CALL histwrite(nid_ctesGCM, "iecri", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "iecri", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=periodav
-      CALL histwrite(nid_ctesGCM, "periodav", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "periodav", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=FLOAT(idissip)
-      CALL histwrite(nid_ctesGCM, "idissip", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "idissip", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
@@ -56,33 +56,33 @@
        zx_tmp_2d(1:iip1,1:jjp1)=0.
       ENDIF
-      CALL histwrite(nid_ctesGCM, "lstardis", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "lstardis", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=FLOAT(nitergdiv)
-      CALL histwrite(nid_ctesGCM, "nitergdiv", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "nitergdiv", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=FLOAT(nitergrot)
-      CALL histwrite(nid_ctesGCM, "nitergrot", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "nitergrot", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=FLOAT(niterh) 
-      CALL histwrite(nid_ctesGCM, "niterh", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "niterh", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=tetagdiv
-      CALL histwrite(nid_ctesGCM, "tetagdiv", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "tetagdiv", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=tetagrot
-      CALL histwrite(nid_ctesGCM, "tetagrot", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "tetagrot", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=tetatemp
-      CALL histwrite(nid_ctesGCM, "tetatemp", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "tetatemp", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=coefdis
-      CALL histwrite(nid_ctesGCM, "coefdis", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "coefdis", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
@@ -92,5 +92,5 @@
        zx_tmp_2d(1:iip1,1:jjp1)=0.
       ENDIF
-      CALL histwrite(nid_ctesGCM, "purmats", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "purmats", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
@@ -100,5 +100,5 @@
        zx_tmp_2d(1:iip1,1:jjp1)=0.
       ENDIF
-      CALL histwrite(nid_ctesGCM, "ok_guide", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "ok_guide", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
@@ -108,17 +108,17 @@
        zx_tmp_2d(1:iip1,1:jjp1)=0.
       ENDIF
-      CALL histwrite(nid_ctesGCM, "true_calendar", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "true_calendar", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=FLOAT(iflag_phys)
-      CALL histwrite(nid_ctesGCM, "iflag_phys", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "iflag_phys", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=FLOAT(iphysiq)
-      CALL histwrite(nid_ctesGCM, "iphysiq", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "iphysiq", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=ecritphy
-      CALL histwrite(nid_ctesGCM, "ecritphy", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "ecritphy", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
@@ -128,5 +128,5 @@
        zx_tmp_2d(1:iip1,1:jjp1)=0.
       ENDIF
-      CALL histwrite(nid_ctesGCM, "cycle_diurne", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "cycle_diurne", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
@@ -136,5 +136,5 @@
        zx_tmp_2d(1:iip1,1:jjp1)=0.
       ENDIF
-      CALL histwrite(nid_ctesGCM, "soil_model", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "soil_model", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
@@ -144,5 +144,5 @@
        zx_tmp_2d(1:iip1,1:jjp1)=0.
       ENDIF
-      CALL histwrite(nid_ctesGCM, "new_oliq", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "new_oliq", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
@@ -152,5 +152,5 @@
        zx_tmp_2d(1:iip1,1:jjp1)=0.
       ENDIF
-      CALL histwrite(nid_ctesGCM, "ok_orodr", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "ok_orodr", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
@@ -160,5 +160,5 @@
        zx_tmp_2d(1:iip1,1:jjp1)=0.
       ENDIF
-      CALL histwrite(nid_ctesGCM, "ok_orolf", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "ok_orolf", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
@@ -168,29 +168,29 @@
        zx_tmp_2d(1:iip1,1:jjp1)=0.
       ENDIF
-      CALL histwrite(nid_ctesGCM, "ok_limitvrai", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "ok_limitvrai", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=nbapp_rad
-      CALL histwrite(nid_ctesGCM, "nbapp_rad", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "nbapp_rad", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=iflag_con
-      CALL histwrite(nid_ctesGCM, "iflag_con", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "iflag_con", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=clon
-      CALL histwrite(nid_ctesGCM, "clon", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "clon", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=clat
-      CALL histwrite(nid_ctesGCM, "clat", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "clat", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=grossismx
-      CALL histwrite(nid_ctesGCM, "grossismx", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "grossismx", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=grossismy
-      CALL histwrite(nid_ctesGCM, "grossismy", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "grossismy", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
@@ -200,21 +200,21 @@
        zx_tmp_2d(1:iip1,1:jjp1)=0.
       ENDIF
-      CALL histwrite(nid_ctesGCM, "fxyhypb", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "fxyhypb", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=dzoomx
-      CALL histwrite(nid_ctesGCM, "dzoomx", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "dzoomx", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=dzoomy
-      CALL histwrite(nid_ctesGCM, "dzoomy", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "dzoomy", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=taux
-      CALL histwrite(nid_ctesGCM, "taux", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "taux", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=tauy
-      CALL histwrite(nid_ctesGCM, "tauy", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "tauy", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
@@ -224,9 +224,9 @@
        zx_tmp_2d(1:iip1,1:jjp1)=0.
       ENDIF
-      CALL histwrite(nid_ctesGCM, "ysinus", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "ysinus", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
       zx_tmp_2d(1:iip1,1:jjp1)=ip_ebil_dyn
-      CALL histwrite(nid_ctesGCM, "ip_ebil_dyn", itau_dyn,
+      CALL histwrite(nid_ctesGCM, "ip_ebil_dyn", itau_w,
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
