Index: BOL/script_install/install_lmdz.sh
===================================================================
--- BOL/script_install/install_lmdz.sh	(revision 5407)
+++ BOL/script_install/install_lmdz.sh	(revision 5521)
@@ -38,5 +38,7 @@
 ### Functions
 
+#-----------------------------------------------------------------------------
 function myget {
+#-----------------------------------------------------------------------------
   # Get a file from LMDZ repository, make it executable if .(ba)sh
   local url=$1
@@ -49,5 +51,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function do_compile_sh {
+#-----------------------------------------------------------------------------
   local component=$1
   local command=$2
@@ -64,5 +68,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function get_svn_branch {
+#-----------------------------------------------------------------------------
   local url=$1
   local rev=$2
@@ -80,5 +86,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function set_default_params {
+#-----------------------------------------------------------------------------
     # Valeur par défaut des parametres
     svn_lmdz=""
@@ -133,5 +141,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function read_cmdline_args {
+#-----------------------------------------------------------------------------
     while (($# > 0)); do
         case $1 in
@@ -312,5 +322,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function ensure_correct_option_combinations {
+#-----------------------------------------------------------------------------
     # Check on veget version
     if [[ $veget != 'none' && $veget != "CMIP6" && $veget != "orch2.0" && $veget != "orch2.2" ]]; then
@@ -354,5 +366,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function check_available_software {
+#-----------------------------------------------------------------------------
     local required_soft=("wget" "tar" "gzip" "make" "gcc" "cmake" "m4" "c++")
     echo "Checking if required software is available (${required_soft[*]})"
@@ -364,5 +378,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function download_modipsl_tar {
+#-----------------------------------------------------------------------------
     if [[ $clean_install = 1 && -d $MODEL ]]; then
       local ans
@@ -393,5 +409,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function init_arch {
+#-----------------------------------------------------------------------------
     cd "$local"
     set +e; arch_dir=$(readlink -f "$arch_dir"); set -e  # full path. readlink must be called *after* the path is created
@@ -410,4 +428,5 @@
       fi
     done
+
     default_fcm_path=$fcm_path
     default_path_path=$path_path
@@ -416,4 +435,32 @@
     # check compiler
     compiler=$(< "$default_fcm_path" grep "%COMPILER" | sed -e "s/%COMPILER\s*//")
+
+    # ------------------------------------------------------------------------------------------
+    # Specific problem with fortran version changes
+    # Introduit le 1er fevrier 2025 par FH. A retravailler
+    # Could be generaized to download a arch tar file if the arch is not available in the current
+    # distribution of LMDZ 
+    # ------------------------------------------------------------------------------------------
+    echo QUOI $compiler
+    if [ $compiler = gfortran -o $compiler = mpif90 ] ; then
+       echo QUOI on est la
+       if [ $( gfortran --version | head -1  | awk ' { print $NF } ' | cut -d. -f1 ) -le 9 ] ; then
+          echo QUOI faire qqchose
+          arch_dir=$PWD/arch
+          if [ $parallel = none ] ; then
+             arch=local-gfortran9
+          else
+             arch=local-gfortran9-parallel
+          fi
+          if [ ! -f $arch_dir/arch-local-gfortran9.fcm ] ; then
+             wget http://lmdz.lmd.jussieu.fr/pub/src_archives/misc/arch/LMDZ/arch-local-gfortran9.tar
+             tar xvf arch-local-gfortran9.tar
+          fi
+          default_fcm_path=$arch_dir/arch-${arch}.fcm
+          default_path_path=$arch_dir/arch-${arch}.path
+          default_env_path=$arch_dir/arch-${arch}.env
+       fi
+    fi
+    # ------------------------------------------------------------------------------------------
 
     # load env
@@ -431,5 +478,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function check_compiler {
+#-----------------------------------------------------------------------------
   # Must be called after init_arch to know which compiler to use
     cat <<eod > tt.f90
@@ -445,5 +494,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function install_arch {
+#-----------------------------------------------------------------------------
     local component=$1
 
@@ -471,5 +522,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function install_netcdf {
+#-----------------------------------------------------------------------------
     echo "Installing Netcdf"
     local ncdf_compiler="$compiler"
@@ -577,5 +630,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function install_IOIPSL {
+#-----------------------------------------------------------------------------
     install_arch "IOIPSL"
 
@@ -594,5 +649,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function install_XIOS {
+#-----------------------------------------------------------------------------
     if [[ $with_xios = 1 ]]; then
         cd "$MODEL/modipsl/modeles"
@@ -616,5 +673,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function get_orchidee_version {  # Set / Check ORCHIDEE version
+#-----------------------------------------------------------------------------
     echo "Checking Orchidee source version"
     local fetch_rev=""
@@ -653,5 +712,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function compile_orchidee {
+#-----------------------------------------------------------------------------
     install_arch "ORCHIDEE"
 
@@ -673,5 +734,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function get_lmdz_version {
+#-----------------------------------------------------------------------------
     echo "Checking LMDZ source version"
     LMDZPATH=$(readlink -e -f "$MODEL/modipsl/modeles/LMD"*)
@@ -703,5 +766,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function compile_lmdz {
+#-----------------------------------------------------------------------------
     install_arch "LMDZ"
     cd "$LMDZPATH"
@@ -742,5 +807,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function get_dynamico_icosa_version {
+#-----------------------------------------------------------------------------
   if [[ $icolmdz = 1 ]]; then
     echo "Checking DYNAMICO source version"
@@ -762,5 +829,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function compile_icolmdzor {
+#-----------------------------------------------------------------------------
     if [[ $icolmdz = 1 ]]; then
       install_arch "ICOSA_LMDZ"
@@ -795,5 +864,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function run_bench {
+#-----------------------------------------------------------------------------
     local bench_cmd="./bench.sh"
 
@@ -1034,5 +1105,7 @@
 }
 
+#-----------------------------------------------------------------------------
 function run_bench_icosa {
+#-----------------------------------------------------------------------------
     local bench_cmd="./bench.sh"
 
@@ -1072,5 +1145,7 @@
 echo "install_lmdz.sh DEBUT $(date)"
 
+#-----------------------------------------------------------------------------
 function wrapper_run_all() {
+#-----------------------------------------------------------------------------
     # This is a wrapper to catch any "unexpected" error due to set -e and avoid abrupt stoppage which may confuse the user
     set_default_params
