Index: trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh
===================================================================
--- trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh	(revision 433)
+++ trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh	(revision 457)
@@ -19,8 +19,8 @@
     # Debug Print :
     echo
-    IGCM_debug_Print 1 "IGCM_comp_Initialize :"
-    echo
-
-    typeset comp compname comptagname CompatibilityTag auxprint card_UserChoices first_option i j
+    IGCM_debug_Print 1 "IGCM_comp_Initialize"
+    echo
+
+    typeset comp compname comptagname CompatibilityTag auxprint card_UserChoices first_option option i j
     for comp in ${config_ListOfComponents[*]} ; do
         # Debug Print
@@ -34,6 +34,6 @@
 	card=${SUBMIT_DIR}/COMP/${compname}.card
 	IGCM_card_DefineVariableFromOption ${card} Compatibility libIGCM
+
 	eval CompatibilityTag=\${${compname}_Compatibility_libIGCM} > /dev/null 2>&1	
-
 	if [ ! "${CompatibilityTag}" = "${libIGCM_CurrentTag}" ] ; then
 	    IGCM_debug_Exit "${compname}.card is not compatible with libIGCM version ${libIGCM_CurrentTag} see libIGCM FAQ http://wiki.ipsl.jussieu.fr/wiki_ipsl/IGCMG/libIGCM/DocUtilisateur/FAQ ."
@@ -51,6 +51,6 @@
 
 	# Debug Print :
-	IGCM_debug_Print 1 "Initialize following component library :"
-	IGCM_debug_Print 1 ${SUBMIT_DIR}/COMP/${compname}.driver
+	IGCM_debug_Print 2 "Initialize following component library"
+	IGCM_debug_Print 2 ${SUBMIT_DIR}/COMP/${compname}.driver
 	IGCM_debug_Print 3 "With tag : ${comptagname}"
 	# Source component library
@@ -79,14 +79,14 @@
 
 	# Read UserChoices section of component card
-	IGCM_debug_Print 1 "DefineArrayFromSection : ${compname}_UserChoices ${card}"
+	IGCM_debug_Print 2 "DefineArrayFromSection : ${compname}_UserChoices ${card}"
 	IGCM_card_DefineArrayFromSection ${card} UserChoices
 	eval first_option=\${${compname}_UserChoices[0]} > /dev/null 2>&1
+	# If section is not empty we define corresponding variables
 	if [ X${first_option} != X"Error:" ] ; then
-	    eval IGCM_debug_Print 2 "${compname}_UserChoices_Options:" \${${compname}_UserChoices[*]}
+	    eval IGCM_debug_Print 3 "${compname}_UserChoices_Options:" \${${compname}_UserChoices[*]}
 	    if [ X${card_UserChoices[0]} != X ] ; then
 		unset card_UserChoices
 	    fi
 	    eval set +A card_UserChoices -- \${${compname}_UserChoices[*]} > /dev/null 2>&1
-	    typeset option
 	    for option in ${card_UserChoices[*]} ; do
 		IGCM_card_DefineVariableFromOption ${card} UserChoices ${option}
@@ -96,5 +96,5 @@
 
 	# Read and Build Output File stuff
-	IGCM_debug_Print 1 "DefineArrayFromOption  : ${compname}_OutputFiles ${card}"
+	IGCM_debug_Print 2 "DefineArrayFromOption  : ${compname}_OutputFiles ${card}"
 	IGCM_card_DefineArrayFromOption ${card} OutputFiles List
 	ListFilesName=${compname}_OutputFiles_List
@@ -196,8 +196,4 @@
 	echo
     done
-    echo "-----"
-    echo
-    IGCM_debug_Print 1 "DefineArrayFromOption  : ListOfComponents"
-    IGCM_debug_PrintVariables 3 config_ListOfComponents
 
     IGCM_debug_PopStack "IGCM_comp_Initialize"
@@ -225,5 +221,5 @@
     # Debug Print :
     echo
-    IGCM_debug_Print 1 "IGCM_comp_GetInputInitialStateFiles :"
+    IGCM_debug_Print 1 "IGCM_comp_GetInputInitialStateFiles"
     echo
 
@@ -349,5 +345,5 @@
     # Debug Print :
     echo
-    IGCM_debug_Print 1 "IGCM_comp_GetInputSmoothFiles :"
+    IGCM_debug_Print 1 "IGCM_comp_GetInputSmoothFiles"
     echo
 
