Index: CONFIG/UNIFORM/v6/IPSLCM6.2/GENERAL/DRIVER/inca.driver
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6.2/GENERAL/DRIVER/inca.driver	(revision 4636)
+++ CONFIG/UNIFORM/v6/IPSLCM6.2/GENERAL/DRIVER/inca.driver	(revision 4636)
@@ -0,0 +1,349 @@
+#!/bin/ksh
+
+#D- Driver du script pour INCA
+#-----------------------------------------------------------------
+function INCA_sed_replace
+{
+    IGCM_debug_PushStack "INCA_sed_replace"
+
+    sed -e "s/${2}/${3}/" ${1} > ${1}.tmp
+    RET=$?
+    echo "INCA_sed : ${1} ${2} ${3}"
+    \mv ${1}.tmp ${1}
+
+    IGCM_debug_PopStack "INCA_sed_replace"
+    return $RET
+}
+#-----------------------------------------------------------------
+function CHM_Initialize
+{
+    IGCM_debug_PushStack "CHM_Initialize"
+
+    if [ X$ResolAtm != X ] ; then
+	# ResolAtm is set in config.card
+	RESOL_ATM_3D=${ResolAtm}
+	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_CHM=${RESOL_ATM_X}${RESOL_ATM_Y}-L${RESOL_ATM_Z}
+    elif [ -f ${SUBMIT_DIR}/../.resol ] ; then
+	[ -f ${SUBMIT_DIR}/../.resol ] && eval $(grep RESOL_ATM_3D ${SUBMIT_DIR}/../.resol) || RESOL_ATM_3D=96x95x19
+	RESOL_CHM_Z=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $3}' | awk "-F-" '{print $1}')
+    else
+	IGCM_debug_Exit "ResolAtm is not set in config.card and the .resol file does not exist."
+	IGCM_debug_Verif_Exit
+    fi
+
+    echo 'resol chimie', $RESOL_CHM
+    CHEM=${ConfChem}
+    echo "INCA Tag : LMDZ-INCA" ${config_UserChoices_TagName}
+
+    ##- 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}
+
+    enable1=.FALSE.
+    enable2=.FALSE.
+
+    for frequency in ${config_CHM_WriteFrequency} ; do
+	case ${frequency} in 
+	    1D|1d) enable1=.TRUE. ;;
+	esac
+	case ${frequency} in
+	    1M|1m) enable2=.TRUE. ;;
+	esac
+    done
+
+
+
+    IGCM_debug_PopStack "CHM_Initialize"
+}
+
+#-----------------------------------------------------------------
+function CHM_Update
+{
+    IGCM_debug_PushStack "CHM_Update"
+
+
+
+    case ${CHEM} in 
+	AER)
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml   forcage1     enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml forcage2     enabled ${enable2}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml   aero1        enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml aero2        enabled ${enable2}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml   chemistry1   enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml chemistry2   enabled ${enable2}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml   emissions1   enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml emissions2   enabled ${enable2}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml   species1     enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml species2     enabled ${enable2}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml   dvel1        enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml dvel2        enabled ${enable2}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml   washout1     enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml washout2     enabled ${enable2}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml   reacflux1    enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml reacflux2    enabled ${enable2}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml   invariants1  enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml invariants2  enabled ${enable2}
+
+	    if [ X${LMDZ_Physics} = X"AP" ] ; then
+		IGCM_comp_modifyDefFile nonblocker run.def config_inca aero
+	    else
+		IGCM_comp_modifyDefFile nonblocker run.def config_inca aeNP
+	    fi
+	;;
+	DUSS)
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml forcage1     enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml aero1        enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml emissions1   enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml species1     enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml vegetation1  enabled ${enable1}
+
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml forcage2     enabled ${enable2}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml aero2        enabled ${enable2}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml emissions2   enabled ${enable2}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml species2     enabled ${enable2}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml vegetation2  enabled ${enable2}
+
+	    if [ X${LMDZ_Physics} = X"AP" ] ; then
+		IGCM_comp_modifyDefFile nonblocker run.def config_inca aero
+	    else
+		IGCM_comp_modifyDefFile nonblocker run.def config_inca aeNP
+	    fi
+	;;
+	NMHC) 
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml reacflux1    enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml emissions1   enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml species1     enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml chemistry1   enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml dvel1        enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml washout1     enabled ${enable1}
+
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml reacflux2  enabled ${enable2}  
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml emissions2 enabled ${enable2}  
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml species2   enabled ${enable2}  
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml chemistry2 enabled ${enable2}  
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml dvel2      enabled ${enable2}  
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml washout2   enabled ${enable2}  
+
+	    IGCM_comp_modifyDefFile nonblocker run.def config_inca chem
+	    ;;
+	NMHC_AER)
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml forcage1     enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml aero1        enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml species1     enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml chemistry1   enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml emissions1   enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml dvel1        enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml phtrate1     enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml washout1     enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml reacflux1    enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml vegetation1  enabled ${enable1}
+
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml forcage2    enabled ${enable2}  
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml aero2       enabled ${enable2} 
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml species2    enabled ${enable2} 
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml chemistry2  enabled ${enable2} 
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml emissions2  enabled ${enable2} 
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml dvel2       enabled ${enable2} 
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml phtrate2    enabled ${enable2} 
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml washout2    enabled ${enable2} 
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml reacflux2   enabled ${enable2} 
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml vegetation2 enabled ${enable2} 
+
+	    if [ X${LMDZ_Physics} = X"AP" ] ; then
+		IGCM_comp_modifyDefFile nonblocker run.def config_inca aero
+	    else
+		IGCM_comp_modifyDefFile nonblocker run.def config_inca aeNP
+	    fi
+	;;
+
+	NMHC_AER_S)
+ 	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml forcage1     enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml aero1        enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml species1     enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml chemistry1   enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml emissions1   enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml dvel1        enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml phtrate1     enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml washout1     enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml reacflux1    enabled ${enable1}
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml vegetation1  enabled ${enable1}
+
+ 	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml forcage2    enabled ${enable2} 
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml aero2       enabled ${enable2} 
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml species2    enabled ${enable2} 
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml chemistry2  enabled ${enable2} 
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml emissions2  enabled ${enable2} 
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml phtrate2    enabled ${enable2} 
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml dvel2       enabled ${enable2} 
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml washout2    enabled ${enable2} 
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml reacflux2   enabled ${enable2} 
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml vegetation2 enabled ${enable2}  
+
+	    if [ X${LMDZ_Physics} = X"AP" ] ; then
+		IGCM_comp_modifyDefFile nonblocker run.def config_inca aero
+	    else
+		IGCM_comp_modifyDefFile nonblocker run.def config_inca aeNP
+	    fi
+	;;
+	GES)
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml emissions1    enabled ${enable1}
+
+	    IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml emissions2    enabled ${enable2}
+
+	    IGCM_comp_modifyDefFile nonblocker run.def config_inca chem
+	esac
+
+
+    # inca.def : Activate reading of 10m wind in files if LMDZ_10m_winds=n in inca.card
+    if [ ! X${inca_UserChoices_LMDZ_10m_winds} = X ] ; then
+	IGCM_comp_modifyDefFile nonblocker inca.def LMDZ_10m_winds  ${inca_UserChoices_LMDZ_10m_winds}
+    else
+	IGCM_comp_modifyDefFile nonblocker inca.def LMDZ_10m_winds  n
+    fi
+
+    if [  X${inca_UserChoices_10m_winds_method} = X ] ; then
+    IGCM_comp_modifyDefFile nonblocker inca.def  10m_winds_method  threshold
+    else
+    IGCM_comp_modifyDefFile nonblocker inca.def  10m_winds_method ${inca_UserChoices_10m_winds_method}
+    fi
+
+
+    if [ ! X${inca_UserChoices_wind_parameter} = X ] ; then 
+	if [  X${inca_UserChoices_10m_winds_method} = Xthreshold ] ; then 
+	    IGCM_comp_modifyDefFile nonblocker inca.def  tref ${inca_UserChoices_wind_parameter}
+	    IGCM_comp_modifyDefFile nonblocker inca.def  kref DEFAULT
+	else
+	    IGCM_comp_modifyDefFile nonblocker inca.def  kref ${inca_UserChoices_wind_parameter}
+	    IGCM_comp_modifyDefFile nonblocker inca.def  tref DEFAULT
+	fi
+    else
+	    IGCM_comp_modifyDefFile nonblocker inca.def  kref DEFAULT
+	    IGCM_comp_modifyDefFile nonblocker inca.def  tref DEFAULT
+    fi
+
+    if [  X${inca_UserChoices_seasalt_corr} = X ] ; then
+    IGCM_comp_modifyDefFile nonblocker inca.def  ss_corr  DEFAULT
+    else
+    IGCM_comp_modifyDefFile nonblocker inca.def  ss_corr ${inca_UserChoices_seasalt_corr}
+    fi
+
+
+
+    # inca.def : choose write frequency for inca_avgr in inca.card
+    if [ ! X${inca_UserChoices_freq_write_chem} = X ] ; then
+	IGCM_comp_modifyDefFile nonblocker inca.def freq_write_chem  ${inca_UserChoices_freq_write_chem}
+    else
+	IGCM_comp_modifyDefFile nonblocker inca.def  freq_write_chem  86400
+    fi
+
+    #inca.def : choose aerosol effect with feedback variable
+    if [ ! X${inca_UserChoices_feedb} = X ] ; then
+	IGCM_comp_modifyDefFile nonblocker inca.def  feedb  ${inca_UserChoices_feedb}
+    else
+	IGCM_comp_modifyDefFile nonblocker inca.def feedb  0
+    fi
+    
+    #inca.def : choose coupled model with orchidee  
+    if [ ! X${inca_UserChoices_CoupOrchInca} = X ]; then 
+	IGCM_comp_modifyDefFile nonblocker inca.def CoupOrchInca ${inca_UserChoices_CoupOrchInca}
+    else
+	IGCM_comp_modifyDefFile nonblocker inca.def CoupOrchInca n
+    fi
+
+    #inca.def : choose sedimentation schema 
+    if [ ! X${inca_UserChoices_multilayer_sedim} = X ]; then 
+	IGCM_comp_modifyDefFile nonblocker inca.def multilayer_sediment ${inca_UserChoices_multilayer_sedim}
+    else
+	IGCM_comp_modifyDefFile nonblocker inca.def multilayer_sediment y
+    fi
+
+    #inca.def : choose calcul interactif des diagnostiques flux chimique ou non  
+    if [ ! X${inca_UserChoices_calcul_flux} = X ]; then 
+	IGCM_comp_modifyDefFile nonblocker inca.def calcul_flux ${inca_UserChoices_calcul_flux}
+    else
+	IGCM_comp_modifyDefFile nonblocker inca.def calcul_flux n
+    fi
+
+    #inca.def : choose aircraft emission 
+    if [ ! X${inca_UserChoices_flag_plane} = X ]; then 
+	IGCM_comp_modifyDefFile nonblocker inca.def flag_plane ${inca_UserChoices_flag_plane}
+    else
+	IGCM_comp_modifyDefFile nonblocker inca.def flag_plane 0
+    fi
+    
+    #inca.def : choose time interpolation for sflx.nc
+    if [ ! X${inca_UserChoices_emi_interp_time} = X ]; then 
+	IGCM_comp_modifyDefFile nonblocker inca.def emi_interp_time ${inca_UserChoices_emi_interp_time}
+    else
+	IGCM_comp_modifyDefFile nonblocker inca.def emi_interp_time 1
+    fi
+
+    #inca.def : choose output library 
+    if [  X${inca_UserChoices_XIOS} = Xy ] ; then
+	IGCM_comp_modifyDefFile nonblocker inca.def  XIOS_INCA_OK  y
+    else
+	IGCM_comp_modifyDefFile nonblocker inca.def  XIOS_INCA_OK n
+    fi
+
+    if [  X${inca_UserChoices_IOIPSL} = Xy ] ; then
+	IGCM_comp_modifyDefFile nonblocker inca.def  IOIPSL_INCA_OK  y
+    else
+	IGCM_comp_modifyDefFile nonblocker inca.def  IOIPSL_INCA_OK n
+    fi
+
+
+
+
+
+    # Add include of INCA context in iodef.xml
+    # In iodef.xml add on next line after "COMPONENT CONTEXT"
+    #  <context id="inca" src="./context_inca.xml"/>
+	echo '<context id="inca" src="./context_inca.xml"/>' > add.tmp
+	cp iodef.xml iodef.xml.tmp
+	sed -e "/COMPONENT CONTEXT/r add.tmp" \
+	    iodef.xml.tmp > iodef.xml
+	rm iodef.xml.tmp add.tmp
+
+
+    # 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*inca.xml)
+	echo "<variable id=\"LongName\" type=\"string\">${config_UserChoices_LongName}</variable>" > add.tmp
+	for file in ${listfile}
+	do
+	    cp ${file} ${file}.tmp
+	    sed -e "/<file id/r add.tmp" \
+		${file}.tmp > ${file}
+	    rm ${file}.tmp 
+	done
+	rm add.tmp
+    fi
+
+    IGCM_debug_PopStack "CHM_Update"
+}
+
+#-----------------------------------------------------------------
+function CHM_Finalize
+{
+    IGCM_debug_PushStack "CHM_Finalize"
+
+    echo FINALIZE CHM !!!
+#
+#    IGCM_sys_Mkdir ${R_OUT_EXE}
+#    cd ${MODIPSL}
+#    tar cf src_${config_UserChoices_JobName}.tar  modeles
+#    IGCM_sys_Mv src_${config_UserChoices_JobName}.tar ${R_OUT_EXE}/.
+#    cd -
+#
+
+    IGCM_debug_PopStack "CHM_Finalize"
+}
Index: CONFIG/UNIFORM/v6/IPSLCM6.2/GENERAL/PARAM/inca.def
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6.2/GENERAL/PARAM/inca.def	(revision 4636)
+++ CONFIG/UNIFORM/v6/IPSLCM6.2/GENERAL/PARAM/inca.def	(revision 4636)
@@ -0,0 +1,36 @@
+#######################################################################
+# parametres pour INCA
+#######################################################################
+#LMDZ_10m_winds=y --> use 10m wind from LMDZ, =n --> use 10m wind from output file
+LMDZ_10m_winds=_AUTO_
+10m_winds_method=_AUTO_
+#choose if there is a feedback with the areosol effect
+feedb=_AUTO_
+#indicate if we are running with xios and/or ioipsl
+XIOS_INCA_OK=_AUTO_
+IOIPSL_INCA_OK=_AUTO_
+#weibull 10m wind parameter / def 4
+kref=_AUTO_: DEFAULT =4
+#threshold 10m wind parameter / def 0.78
+tref=_AUTO_: DEFAULT =0.78
+#seasalt_correctif / def = 1 
+ss_corr=_AUTO_: DEFAULT =1 
+#sedimentation 
+multilayer_sediment=_AUTO_
+#coupled model with orchidee
+CoupOrchInca=_AUTO_
+nbveget=15
+#use or not the deposition from orchidee
+DepOrch=n
+# uncomment two next line if we want to coupled with orchidee without transfer any flux
+#nbFlux_FromOrch=0
+#emi_FromOrch=
+#output diagnostic for chemistry flux
+calcul_flux=_AUTO_
+#
+flag_plume=0
+#choose which type of aircraft you will use (0 - 1 - 2 - 3) (no aircraft / old inca aircraft / new subsonic inca aircraft / subsonic + hypersonic inca aircraft)
+flag_plane=_AUTO_
+#choose which time interpolation you want to interpolate sflx file. ( 0 - 1 - 2) (no interpolation / point to point interpolation / Sheng & Zwiers interpolation) 
+emi_interp_time=_AUTO_
+
