Index: /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/clesphys.h
===================================================================
--- /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/clesphys.h	(revision 1375)
+++ /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/clesphys.h	(revision 1376)
@@ -1,2 +1,3 @@
+
 !
 ! $Id$
@@ -67,4 +68,5 @@
        LOGICAL :: ok_strato
        LOGICAL :: ok_hines
+       INTEGER :: nseuil
 
        COMMON/clesphys/cycle_diurne, soil_model, new_oliq,              &
@@ -85,5 +87,5 @@
      &     , ok_lic_melt, cvl_corr, aer_type                            &
      &     , qsol0, iflag_rrtm, ok_strato,ok_hines,ecrit_LES            &
-     &     , co2_ppm0
+     &     , co2_ppm0, nseuil
      
 !$OMP THREADPRIVATE(/clesphys/)
Index: /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/conf_phys.F90
===================================================================
--- /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/conf_phys.F90	(revision 1375)
+++ /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/conf_phys.F90	(revision 1376)
@@ -151,4 +151,5 @@
   REAL,SAVE :: ecrit_LES_omp
   REAL,SAVE :: ecrit_tra_omp
+  INTEGER, SAVE :: nseuil_omp   
   REAL,SAVE :: cvl_corr_omp
   LOGICAL,SAVE :: ok_lic_melt_omp
@@ -1226,4 +1227,14 @@
   ecrit_tra_omp = 30.
   call getin('ecrit_tra',ecrit_tra_omp)
+!
+!Config Key  = nseuil
+!Config Desc = Numero du traceur a partir duquel on ne transporte 
+!              pas par convection
+!Config Def  = 7 !a partir du numero 7 pour les pseudo-traceurs de Remy
+!Config Help =
+!
+  nseuil_omp = 7
+  call getin('nseuil',nseuil_omp)
+!
 !
 !Config Key  = ecrit_reg
@@ -1515,4 +1526,5 @@
     ecrit_mth = ecrit_mth_omp
     ecrit_tra = ecrit_tra_omp
+    nseuil = nseuil_omp
     ecrit_reg = ecrit_reg_omp
     cvl_corr = cvl_corr_omp
@@ -1678,4 +1690,5 @@
   write(numout,*)' ecrit_ hf, ins, day, mth, reg, tra, ISCCP, LES',&
    ecrit_hf, ecrit_ins, ecrit_day, ecrit_mth, ecrit_reg, ecrit_tra, ecrit_ISCCP, ecrit_LES
+  write(numout,*)' nseuil ',nseuil
 
   write(numout,*) 'ok_strato = ', ok_strato
Index: /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/phys_output_mod.F90
===================================================================
--- /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/phys_output_mod.F90	(revision 1375)
+++ /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/phys_output_mod.F90	(revision 1376)
@@ -11,5 +11,5 @@
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-MODULE phys_output_mod
+MODULE phys_output_mod 
 
   IMPLICIT NONE
@@ -525,7 +525,4 @@
   type(ctrl_out),save :: o_dvlif        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dvlif')
 
-! Attention a refaire correctement
-  type(ctrl_out),save,dimension(2) :: o_trac         = (/ ctrl_out((/ 4, 10, 10, 10, 10 /),'trac01'), &
-                                                     ctrl_out((/ 4, 10, 10, 10, 10 /),'trac02') /)
     CONTAINS
 
@@ -539,5 +536,5 @@
        type_ocean, iflag_pbl,ok_mensuel,ok_journe, &
        ok_hf,ok_instan,ok_LES,ok_ade,ok_aie, read_climoz, &
-       new_aod, aerosol_couple)   
+       new_aod, aerosol_couple, o_trac)   
 
 
@@ -602,8 +599,10 @@
   real, dimension(nfiles), save     :: phys_out_latmin        = (/ -90., -90., -90., -90., -90. /)
   real, dimension(nfiles), save     :: phys_out_latmax        = (/ 90., 90., 90., 90., 90. /)
