Index: CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_AER/COMP/lmdz.card
===================================================================
--- CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_AER/COMP/lmdz.card	(revision 859)
+++ CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_AER/COMP/lmdz.card	(revision 860)
@@ -4,4 +4,8 @@
 
 [UserChoices]
+LMDZ_NbPeriod_adjust=3
+# LMDZ_NbPeriod_adjust=0
+# To force usage of this Bands file, put LMDZ_NbPeriod_adjust=0 and replace XXXXXXX by Restart Job Name
+# LMDZ_Bands_file_name=${ARCHIVE}/IGCM_OUT/IPSLCM5/XXXXXXX/ATM/Debug/XXXXXXX_Bands_96x95x19_3prc.dat_3
 
 [InitialStateFiles]
@@ -21,6 +25,5 @@
 	(${SUBMIT_DIR}/PARAM/gcm.def, gcm.def), \
 	(${SUBMIT_DIR}/PARAM/run.def, .), \
-	(${SUBMIT_DIR}/PARAM/traceur.def, .), \
-	(${SUBMIT_DIR}/PARAM/Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat, .)
+	(${SUBMIT_DIR}/PARAM/traceur.def, .)
  
 
Index: CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_AER/COMP/lmdz.driver
===================================================================
--- CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_AER/COMP/lmdz.driver	(revision 859)
+++ CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_AER/COMP/lmdz.driver	(revision 860)
@@ -63,4 +63,15 @@
     PAT_ecritphy=$( grep 'ecritphy'    ${SUBMIT_DIR}/PARAM/gcm.def )
 
+
+    ## Read LMDZ_NbPeriod_adjust option in ${compname}.card 
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices LMDZ_NbPeriod_adjust
+    eval LMDZ_NbPeriod_adjust=\${${compname}_UserChoices_LMDZ_NbPeriod_adjust} > /dev/null 2>&1
+
+    if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
+        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices LMDZ_Bands_file_name
+        eval LMDZ_Bands_file_name=\${${compname}_UserChoices_LMDZ_Bands_file_name} > /dev/null 2>&1
+    fi
+
+
     ##-- This could be define in lmdz.card, inside section [UserChoices]
     ##-- Otherwise we get the value in *.def
@@ -87,16 +98,32 @@
     fi
 
+    if [ ${CumulPeriod} -eq 1 ] ; then
+        if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
+            IGCM_sys_Get ${LMDZ_Bands_file_name} Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat
+            IGCM_sys_Put_Out Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_0
+            IGCM_debug_Print 1 "Bands file forced to ${LMDZ_Bands_file_name} and stored in ${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_0"
+        fi
+    fi
+
+    LMDZ_adjust=n
+    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && LMDZ_adjust=y
+
+    RefPeriod=${LMDZ_NbPeriod_adjust} #0 to use a Bands file from Restart
+    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && (( RefPeriod = ${CumulPeriod} - 1 )) 
+
+    [ ${CumulPeriod} -gt 1 ] && IGCM_sys_Get ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_${RefPeriod} Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat
+
     ## Mise en forme du fichier physiq.def
-    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"   \
-	-e "s/OK_journe=.*/OK_journe=${OK_journe}/"   \
-	-e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" \
+    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"   	\
+	-e "s/OK_journe=.*/OK_journe=${OK_journe}/"   	\
+	-e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" 	\
 	physiq.def > physiq.def.tmp
     IGCM_sys_Mv physiq.def.tmp physiq.def
 
     ## Mise en forme du fichier gcm.def
-    sed  -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/" \
-	-e "s/${PAT_day_step}/day_step=${day_step}/" \
-	-e "s/${PAT_iperiod}/iperiod=${iperiod}/" \
-	-e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" \
+    sed  -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/" 	\
+	-e "s/${PAT_day_step}/day_step=${day_step}/" 	\
+	-e "s/${PAT_iperiod}/iperiod=${iperiod}/" 	\
+	-e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" 	\
 	gcm.def > gcm.def.tmp
     IGCM_sys_Mv gcm.def.tmp gcm.def
@@ -109,9 +136,10 @@
 
     ## Mise en forme du fichier run.def
