Index: CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/EXPERIMENTS/LMDZ/CREATE_amip/config.card
===================================================================
--- CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/EXPERIMENTS/LMDZ/CREATE_amip/config.card	(revision 4932)
+++ CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/EXPERIMENTS/LMDZ/CREATE_amip/config.card	(revision 4934)
@@ -69,6 +69,4 @@
 #D-- ATM -
 [ATM]
-#
-WriteFrequency="1Y"
 # If config_Restarts_OverRule == 'n' all params are read
 Restart= n
Index: CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/EXPERIMENTS/LMDZ/CREATE_clim_360d/config.card
===================================================================
--- CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/EXPERIMENTS/LMDZ/CREATE_clim_360d/config.card	(revision 4932)
+++ CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/EXPERIMENTS/LMDZ/CREATE_clim_360d/config.card	(revision 4934)
@@ -69,6 +69,4 @@
 #D-- ATM -
 [ATM]
-#
-WriteFrequency="1Y"
 # If config_Restarts_OverRule == 'n' all params are read
 Restart= n
Index: CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/EXPERIMENTS/LMDZOR/amip/COMP/lmdz.card
===================================================================
--- CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/EXPERIMENTS/LMDZOR/amip/COMP/lmdz.card	(revision 4932)
+++ CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/EXPERIMENTS/LMDZOR/amip/COMP/lmdz.card	(revision 4934)
@@ -37,22 +37,28 @@
 ByPass_hgardfou_mats=n
 
-# Set OutLevel to choose the level of output for LMDZ
-# OutLevel=low/medium/high
-OutLevel=low
-
-# Set COSP activation and output frequency (monthly, daily, HF) = y/n
-LMDZ_COSP_OK=y
-LMDZ_COSP_monthly=n
-LMDZ_COSP_daily=n
-LMDZ_COSP_hf=n
-
-# Set NMC output frequency (monthly, daily, HF) = y/n
-LMDZ_NMC_monthly=n
-LMDZ_NMC_daily=n
-LMDZ_NMC_hf=n
-
 # Nugding : ok_guide=y/n
 # If ok_guide=y, add nudging files(u.nc, v.nc, hur.nc,...) in BoundaryFiles section below.
 ok_guide=n
+
+# Specify which output file to activate and at which output_level
+# Use an integer to specify the output level or NONE if to deactivate the file
+# output_level_filename=1     : activate the corresponding file with low output level
+# output_level_filename=10    : activate the corresponding file with high output level
+# output_level_filename=NONE  : the file will not be written
+output_level_histmth = 5
+output_level_histday = NONE
+output_level_histhf  = NONE
+output_level_histmthNMC = NONE
+output_level_histdayNMC = NONE
+output_level_histhfNMC  = NONE
+output_level_histstrataer = NONE
+output_level_histdaystrataer = NONE
+output_level_histstn      = NONE
+
+# Activate COSP in config.def and set corresponding output files
+LMDZ_COSP_OK=y
+output_level_histmthCOSP = NONE
+output_level_histdayCOSP = NONE
+output_level_histhfCOSP  = NONE
 
 [InitialStateFiles]
Index: CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/EXPERIMENTS/LMDZOR/amip/config.card
===================================================================
--- CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/EXPERIMENTS/LMDZOR/amip/config.card	(revision 4932)
+++ CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/EXPERIMENTS/LMDZOR/amip/config.card	(revision 4934)
@@ -80,5 +80,4 @@
 #D-- ATM -
 [ATM]
-WriteFrequency="1M"
 # If config_Restarts_OverRule == 'n' next 4 params are read
 Restart= n
@@ -93,7 +92,4 @@
 #D-- SRF -
 [SRF]
-# WriteFrequency is not used any more for ORCHIDEE 
-# Output files are now managed in orchidee.card 
-WriteFrequency=""
 # If config_Restarts_OverRule == 'n' next 4 params are read
 Restart= n
@@ -108,7 +104,4 @@
 #D-- SBG - STOMATE
 [SBG]
-# WriteFrequency is not used any more for ORCHIDEE 
-# Output files are now managed in stomate.card 
-WriteFrequency=""
 # If config_Restarts_OverRule == 'n' next 4 params are read
 Restart= n
@@ -123,5 +116,4 @@
 #D-- IOS -
 [IOS]
-WriteFrequency=""
 # If config_Restarts_OverRule == 'n' next 4 params are read
 Restart= n
Index: CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/EXPERIMENTS/LMDZOR/clim_pdControl/COMP/lmdz.card
===================================================================
--- CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/EXPERIMENTS/LMDZOR/clim_pdControl/COMP/lmdz.card	(revision 4932)
+++ CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/EXPERIMENTS/LMDZOR/clim_pdControl/COMP/lmdz.card	(revision 4934)
@@ -37,22 +37,28 @@
 ByPass_hgardfou_mats=n
 
-# Set OutLevel to choose the level of output for LMDZ
-# OutLevel=low/medium/high
-OutLevel=low
-
-# Set COSP activation and output frequency (monthly, daily, HF) = y/n
-LMDZ_COSP_OK=y
-LMDZ_COSP_monthly=n
-LMDZ_COSP_daily=n
-LMDZ_COSP_hf=n
-
-# Set NMC output frequency (monthly, daily, HF) = y/n
-LMDZ_NMC_monthly=n
-LMDZ_NMC_daily=n
-LMDZ_NMC_hf=n
-
 # Nugding : ok_guide=y/n
 # If ok_guide=y, add nudging files(u.nc, v.nc, hur.nc,...) in BoundaryFiles section below.
 ok_guide=n
