Index: LMDZ5/trunk/libf/dyn3d_common/infotrac.F90
===================================================================
--- LMDZ5/trunk/libf/dyn3d_common/infotrac.F90	(revision 2261)
+++ LMDZ5/trunk/libf/dyn3d_common/infotrac.F90	(revision 2262)
@@ -143,16 +143,35 @@
           endif
        END IF
-       if ( planet_type=='earth') then
-         ! For Earth, water vapour & liquid tracers are not in the physics
-         nbtr=nqtrue-2
-       else
-         ! Other planets (for now); we have the same number of tracers
-         ! in the dynamics than in the physics
-         nbtr=nqtrue
-       endif
+!jyg<
+!!       if ( planet_type=='earth') then
+!!         ! For Earth, water vapour & liquid tracers are not in the physics
+!!         nbtr=nqtrue-2
+!!       else
+!!         ! Other planets (for now); we have the same number of tracers
+!!         ! in the dynamics than in the physics
+!!         nbtr=nqtrue
+!!       endif
+!>jyg
     ELSE ! type_trac=inca
+!jyg<
+       ! The traceur.def file is used to define the number "nqo" of water phases 
+       ! present in the simulation. Default : nqo = 2.
+       OPEN(90,file='traceur.def',form='formatted',status='old', iostat=ierr)
+       IF(ierr.EQ.0) THEN
+          WRITE(lunout,*) trim(modname),': Open traceur.def : ok'
+          READ(90,*) nqo
+       ELSE 
+          WRITE(lunout,*) trim(modname),': Using default value for nqo'
+          nqo=2
+       ENDIF
+       IF (nqo /= 2 .OR. nqo /= 3 ) THEN
+          WRITE(lunout,*) trim(modname),': nqo=',nqo, ' is not allowded. Only 2 or 3 water phases allowed'
+          CALL abort_gcm('infotrac_init','Bad number of water phases',1)
+       END IF
        ! nbtr has been read from INCA by init_const_lmdz() in gcm.F 
-       nqtrue=nbtr+2
-    END IF
+       nqtrue=nbtr+nqo
+!!       nqtrue=nbtr+2
+    END IF   ! type_trac
+!>jyg
 
     IF ((planet_type=="earth").and.(nqtrue < 2)) THEN
@@ -161,18 +180,23 @@
     END IF
     
+!jyg<
 ! Transfert number of tracers to Reprobus
-    IF (type_trac == 'repr') THEN
-#ifdef REPROBUS
-       CALL Init_chem_rep_trac(nbtr)
-#endif
-    END IF
+!!    IF (type_trac == 'repr') THEN
+!!#ifdef REPROBUS
+!!       CALL Init_chem_rep_trac(nbtr)
+!!#endif
+!!    END IF
+!>jyg
        
 !
-! Allocate variables depending on nqtrue and nbtr
+! Allocate variables depending on nqtrue
 !
     ALLOCATE(tnom_0(nqtrue), hadv(nqtrue), vadv(nqtrue))
-    ALLOCATE(conv_flg(nbtr), pbl_flg(nbtr), solsym(nbtr))
-    conv_flg(:) = 1 ! convection activated for all tracers
-    pbl_flg(:)  = 1 ! boundary layer activated for all tracers
+!
+!jyg<
+!!    ALLOCATE(conv_flg(nbtr), pbl_flg(nbtr), solsym(nbtr))
+!!    conv_flg(:) = 1 ! convection activated for all tracers
+!!    pbl_flg(:)  = 1 ! boundary layer activated for all tracers
+!>jyg
 
 !-----------------------------------------------------------------------
@@ -230,11 +254,4 @@
          endif ! of if (planet_type=="earth")
        END IF
-
-!CR: nombre de traceurs de l eau
-       if (tnom_0(3) == 'H2Oi') then
-          nqo=3
-       else
-          nqo=2
-       endif
        
        WRITE(lunout,*) trim(modname),': Valeur de traceur.def :'
@@ -244,5 +261,39 @@
        END DO
 