-    sed -e "s/_dayref_/${nbjour}/" \
-	-e "s/_anneeref_/${yractu}/" \
+    sed -e "s/_dayref_/${nbjour}/" 			\
+	-e "s/_anneeref_/${yractu}/" 			\
         -e "s/_calend_/${CalendarTypeForLmdz}/"        	\
-	-e "s/_nday_/${PeriodLengthInDays}/" \
-	-e "s/_raz_date_/${RAZ_DATE}/" \
+	-e "s/_nday_/${PeriodLengthInDays}/" 		\
+	-e "s/_raz_date_/${RAZ_DATE}/" 			\
+	-e "s/_adjust_/${LMDZ_adjust}/"                	\
 	run.def > run.def.tmp
     IGCM_sys_Mv run.def.tmp run.def
@@ -125,4 +153,5 @@
     IGCM_debug_PushStack "ATM_Finalize"
 
+    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_${CumulPeriod}
     echo FINALIZE ATM !
 
Index: CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_CH4/COMP/lmdz.card
===================================================================
--- CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_CH4/COMP/lmdz.card	(revision 859)
+++ CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_CH4/COMP/lmdz.card	(revision 860)
@@ -4,4 +4,8 @@
 
 [UserChoices]
+LMDZ_NbPeriod_adjust=3
+# LMDZ_NbPeriod_adjust=0
+# To force usage of this Bands file, put LMDZ_NbPeriod_adjust=0 and replace XXXXXXX by Restart Job Name
+# LMDZ_Bands_file_name=${ARCHIVE}/IGCM_OUT/IPSLCM5/XXXXXXX/ATM/Debug/XXXXXXX_Bands_96x95x19_3prc.dat_3
 
 [InitialStateFiles]
@@ -19,6 +23,5 @@
 	(${SUBMIT_DIR}/PARAM/gcm.def, gcm.def), \
 	(${SUBMIT_DIR}/PARAM/run.def, .), \
-	(${SUBMIT_DIR}/PARAM/traceur.def, .), \
-	(${SUBMIT_DIR}/PARAM/Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat, .)
+	(${SUBMIT_DIR}/PARAM/traceur.def, .)
  
 
Index: CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_CH4/COMP/lmdz.driver
===================================================================
--- CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_CH4/COMP/lmdz.driver	(revision 859)
+++ CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_CH4/COMP/lmdz.driver	(revision 860)
@@ -1,3 +1,3 @@
-#- $Id: lmdz.driver 119 2007-07-31 13:56:33Z acosce $
+#- $Id: lmdz.driver 841 2009-12-08 09:48:13Z acosce $
 #!/bin/ksh
 
@@ -16,4 +16,5 @@
     esac
 
+
     ##-- Calendar type for LMDZ
     case ${config_UserChoices_CalendarType} in
@@ -27,5 +28,4 @@
             CalendarTypeForLmdz=earth_360d
     esac
-
 
     ##- Default number of processor for lmdz
@@ -63,4 +63,15 @@
     PAT_ecritphy=$( grep 'ecritphy'    ${SUBMIT_DIR}/PARAM/gcm.def )
 
+
+    ## Read LMDZ_NbPeriod_adjust option in ${compname}.card 
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices LMDZ_NbPeriod_adjust
+    eval LMDZ_NbPeriod_adjust=\${${compname}_UserChoices_LMDZ_NbPeriod_adjust} > /dev/null 2>&1
+
+    if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
+        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices LMDZ_Bands_file_name
+        eval LMDZ_Bands_file_name=\${${compname}_UserChoices_LMDZ_Bands_file_name} > /dev/null 2>&1
+    fi
+
+
     ##-- This could be define in lmdz.card, inside section [UserChoices]
     ##-- Otherwise we get the value in *.def
@@ -87,16 +98,32 @@
     fi
 
+    if [ ${CumulPeriod} -eq 1 ] ; then
+        if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
+            IGCM_sys_Get ${LMDZ_Bands_file_name} Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat
+            IGCM_sys_Put_Out Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_0
+            IGCM_debug_Print 1 "Bands file forced to ${LMDZ_Bands_file_name} and stored in ${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_0"
+        fi
+    fi
+
+    LMDZ_adjust=n
+    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && LMDZ_adjust=y
+
+    RefPeriod=${LMDZ_NbPeriod_adjust} #0 to use a Bands file from Restart
+    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && (( RefPeriod = ${CumulPeriod} - 1 )) 
+
+    [ ${CumulPeriod} -gt 1 ] && IGCM_sys_Get ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_${RefPeriod} Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat
+
     ## Mise en forme du fichier physiq.def