+
+# Specify which output file to activate and at which output_level
+# Use an integer to specify the output level or NONE if to deactivate the file
+# output_level_filename=1     : activate the corresponding file with low output level
+# output_level_filename=10    : activate the corresponding file with high output level
+# output_level_filename=NONE  : the file will not be written
+output_level_histmth = 5
+output_level_histday = NONE
+output_level_histhf  = NONE
+output_level_histmthNMC = NONE
+output_level_histdayNMC = NONE
+output_level_histhfNMC  = NONE
+output_level_histstrataer = NONE
+output_level_histdaystrataer = NONE
+output_level_histstn      = NONE
+
+# Activate COSP in config.def and set corresponding output files
+LMDZ_COSP_OK=y
+output_level_histmthCOSP = NONE
+output_level_histdayCOSP = NONE
+output_level_histhfCOSP  = NONE
 
 [InitialStateFiles]
Index: CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/EXPERIMENTS/LMDZOR/clim_pdControl/config.card
===================================================================
--- CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/EXPERIMENTS/LMDZOR/clim_pdControl/config.card	(revision 4932)
+++ CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/EXPERIMENTS/LMDZOR/clim_pdControl/config.card	(revision 4934)
@@ -80,5 +80,4 @@
 #D-- ATM -
 [ATM]
-WriteFrequency="1M"
 # If config_Restarts_OverRule == 'n' next 4 params are read
 Restart= n
@@ -93,7 +92,4 @@
 #D-- SRF -
 [SRF]
-# WriteFrequency is not used any more for ORCHIDEE 
-# Output files are now managed in orchidee.card 
-WriteFrequency=""
 # If config_Restarts_OverRule == 'n' next 4 params are read
 Restart= n
@@ -108,7 +104,4 @@
 #D-- SBG - STOMATE
 [SBG]
-# WriteFrequency is not used any more for ORCHIDEE 
-# Output files are now managed in stomate.card 
-WriteFrequency=""
 # If config_Restarts_OverRule == 'n' next 4 params are read
 Restart= n
@@ -123,5 +116,4 @@
 #D-- IOS -
 [IOS]
-WriteFrequency=""
 # If config_Restarts_OverRule == 'n' next 4 params are read
 Restart= n
Index: CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/DRIVER/lmdz.driver
===================================================================
--- CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/DRIVER/lmdz.driver	(revision 4932)
+++ CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/DRIVER/lmdz.driver	(revision 4934)
@@ -48,98 +48,4 @@
     ConfType=${lmdz_UserChoices_ConfType}
 
-    ##- LMDZ output level, to be set in lmdz.card
-    if [ X${lmdz_UserChoices_OutLevel} = X ] ; then
-	# OutLevel is not set. Take default value low.
-	OutLevel=low
-    else
-	OutLevel=${lmdz_UserChoices_OutLevel}
-    fi
-
-    ##-- Output frequency purpose ....
-    ##--  Initialisation  ....
-    ok_mensuel=.FALSE.
-    ok_journe=.FALSE.
-    ok_hf=.FALSE.
-    ok_hf3h=.FALSE.
-    ok_hf3hm=.FALSE.
-    ok_stn=.FALSE.
-
-
-    case ${config_UserChoices_PeriodLength} in
-	1Y|1y|1M|1m) ok_mensuel=.TRUE. ;;
-	5D|5d|1D|1d) ok_journe=.TRUE. ;;
-    esac
-
-    for frequency in ${config_ATM_WriteFrequency} ; do
-	case ${frequency} in
-	    1M|1m) ok_mensuel=.TRUE. ;;
-	esac
-	case ${frequency} in
-	    5D|5d|1D|1d) ok_journe=.TRUE. ;;
-	esac
-	case ${frequency} in
-	    HF|hf) ok_hf=.TRUE. ;;
-	esac
-	case ${frequency} in 
-	    HF3h|hf3h) ok_hf3h=.TRUE. ;;
-	esac
-	case ${frequency} in 
-	    HF3hm|hf3hm) ok_hf3hm=.TRUE. ;;
-	esac
-	case ${frequency} in
-	    STN|stn) ok_stn=.TRUE. ;;
-	esac
-    done
-
-
-##  Read LMDZ_COSP_OK in lmdz.card
-    if [ X${lmdz_UserChoices_LMDZ_COSP_OK} = Xy ] ; then
-	##  LMDZ_COSP_OK=y, now read all other COSP variables
-	##  Read LMDZ_COSP_monthly in lmdz.card
-	if [ X${lmdz_UserChoices_LMDZ_COSP_monthly} = Xy ] ; then
-	    LMDZ_COSP_monthly=.TRUE.
-	else
-	    LMDZ_COSP_monthly=.FALSE.
-	fi
-        ##  Read LMDZ_COSP_daily in lmdz.card
-	if [ X${lmdz_UserChoices_LMDZ_COSP_daily} = Xy ] ; then
-	    LMDZ_COSP_daily=.TRUE.
-	else
-	    LMDZ_COSP_daily=.FALSE.
-	fi
-        ##  Read LMDZ_COSP_hf in lmdz.card
-	if [ X${lmdz_UserChoices_LMDZ_COSP_hf} = Xy ] ; then
-	    LMDZ_COSP_hf=.TRUE.
-	else
-	    LMDZ_COSP_hf=.FALSE.
-	fi
-    else
-	# LMDZ_COSP_OK=n : All cosp output are deactivated
-	LMDZ_COSP_monthly=.FALSE.
-	LMDZ_COSP_daily=.FALSE.
-	LMDZ_COSP_hf=.FALSE.
-    fi	
-
-    ##  Read LMDZ_NMC_monthly in lmdz.card
-    if [ X${lmdz_UserChoices_LMDZ_NMC_monthly} = Xy ] ; then
-	LMDZ_NMC_monthly=.TRUE.
-    else
-	LMDZ_NMC_monthly=.FALSE.
-    fi
-    
-    ## Read LMDZ_NMC_daily in lmdz.card
-    if [ X${lmdz_UserChoices_LMDZ_NMC_daily} = Xy ] ; then
-	LMDZ_NMC_daily=.TRUE.
-    else
-	LMDZ_NMC_daily=.FALSE.
-    fi
-    
-    ## Read LMDZ_NMC_hf in lmdz.card
-    if [ X${lmdz_UserChoices_LMDZ_NMC_hf} = Xy ] ; then
-	LMDZ_NMC_hf=.TRUE.
-    else
-	LMDZ_NMC_hf=.FALSE.
-    fi
-
     IGCM_debug_PopStack "ATM_Initialize"
 }
