Index: LMDZ6/branches/contrails/DefLists/context_input_lmdz.xml
===================================================================
--- LMDZ6/branches/contrails/DefLists/context_input_lmdz.xml	(revision 5622)
+++ LMDZ6/branches/contrails/DefLists/context_input_lmdz.xml	(revision 5623)
@@ -434,6 +434,6 @@
 <field_definition>
 
-  <field id ="KMFLOWN_read" field_ref="KMFLOWN_id"  read_access="true" />
-  <field id ="KMFLOWN_interp" field_ref="KMFLOWN_read"  read_access="true" grid_ref="grid_from_aviation" /> 
+  <field id ="KMFLOWN_read" field_ref="KMFLOWN_id"  enabled="false" read_access="true" />
+  <field id ="KMFLOWN_interp" field_ref="KMFLOWN_read"  enabled="false" read_access="true" grid_ref="grid_from_aviation" /> 
 
 </field_definition>
Index: LMDZ6/branches/contrails/libf/misc/readTracFiles_mod.f90
===================================================================
--- LMDZ6/branches/contrails/libf/misc/readTracFiles_mod.f90	(revision 5622)
+++ LMDZ6/branches/contrails/libf/misc/readTracFiles_mod.f90	(revision 5623)
@@ -121,9 +121,9 @@
   !--- SOME PARAMETERS THAT ARE NOT LIKELY TO CHANGE OFTEN
   CHARACTER(LEN=maxlen), SAVE      :: tran0        = 'air'      !--- Default transporting fluid
-  CHARACTER(LEN=maxlen), PARAMETER :: old_phases   = 'vlib'     !--- Old phases for water (no separator)
-  CHARACTER(LEN=maxlen), PARAMETER :: known_phases = 'glsb'     !--- Known phases initials
+  CHARACTER(LEN=maxlen), PARAMETER :: old_phases   = 'vlibfcapqt'     !--- Old phases for water (no separator)
+  CHARACTER(LEN=maxlen), PARAMETER :: known_phases = 'glsbfcapqt'     !--- Known phases initials
   INTEGER, PARAMETER :: nphases = LEN_TRIM(known_phases)        !--- Number of phases
   CHARACTER(LEN=maxlen), SAVE      :: phases_names(nphases) &   !--- Known phases names
-                                = ['gaseous  ', 'liquid   ', 'solid    ','blownSnow']
+                                = ['gaseous  ', 'liquid   ', 'solid    ','blownSnow', 'fraccld  ', 'cldvap   ', 'avifrac  ', 'pavifra  ', 'qvapavi  ', 'ticeavi  ']
   CHARACTER(LEN=1),      SAVE :: phases_sep  =  '_'             !--- Phase separator
   CHARACTER(LEN=maxlen), SAVE :: isoFile = 'isotopes_params.def'!--- Name of the isotopes parameters file
Index: LMDZ6/branches/contrails/libf/phylmd/infotrac_phy.F90
===================================================================
--- LMDZ6/branches/contrails/libf/phylmd/infotrac_phy.F90	(revision 5622)
+++ LMDZ6/branches/contrails/libf/phylmd/infotrac_phy.F90	(revision 5623)
@@ -369,4 +369,11 @@
    iqva = strIdx(tracers(:)%name, 'CONTWATER_g')
    iqia = strIdx(tracers(:)%name, 'CONTWATER_s')
+   !--Two ways of declaring tracers - the way below should be deleted in the future
+   IF (icf.EQ.0) icf  = strIdx(tracers(:)%name, addPhase('H2O', 'f'))
+   IF (iqvc.EQ.0) iqvc = strIdx(tracers(:)%name, addPhase('H2O', 'c'))
+   IF (icfa.EQ.0) icfa = strIdx(tracers(:)%name, addPhase('H2O', 'a'))
+   IF (ipcf.EQ.0) ipcf = strIdx(tracers(:)%name, addPhase('H2O', 'p'))
+   IF (iqva.EQ.0) iqva = strIdx(tracers(:)%name, addPhase('H2O', 'q'))
+   IF (iqia.EQ.0) iqia = strIdx(tracers(:)%name, addPhase('H2O', 't'))
 
    IF(CPPKEY_STRATAER .AND. type_trac == 'coag') THEN