-    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"   \
-	-e "s/OK_journe=.*/OK_journe=${OK_journe}/"   \
-	-e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" \
+    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"   	\
+	-e "s/OK_journe=.*/OK_journe=${OK_journe}/"   	\
+	-e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" 	\
 	physiq.def > physiq.def.tmp
     IGCM_sys_Mv physiq.def.tmp physiq.def
 
     ## Mise en forme du fichier gcm.def
-    sed  -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/" \
-	-e "s/${PAT_day_step}/day_step=${day_step}/" \
-	-e "s/${PAT_iperiod}/iperiod=${iperiod}/" \
-	-e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" \
+    sed  -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/" 	\
+	-e "s/${PAT_day_step}/day_step=${day_step}/" 	\
+	-e "s/${PAT_iperiod}/iperiod=${iperiod}/" 	\
+	-e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" 	\
 	gcm.def > gcm.def.tmp
     IGCM_sys_Mv gcm.def.tmp gcm.def
@@ -109,9 +136,10 @@
 
     ## Mise en forme du fichier run.def
-    sed -e "s/_dayref_/${nbjour}/" \
-	-e "s/_anneeref_/${yractu}/" \
+    sed -e "s/_dayref_/${nbjour}/" 			\
+	-e "s/_anneeref_/${yractu}/" 			\
         -e "s/_calend_/${CalendarTypeForLmdz}/"        	\
-	-e "s/_nday_/${PeriodLengthInDays}/" \
-	-e "s/_raz_date_/${RAZ_DATE}/" \
+	-e "s/_nday_/${PeriodLengthInDays}/" 		\
+	-e "s/_raz_date_/${RAZ_DATE}/" 			\
+	-e "s/_adjust_/${LMDZ_adjust}/"                	\
 	run.def > run.def.tmp
     IGCM_sys_Mv run.def.tmp run.def
@@ -125,4 +153,5 @@
     IGCM_debug_PushStack "ATM_Finalize"
 
+    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_${CumulPeriod}
     echo FINALIZE ATM !
 
Index: CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_CH4_AER/COMP/lmdz.card
===================================================================
--- CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_CH4_AER/COMP/lmdz.card	(revision 859)
+++ CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_CH4_AER/COMP/lmdz.card	(revision 860)
@@ -4,4 +4,8 @@
 
 [UserChoices]
+LMDZ_NbPeriod_adjust=3
+# LMDZ_NbPeriod_adjust=0
+# To force usage of this Bands file, put LMDZ_NbPeriod_adjust=0 and replace XXXXXXX by Restart Job Name
+# LMDZ_Bands_file_name=${ARCHIVE}/IGCM_OUT/IPSLCM5/XXXXXXX/ATM/Debug/XXXXXXX_Bands_96x95x19_3prc.dat_3
 
 [InitialStateFiles]
@@ -20,6 +24,5 @@
 	(${SUBMIT_DIR}/PARAM/gcm.def, gcm.def), \
 	(${SUBMIT_DIR}/PARAM/run.def, .), \
-	(${SUBMIT_DIR}/PARAM/traceur.def, .), \
-	(${SUBMIT_DIR}/PARAM/Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat, .)
+	(${SUBMIT_DIR}/PARAM/traceur.def, .)
  
 
Index: CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_CH4_AER/COMP/lmdz.driver
===================================================================
--- CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_CH4_AER/COMP/lmdz.driver	(revision 859)
+++ CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_CH4_AER/COMP/lmdz.driver	(revision 860)
@@ -1,4 +1,5 @@
 #- $Id$
 #!/bin/ksh
+
 #-----------------------------------------------------------------
 function ATM_Initialize
@@ -62,4 +63,15 @@
     PAT_ecritphy=$( grep 'ecritphy'    ${SUBMIT_DIR}/PARAM/gcm.def )
 