@@ -286,58 +192,117 @@
     IGCM_comp_modifyDefFile nonblocker config.def t_coupl   ${LMDZ_t_coupl} 
 
-    ##-- Add special treatement for CARBON CYCLE
-    if [ X"${lmdz_UserChoices_CARBON_CYCLE}" = X"control" ] || [ X"${lmdz_UserChoices_CARBON_CYCLE}" = X"historical" ] ; then
-	ATM_Carbon_Update
-    fi
-
-
-    ##-- Set LMDZ_COSP_daily1979=y in section UserChoices in lmdz.card to activate 
-    ##   COSP daily output for years 1979 and later (mandatory for historical CMIP5 run).
-    if ([ X"${lmdz_UserChoices_LMDZ_COSP_daily1979}" = X"y" ] &&  [ ${year} -ge 1979 ]) ; then
-	LMDZ_COSP_daily=.TRUE.
-    fi
-
-    ## Modifiy 
-    IGCM_comp_modifyXmlFile nonblocker file_def_histmth_lmdz.xml histmth enabled ${ok_mensuel}
-    
-    IGCM_comp_modifyXmlFile nonblocker file_def_histday_lmdz.xml histday enabled ${ok_journe}
-    
-    if [ X${OutLevel} = Xlow ] || [ X${OutLevel} = Xmedium ] ; then
-	IGCM_comp_modifyXmlFile nonblocker file_def_histday_lmdz.xml histday output_level 2
-    else
-	IGCM_comp_modifyXmlFile nonblocker file_def_histday_lmdz.xml histday output_level 5
-    fi
-    
-    IGCM_comp_modifyXmlFile nonblocker file_def_histhf_lmdz.xml histhf enabled ${ok_hf}
-    
-    if [ X${OutLevel} = Xlow ] ; then
-	IGCM_comp_modifyXmlFile nonblocker file_def_histhf_lmdz.xml histhf output_level 5
-    elif [ X${OutLevel} = Xmedium ] ; then
-	IGCM_comp_modifyXmlFile nonblocker file_def_histhf_lmdz.xml histhf output_level 6
-    elif [ X${OutLevel} = Xhigh ] ; then
-	IGCM_comp_modifyXmlFile nonblocker file_def_histhf_lmdz.xml histhf output_level 7
-    fi
-    	
-    IGCM_comp_modifyXmlFile nonblocker file_def_histhf3h_lmdz.xml histhf3h enabled ${ok_hf3h}
-    IGCM_comp_modifyXmlFile nonblocker file_def_histhf3hm_lmdz.xml histhf3hm enabled ${ok_hf3hm}
-
-    IGCM_comp_modifyXmlFile nonblocker file_def_histstn_lmdz.xml histstn enabled ${ok_stn}
-
-    IGCM_comp_modifyXmlFile nonblocker file_def_histmthNMC_lmdz.xml histmthNMC enabled ${LMDZ_NMC_monthly}
-    IGCM_comp_modifyXmlFile nonblocker file_def_histdayNMC_lmdz.xml histdayNMC enabled ${LMDZ_NMC_daily}
-    IGCM_comp_modifyXmlFile nonblocker file_def_histhfNMC_lmdz.xml histhfNMC enabled ${LMDZ_NMC_hf}
-    
-    IGCM_comp_modifyXmlFile nonblocker file_def_histmthCOSP_lmdz.xml histmthCOSP enabled ${LMDZ_COSP_monthly}
-    IGCM_comp_modifyXmlFile nonblocker file_def_histdayCOSP_lmdz.xml histdayCOSP enabled ${LMDZ_COSP_daily}
-    IGCM_comp_modifyXmlFile nonblocker file_def_histhfCOSP_lmdz.xml histhfCOSP enabled ${LMDZ_COSP_hf}
-
-    # Activate the histstrataer output file only for configuration with interactive stratospheric aersols 
-    # done by setting the key word LMDZ_strataero=y in lmdz.card
-    if [ X${lmdz_UserChoices_LMDZ_strataero} = Xy ] ; then
-	IGCM_comp_modifyXmlFile nonblocker file_def_histstrataer_lmdz.xml histstrataer enabled .TRUE.
-	IGCM_comp_modifyXmlFile nonblocker file_def_histdaystrataer_lmdz.xml histdaystrataer enabled .TRUE.
-    else
-	IGCM_comp_modifyXmlFile nonblocker file_def_histstrataer_lmdz.xml histstrataer enabled .FALSE.
-	IGCM_comp_modifyXmlFile nonblocker file_def_histdaystrataer_lmdz.xml histdaystrataer enabled .FALSE.
+
+
+    ## Activate diagnostic output files and set output_level for each file
+
+    # histmth
+    if [ X${lmdz_UserChoices_output_level_histmth} = X ] || [ X${lmdz_UserChoices_output_level_histmth} = XNONE ] ; then
+	IGCM_comp_modifyXmlFile nonblocker file_def_histmth_lmdz.xml histmth enabled FALSE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histmth_lmdz.xml histmth output_level 0
+    else
+	IGCM_comp_modifyXmlFile nonblocker file_def_histmth_lmdz.xml histmth enabled TRUE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histmth_lmdz.xml histmth output_level ${lmdz_UserChoices_output_level_histmth} 
+    fi
+
+    # histday
+    if [ X${lmdz_UserChoices_output_level_histday} = X ] || [ X${lmdz_UserChoices_output_level_histday} = XNONE ] ; then
+	IGCM_comp_modifyXmlFile nonblocker file_def_histday_lmdz.xml histday enabled FALSE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histday_lmdz.xml histday output_level 0
+    else
+	IGCM_comp_modifyXmlFile nonblocker file_def_histday_lmdz.xml histday enabled TRUE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histday_lmdz.xml histday output_level ${lmdz_UserChoices_output_level_histday} 
+    fi
+
+    # histhf
+    if [ X${lmdz_UserChoices_output_level_histhf} = X ] || [ X${lmdz_UserChoices_output_level_histhf} = XNONE ] ; then
+	IGCM_comp_modifyXmlFile nonblocker file_def_histhf_lmdz.xml histhf enabled FALSE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histhf_lmdz.xml histhf output_level 0
+    else
+	IGCM_comp_modifyXmlFile nonblocker file_def_histhf_lmdz.xml histhf enabled TRUE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histhf_lmdz.xml histhf output_level ${lmdz_UserChoices_output_level_histhf} 
+    fi
+
+    # histmthNMC
+    if [ X${lmdz_UserChoices_output_level_histmthNMC} = X ] || [ X${lmdz_UserChoices_output_level_histmthNMC} = XNONE ] ; then
+	IGCM_comp_modifyXmlFile nonblocker file_def_histmthNMC_lmdz.xml histmthNMC enabled FALSE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histmthNMC_lmdz.xml histmthNMC output_level 0
+    else
+	IGCM_comp_modifyXmlFile nonblocker file_def_histmthNMC_lmdz.xml histmthNMC enabled TRUE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histmthNMC_lmdz.xml histmthNMC output_level ${lmdz_UserChoices_output_level_histmthNMC} 
+    fi
+
+    # histdayNMC
+    if [ X${lmdz_UserChoices_output_level_histdayNMC} = X ] || [ X${lmdz_UserChoices_output_level_histdayNMC} = XNONE ] ; then
+	IGCM_comp_modifyXmlFile nonblocker file_def_histdayNMC_lmdz.xml histdayNMC enabled FALSE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histdayNMC_lmdz.xml histdayNMC output_level 0
+    else
+	IGCM_comp_modifyXmlFile nonblocker file_def_histdayNMC_lmdz.xml histdayNMC enabled TRUE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histdayNMC_lmdz.xml histdayNMC output_level ${lmdz_UserChoices_output_level_histdayNMC} 
+    fi
+
+    # histhfNMC
+    if [ X${lmdz_UserChoices_output_level_histhfNMC} = X ] || [ X${lmdz_UserChoices_output_level_histhfNMC} = XNONE ] ; then
+	IGCM_comp_modifyXmlFile nonblocker file_def_histhfNMC_lmdz.xml histhfNMC enabled FALSE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histhfNMC_lmdz.xml histhfNMC output_level 0
+    else
+	IGCM_comp_modifyXmlFile nonblocker file_def_histhfNMC_lmdz.xml histhfNMC enabled TRUE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histhfNMC_lmdz.xml histhfNMC output_level ${lmdz_UserChoices_output_level_histhfNMC} 
+    fi
+
+    # histstrataer
+    if [ X${lmdz_UserChoices_output_level_histstrataer} = X ] || [ X${lmdz_UserChoices_output_level_histstrataer} = XNONE ] ; then
+	IGCM_comp_modifyXmlFile nonblocker file_def_histstrataer_lmdz.xml histstrataer enabled FALSE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histstrataer_lmdz.xml histstrataer output_level 0
+    else
+	IGCM_comp_modifyXmlFile nonblocker file_def_histstrataer_lmdz.xml histstrataer enabled TRUE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histstrataer_lmdz.xml histstrataer output_level ${lmdz_UserChoices_output_level_histstrataer} 
+    fi
+
+    # histdaystrataer
+    if [ X${lmdz_UserChoices_output_level_histdaystrataer} = X ] || [ X${lmdz_UserChoices_output_level_histdaystrataer} = XNONE ] ; then
+	IGCM_comp_modifyXmlFile nonblocker file_def_histdaystrataer_lmdz.xml histdaystrataer enabled FALSE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histdaystrataer_lmdz.xml histdaystrataer output_level 0
+    else
+	IGCM_comp_modifyXmlFile nonblocker file_def_histdaystrataer_lmdz.xml histdaystrataer enabled TRUE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histdaystrataer_lmdz.xml histdaystrataer output_level ${lmdz_UserChoices_output_level_histstrataer}
+    fi
+
+    # histstn
+    if [ X${lmdz_UserChoices_output_level_histstn} = X ] || [ X${lmdz_UserChoices_output_level_histstn} = XNONE ] ; then
+	IGCM_comp_modifyXmlFile nonblocker file_def_histstn_lmdz.xml histstn enabled FALSE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histstn_lmdz.xml histstn output_level 0
+    else
+	IGCM_comp_modifyXmlFile nonblocker file_def_histstn_lmdz.xml histstn enabled TRUE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histstn_lmdz.xml histstn output_level ${lmdz_UserChoices_output_level_histstn} 
+    fi
+
+
+    # histmthCOSP
+    if [ X${lmdz_UserChoices_output_level_histmthCOSP} = X ] || [ X${lmdz_UserChoices_output_level_histmthCOSP} = XNONE ] ; then
+	IGCM_comp_modifyXmlFile nonblocker file_def_histmthCOSP_lmdz.xml histmthCOSP enabled FALSE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histmthCOSP_lmdz.xml histmthCOSP output_level 0
+    else
+	IGCM_comp_modifyXmlFile nonblocker file_def_histmthCOSP_lmdz.xml histmthCOSP enabled TRUE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histmthCOSP_lmdz.xml histmthCOSP output_level ${lmdz_UserChoices_output_level_histmthCOSP} 
+    fi
+
+
+    # histdayCOSP
+    if [ X${lmdz_UserChoices_output_level_histdayCOSP} = X ] || [ X${lmdz_UserChoices_output_level_histdayCOSP} = XNONE ] ; then
+	IGCM_comp_modifyXmlFile nonblocker file_def_histdayCOSP_lmdz.xml histdayCOSP enabled FALSE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histdayCOSP_lmdz.xml histdayCOSP output_level 0
+    else
+	IGCM_comp_modifyXmlFile nonblocker file_def_histdayCOSP_lmdz.xml histdayCOSP enabled TRUE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histdayCOSP_lmdz.xml histdayCOSP output_level ${lmdz_UserChoices_output_level_histdayCOSP} 
+    fi
+
+
+    # histhfCOSP
+    if [ X${lmdz_UserChoices_output_level_histhfCOSP} = X ] || [ X${lmdz_UserChoices_output_level_histhfCOSP} = XNONE ] ; then
+	IGCM_comp_modifyXmlFile nonblocker file_def_histhfCOSP_lmdz.xml histhfCOSP enabled FALSE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histhfCOSP_lmdz.xml histhfCOSP output_level 0
+    else
+	IGCM_comp_modifyXmlFile nonblocker file_def_histhfCOSP_lmdz.xml histhfCOSP enabled TRUE
+	IGCM_comp_modifyXmlFile nonblocker file_def_histhfCOSP_lmdz.xml histhfCOSP output_level ${lmdz_UserChoices_output_level_histhfCOSP} 
     fi
 