Index: LMDZ6/branches/contrails/libf/phylmd/lmdz_aviation.f90
===================================================================
--- LMDZ6/branches/contrails/libf/phylmd/lmdz_aviation.f90	(revision 5622)
+++ LMDZ6/branches/contrails/libf/phylmd/lmdz_aviation.f90	(revision 5623)
@@ -288,9 +288,14 @@
 IF (grid_type==unstructured) THEN
 
-    ! Activate aviation file
-    IF (is_omp_master) CALL xios_set_file_attr("aviation", enabled=.TRUE.)
-
-    ! Get number of vertical levels and level values
-    IF (is_omp_master) CALL xios_get_axis_attr( "aviation_lev", n_glo=nleva )
+    IF (is_omp_master) THEN
+      ! Activate aviation file
+      CALL xios_set_file_attr("aviation", enabled=.TRUE.)
+      ! Activate aviation fields
+      CALL xios_set_field_attr("KMFLOWN_read", enabled=.TRUE.)
+      CALL xios_set_field_attr("KMFLOWN_interp", enabled=.TRUE.)
+
+      ! Get number of vertical levels and level values
+      CALL xios_get_axis_attr( "aviation_lev", n_glo=nleva )
+    ENDIF
     CALL bcast_omp(nleva)
 
Index: LMDZ6/branches/contrails/libf/phylmd/lmdz_lscp_condensation.f90
===================================================================
--- LMDZ6/branches/contrails/libf/phylmd/lmdz_lscp_condensation.f90	(revision 5622)
+++ LMDZ6/branches/contrails/libf/phylmd/lmdz_lscp_condensation.f90	(revision 5623)
@@ -245,4 +245,5 @@
 ! for dissipation
 REAL :: pdf_shape
+REAL :: dcf_sub_tmp, dqvc_sub_tmp
 !
 ! for condensation
@@ -532,12 +533,15 @@
           !--incld_ice_thresh times the saturation
           IF ( qiceincld .LT. ( incld_ice_thresh * qsat(i) ) ) THEN
-            dcf_sub(i) = ( qiceincld / ( incld_ice_thresh * qsat(i) ) - 1. ) * cldfra(i)
-            dqvc_sub(i) = qvapincld * dcf_sub(i)
-
-            cldfra(i) = cldfra(i) + dcf_sub(i)
-            qcld(i) = qcld(i) + dqvc_sub(i)
-            qvc(i) = qvc(i) + dqvc_sub(i)
-            clrfra(i) = MIN(1., clrfra(i) - dcf_sub(i))
-            qclr(i) = qclr(i) - dqvc_sub(i)
+            dcf_sub_tmp = ( qiceincld / ( incld_ice_thresh * qsat(i) ) - 1. ) * cldfra(i)
+            dqvc_sub_tmp = qvapincld * dcf_sub_tmp
+
+            cldfra(i) = cldfra(i) + dcf_sub_tmp
+            qcld(i) = qcld(i) + dqvc_sub_tmp
+            qvc(i) = qvc(i) + dqvc_sub_tmp
+            clrfra(i) = MIN(1., clrfra(i) - dcf_sub_tmp)
+            qclr(i) = qclr(i) - dqvc_sub_tmp
+          ELSE
+            dcf_sub_tmp = 0.
+            dqvc_sub_tmp = 0.
           ENDIF
 
@@ -590,12 +594,5 @@
             clrfra(i) = MIN(1., clrfra(i) - dcf_sub(i))
             qclr(i)   = qclr(i) - dqvc_sub(i) - dqi_sub(i)
-          ENDIF ! qvapincld_new .GT. 0.
-
-
-          !------------------------------------
-          !--       PHASE ADJUSTMENT        --
-          !------------------------------------
-
-          IF ( qvapincld_new .EQ. 0. ) THEN
+          ELSEIF ( qvapincld_new .EQ. 0. ) THEN
             !--If all the ice has been sublimated, we sublimate
             !--completely the cloud and do not activate the dissipation
@@ -606,4 +603,5 @@
             dqi_sub(i) = - ( qcld(i) - qvc(i) )
 
+            !--Add tendencies
             cldfra(i) = 0.
             qcld(i) = 0.
@@ -611,5 +609,16 @@
             clrfra(i) = MIN(1., clrfra(i) - dcf_sub(i))
             qclr(i) = qclr(i) - dqvc_sub(i) - dqi_sub(i)