+
+    ## Read LMDZ_NbPeriod_adjust option in ${compname}.card 
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices LMDZ_NbPeriod_adjust
+    eval LMDZ_NbPeriod_adjust=\${${compname}_UserChoices_LMDZ_NbPeriod_adjust} > /dev/null 2>&1
+
+    if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
+        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices LMDZ_Bands_file_name
+        eval LMDZ_Bands_file_name=\${${compname}_UserChoices_LMDZ_Bands_file_name} > /dev/null 2>&1
+    fi
+
+
     ##-- This could be define in lmdz.card, inside section [UserChoices]
     ##-- Otherwise we get the value in *.def
@@ -86,16 +98,32 @@
     fi
 
+    if [ ${CumulPeriod} -eq 1 ] ; then
+        if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
+            IGCM_sys_Get ${LMDZ_Bands_file_name} Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat
+            IGCM_sys_Put_Out Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_0
+            IGCM_debug_Print 1 "Bands file forced to ${LMDZ_Bands_file_name} and stored in ${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_0"
+        fi
+    fi
+
+    LMDZ_adjust=n
+    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && LMDZ_adjust=y
+
+    RefPeriod=${LMDZ_NbPeriod_adjust} #0 to use a Bands file from Restart
+    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && (( RefPeriod = ${CumulPeriod} - 1 )) 
+
+    [ ${CumulPeriod} -gt 1 ] && IGCM_sys_Get ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_${RefPeriod} Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat
+
     ## Mise en forme du fichier physiq.def
-    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"   \
-	-e "s/OK_journe=.*/OK_journe=${OK_journe}/"   \
-	-e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" \
+    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"   	\
+	-e "s/OK_journe=.*/OK_journe=${OK_journe}/"   	\
+	-e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" 	\
 	physiq.def > physiq.def.tmp
     IGCM_sys_Mv physiq.def.tmp physiq.def
 
     ## Mise en forme du fichier gcm.def
-    sed  -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/" \
-	-e "s/${PAT_day_step}/day_step=${day_step}/" \
-	-e "s/${PAT_iperiod}/iperiod=${iperiod}/" \
-	-e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" \
+    sed  -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/" 	\
+	-e "s/${PAT_day_step}/day_step=${day_step}/" 	\
+	-e "s/${PAT_iperiod}/iperiod=${iperiod}/" 	\
+	-e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" 	\
 	gcm.def > gcm.def.tmp
     IGCM_sys_Mv gcm.def.tmp gcm.def
@@ -108,9 +136,10 @@
 
     ## Mise en forme du fichier run.def
-    sed -e "s/_dayref_/${nbjour}/" \
-	-e "s/_anneeref_/${yractu}/" \
+    sed -e "s/_dayref_/${nbjour}/" 			\
+	-e "s/_anneeref_/${yractu}/" 			\
         -e "s/_calend_/${CalendarTypeForLmdz}/"        	\
-	-e "s/_nday_/${PeriodLengthInDays}/" \
-	-e "s/_raz_date_/${RAZ_DATE}/" \
+	-e "s/_nday_/${PeriodLengthInDays}/" 		\
+	-e "s/_raz_date_/${RAZ_DATE}/" 			\
+	-e "s/_adjust_/${LMDZ_adjust}/"                	\
 	run.def > run.def.tmp
     IGCM_sys_Mv run.def.tmp run.def
@@ -124,4 +153,5 @@
     IGCM_debug_PushStack "ATM_Finalize"
 
+    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_${CumulPeriod}
     echo FINALIZE ATM !
 
Index: CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_GES/COMP/lmdz.card
===================================================================
--- CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_GES/COMP/lmdz.card	(revision 859)
+++ CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_GES/COMP/lmdz.card	(revision 860)
@@ -4,4 +4,8 @@
 
 [UserChoices]
+LMDZ_NbPeriod_adjust=3
+# LMDZ_NbPeriod_adjust=0
+# To force usage of this Bands file, put LMDZ_NbPeriod_adjust=0 and replace XXXXXXX by Restart Job Name
+# LMDZ_Bands_file_name=${ARCHIVE}/IGCM_OUT/IPSLCM5/XXXXXXX/ATM/Debug/XXXXXXX_Bands_96x95x19_3prc.dat_3
 
 [InitialStateFiles]