@@ -405,27 +370,26 @@
 	echo "Activate coupling to INCA, set type_trac=inca in run.def"
 	IGCM_comp_modifyDefFile blocker run.def type_trac inca
+	IGCM_comp_modifyDefFile blocker run.def iflag_phytrac 1  
     elif [ X${config_ListOfComponents_CHM} = Xreprobus ] ; then
 	echo "Activate coupling to REPROBUS, set type_trac=repr in run.def"
 	IGCM_comp_modifyDefFile blocker run.def type_trac repr
         IGCM_comp_modifyDefFile blocker run.def config_inca none
+	IGCM_comp_modifyDefFile blocker run.def iflag_phytrac 1  
     elif [ X${config_UserChoices_ConfigType} = XESMCO2 ] ; then 
 	echo "ESM config, set type_trac=co2i in run.def"
 	IGCM_comp_modifyDefFile blocker run.def type_trac co2i
         IGCM_comp_modifyDefFile blocker run.def config_inca none
+	IGCM_comp_modifyDefFile blocker run.def iflag_phytrac 1  
+    elif [ X${lmdz_UserChoices_LMDZ_strataero} = Xy ] ; then
+        echo "No coupling to chemistry model but it is a LMDZ STRATAER configuration, set type_trac=coag in run.def"
+        IGCM_comp_modifyDefFile blocker run.def type_trac coag
+        IGCM_comp_modifyDefFile blocker run.def config_inca none
+	IGCM_comp_modifyDefFile blocker run.def iflag_phytrac 1  
     else
 	echo "No coupling to chemistry model, set type_trac=lmdz in run.def"
 	IGCM_comp_modifyDefFile blocker run.def type_trac lmdz
         IGCM_comp_modifyDefFile blocker run.def config_inca none
