Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/orchidee.driver
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/orchidee.driver	(revision 2410)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/orchidee.driver	(revision 2582)
@@ -15,10 +15,10 @@
 
     ##- Define variable DefSuffix set in orchidee.card
-    ##  This variable is used in orchidee.card to choose 
-    ##  parameter file(orchidee.def_DefSuffix). 
+    ##  This variable is used in orchidee.card to choose
+    ##  parameter file(orchidee.def_DefSuffix).
     if [ ! X${orchidee_UserChoices_DefSuffix} = X ] ; then
-	DefSuffix=${orchidee_UserChoices_DefSuffix}
+        DefSuffix=${orchidee_UserChoices_DefSuffix}
     else
-	DefSuffix=Choi
+        DefSuffix=Choi
     fi
 
@@ -33,142 +33,72 @@
     # Activate STOMATE if the compontent SBG=stomate is set in config.card
     if [ X${config_ListOfComponents_SBG} = Xstomate ] ; then
-	IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_OK_STOMATE y
+        IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_OK_STOMATE y
     else
-	IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_OK_STOMATE n
+        IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_OK_STOMATE n
     fi
 
-    typeset SECHIBA_WRITE_STEP
+    # Default init : files are desactivated
+    IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .FALSE.
+    IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 enabled .FALSE.
 
-    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
-	IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .FALSE. 
-	IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 enabled .FALSE. 
-	IGCM_comp_modifyDefFile nonblocker orchidee.def XIOS_ORCHIDEE_OK y
-    else
-	IGCM_comp_modifyDefFile nonblocker orchidee.def XIOS_ORCHIDEE_OK n
-    fi    
-
-    SRF_WriteFrequency=$( echo ${config_SRF_WriteFrequency} | sed -e 's/\([0-9]*[yYmMdDs]\).*/\1/' ) 
+    SRF_WriteFrequency=$( echo ${config_SRF_WriteFrequency} | sed -e 's/\([0-9]*[yYmMdDs]\).*/\1/' )
     case ${SRF_WriteFrequency} in
-	*Y|*y) 
-	    WriteInYears=$( echo ${SRF_WriteFrequency} | awk -F '[yY]' '{print $1}' )
-	    PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
-	    (( SECHIBA_WRITE_STEP = PeriodLengthInDays * WriteInYears / PeriodLengthInYears * 86400 )) 
-	    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
-		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 
-		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq ${WriteInYears}y
-		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history 
-	    fi
-	    ;;
-	1M)
-	    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
-		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 
-		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq 1mo
-		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history 
-	    fi
-	    case ${config_UserChoices_PeriodLength} in
-	    *Y|*y)
-		SECHIBA_WRITE_STEP=-1.
-		;;
-	    *M|*m)
-		SECHIBA_WRITE_STEP=-1.
-		;;
-	    *)
-		(( SECHIBA_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) * 86400 ))
-		;;
-	    esac
-	    ;;
-	*M|*m) 
-	    WriteInMonths=$( echo ${SRF_WriteFrequency} | awk -F '[mM]' '{print $1}' )
-	    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
-		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 
-		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq ${WriteInMonths}mo
-		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history 
-	    fi
-	    case ${config_UserChoices_PeriodLength} in
-	    *Y|*y)
-		PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
-		(( SECHIBA_WRITE_STEP = PeriodLengthInDays * 86400 / PeriodLengthInYears / 12  ))
-		;;
-	    *M|*m)
-		PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' )
-		(( SECHIBA_WRITE_STEP = PeriodLengthInDays * WriteInMonths  * 86400 / PeriodLengthInMonths  ))
-		;;
-	    *)
-		(( SECHIBA_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) * 86400 ))
-		if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
-		    IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 
-		    IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq ${SECHIBA_WRITE_STEP}s
-		    IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history
-		fi
-		;;
-	    esac
-	    ;;
-	5D|5d) 
-	    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
-		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 
-		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq 5d
-		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history 
-	    fi
-	    (( SECHIBA_WRITE_STEP = 5 * 86400 )) 
-	    ;;
-	1D|1d) 
-	    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
-		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 
-		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq 1d
-		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history 
-	    fi
-	    (( SECHIBA_WRITE_STEP = 86400 )) 
-	    ;;
-	*s)
-	    WriteInSeconds=$( echo ${SRF_WriteFrequency} | awk -F '[s]' '{print $1}' )
-	    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
-		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 
-		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq ${WriteInSeconds}s
-		IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history 
-	    fi
-	    (( SECHIBA_WRITE_STEP = WriteInSeconds )) ;;
-	*) 
-	    IGCM_debug_Exit "SRF_Update " ${SRF_WriteFrequency} " invalid WriteFrequency : choose in 1Y, 1M, 5D, 1D." 
-	    IGCM_debug_Verif_Exit ;;
+        *Y|*y)
+            WriteInYears=$( echo ${SRF_WriteFrequency} | awk -F '[yY]' '{print $1}' )
+            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
+            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE.
+            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq ${WriteInYears}y
+            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history
+            ;;
+        *M|*m)
+            WriteInMonths=$( echo ${SRF_WriteFrequency} | awk -F '[mM]' '{print $1}' )
+            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE.
+            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq ${WriteInMonths}mo
+            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history
+            ;;
+        5D|5d)
+            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE.
+            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq 5d
+            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history
+            ;;
+        1D|1d)
+            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE.
+            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq 1d
+            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history
+            ;;
+        *s)
+            WriteInSeconds=$( echo ${SRF_WriteFrequency} | awk -F '[s]' '{print $1}' )
+            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE.
+            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq ${WriteInSeconds}s
+            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history
+            ;;
+        *)
+            IGCM_debug_Exit "SRF_Update " ${SRF_WriteFrequency} " invalid WriteFrequency : choose in 1Y, 1M, 5D, 1D."
+            IGCM_debug_Verif_Exit ;;
     esac
 