-    ELSE  ! type_trac=inca : config_inca='aero' ou 'chem'
+       if ( planet_type=='earth') then
+         !CR: nombre de traceurs de l eau
+         if (tnom_0(3) == 'H2Oi') then
+            nqo=3
+         else
+            nqo=2
+         endif
+         ! For Earth, water vapour & liquid tracers are not in the physics
+         nbtr=nqtrue-nqo
+       else
+         ! Other planets (for now); we have the same number of tracers
+         ! in the dynamics than in the physics
+         nbtr=nqtrue
+       endif
+
+    ENDIF  ! (type_trac == 'lmdz' .OR. type_trac == 'repr')
+!jyg<
+!
+! Transfert number of tracers to Reprobus
+    IF (type_trac == 'repr') THEN
+#ifdef REPROBUS
+       CALL Init_chem_rep_trac(nbtr)
+#endif
+    END IF
+!
+! Allocate variables depending on nbtr
+!
+    ALLOCATE(conv_flg(nbtr), pbl_flg(nbtr), solsym(nbtr))
+    conv_flg(:) = 1 ! convection activated for all tracers
+    pbl_flg(:)  = 1 ! boundary layer activated for all tracers
+!
+!!    ELSE  ! type_trac=inca : config_inca='aero' ou 'chem'
+!
+    IF (type_trac == 'inca') THEN   ! config_inca='aero' ou 'chem'
+!>jyg
 ! le module de chimie fournit les noms des traceurs
 ! et les schemas d'advection associes.
@@ -258,11 +309,17 @@
        tnom_0(1)='H2Ov'
        tnom_0(2)='H2Ol'
-
-       DO iq =3,nqtrue
-          tnom_0(iq)=solsym(iq-2)
+       IF (nqo == 3) tnom_0(3)='H2Oi'     !! jyg
+
+!jyg<
+       DO iq = nqo+1, nqtrue
+          tnom_0(iq)=solsym(iq-nqo)
        END DO
-       nqo = 2
-
-    END IF ! type_trac
+!!       DO iq =3,nqtrue
+!!          tnom_0(iq)=solsym(iq-2)
+!!       END DO
+!!       nqo = 2
+!>jyg
+
+    END IF ! (type_trac == 'inca')
 
 !-----------------------------------------------------------------------
Index: LMDZ5/trunk/libf/phylmd/physiq.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/physiq.F90	(revision 2261)
+++ LMDZ5/trunk/libf/phylmd/physiq.F90	(revision 2262)
@@ -1557,12 +1557,16 @@
      ENDDO
 !!! RomP >>>   td dyn traceur
-     IF (nqtot.GE.3) THEN
-        DO iq = 3, nqtot
+!!     IF (nqtot.GE.3) THEN       ! jyg
+!!        DO iq = 3, nqtot        ! jyg
+     IF (nqtot.GE.nqo+1) THEN     ! jyg
+        DO iq = nqo+1, nqtot      ! jyg
            DO k = 1, klev
               DO i = 1, klon
-                 d_tr_dyn(i,k,iq-2)= &
-                      (tr_seri(i,k,iq-2)-tr_ancien(i,k,iq-2))/dtime
+!!                 d_tr_dyn(i,k,iq-2)= &                                 ! jyg
+!!                      (tr_seri(i,k,iq-2)-tr_ancien(i,k,iq-2))/dtime    ! jyg
+                 d_tr_dyn(i,k,iq-nqo)= &                                 ! jyg
+                      (tr_seri(i,k,iq-nqo)-tr_ancien(i,k,iq-nqo))/dtime  ! jyg
                  !         iiq=niadv(iq)
-                 !         print*,i,k," d_tr_dyn",d_tr_dyn(i,k,iq-2),"tra:",iq,tname(iiq)
+                 !         print*,i,k," d_tr_dyn",d_tr_dyn(i,k,iq-nqo),"tra:",iq,tname(iiq)
               ENDDO
            ENDDO
@@ -1580,9 +1584,12 @@
      ENDDO
 !!! RomP >>>   td dyn traceur
-     IF (nqtot.GE.3) THEN
-        DO iq = 3, nqtot
+!!     IF (nqtot.GE.3) THEN                                            ! jyg
+!!        DO iq = 3, nqtot                                             ! jyg
+     IF (nqtot.GE.nqo+1) THEN                                          ! jyg
+        DO iq = nqo+1, nqtot                                           ! jyg
            DO k = 1, klev
               DO i = 1, klon
-                 d_tr_dyn(i,k,iq-2)= 0.0
+!!                 d_tr_dyn(i,k,iq-2)= 0.0                             ! jyg
+                 d_tr_dyn(i,k,iq-nqo)= 0.0                             ! jyg
               ENDDO
            ENDDO