-          ELSE
+          ENDIF ! qvapincld_new .GT. qvapincld
+
+          !--We readd previously calculated dcf_sub_tmp and dqvc_sub_tmp to the diagnostics
+          dcf_sub(i) = dcf_sub(i) + dcf_sub_tmp
+          dqvc_sub(i) = dqvc_sub(i) + dqvc_sub_tmp
+
+
+          !------------------------------------
+          !--       PHASE ADJUSTMENT        --
+          !------------------------------------
+
+          IF ( qvapincld_new .GT. 0. ) THEN
             !--Adjustment of the IWC to the new vapor in cloud
             !--(this can be either positive or negative)
@@ -840,5 +849,5 @@
           qiceinmix = ( qcld(i) - qvc(i) ) / cldfra(i) / ( 1. + clrfra_mix / cldfra_mix )
           tauinv_depsub = qiceinmix**(1./3.) * kappa_depsub
-          qvapinmix_lim = qsat(i) - qiceinmix / ( 1. - EXP( - dtime * tauinv_depsub ) )
+          qvapinmix_lim = qsat(i) - qiceinmix / ( 1. - EXP( - dtime / 2. * tauinv_depsub ) )
           qvapinclr_lim = qvapinmix_lim * ( 1. + cldfra_mix / clrfra_mix ) &
                         - qvc(i) / cldfra(i) * cldfra_mix / clrfra_mix
@@ -1117,5 +1126,5 @@
           IF ( ok_unadjusted_clouds .AND. .NOT. ok_warm_cloud ) THEN
             tauinv_depsub = qiceincld**(1./3.) * kappa_depsub
-            qvapinclr_lim = qsat(i) - qiceincld / ( 1. - EXP( - dtime * tauinv_depsub ) )
+            qvapinclr_lim = qsat(i) - qiceincld / ( 1. - EXP( - dtime / 2. * tauinv_depsub ) )
           ELSE
             qvapinclr_lim = qsat(i) - qiceincld
@@ -1144,10 +1153,9 @@
             dcf_sed(i)  = clrfra_sed * pdf_fra_above_lim / clrfra(i)
             dqvc_sed(i) = dcf_sed(i) * pdf_q_above_lim / pdf_fra_above_lim
-            !--We include the sedimentated ice:
-            dqi_sed(i)  = qiceincld &    !--We include the sedimentated ice:
-                        * ( dcf_sed(i) & !--the part that falls in the newly formed cloud and
-                          + cldfra(i) )  !--the part that falls in the existing cloud
-                        
           ENDIF
+          !--We include the sedimentated ice:
+          dqi_sed(i)  = qiceincld &    !--We include the sedimentated ice:
+                      * ( dcf_sed(i) & !--the part that falls in the newly formed cloud and
+                        + cldfra(i) )  !--the part that falls in the existing cloud
 
         ELSE
Index: LMDZ6/branches/contrails/libf/phylmd/physiq_mod.F90
===================================================================
--- LMDZ6/branches/contrails/libf/phylmd/physiq_mod.F90	(revision 5622)
+++ LMDZ6/branches/contrails/libf/phylmd/physiq_mod.F90	(revision 5623)
@@ -2473,4 +2473,6 @@
              cf_seri(i,k)  = qx(i,k,icf)
              qvc_seri(i,k) = qx(i,k,iqvc)
+             !--DYNAMICO can return NaNs for children tracers
+             IF (ISNAN(qvc_seri(i,k))) qvc_seri(i,k) = 0.
           ENDIF
           IF (ok_plane_contrail) THEN
@@ -2479,4 +2481,9 @@
              qva_seri(i,k) = qx(i,k,iqva)
              qia_seri(i,k) = qx(i,k,iqia)
+             !--DYNAMICO can return NaNs for children tracers
+             IF (ISNAN(cfa_seri(i,k))) cfa_seri(i,k) = 0.
+             IF (ISNAN(pcf_seri(i,k))) pcf_seri(i,k) = 0.
+             IF (ISNAN(qva_seri(i,k))) qva_seri(i,k) = 0.
+             IF (ISNAN(qia_seri(i,k))) qia_seri(i,k) = 0.
           ENDIF
        ENDDO
