Index: BOL/script_install_amaury/install_lmdz.sh
===================================================================
--- BOL/script_install_amaury/install_lmdz.sh	(revision 5083)
+++ BOL/script_install_amaury/install_lmdz.sh	(revision 5156)
@@ -49,4 +49,20 @@
 }
 
+function get_svn_branch {
+  local url=$1
+  local rev=$2
+  local res
+
+  res=$(svn log -v -q "$url" -r "$rev" -l 1 | cut -d "/" -f -4)
+  if echo "$res" | grep -q "/trunk/"; then
+    res=$(echo "$res" | grep "/trunk/" | head -1 | cut -d "/" -f 2-3)
+  elif echo "$res" | grep -q "/branches/"; then
+    res=$(echo "$res" | grep "/branches/" | head -1 | cut -d "/" -f 2-4)
+  else
+    echo "Could not determine svn branch for $url, r=$rev"
+  fi
+  echo "$res"
+}
+
 function set_default_params {
     # Valeur par défaut des parametres
@@ -61,4 +77,6 @@
     benchphysiq=""
     compphysiq="lmd"
+    is_1D="n"
+    fortran_file="gcm"
 
     parallel="none"
@@ -249,6 +267,11 @@
     if [[ $arch_dir = "" ]]; then
       arch_dir="$MODEL/modipsl/config/IPSLCM7/ARCH/";
-    elif ! readlink -fe "$arch_dir"; then
+    elif ! readlink -fe "$arch_dir" >/dev/null; then
       echo "STOP: no arch dir <$arch_dir>"; exit 1
+    fi
+
+    if ! (echo "$grid_resolution" | grep -q "x"); then
+      is_1D="y"
+      fortran_file="lmdz1d"
     fi
 }
@@ -313,5 +336,5 @@
         echo "problem installing with compiler $compiler"; exit 1
     fi
-    \rm tt a.out tt.f90
+    rm tt a.out tt.f90
 }
 
@@ -320,8 +343,8 @@
 
     mkdir -p "$MODEL"
-    MODEL=$(readlink -e -f "$MODEL"); echo "$MODEL"  # absolute path
+    MODEL=$(readlink -e -f "$MODEL"); echo "MODEL: $MODEL"  # absolute path
     if [[ ! -d "$MODEL/modipsl" ]]; then
         echo "##########################################################"
-        echo "Download a slightly modified version of LMDZ"
+        echo "Downloading a slightly modified version of modipsl+LMDZ"
         echo "##########################################################"
         cd "$MODEL"
@@ -332,5 +355,5 @@
         gunzip "modipsl.$version.tar.gz" &>> get.log
         tar xf "modipsl.$version.tar" &>> get.log
-        \rm "modipsl.$version.tar"
+        rm "modipsl.$version.tar"
         cd - &> /dev/null
     fi
@@ -463,5 +486,5 @@
 
     if $ncdf_compiler -I"$ncdfdir"/include test_netcdf90.f90 -L"$ncdfdir"/lib -lnetcdff -lnetcdf -Wl,-rpath="$ncdfdir"/lib && ./a.out; then
-        \rm test_netcdf90.f90 a.out
+        rm test_netcdf90.f90 a.out
     else
         cat <<EOF
@@ -615,8 +638,9 @@
             local lmdzbranch
             echo "Fetching LMDZ $svn_lmdz from the repository"
