Index: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/orchidee.driver
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/orchidee.driver	(revision 3033)
+++ CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/orchidee.driver	(revision 3047)
@@ -1,4 +1,4 @@
 #!/bin/ksh
-#D- Driver du script pour ORCHIDEE
+## Driver for the component SRF corresponding to the sechiba part of ORCHIDEE
 #-----------------------------------------------------------------
 function SRF_Initialize
@@ -63,12 +63,18 @@
     ## 2. Mangement of output and modifications of related xml files
 
-    # Set default values for sechiba1_enabled, sechiba1_freq and sechiba2_enabled.
+    # Set default values for sechiba1_enabled and sechiba1_freq.
+    # These variables are used only to modify file_def_orchidee.xml
     sechiba1_enabled=.FALSE.
     sechiba2_enabled=.FALSE.
     sechiba1_freq=0s
+    sechiba2_freq=0s
 
-    # Get WriteFrenquecies from config.card for SECHIBA
-    # Note that it is only possible to have one HF and one other option. 
-    # If more options are set in config.card only the latest will be used.
+
+    # Get WriteFrenquecy for SRF (SECHIBA) from config.card
+    # 1 or 2 frequencies can be set in WriteFrenquecy for SRF
+    # The first frequency will always be used for the sechiba_history file and the 
+    # second frequency will be used for the sechiba_out_2.nc file. 
+    # The files are activated only if its corresponding frequency is set in WriteFrequency
+    ifreq=0
     for frequency in ${config_SRF_WriteFrequency} ; do
 	case ${frequency} in
@@ -76,29 +82,49 @@
 		NbYears=$( echo ${frequency} | awk -F '[yY]' '{print $1}' )
 		NbDaysYear=$( IGCM_date_DaysInYear ${year} )
-		sechiba1_enabled=.TRUE.
-		sechiba1_freq=${NbYears}y ;;
+		file_enabled=.TRUE.
+		file_freq=${NbYears}y ;;
 	    *M|*m)
 		NbMonths=$( echo ${frequency} | awk -F '[mM]' '{print $1}' )
-		sechiba1_enabled=.TRUE.
-		sechiba1_freq=${NbMonths}mo ;;
+		file_enabled=.TRUE.
+		file_freq=${NbMonths}mo ;;
 	    *D|*d)
 		NbDays=$( echo ${frequency} | awk -F '[dD]' '{print $1}' )
-		sechiba1_enabled=.TRUE.
-		sechiba1_freq=${NbDays}d ;;
+		file_enabled=.TRUE.
+		file_freq=${NbDays}d ;;
 	    *s)
 		WriteInSeconds=$( echo ${frequency} | awk -F '[s]' '{print $1}' )
-		sechiba1_enabled=.TRUE.
-		sechiba1_freq=${WriteInSeconds}s ;;
+		file_enabled=.TRUE.
+		file_freq=${WriteInSeconds}s ;;
             HF|hf) 
-		sechiba2_enabled=.TRUE. ;;
+		file_enabled=.TRUE. 
+		file_freq=10800s ;;
 	    *) 
-		IGCM_debug_Exit "SRF WriteFrequency=${frequency} is invalid. Choose between xY, xM, xD, xs and HF for Sechiba." ;;
+		IGCM_debug_Exit "SRF_Update " ${frequency} " invalid WriteFrequency : choose in xY, xM, xD, xs and HF" 
+		IGCM_debug_Verif_Exit ;;
+	esac
+
+	(( ifreq = ifreq + 1 ))
+	case ${ifreq} in
+	    1)
+		sechiba1_enabled=${file_enabled}
+		sechiba1_freq=${file_freq} ;;
+	    2)
+		sechiba2_enabled=${file_enabled}
+		sechiba2_freq=${file_freq} ;;
+        *)
+		IGCM_debug_Exit "SRF_Update: It is not possible to set more than 2 output files for sechiba from config.card"
+		IGCM_debug_Exit "You must correct WriteFrequancy in SRF secion in config.card."
+		IGCM_debug_Exit "Adapt file_def_orchidee.xml directly if you want more output files"
+		IGCM_debug_Verif_Exit ;;
 	esac
     done
 
-    # Do the modifications in file_def_orchidee.xml
+
+    # Modify file_def_orchidee.xml file
     IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba1 enabled ${sechiba1_enabled}
     IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba1 output_freq ${sechiba1_freq}
     IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba2 enabled ${sechiba2_enabled}
+    IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba2 output_freq ${sechiba2_freq}
+    
 
     # Add include of orchidee context in iodef.xml
@@ -110,17 +136,18 @@
     rm iodef.xml.tmp add.tmp
 
-    #Long Name as global attribute (if LongName is not empty)
-	if [ ! "X${config_UserChoices_LongName}" = "X" ] ; then
-	    listfile=$(ls file_def*orchidee.xml)
-	    echo "<variable id=\"LongName\" type=\"string\">${config_UserChoices_LongName}</variable>" > add.tmp
-	    for file in ${listfile}
-	    do
-		cp ${file} ${file}.tmp
-		sed -e "/<file id/r add.tmp" \
-		    ${file}.tmp > ${file}
-		rm ${file}.tmp 
-	    done 
-	    rm add.tmp
-	fi
+    # Add LongName as global attribute in XIOS output files (if LongName is not empty)
+    if [ ! "X${config_UserChoices_LongName}" = "X" ] ; then
+	listfile=$(ls file_def*orchidee.xml)
+	echo "<variable id=\"LongName\" type=\"string\">${config_UserChoices_LongName}</variable>" > add.tmp
+	for file in ${listfile}
+	do
+	    cp ${file} ${file}.tmp
+	    sed -e "/<file id/r add.tmp" \
+		${file}.tmp > ${file}
+	    rm ${file}.tmp 
+	done 
+	rm add.tmp
+    fi
+
 
     IGCM_debug_PopStack "SRF_Update"