@@ -20,6 +24,5 @@
 	(${SUBMIT_DIR}/PARAM/gcm.def, gcm.def), \
 	(${SUBMIT_DIR}/PARAM/run.def, .), \
-	(${SUBMIT_DIR}/PARAM/traceur.def, .), \
-	(${SUBMIT_DIR}/PARAM/Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat, .) 
+	(${SUBMIT_DIR}/PARAM/traceur.def, .)
 
 [RestartFiles]
Index: CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_GES/COMP/lmdz.driver
===================================================================
--- CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_GES/COMP/lmdz.driver	(revision 859)
+++ CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_GES/COMP/lmdz.driver	(revision 860)
@@ -1,4 +1,5 @@
-#- $Id: lmdz.driver 119 2007-07-31 13:56:33Z acosce $
+#- $Id: lmdz.driver 841 2009-12-08 09:48:13Z acosce $
 #!/bin/ksh
+
 #-----------------------------------------------------------------
 function ATM_Initialize
@@ -15,4 +16,5 @@
     esac
 
+
     ##-- Calendar type for LMDZ
     case ${config_UserChoices_CalendarType} in
@@ -26,5 +28,4 @@
             CalendarTypeForLmdz=earth_360d
     esac
-
 
     ##- Default number of processor for lmdz
@@ -62,4 +63,15 @@
     PAT_ecritphy=$( grep 'ecritphy'    ${SUBMIT_DIR}/PARAM/gcm.def )
 
+
+    ## Read LMDZ_NbPeriod_adjust option in ${compname}.card 
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices LMDZ_NbPeriod_adjust
+    eval LMDZ_NbPeriod_adjust=\${${compname}_UserChoices_LMDZ_NbPeriod_adjust} > /dev/null 2>&1
+
+    if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
+        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices LMDZ_Bands_file_name
+        eval LMDZ_Bands_file_name=\${${compname}_UserChoices_LMDZ_Bands_file_name} > /dev/null 2>&1
+    fi
+
+
     ##-- This could be define in lmdz.card, inside section [UserChoices]
     ##-- Otherwise we get the value in *.def
@@ -86,16 +98,32 @@
     fi
 
+    if [ ${CumulPeriod} -eq 1 ] ; then
+        if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
+            IGCM_sys_Get ${LMDZ_Bands_file_name} Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat
+            IGCM_sys_Put_Out Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_0
+            IGCM_debug_Print 1 "Bands file forced to ${LMDZ_Bands_file_name} and stored in ${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_0"
+        fi
+    fi
+
+    LMDZ_adjust=n
+    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && LMDZ_adjust=y
+
+    RefPeriod=${LMDZ_NbPeriod_adjust} #0 to use a Bands file from Restart
+    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && (( RefPeriod = ${CumulPeriod} - 1 )) 
+
+    [ ${CumulPeriod} -gt 1 ] && IGCM_sys_Get ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_${RefPeriod} Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat
+
     ## Mise en forme du fichier physiq.def
-    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"   \
-	-e "s/OK_journe=.*/OK_journe=${OK_journe}/"   \
-	-e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" \
+    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"   	\
+	-e "s/OK_journe=.*/OK_journe=${OK_journe}/"   	\
+	-e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" 	\
 	physiq.def > physiq.def.tmp
     IGCM_sys_Mv physiq.def.tmp physiq.def
 
     ## Mise en forme du fichier gcm.def
-    sed  -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/" \
-	-e "s/${PAT_day_step}/day_step=${day_step}/" \
-	-e "s/${PAT_iperiod}/iperiod=${iperiod}/" \
-	-e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" \
+    sed  -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/" 	\
+	-e "s/${PAT_day_step}/day_step=${day_step}/" 	\
+	-e "s/${PAT_iperiod}/iperiod=${iperiod}/" 	\
+	-e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" 	\
 	gcm.def > gcm.def.tmp
     IGCM_sys_Mv gcm.def.tmp gcm.def
@@ -108,9 +136,10 @@
 
     ## Mise en forme du fichier run.def