-  
-  
-
-! 
+
+!IM definition dynamique flag o_trac pour sortie traceurs
+  INTEGER :: nq
+  type(ctrl_out) :: o_trac(nqtot)
+  CHARACTER(len=8) :: solsym(nqtot)
+
    print*,'Debut phys_output_mod.F90'
 ! Initialisations (Valeurs par defaut
@@ -1220,12 +1219,22 @@
      ENDIF
 
-      if (nqtot>=3) THEN
-!Attention    DO iq=3,nqtot
-    DO iq=3,4  
+!IM traceurs dynamiques
+    DO nq=1,nqtot
+      IF(nq.LT.10) THEN
+       WRITE(solsym(nq),'(i1)') nq
+       o_trac(nq)    =  ctrl_out((/ 4, 5, 1, 1, 1 /),'trac0'//TRIM(solsym(nq)))
+      ELSE
+       WRITE(solsym(nq),'(i2)') nq
+       o_trac(nq)    =  ctrl_out((/ 4, 5, 1, 1, 1 /),'trac'//TRIM(solsym(nq)))
+      ENDIF
+     WRITE(*,*) 'nq, o_trac(nq)=',nq, o_trac(nq)
+    ENDDO
+!
+    if (nqtot>=3) THEN
+     DO iq=3,nqtot  
        iiq=niadv(iq)
-! CALL histdef3d (iff, o_trac%flag,'o_'//tnom(iq)%name,ttext(iiq), "-" )
   CALL histdef3d (iff, o_trac(iq-2)%flag,o_trac(iq-2)%name,ttext(iiq), "-" )
-    ENDDO
-      endif
+     ENDDO
+    endif
 
         CALL histend(nid_files(iff))
Index: /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/phys_output_write.h
===================================================================
--- /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/phys_output_write.h	(revision 1375)
+++ /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/phys_output_write.h	(revision 1376)
@@ -1505,14 +1505,12 @@
         ENDIF
 
-!       IF (o_trac%flag(iff)<=lev_files(iff)) THEN
-         if (nqtot.GE.3) THEN
-!           DO iq=3,nqtot
-           DO iq=3,4
+        if (nqtot.GE.3) THEN
+         DO iq=3,nqtot
        IF (o_trac(iq-2)%flag(iff)<=lev_files(iff)) THEN
          CALL histwrite_phy(nid_files(iff),
      s                  o_trac(iq-2)%name,itau_w,qx(:,:,iq))
        ENDIF
-           ENDDO
-         endif
+         ENDDO
+        endif
 
       if (ok_sync) then
Index: /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/phytrac.F90
===================================================================
--- /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/phytrac.F90	(revision 1375)
+++ /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/phytrac.F90	(revision 1376)
@@ -1,2 +1,3 @@
+
 !$Id $
 
@@ -213,5 +214,6 @@
      SELECT CASE(type_trac)
      CASE('lmdz')
-        CALL traclmdz_init(pctsrf, ftsol, tr_seri, aerosol, lessivage)
+!IM ajout t_seri, pplay, sh    CALL traclmdz_init(pctsrf, ftsol, tr_seri, aerosol, lessivage)
+        CALL traclmdz_init(pctsrf, ftsol, tr_seri, t_seri, pplay, sh, aerosol, lessivage)
      CASE('inca')
         source(:,:)=0.
@@ -239,5 +241,5 @@
           paprs,    pplay,        cdragh,  coefh,   &
           yu1,      yv1,          ftsol,   pctsrf,  &
-          xlat,     couchelimite,                   &
+          xlat,     couchelimite, sh,               &
           tr_seri,  source,       solsym,  d_tr_cl)
      
@@ -277,4 +279,7 @@
         END IF
 
+!IM ajout traceurs RR 
+!      print*,'phytrac it,nseuil=',it,nseuil
+       IF (it.lt.nseuil) THEN
         DO k = 1, klev
            DO i = 1, klon        
@@ -282,4 +287,5 @@
            END DO
         END DO
+       END IF !(it.lt.nseuil) then
 
         CALL minmaxqfi(tr_seri(:,:,it),0.,1.e33,'convection it = '//solsym(it))
Index: /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/traclmdz_mod.F90
===================================================================
--- /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/traclmdz_mod.F90	(revision 1375)
+++ /LMDZ4/branches/LMDZ4V5.0-dev/libf/phylmd/traclmdz_mod.F90	(revision 1376)
@@ -35,4 +35,13 @@
 !$OMP THREADPRIVATE(id_be)
 
+!IM ajout traceurs RR 
+  INTEGER,SAVE :: id_dry !traceur dry intrusions
+!$OMP THREADPRIVATE(id_dry)
+  INTEGER,SAVE :: id_pcsat, id_pcocsat, id_pcq ! traceurs pseudo-vapeur CL qsat, qsat_oc, q
+!$OMP THREADPRIVATE(id_pcsat, id_pcocsat, id_pcq)
+  INTEGER,SAVE :: id_pcs0, id_pcos0, id_pcq0 ! traceurs pseudo-vapeur CL qsat, qsat_oc, q
+!                                            ! qui ne sont pas transportes par la convection
+!$OMP THREADPRIVATE(id_pcs0, id_pcos0, id_pcq0)
+
   LOGICAL,SAVE :: rnpb=.TRUE. ! Presence du couple Rn222, Pb210
 !$OMP THREADPRIVATE(rnpb)
@@ -65,5 +74,5 @@
 
 
-  SUBROUTINE traclmdz_init(pctsrf, ftsol, tr_seri, aerosol, lessivage)
+  SUBROUTINE traclmdz_init(pctsrf, ftsol, tr_seri, t_seri, pplay, sh, aerosol, lessivage)
     ! This subroutine allocates and initialize module variables and control variables.
     USE dimphy
@@ -78,5 +87,9 @@
     REAL,DIMENSION(klon,nbsrf),INTENT(IN)     :: pctsrf ! Pourcentage de sol f(nature du sol)
     REAL,DIMENSION(klon,nbsrf),INTENT(IN)     :: ftsol  ! Temperature du sol (surf)(Kelvin)
-    REAL,DIMENSION(klon,klev,nbtr),INTENT(IN) :: tr_seri! Concentration Traceur [U/KgA]  
+!IM traceurs RR   REAL,DIMENSION(klon,klev,nbtr),INTENT(IN) :: tr_seri! Concentration Traceur [U/KgA]  
+    REAL,DIMENSION(klon,klev,nbtr),INTENT(INOUT) :: tr_seri! Concentration Traceur [U/KgA]  
+    REAL,DIMENSION(klon,klev),INTENT(IN)   :: t_seri  ! Temperature
+    REAL,DIMENSION(klon,klev),INTENT(IN)   :: pplay   ! pression pour le mileu de chaque couche (en Pa)
+    REAL,DIMENSION(klon,klev),INTENT(IN)   :: sh      ! humidite specifique
 
 ! Output variables
@@ -85,5 +98,6 @@
         
 ! Local variables    
-    INTEGER :: ierr, it, iiq
+    INTEGER :: ierr, it, iiq, i, k
+    REAL,DIMENSION(klon,klev)      :: qsat   ! pression de la vapeur a saturation
     
 ! --------------------------------------------
@@ -137,4 +151,62 @@
        END IF    
     END DO
+
+    id_dry=0
+
+    DO it=1,nbtr
+       iiq=niadv(it+2)
+       IF ( tname(iiq) == "dry" .OR. tname(iiq) == "Dry" ) THEN
+        id_dry=it
+       END IF    
+    END DO  
+
+    id_pcsat=0
+    DO it=1,nbtr
+       iiq=niadv(it+2)
+       IF ( tname(iiq) == "pcsat" .OR. tname(iiq) == "Pcsat" ) THEN
+        id_pcsat=it
+      END IF
+    END DO
+
+    id_pcocsat=0
+    DO it=1,nbtr
+       iiq=niadv(it+2)
+       IF ( tname(iiq) == "pcocsat" .OR. tname(iiq) == "Pcocsat" ) THEN
+        id_pcocsat=it
+       END IF
+    END DO
+
+    id_pcq=0
+    DO it=1,nbtr
+       iiq=niadv(it+2)
+       IF ( tname(iiq) == "pcq" .OR. tname(iiq) == "Pcq" ) THEN
+        id_pcq=it
+       END IF
+    END DO
+
+    id_pcs0=0
+    DO it=1,nbtr
+       iiq=niadv(it+2)
+       IF ( tname(iiq) == "pcs0" .OR. tname(iiq) == "Pcs0" ) THEN
+        id_pcs0=it
+      END IF
+    END DO
+
+    id_pcos0=0
+    DO it=1,nbtr
+       iiq=niadv(it+2)
+       IF ( tname(iiq) == "pcos0" .OR. tname(iiq) == "Pcos0" ) THEN
+        id_pcos0=it
+       END IF
+    END DO
+
+    id_pcq0=0
+    DO it=1,nbtr
+       iiq=niadv(it+2)
+       IF ( tname(iiq) == "pcq0" .OR. tname(iiq) == "Pcq0" ) THEN
+        id_pcq0=it
+       END IF
+    END DO
+
 !
 ! Valeurs specifiques pour les traceurs Rn222 et Pb210
@@ -159,4 +231,82 @@
     END IF
 
+!IM initialisation traceurs pseudo-vapeurs
+    call q_sat(klon*klev,t_seri,pplay,qsat)
+    IF ( id_pcsat /= 0 ) THEN
+     DO k = 1, klev
+      DO i = 1, klon
+       IF ( pplay(i,k).GE.85000.) THEN
+        tr_seri(i,k,id_pcsat) = qsat(i,k)
+       ELSE
+        tr_seri(i,k,id_pcsat) = 100.
+       END IF
+      END DO
+     END DO
+    END IF
+
+    IF ( id_pcocsat /= 0 ) THEN
+     DO k = 1, klev
+      DO i = 1, klon
+       IF ( pplay(i,k).GE.85000.) THEN
+        IF ( pctsrf (i, is_oce) > 0. ) THEN
+         tr_seri(i,k,id_pcocsat) = qsat(i,k)
+        ELSE
+         tr_seri(i,k,id_pcocsat) = 100.
+        END IF
+       END IF
+      END DO
+     END DO
+    END IF
+
+    IF ( id_pcq /= 0 ) THEN
+     DO k = 1, klev
+      DO i = 1, klon
+       IF ( pplay(i,k).GE.85000.) THEN
+        tr_seri(i,k,id_pcq) = sh(i,k)
+       ELSE
+        tr_seri(i,k,id_pcq) = 100.
+       END IF
+      END DO
+     END DO
+    END IF
+
+    IF ( id_pcs0 /= 0 ) THEN
+     DO k = 1, klev
+      DO i = 1, klon
+       IF ( pplay(i,k).GE.85000.) THEN
+        tr_seri(i,k,id_pcs0) = qsat(i,k)
+       ELSE
+        tr_seri(i,k,id_pcs0) = 100.
+       END IF
+      END DO
+     END DO
+    END IF
+
+    IF ( id_pcos0 /= 0 ) THEN
+     DO k = 1, klev
+      DO i = 1, klon
+       IF ( pplay(i,k).GE.85000.) THEN
+        IF ( pctsrf (i, is_oce) > 0. ) THEN
+         tr_seri(i,k,id_pcos0) = qsat(i,k)
+        ELSE
+         tr_seri(i,k,id_pcos0) = 100.
+        END IF
+       END IF
+      END DO
+     END DO
+    END IF
+
+    IF ( id_pcq0 /= 0 ) THEN
+     DO k = 1, klev
+      DO i = 1, klon
+       IF ( pplay(i,k).GE.85000.) THEN
+        tr_seri(i,k,id_pcq0) = sh(i,k)
+       ELSE
+        tr_seri(i,k,id_pcq0) = 100.
+       END IF
+      END DO
+     END DO
+    END IF
+ 
   END SUBROUTINE traclmdz_init
 
@@ -165,5 +315,5 @@
        paprs,    pplay,        cdragh,  coefh,   &
        yu1,      yv1,          ftsol,   pctsrf,  &
-       xlat,     couchelimite,                   &
+       xlat,     couchelimite, sh,               &
        tr_seri,  source,       solsym,  d_tr_cl)
     
@@ -204,4 +354,6 @@
     REAL,DIMENSION(klon),INTENT(IN)      :: yv1        ! vents au premier niveau
     LOGICAL,INTENT(IN)                   :: couchelimite
+!IM traceurs RR
+    REAL,DIMENSION(klon,klev),INTENT(IN)   :: sh      ! humidite specifique
 
 ! Arguments necessaires pour les sources et puits de traceur:
@@ -230,5 +382,7 @@
     REAL                           :: zrho      ! Masse Volumique de l'air KgA/m3
 
-!
+!IM traceurs RR
+    REAL,DIMENSION(klon,klev)      :: qsat   ! pression de la vapeur a saturation
+    REAL :: amn, amx
 !
 !=================================================================
@@ -245,4 +399,70 @@
     END IF
   
+!IM ajout traceurs RR
+    call q_sat(klon*klev,t_seri,pplay,qsat)
+    
+    IF ( id_pcsat /= 0 ) THEN
+     DO k = 1, klev
+      DO i = 1, klon
+       IF ( pplay(i,k).GE.85000.) THEN
+        tr_seri(i,k,id_pcsat) = qsat(i,k)
+       END IF
+      END DO 
+     END DO
+    END IF
+
+    IF ( id_pcocsat /= 0 ) THEN
+     DO k = 1, klev
+      DO i = 1, klon
+       IF ( pplay(i,k).GE.85000.) THEN
+        IF ( pctsrf (i, is_oce) > 0. ) THEN
+         tr_seri(i,k,id_pcocsat) = qsat(i,k)
+        END IF
+       END IF
+      END DO
+     END DO
+    END IF
+
+    IF ( id_pcq /= 0 ) THEN
+     DO k = 1, klev
+      DO i = 1, klon
+       IF ( pplay(i,k).GE.85000.) THEN
+        tr_seri(i,k,id_pcq) = sh(i,k)
+       END IF
+      END DO
+     END DO
+    END IF
+
+    IF ( id_pcs0 /= 0 ) THEN
+     DO k = 1, klev
+      DO i = 1, klon
+       IF ( pplay(i,k).GE.85000.) THEN
+        tr_seri(i,k,id_pcs0) = qsat(i,k)
+       END IF
+      END DO
+     END DO
+    END IF
+
+    IF ( id_pcos0 /= 0 ) THEN
+     DO k = 1, klev
+      DO i = 1, klon
+       IF ( pplay(i,k).GE.85000.) THEN
+        IF ( pctsrf (i, is_oce) > 0. ) THEN
+         tr_seri(i,k,id_pcos0) = qsat(i,k)
+        END IF
+       END IF
+      END DO
+     END DO
+    END IF
+
+    IF ( id_pcq0 /= 0 ) THEN
+     DO k = 1, klev
+      DO i = 1, klon
+       IF ( pplay(i,k).GE.85000.) THEN
+        tr_seri(i,k,id_pcq0) = sh(i,k)
+       END IF
+      END DO
+     END DO
+    END IF
 
     DO it=1,nbtr
@@ -294,5 +514,65 @@
        END IF
     END DO
-           
+          
+!IM traceurs RR
+    IF ( id_pcsat /= 0 ) THEN
+     DO k = 1, klev
+      DO i = 1, klon
+       IF ( pplay(i,k).LT.85000.) THEN
+        tr_seri(i,k,id_pcsat) = MIN (qsat(i,k), tr_seri(i,k,id_pcsat))
+       END IF 
+      END DO
+     END DO
+    END IF
+
+    IF ( id_pcocsat /= 0 ) THEN
+     DO k = 1, klev
+      DO i = 1, klon
+       IF ( pplay(i,k).LT.85000.) THEN
+        tr_seri(i,k,id_pcocsat) = MIN (qsat(i,k), tr_seri(i,k,id_pcocsat))
+       END IF
+      END DO
+     END DO
+    END IF
+
+    IF ( id_pcq /= 0 ) THEN
+     DO k = 1, klev 
+      DO i = 1, klon 
+       IF ( pplay(i,k).LT.85000.) THEN
+        tr_seri(i,k,id_pcq) = MIN (qsat(i,k), tr_seri(i,k,id_pcq))
+       END IF
+      END DO  
+     END DO  
+    END IF  
+
+    IF ( id_pcs0 /= 0 ) THEN
+     DO k = 1, klev
+      DO i = 1, klon
+       IF ( pplay(i,k).LT.85000.) THEN
+        tr_seri(i,k,id_pcs0) = MIN (qsat(i,k), tr_seri(i,k,id_pcs0))
+       END IF
+      END DO
+     END DO
+    END IF
+
+    IF ( id_pcos0 /= 0 ) THEN
+     DO k = 1, klev
+      DO i = 1, klon
+       IF ( pplay(i,k).LT.85000.) THEN
+        tr_seri(i,k,id_pcos0) = MIN (qsat(i,k), tr_seri(i,k,id_pcos0))
+       END IF
+      END DO
+     END DO
+    END IF
+
+    IF ( id_pcq0 /= 0 ) THEN
+     DO k = 1, klev
+      DO i = 1, klon
+       IF ( pplay(i,k).LT.85000.) THEN
+        tr_seri(i,k,id_pcq0) = MIN (qsat(i,k), tr_seri(i,k,id_pcq0))
+       END IF
+      END DO
+     END DO
+    END IF
 !======================================================================
 !   Calcul de l'effet du puits radioactif