-    fi
-
-
-    # run.def : Activate the call to phytrac 
-    if [ ! X${lmdz_UserChoices_iflag_phytrac} = X ]; then 
-	IGCM_comp_modifyDefFile nonblocker run.def iflag_phytrac ${lmdz_UserChoices_iflag_phytrac}
-    elif [ X${config_UserChoices_ConfigType} = XESMCO2 ] ; then
-	IGCM_comp_modifyDefFile blocker run.def iflag_phytrac 1  
-    else
-	IGCM_comp_modifyDefFile nonblocker run.def iflag_phytrac DEFAULT
-    fi 
+	IGCM_comp_modifyDefFile blocker run.def iflag_phytrac 0
+    fi
 
     # run.def : Activate the new calving 
@@ -528,4 +492,13 @@
 	IGCM_comp_modifyDefFile nonblocker config.def carbon_cycle_tr DEFAULT
 	IGCM_comp_modifyDefFile nonblocker config.def carbon_cycle_rad DEFAULT
+    fi
+
+    # config.def : Modify parameter ok_volcan if ok_volcan=y or LMDZ_strataero=y in lmdz.card
+    # Note: ok_volcan is a flag allowing a double-call with/without natural forcing (instead of with/without anthro forcing).
+    if [ ! X${lmdz_UserChoices_ok_volcan} = X ] || [ X${lmdz_UserChoices_LMDZ_strataero} = Xy ] ; then
+	IGCM_comp_modifyDefFile nonblocker config.def ok_volcan ${lmdz_UserChoices_ok_volcan}
+    else
+	# Take default value set in config.def
+	IGCM_comp_modifyDefFile nonblocker config.def ok_volcan DEFAULT
     fi
 