-    sed -e "s/_dayref_/${nbjour}/" \
-	-e "s/_anneeref_/${yractu}/" \
+    sed -e "s/_dayref_/${nbjour}/" 			\
+	-e "s/_anneeref_/${yractu}/" 			\
         -e "s/_calend_/${CalendarTypeForLmdz}/"        	\
-	-e "s/_nday_/${PeriodLengthInDays}/" \
-	-e "s/_raz_date_/${RAZ_DATE}/" \
+	-e "s/_nday_/${PeriodLengthInDays}/" 		\
+	-e "s/_raz_date_/${RAZ_DATE}/" 			\
+	-e "s/_adjust_/${LMDZ_adjust}/"                	\
 	run.def > run.def.tmp
     IGCM_sys_Mv run.def.tmp run.def
@@ -124,4 +153,5 @@
     IGCM_debug_PushStack "ATM_Finalize"
 
+    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_${CumulPeriod}
     echo FINALIZE ATM !
 
Index: CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_NMHC/COMP/lmdz.card
===================================================================
--- CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_NMHC/COMP/lmdz.card	(revision 859)
+++ CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_NMHC/COMP/lmdz.card	(revision 860)
@@ -4,4 +4,8 @@
 
 [UserChoices]
+LMDZ_NbPeriod_adjust=3
+# LMDZ_NbPeriod_adjust=0
+# To force usage of this Bands file, put LMDZ_NbPeriod_adjust=0 and replace XXXXXXX by Restart Job Name
+# LMDZ_Bands_file_name=${ARCHIVE}/IGCM_OUT/IPSLCM5/XXXXXXX/ATM/Debug/XXXXXXX_Bands_96x95x19_3prc.dat_3
 
 [InitialStateFiles]
@@ -20,6 +24,5 @@
 	(${SUBMIT_DIR}/PARAM/gcm.def, gcm.def), \
 	(${SUBMIT_DIR}/PARAM/run.def, .), \
-	(${SUBMIT_DIR}/PARAM/traceur.def, .), \
-	(${SUBMIT_DIR}/PARAM/Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat, .) 
+	(${SUBMIT_DIR}/PARAM/traceur.def, .)
 
 [RestartFiles]
Index: CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_NMHC/COMP/lmdz.driver
===================================================================
--- CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_NMHC/COMP/lmdz.driver	(revision 859)
+++ CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_NMHC/COMP/lmdz.driver	(revision 860)
@@ -1,3 +1,3 @@
-#- $Id: lmdz.driver 119 2007-07-31 13:56:33Z acosce $
+#- $Id: lmdz.driver 841 2009-12-08 09:48:13Z acosce $
 #!/bin/ksh
 
@@ -28,6 +28,4 @@
             CalendarTypeForLmdz=earth_360d
     esac
-
-
 
     ##- Default number of processor for lmdz
@@ -65,4 +63,15 @@
     PAT_ecritphy=$( grep 'ecritphy'    ${SUBMIT_DIR}/PARAM/gcm.def )
 
+
+    ## Read LMDZ_NbPeriod_adjust option in ${compname}.card 
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices LMDZ_NbPeriod_adjust
+    eval LMDZ_NbPeriod_adjust=\${${compname}_UserChoices_LMDZ_NbPeriod_adjust} > /dev/null 2>&1
+
+    if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
+        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices LMDZ_Bands_file_name
+        eval LMDZ_Bands_file_name=\${${compname}_UserChoices_LMDZ_Bands_file_name} > /dev/null 2>&1
+    fi
+
+
     ##-- This could be define in lmdz.card, inside section [UserChoices]
     ##-- Otherwise we get the value in *.def
@@ -89,16 +98,32 @@
     fi
 
+    if [ ${CumulPeriod} -eq 1 ] ; then
+        if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
+            IGCM_sys_Get ${LMDZ_Bands_file_name} Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat
+            IGCM_sys_Put_Out Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_0
+            IGCM_debug_Print 1 "Bands file forced to ${LMDZ_Bands_file_name} and stored in ${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_0"
+        fi
+    fi
+
+    LMDZ_adjust=n
+    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && LMDZ_adjust=y
+
+    RefPeriod=${LMDZ_NbPeriod_adjust} #0 to use a Bands file from Restart
+    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && (( RefPeriod = ${CumulPeriod} - 1 )) 
+
+    [ ${CumulPeriod} -gt 1 ] && IGCM_sys_Get ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_${RefPeriod} Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat
+
     ## Mise en forme du fichier physiq.def
