Index: CONFIG/UNIFORM/v6/IPSLCM6.3/ARCH/arch-X64_IRENE-AMD.env
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6.3/ARCH/arch-X64_IRENE-AMD.env	(revision 6532)
+++ CONFIG/UNIFORM/v6/IPSLCM6.3/ARCH/arch-X64_IRENE-AMD.env	(revision 6533)
@@ -5,6 +5,7 @@
 module load mpi/openmpi/4.1.4
 module load flavor/hdf5/parallel
-module load hdf5/1.12.0
+module load hdf5/1.12.2
 module load netcdf-fortran/4.5.3
+module load netcdf95
 module load mkl/20.0.0
 module load feature/bridge/heterogenous_mpmd
Index: CONFIG/UNIFORM/v6/IPSLCM6.3/ARCH/arch-X64_IRENE.env
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6.3/ARCH/arch-X64_IRENE.env	(revision 6532)
+++ CONFIG/UNIFORM/v6/IPSLCM6.3/ARCH/arch-X64_IRENE.env	(revision 6533)
@@ -5,6 +5,7 @@
 module load mpi/openmpi/4.1.4
 module load flavor/hdf5/parallel
-module load hdf5/1.12.0
+module load hdf5/1.12.2
 module load netcdf-fortran/4.5.3
+module load netcdf95
 module load mkl/20.0.0
 module load feature/bridge/heterogenous_mpmd
Index: CONFIG/UNIFORM/v6/IPSLCM6.3/ARCH/arch-X64_JEANZAY.env
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6.3/ARCH/arch-X64_JEANZAY.env	(revision 6532)
+++ CONFIG/UNIFORM/v6/IPSLCM6.3/ARCH/arch-X64_JEANZAY.env	(revision 6533)
@@ -6,3 +6,6 @@
 module load netcdf/4.7.2-mpi
 module load netcdf-fortran/4.5.2-mpi
+module load netcdf95
 
+# Load svn needed for the compilation script
+module load subversion
Index: CONFIG/UNIFORM/v6/IPSLCM6.3/compile_ipslcm6.sh
===================================================================
--- CONFIG/UNIFORM/v6/IPSLCM6.3/compile_ipslcm6.sh	(revision 6532)
+++ CONFIG/UNIFORM/v6/IPSLCM6.3/compile_ipslcm6.sh	(revision 6533)
@@ -28,4 +28,7 @@
 # Also compile ce0l subprogram to LMDZ (y/n)
 ce0l=n
+# choose radiative code compilation option 
+rad=rrtm
+opt_rad=""
 
 # Optimization mode
@@ -68,4 +71,5 @@
          [ESMCO2] Compile IPSLCM6 for CO2 interactif ocean/atmosphere.
          [ESMAER] Compile IPSLCM6 for AER interactif on atmosphere
+         [ESMCO2AER] Compile IPSLCM6 for both interactive CO2 and AER, and also with transfer of species from PISCES to INCA.
          [-full] Full recompilation of all components. This option can be added to all other options.
          [-cleannemo] Full recompilation of NEMO component  only.
@@ -92,4 +96,8 @@
 Example 6: Full recompilation of resolution MR05 in debug mode
 ./compile_ipslcm6.sh MR025 -debug -full
+
+Example 7: choose radiative schema for LMDZ (oldrad/rrtm/ecrad). Default is rrtm
+./compile_ipslcm6.sh MR025 -rad ecrad
+
 
 end_help
@@ -101,5 +109,7 @@
 	"ESMCO2")      esmco2=y;  shift ;; 
 	"ESMAER")      esmaer=y; shift ;; 
+	"ESMCO2AER")   esmco2=y; esmaer=y; shift ;;
 	"CE0L")        ce0l=y ; shift ;;
+	"-rad")        rad=$2; shift ; shift;;
 	"-parallel")   parallel=$2 ; shift ; shift ;; 
 	"-arch")       fcm_arch="$2" ; shift ; shift ;;
@@ -168,4 +178,6 @@
     echo " Personal module list before sourcing of ARCH/arch.env file:"    >> $outfile  
     module list   >> $outfile 2>&1 
+    # Get initial svn version
+    svn_version=$(module list -t | grep subversion)
 
     # Make a link to this file, to be used also in config.card
@@ -175,4 +187,8 @@
     # Source the file
     source ARCH/arch.env   >> $outfile 2>&1 
+    if [ X$svn_version != X ] ; then
+        # Put back initial version of svn
+        module load ${svn_version}
+    fi
     echo >> $outfile 
     echo " New module list after sourcing of ARCH/arch.env file:"    >> $outfile  
@@ -263,13 +279,17 @@
    delkeys="key_nosignedzero key_mpp_rep"
 else