@@ -603,10 +576,9 @@
     fi
 
-    #Compression level (if CompressionLevel is not empty)
+    # Compression level (if CompressionLevel is not empty)
     if [ ! "X${config_UserChoices_CompressionLevel}" = "X" ] ; then
     echo "NetCDF output files compression level is " ${config_UserChoices_CompressionLevel}
     listfile=$(ls file_def*lmdz.xml)
-    for file in ${listfile}
-    do
+    for file in ${listfile} ; do
         sed -i -e "s/\(compression_level=\"\)[^\"]*\(\"\)/\1${config_UserChoices_CompressionLevel}\2/" ${file}
     done
@@ -622,148 +594,7 @@
     IGCM_debug_PushStack "ATM_Finalize"
 
-    # Add special treatement for CARBON CYCLE
-    if [ X"${lmdz_UserChoices_CARBON_CYCLE}" = X"control" ] || [ X"${lmdz_UserChoices_CARBON_CYCLE}" = X"historical" ] ; then
-	ATM_Carbon_Finalize
-    fi
-
-    echo FINALIZE ATM !
+    IGCM_debug_Print 1 "FINALIZE ATM !"
 
     IGCM_debug_PopStack "ATM_Finalize"
 }
 
-
-
-function ATM_Carbon_Update
-{
-    # This fuction will be called only if CARBON_CYCLE is set to control or historical in lmdz.card
-
-    IGCM_debug_PushStack "ATM_Carbon_Update"
-
-    typeset InitPeriodCo2 InitDateBeginCo2 InitDateEndCo2
-    typeset CO2SBG CO2MBG CO2LU CO2_ppm CO2_ppm_prec fCO2_ff
-    typeset PathCO2log 
-    typeset PreviousLinelog LastPeriodDateBegin LastPeriodDateEnd LastDatesPeriod LastPREFIX
-    
-    if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"n" ] ) ; then
-        ##--Initialization of fluxes to an undefined value at the first run
-	UndefinedValueCo2=-9999
-	InitPeriodCo2=0
-	InitDateBeginCo2=${UndefinedValueCo2}
-	InitYearCo2=$(( ${year} - 1 )) 
-	InitDateEndCo2=${InitYearCo2}1231
-	fCO2_ff=${UndefinedValueCo2} 
-	CO2SBG=${UndefinedValueCo2}
-	CO2LU=${UndefinedValueCo2}
-	CO2MBG=${UndefinedValueCo2}
-	CO2_ppm_prec=${UndefinedValueCo2}
-        # Get the initial value of atmosp. pco2 
-	CO2_ppm=${lmdz_UserChoices_co2_init}
-	
-	IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log
-	IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log
-	
-        # Save CO2 values in ExeCpuLog variable contents 5 fields
-	echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
-	    gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
-                              $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
-	
-        # Get the path where the log file co2.log is
-	PathCO2log=${SUBMIT_DIR} 
-        # Get Previous line in co2.log
-	PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
-	
-    else
-	
-	# NEW parameter in config.card (even for Overule all restarts, you must modify the line after this comment ):
-        # !! NEW for Carbone cycle !! Path where to find old co2.log file for restart CO2.
-	#SubmitRestartPath=
-	if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"y" ] ) ; then
-	    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ATM SubmitRestartPath
-	    PathCO2log=${config_ATM_SubmitRestartPath}
-	    Date_r=$( IGCM_date_ConvertFormatToGregorian ${config_ATM_RestartDate} )
-	    PreviousLinelog=$( grep ${Date_r} ${PathCO2log}/co2.log )
-	    
-	    IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log
-	    IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log
-	    
-            # Save Last Line of control in new co2.log file
-	    InitPeriodCo2=0   
-	    InitDateBeginCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $2}' )
-	    InitDateEndCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $3}' )
-	    fCO2_ff=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $6}' )
-	    CO2SBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $8}' )
-	    CO2LU=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $9}' )
-	    CO2MBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $7}' )
-	    CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $5}' )
-	    CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
-	    
-	    echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
-		gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
-                              $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
-	else
-           # Get restart line in co2.log
-	    PathCO2log=${SUBMIT_DIR}
-	    PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
-           # Get the value of atmosp. pco2 in co2.log
-	    CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
-	fi
-	
-    fi
-    
-    if [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
-	# Modify co2_ppm in config.def only for historical run
-	# If not historical run, keep co2_ppm value set earlier by IGCM_comp_modifyDefFile
-	IGCM_comp_modifyDefFile force config.def co2_ppm     ${CO2_ppm}
-    fi
-    IGCM_debug_PopStack "ATM_Carbon_Update"
-}
-
-
-function ATM_Carbon_Finalize
-{
-    # This fuction will be called only if CARBON_CYCLE is set to control or historical in lmdz.card
-
-    IGCM_debug_PushStack "ATM_Carbon_Finalize"
-
-    typeset CO2SBG_3V CO2SBG CO2MBG CO2SRF CO2LU CO2_ppm CO2_ppm_prec fCO2_ff
-    
-	# Fossil fuel emission
-    if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] ; then
-            # For Control, no fossil fuel emission :
-	fCO2_ff=0
-	echo "Fossil Fuel for control run  :" ${fCO2_ff}
-    else
-            # For historical, get the fossile fuel file :
-	fCO2_ff=$( gawk "{if (match(\$0,\"${year}\ *${month}\")) {print \$3}}" ${SUBMIT_DIR}/PARAM/CMIP5_gridcar_CO2_emissions_fossil_fuel_Andres_1751-2007_monthly_SC.txt )
-	echo "Fossil Fuel for historical run  :" ${fCO2_ff}
-    fi
-    
-        # Get the value of ocean carbon flux
-    CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ocean.output )
-    CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" )
-    echo "Ocean carbon flux  :" ${CO2MBG}
-    
-        # Get the value of land fluxes
-    set +A CO2SBG_3V -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk out_orchidee_0000 )
-    CO2SRF=$( echo ${CO2SBG_3V[0]} | sed -e "s/ *//" )
-    CO2LU=$( echo ${CO2SBG_3V[1]} | sed -e "s/ *//" )
-    CO2SBG=$( echo ${CO2SBG_3V[2]} | sed -e "s/ *//" )
-    echo "Land carbon flux (NEP)         :" ${CO2SRF}
-    echo "LU flux          (FLUC)        :" ${CO2LU}
-    echo "Total Land carbon flux (NBP)   :" ${CO2SBG}
-    
-        # Previous CO2
-    CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
-    echo "Previous CO2  :" ${CO2_ppm_prec}
-    
-        # Formula
-    CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SBG}) / 2.12" | bc -l )
-    echo "New CO2  :" ${CO2_ppm}
-    
-        # Save CO2 values in ExeCpuLog variable contents 5 fields
-    echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
-	gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
-                           $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
-    
-    IGCM_debug_PopStack "ATM_Carbon_Finalize"
-}
Index: CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/DRIVER/orchidee.driver
===================================================================
--- CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/DRIVER/orchidee.driver	(revision 4932)
+++ CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/DRIVER/orchidee.driver	(revision 4934)
@@ -169,10 +169,9 @@
     fi
 