-    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"   \
-	-e "s/OK_journe=.*/OK_journe=${OK_journe}/"   \
-	-e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" \
+    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"   	\
+	-e "s/OK_journe=.*/OK_journe=${OK_journe}/"   	\
+	-e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" 	\
 	physiq.def > physiq.def.tmp
     IGCM_sys_Mv physiq.def.tmp physiq.def
 
     ## Mise en forme du fichier gcm.def
-    sed  -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/" \
-	-e "s/${PAT_day_step}/day_step=${day_step}/" \
-	-e "s/${PAT_iperiod}/iperiod=${iperiod}/" \
-	-e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" \
+    sed  -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/" 	\
+	-e "s/${PAT_day_step}/day_step=${day_step}/" 	\
+	-e "s/${PAT_iperiod}/iperiod=${iperiod}/" 	\
+	-e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" 	\
 	gcm.def > gcm.def.tmp
     IGCM_sys_Mv gcm.def.tmp gcm.def
@@ -111,9 +136,10 @@
 
     ## Mise en forme du fichier run.def
-    sed -e "s/_dayref_/${nbjour}/" \
-	-e "s/_anneeref_/${yractu}/" \
+    sed -e "s/_dayref_/${nbjour}/" 			\
+	-e "s/_anneeref_/${yractu}/" 			\
         -e "s/_calend_/${CalendarTypeForLmdz}/"        	\
-	-e "s/_nday_/${PeriodLengthInDays}/" \
-	-e "s/_raz_date_/${RAZ_DATE}/" \
+	-e "s/_nday_/${PeriodLengthInDays}/" 		\
+	-e "s/_raz_date_/${RAZ_DATE}/" 			\
+	-e "s/_adjust_/${LMDZ_adjust}/"                	\
 	run.def > run.def.tmp
     IGCM_sys_Mv run.def.tmp run.def
@@ -127,4 +153,5 @@
     IGCM_debug_PushStack "ATM_Finalize"
 
+    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_${CumulPeriod}
     echo FINALIZE ATM !
 
Index: CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_NMHC_AER/COMP/lmdz.card
===================================================================
--- CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_NMHC_AER/COMP/lmdz.card	(revision 859)
+++ CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_NMHC_AER/COMP/lmdz.card	(revision 860)
@@ -4,4 +4,8 @@
 
 [UserChoices]
+LMDZ_NbPeriod_adjust=3
+# LMDZ_NbPeriod_adjust=0
+# To force usage of this Bands file, put LMDZ_NbPeriod_adjust=0 and replace XXXXXXX by Restart Job Name
+# LMDZ_Bands_file_name=${ARCHIVE}/IGCM_OUT/IPSLCM5/XXXXXXX/ATM/Debug/XXXXXXX_Bands_96x95x19_3prc.dat_3
 
 [InitialStateFiles]
@@ -20,6 +24,5 @@
 	(${SUBMIT_DIR}/PARAM/gcm.def, gcm.def), \
 	(${SUBMIT_DIR}/PARAM/run.def, .), \
-	(${SUBMIT_DIR}/PARAM/traceur.def, .), \
-	(${SUBMIT_DIR}/PARAM/Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat, .)
+	(${SUBMIT_DIR}/PARAM/traceur.def, .)
  
 
Index: CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_NMHC_AER/COMP/lmdz.driver
===================================================================
--- CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_NMHC_AER/COMP/lmdz.driver	(revision 859)
+++ CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_NMHC_AER/COMP/lmdz.driver	(revision 860)
@@ -1,4 +1,5 @@
-#- $Id: lmdz.driver 119 2007-07-31 13:56:33Z acosce $
+#- $Id: lmdz.driver 841 2009-12-08 09:48:13Z acosce $
 #!/bin/ksh
+
 #-----------------------------------------------------------------
 function ATM_Initialize