-   addkeys="key_top key_pisces key_age key_cfc key_cpl_carbon_cycle key_gas key_oasis3"
+   addkeys="key_top key_pisces key_age key_cfc key_cpl_carbon_cycle key_gas key_oasis3 key_transm_ocninca"
    if [ ${oceanbio} == y ] ; then
       if [ ${esmco2} == y ] ; then
-         delkeys="key_nosignedzero key_mpp_rep"
+        if [ ${esmaer} == y ] ; then
+           delkeys="key_nosignedzero key_mpp_rep"
+        else
+           delkeys="key_nosignedzero key_mpp_rep key_transm_ocninca"
+        fi
       else
-         delkeys="key_nosignedzero key_mpp_rep key_cpl_carbon_cycle key_gas"
+         delkeys="key_nosignedzero key_mpp_rep key_cpl_carbon_cycle key_gas key_transm_ocninca"
       fi
    else
-      delkeys="key_nosignedzero key_mpp_rep key_top key_pisces key_cfc key_age key_cpl_carbon_cycle key_gas"
+      delkeys="key_nosignedzero key_mpp_rep key_top key_pisces key_cfc key_age key_cpl_carbon_cycle key_gas key_transm_ocninca"
    fi
 fi
@@ -320,6 +340,8 @@
 
 if [ -f $nemo_root/$cfg_wrk/BLD/bin/nemo.exe ] ; then
-    if [ ${esmco2} == y ] ;  then 
+    if [ ${esmco2} == y ] && [ ${esmaer} == n ] ;  then 
 	mv $nemo_root/$cfg_wrk/BLD/bin/nemo.exe $modipsl/bin/opa.ESMCO2_${resol_oce}_${optmode}
+    elif [ ${esmco2} == y ] && [ ${esmaer} == y ] ;  then
+    mv $nemo_root/$cfg_wrk/BLD/bin/nemo.exe $modipsl/bin/opa.ESMCO2AER_${resol_oce}_${optmode}
     else
 	mv $nemo_root/$cfg_wrk/BLD/bin/nemo.exe $modipsl/bin/opa_${resol_oce}_${optmode}
@@ -332,9 +354,13 @@
 if [ ${esmaer} == y ] ;  then 
     cd $modipsl/modeles/INCA
-    #compile INCA regulat lat_lon chimie librairy 
+    #compile INCA regulat lat_lon chimie library 
     echo; echo "NOW COMPILE INCA AER on resolution = ${resol_atm}"
-    echo ./makeinca_fcm -chimie AER -$optmode -xios -parallel mpi_omp -resol ${resol_atm} -j 8 -arch ${fcm_arch}  -arch_path $arch_path $full_flag $full_inca >> $outfile 
-    ./makeinca_fcm -chimie AER -$optmode -xios -parallel mpi_omp -resol ${resol_atm} -j 8 -arch ${fcm_arch} -arch_path $arch_path  $full_flag $full_inca >> $outfile 2>&1
-
+    if [ ${esmco2} == y ] ; then
+      echo ./makeinca_fcm -chimie AER -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path $full_flag $full_inca -cplocninca >> $outfile
+      ./makeinca_fcm -chimie AER -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path  $full_flag $full_inca -cplocninca >> $outfile 2>&1
+    else
+      echo ./makeinca_fcm -chimie AER -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path $full_flag $full_inca >> $outfile 
+      ./makeinca_fcm -chimie AER -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path  $full_flag $full_inca >> $outfile 2>&1
+    fi
     # Test if compiling finished
     if [[ $? != 0 ]] ; then
@@ -358,4 +384,7 @@
 echo; echo "NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}"
 echo >> $outfile ; echo " NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}"   >> $outfile 
+# Retrieve the final svn release number, needed for radiative code suffix of executable
+lmdzsvn=`svnversion . | egrep -o "[0-9]+"  | awk 'NR==1'`
+echo >> $outfile ; echo "lmdzsvn= $lmdzsvn "   >> $outfile
 
 # Check if the compilation of LMDZ was previsouly interupted prematured. 
@@ -372,12 +401,29 @@
 fi
 