-    #Compression level (if CompressionLevel is not empty)
+    # Compression level (if CompressionLevel is not empty)
     if [ ! "X${config_UserChoices_CompressionLevel}" = "X" ] ; then
 	echo "NetCDF output files compression level is " ${config_UserChoices_CompressionLevel}
     	listfile=$(ls file_def*orchidee.xml)
-    	for file in ${listfile}
-    	do
+    	for file in ${listfile} ; do
 	    sed -i -e "s/\(compression_level=\"\)[^\"]*\(\"\)/\1${config_UserChoices_CompressionLevel}\2/" ${file}
     	done
Index: CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/PARAM/config.def_actuel
===================================================================
--- CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/PARAM/config.def_actuel	(revision 4932)
+++ CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/PARAM/config.def_actuel	(revision 4934)
@@ -1,2 +1,11 @@
+## level_coupling_esm : 0(pas d'echange de carbone), 2 (change entre LMDZ/CPL/NEMO et LMDZ/ORCHIDEE)
+level_coupling_esm=  _AUTO_: DEFAULT = 0
+## carbon_cycle_cpl: couplage des flux de carbone ATM/OCE, ATM/SRF
+carbon_cycle_cpl=_AUTO_ : DEFAULT=n
+## carbon_cycle_tr: transport atmospherique de CO2 dans LMDZ
+carbon_cycle_tr=_AUTO_ : DEFAULT=n
+## carbon_cycle_rad: utilisation de traceur CO2 dans le code radiatif
+carbon_cycle_rad=_AUTO_ : DEFAULT=n
+
 ##  Cycle diurne  ou non                 
 iflag_cycle_diurne=1