@@ -15,4 +16,5 @@
     esac
 
+
     ##-- Calendar type for LMDZ
     case ${config_UserChoices_CalendarType} in
@@ -27,6 +29,4 @@
     esac
 
-
-
     ##- Default number of processor for lmdz
     NUM_PROC_ATM=1
@@ -34,5 +34,4 @@
 	NUM_PROC_ATM=${BATCH_NUM_PROC_TOT}
     fi
- 
 
     ##--Frequency purpose ....
@@ -64,4 +63,15 @@
     PAT_ecritphy=$( grep 'ecritphy'    ${SUBMIT_DIR}/PARAM/gcm.def )
 
+
+    ## Read LMDZ_NbPeriod_adjust option in ${compname}.card 
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices LMDZ_NbPeriod_adjust
+    eval LMDZ_NbPeriod_adjust=\${${compname}_UserChoices_LMDZ_NbPeriod_adjust} > /dev/null 2>&1
+
+    if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
+        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices LMDZ_Bands_file_name
+        eval LMDZ_Bands_file_name=\${${compname}_UserChoices_LMDZ_Bands_file_name} > /dev/null 2>&1
+    fi
+
+
     ##-- This could be define in lmdz.card, inside section [UserChoices]
     ##-- Otherwise we get the value in *.def
@@ -88,16 +98,32 @@
     fi
 
+    if [ ${CumulPeriod} -eq 1 ] ; then
+        if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
+            IGCM_sys_Get ${LMDZ_Bands_file_name} Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat
+            IGCM_sys_Put_Out Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_0
+            IGCM_debug_Print 1 "Bands file forced to ${LMDZ_Bands_file_name} and stored in ${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_0"
+        fi
+    fi
+
+    LMDZ_adjust=n
+    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && LMDZ_adjust=y
+
+    RefPeriod=${LMDZ_NbPeriod_adjust} #0 to use a Bands file from Restart
+    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && (( RefPeriod = ${CumulPeriod} - 1 )) 
+
+    [ ${CumulPeriod} -gt 1 ] && IGCM_sys_Get ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_${RefPeriod} Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat
+
     ## Mise en forme du fichier physiq.def
-    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"   \
-	-e "s/OK_journe=.*/OK_journe=${OK_journe}/"   \
-	-e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" \
+    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"   	\
+	-e "s/OK_journe=.*/OK_journe=${OK_journe}/"   	\
+	-e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" 	\
 	physiq.def > physiq.def.tmp
     IGCM_sys_Mv physiq.def.tmp physiq.def
 
     ## Mise en forme du fichier gcm.def
-    sed  -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/" \
-	-e "s/${PAT_day_step}/day_step=${day_step}/" \
-	-e "s/${PAT_iperiod}/iperiod=${iperiod}/" \
-	-e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" \
+    sed  -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/" 	\
+	-e "s/${PAT_day_step}/day_step=${day_step}/" 	\
+	-e "s/${PAT_iperiod}/iperiod=${iperiod}/" 	\
+	-e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" 	\
 	gcm.def > gcm.def.tmp
     IGCM_sys_Mv gcm.def.tmp gcm.def
@@ -110,9 +136,10 @@
 
     ## Mise en forme du fichier run.def
-    sed -e "s/_dayref_/${nbjour}/" \
-	-e "s/_anneeref_/${yractu}/" \
+    sed -e "s/_dayref_/${nbjour}/" 			\
+	-e "s/_anneeref_/${yractu}/" 			\
         -e "s/_calend_/${CalendarTypeForLmdz}/"        	\
-	-e "s/_nday_/${PeriodLengthInDays}/" \
-	-e "s/_raz_date_/${RAZ_DATE}/" \
+	-e "s/_nday_/${PeriodLengthInDays}/" 		\
+	-e "s/_raz_date_/${RAZ_DATE}/" 			\
+	-e "s/_adjust_/${LMDZ_adjust}/"                	\
 	run.def > run.def.tmp
     IGCM_sys_Mv run.def.tmp run.def
@@ -126,4 +153,5 @@
     IGCM_debug_PushStack "ATM_Finalize"
 
+    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_${CumulPeriod}
     echo FINALIZE ATM !
 
