Index: CMIP6/DCPP-A/DRIVER/lim2.driver
===================================================================
--- CMIP6/DCPP-A/DRIVER/lim2.driver	(revision 5840)
+++ CMIP6/DCPP-A/DRIVER/lim2.driver	(revision 5840)
@@ -0,0 +1,64 @@
+#!/bin/ksh
+
+#-----------------------------------
+function ICE_Initialize
+{ 
+    IGCM_debug_PushStack "ICE_Initialize"
+
+    echo INITIALIZE ICE !!!
+
+    IGCM_debug_PopStack "ICE_Initialize"
+}
+
+#-----------------------------------
+function ICE_Update
+{
+    IGCM_debug_PushStack "ICE_Update"
+
+    ##--Write Frequency for iomput
+    ## Differents frequencies are allowed for ICE files
+
+    VI1D_ENABLE=".FALSE."
+    VI5D_ENABLE=".FALSE."
+    VI1M_ENABLE=".FALSE."
+    VI1Y_ENABLE=".FALSE."
+
+    for frequency in ${config_ICE_WriteFrequency} ; do
+        case ${frequency} in
+            ( 1D|1d ) VI1D_ENABLE=".TRUE." ;;
+            ( 5D|5d ) VI5D_ENABLE=".TRUE." ;;
+            ( 1M|1m ) VI1M_ENABLE=".TRUE." ;;
+            ( *[yY] ) VI1Y_ENABLE=".TRUE." ;;
+        esac
+    done
+
+
+  # Update iodef.xml
+
+    IGCM_debug_Print 1 'Informations into iodef.xml : VI1D_ENABLE VI5D_ENABLE VI1M_ENABLE VI1Y_ENABLE '
+    IGCM_debug_Print 1 ${VI1D_ENABLE}  ${VI5D_ENABLE} ${VI1M_ENABLE} ${VI1Y_ENABLE}
+
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-lim.xml 1d_lim enabled ${VI1D_ENABLE}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-lim.xml 5d_lim enabled ${VI5D_ENABLE}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-lim.xml 1m_lim enabled ${VI1M_ENABLE}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-lim.xml 1y_lim enabled ${VI1Y_ENABLE}
+
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-lim.xml 1d_lim output_level ${lim2_UserChoices_OutputLevel}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-lim.xml 5d_lim output_level ${lim2_UserChoices_OutputLevel}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-lim.xml 1m_lim output_level ${lim2_UserChoices_OutputLevel}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-lim.xml 1y_lim output_level ${lim2_UserChoices_OutputLevel}
+
+    echo UPDATE ICE !!!
+
+    IGCM_debug_PopStack "ICE_Update"
+}
+
+#-----------------------------------
+function ICE_Finalize
+{
+    IGCM_debug_PushStack "ICE_Finalize"
+
+    echo FINALIZE ICE !!!
+
+    IGCM_debug_PopStack "ICE_Finalize"
+}
Index: CMIP6/DCPP-A/DRIVER/lim3.driver
===================================================================
--- CMIP6/DCPP-A/DRIVER/lim3.driver	(revision 5840)
+++ CMIP6/DCPP-A/DRIVER/lim3.driver	(revision 5840)
@@ -0,0 +1,65 @@
+#!/bin/ksh
+
+#-----------------------------------
+function ICE_Initialize
+{ 
+    IGCM_debug_PushStack "ICE_Initialize"
+
+    echo INITIALIZE ICE !!!
+
+    IGCM_debug_PopStack "ICE_Initialize"
+}
+
+#-----------------------------------
+function ICE_Update
+{
+    IGCM_debug_PushStack "ICE_Update"
+
+    ##--Write Frequency for iomput
+    ## Differents frequencies are allowed for ICE files
+
+    VI1D_ENABLE=".FALSE."
+    VI5D_ENABLE=".FALSE."
+    VI1M_ENABLE=".FALSE."
+    VI1Y_ENABLE=".FALSE."
+
+    for frequency in ${config_ICE_WriteFrequency} ; do
+        case ${frequency} in
+            ( 1D|1d ) VI1D_ENABLE=".TRUE." ;;
+            ( 5D|5d ) VI5D_ENABLE=".TRUE." ;;
+            ( 1M|1m ) VI1M_ENABLE=".TRUE." ;;
+            ( *[yY] ) VI1Y_ENABLE=".TRUE." ;;
+        esac
+    done
+
+
+  # Update iodef.xml
+
+    IGCM_debug_Print 1 'Informations into iodef.xml : VI1D_ENABLE VI5D_ENABLE VI1M_ENABLE VI1Y_ENABLE '
+    IGCM_debug_Print 1 ${VI1D_ENABLE}  ${VI5D_ENABLE} ${VI1M_ENABLE} ${VI1Y_ENABLE}
+
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-lim.xml 1d_lim enabled ${VI1D_ENABLE}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-lim.xml 5d_lim enabled ${VI5D_ENABLE}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-lim.xml 1m_lim enabled ${VI1M_ENABLE}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-lim.xml 1y_lim enabled ${VI1Y_ENABLE}
+
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-lim.xml 1d_lim output_level ${lim3_UserChoices_OutputLevel}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-lim.xml 5d_lim output_level ${lim3_UserChoices_OutputLevel}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-lim.xml 1m_lim output_level ${lim3_UserChoices_OutputLevel}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-lim.xml 1y_lim output_level ${lim3_UserChoices_OutputLevel}
+
+
+    echo UPDATE ICE !!!
+
+    IGCM_debug_PopStack "ICE_Update"
+}
+
+#-----------------------------------
+function ICE_Finalize
+{
+    IGCM_debug_PushStack "ICE_Finalize"
+
+    echo FINALIZE ICE !!!
+
+    IGCM_debug_PopStack "ICE_Finalize"
+}
Index: CMIP6/DCPP-A/DRIVER/lmdz.driver
===================================================================
--- CMIP6/DCPP-A/DRIVER/lmdz.driver	(revision 5840)
+++ CMIP6/DCPP-A/DRIVER/lmdz.driver	(revision 5840)
@@ -0,0 +1,723 @@
+#!/bin/ksh
+#-----------------------------------------------------------------
+function ATM_Initialize
+{
+    IGCM_debug_PushStack "ATM_Initialize"
+
+    RESOL_ATM=$( echo $RESOL | awk "-Fx" '{print $2}' | awk "-F-" '{print $1}')
+
+    [ -f ${SUBMIT_DIR}/../.resol ] && eval $(grep RESOL_ATM_3D ${SUBMIT_DIR}/../.resol) || RESOL_ATM_3D=96x95x39
+
+    RESOL_ATM_Z=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $3}' )
+    RESOL_ATM_X=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $1}' )
+    RESOL_ATM_Y=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $2}' )
+    RESOL_ATM_XY="${RESOL_ATM_X}x${RESOL_ATM_Y}"
+
+    ##- LMDZ physics version
+    ##  Read LMDZ_Physics option in lmdz.card, if not present take default value AP (old physics) 
+    if [ ! X${lmdz_UserChoices_LMDZ_Physics} = X ] ; then
+	LMDZ_Physics=${lmdz_UserChoices_LMDZ_Physics}
+    else
+	LMDZ_Physics=AP
+    fi
+    echo LMDZ physics version : ${LMDZ_Physics}
+
+    ##- Create_etat0_limit version
+    ##  Define variable CREATE only if it is set in lmdz.card section UserChoices.
+    ##  This variable is only used in lmdz.card to choose input files.
+    if [ ! X${lmdz_UserChoices_CREATE} = X ] ; then
+	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices CREATE
+	CREATE=${lmdz_UserChoices_CREATE}
+	echo create_etat0_limit version : ${CREATE}
+    fi
+
+
+    ## - LMDZ choice of config.def file
+    ##   ConfType must be set in lmdz.card
+    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"
+}
+
+#-----------------------------------------------------------------
+function ATM_Update
+{
+    IGCM_debug_PushStack "ATM_Update"
+
+    ##-- GHG forcing :
+    ##   If forcing file exist in run directory, read values for the current year 
+    ##   and set in config.def. If not use the default value set in config.def
+
+    # Read value for solaire from file SOLARANDVOLCANOES.txt. If file not existing, take DEFAULT value from file. 
+    IGCM_debug_Print 1 "Note that the solaire parameter is here below changed but it is only used by LMDZ for old physics(AP and NPv3.2)"
+    IGCM_debug_Print 1 "For newer physics with iflag_rrtm=1 and ok_suntime_rrtm=y, the solar constant is instead taken from solarforcing.nc file"
+    if [ -f SOLARANDVOLCANOES.txt ] ; then
+	value=`grep Annee_${year} SOLARANDVOLCANOES.txt | awk -F= '{print $2}'`
+	if [ X"${value}" = X ] ; then
+	    # The grep returned empty variable, stop execution
+	    IGCM_debug_Exit "The file SOLARANDVOLCANOES.txt do not contain the current year."
+	    IGCM_debug_Verif_Exit
+	fi
+    else
+	value=DEFAULT
+    fi
+    IGCM_comp_modifyDefFile nonblocker config.def solaire $value
+
+    # Read value for eccentricity from file Eccentricity.txt. If file not existing, take DEFAULT value from file.
+    if [ -f Eccentricity.txt ] ; then
+	value=`grep Annee_${year} Eccentricity.txt | awk -F= '{print $2}'`
+	if [ X"${value}" = X ] ; then
+	    # The grep returned empty variable, stop execution
+	    IGCM_debug_Exit "The file Eccentricity.txt do not contain the current year."
+	    IGCM_debug_Verif_Exit
+	fi
+    else
+	value=DEFAULT
+    fi
+    IGCM_comp_modifyDefFile nonblocker config.def R_ecc $value
+
+    # Read value for obliquity from file Obliquity.txt. If file not existing, take DEFAULT value from file.
+    if [ -f Obliquity.txt ] ; then
+	value=`grep Annee_${year} Obliquity.txt | awk -F= '{print $2}'`
+	if [ X"${value}" = X ] ; then
+	    # The grep returned empty variable, stop execution
+	    IGCM_debug_Exit "The file Obliquity.txt do not contain the current year."
+	    IGCM_debug_Verif_Exit
+	fi
+    else
+	value=DEFAULT
+    fi
+    IGCM_comp_modifyDefFile nonblocker config.def R_incl $value
+
+    # Read value for perihelie from file Perihelie.txt. If file not existing, take DEFAULT value from file.
+    if [ -f Perihelie.txt ] ; then
+	value=`grep Annee_${year} Perihelie.txt | awk -F= '{print $2}'`
+	if [ X"${value}" = X ] ; then
+	    # The grep returned empty variable, stop execution
+	    IGCM_debug_Exit "The file Perihelie.txt do not contain the current year."
+	    IGCM_debug_Verif_Exit
+	fi
+    else
+	value=DEFAULT
+    fi
+    IGCM_comp_modifyDefFile nonblocker config.def R_peri $value
+
+    # Read value for co2_ppm from file CO2.txt. If file not existing, take DEFAULT value from file. 
+    # Calculate co2_ppm_per as co2_ppm*4.
+    if [ -f CO2.txt ] ; then
+       	value=`grep Annee_${year} CO2.txt | awk -F= '{print $2}'`
+	if [ X"${value}" = X ] ; then
+	    # The grep returned empty variable, stop execution
+	    IGCM_debug_Exit "The file CO2.txt do not contain the current year."
+	    IGCM_debug_Verif_Exit
+	fi
+	value4=`grep Annee_${year} CO2.txt | awk -F= '{print $2 * 4}'`
+    else
+	value=DEFAULT
+	value4=DEFAULT
+    fi
+    IGCM_comp_modifyDefFile nonblocker config.def co2_ppm $value
+    IGCM_comp_modifyDefFile nonblocker config.def co2_ppm_per $value4
+
+
+    # Read value for CH4_ppb from file CH4.txt. If file not existing, take DEFAULT value from file. 
+    if [ -f CH4.txt ] ; then
+	value=`grep Annee_${year} CH4.txt | awk -F= '{print $2}'`
+	if [ X"${value}" = X ] ; then
+	    # The grep returned empty variable, stop execution
+	    IGCM_debug_Exit "The file CH4.txt do not contain the current year."
+	    IGCM_debug_Verif_Exit
+	fi
+    else
+	value=DEFAULT
+    fi
+    IGCM_comp_modifyDefFile nonblocker config.def CH4_ppb $value
+
+
+    # Read value for N2O_ppb from file N2O.txt. If file not existing, take DEFAULT value from file. 
+    if [ -f N2O.txt ] ; then
+	value=`grep Annee_${year} N2O.txt | awk -F= '{print $2}'`
+	if [ X"${value}" = X ] ; then
+	    # The grep returned empty variable, stop execution
+	    IGCM_debug_Exit "The file N2O.txt do not contain the current year."
+	    IGCM_debug_Verif_Exit
+	fi
+    else
+	value=DEFAULT
+    fi
+    IGCM_comp_modifyDefFile nonblocker config.def N2O_ppb $value
+
+    # Read value for CFC11_ppt from file CFC11.txt. If file not existing, take DEFAULT value from file. 
+    if [ -f CFC11.txt ] ; then
+	value=`grep Annee_${year} CFC11.txt | awk -F= '{print $2}'`
+	if [ X"${value}" = X ] ; then
+	    # The grep returned empty variable, stop execution
+	    IGCM_debug_Exit "The file CFC11.txt do not contain the current year."
+	    IGCM_debug_Verif_Exit
+	fi
+    else
+	value=DEFAULT
+    fi
+    IGCM_comp_modifyDefFile nonblocker config.def CFC11_ppt $value
+
+
+    # Read value for CFC12_ppt from file CFC12.txt. If file not existing, take DEFAULT value from file. 
+    if [ -f CFC12.txt ] ; then
+	value=`grep Annee_${year} CFC12.txt | awk -F= '{print $2}'`
+	if [ X"${value}" = X ] ; then
+	    # The grep returned empty variable, stop execution
+	    IGCM_debug_Exit "The file CFC12.txt do not contain the current year."
+	    IGCM_debug_Verif_Exit
+	fi
+    else
+	value=DEFAULT
+    fi
+    IGCM_comp_modifyDefFile nonblocker config.def CFC12_ppt $value
+
+
+    ## Coupling Time Step : Take value of FreqCoupling set in oasis.card or if it is not set, take default value 86400
+    LMDZ_t_coupl=${oasis_UserChoices_FreqCoupling:-86400}
+    IGCM_debug_Print 3 "LMDZ_t_coupl "   ${LMDZ_t_coupl}
+    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.
+    else
+	IGCM_comp_modifyXmlFile nonblocker file_def_histstrataer_lmdz.xml histstrataer enabled .FALSE.
+    fi
+
+
+    ## run.def parameters
+
+
+    ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def
+    if [ ${CumulPeriod} -eq 1 ] ; then
+	IGCM_comp_modifyDefFile blocker run.def raz_date  1
+    else
+	IGCM_comp_modifyDefFile blocker run.def raz_date  0
+    fi
+
+    ##-- Calendar type for LMDZ and create_etat0_limit
+    case ${config_UserChoices_CalendarType} in
+        leap|gregorian)
+	    IGCM_comp_modifyDefFile blocker run.def calend  gregorian ;;
+        noleap)
+	    IGCM_comp_modifyDefFile blocker run.def calend  earth_365d ;;
+        360d)
+	    IGCM_comp_modifyDefFile blocker run.def calend  earth_360d ;;
+        *)
+	    IGCM_comp_modifyDefFile blocker run.def calend  earth_360d ;;
+    esac
+
+    IGCM_comp_modifyDefFile blocker run.def dayref    ${InitDay}
+    IGCM_comp_modifyDefFile blocker run.def nday      ${PeriodLengthInDays}
+
+    # Set anneeref different for gcm and ce0l
+    # Test if executable create_etat0_limit is present and lmdz.x is not present
+    if [ -f create_etat0_limit* ] || [ -f ce0l* ] && [ ! -f lmdz.x ] ; then
+	# for case ce0l : always take current year
+	IGCM_comp_modifyDefFile blocker run.def anneeref ${year}
+
+        # Temporary, set use_filtre_fft=n because we now use dyn3d for ce0l version where fft is not implemented. 
+        # In more recent versions of LMDZ, this will not be needed. 
+	IGCM_comp_modifyDefFile force   run.def use_filtre_fft n
+    else
+	# for case gcm : take first year of simulation
+	IGCM_comp_modifyDefFile blocker run.def anneeref ${InitYear}
+    fi
+
+    ## Determine from the variable ListOfComponents in config.card coupling to external models 
+    ## and set corresponding parameters in run.def
+    echo ListOfComponents now running : ${config_ListOfComponents[*]}
+
+    if [ X${config_ListOfComponents_SRF} = Xorchidee ] ; then
+	echo "Activate ORCHIDEE, set VEGET=y in run.def"
+	IGCM_comp_modifyDefFile blocker run.def VEGET y
+    else
+	echo "No ORCHIDEE, set VEGET=n in run.def"
+	IGCM_comp_modifyDefFile blocker run.def VEGET n
+    fi
+
+    if [ X${config_ListOfComponents_CPL} = Xoasis ] ; then
+	echo "Activate coupling to ocean, set type_ocean=couple in run.def"
+	IGCM_comp_modifyDefFile blocker run.def type_ocean couple
+    else
+	echo "LMDZ is running in forced mode without ocean model, set type_ocean=force in run.def"
+	IGCM_comp_modifyDefFile nonblocker run.def type_ocean force
+    fi
+
+    if [ X${config_ListOfComponents_CHM} = Xinca ] ; then
+	echo "Activate coupling to INCA, set type_trac=inca in run.def"
+	IGCM_comp_modifyDefFile blocker run.def type_trac inca
+    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
+    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}
+    else
+	IGCM_comp_modifyDefFile nonblocker run.def iflag_phytrac 0
+    fi 
+
+    # physiq.def : Activate the call to phytrac 
+    if [ ! X${lmdz_UserChoices_ok_bug_cv_trac} = X ]; then 
+	IGCM_comp_modifyDefFile nonblocker physiq.def ok_bug_cv_trac  ${lmdz_UserChoices_ok_bug_cv_trac}
+    else
+	IGCM_comp_modifyDefFile nonblocker physiq.def ok_bug_cv_trac  n
+    fi 
+
+    # config.def : Activate direct radiative effect if ok_ade=y
+    if [ ! X${lmdz_UserChoices_ok_ade} = X ]; then 
+	IGCM_comp_modifyDefFile nonblocker config.def ok_ade ${lmdz_UserChoices_ok_ade}
+    else
+	IGCM_comp_modifyDefFile nonblocker config.def ok_ade n
+    fi 
+
+    # config.def : Activate indirect radiative effect if ok_aie=y
+    if [ ! X${lmdz_UserChoices_ok_aie} = X ]; then 
+	IGCM_comp_modifyDefFile nonblocker config.def ok_aie ${lmdz_UserChoices_ok_aie}
+    else
+	IGCM_comp_modifyDefFile nonblocker config.def ok_aie n
+    fi 
+
+    # config.def : Activate online aerosol coupled model if aerosol_couple=y
+    if [ ! X${lmdz_UserChoices_aerosol_couple} = X ]; then 
+	IGCM_comp_modifyDefFile nonblocker config.def aerosol_couple ${lmdz_UserChoices_aerosol_couple}
+    else
+	IGCM_comp_modifyDefFile nonblocker config.def aerosol_couple n
+    fi 
+
+    # config.def : Activate online Ozone chemistry coupled model if chemistry_couple=y
+    if [ ! X${lmdz_UserChoices_chemistry_couple} = X ]; then 
+	IGCM_comp_modifyDefFile nonblocker config.def chemistry_couple ${lmdz_UserChoices_chemistry_couple}
+    else
+	IGCM_comp_modifyDefFile nonblocker config.def chemistry_couple n
+    fi 
+
+    # config.def : Activate reading of ozone in climatology if read_climoz=2
+    if [ ! X${lmdz_UserChoices_read_climoz} = X ]; then 
+	IGCM_comp_modifyDefFile nonblocker config.def read_climoz ${lmdz_UserChoices_read_climoz}
+    else
+	IGCM_comp_modifyDefFile nonblocker config.def read_climoz 0	
+    fi 
+
+    # config.def : Choose aerosol use in radiative effect 
+    #  type of coupled aerosol =1 (default) =2 => bc  only =3 => pom only =4 => seasalt only 
+    # =5 => dust only =6 => all aerosol    
+    if [ ! X${lmdz_UserChoices_flag_aerosol} = X ]; then 
+	IGCM_comp_modifyDefFile nonblocker config.def flag_aerosol ${lmdz_UserChoices_flag_aerosol}
+    else
+	IGCM_comp_modifyDefFile nonblocker config.def flag_aerosol 0
+    fi 
+
+    # config.def : Activate calcul of Cloud droplet number concentration if ok_cdnc=y
+    if [ ! X${lmdz_UserChoices_ok_cdnc} = X ]; then 
+	IGCM_comp_modifyDefFile nonblocker config.def ok_cdnc ${lmdz_UserChoices_ok_cdnc}
+    else
+	IGCM_comp_modifyDefFile nonblocker config.def ok_cdnc n	
+    fi 
+
+    # config.def : Activate COSP
+    if [ ! X${lmdz_UserChoices_LMDZ_COSP_OK} = X ]; then 
+	IGCM_comp_modifyDefFile nonblocker config.def ok_cosp ${lmdz_UserChoices_LMDZ_COSP_OK}
+    else
+	IGCM_comp_modifyDefFile nonblocker config.def ok_cosp n	
+    fi 
+
+    # config.def : Modify parameter pmagic if it is set in lmdz.card
+    if [ ! X${lmdz_UserChoices_pmagic} = X ]; then 
+	IGCM_comp_modifyDefFile nonblocker config.def pmagic ${lmdz_UserChoices_pmagic}
+    else
+	# Take default value set in config.def
+	IGCM_comp_modifyDefFile nonblocker config.def pmagic DEFAULT
+    fi 
+
+    # physiq.def : Modify parameter tau_gl if it is set in lmdz.card
+    if [ ! X${lmdz_UserChoices_tau_gl} = X ]; then 
+	IGCM_comp_modifyDefFile nonblocker physiq.def tau_gl ${lmdz_UserChoices_tau_gl}
+    else
+	# Take default value set in physiq.def
+	IGCM_comp_modifyDefFile nonblocker physiq.def tau_gl DEFAULT
+    fi
+   
+
+    # guide.def : Activate nudging if ok_guide=y set in lmdz.card
+    if [ ! X${lmdz_UserChoices_ok_guide} = X ] ; then
+	IGCM_comp_modifyDefFile nonblocker guide.def ok_guide  ${lmdz_UserChoices_ok_guide}
+    else
+	IGCM_comp_modifyDefFile nonblocker guide.def ok_guide n
+    fi
+
+
+    ## Read ByPass_hgardfou_teta option in lmdz.card --> divide teta* by 2 if [ $ByPass_hgardfou_teta = 1 ]
+    ByPass_hgardfou_teta=${lmdz_UserChoices_ByPass_hgardfou_teta}
+    if [ X"${ByPass_hgardfou_teta}" = X"y" ] ; then
+	awk '{ if ($0 ~ /^teta.*=/) {split($0,a,"=") ; print a[1]"="a[2]/2"."} else print $0}' gcm.def > gcm.def.tmp
+	IGCM_sys_Mv gcm.def.tmp gcm.def
+	echo
+	IGCM_debug_Print 1 "ByPass_hgardfou_teta : ^teta*/2 in gcm.def"
+	echo
+	cat gcm.def
+	ByPass_hgardfou_teta=n
+	IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_teta "${ByPass_hgardfou_teta}"
+    fi
+
+    ## Read ByPass_hgardfou_mats option in lmdz.card --> purmats=y 2 if [ $ByPass_hgardfou_mats = 1 ]
+    ByPass_hgardfou_mats=${lmdz_UserChoices_ByPass_hgardfou_mats}
+    if [ X"${ByPass_hgardfou_mats}" = X"y" ] ; then
+	sed -e "s/^purmats=.*/purmats=y/" gcm.def > gcm.def.tmp
+        IGCM_sys_Mv gcm.def.tmp gcm.def
+        echo
+        IGCM_debug_Print 1 "ByPass_hgardfou_mats : purmats=y in gcm.def"
+        echo
+        cat gcm.def
+        ByPass_hgardfou_mats=n
+        IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_mats "${ByPass_hgardfou_mats}"
+    fi
+
+    # Add include of LMDZ context in iodef.xml
+    # In iodef.xml add on the next line after "COMPONENT CONTEXT"
+    echo '<context id="LMDZ" src="./context_lmdz.xml"/>' > add.tmp
+    # Add inclusion of file context_input_lmdz.xml if this file exists
+    if [ -f context_input_lmdz.xml ] ; then
+        echo '<context id="LMDZ" src="./context_input_lmdz.xml"/>' >> add.tmp
+    fi
+    # Include xml files for output configuration if running with workflow CMIP6
+    if [ X"$( echo ${config_UserChoices_ExpType} | grep CMIP6 )" != "X" ] ; then
+	echo '<context id="LMDZ" src="./ping_lmdz.xml"/>' >> add.tmp
+	echo '<context id="LMDZ" src="./dr2xml_lmdz.xml"/>' >> add.tmp
+    fi
+    cp iodef.xml iodef.xml.tmp
+    sed -e "/COMPONENT CONTEXT/r add.tmp" iodef.xml.tmp > iodef.xml
+    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*lmdz.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
+
+    #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
+        sed -i -e "s/\(compression_level=\"\)[^\"]*\(\"\)/\1${config_UserChoices_CompressionLevel}\2/" ${file}
+    done
+    fi
+
+            
+    IGCM_debug_PopStack "ATM_Update"
+}
+
+#-----------------------------------
+function ATM_Finalize
+{
+    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_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: CMIP6/DCPP-A/DRIVER/oasis.driver
===================================================================
--- CMIP6/DCPP-A/DRIVER/oasis.driver	(revision 5840)
+++ CMIP6/DCPP-A/DRIVER/oasis.driver	(revision 5840)
@@ -0,0 +1,169 @@
+#!/bin/ksh
+#-----------------------------------
+CPL_Initialize ()
+{
+    IGCM_debug_PushStack "CPL_Initialize"
+ 
+    echo INITIALIZE CPL !!!
+
+# Local function to find parameters in LMDZ .def files
+    lmdzgrep () {
+        grep $1 $2 |grep -v "#" | awk "-F=" '{print $2}' | awk "-F " '{print $1}'
+    }
+
+    #RESOL_CPL=$( echo $RESOL | awk "-F-" '{print $1}' )
+    RESOL_CPL=${RESOL_OCE}x${RESOL_ATM}
+    IGCM_debug_Print 1 "RESOL_CPL      : ${RESOL_CPL}"
+
+    CPL_OkDay="n"
+    CPL_OkMonth="n"
+
+    for CPL_Frequency in ${config_CPL_WriteFrequency} ; do
+	case ${CPL_Frequency} in
+	    *D|*d) CPL_OkDay="y"   ;;
+	    *M)    CPL_OkMonth="y" ;;
+	esac
+    done
+
+    # Initialisation required for AddNoise done during one Period
+    Test_AddNoise_First_Only=y
+
+    IGCM_debug_PopStack "CPL_Initialize"
+
+}
+
+#-----------------------------------
+CPL_Update ()
+{
+    IGCM_debug_PushStack "CPL_Update"
+
+    ############ Update Time and Counters ##############
+    ##-- Calcul de la duree du job (en secondes)
+    (( D_JOB_SEC = 3600 * 24 * PeriodLengthInDays ))
+
+    ############ Update Other Parameters  ##############
+    ## Read Output_mode option in oasis.card --> Put "y" to have coupling variables in ouptut files
+    CPL_OutputMode="n"
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/oasis.card UserChoices OutputMode 
+    eval CPL_OutputMode=\${oasis_UserChoices_OutputMode} > /dev/null 2>&1
+    echo CPL_OutputMode = ${CPL_OutputMode}
+    CPL_OutputVar='EXPORTED'
+    if [ ${CPL_OutputMode} = y ] ; then
+	CPL_OutputVar='EXPOUT'
+    fi
+
+    FreqCoupling=${oasis_UserChoices_FreqCoupling:-86400}
+    FreqCouplingRoffCalv=${oasis_UserChoices_FreqCouplingRoffCalv:-86400}
+
+    ## Calculate lag for transfer of fields from atmosphere -> ocean.
+    ## LagAtm="1day in sec"/day_step * iphysiq/nsplit_phys
+    ## First get day_step, iphyisq and nsplit_phys from LMDZ parameter files
+    day_step=$(    lmdzgrep day_step gcm.def )
+    iphysiq=$(     lmdzgrep iphysiq gcm.def )
+    nsplit_phys=$( lmdzgrep nsplit_phys physiq.def )
+
+    IGCM_debug_Print 3 "Parametre de calcul Lag LMDZ recuperes " ${day_step} ${iphysiq} ${nsplit_phys}
+
+    [[ ${nsplit_phys} -eq 0 || "X${nsplit_phys}" = "X" ]] && nsplit_phys=1
+
+    IGCM_debug_Print 3 "Parametre de calcul Lag LMDZ mis a jour " ${day_step} ${iphysiq} ${nsplit_phys}
+                                                              
+    (( LagAtm = 86400 * iphysiq / day_step / nsplit_phys ))
+    (( LagAtmRoffCalv = $FreqCoupling + $LagAtm ))
+    (( LagOce = 86400 / OPA_NPDT_DAY ))
+
+    IGCM_debug_Print 1 "OPA_NPDT_DAY : ${OPA_NPDT_DAY}"
+    IGCM_debug_Print 1 "LagAtm        : ${LagAtm}"
+    IGCM_debug_Print 1 "LagAtmRoffCalv : ${LagAtmRoffCalv}"
+    IGCM_debug_Print 1 "LagOce        : ${LagOce}"
+
+    ## Use of Lucia ##
+    lucia_ok=""
+    if [ ${oasis_UserChoices_Lucia} = y ] ; then
+	lucia_ok="-1"
+    fi
+    
+    ############ Update Parameter Files   ##############
+    sed -e "s/<total_time>/${D_JOB_SEC}/" \
+	-e "s/<lucia_ok>/${lucia_ok}/" \
+	-e "s/<output_mode>/${CPL_OutputVar}/g" \
+	-e "s/<freq_coupling>/${FreqCoupling}/g" \
+	-e "s/<freq_coupling_roff_calv>/${FreqCouplingRoffCalv}/g" \
+	-e "s/<lag_atm>/${LagAtm}/g" \
+	-e "s/<lag_atm_roff_calv>/${LagAtmRoffCalv}/g" \
+	-e "s/<lag_oce>/${LagOce}/g" \
+	namcouple > namcouple.tmp
+    IGCM_sys_Mv namcouple.tmp namcouple
+    # For IPSLCM6 and use of OASIS-MCT
+    if [ ${CumulPeriod} -eq 1 ]; then
+	ncrename -v OIceFrac,OIceFrc sstoc.nc > /dev/null 2>&1
+    fi
+    # For use of XIOS
+    IGCM_comp_modifyXmlFile force iodef.xml using_oasis NONE true
+
+    if [ X"${Test_AddNoise_First_Only}" = X"y" ]; then
+
+    Test_AddNoise_First_Only=n
+
+    # AddNoise if required but only for one Period
+
+    # Read ByPass_addnoise_sst option in oasis.card --> apply addnoise for sst in CPL restart file if [ $ByPass_addnoise_sst = y ]
+    ByPass_addnoise_sst=${oasis_UserChoices_ByPass_addnoise_sst}
+    if [ X"${ByPass_addnoise_sst}" = X"y" ] ; then
+      
+      ByPass_PerturbExe=${oasis_UserChoices_ByPass_PerturbExe}
+      ByPass_FileOut=${oasis_UserChoices_ByPass_FileOut}
+      ByPass_PerturbVar=${oasis_UserChoices_ByPass_PerturbVar}
+      ByPass_PerturbAmp=${oasis_UserChoices_ByPass_PerturbAmp}
+
+      IGCM_sys_Chmod 644 ${RUN_DIR}/${ByPass_FileOut}.nc
+      IGCM_debug_Print 1 "${ByPass_PerturbExe} ${RUN_DIR}/${ByPass_FileOut}.nc ${ByPass_PerturbVar} ${ByPass_PerturbAmp}"
+
+      ${ByPass_PerturbExe} ${RUN_DIR}/${ByPass_FileOut}.nc ${ByPass_PerturbVar} ${ByPass_PerturbAmp} 
+      if [ $? -ne 0 ] ; then
+        IGCM_debug_Exit "Error with $( basename ${ByPass_PerturbExe} )"
+        IGCM_debug_Verif_Exit
+      fi
+
+      echo
+      IGCM_debug_Print 1 "ByPass_addnoise_sst : applied addnoise for sst in CPL restart file"
+      echo
+      ByPass_addnoise_sst=n
+      # necessary to reset ByPass in next Period during the same Job (PeriodNb<>1)
+      export oasis_UserChoicesByPass_addnoise_sst=n
+      IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/oasis.card UserChoices ByPass_addnoise_sst "${ByPass_addnoise_sst}"
+    fi
+
+    fi
+
+    IGCM_debug_PopStack "CPL_Update"
+}
+
+#-----------------------------------
+CPL_Finalize ()
+{
+    IGCM_debug_PushStack "CPL_Finalize"
+
+    if [ "${CPL_OutputMode}" = "y" ] ; then
+
+        [[ ${CPL_OkDay}   = "y" ]] && date >TEMPO_1D_cpl_atm.nc
+        [[ ${CPL_OkMonth} = "y" ]] && date >TEMPO_1M_cpl_atm.nc
+        [[ ${CPL_OkDay}   = "y" ]] && date >TEMPO_1D_cpl_oce.nc
+        [[ ${CPL_OkMonth} = "y" ]] && date >TEMPO_1M_cpl_oce.nc
+
+    fi
+
+    ## Use of Lucia ##
+    if [ ${oasis_UserChoices_Lucia} = y ] ; then
+	echo "Use of LUCIA"
+    #   To be changed 
+    #   On Curie
+    #   /ccc/scratch/cont003/dsm/p86caub/LUCIA/lucia
+    #   On Ada
+    #   /linkhome/rech/psl/rpsl035/LUCIA/lucia
+    fi
+
+    echo FINALIZE CPL !!!
+
+    IGCM_debug_PopStack "CPL_Finalize"
+}
Index: CMIP6/DCPP-A/DRIVER/opa9.driver
===================================================================
--- CMIP6/DCPP-A/DRIVER/opa9.driver	(revision 5840)
+++ CMIP6/DCPP-A/DRIVER/opa9.driver	(revision 5840)
@@ -0,0 +1,293 @@
+#!/bin/ksh
+#-----------------------------------------------------------------
+function OCE_Initialize
+{
+    IGCM_debug_PushStack "OCE_Initialize"
+
+    JOB_NAME=${config_UserChoices_JobName}
+
+    RESOL_OCE_ICE=$( echo ${RESOL} | awk "-Fx" '{print $1}' )
+    case ${RESOL_OCE_ICE} in
+	( *LIM2* ) SEAICE_MODEL=LIM2 ; 	LIM_VERSION=2 ;;
+	( *LIM3* ) SEAICE_MODEL=LIM3 ; 	LIM_VERSION=3 ;;
+	( *CICE* ) SEAICE_MODEL=CICE                  ;;
+	( *      ) SEAICE_MODEL=UNKNOWN               ;;
+    esac
+    RESOL_OCE=$( echo ${RESOL_OCE_ICE} | sed "s/${SEAICE_MODEL}//" )
+
+    IGCM_debug_Print 1 "RESOL          : ${RESOL}"
+    IGCM_debug_Print 1 "RESOL_OCE_ICE  : ${RESOL_OCE_ICE}"
+    IGCM_debug_Print 1 "SEAICE_MODEL   : ${SEAICE_MODEL}"
+    IGCM_debug_Print 1 "LIM_VERSION    : ${LIM_VERSION}"
+    IGCM_debug_Print 1 "RESOL_OCE      : ${RESOL_OCE}"
+
+    # Local function to find namelists parameters
+    #supergrep () { grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%" ; }
+    supergrep () { grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%" -e "s%^ *$1 *=%%" ; }
+    ##--Variables used by OPA --
+    NAMELIST_OPA_CFG=${SUBMIT_DIR}/PARAM/namelist_${RESOL_OCE}_cfg
+    IGCM_debug_Print 1 "namelist_cfg : ${NAMELIST_OPA_CFG}"
+    if [ ! -r ${NAMELIST_OPA_CFG} ] ; then
+        IGCM_debug_Exit "${NAMELIST_OPA_CFG} not found"
+	IGCM_debug_Verif_Exit
+    fi
+    OPA_RDT=$(       supergrep rn_rdt        ${NAMELIST_OPA_CFG} )
+    OPA_NN_FSBC=$(   supergrep nn_fsbc       ${NAMELIST_OPA_CFG} )
+    #
+    # OPA_RDT=$(       supergrep rn_rdt        namelist_cfg )
+    # OPA_NN_FSBC=$(   supergrep nn_fsbc       namelist_cfg )
+    (( OPA_NPDT_DAY   =  86400 / OPA_RDT        ))
+    (( OPA_NPDT_YEAR  =  OPA_NPDT_DAY * 365     ))
+    (( OPA_RDT_SBC    =  OPA_RDT * OPA_NN_FSBC ))
+ 
+    # Period Length In Days between DateBegin and first day of calendar 0001 01 01
+    # /!\ Needed by OPA namelist to compute file names /!\
+    (( DaysSinceJC = $( IGCM_date_DaysSinceJC ${DateBegin} ) + 1 ))
+
+    IGCM_debug_Print 1 " "
+    IGCM_debug_Print 1 "OPA_RDT        ${OPA_RDT}"
+    IGCM_debug_Print 1 "OPA_NN_FSBC    ${OPA_NN_FSBC}"
+    IGCM_debug_Print 1 "OPA_RDT_SBC    ${OPA_RDT_SBC}"
+    IGCM_debug_Print 1 "OPA_NPDT_DAY   ${OPA_NPDT_DAY}"
+    IGCM_debug_Print 1 "OPA_NPDT_YEAR  ${OPA_NPDT_YEAR}"
+    IGCM_debug_Print 1 "DaysSinceJC    ${DaysSinceJC}"
+
+    ## Check that nn_fsbc is correct compare to coupling frequency
+    FreqCoupling=${oasis_UserChoices_FreqCoupling:-86400}
+    
+    ## This informations are used for diaptr, trends and diagap files
+    ## only the first frequency is used for this files
+    
+    IGCM_debug_Print 1 "FreqCoupling    ${FreqCoupling}"
+    IGCM_debug_Print 1 "OPA_NN_FSBC    ${OPA_NN_FSBC}"
+    IGCM_debug_Print 1 "OPA_RDT        ${OPA_RDT}"
+    IGCM_debug_Print 1 "OPA_RDT_SBC    ${OPA_RDT_SBC}"
+    
+    if [[ ${OPA_RDT_SBC} -gt ${FreqCoupling} ]] ; then
+	IGCM_debug_Exit "OPA_RDT_SBC=${OPA_RDT_SBC} is greater than FreqCoupling=${FreqCoupling}"
+     	IGCM_debug_Verif_Exit
+    fi
+
+    IGCM_debug_PopStack "OCE_Initialize"
+   
+}
+
+#-----------------------------------------------------------------
+function OCE_Update
+{
+    IGCM_debug_PushStack "OCE_Update"
+  
+    ##--Write Frequency for iomput
+    ## Differents frequencies are allowed for OCE files
+
+    V1D_ENABLE=".FALSE."
+    V5D_ENABLE=".FALSE."
+    V1M_ENABLE=".FALSE."
+    V1Y_ENABLE=".FALSE."
+
+    for frequency in ${config_OCE_WriteFrequency} ; do
+        case ${frequency} in
+            ( 1D|1d ) V1D_ENABLE=".TRUE." ;;
+            ( 5D|5d ) V5D_ENABLE=".TRUE." ;;
+            ( 1M|1m ) V1M_ENABLE=".TRUE." ;;
+            ( *[yY] ) V1Y_ENABLE=".TRUE." ;;
+        esac
+    done
+
+    # Period Length In Days between DateBegin and first day of calendar 0001 01 01
+    # Needed by OPA namelist to compute correct file names 
+    (( PeriodDaysSinceJC =  $( IGCM_date_DaysSinceJC ${PeriodDateBegin} ) + 1  ))
+
+    ##-- Number of time steps updated : the first, the last and the number of time steps
+    (( OPA_NIT000 = ( PeriodDaysSinceJC - DaysSinceJC ) * OPA_NPDT_DAY + 1 ))
+    (( OPA_NPDT   = PeriodLengthInDays * OPA_NPDT_DAY ))
+    (( OPA_NITEND = OPA_NIT000 + OPA_NPDT - 1))
+
+    ##-- We force one restart file at the end of the trunk
+    OPA_NSTOCK="${OPA_NITEND}"
+
+
+    ##-- Additionnal Restart Option to force reproducibility ; force kt to kt red in restart file
+    ## ${opa9_UserChoices_Reproducibility_after_restart}
+
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/opa9.card UserChoices Reproducibility_after_restart
+
+   ##-- Restart configuration
+    if ( [ "${opa9_UserChoices_Reproducibility_after_restart}" = "y" ] ) ; then
+      OPA_LRSTAR=.TRUE.
+      OPA_NRSTDT=2
+      #echo "OPA RESTART"
+      IGCM_debug_Print 1 'WARNING : dangerous option for NEMO opa9 pisces lim3'
+      IGCM_debug_Print 1 'Reproducibility_after_Restart forced ie kt forced to kt red in restart file : ' ${opa9_UserChoices_Reproducibility_after_restart}
+
+    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_OCE_Restart}" = "n" ] ) ; then
+      OPA_LRSTAR=.FALSE.
+      OPA_NRSTDT=0
+      #echo "NO OPA RESTART"
+    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_OCE_Restart}" = "y" ] ) ; then
+      OPA_LRSTAR=.TRUE.
+      OPA_NRSTDT=0
+      #echo "OPA RESTART"
+    else
+      OPA_LRSTAR=.TRUE.
+      OPA_NRSTDT=2
+      #echo "OPA RESTART"
+    fi
+
+    if ( [ "${CumulPeriod}" -eq 1 ] && [ "${opa9_UserChoices_Restart_TS_only}" = "y" ] ) ; then
+      OPA_LRSTAR_TS=.TRUE.
+    else
+      OPA_LRSTAR_TS=.FALSE.
+    fi
+
+    ##-- Meshmask option. Forced only once.
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/opa9.card UserChoices mesh_mask
+
+    OPA_NMSH=0
+    if [ "${opa9_UserChoices_mesh_mask}" = "y" ]; then
+        OPA_NMSH=1
+        IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/opa9.card UserChoices mesh_mask "n"
+    fi
+
+    # nleapy configuration
+    case ${config_UserChoices_CalendarType} in
+        ( leap|gregorian) OPA_NLEAPY=1  ;;
+        ( noleap        ) OPA_NLEAPY=0  ;;
+        ( 360d          ) OPA_NLEAPY=30 ;;
+        ( *             ) OPA_NLEAPY=30 ;;
+    esac
+
+    if ( [ "${opa9_UserChoices_Reproducibility_after_restart}" = "y" ] ) ; then
+      ##-- choose the right restart file
+      NEMO_RESTART_FILE=restartopa.nc
+      [ -f restartopa_0000.nc ] && NEMO_RESTART_FILE=restartopa_0000.nc
+      ##-- Getting from restart file the last time step of the run at which we want to re-start
+      NEMO_KT_FROM_RESTART=$(ncdump -v kt ${NEMO_RESTART_FILE}|grep 'kt ='|awk '{print $3}' )
+
+      if ( [ "${CumulPeriod}" -eq 1 ] ) ; then
+        ## Force the date in the restart file to be the last day before the begining of the new run
+        dateendprevious=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} -1 )
+        IGCM_debug_Print 1 "Previous Date  ${dateendprevious}"
+        IGCM_debug_Print 1 "cmd done to modify NEMO restartfile:   ncap2 -s ndastp=${dateendprevious} ${NEMO_RESTART_FILE}  tmp.nc"
+	if [ -f restartopa_0000.nc ] ; then
+           typeset -Z4 ncpu=0
+           while [ $ncpu -lt ${OCE_PROC_MPI} ] ; do
+              ncap2 -s "ndastp=${dateendprevious}" restartopa_${ncpu}.nc  tmp.nc
+              mv tmp.nc restartopa_${ncpu}.nc
+              (( ncpu = ncpu + 1 ))
+           done
+        else
+           ncap2 -s "ndastp=${dateendprevious}" ${NEMO_RESTART_FILE}  tmp.nc
+           mv tmp.nc ${NEMO_RESTART_FILE}
+        fi
+        ##-- Getting from restart file the "new" restart date of run at which we want to re-start
+        NEMO_NDASTP_FROM_RESTART=$(ncdump -v ndastp ${NEMO_RESTART_FILE}|grep 'ndastp ='|awk '{print $3}' )
+        IGCM_debug_Print 1 "NEMO_NDASTP (from Restart) for 1st Period       : ${NEMO_NDASTP_FROM_RESTART}"
+
+      fi
+
+      (( NEMO_NIT000 = NEMO_KT_FROM_RESTART + 1 ))
+      (( NEMO_NITEND = NEMO_KT_FROM_RESTART + OPA_NITEND - OPA_NIT000 + 1 ))
+      IGCM_debug_Print 1 "NEMO_NIT000 (from Restart)        : ${NEMO_NIT000}"
+      IGCM_debug_Print 1 "NEMO_NITEND (from Restart + ... ) : ${NEMO_NITEND}"
+      ##-- We force one restart file at the end of the trunk
+      OPA_NSTOCK="${NEMO_NITEND}"
+      OPA_NIT000="${NEMO_NIT000}"
+      OPA_NITEND="${NEMO_NITEND}"
+    fi
+
+    typeset -r PRECIS=8
+    NEMO_END=$( echo $( awk "BEGIN { printf \"%0${PRECIS}d\",${OPA_NITEND} }" ) ) 
+
+    IGCM_comp_modifyNamelist blocker    namelist_cfg cn_exp       ${config_UserChoices_JobName}
+    IGCM_comp_modifyNamelist blocker    namelist_cfg nn_it000     ${OPA_NIT000}
+    IGCM_comp_modifyNamelist blocker    namelist_cfg nn_itend     ${OPA_NITEND}
+    IGCM_comp_modifyNamelist blocker    namelist_cfg ln_rstart    ${OPA_LRSTAR}
+    IGCM_comp_modifyNamelist blocker    namelist_cfg ln_rstart_ts ${OPA_LRSTAR_TS}
+    IGCM_comp_modifyNamelist blocker    namelist_cfg nn_stock     ${OPA_NSTOCK}
+    IGCM_comp_modifyNamelist blocker    namelist_cfg nn_rstctl    ${OPA_NRSTDT}
+    IGCM_comp_modifyNamelist blocker    namelist_cfg nn_date0     ${PeriodDateBegin}
+    IGCM_comp_modifyNamelist nonblocker namelist_cfg nn_msh       ${OPA_NMSH}
+    IGCM_comp_modifyNamelist nonblocker namelist_cfg nn_rnf_depth_file  ${OPA_NMSH}
+    IGCM_comp_modifyNamelist blocker    namelist_cfg nn_leapy     ${OPA_NLEAPY}
+    
+    # Update iodef.xml
+
+    IGCM_debug_Print 1 'Informations into iodef.xml : V1D_ENABLE V5D_ENABLE V1M_ENABLE V1Y_ENABLE '
+    IGCM_debug_Print 1 ${V1D_ENABLE}  ${V5D_ENABLE} ${V1M_ENABLE} ${V1Y_ENABLE}
+
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-opa.xml 1d_opa enabled ${V1D_ENABLE}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-opa.xml 5d_opa enabled ${V5D_ENABLE}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-opa.xml 1m_opa enabled ${V1M_ENABLE}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-opa.xml 1y_opa enabled ${V1Y_ENABLE}
+
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-opa.xml 1d_opa output_level ${opa9_UserChoices_OutputLevel}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-opa.xml 5d_opa output_level ${opa9_UserChoices_OutputLevel}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-opa.xml 1m_opa output_level ${opa9_UserChoices_OutputLevel}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-opa.xml 1y_opa output_level ${opa9_UserChoices_OutputLevel}
+
+
+    # Update reference year/month/day
+    IGCM_date_GetYearMonthDay ${DateBegin} iyear imonth iday
+    IGCM_comp_modifyXmlFile force context_nemo.xml ref_year  NONE ${iyear} 
+    IGCM_comp_modifyXmlFile force context_nemo.xml ref_month NONE ${imonth} 
+    IGCM_comp_modifyXmlFile force context_nemo.xml ref_day   NONE ${iday} 
+    
+    
+    # for MPP and switch to different number of procs for NEMO.  We need to suppres restartopa the second period, if restartopa_0000 exist
+    # same thing for restart_trc and restart_ice_in
+
+    for restartfilenemo in restartopa restart_trc restart_ice_in ; do
+      [ -f ${restartfilenemo}.nc ] && [ -f ${restartfilenemo}_0000.nc ] && IGCM_sys_Rm -f ${restartfilenemo}.nc
+    done
+
+    # Add include of nemo context in iodef.xml
+    # In iodef.xml add on next line after "COMPONENT CONTEXT"
+    #  <context id="nemo" src="./context_nemo.xml"/>
+    echo '<context id="nemo" src="./context_nemo.xml"/>' > add.tmp
+    if [ X"$( echo ${config_UserChoices_ExpType} | grep CMIP6 )" != "X" ] ; then
+	echo '<context id="nemo" src="./ping_nemo.xml"/>' >> add.tmp
+	echo '<context id="nemo" src="./dr2xml_opa9.xml"/>' >> add.tmp
+    fi
+    cp iodef.xml iodef.xml.tmp
+    sed -e "/COMPONENT CONTEXT/r add.tmp" \
+        iodef.xml.tmp > iodef.xml
+    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_nemo*.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
+
+    #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_nemo*.xml)
+    	for file in ${listfile}
+    	do
+	    sed -i -e "s/\(compression_level=\"\)[^\"]*\(\"\)/\1${config_UserChoices_CompressionLevel}\2/" ${file}
+    	done
+    fi
+
+
+    IGCM_debug_PopStack "OCE_Update"
+}
+
+#-----------------------------------
+function OCE_Finalize
+{
+    IGCM_debug_PushStack "OCE_Finalize"
+
+    IGCM_debug_Print 1 FINALIZE OCE !!!
+
+    IGCM_debug_PopStack "OCE_Finalize"
+}
Index: CMIP6/DCPP-A/DRIVER/orchidee.driver
===================================================================
--- CMIP6/DCPP-A/DRIVER/orchidee.driver	(revision 5840)
+++ CMIP6/DCPP-A/DRIVER/orchidee.driver	(revision 5840)
@@ -0,0 +1,189 @@
+#!/bin/ksh
+## Driver for the component SRF corresponding to the sechiba part of ORCHIDEE
+#-----------------------------------------------------------------
+function SRF_Initialize
+{
+    IGCM_debug_PushStack "SRF_Initialize"
+
+    ##- Define variable DefSuffix set in orchidee.card
+    ##  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}
+    else
+        DefSuffix=CWRR
+    fi
+
+    IGCM_debug_PopStack "SRF_Initialize"
+}
+
+#-----------------------------------------------------------------
+function SRF_Update
+{
+    IGCM_debug_PushStack "SRF_Update"
+
+    ## 1. Modifications in orchidee.def parameter file
+
+    # Activate STOMATE if the compontent SBG=stomate is set in config.card
+    if [ X${config_ListOfComponents_SBG} = Xstomate ] ; then
+	# Activate stomate in orchidee.def
+        IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_OK_STOMATE y
+    else
+	# Deactivate stomate in orchidee.def
+        IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_OK_STOMATE n
+	# Deactivate output files for stomate
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 enabled .FALSE.
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_level 0
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_freq 1mo
+        IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 enabled .FALSE.
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_level 0
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_freq 1mo
+    fi
+
+    # Define in orchidee.def if restart file should be used
+    if ( [ ${CumulPeriod} -ne 1 ] || [ "${config_SRF_Restart}" != "n" ] ) ; then
+        IGCM_comp_modifyDefFile blocker orchidee.def SECHIBA_restart_in sechiba_rest_in.nc
+    else
+        IGCM_comp_modifyDefFile blocker orchidee.def SECHIBA_restart_in NONE
+    fi
+
+    # Set VEGET_UPDATE=1Y in orchidee.def if VEGET_UPDATE_at_start=y in orchidee.card and if it is the first cumul periond (start of new simulation)
+    if [ X${orchidee_UserChoices_VEGET_UPDATE_at_start} = Xy ] && [ ${CumulPeriod} -eq 1 ] ; then
+        IGCM_comp_modifyDefFile nonblocker orchidee.def VEGET_UPDATE   1Y
+    fi
+
+    # Modify in orchidee.def VEGET_UPDATE if it is set in orchidee.card section UserChoices
+    # Note: if the variable has been set by VEGET_UPDATE_at_start, this section will not overwrite it.
+    if [ ! X${orchidee_UserChoices_VEGET_UPDATE} = X ] ; then
+        IGCM_comp_modifyDefFile nonblocker orchidee.def VEGET_UPDATE   ${orchidee_UserChoices_VEGET_UPDATE}
+    else
+        IGCM_comp_modifyDefFile nonblocker orchidee.def VEGET_UPDATE 0Y
+    fi
+
+    # Set LAI_MAP in orchidee.def acording to value set in orchidee.card section UserChoices
+    # If LAI_MAP is not definded in orchidee.card, set default value n
+    # Note: this option is only read by ORCHIDEE if starting without restart files
+    if [ ! X${orchidee_UserChoices_LAI_MAP} = X ] ; then
+        IGCM_comp_modifyDefFile nonblocker orchidee.def LAI_MAP   ${orchidee_UserChoices_LAI_MAP}
+    else
+        IGCM_comp_modifyDefFile nonblocker orchidee.def LAI_MAP   DEFAULT
+    fi
+
+    # Set DO_WOOD_HARVEST in orchidee.def acording to value set in orchidee.card section UserChoices
+    # If DO_WOOD_HARVEST is not definded in orchidee.card, set default value y
+    if [ ! X${orchidee_UserChoices_DO_WOOD_HARVEST} = X ] ; then
+        IGCM_comp_modifyDefFile nonblocker orchidee.def DO_WOOD_HARVEST   ${orchidee_UserChoices_DO_WOOD_HARVEST}
+    else
+        IGCM_comp_modifyDefFile nonblocker orchidee.def DO_WOOD_HARVEST   DEFAULT
+    fi
+
+    # Activate creation of river description file only for the first period
+    if [ ${CumulPeriod} -eq 1 ] ; then
+        IGCM_comp_modifyDefFile nonblocker orchidee.def RIVER_DESC y
+    else
+        IGCM_comp_modifyDefFile nonblocker orchidee.def RIVER_DESC n
+    fi
+
+    # Activate calcul of chemistry BVOC
+    if [ ! X${orchidee_UserChoices_CHEMISTRY_BVOC} = X ] ; then
+        IGCM_comp_modifyDefFile nonblocker orchidee.def CHEMISTRY_BVOC ${orchidee_UserChoices_CHEMISTRY_BVOC}
+    else
+        IGCM_comp_modifyDefFile nonblocker orchidee.def CHEMISTRY_BVOC n
+    fi
+
+    ## 2. Mangement of output and modifications of related xml files
+    # Modify file_def_orchidee.xml file using settings from orchidee.card
+    # We here suppose that for each file, in orchidee.card UserChoices section, if the parameter 
+    # output_level_filename is set, then also output_freq_filename must be set. The existance of output_freq_filename will not be checked. 
+    # If output_level_filename=NONE or if it is not set, the corresponding file will be deactivated.
+    # Settings in config.card WriteFrequency are not used any more.
+    
+    if [ X${orchidee_UserChoices_output_level_sechiba_history} = X ] || [ X${orchidee_UserChoices_output_level_sechiba_history} = XNONE ] ; then
+	# output_level_sechiba_history is not set in orchidee.card or it is set to NONE.
+	# Deactivate the file.
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba1 enabled .FALSE.
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba1 output_level 0
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba1 output_freq 1mo
+    else
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba1 enabled      .TRUE.
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba1 output_level ${orchidee_UserChoices_output_level_sechiba_history}
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba1 output_freq  ${orchidee_UserChoices_output_freq_sechiba_history}
+    fi
+    
+    if [ X${orchidee_UserChoices_output_level_sechiba_out_2} = X ] || [ X${orchidee_UserChoices_output_level_sechiba_out_2} = XNONE ] ; then
+	# output_level_sechiba_out_2 is not set in orchidee.card or it is set to NONE.
+	# Deactivate the file.
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba2 enabled .FALSE.
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba2 output_level 0
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba2 output_freq 1mo
+    else
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba2 enabled      .TRUE.
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba2 output_level ${orchidee_UserChoices_output_level_sechiba_out_2}
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba2 output_freq  ${orchidee_UserChoices_output_freq_sechiba_out_2}
+    fi
+    
+    if [ X${orchidee_UserChoices_output_level_sechiba_history_4dim} = X ] || [ X${orchidee_UserChoices_output_level_sechiba_history_4dim} = XNONE ] ; then
+	# output_level_sechiba_history_4dim is not set in orchidee.card or it is set to NONE.
+	# Deactivate the file.
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba3 enabled .FALSE.
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba3 output_level 0
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba3 output_freq 1mo
+    else
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba3 enabled      .TRUE.
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba3 output_level ${orchidee_UserChoices_output_level_sechiba_history_4dim}
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba3 output_freq  ${orchidee_UserChoices_output_freq_sechiba_history_4dim}
+    fi
+        
+
+    # Add include of orchidee context in iodef.xml
+    # In iodef.xml add on the next line after "COMPONENT CONTEXT"
+    echo '<context id="orchidee" src="./context_orchidee.xml"/>' > add.tmp
+    # Add inclusion of file context_input_orchidee.xml if this file exists
+    if [ -f context_input_orchidee.xml ] ; then
+        echo '<context id="orchidee" src="./context_input_orchidee.xml"/>' >> add.tmp
+    fi
+    # Include xml files for output configuration if running with workflow CMIP6
+    if [ X"$( echo ${config_UserChoices_ExpType} | grep CMIP6 )" != "X" ] ; then
+	echo '<context id="orchidee" src="./ping_orchidee.xml"/>' >> add.tmp
+	echo '<context id="orchidee" src="./dr2xml_orchidee.xml"/>' >> add.tmp
+    fi
+    cp iodef.xml iodef.xml.tmp
+    sed -e "/COMPONENT CONTEXT/r add.tmp" iodef.xml.tmp > iodef.xml
+    rm iodef.xml.tmp add.tmp
+
+    # 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
+
+    #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
+	    sed -i -e "s/\(compression_level=\"\)[^\"]*\(\"\)/\1${config_UserChoices_CompressionLevel}\2/" ${file}
+    	done
+    fi
+
+
+
+    IGCM_debug_PopStack "SRF_Update"
+}
+
+#-----------------------------------------------------------------
+function SRF_Finalize
+{
+    IGCM_debug_PushStack "SRF_Finalize"
+
+    IGCM_debug_PopStack "SRF_Finalize"
+}
Index: CMIP6/DCPP-A/DRIVER/pisces.driver
===================================================================
--- CMIP6/DCPP-A/DRIVER/pisces.driver	(revision 5840)
+++ CMIP6/DCPP-A/DRIVER/pisces.driver	(revision 5840)
@@ -0,0 +1,120 @@
+#!/bin/ksh
+
+#-----------------------------------
+function MBG_Initialize
+{ 
+    IGCM_debug_PushStack "MBG_Initialize"
+
+    # Local function to find parameters in LMDZ .def files
+
+lmdzgrep2 () {
+     grep -w ${1} ${2} | grep -v "#"  | sed -e 's/=//g' -e 's/://g' -e 's/_AUTO_//' -e 's/DEFAULT//' | sed -e "s/${1}//" 
+}
+
+    ##--Variables used by MBG --
+
+    # ln_rsttr  boolean term for tracer model restart (true or false)
+    # nrsttr    control of the time step (0, 1 or 2)
+    
+    IGCM_debug_PopStack "MBG_Initialize"
+}
+
+#-----------------------------------
+function MBG_Update
+{
+    IGCM_debug_PushStack "MBG_Update"
+
+    ##--Write Frequency for iomput
+    ## Differents frequencies are allowed for MBG files
+
+    VT1D_ENABLE=".FALSE."
+    VT5D_ENABLE=".FALSE."
+    VT1M_ENABLE=".FALSE."
+    VT1Y_ENABLE=".FALSE."
+
+    for frequency in ${config_MBG_WriteFrequency} ; do
+        case ${frequency} in
+            ( 1D|1d ) VT1D_ENABLE=".TRUE." ;;
+            ( 5D|5d ) VT5D_ENABLE=".TRUE." ;;
+            ( 1M|1m ) VT1M_ENABLE=".TRUE." ;;
+            ( *[yY] ) VT1Y_ENABLE=".TRUE." ;;
+        esac
+    done
+
+    ##-- Restart configuration
+    ##-- Restart configuration
+    if ( [ "${opa9_UserChoices_Reproducibility_after_restart}" = "y" ] ) ; then
+        TOP_LN_RSTR=.TRUE.
+        TOP_NN_RSTR=2
+        IGCM_debug_Print 1 'WARNING : dangerous option for NEMO pisces too'
+        IGCM_debug_Print 1 'Reproducibility_after_Restart forced : ' ${opa9_UserChoices_Reproducibility_after_restart}
+
+    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "n" ] ) ; then
+
+        #echo "NO RESTART FOR TOP"
+        TOP_LN_RSTR=.FALSE.
+        TOP_NN_RSTR=0
+
+    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then
+
+        #echo "RESTART TOP"
+        TOP_LN_RSTR=.TRUE.
+        TOP_NN_RSTR=0
+
+        # If we start from IPSLCM5* restart files.
+	    for file in restart_trc*.nc ; do
+            IGCM_debug_Print 1 "cmd done to modify IPSLCM5* NEMO pisces restartfile: " ncrename -v TRBDSi,TRBGSi -v TRNDSi,TRNGSi -v TRNBSi,TRNDSi -v TRBBSi,TRBDSi ${file} > /dev/null 2>&1
+            ncrename -v TRBDSi,TRBGSi -v TRNDSi,TRNGSi -v TRNBSi,TRNDSi -v TRBBSi,TRBDSi ${file} > /dev/null 2>&1
+	    done
+
+    else
+
+        #echo "RESTART TOP"
+        TOP_LN_RSTR=.TRUE.
+        TOP_NN_RSTR=2
+
+    fi
+
+
+    ##-- CO2 forcing : update atcco2 value in namelist_pisces_cfg with the same one used in LMDZ
+    IGCM_debug_Print 1 "Take same CO2 as for LMDZ, in parameter file config.def."
+    # ATM_Update is done before MBG_Update and therefore config.def file contains the correct value for CO2.
+    IGCM_debug_Print 1 'Update atcco2 in namelist_pisces_cfg with same value as for LMDZ'
+    LMDZ_CO2=$( lmdzgrep2 co2_ppm config.def )
+    IGCM_debug_Print 1 "LMDZ_CO2 : ${LMDZ_CO2} "
+    IGCM_comp_modifyNamelist force  namelist_pisces_cfg atcco2 ${LMDZ_CO2}
+
+    ##-- Update namelist_top_cfg and namelist_pisces_cfg
+    IGCM_comp_modifyNamelist blocker  namelist_top_cfg     ln_rsttr   ${TOP_LN_RSTR}
+    IGCM_comp_modifyNamelist blocker  namelist_top_cfg     nn_rsttr   ${TOP_NN_RSTR}
+    IGCM_comp_modifyNamelist blocker  namelist_pisces_cfg  nn_pisdmp  ${OPA_NPDT_YEAR}
+ 
+    # Update iodef.xml
+
+    IGCM_debug_Print 1 'Informations into iodef.xml : VT1D_ENABLE VT5D_ENABLE VT1M_ENABLE VT1Y_ENABLE '
+    IGCM_debug_Print 1 ${VT1D_ENABLE}  ${VT5D_ENABLE} ${VT1M_ENABLE} ${VT1Y_ENABLE}
+
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1d_pis enabled ${VT1D_ENABLE}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 5d_pis enabled ${VT5D_ENABLE}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1m_pis enabled ${VT1M_ENABLE}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1y_pis enabled ${VT1Y_ENABLE}
+
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1d_pis output_level ${pisces_UserChoices_OutputLevel}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 5d_pis output_level ${pisces_UserChoices_OutputLevel}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1m_pis output_level ${pisces_UserChoices_OutputLevel}
+    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1y_pis output_level ${pisces_UserChoices_OutputLevel}
+
+   
+    IGCM_debug_PopStack "MBG_Update"
+}
+
+#-----------------------------------
+function MBG_Finalize
+{
+    IGCM_debug_PushStack "MBG_Finalize"
+
+    echo FINALIZE MBG !!!
+
+    IGCM_debug_PopStack "MBG_Finalize"
+}
+
Index: CMIP6/DCPP-A/DRIVER/stomate.driver
===================================================================
--- CMIP6/DCPP-A/DRIVER/stomate.driver	(revision 5840)
+++ CMIP6/DCPP-A/DRIVER/stomate.driver	(revision 5840)
@@ -0,0 +1,67 @@
+#!/bin/ksh
+
+#D- Driver for ORCHIDEE stomate component (SBG)
+
+#-----------------------------------------------------------------
+function SBG_Initialize
+{
+    IGCM_debug_PushStack "SBG_Initialize"
+
+    IGCM_debug_PopStack "SBG_Initialize"
+}
+
+#-----------------------------------------------------------------
+function SBG_Update
+{
+    IGCM_debug_PushStack "SBG_Update"
+    
+    # Output management
+    # Modify file_def_orchidee.xml file using settings from stomate.card
+    # We here suppose that for each file, in stomate.card UserChoices section, if the parameter 
+    # output_level_filename is set, then also output_freq_filename must be set. The existance of output_freq_filename will not be checked. 
+    # If output_level_filename=NONE or if it is not set, the corresponding file will be deactivated.
+    
+    if [ X${stomate_UserChoices_output_level_stomate_history} = X ] || [ X${stomate_UserChoices_output_level_stomate_history} = XNONE ] ; then
+	# output_level_stomate_history is not set in stomate.card or it is set to NONE.
+	# Deactivate the file.
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 enabled .FALSE.
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_level 0
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_freq 1mo
+    else
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 enabled      .TRUE.
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_level ${stomate_UserChoices_output_level_stomate_history}
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_freq  ${stomate_UserChoices_output_freq_stomate_history}
+    fi
+    
+    if [ X${stomate_UserChoices_output_level_stomate_ipcc_history} = X ] || [ X${stomate_UserChoices_output_level_stomate_ipcc_history} = XNONE ] ; then
+	# output_level_stomate_ipcc_history is not set in stomate.card or it is set to NONE.
+	# Deactivate the file.
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 enabled .FALSE.
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_level 0
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_freq 1mo
+    else
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 enabled      .TRUE.
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_level ${stomate_UserChoices_output_level_stomate_ipcc_history}
+	IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_freq  ${stomate_UserChoices_output_freq_stomate_ipcc_history}
+    fi
+
+        
+
+    # Define in orchidee.def if restart file should be used
+    if ( [ ${CumulPeriod} -eq 1 ] && [ "${config_SBG_Restart}" = "n" ] ) ; then
+        echo "STOMATE : without restart"
+        IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_RESTART_FILEIN NONE
+    else
+        IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_RESTART_FILEIN stomate_rest_in.nc
+    fi
+
+    IGCM_debug_PopStack "SBG_Update"
+}
+
+#-----------------------------------------------------------------
+function SBG_Finalize
+{
+    IGCM_debug_PushStack "SBG_Finalize"
+    
+    IGCM_debug_PopStack "SBG_Finalize"
+}
Index: CMIP6/DCPP-A/DRIVER/xios.driver
===================================================================
--- CMIP6/DCPP-A/DRIVER/xios.driver	(revision 5840)
+++ CMIP6/DCPP-A/DRIVER/xios.driver	(revision 5840)
@@ -0,0 +1,42 @@
+#!/bin/ksh
+#-----------------------------------
+function IOS_Initialize
+{ 
+    IGCM_debug_PushStack "IOS_Initialize"
+
+    echo INITIALIZE IOS !!!
+
+    IGCM_debug_PopStack "IOS_Initialize"
+}
+
+#-----------------------------------
+function IOS_Update
+{
+    IGCM_debug_PushStack "IOS_Update"
+
+    echo UPDATE IOS !!!
+# Activate server mode
+    IGCM_comp_modifyXmlFile force iodef.xml using_server NONE true
+
+# Activate 2nd server level for CMIP6 type experiments (CMIP6 workflow)
+    if [ X"$( echo ${config_UserChoices_ExpType} | grep CMIP6 )" != "X" ] ; then
+    IGCM_comp_modifyXmlFile force iodef.xml using_server2 NONE true
+    fi
+
+    if [ -f namcouple ] ; then
+	sed -e "s/2  LMDZ oceanx/3 LMDZ oceanx ${config_Executable_IOS[1]}/" namcouple > namcouple.tmp 
+	IGCM_sys_Mv namcouple.tmp namcouple
+    fi
+
+    IGCM_debug_PopStack "IOS_Update"
+}
+
+#-----------------------------------
+function IOS_Finalize
+{
+    IGCM_debug_PushStack "IOS_Finalize"
+
+    echo FINALIZE IOS !!!
+
+    IGCM_debug_PopStack "IOS_Finalize"
+}