@@ -72,5 +81,5 @@
 # 
 # Aerosols stratospheriques utilises par defaut 
-flag_aerosol_strat= _AUTO_: DEFAULT = 2
+flag_aerosol_strat=_AUTO_ : DEFAULT=2
 # Diag VolMIP to get volcanic aerosols effects instead of tropospheric ones
 ok_volcan=n
Index: CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/PARAM/config.def_annuel
===================================================================
--- CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/PARAM/config.def_annuel	(revision 4932)
+++ CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/PARAM/config.def_annuel	(revision 4934)
@@ -1,2 +1,11 @@
+# level_coupling_esm : 0(pas d'echange de carbone), 2 (change entre LMDZ/CPL/NEMO et LMDZ/ORCHIDEE)
+level_coupling_esm=  _AUTO_: DEFAULT = 0
+## carbon_cycle_cpl: couplage des flux de carbone ATM/OCE, ATM/SRF
+carbon_cycle_cpl=_AUTO_ : DEFAULT=n
+## carbon_cycle_tr: transport atmospherique de CO2 dans LMDZ
+carbon_cycle_tr=_AUTO_ : DEFAULT=n
+## carbon_cycle_rad: utilisation de traceur CO2 dans le code radiatif
+carbon_cycle_rad=_AUTO_ : DEFAULT=n
+
 ##  Cycle diurne  ou non                 
 iflag_cycle_diurne=1
@@ -73,5 +82,5 @@
 # 
 # Aerosols stratospheriques utilises par defaut 
-flag_aerosol_strat= _AUTO_: DEFAULT = 2
+flag_aerosol_strat=_AUTO_ : DEFAULT=2
 # Diag VolMIP to get volcanic aerosols effects instead of tropospheric ones
 ok_volcan=n
Index: CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/PARAM/config.def_preind
===================================================================
--- CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/PARAM/config.def_preind	(revision 4932)
+++ CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/PARAM/config.def_preind	(revision 4934)
@@ -1,2 +1,11 @@
+## level_coupling_esm : 0(pas d'echange de carbone), 2 (change entre LMDZ/CPL/NEMO et LMDZ/ORCHIDEE)
+level_coupling_esm=  _AUTO_: DEFAULT = 0
+## carbon_cycle_cpl: couplage des flux de carbone ATM/OCE, ATM/SRF
+carbon_cycle_cpl=_AUTO_ : DEFAULT=n
+## carbon_cycle_tr: transport atmospherique de CO2 dans LMDZ
+carbon_cycle_tr=_AUTO_ : DEFAULT=n
+## carbon_cycle_rad: utilisation de traceur CO2 dans le code radiatif
+carbon_cycle_rad=_AUTO_ : DEFAULT=n
+
 ##  Cycle diurne  ou non                 
 iflag_cycle_diurne=1
@@ -73,5 +82,5 @@
 # Aerosols stratospheriques utilises par defaut 
 #
-flag_aerosol_strat= _AUTO_: DEFAULT = 2
+flag_aerosol_strat=_AUTO_ : DEFAULT=2
 # Diag VolMIP to get volcanic aerosols effects instead of tropospheric ones
 ok_volcan=n
Index: CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/PARAM/orchidee.def_CWRR
===================================================================
--- CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/PARAM/orchidee.def_CWRR	(revision 4932)
+++ CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/PARAM/orchidee.def_CWRR	(revision 4934)
@@ -133,5 +133,10 @@
 
 # Activate downregulation for CO2
-DOWNREGULATION_CO2=y
+# Set DOWNREGULATION_CO2_NEW=y to activate new revised version of 
+# downregulation parametrization available in ORCHIDEE_2_0 for 
+# configurations v6.1.11 or later or in ORCHIDEE_2_2 from revision 6393 and later. 
+# When DOWNREGULATION_CO2_NEW=y, 
+# DOWNREGULATION_CO2 will be forced to false by the model.
+DOWNREGULATION_CO2_NEW=y
 DOWNREGULATION_CO2_BASELEVEL=380.
 
Index: CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/PARAM/run.def
===================================================================
--- CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/PARAM/run.def	(revision 4932)
+++ CONFIG/UNIFORM/v6/LMDZORINCA_v6.2/GENERAL/PARAM/run.def	(revision 4934)
@@ -55,5 +55,5 @@
 no_ter_antartique=y
 ### Do not call phytrac to speed things up
-iflag_phytrac=_AUTO_: DEFAULT = 0
+iflag_phytrac=_AUTOBLOCKER_: DEFAULT = 0
 ### cpl_old_calving : use n for DYNAMICO and new coupling weight(MR025)
 cpl_old_calving = _AUTO_