-            lmdzbranch=$(svn log -v -q https://svn.lmd.jussieu.fr/LMDZ -r "$svn_lmdz" | grep LMDZ | head -1 | sed -e 's:trunk/.*$:trunk:' | awk '{print $2}')
+            lmdzbranch=$(get_svn_branch "https://svn.lmd.jussieu.fr/LMDZ" "$svn_lmdz")
+            echo "branch is $lmdzbranch"
             cd "$MODEL/modipsl/modeles"
             rm -rf LMD*
-            svn co -r "$svn_lmdz" "https://svn.lmd.jussieu.fr/LMDZ$lmdzbranch" LMDZ
+            svn co -r "$svn_lmdz" "https://svn.lmd.jussieu.fr/LMDZ/$lmdzbranch" LMDZ
             cd - > /dev/null
         fi
@@ -636,7 +660,7 @@
 
     if [[ $used_lmdz_rev -le 4185 ]]; then
-        exe_name="bin/gcm_${grid_resolution}_phy${compphysiq}_${suff_para}${suff_orc}${suff_aer}${suff_iso}.e"
+        exe_name="bin/${fortran_file}_${grid_resolution}_phy${compphysiq}_${suff_para}${suff_orc}${suff_aer}${suff_iso}.e"
     else
-        exe_name="bin/gcm_${grid_resolution}_phy${compphysiq}_${rad}${suff_para}${suff_orc}${suff_aer}${suff_iso}.e"
+        exe_name="bin/${fortran_file}_${grid_resolution}_phy${compphysiq}_${rad}${suff_para}${suff_orc}${suff_aer}${suff_iso}.e"
     fi
 
@@ -660,5 +684,5 @@
     makelmdz="makelmdz_fcm $optim_flag -arch $arch -j $make_j"
     local para_compile_opt="-mem -parallel $parallel"; if [[ $parallel = "none" ]]; then para_compile_opt=""; fi
-    echo "$jobcmd ./$makelmdz $opt_rad $opt_cosp $opt_makelmdz_xios $opt_aer $opt_inlandsis $opt_isotopes -p $compphysiq -d ${grid_resolution} -v $fcm_veget_version $para_compile_opt gcm" > compile.sh
+    echo "$jobcmd ./$makelmdz $opt_rad $opt_cosp $opt_makelmdz_xios $opt_aer $opt_inlandsis $opt_isotopes -p $compphysiq -d ${grid_resolution} -v $fcm_veget_version $para_compile_opt $fortran_file" > compile.sh
     echo "Compiling lmdz using $(\cat compile.sh) (log: $lmdzlog) $(date)"
     chmod +x ./compile.sh
@@ -677,4 +701,6 @@
 
 function run_bench {
+    local bench_cmd="./bench.sh"
+
     cd "$MODEL/modipsl/modeles/LMDZ"*
 
@@ -683,8 +709,23 @@
         ./init.sh
     elif [[ $bench = 1 ]]; then
-        \rm -rf "BENCH${grid_resolution}"
-        local bench=bench_lmdz_${grid_resolution}
+      rm -rf "BENCH${grid_resolution}"
+      local bench=bench_lmdz_${grid_resolution}
+      if [[ $compphysiq = "lmdiso" ]]; then bench=bench_lmdz_iso_${grid_resolution}; fi
+
+      if [[ $is_1D = "y" ]] ; then  # 1D
+        myget "1D/1D.tar.gz"
+        mkdir -p "BENCH${grid_resolution}"
+        tar xf "1D.tar.gz" -C "BENCH${grid_resolution}" --strip-components=1
+        cd "BENCH${grid_resolution}"
+        # Below: ugly, but until we rewrite the 1D case...
+        sed -i'' -e "s:^listecas=.*$:listecas=ARMCU/REF:" -e "s:cd \$local/bin ; ./compile -L \$L:#cd \$local/bin ; ./compile -L \$L:" \
+            -e "s:./compile -L \$llm:#./compile -L \$llm:" -e "s:ln -sf \$bin/\\\\\${main}\${suffixe}.e .:ln -sf ../../../../../$exe_name \\\\\${main}\${suffixe}.e:" -e "s:gzip listing:cp listing restartphy.nc ../../../../; exit 0:" \
+            run.sh
+        cp "../$exe_name" bin/
+        bench_cmd="./run.sh -rad $rad"  # suppress ferret commands that launch after bench is "over"
+      else
         myget "3DBenchs/$bench.tar.gz"
-        tar xf "$bench.tar.gz"
+        mkdir "BENCH${grid_resolution}"
+        tar xf "$bench.tar.gz" -C "BENCH${grid_resolution}" --strip-components=1
 
         if [[ $cosp = "v1" || $cosp = "v2" ]]; then
@@ -786,5 +827,4 @@
         cd "BENCH${grid_resolution}"
 
-        local bench_cmd="./bench.sh"
         if [[ ${parallel:0:3} = "mpi" ]]; then
             # Lancement avec deux procs mpi et 2 openMP
@@ -822,4 +862,5 @@
             echo "./gcm.e &> listing" > bench.sh
         fi
+        chmod +x bench.sh
         # Getting orchidee stuff
         if [[ $veget = 'CMIP6' || $veget = "orch2.0" ]]; then  # TODO once we have a 2.2 bench, add it here (or in planned separate bench script)
@@ -862,7 +903,9 @@
         fi
 
+        fi
+
         if [[ -f ../arch.env ]]; then source ../arch.env; fi
 
-        echo "EXECUTION DU BENCH"
+        echo "STARTING BENCH"
         date
         if (! $bench_cmd &> out.bench) || ! (tail -n 1 listing | grep "Everything is cool"); then