-if [ ${esmaer} == n ] ;  then 
-    echo ./makelmdz_fcm -d ${resol_atm} -c OMCT -rrtm true -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm    >> $outfile 
-    ./makelmdz_fcm -d ${resol_atm} -c OMCT -rrtm true -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm    >> $outfile 2>&1
+# Need to define the proper option for radiative code compilation. By default, we use rrtm
+case $rad in
+    oldrad) opt_rad="" ;;
+    rrtm)   if [ $lmdzsvn -le 4185 ] ; then opt_rad="-rrtm true" ; else opt_rad="-rad rrtm" ; fi ;;
+    ecrad)  opt_rad="-rad ecrad" ;;
+    *) echo Only oldrad rrtm ecrad for rad option ; exit
+esac
+
+if [ $lmdzsvn -le 4185 -a $rad = "ecrad" ] ; then echo "ecrad only available for LMDZ rev starting with 4186 " ; exit ; fi
+
+
+if [ ${esmaer} == n ] ;  then
+    echo ./makelmdz_fcm -d ${resol_atm} -c OMCT -cosp true $opt_rad -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm    >> $outfile
+    ./makelmdz_fcm -d ${resol_atm} -c OMCT -cosp true $opt_rad -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm    >> $outfile 2>&1
 else
-    #in esm aer case add chemistry option to lmdz compilation 
-    echo ./makelmdz_fcm -d ${resol_atm} -c OMCT -rrtm true -$optmode -mem -parallel $parallel -chimie INCA -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm    >> $outfile 
-    ./makelmdz_fcm -d ${resol_atm} -c OMCT -rrtm true -$optmode -mem -parallel $parallel -chimie INCA -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm    >> $outfile 2>&1
-fi 
+    #in esm aer case add chemistry option to lmdz compilation
+    if [ ${esmco2} == y ] ; then
+      echo ./makelmdz_fcm -d ${resol_atm} -c OMCT -cosp true -rrtm true -$optmode -mem -parallel $parallel -chimie INCA -cplocninca -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm    >> $outfile
+      ./makelmdz_fcm -d ${resol_atm} -c OMCT -cosp true -rrtm true -$optmode -mem -parallel $parallel -chimie INCA -cplocninca -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm    >> $outfile 2>&1
+    else
+      echo ./makelmdz_fcm -d ${resol_atm} -c OMCT -cosp true -rrtm true -$optmode -mem -parallel $parallel -chimie INCA -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm    >> $outfile
+      ./makelmdz_fcm -d ${resol_atm} -c OMCT -cosp true -rrtm true -$optmode -mem -parallel $parallel -chimie INCA -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm    >> $outfile 2>&1
+    fi
+fi
+
 # Test if compiling finished
 if [[ $? != 0 ]] ; then
@@ -386,4 +432,7 @@
 fi
 
+
+
+
 # Move executables to modipsl/bin folder
 echo >> $outfile
@@ -392,9 +441,15 @@
 ls -lrt $modipsl/modeles/LMDZ/bin  >> $outfile
 echo >> $outfile
+
+
+suffix=_${resol_atm}_phylmd
+if [ $lmdzsvn -ge 4186 ] ; then suffix=${suffix}_${rad} ; fi
+suffix=${suffix}_para_mem_orch_couple
 if [ ${esmaer} == n ] ;  then 
-    suffix=_${resol_atm}_phylmd_para_mem_orch_couple.e
+    suffix=${suffix}.e
 else
-    suffix=_${resol_atm}_phylmd_para_mem_orch_couple_inca.e
-fi
+    suffix=${suffix}_inca.e
+fi
+
 echo gcm suffix = $suffix
 
@@ -412,4 +467,7 @@
 
 
+
+
+
 # Compile ce0l initialization program for LMDZ regular lat-lon exectuable
 if [ $ce0l == y ] ; then
@@ -417,6 +475,11 @@
     echo >> $outfile ; echo " NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}"   >> $outfile 
     
-    echo ./makelmdz_fcm -d ${resol_atm} -rrtm true -$optmode -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l    >> $outfile 
-    ./makelmdz_fcm -d ${resol_atm} -rrtm true -$optmode -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l    >> $outfile 2>&1
+    echo ./makelmdz_fcm -d ${resol_atm} $opt_rad -$optmode -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l    >> $outfile 
+    ./makelmdz_fcm -d ${resol_atm} $opt_rad -$optmode -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l    >> $outfile 2>&1
+
+# 1er aout - remove xios from ce0l compilation #
+#    echo ./makelmdz_fcm -d ${resol_atm} $opt_rad -$optmode -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l    >> $outfile 
+#    ./makelmdz_fcm -d ${resol_atm} $opt_rad -$optmode -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l    >> $outfile 2>&1
+
     # Test if compiling finished
     if [[ $? != 0 ]] ; then
@@ -432,6 +495,7 @@
     ls -lrt $modipsl/modeles/LMDZ/bin  >> $outfile
     echo >> $outfile
-#    suffix=_${resol_atm}_phylmd_para_mem_orch_couple.e
+
     suffix=_${resol_atm}_phylmd_seq.e
+    if [ $lmdzsvn -ge 4186 ] ; then suffix=_${resol_atm}_phylmd_${rad}_seq.e ; fi
     echo ce0l suffix = $suffix
 