@@ -356,5 +352,4 @@
 
     for comp in ${config_ListOfComponents[*]} ; do
-	echo "-----"
 	# Define component
 	eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
@@ -414,5 +409,5 @@
     # Debug Print :
     echo
-    IGCM_debug_Print 1 "IGCM_comp_GetInputBoundaryFiles :"
+    IGCM_debug_Print 1 "IGCM_comp_GetInputBoundaryFiles"
     echo
 
@@ -426,5 +421,4 @@
     for comp in ${config_ListOfComponents[*]} ; do
 
-	echo "-----"
 	# Define component
 	eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
@@ -500,5 +494,5 @@
     # Debug Print :
     echo
-    IGCM_debug_Print 1 "IGCM_comp_DelFixeBoundaryFiles :"
+    IGCM_debug_Print 1 "IGCM_comp_DelFixeBoundaryFiles"
     echo
 
@@ -516,5 +510,5 @@
     # Debug Print :
     echo
-    IGCM_debug_Print 1 "IGCM_comp_GetInputParametersFiles :"
+    IGCM_debug_Print 1 "IGCM_comp_GetInputParametersFiles"
     echo
 
@@ -563,5 +557,5 @@
     # Debug Print :
     echo
-    IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles :"
+    IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles"
     echo
 
@@ -731,5 +725,5 @@
     # Debug Print :
     echo
-    IGCM_debug_Print 1 "IGCM_comp_PeriodStart :"
+    IGCM_debug_Print 1 "IGCM_comp_PeriodStart"
     echo
 
@@ -762,5 +756,5 @@
     # Debug Print :
     echo
-    IGCM_debug_Print 1 "IGCM_comp_Update :"
+    IGCM_debug_Print 1 "IGCM_comp_Update"
     echo
 
@@ -794,5 +788,5 @@
 
 	# Debug Print
-	IGCM_debug_Print 3 "Update ${compname} Parameter Files."
+	IGCM_debug_Print 1 "Update ${compname} Parameter Files."
 	# UPDATE component
         ${comp}_Update
@@ -810,5 +804,5 @@
     # Debug Print :
     echo
-    IGCM_debug_Print 1 "IGCM_comp_Finalize :"
+    IGCM_debug_Print 1 "IGCM_comp_Finalize"
     echo
 
@@ -1055,5 +1049,6 @@
 
 		unset list_file
-		set +A list_file -- $( ls ${file_in}* | sort 2>/dev/null )
+		#set +A list_file -- $( ls ${file_in}* | sort 2>/dev/null )
+		set +A list_file -- $( for i in $(ls ${file_in}* 2>/dev/null | sed "s/${file_in}//" | sort -n) ; do ls ${file_in}$i ; done )
 		nlist_file=${#list_file[@]}
 		if [ ${nlist_file} -gt 1 ] ; then
@@ -1082,6 +1077,6 @@
 			eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_out}" > /dev/null 2>&1
 
-			if ( $ExecutionFail && [ X$( echo ${file_out} | grep "_out" ) != X ] ) ; then
-			    IGCM_sys_Cp ${file_out} ${SUBMIT_DIR}
+			if ( ${ExecutionFail} ) ; then
+			    IGCM_sys_Cp ${file_out} ${SUBMIT_DIR}/Debug
 			fi
 		    else
@@ -1091,6 +1086,6 @@
 			    eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file}" > /dev/null 2>&1
 			done
-			if ( $ExecutionFail && [ X$( echo ${file} | grep "_out" ) != X ] ) ; then
-			    IGCM_sys_Cp ${file} ${SUBMIT_DIR}/${PREFIX}_${file}
+			if ( ${ExecutionFail} ) ; then
+			    IGCM_sys_Cp ${file} ${SUBMIT_DIR}/Debug/${PREFIX}_${file}
 			fi
 		    fi
@@ -1102,6 +1097,6 @@
 		    [ $? -eq 0 ] && eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
 
-		    if ( $ExecutionFail && [ X$( echo ${file_in} | grep "_out" ) != X ] ) ; then
-			IGCM_sys_Cp ${file_in} ${SUBMIT_DIR}/${PREFIX}_${file_in}
+		    if ( ${ExecutionFail} ) ; then
+			IGCM_sys_Cp ${file_in} ${SUBMIT_DIR}/Debug/${PREFIX}_${file_in}
 		    fi
 		fi