-#Use of XIOS ouputs only
-
-    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
-	(( SECHIBA_WRITE_STEP = 0 ))
+    # Outputs HF in HISTFILE2 if required. Output frequency is 3 hours by default.
+    if [ X${SRF_ok_hf} = Xy ] ; then
+        IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 enabled .TRUE.
+        IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 output_freq 10800s
+        IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 name sechiba_out_2
     fi
-    IGCM_comp_modifyDefFile nonblocker orchidee.def WRITE_STEP ${SECHIBA_WRITE_STEP}
-    IGCM_comp_modifyDefFile nonblocker orchidee.def SECHIBA_HISTLEVEL ${orchidee_UserChoices_sechiba_LEVEL}
-
-    # Outputs HF in HISTFILE2 if required
-    if [ X${SRF_ok_hf} = Xy ] ; then
-	IGCM_comp_modifyDefFile nonblocker orchidee.def SECHIBA_HISTFILE2 y
-	if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
-	    IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 enabled .TRUE. 
-	    IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 output_freq 10800s
-	    IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 name sechiba_out_2
-	fi
-    else
-	IGCM_comp_modifyDefFile nonblocker orchidee.def SECHIBA_HISTFILE2 n
-    fi
-    IGCM_comp_modifyDefFile nonblocker orchidee.def SECHIBA_HISTLEVEL2 1
-    IGCM_comp_modifyDefFile nonblocker orchidee.def WRITE_STEP2 10800.0
 
     if ( [ ${CumulPeriod} -ne 1 ] || [ "${config_SRF_Restart}" != "n" ] ) ; then
-	IGCM_comp_modifyDefFile blocker orchidee.def SECHIBA_restart_in sechiba_rest_in.nc
+        IGCM_comp_modifyDefFile blocker orchidee.def SECHIBA_restart_in sechiba_rest_in.nc
     else
-	IGCM_comp_modifyDefFile blocker orchidee.def SECHIBA_restart_in NONE
+        IGCM_comp_modifyDefFile blocker orchidee.def SECHIBA_restart_in NONE
     fi
 
-# Modify in orchidee.def VEGET_UPDATE and LAND_COVER_CHANGE if they are set in orchidee.card section UserChoices
+    # Modify in orchidee.def VEGET_UPDATE and LAND_COVER_CHANGE if they are set in orchidee.card section UserChoices
     if [ ! X${orchidee_UserChoices_VEGET_UPDATE} = X ] ; then
-	IGCM_comp_modifyDefFile nonblocker orchidee.def VEGET_UPDATE   ${orchidee_UserChoices_VEGET_UPDATE}
+        IGCM_comp_modifyDefFile nonblocker orchidee.def VEGET_UPDATE   ${orchidee_UserChoices_VEGET_UPDATE}
     else
-	IGCM_comp_modifyDefFile nonblocker orchidee.def VEGET_UPDATE 0Y
+        IGCM_comp_modifyDefFile nonblocker orchidee.def VEGET_UPDATE 0Y
     fi
     if [ ! X${orchidee_UserChoices_LAND_COVER_CHANGE} = X ] ; then
-	IGCM_comp_modifyDefFile nonblocker orchidee.def LAND_COVER_CHANGE ${orchidee_UserChoices_LAND_COVER_CHANGE}
+        IGCM_comp_modifyDefFile nonblocker orchidee.def LAND_COVER_CHANGE ${orchidee_UserChoices_LAND_COVER_CHANGE}
     else
-	IGCM_comp_modifyDefFile nonblocker orchidee.def LAND_COVER_CHANGE n
+        IGCM_comp_modifyDefFile nonblocker orchidee.def LAND_COVER_CHANGE n
     fi
 
@@ -176,17 +106,14 @@
     #IGCM_sys_Put_Out ${RUN_DIR}/run.def ${R_SAVE}/${PREFIX}_run.def
 
-#Temporary way to fix bug on cimean variable
-    IGCM_comp_modifyXmlFile force field_def_orchidee.xml cimean enabled .FALSE. 
+    #Temporary way to fix bug on cimean variable
+    IGCM_comp_modifyXmlFile force field_def_orchidee.xml cimean enabled .FALSE.
 
-    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
     # Add include of orchidee context in iodef.xml
     # In iodef.xml add on next line after "COMPONENT CONTEXT"
     #  <context id="orchidee" src="./context_orchidee.xml"/>
-	echo '<context id="orchidee" src="./context_orchidee.xml"/>' > add.tmp
-	cp iodef.xml iodef.xml.tmp
-	sed -e "/COMPONENT CONTEXT/r add.tmp" \
-	    iodef.xml.tmp > iodef.xml
-	rm iodef.xml.tmp add.tmp
-    fi
+    echo '<context id="orchidee" src="./context_orchidee.xml"/>' > add.tmp
+    cp iodef.xml iodef.xml.tmp
+    sed -e "/COMPONENT CONTEXT/r add.tmp" iodef.xml.tmp > iodef.xml
+    rm iodef.xml.tmp add.tmp
 
     IGCM_debug_PopStack "SRF_Update"
