Index: BOL/LMDZ_Setup_amaury/setup.sh
===================================================================
--- BOL/LMDZ_Setup_amaury/setup.sh	(revision 4986)
+++ BOL/LMDZ_Setup_amaury/setup.sh	(revision 4991)
@@ -8,54 +8,36 @@
 ####################################################################
 function define_expert_options {
-  #NOTE : $optim  is part of $LMDZname (see definition of LMDZname below),
-  #   so that running with "-debug" needs to (re)install the model (install=-install in main.sh)
-  #   If you have already installed the model, and only want to recompile the gcm in debug mode,
-  #   add "-debug" to the compilation options in the compile.sh script created in the present folder, and run it (./compile.sh gcm)
-  #   ALTERNATIVELY : you can remove $optim in the definition of "LMDZname" below
-  #optim=""
-  optim="-debug"  # TODO temp
-
-  #NOTE : "testmode=y" is for running in test mode :
-  # the simulation job "tmp_$SIM" (created on $SCRATCHDIR) is automatically changed for a short run,
-  # and submitted to the Jean-Zay "test" queue :
-  #  a/ time=00:10:00  (run time limit = 10 min; for test queue, it must be 30 min maximum)
-  #  b/ nday=1 (this line, forcing nday to 1 day, is "hidden" in script_SIMU, by default it is commented out)
-  #  c/ #SBATCH --qos=qos_cpu-dev (this line is in script_SIMU, by default it is commented out)
-  #If you want to change "time", or "nday", but still run in "test" mode, modify the "if [ $debug = 1 ]...; fi" further below.
-  testmode="y"  # TODO revert
-
-  # Radiative code : "oldrad" or "rrtm" or "ecrad"
+  # optim: either "" or "-debug" to compile in debug mode (slower but better diagnosis of segfaults)
+  optim=""
+
+  # "n" or "y". If testmode="y", then simulations run for a single day per period.
+  # NOTE: you must set mthend accordingly !
+  testmode="n"
+
+  # Radiative code: "oldrad" / "rrtm" / "ecrad"
   rad="rrtm"
 
-  # AEROSOLS : n (=no) / clim (=average 1995-2014) / spla (interactive dust and sea salt)
+  #   !!! STRONG recommendation : experiments with DIFFERENT Orchidee or aerosol options should be performed in DIFFERENT LMDZ_Setup folders
+  #   !!! (especially as they may need different initial files)
+
+  # AEROSOLS : "n" (=no) / "clim" (=average 1995-2014) / "spla" (interactive dust and sea salt)
   # (WARNING : if you first run the scripts with aerosols=n, then you want to change to =clim ,
   #   you'll need to remove the INIT and LIMIT folders that have been created, then run main.sh with init=1
   #   in order to re-run the initialisation job, which downloads the aerosol files and interpolates them)
   aerosols="clim"
-  aerosols="n"  # TODO revert when we fix/investigate the aerosols issue
+  aerosols="n"  # TODO TEMP
 
   # SURFACE/VEGETATION SCHEME
-  # It is controlled by the single variable "veget" which can have the following values
-  # - "none": bucket scheme
-  # - "CMIP6" or "orch2.0": orchidee version used in CMIP exercise, rev 5661
-  # - "orch2.2": orchidee version used in IPSLCM7 configuration
-  # - number: orchidee version number : only rev 7983 on branch _2_2, and 7994 on trunk, are available
+  # - "none" (bucket scheme) / "CMIP6" or "orch2.0" (orchidee version used in CMIP exercise) / "orch2.2" (orchidee version used in IPSLCM7 configuration) / number (orchidee version number - only rev 7983 on branch _2_2, and 7994 on trunk, are available)
+  # TODO check w/ Adriana why only 7983 & 7994, see if still relevant - is it a compilation issue ? Or an INIT issue ?
   veget="CMIP6"
-
-  #AS : If you have installed the model with a given "veget" option, and you want to change it :
-  #   --> RECOMMENDED : re-install the model from scratch in a new TEST_PROD folder
-  #   TODO Amaury: check w/ Adriana what the use case is for lmdz_setup here
-  #   --> EXPERT : If you want to keep your previous installation, and not go through the install_lmdz.sh routine,
-  #    you will need to (a) install the proper version of ORCHIDEE in the modipsl/modeles directory, and
-  #                     (b) set the "veget" options (opt_veget, orchidee_rev, suforch) to their proper values
-  #                        in the file $LMDZD/modipsl/modeles/surface_env
-  # (NB : no need to initialise these vars here:
-  #     surface_env is either (re)created when (re)installing the model (run with install=-install),
-  #     or it already exists (install="").
-
-  # New snow scheme INLANDSIS (y/n)
-  # (this flag activates INLANDSIS compilation;
-  # not yet done : treatment of specific restart and def file)
+#  veget="6592"  # TODO correct bug in install_lmdz where we don't know which fcm arg to fwd if we only give the rev... see w/ Laurent (choice in ols install_lmdz: only support >2.0)
+
+  # New snow scheme INLANDSIS! "y" / "n"
+  # This flag activates INLANDSIS compilation; not yet done : treatment of specific restart and def file
   inlandsis="n"
+
+  # netcdf: 0 (use existing library) / 1 (recompile netcdf, slow)
+  netcdf=0
 
   # --->>> ALSO PAY ATTENTION TO OUTPUT files, frequency, level -------------
@@ -66,11 +48,9 @@
   #          For aerosols=n, the corresponding flags will automatically be set to "n".
   #   With XIOS : adjust DEF/XMLfiles*/file*xml
-
-  netcdf=0
 }
 
 # /!\ DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOU ARE DOING /!\
 
-function enable_groupe {  # In job scripts, sed platform-specific headers
+function enable_platform {  # In job scripts, sed platform-specific headers
   local file="$1"
   local platform
@@ -205,5 +185,5 @@
   fi
 
-  if [[ $climato = 0 && $freq = yr ]]; then
+  if [[ $climato = 0 && $freq = "yr" ]]; then
      echo "STOP: Running simulations with interannual SSTs is possible only month by month and a true calendar."
      echo "Change <climato> to <1> or <freq> to <mo> or modify setup.sh (experts)"; exit 1
@@ -397,5 +377,5 @@
     cp reb.sh "$local/$SIM/reb.sh"; chmod +x "$local/$SIM/reb.sh"
     sed -i'' -e "s:^rebuild=.*.$:rebuild=$LMDZD/$LMDZname/modipsl/bin/rebuild:" "$local/$SIM/reb.sh"
-    enable_groupe "$local/$SIM/reb.sh"
+    enable_platform "$local/$SIM/reb.sh"
 
     # Copy .def
@@ -454,5 +434,5 @@
   "$local/script_SIMU" >| "$SIMRUNDIR/tmp_$SIM"
 
-  enable_groupe "$SIMRUNDIR/tmp_$SIM"
+  enable_platform "$SIMRUNDIR/tmp_$SIM"
 
   if [[ $testmode = "y" ]]; then
@@ -539,4 +519,8 @@
   done
   cd - > /dev/null
+
+  if [[ $rad = "ecrad" && ! -d ecrad_data ]]; then
+    cd "$local"; wget https://lmdz.lmd.jussieu.fr/pub/3DInputData/ecrad/ecrad_data.tar; tar xvf ecrad_data.tar; cd - > /dev/null
+  fi
 }
 
@@ -648,5 +632,5 @@
   sed -e 's/anneeref=.*.$/anneeref='\$yr'/' DEF/run.def >| run.def
   echo Starting initialisation
-  $RUNCMD 1 $ce0l
+  OMP_NUM_THREADS=1 $RUNCMD 1 $ce0l  # ce0l requires MPI=OMP=1
   if [ $climato = 0 ]; then mv limit.nc limit.\$yr.nc; fi
 done
@@ -672,5 +656,6 @@
 
 # Copy initial and forcing files in $local/$INIT and $local/$LIMIT; also in $local/INPUT_SPLA if $aerosols=spla
-for f in sta* limit.nc gri*nc; do cp \$f $local/$INIT/\$f; done
+for f in sta* gri*nc; do cp \$f $local/$INIT/\$f; done
+if [[ $climato = 1 ]]; then cp limit.nc $local/$INIT/limit.nc; fi
 mkdir -p $local/$LIMIT
 for f in limit*.nc ; do cp \$f $local/$LIMIT/\$f; done
@@ -691,5 +676,5 @@
   # ANCIEN MULTI STEP   esac
 ...eod
-    enable_groupe tmp
+    enable_platform tmp
     echo "###############################################################################"
     echo "Submitting initialisation job <$SUBMITCMD tmp> from $(pwd)"
@@ -705,4 +690,18 @@
      $SUBMITCMD "tmp_$SIM"
      echo '###############################################################################'
+  fi
+}
+
+function message_post_submit {
+  if [[ $ok_guide = "y" && $init = 1 ]]; then
+    echo "Once initialisation is finished, you have to create nudging files"
+    echo "Edit era2gcm.sh and set the desired parameters in section <User choices>"
+    echo "Make sure you have acces to the chosen ERA files, and the required modules are loaded, then run : ./era2gcm.sh"
+    if [[ $aerosols = "spla" ]]; then
+      echo "Your aerosol choice is <spla>, so you need ERA 10m-winds interpolated on LMDZ grid. Use script era2gcm_uv10m.sh"
+    fi
+  else
+    echo "Si tout se passe bien, vous avez initialisé et lancé automatiquement la simulation."
+    echo "Le job qui a été lancé se trouve sur $SIMRUNTOPDIR/$MAINDIR/tmp_$SIM"
   fi
 }
@@ -724,4 +723,5 @@
 fetch_simu_init_files
 run_sim_or_init
+message_post_submit
 
 exit 1
@@ -730,7 +730,4 @@
 # COMPILATION OPTIONS depending on the user choices and LMDZ revision number $mysvn
 #-------------------------------------------------------
-if [[ $rad = "ecrad" && ! -d ecrad_data ]]; then
-    cd "$local"; wget https://lmdz.lmd.jussieu.fr/pub/3DInputData/ecrad/ecrad_data.tar; tar xvf ecrad_data.tar; cd - > /dev/null
-fi
 
 if [[ $rad = "ecrad" && $aerosols != "n" && $mysvn -lt 4489 ]] ; then echo "Les aerosols tropospheriques ne sont pas pris en charge par ecrad avant LMDZ rev 4489, ici rev est $mysvn"; exit 1; fi
@@ -760,20 +757,5 @@
 
 
-if [ $ok_guide = y -a $init = 1 ]; then
-   echo Once initialisation is finished, you have to create nudging files
-   echo Edit era2gcm.sh and set the desired parameters in section "User choices"
-   echo Make sure you have acces to the chosen ERA files, and the required modules are load
-   echo Then run : ./era2gcm.sh
-   if [ "$aerosols" = "spla" ]; then
-     echo Your aerosol choice is "spla", so you need ERA 10m-winds interpolated on LMDZ grid
-     echo Use script era2gcm_uv10m.sh
-   fi
-else
-   echo Si tout se passe bien, vous avez initialise et lance automatiquement
-   echo la simulation.
-   echo Si vous voulez modifier les caracteristiques du job, comme le temps
-   echo max ou le nombre de proc, il se trouve sur
-   echo $SIMRUNTOPDIR/$MAINDIR/tmp_$SIM
-fi
+
 
 ###############################################################################
