diff --git a/.gitignore b/.gitignore
index ab4a609c3f44a38db6ca82469ad3311996a2c686..a8c9756906901211d71b2d525e6a2d60cd1fe392 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,12 +4,16 @@ cfgs/work_cfgs.txt
 cfgs/*/BLD
 cfgs/*/EXP00
 cfgs/*/WORK
+cfgs/*/NEMOFILES
+cfgs/*/AGRIFLIB
 cfgs/*_ST
 
 tests/work_cfgs.txt
 tests/*/BLD
 tests/*/EXP00
 tests/*/WORK
+tests/*/NEMOFILES
+tests/*/AGRIFLIB
 tests/*_ST
 
 tools/*/BLD
diff --git a/.gitlab-ci-cnrs.yml b/.gitlab-ci-cnrs.yml
new file mode 100644
index 0000000000000000000000000000000000000000..186de555673d1e6f63bf2255e44acbd8709a61e2
--- /dev/null
+++ b/.gitlab-ci-cnrs.yml
@@ -0,0 +1,27 @@
+# HPC & configs lists to be tested with SETTE
+.parallel_HPC_CFG:
+  parallel:
+    matrix:
+      - HPC: [irene,jean-zay]
+        CONFIG: [ORCA2_ICE_PISCES,ORCA2_OFF_PISCES,AMM12,AGRIF,WED025,GYRE_PISCES,SAS,ORCA2_ICE_OBS]
+
+# HPC & testcases lists to be tested with SETTE
+.parallel_HPC_TST:
+  parallel:
+    matrix:
+      - HPC: [irene,jean-zay]
+        CONFIG: [SWG,ICE_AGRIF,OVERFLOW,LOCK_EXCHANGE,VORTEX,ISOMIP+]
+
+
+# variables declared hereafter will be avaible in all jobs
+# these 2 variables are needed for each HPC to be tested:
+# - SETTE_CFG: SETTE param.cfg file path
+# - SETTE_MOD: SETTE modules list
+
+variables:
+  # JEAN-ZAY
+  JZ_SETTE_CFG: "/linkhome/rech/genloc01/reee217/nemo_CI/param.cfg"
+  JZ_SETTE_MOD: "intel-compilers/19.1.3 intel-mpi/2019.9 hdf5/1.12.0-mpi netcdf-c/4.7.4-mpi netcdf-fortran/4.5.3-mpi git/2.25.0"
+  # IRENE
+  IR_SETTE_CFG: "/ccc/cont005/dsku/leger/home/user/locean/massons/nemo_CI/param.cfg"
+  IR_SETTE_MOD: "intel/19.0.5.281 mpi/openmpi/4.0.2 flavor/hdf5/parallel flavor/buildmpi/openmpi/4.0 netcdf-c/4.6.0 netcdf-fortran/4.4.4 hdf5/1.8.20 boost/1.69.0 blitz/0.10 c++/gnu/7.3.0 c/gnu/7.3.0"
diff --git a/.gitlab-ci-default.yml b/.gitlab-ci-default.yml
new file mode 100644
index 0000000000000000000000000000000000000000..0deb66fb2e00c332aa94072e5af27061f446e739
--- /dev/null
+++ b/.gitlab-ci-default.yml
@@ -0,0 +1,15 @@
+# default (but willingly wrong) values
+
+# HPC & configs lists to be tested with SETTE
+.parallel_HPC_CFG:
+  parallel:
+    matrix:
+      - HPC: [default]
+        CONFIG: [default]
+
+# HPC & testcases lists to be tested with SETTE
+.parallel_HPC_TST:
+  parallel:
+    matrix:
+      - HPC: [default]
+        CONFIG: [default]
diff --git a/.gitlab-ci-mercator.yml b/.gitlab-ci-mercator.yml
new file mode 100644
index 0000000000000000000000000000000000000000..b7a74c95af3db2f608d946b2630033d33602cf4d
--- /dev/null
+++ b/.gitlab-ci-mercator.yml
@@ -0,0 +1,32 @@
+# HPC & configs lists to be tested with SETTE
+.parallel_HPC_CFG:
+  parallel:
+    matrix:
+      - HPC: [aa,belenos]
+        #CONFIG: [ORCA2_ICE_PISCES,ORCA2_OFF_PISCES,AMM12,AGRIF_DEMO,WED025,GYRE_PISCES,ORCA2_SAS_ICE,ORCA2_ICE_OBS]
+        CONFIG: [ORCA2_ICE_PISCES,ORCA2_OFF_PISCES,AMM12,WED025,GYRE_PISCES,ORCA2_SAS_ICE,ORCA2_ICE_OBS]
+
+# HPC & testcases lists to be tested with SETTE
+.parallel_HPC_TST:
+  parallel:
+    matrix:
+      - HPC: [aa,belenos]
+        #CONFIG: [SWG,ICE_AGRIF,OVERFLOW,LOCK_EXCHANGE,VORTEX,ISOMIP+]
+        CONFIG: [SWG,OVERFLOW,LOCK_EXCHANGE,VORTEX,ISOMIP+]
+
+
+# variables declared hereafter will be avaible in all jobs
+# these 2 variables are needed for each HPC to be tested:
+# - SETTE_CFG: SETTE param.cfg file path
+# - SETTE_MOD: SETTE modules list
+
+variables:
+  # METEO-FRANCE BELENOS (INTEL_2018+INTEL-MPI)
+  BL_SETTE_CFG: "/home/ext/mr/smer/samsong/SRC/NEMO/main/sette/param.ci"
+  BL_SETTE_MOD: "gcc/9.2.0 intel/2018.5.274 intelmpi/2018.5.274 phdf5/1.8.18 netcdf_par/4.7.1_V2 xios/trunk/r2320_intel-impi git/2.27.0"
+  # ECMWF AA (INTEL_2021+OPEN-MPI)
+  AA_SETTE_CFG: "/home/ar0s/SRC/NEMO/main/sette/param.ci"
+  AA_SETTE_MOD: "prgenv/intel intel/2021.4.0 openmpi/4.1.1.1 hdf5-parallel/1.10.6 netcdf4-parallel/4.7.4 xios/trunk/r2320_intel-ompi"
+  # MERCATOR KARA (TODO)
+  #KR_SETTE_CFG: "/kara/data1/gsamson/SRC/NEMO/nemo/sette/param.ci"
+  #KR_SETTE_MOD: "gcc/9.3.0 openmpi/4.0.5_gcc9.3.0 hdf5/1.8.18_gcc9.3.0 netcdf/4.7.1_gcc9.3.0 xios/trunk_rev2136_gcc9.3.0 git/2.34.1"
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000000000000000000000000000000000000..d9496fce35fbbcd9110501445ab1b7bebf5b309c
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,180 @@
+#----------#
+# SETTE CI #
+#----------#
+
+
+include:
+  # default values will be overwritten depending on commit author
+  - local: '.gitlab-ci-default.yml'
+  - local: '.gitlab-ci-cnrs.yml'
+    rules:
+    - if: '$CI_COMMIT_AUTHOR =~ /.*masson.*/'
+  - local: '.gitlab-ci-mercator.yml'
+    rules:
+    - if: $CI_PIPELINE_SOURCE == "schedule"
+    #- if: '$CI_COMMIT_AUTHOR =~ /.*samson.*/ || $CI_COMMIT_AUTHOR =~ /.*chanut.*/'
+
+
+.cache: &cache_CFG
+  key: ${CONFIG}_${CI_COMMIT_SHORT_SHA}_${CI_PIPELINE_ID}
+  paths:
+    - cfgs/${CONFIG}_ST/EXP*
+    - cfgs/${CONFIG}_ST/BLD/bin
+    - cfgs/${CONFIG}_ST/cpp_${CONFIG}_ST.fcm
+
+.cache: &cache_TST
+  key: ${CONFIG}_${CI_COMMIT_SHORT_SHA}_${CI_PIPELINE_ID}
+  paths:
+    - tests/${CONFIG}_ST/EXP*
+    - tests/${CONFIG}_ST/BLD/bin
+    - tests/${CONFIG}_ST/cpp_${CONFIG}_ST.fcm
+
+
+stages:
+  - compile
+  - run
+  - check
+
+
+before_script:
+# the following commands will be executed at the beginning of each job
+# they are needed to copy param.cfg to SETTE directory and to load the modules
+  - declare -A HOST_NAME=( ["kara"]="KR" ["aa"]="AA" ["belenoslogin"]="BL" ["irene"]="IR" ["jean-zay"]="JZ" )
+  - SETTE_MOD=${HOST_NAME[${HOSTNAME//[0-9,-,.]*}]}_SETTE_MOD
+  - if [ -d ${HOME}/modules ]; then module use ${HOME}/modules; fi
+  - module purge || true   # force to always have 0 as error code (needed for irene)
+  - module load ${!SETTE_MOD}
+  - set -x   # debug prints
+  - SETTE_CFG=${HOST_NAME[${HOSTNAME//[0-9,-,.]*}]}_SETTE_CFG
+  - cp -av ${!SETTE_CFG} sette/param.cfg
+  - git config core.filemode false   # ignore git(lab) symlinks permissions changes when pushing then pulling cache ("old mode 100755 -> new mode 100644")
+  - SETTE_OPT="-b -u -w"
+
+
+# JOBS
+# sette_cmp_cfgs : compile reference configurations
+# sette_cmp_tsts : compile test cases
+# sette_run_cfgs : run reference configurations
+# sette_run_tsts : run test cases
+# sette_rpt_cfgs : check reference configurations results
+# sette_rpt_tsts : check test cases results
+
+sette_cmp_cfgs:
+  stage: compile
+  rules:
+    - if: $CI_PIPELINE_SOURCE == "schedule"
+  extends: .parallel_HPC_CFG   # HPC + configs loop 
+  cache:
+    <<: *cache_CFG
+    policy: push
+  tags:
+    - $HPC
+  script:
+    - cd sette
+    - ./sette.sh ${SETTE_OPT} -n ${CONFIG} -x "COMPILE" | tee -a sette_cmp_${CONFIG}_${CI_COMMIT_SHORT_SHA}_${HPC}.log
+    - cd -
+  artifacts:
+    paths:
+      - sette/sette_cmp_${CONFIG}_${CI_COMMIT_SHORT_SHA}_${HPC}.log
+    when: always
+
+sette_cmp_tsts:
+  stage: compile
+  rules:
+    - if: $CI_PIPELINE_SOURCE == "schedule"
+  extends: .parallel_HPC_TST   # HPC + tests loop
+  cache:
+    <<: *cache_TST
+    policy: push
+  tags:
+    - $HPC
+  script:
+    - cd sette
+    - ./sette.sh ${SETTE_OPT} -n ${CONFIG} -x "COMPILE" | tee -a sette_cmp_${CONFIG}_${CI_COMMIT_SHORT_SHA}_${HPC}.log
+    - cd -
+  artifacts:
+    paths:
+      - sette/sette_cmp_${CONFIG}_${CI_COMMIT_SHORT_SHA}_${HPC}.log
+    when: always
+
+sette_run_cfgs:
+  stage: run
+  rules:
+    - if: $CI_PIPELINE_SOURCE == "schedule"
+  needs: [sette_cmp_cfgs]   # limited to 50 jobs
+  dependencies: []   # do not retrieve previous artifacts
+  extends: .parallel_HPC_CFG   # HPC + configs loop
+  cache:
+    <<: *cache_CFG
+    policy: pull
+  tags:
+    - $HPC
+  script:
+    - cd sette
+    - ./sette.sh ${SETTE_OPT} -n ${CONFIG} -x "RESTART REPRO PHYOPTS CORRUPT" | tee -a sette_run_${CONFIG}_${CI_COMMIT_SHORT_SHA}_${HPC}.log
+    - cd -
+  artifacts:
+    paths:
+      - sette/sette_run_${CONFIG}_${CI_COMMIT_SHORT_SHA}_${HPC}.log
+      - cfgs/${CONFIG}_ST/*/sette.*.out
+      - cfgs/${CONFIG}_ST/*/sette.*.err
+      - cfgs/${CONFIG}_ST/*/ocean.output*
+    when: always
+
+sette_run_tsts:
+  stage: run
+  rules:
+    - if: $CI_PIPELINE_SOURCE == "schedule"
+  needs: [sette_cmp_tsts]   # limited to 50 jobs
+  dependencies: []   # do not retrieve previous artifacts
+  extends: .parallel_HPC_TST   # HPC + tests loop
+  cache:
+    <<: *cache_TST
+    policy: pull
+  tags:
+    - $HPC
+  script:
+    - cd sette
+    - ./sette.sh ${SETTE_OPT} -n ${CONFIG} -x "RESTART REPRO PHYOPTS CORRUPT" | tee -a sette_run_${CONFIG}_${CI_COMMIT_SHORT_SHA}_${HPC}.log
+    - cd -
+  artifacts:
+    paths:
+      - sette/sette_run_${CONFIG}_${CI_COMMIT_SHORT_SHA}_${HPC}.log
+      - tests/${CONFIG}_ST/*/sette.*.out
+      - tests/${CONFIG}_ST/*/sette.*.err
+      - tests/${CONFIG}_ST/*/ocean.output*
+    when: always
+
+sette_rpt_cfgs:
+  stage: check
+  rules:
+    - if: $CI_PIPELINE_SOURCE == "schedule"
+  needs: [sette_run_cfgs]   # limited to 50 jobs
+  dependencies: []   # do not retrieve previous artifacts
+  extends: .parallel_HPC_CFG   # HPC + configs loop
+  tags:
+    - $HPC
+  script:
+    - cd sette
+    - ./sette_rpt.sh -b -u -n "${CONFIG}" | tee -a sette_rpt_${CONFIG}_${CI_COMMIT_SHORT_SHA}_${HPC}.log
+  artifacts:
+    paths:
+      - sette/sette_rpt_${CONFIG}_${CI_COMMIT_SHORT_SHA}_${HPC}.log
+    when: always
+
+sette_rpt_tsts:
+  stage: check
+  rules:
+    - if: $CI_PIPELINE_SOURCE == "schedule"
+  needs: [sette_run_tsts]   # limited to 50 jobs
+  dependencies: []   # do not retrieve previous artifacts
+  extends: .parallel_HPC_TST   # HPC + tests loop
+  tags:
+    - $HPC
+  script:
+    - cd sette
+    - ./sette_rpt.sh -b -u -n "${CONFIG}" | tee -a sette_rpt_${CONFIG}_${CI_COMMIT_SHORT_SHA}_${HPC}.log
+  artifacts:
+    paths:
+      - sette/sette_rpt_${CONFIG}_${CI_COMMIT_SHORT_SHA}_${HPC}.log
+    when: always
\ No newline at end of file
diff --git a/README.rst b/README.rst
index 789b823be65109dd565f7abc3e0ff0c47dc8b109..fc2f7cc89aecb06fdc9940fcfa32d35d252c829a 100644
--- a/README.rst
+++ b/README.rst
@@ -1,3 +1,6 @@
+.. image:: https://forge.nemo-ocean.eu/nemo/nemo/badges/main/pipeline.svg
+           :target: https://forge.nemo-ocean.eu/nemo/nemo/-/commits/main
+
 **Contents**
 
 .. contents::
diff --git a/arch/MERCATOR/arch-X64_BELENOS_INTEL_OMPI.fcm b/arch/MERCATOR/arch-X64_BELENOS_INTEL_OMPI.fcm
index bb826c749d4cc957d766cd52526a5cdafec9d4d0..c0ace091c28976c3f3d63a22eb70ac42d0eff48b 100644
--- a/arch/MERCATOR/arch-X64_BELENOS_INTEL_OMPI.fcm
+++ b/arch/MERCATOR/arch-X64_BELENOS_INTEL_OMPI.fcm
@@ -55,7 +55,8 @@
 
 %CPP                 cpp
 %FC                  mpifort -c -cpp
-%FCFLAGS             -march=core-avx2 -i4 -r8 -O3 -fp-model strict -fno-alias -align array64byte
+%PROD_FCFLAGS        -march=core-avx2 -i4 -r8 -O3 -fp-model strict -fno-alias -align array64byte
+%DEBUG_FCFLAGS       -march=core-avx2 -i4 -r8 -g -O0 -debug all -traceback -fp-model strict -ftrapuv -check all,noarg_temp_created -fpe-all0 -ftz -init=arrays,snan,huge
 %FFLAGS              %FCFLAGS
 %LD                  mpifort
 %LDFLAGS             
diff --git a/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_top_cfg b/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_top_cfg
index 14d9a89e2d3217126f2bebdf7e78eea5e03a7424..dd3f17f3273598c95b4b6a9456bf8db6fff3b9d1 100644
--- a/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_top_cfg
+++ b/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_top_cfg
@@ -114,7 +114,7 @@
    sn_trcsbc(14) = 'dust.orca.new'   ,       -1          , 'dustfer'     ,  .true.      , .true. , 'yearly'  , ''       , ''    , ''
    sn_trcsbc(23) = 'ndeposition.orca',      -12          , 'ndep'        ,  .false.     , .true. , 'yearly'  , ''       , ''    , ''
    rn_trsfac(5)  = 3.774194e-02     !  (  1E-3 / 31. * 117 )
-   rn_trsfac(7)  = 9.572954e-03     !  ( 8.8   / 28.1 )
+   rn_trsfac(7)  = 9.572954e-03     !  (  0.269 / 28.1 )
    rn_trsfac(14) = 6.2667860e-04    !  (  0.035 / 55.85 )
    rn_trsfac(23) = 5.2232143e-01    !  ( From kgN m-2 s-1 to molC l-1 ====> zfact = 7.3125/14 )
    rn_sbc_time   = 1.               !  Time scaling factor for SBC and CBC data (seconds in a day)
diff --git a/cfgs/ORCA2_OFF_PISCES/EXPREF/namelist_top_cfg b/cfgs/ORCA2_OFF_PISCES/EXPREF/namelist_top_cfg
index 14d9a89e2d3217126f2bebdf7e78eea5e03a7424..dd3f17f3273598c95b4b6a9456bf8db6fff3b9d1 100644
--- a/cfgs/ORCA2_OFF_PISCES/EXPREF/namelist_top_cfg
+++ b/cfgs/ORCA2_OFF_PISCES/EXPREF/namelist_top_cfg
@@ -114,7 +114,7 @@
    sn_trcsbc(14) = 'dust.orca.new'   ,       -1          , 'dustfer'     ,  .true.      , .true. , 'yearly'  , ''       , ''    , ''
    sn_trcsbc(23) = 'ndeposition.orca',      -12          , 'ndep'        ,  .false.     , .true. , 'yearly'  , ''       , ''    , ''
    rn_trsfac(5)  = 3.774194e-02     !  (  1E-3 / 31. * 117 )
-   rn_trsfac(7)  = 9.572954e-03     !  ( 8.8   / 28.1 )
+   rn_trsfac(7)  = 9.572954e-03     !  (  0.269 / 28.1 )
    rn_trsfac(14) = 6.2667860e-04    !  (  0.035 / 55.85 )
    rn_trsfac(23) = 5.2232143e-01    !  ( From kgN m-2 s-1 to molC l-1 ====> zfact = 7.3125/14 )
    rn_sbc_time   = 1.               !  Time scaling factor for SBC and CBC data (seconds in a day)
diff --git a/ext/FCM/bin/fcm_internal b/ext/FCM/bin/fcm_internal
index 3c95240ea857bbc7faca7cba1437801035417fd5..ccbedd48c041fa3f5512f2594edbb9230383e758 100755
--- a/ext/FCM/bin/fcm_internal
+++ b/ext/FCM/bin/fcm_internal
@@ -9,6 +9,7 @@ use strict;
 use warnings;
 
 use Fcm::Timer qw{timestamp_command};
+use File::Spec;
 
 # Function declarations
 sub catfile;
diff --git a/makenemo b/makenemo
index 5d03dcc173bf75e896bb8794df6356b5eb0492f2..7e563da7c95fa612e347b70921950f5edba602ef 100755
--- a/makenemo
+++ b/makenemo
@@ -1,9 +1,8 @@
 #!/bin/bash
-#set -x
 set -o posix
+#set -x
 #set -u
 #set -e
-#+
 #
 # ===============
 # makenemo
@@ -16,15 +15,12 @@ set -o posix
 # SYNOPSIS
 # ========
 #
-# ::
-#
 #  $ makenemo
 #
 #
 # DESCRIPTION
 # ===========
 #
-#
 # This script aims :
 #
 # - to choose MYCONFIG
@@ -44,11 +40,8 @@ set -o posix
 #
 #  Locally defined :
 #
-# - TAB         : NEMO subdirectory used (read)
 # - MAIN_DIR    : self explaining
 # - CONFIG_DIR  :   "    "    "
-# - MODELES_DIR :   "    "    "
-# - TOOLS_DIR   :   "    "    "
 # - NEMO_DIR    :   "    "    "
 # - REMOTE_CTL  : URL link to a remote resource list for an external configuration
 #                 which is not part of the reference suite
@@ -59,62 +52,26 @@ set -o posix
 # EXAMPLES
 # ========
 #
-# ::
-#
-#  $ ./makenemo -m ifort_osx - j3 -n ORCA2_SI3_PISCES
-#
-#
-# TODO
-# ====
-#
-# option debug
-#
-#
-# EVOLUTIONS
-# ==========
-#
-# $Id: makenemo 15186 2021-08-12 16:39:09Z gsamson $
-#
-#
-#
-#   * creation
-#
-#-
+#  $ ./makenemo -m ifort_osx -j 3 -r ORCA2_ICE_PISCES -n MY_ORCA2
 
-#-
-##- Initialization of the options ---
+
+# Initialization of the options
 x_d=''; x_h=''; x_n=''; x_r=''; x_c='';
 x_u=''; x_a=''; x_m=''; x_t=''; x_b='';
-x_j='1'; x_e='none'; x_s='src'; x_v='1'
-x_c_cfg=0
-x_nocdf=0
-
-##- Local variables ---
-b_n=$(basename ${0})
-OPTIND='1'
-MAIN_DIR=$(cd $(dirname "$0"); pwd)
-MAIN_DIR=${MAIN_DIR%/sette}
-MAIN_DIR=${MAIN_DIR%/tools}
-MAIN_DIR=${MAIN_DIR%/cfgs}
-MAIN_DIR=${MAIN_DIR%/tests}
-MAIN_DIR=${MAIN_DIR%/ext}
-MAIN_DIR=${MAIN_DIR%/arch}
-export MAIN_DIR
-#
-export CFGS_DIR=${MAIN_DIR}/cfgs
-export TESTS_DIR=${MAIN_DIR}/tests
-export TOOLS_DIR=${MAIN_DIR}/tools
-export COMPIL_DIR=${MAIN_DIR}/mk
-export NEMO_DIR=${MAIN_DIR}/${x_s}
-export AGRIFUSE='10'
+x_j='1'; x_e=''; x_s='src'; x_v='1'
 list_key='0'; chk_key='1'
 list_add_key=''; list_def_key=''; list_del_key=''
-#-
-#- FCM and functions location ---
-export PATH=${MAIN_DIR}/ext/FCM/bin:$PATH
+x_c_cfg=0; x_nocdf=0
+
+
+# Local variables
+MAIN_DIR=$(cd $(dirname "$0"); pwd)
+MAIN_DIR=${MAIN_DIR%/+(sette|tools|cfgs|tests|ext|arch)}
+COMPIL_DIR=${MAIN_DIR}/mk
+PATH=${MAIN_DIR}/ext/FCM/bin:$PATH
 
-#-
-#- Choice of the options ---
+
+# Choice of the options
 while [ ${#1} -gt 0 ]; do
     
     case "$1" in
@@ -228,91 +185,107 @@ EOF
     shift
 done
 
-export NEW_CONF=${x_n}
+
+# Variables definition based on options
 NBR_PRC=${x_j}
 CMP_NAM=${x_m}
-NEM_SUBDIR=${x_d}
-REF_CONF=${x_r}
-DEMO_CONF=${x_a}
-export NEMO_DIR=${MAIN_DIR}/${x_s}
 NEMO_DBG=${x_b}
+NEMO_DIR=${MAIN_DIR}/${x_s}
+
+
+# Print available arch files
+[ "${CMP_NAM}" == 'all' ] && ${COMPIL_DIR}/Flist_archfile.sh && exit 0
+
+
+# New config case
+if [ -n "${x_n}" ]; then
+
+  # Look for already-existing new config
+  NEW_CONF=${x_n}
+  if [ -n "${x_t}" ]; then
+    NEW_DIR=$( find -L ${x_t} -maxdepth 1 -type d -name ${x_n} 2>/dev/null )
+  else
+    NEW_DIR=$( find -L ${MAIN_DIR}/cfgs ${MAIN_DIR}/tests -maxdepth 1 -type d -name ${NEW_CONF} 2>/dev/null )
+  fi
+  NEW_NB=$( echo ${NEW_DIR} | wc -w )
+  NEW_CMP=$( grep -l "^${NEW_CONF} " ${MAIN_DIR}/cfgs/*_cfgs.txt ${MAIN_DIR}/tests/*_cfgs.txt | tail -1 )
+
+  # Define if new config needs to be created or not
+  if [[ ${NEW_NB:-0} -eq 0 || -z "${NEW_CMP}" ]]; then
+    DO_NEW=1
+  else
+    DO_NEW=0
+    NEW_SUB="$( grep "^${NEW_CONF} " ${NEW_CMP} | awk '{$1 = ""; print $0}' )"
+    if [[ -n "${x_r}" || -n "${x_a}" ]]; then
+      echo -e "\nWARNING: ${NEW_CONF} configuration is already existing, we ignore \"-r\" & \"-a\" options\n"
+    fi
+  fi
 
-[ "${CMP_NAM}" == 'all' ] && . ${COMPIL_DIR}/Flist_archfile.sh all && exit
-
-# '-r': reference config ('cfgs' directory)
-if [ -n "${REF_CONF}" ]; then
-    conf_file=ref_cfgs.txt ; export CONFIG_DIR=${CFGS_DIR} ; TML_CONF=${REF_CONF}
-# '-a': testcases ('tests' directory)
-elif [ -n "${DEMO_CONF}" ]; then
-    conf_file=demo_cfgs.txt; export CONFIG_DIR=${TESTS_DIR}; TML_CONF=${DEMO_CONF}
-# '-n': new or already-existing config (any directory)
-elif [[ -n "${NEW_CONF}" && -z "${conf_file}" ]]; then
-    # already-existing config (check work_cfgs.txt)
-    if [ $( grep -l "^${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt 2> /dev/null | wc -l ) -eq 1 ]; then
-        conf_file=$( grep -l "^${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt )
-        export CONFIG_DIR=$( dirname $conf_file ); conf_file=$( basename $conf_file )
-        TML_CONF=${NEW_CONF}
-    # new config (check ref_cfgs.txt & demo_cfgs.txt)
-    elif [ $( grep -l "^${NEW_CONF} " ${CFGS_DIR}/ref_cfgs.txt ${TESTS_DIR}/demo_cfgs.txt 2> /dev/null | wc -l ) -eq 1 ]; then
-        conf_file=$( grep -l "^${NEW_CONF} " ${CFGS_DIR}/ref_cfgs.txt ${TESTS_DIR}/demo_cfgs.txt )
-        export CONFIG_DIR=$( dirname $conf_file ); conf_file=$( basename $conf_file )
-        TML_CONF=${NEW_CONF}
-    # config not found in both cfgs & tests directories
-    else
-        echo -e "\033[0;31m\nUser configuration ${NEW_CONF} not found !"
-        echo -e "Please choose a reference configuration (-r) or a testcase (-a)"
-        echo -e "among this list to create your own configuration (-n):"
-        ${COMPIL_DIR}/Flist_cfgs.sh
-        exit 2
+fi
+
+
+# Define ref config if new config not defined or not existing yet
+if [[ ${DO_NEW:-0} -eq 1 || -z "${NEW_CONF}" ]]; then
+
+  if [[ -n "${x_r}" || -n "${x_a}" ]]; then
+    REF_DIR=$( find ${MAIN_DIR}/cfgs ${MAIN_DIR}/tests -maxdepth 1 -type d -name ${x_r:-""} -o -name ${x_a:-""} 2>/dev/null )
+    REF_NB=$( echo ${REF_DIR} | wc -w )
+    REF_CMP=$( grep -l "^${x_r} \|^${x_a} " ${MAIN_DIR}/cfgs/ref_cfgs.txt ${MAIN_DIR}/tests/demo_cfgs.txt )
+    if [[ ${REF_NB} -eq 1 && -n "${REF_CMP}" ]]; then
+      REF_CONF=$(basename ${REF_DIR})
+      REF_TYPE=$(basename ${REF_DIR%\/*})
+      REF_FILE=$(basename ${REF_CMP})
+      REF_SUB="$( grep "^${REF_CONF} " ${REF_CMP} | awk '{$1 = ""; print $0}' )"
+    elif [ ${REF_NB} -gt 1 ]; then
+      echo -e "Please choose only one reference configuration (-r) or testcase (-a)"; exit 2
+    elif [ ${REF_NB} -eq 0 ]; then
+      echo -e "Please choose at least one reference configuration (-r) or testcase (-a) from:"
+      ${COMPIL_DIR}/Flist_cfgs.sh ${MAIN_DIR}; exit 2
     fi
-# using both '-r' and '-a' options
-elif [[ -n "${REF_CONF}" && -n "${DEMO_CONF}" ]]; then
-    echo -e "\033[0;31m\nYou have to choose whether you work with:"
-    echo -e "  - LTS configurations in ./cfgs  ('-r') or"
-    echo -e "  - Unsupported cases  in ./tests ('-a')\033[0m\n"
-    exit 2
-# config found in both cfgs & tests directories
-elif [ $( grep -l "^${NEW_CONF} " */work_cfgs.txt 2> /dev/null | wc -l ) -gt 1 ]; then
-    echo -e "\033[0;31m\nUser configuration ${NEW_CONF} is present in both"
-    echo -e "cfgs/work_cfgs.txt and tests/work_cfgs.txt files"
-    echo -e "Please choose only one \033[0m"
-    exit 2
-# 'all': list all available configurations
-elif [[ "${REF_CONF}" == 'all' || "${DEMO_CONF}" == 'all' ]]; then
-    ${COMPIL_DIR}/Flist_cfgs.sh
-    exit 0
-# any other case
-else
-    exit 2
+  else
+    echo -e "Please choose at least one reference configuration (-r) or testcase (-a) from:"
+    ${COMPIL_DIR}/Flist_cfgs.sh ${MAIN_DIR}; exit 2
+  fi
+
+  # force config creation if ref config installed outside nemo directory
+  if [[ -n "${x_t}" && ${x_t} != ${REF_DIR%\/*} ]]; then DO_NEW=1; fi
+
 fi
 
-if [ -z "${NEW_CONF}" ]; then NEW_CONF=$TML_CONF; fi
-export NEMO_TDIR=${x_t:-$CONFIG_DIR}
+
+# Current config (new or ref) definition
+CFG_DIR=$( dirname ${NEW_CMP:-${REF_CMP}} )
+CUR_DIR=${NEW_DIR:-${REF_DIR}}
+CUR_CONF=${NEW_CONF:-${REF_CONF}}
+CUR_SUB=${NEW_SUB:-${REF_SUB}}
+NEMO_TDIR=${x_t:-${CUR_DIR%\/*}}
 
 
-# check configuration existence & clean it if asked
-incfg=$( find $NEMO_TDIR -type d -maxdepth 1 -name ${NEW_CONF} 2>/dev/null | wc -l )   # this configuration exists in CFGS_DIR
-if [ $incfg -eq 1 ] ; then
-    # CLEANING
+# Config cleaning
+if [ -d ${NEMO_TDIR}/${CUR_CONF} ]; then
+
     if [ $x_c_cfg -eq 1 ] ; then
-        . ${COMPIL_DIR}/Fclean_config.sh
+        ${COMPIL_DIR}/Fclean_config.sh ${NEMO_TDIR}/${CUR_CONF}
         exit 0
     elif [ ${#x_c} -ne 0 ]; then
-        #read -p "Are you sure that you want to clean $NEW_CONF configuration ? " -n 1 -r; echo
+
+        #read -p "Are you sure that you want to clean $CUR_CONF configuration ? " -n 1 -r; echo
         #if [[ $REPLY =~ ^[Yy]$ ]]; then
-            # We coose the default light file
-            [ $x_nocdf -eq 1 ] && export USEBLD=bldxagxcdf.cfg || export USEBLD=bldxag.cfg
-            # We look after agrif
-            grep key_agrif ${NEMO_TDIR}/BLD/cpp.fcm 2>/dev/null && export AGRIFUSE=1 && export USEBLD=${USEBLD/xag/}
+            # choose & generate fcm cfg file
+            [ $x_nocdf -eq 1 ] && USEBLD=bldxagxcdf.cfg || USEBLD=bldxag.cfg
+            grep key_agrif ${NEMO_TDIR}/${CUR_CONF}/BLD/cpp.fcm 2>/dev/null && USEBLD=${USEBLD/xag/}
+            sed -e "s~MAIN_DIR~${MAIN_DIR}~; s~NEMO_TDIR~${NEMO_TDIR}~; s~CUR_CONF~${CUR_CONF}~; s~COMPIL_DIR~${COMPIL_DIR}~" ${COMPIL_DIR}/${USEBLD} > ${NEMO_TDIR}/${CUR_CONF}/BLD/${USEBLD}
+
             # fcm clean
-            fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD || exit 1
-            # add remove for clean option
-            echo -e '\nCleaning '${NEW_CONF}' building directories and variables\n'
+            fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${NEMO_TDIR}/${CUR_CONF}/BLD/${USEBLD} || exit 1
+
+            # remove all build directories
+            echo -e '\nCleaning '${CUR_CONF}' building directories and variables\n'
             for dir in AGRIFLIB BLD LONG NEMOFILES REPRO_* SHORT WORK; do
-               rm -rf ${NEMO_TDIR}/${NEW_CONF}/$dir
+               rm -rf ${NEMO_TDIR}/${CUR_CONF}/$dir
             done
             for file in cpp.history cpp.fcm full_key_list.txt; do
-               rm -f ${NEMO_TDIR}/${NEW_CONF}/BLD/$file
+               rm -f ${NEMO_TDIR}/${CUR_CONF}/BLD/$file
             done
             exit 0
         #else
@@ -320,117 +293,108 @@ if [ $incfg -eq 1 ] ; then
         #    exit 2
         #fi
     fi
-    if [[ -n "$x_n" && -n "$REF_CONF"  ]]; then echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-r $REF_CONF\"\n"; REF_CONF=""; fi
-    if [[ -n "$x_n" && -n "$DEMO_CONF" ]]; then echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-a $DEMO_CONF\"\n"; DEMO_CONF=""; fi
-elif [ $incfg -eq 0 ]; then
+else
     [ $x_c_cfg -eq 1 ] && echo -e "\nWARNING: Configuration cleaning of a non-existing configuration, we ignore\n" && exit 0
     [  ${#x_c} -ne 0 ] && echo -e "\nWARNING: Compilation cleaning of a non-existing configuration, we ignore\n" && exit 0
 fi
 
 
-## No ref. cfg or demo selected
-if [[ -z "${REF_CONF}" && -z "${DEMO_CONF}" && $incfg -eq 0 ]]; then
-    echo -e "\033[0;31m\nAt least a reference configuration ('-r'), a test case ('-a'), "
-    echo -e "a remote configuration ('-u') has to be choosen to build a new configuration!!!\033[0m"
-    ${COMPIL_DIR}/Flist_cfgs.sh
-    exit 2
+# Create/update config components list
+NEM_SUBDIR=( ${x_d:-${CUR_SUB}} )
+if [ ${DO_NEW:-0} -eq 1 ]; then
+    echo
+    printf "\nYou are installing a new configuration %s from %s " ${CUR_CONF} ${REF_CONF}
+    printf  "with sub-components: %s\n"  "${NEM_SUBDIR[*]}"
+    echo
+else
+    echo
+    printf "\nYou are compiling an existing configuration %s " ${CUR_CONF}
+    printf  "with sub-components: %s\n"  "${NEM_SUBDIR[*]}"
+    echo
 fi
-
-## Update sub-comps if needed
-if [ -z "${NEM_SUBDIR}" ]; then
-    NEM_SUBDIR=$( grep "${TML_CONF} " ${CONFIG_DIR}/${conf_file}  | awk '{$1 = ""; print $0}' )
+if [[ -n "${x_d}" || ${DO_NEW:-0} -eq 1 ]]; then
+    [ -f ${CFG_DIR}/work_cfgs.txt ] && sed -i "/^${CUR_CONF} /d" ${CFG_DIR}/work_cfgs.txt
+    echo ${CUR_CONF} "${NEM_SUBDIR[*]}" >> ${CFG_DIR}/work_cfgs.txt
 fi
 
-export NEM_SUBDIR="${NEM_SUBDIR}" NEW_CONF="${NEW_CONF}"
 
-## Create new config
-if [ ${TML_CONF} != ${NEW_CONF} ]; then
-    echo
-    printf "\nYou are installing a new configuration %s from %s " ${NEW_CONF} ${TML_CONF}
-    if [ -n "${NEM_SUBDIR}" ]; then printf  "with sub-components: %s\n"  "${NEM_SUBDIR}"; fi
-    echo
-fi
-${COMPIL_DIR}/Fmake_config.sh ${NEMO_TDIR}/${NEW_CONF} ${CONFIG_DIR}/${TML_CONF}  # must be called for existing config to create EXP00 if not existing
+# Create config directories
+${COMPIL_DIR}/Fmake_config.sh ${NEMO_TDIR}/${CUR_CONF} ${REF_DIR:-${NEMO_TDIR}/${CUR_CONF}}
 
-## Save new configuration with sub-components set in work_cfgs.txt
-[ -f ${CONFIG_DIR}/work_cfgs.txt ] && sed -i "/^${NEW_CONF} /d" ${CONFIG_DIR}/work_cfgs.txt
-echo ${NEW_CONF} "${NEM_SUBDIR}" >> ${CONFIG_DIR}/work_cfgs.txt
 
-#- Create the WORK ---
-#- Clean links and librairies ---
-#- Creating the good links, at first on OCE ---
-. ${COMPIL_DIR}/Fmake_WORK.sh ${x_e[@]} || exit 3
+# Create/update WORK directory
+${COMPIL_DIR}/Fmake_WORK.sh "${NEM_SUBDIR[*]/#/${NEMO_DIR}/}" "${x_e:-"MY_SRC"}" ${NEMO_TDIR}/${CUR_CONF} || exit 3
 
-. ${COMPIL_DIR}/Fmake_bld.sh ${CONFIG_DIR} ${NEW_CONF} ${NEMO_TDIR} || exit 3
 
-# build the complete list of the cpp keys of this configuration
+# Build the complete list of the CPP keys of this configuration
 if [[ ${chk_key} -eq 1 || ${list_key} -eq 1 ]] ; then
-    for i in $( grep "^ *#.* key_" ${NEMO_TDIR}/${NEW_CONF}/WORK/* ); do
-	echo $i | grep key_ | sed -e "s/=.*//"
-    done \
-	| sort -d | uniq > ${NEMO_TDIR}/${NEW_CONF}/BLD/full_key_list.txt
-    
-    [ ${list_key} -eq 1 ] && echo && cat ${NEMO_TDIR}/${NEW_CONF}/BLD/full_key_list.txt && exit 0
+    grep -h "^#.*defined.*" ${NEMO_TDIR}/${CUR_CONF}/WORK/* | \
+    grep -o "key_[[:alnum:]]\+\|key_[[:alnum:]]\+_[[:alnum:]]\+\|iso_[[:alnum:]]\+_[[:alnum:]]\+" | \
+    sort | uniq > ${NEMO_TDIR}/${CUR_CONF}/BLD/full_key_list.txt
+    [ ${list_key} -eq 1 ] && echo && cat ${NEMO_TDIR}/${CUR_CONF}/BLD/full_key_list.txt && exit 0
 fi
 
-#- At this stage new configuration has been added, we add or remove keys
-[ ! -z "${list_add_key}" ] && { . ${COMPIL_DIR}/Fadd_keys.sh ${NEW_CONF} add_key ${list_add_key}; }
-[ ! -z "${list_def_key}" ] && { . ${COMPIL_DIR}/Fdef_keys.sh ${NEW_CONF} def_key ${list_def_key}; }
-[ ! -z "${list_del_key}" ] && { . ${COMPIL_DIR}/Fdel_keys.sh ${NEW_CONF} del_key ${list_del_key}; }
 
-#- check that all keys are really existing...
+# CPP keys addition/removal
+[ -n "${list_add_key}" ] && ${COMPIL_DIR}/Fadd_keys.sh ${NEMO_TDIR}/${CUR_CONF} ${list_add_key}
+[ -n "${list_def_key}" ] && ${COMPIL_DIR}/Fdef_keys.sh ${NEMO_TDIR}/${CUR_CONF} ${list_def_key}
+[ -n "${list_del_key}" ] && ${COMPIL_DIR}/Fdel_keys.sh ${NEMO_TDIR}/${CUR_CONF} ${list_del_key}
+
+
+# CPP keys check
 if [ $chk_key -eq 1 ] ; then
-    for kk in $( cat ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm ); do
-	if [ "$( echo $kk | cut -c 1-4 )" == "key_" ]; then
-	    kk=${kk/=*/}
-	    if [ ! $( grep -w $kk ${NEMO_TDIR}/${NEW_CONF}/BLD/full_key_list.txt ) ]; then
-		echo
-		echo "E R R O R : key "$kk" is not found in ${NEMO_TDIR}/${NEW_CONF}/WORK routines..."
-		echo "we stop..."
-		echo
-		exit 1
-	    fi
-	fi
+    for kk in $( sed -n "s/bld::tool::fppkeys \+//p" ${NEMO_TDIR}/${CUR_CONF}/cpp_${CUR_CONF}.fcm ); do
+        if ! grep -q $kk ${NEMO_TDIR}/${CUR_CONF}/BLD/full_key_list.txt; then
+	    echo
+	    echo "E R R O R : key "$kk" is not found in ${NEMO_TDIR}/${CUR_CONF}/WORK routines..."
+	    echo "we stop..."
+	    echo
+	    exit 1
+        fi
     done  
 fi
 
-#- At this stage cpp keys have been updated. we can check the arch file
-#- When used for the first time, choose a compiler ---
-. ${COMPIL_DIR}/Fcheck_archfile.sh ${NEMO_TDIR}/${NEW_CONF}/BLD/arch_nemo.fcm ${NEMO_TDIR}/${NEW_CONF}/BLD/cpp.fcm ${CMP_NAM} || exit 3
-#-
-#_ END OF CONFIGURATION PHASE
-#_
 
-#-
-#- Compile ---
+# CPP & arch files check
+ln -sf ${NEMO_TDIR}/${CUR_CONF}/cpp_${CUR_CONF}.fcm ${NEMO_TDIR}/${CUR_CONF}/BLD/cpp.fcm
+${COMPIL_DIR}/Fcheck_archfile.sh ${NEMO_TDIR}/${CUR_CONF}/BLD/arch_nemo.fcm ${NEMO_TDIR}/${CUR_CONF}/BLD/cpp.fcm ${MAIN_DIR}/arch/arch-${CMP_NAM}.fcm ${NEMO_DBG} || exit 3
 
+
+# Compilation
 if [ "${NBR_PRC}" -gt 0 ]; then
 
-    # We coose the default light file
-    [ $x_nocdf -eq 1 ] && export USEBLD=bldxagxcdf.cfg || export USEBLD=bldxag.cfg
+    # choose & generate fcm cfg file
+    [ $x_nocdf -eq 1 ] && USEBLD=bldxagxcdf.cfg || USEBLD=bldxag.cfg
 
-    # We look after agrif
-    grep key_agrif ${NEMO_TDIR}/${NEW_CONF}/BLD/cpp.fcm 2>/dev/null && export AGRIFUSE=1 && export USEBLD=${USEBLD/xag/}
-    . ${COMPIL_DIR}/Fprep_agrif.sh ${NEW_CONF} ${NEMO_TDIR} arch_nemo.fcm || exit 3
-    
-    ## if AGRIF we do a first preprocessing
-    if [[ ${#x_c} -eq 0 && "$AGRIFUSE" -eq 1 ]]; then
-	fcm build --ignore-lock -j 1 ${COMPIL_DIR}/bld_preproagr.cfg || exit 1
-	echo ''
+    # AGRIF preprocessing
+    grep key_agrif ${NEMO_TDIR}/${CUR_CONF}/BLD/cpp.fcm 2>/dev/null && USEBLD=${USEBLD/xag/}
+    if [[ ! ${USEBLD} =~ "xag" ]]; then
+        ${COMPIL_DIR}/Fprep_agrif.sh ${MAIN_DIR} ${NEMO_TDIR}/${CUR_CONF} || exit 3
+
+        # compile & copy conv
+        sed -e "s~MAIN_DIR~${MAIN_DIR}~; s~NEMO_TDIR~${NEMO_TDIR}~; s~CUR_CONF~${CUR_CONF}~; s~COMPIL_DIR~${COMPIL_DIR}~" ${COMPIL_DIR}/conv.cfg > ${NEMO_TDIR}/${CUR_CONF}/BLD/conv.cfg
+        fcm build ${NEMO_TDIR}/${CUR_CONF}/BLD/conv.cfg || exit 1
+        ln -sfv ${MAIN_DIR}/ext/AGRIF/agrif_oce.in ${NEMO_TDIR}/${CUR_CONF}/AGRIFLIB/bin/conv ${NEMO_TDIR}/${CUR_CONF}/NEMOFILES/.
+
+        sed -e "s~MAIN_DIR~${MAIN_DIR}~; s~NEMO_TDIR~${NEMO_TDIR}~; s~CUR_CONF~${CUR_CONF}~; s~COMPIL_DIR~${COMPIL_DIR}~" ${COMPIL_DIR}/bld_preproagr.cfg > ${NEMO_TDIR}/${CUR_CONF}/BLD/bld_preproagr.cfg
+	fcm build --ignore-lock -j 1 ${NEMO_TDIR}/${CUR_CONF}/BLD/bld_preproagr.cfg || exit 1
+	echo
 	echo "---------------------------------"
 	echo "CONV preprocessing successfull !!"
 	echo "---------------------------------"
-	echo ''
+	echo
     fi
 
-    fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD || exit 1
+    sed -e "s~MAIN_DIR~${MAIN_DIR}~; s~NEMO_TDIR~${NEMO_TDIR}~; s~CUR_CONF~${CUR_CONF}~; s~COMPIL_DIR~${COMPIL_DIR}~" ${COMPIL_DIR}/${USEBLD} > ${NEMO_TDIR}/${CUR_CONF}/BLD/${USEBLD}
+    fcm build --ignore-lock -v ${x_v} -j ${NBR_PRC} ${NEMO_TDIR}/${CUR_CONF}/BLD/${USEBLD} || exit 1
 
-    if [ -f ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ]; then
-	ln -sf ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe  ${NEMO_TDIR}/${NEW_CONF}/EXP00/nemo
+    if [ -f ${NEMO_TDIR}/${CUR_CONF}/BLD/bin/nemo.exe ]; then
+	(cd ${NEMO_TDIR}/${CUR_CONF}/EXP00; ln -sfv ../BLD/bin/nemo.exe ./nemo)
+    else
+        exit 1
     fi
-
     
 fi
 
-#- Unset variables
-${COMPIL_DIR}/Fclean_var.sh
+
+exit 0
diff --git a/mk/Fadd_keys.sh b/mk/Fadd_keys.sh
index e4fc8c787d707cf0931770699438eebef1339e75..d563a75adb5afdfdac950d53a1d091e33b4fdc43 100755
--- a/mk/Fadd_keys.sh
+++ b/mk/Fadd_keys.sh
@@ -62,16 +62,14 @@ set -o posix
 #   * creation
 #
 #-
- echo "Adding keys in : ${NEW_CONF}" 
- for i in ${list_add_key} ; do
-	if [ "$(cat ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "\<$i\>" )" -ne 0 ] ; then
- 	   echo "key $i already present in cpp_${NEW_CONF}.fcm" 
-	else
-	   sed -e "s/$/ ${i}/"  ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm >  ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp
- 	   mv ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp   ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm
- 	   echo "added key $i in ${NEW_CONF}" 
-	fi
- done
- 
- unset -v list_add_key
 
+echo "Adding keys ${2} in : ${1}"
+
+for i in ${2} ; do
+    if [ "$(cat ${1}/cpp_$(basename ${1}).fcm | grep -c "\<$i\>" )" -ne 0 ] ; then
+        echo "key $i already present in cpp_$(basename ${1}).fcm"
+    else
+        sed -i "s/$/ ${i}/" ${1}/cpp_$(basename ${1}).fcm
+        echo "added key $i in $(basename ${1})"
+    fi
+done
diff --git a/mk/Fcheck_archfile.sh b/mk/Fcheck_archfile.sh
index f7aad910b2889765f0d0a8db6c9b4bf85e528fb2..b57a6aa389d8fcac6397bdf5ba1757715045c759 100755
--- a/mk/Fcheck_archfile.sh
+++ b/mk/Fcheck_archfile.sh
@@ -118,7 +118,7 @@ if [ ${#3} -eq 0 ]; then # arch not specified
 	fi
     fi
 else 
-    nb=$( find ${MAIN_DIR}/arch -name arch-${3}.fcm -print | wc -l )
+    nb=$( find $(dirname ${3}) -name $(basename ${3}) -print | wc -l )
     if [ $nb -eq 0 ]; then # no arch file found
 	echo "Warning !!!"
 	echo "Compiler not existing"
@@ -129,12 +129,12 @@ else
     if [ $nb -gt 1 ]; then # more than 1 arch file found
 	echo "Warning !!!"
 	echo "more than 1 arch file for the same compiler have been found"
-	find ${MAIN_DIR}/arch -name arch-${3}.fcm -print
+	find $(dirname ${3}) -name $(basename ${3}) -print
 	echo "keep only 1"
 	echo "EXITING..."
 	exit 1       
     fi
-    myarch=$( find ${MAIN_DIR}/arch -name arch-${3}.fcm -print )
+    myarch=$( find $(dirname ${3}) -name $(basename ${3}) -print )
     # we were already using this arch file ?
     if [ "$myarch" == "$( cat $(dirname $1)/arch.history 2>/dev/null)" ]; then 
 	if [ -f $1 ]; then
@@ -151,7 +151,7 @@ else
 		[ ${#mycpp} -ne 0 ] && cpeval ${myarch} $1
 	    fi
 	    # has myarch file been updated since we copied it in ${COMPIL_DIR}?
-	    myarch=$( find -L ${MAIN_DIR}/arch -cnewer $(basename $1) -name arch-${3}.fcm -print )
+	    myarch=$( find -L $(dirname ${3}) -cnewer $(basename $1) -name $(basename ${3}) -print )
 	    [ ${#myarch} -ne 0 ] && cpeval ${myarch} $1
 	else
 	    cpeval ${myarch} $1
@@ -185,7 +185,7 @@ then
     fi
 #- in TOOLS directory looking for USE xios
 else
-    use_iom=$( egrep --exclude-dir=.svn -r USE ${MAIN_DIR}/src/* | grep -c xios )
+    use_iom=$( egrep --exclude-dir=.svn -r USE $(dirname ${3})/../src/* | grep -c xios )
     have_lxios=$( sed -e "s/#.*$//" $1 | grep -c "\-lxios" )
     if [[ ( $use_iom -eq 0 ) || ( $have_lxios != 1 ) ]]
     then 
@@ -216,7 +216,7 @@ do
 done
 
 # Nemo debug ?
-if [ -n "${NEMO_DBG}" ]; then
+if [ -n "${4}" ]; then
     if (! grep -q "^%DEBUG_FCFLAGS" $1 ); then
        echo "ERROR: You must defined '%DEBUG_FCFLAGS' in your arch file if you want to compile Nemo in debug mode using '-d' option"
        exit 1
diff --git a/mk/Fcheck_config.sh b/mk/Fcheck_config.sh
index 996047f5989afaf7a2c4fa08f9b0384c01341c97..24b261049babb6daaaed48f4cb7f5f2503b75721 100755
--- a/mk/Fcheck_config.sh
+++ b/mk/Fcheck_config.sh
@@ -69,18 +69,18 @@ declare -a ZTAB
 if [ ${#2} -eq 0 ]; then
    tail -1  ${CONFIG_DIR}/$1	> ${CONFIG_DIR}/cfg.tmp
    read -a ZTAB < ${CONFIG_DIR}/cfg.tmp
-   NEW_CONF=${ZTAB[0]} ; TAB=( ${ZTAB[@]:1} )
+   CUR_CONF=${ZTAB[0]} ; TAB=( ${ZTAB[@]:1} )
    \rm ${CONFIG_DIR}/cfg.tmp
    echo "Warning !!!"
    echo "No configuration specified"
    echo "Use makenemo -n MYCONFIG"
    echo "or  makenemo -h for help"
-   echo "Using default configuration : ${NEW_CONF}"
+   echo "Using default configuration : ${CUR_CONF}"
 fi
 if [ "$1" == cfg.txt ]; then
-   cat ${CONFIG_DIR}/$1 | grep "${NEW_CONF} " > ${CONFIG_DIR}/cfg.tmp
+   cat ${CONFIG_DIR}/$1 | grep "${CUR_CONF} " > ${CONFIG_DIR}/cfg.tmp
    read -a ZTAB < ${CONFIG_DIR}/cfg.tmp
-   NEW_CONF=${ZTAB[0]} ; TAB=( ${ZTAB[@]:1} )
+   CUR_CONF=${ZTAB[0]} ; TAB=( ${ZTAB[@]:1} )
    \rm ${CONFIG_DIR}/cfg.tmp
 fi
 
diff --git a/mk/Fclean_config.sh b/mk/Fclean_config.sh
index af5d99d9f09ce541d7e03c8a5a35bd2391d80fc5..19ca4f060de8034e108a07940d67e0f33c2e8c20 100755
--- a/mk/Fclean_config.sh
+++ b/mk/Fclean_config.sh
@@ -63,31 +63,23 @@ set -o posix
 #
 #-
 
-NEW_CONF=${x_n}
+CONF=$(basename ${1})
+CONFIG_DIR=$(dirname ${1})
 
-if [ ${#NEW_CONF} -eq 0 ] ; then
+if [ ${#CONF} -eq 0 ] ; then
 	echo " "
 	echo "No configuration specified, please use makenemo -n CONFIG clean_config "
 else
 	echo " "
-	echo "Are you sure that you want to remove this directory $NEW_CONF? [y/n] "
+	echo "Are you sure that you want to remove this directory $CONF? [y/n] "
 	read answer
 	answer=`echo $answer | sed 's/^[y].*$/y/'`
 
 	if [  -z "$answer" -o "x$answer" = "xy" ]; then
 
-		## testing if configuration exists
-		if [[ ! $( grep "${NEW_CONF} " */work_cfgs.txt ) ]] ; then
-			echo "The configuration ${NEW_CONF} does not exist in file work_cfgs.txt"     
-			echo "No removing configuration"
-			echo " "
-		else
-			CONFIG_DIR=${MAIN_DIR}/$( grep -l "${NEW_CONF} " */work_cfgs.txt | cut -d/ -f1 )
-			rm -rf ${CONFIG_DIR}/${NEW_CONF}
-			sed -e "/${NEW_CONF} /d"  ${CONFIG_DIR}/work_cfgs.txt >  ${CONFIG_DIR}/work_cfgs.tmp
-			mv  ${CONFIG_DIR}/work_cfgs.tmp  ${CONFIG_DIR}/work_cfgs.txt
-			echo "${NEW_CONF} configuration REMOVED" 
-		fi
+		rm -rf ${CONFIG_DIR}/${CONF}
+		sed -i "/^${CONF} /d"  ${CONFIG_DIR}/work_cfgs.txt >  ${CONFIG_DIR}/work_cfgs.tmp
+		echo "${CONF} configuration REMOVED" 
 
 	else
 		echo " "
@@ -95,5 +87,3 @@ else
 	fi
 
 fi 
-
-unset -v answer
diff --git a/mk/Fclean_var.sh b/mk/Fclean_var.sh
deleted file mode 100755
index eb624c7140dcd11cd8028d08e61ba993cb8aec9d..0000000000000000000000000000000000000000
--- a/mk/Fclean_var.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/bash
-#set -x
-set -o posix
-#set -u
-#set -e
-#+
-#
-# =============
-# Fclean_var.sh
-# =============
-#
-# ----------------------------
-# Clean environment variables
-# ----------------------------
-#
-# SYNOPSIS
-# ========
-#
-# ::
-#
-#  $ Fclean_var.sh
-#
-#
-# DESCRIPTION
-# ===========
-#
-#
-# Clean environment variables
-#
-# EXAMPLES
-# ========
-#
-# ::
-#
-#  $ ./Fclean_var.sh
-#
-#
-# TODO
-# ====
-#
-# option debug
-#
-#
-# EVOLUTIONS
-# ==========
-#
-# $Id: Fclean_var.sh 4990 2014-12-15 16:42:49Z timgraham $
-#
-#
-#
-#   * creation
-#
-#-
-#- Unset variables
-
-unset -v NSTOP
-unset -v TAB
-unset -v NEW_CONF
-unset -v REF_CONF
-unset -v CMP_NAM
-unset -v NBR_PRC
-unset -v NEM_SUBDIR
-unset -v MAIN_DIR
-unset -v CONFIG_DIR
-unset -v TOOLS_DIR
-unset -v COMPIL_DIR
-unset -v NEMO_DIR
-unset -v USEBLD
diff --git a/mk/Fdef_keys.sh b/mk/Fdef_keys.sh
index bf94a481f7098bcf43c15cc378f7b4f1d7106995..482db9529d75af70a1fb06219b18bed4aa1cb515 100755
--- a/mk/Fdef_keys.sh
+++ b/mk/Fdef_keys.sh
@@ -56,8 +56,5 @@ set -o posix
 #
 #-
 
-echo "Defining keys in : ${NEW_CONF}"
-
-echo " bld::tool::fppkeys ${list_def_key}" > ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm
-
-unset -v list_def_key
+echo "Defining keys in : $(dirname ${1})"
+echo " bld::tool::fppkeys ${2}" > ${1}/cpp_$(basename ${1}).fcm
diff --git a/mk/Fdel_keys.sh b/mk/Fdel_keys.sh
index ff95aa2b445f72d18f4fc17552b269b5c4cc8db3..4bbcd38b82543dfbd0cc44f7db4bf648c605a5da 100755
--- a/mk/Fdel_keys.sh
+++ b/mk/Fdel_keys.sh
@@ -60,22 +60,13 @@ set -o posix
 #
 #-
 
-echo "Removing keys in : ${NEW_CONF}"
+echo "Removing keys ${2} in : ${1}"
 
-for i in ${list_del_key} ; do
-
-     if [ "$(echo ${i} | grep -c key_nproc )" -ne 0                                      ]; then
-        sed -e "s/key_nproc[ij]=.* //" ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm \
-	    >  ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp
-        mv ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm
-        echo " "
-     elif [ "$(cat ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "$i" )" -ne 0 ]; then
-         sed -e "s/\b${i}\b//" ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm \
-	     >  ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp
-         mv ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm
-         echo "deleted key $i in ${NEW_CONF}"
+for i in ${2} ; do
+     if [ "$(echo ${i} | grep -c key_nproc )" -gt 0 ]; then
+        sed -i "s/key_nproc[ij]=.* //" ${1}/cpp_$(basename ${1}).fcm
+     elif [ "$(cat ${1}/cpp_$(basename ${1}).fcm | grep -c "$i")" -gt 0 ]; then
+         sed -i "s/\b${i}\b//" ${1}/cpp_$(basename ${1}).fcm
+         echo "deleted key $i in $(basename ${1})"
      fi
-
 done
-
-unset -v list_del_key
diff --git a/mk/Flist_archfile.sh b/mk/Flist_archfile.sh
index 46c570beeeff3c51560b9e007bacaf5daf9a1f77..506f620bc827b96bad1b7fcabf5f552e27258753 100755
--- a/mk/Flist_archfile.sh
+++ b/mk/Flist_archfile.sh
@@ -67,11 +67,11 @@ archfile_loop() {
 
 echo -e "\n  ¤ Generic computing architectures"
 
-archfile_loop ${MAIN_DIR}/arch
+archfile_loop ${1}/arch
 
-for dir in $( ls ${MAIN_DIR}/arch | grep -v "fcm$" ); do
-	echo -e "\n  ¤ Specific HPC architectures for "${dir}
-	archfile_loop ${MAIN_DIR}/arch/$dir
+for dir in $( ls ${1}/arch | grep -v "fcm$" ); do
+    echo -e "\n  ¤ Specific HPC architectures for "${dir}
+    archfile_loop ${1}/arch/$dir
 done
 
 echo
diff --git a/mk/Flist_cfgs.sh b/mk/Flist_cfgs.sh
index 34c8b36c7e4a6632f2c9cd3f4d13efe40809810e..33ca7cc2a219484162fcb81a06d6e37e2545fd1c 100755
--- a/mk/Flist_cfgs.sh
+++ b/mk/Flist_cfgs.sh
@@ -1,14 +1,14 @@
 #!/bin/bash
 
 echo -e "\n  ¤ Reference configurations with default sub-components (can be updated by a new set)"
-cat ${MAIN_DIR}/cfgs/ref_cfgs.txt \
+cat ${1}/cfgs/ref_cfgs.txt \
 | awk '{printf "%-20s", $1}{$1 = ""; printf "%s\n", $0}'
 
 echo -e "\n  ¤ Demonstrations cases (see https://github.com/sflavoni/NEMO-test-cases for more)"
-cat ${MAIN_DIR}/tests/demo_cfgs.txt \
+cat ${1}/tests/demo_cfgs.txt \
 | awk '{printf "%-20s", $1}{$1 = ""; printf "%s\n", $0}'
 
 echo -e "\n  ¤ Available sub-components ('OCE' is mandatory in any set)"
-ls  ${MAIN_DIR}/src | awk -F/ '{ print $NF }' | column
+ls ${1}/src | awk -F/ '{ print $NF }' | column
 
 echo
diff --git a/mk/Fmake_WORK.sh b/mk/Fmake_WORK.sh
index eee618ced4089e139006e7427930befcd85c27d9..afa6a46bd0eda11c70bc2ab52a5ca7d35fe05986 100755
--- a/mk/Fmake_WORK.sh
+++ b/mk/Fmake_WORK.sh
@@ -34,7 +34,7 @@ set -o posix
 #
 # Make the WORK directory:
 #
-# - Create line in NEW_CONF/WORK
+# - Create line in CUR_CONF/WORK
 # - Use specified sub-directories previously
 # - OCE has to be done first !!!
 #
@@ -63,39 +63,37 @@ set -o posix
 #   * creation
 #
 #-
-declare ZSRC=${@}
-ZCONF=${NEMO_TDIR}/${NEW_CONF}
-ZTAB=${NEM_SUBDIR[@]}
-declare NDIR=${#ZTAB[@]}
+ZTAB=( $1 )
+ZSRC=( $2 )
+ZCONF=$3
+NDIR=${#ZTAB[@]}
 
+echo ''
 echo 'Creating '${ZCONF}'/WORK = '${ZTAB[*]}' for '${ZCONF##*/}
+echo ''
 
 [ ! -d ${ZCONF}/MY_SRC ] && \mkdir -p ${ZCONF}/MY_SRC
+[ ! -d ${ZCONF}/BLD    ] && \mkdir -p ${ZCONF}/BLD
 [   -d ${ZCONF}/WORK   ] || \mkdir -p ${ZCONF}/WORK
 
 for comp in ${ZTAB[*]}; do
-	find ${NEMO_DIR}/$comp -name \*.[Ffh]90 -exec ln -sf {} ${ZCONF}/WORK \;
+    find $comp -name \*.[Ffh]90 -exec ln -sf {} ${ZCONF}/WORK \;
 done
 
-cd ${ZCONF}
-for ZDIR in ${ZSRC[@]}; do
-    if [ -d ${ZDIR} ] ; then
+for ZDIR in ${ZSRC[*]}; do
+    if [ -d ${ZCONF}/${ZDIR} ] ; then
+        d=${ZCONF}/${ZDIR}
+    elif [ -d ${ZDIR} ] ; then
         d=${ZDIR}
-    else
-        d='MY_SRC'
-        echo 'External directory for MY_SRC unspecified or does not exist. Using default.'
     fi
 
     for ff in `(find ${d} -name \*.[Ffh]90 2>/dev/null)`
     do
         if [ "$ff" != "${ff#/}" ]; then
-          ln -sf $ff WORK/.
+          ln -sf $ff ${ZCONF}/WORK/.
         else
-          ln -sf ../$ff WORK/.
+          ln -sf ../$ff ${ZCONF}/WORK/.
         fi
     done
     echo ${d}' content is linked to '${ZCONF}/WORK
 done
-cd -
-
-unset -v ZCONF ZTAB NDIR
diff --git a/mk/Fmake_bld.sh b/mk/Fmake_bld.sh
deleted file mode 100755
index bd4b331cde6e84c497a82e3db2db70bbab581cbd..0000000000000000000000000000000000000000
--- a/mk/Fmake_bld.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/bash
-#set -x
-set -o posix
-#set -u
-#set -e
-#+
-#
-# ============
-# Fmake_bld.sh
-# ============
-#
-# --------------------
-# Make build directory
-# --------------------
-#
-# SYNOPSIS
-# ========
-#
-# ::
-#
-#  $ Fmake_bld.sh
-#
-#
-# DESCRIPTION
-# ===========
-#
-#
-# Under CONFIG_NAME :
-# - Make the build directory 
-# - Create repositories needed :
-# - BLD for compilation 
-#
-# A tmpdir can be specified for memory issues.
-#
-#
-# EXAMPLES
-# ========
-#
-# ::
-#
-#  $ ./Fmake_bld.sh NEMOGCM/cfgs GYRE  /usr/tmp
-#
-#
-# TODO
-# ====
-#
-# option debug
-#
-#
-# EVOLUTIONS
-# ==========
-#
-# $Id: Fmake_bld.sh 9651 2018-05-28 06:47:14Z nicolasmartin $
-#
-#
-#
-#   * creation
-#
-#-
-[ ! -d ${3}/${2}     ] && \mkdir -p ${3}/${2}
-[ ! -d ${3}/${2}/BLD ] && \mkdir -p ${3}/${2}/BLD
-[ -f ${3}/${2}/cpp_${2}.fcm ] && ln -sf ${3}/${2}/cpp_${2}.fcm ${3}/${2}/BLD/cpp.fcm
-rm -f  ${1}/${2}/BLD/fcm.bld.lock
diff --git a/mk/Fmake_config.sh b/mk/Fmake_config.sh
index 22955c4d0b125339e889781978c961b28453b9c2..ae844c4023a0aaaa9c3a38b0f9ae43026b69a2d8 100755
--- a/mk/Fmake_config.sh
+++ b/mk/Fmake_config.sh
@@ -66,7 +66,12 @@ then
     do
 	if [[ -L ${f} && $( readlink -f ${f} ) =~ "SHARED" ]]
 	then
-	    \ln -sf $( readlink -f ${f} ) ${1}/EXP00/$( basename ${f} )   # keep link from SHARED
+	    # create absolute(relative) symlinks if config directory is outside(inside) nemo directory
+            if [[ $(dirname ${1}) != $(dirname ${2}) ]]; then
+              \ln -sf $( readlink -f ${f} ) ${1}/EXP00/$( basename ${f} )   # keep link from SHARED
+            else
+              (cd ${1}/EXP00; \ln -sf ../../../cfgs/SHARED/$(basename $(readlink -f ${f}) ) $( basename ${f} ))
+            fi
 	else
 	    \cp ${f} ${1}/EXP00/.
 	fi
diff --git a/mk/Fmake_tools_bld.sh b/mk/Fmake_tools_bld.sh
index 3a9a5041cbd8184350cff28a2b9983fba50666cf..71443a3addfa3d6957fd431c5d97f8b82fd1ba51 100755
--- a/mk/Fmake_tools_bld.sh
+++ b/mk/Fmake_tools_bld.sh
@@ -57,10 +57,8 @@ set -o posix
 #   * creation
 #
 #-
-[ ! -d ${3}/${2}     ] && \mkdir ${3}/${2}
-[ ! -d ${3}/${2}/BLD ] && \mkdir ${3}/${2}/BLD
+[ ! -d ${3}/${2}/BLD ] && \mkdir -p ${3}/${2}/BLD
 [ ! -d ${1}/${2}/BLD ] && ln -sf ${3}/${2}/BLD ${1}/${2}/BLD
 # enforce presence of cpp_tools.fcm (write a blank one if not present in the tools directory)
 # cp instead of ln to avoid overwiting previous tool cpp_XXX.fcm file when compiling a file without cpp_YYY.fcm file.
 [ -f ${3}/${2}/cpp_${2}.fcm ] && ln -sf -f ${3}/${2}/cpp_${2}.fcm ${3}/${2}/BLD/cpp_tools.fcm || echo 'bld::tool::fppkeys ' > ${3}/${2}/BLD/cpp_tools.fcm
-rm -f  ${1}/${NEW_CONF}/BLD/fcm.bld.lock
diff --git a/mk/Fprep_agrif.sh b/mk/Fprep_agrif.sh
index 64375c4f1fb31633d3fa500941364fcdc73acb0b..75025edd01f3f6e67164b24d515a198fec6bd89b 100755
--- a/mk/Fprep_agrif.sh
+++ b/mk/Fprep_agrif.sh
@@ -55,26 +55,13 @@ set -o posix
 #-
 
 #- AGRIF conv
-if [ "$AGRIFUSE" == 1 ]; then
+
 #-MPI for AGRIF
-if [ ! -f ${MAIN_DIR}/ext/AGRIF/nemo_mpi.h ];then
-   echo '#if ! defined key_mpi_off' > ${MAIN_DIR}/ext/AGRIF/nemo_mpi.h
-   echo '#define AGRIF_MPI'        >> ${MAIN_DIR}/ext/AGRIF/nemo_mpi.h
-   echo '#endif'                   >> ${MAIN_DIR}/ext/AGRIF/nemo_mpi.h
+if [ ! -f ${1}/ext/AGRIF/nemo_mpi.h ]; then
+   echo '#if ! defined key_mpi_off' > ${1}/ext/AGRIF/nemo_mpi.h
+   echo '#define AGRIF_MPI'        >> ${1}/ext/AGRIF/nemo_mpi.h
+   echo '#endif'                   >> ${1}/ext/AGRIF/nemo_mpi.h
 fi
 
- #- CONV
-export MYARCH=$3
-fcm build ${COMPIL_DIR}/conv.cfg || exit 1
-#C_COMPILER=${CC-cc}
-#gmake CC=${C_COMPILER} -C ${MAIN_DIR}/ext/AGRIF/LIB
-
 #- AGRIF sources
-[ ! -d $2/$1/NEMOFILES ] && mkdir  $2/$1/NEMOFILES
-[ ! -d $2/$1/NEMOFILES/AGRIF_INC ] && mkdir  $2/$1/NEMOFILES/AGRIF_INC
-[ ! -d $2/$1/NEMOFILES/AGRIF_MODELFILES ] && mkdir  $2/$1/NEMOFILES/AGRIF_MODELFILES
-cp -f -r ${MAIN_DIR}/ext/AGRIF/agrif_oce.in  $2/$1/NEMOFILES/
-#cp -f -r ${MAIN_DIR}/ext/AGRIF/conv  $2/$1/NEMOFILES/
-cp -f -r $2/$1/AGRIFLIB/bin/conv  $2/$1/NEMOFILES/
-
-fi
+mkdir -p ${2}/NEMOFILES
diff --git a/mk/README b/mk/README
deleted file mode 100644
index b54b12daf77e46b58af9488588f8defd5a668104..0000000000000000000000000000000000000000
--- a/mk/README
+++ /dev/null
@@ -1,7 +0,0 @@
-CSHRC :
-setenv PATH ~/NEMOGCM/TOOLS:$PATH
-setenv NEMO_TDIR /users/rblod/tmp
-
-BASH :
-export PATH=$PATH:~/NEMOGCM/TOOLS'
-export NEMO_TDIR=/users/rblod/tmp
diff --git a/mk/agrifpp.sh b/mk/agrifpp.sh
index 308125ce8005c817aa0c3e0ad4223b5fa68e0f09..5ff5bcdb5dec7fbdc081cfe5e5acac7a1ecaa33b 100755
--- a/mk/agrifpp.sh
+++ b/mk/agrifpp.sh
@@ -56,12 +56,13 @@ set -o posix
 #-
 MYDIR=$1
 MYFILE=$(basename "$2")
+
 if [ "$MYFILE" == "agrif2model.f90" ];then
-   if [ -d ${MYDIR}/${NEW_CONF}/WORK ]; then
-      \cp ${MYDIR}/${NEW_CONF}/WORK/${MYFILE/.f90/.F90} ${MYDIR}/${NEW_CONF}/NEMOFILES/obj/$MYFILE
+   if [ -d ${MYDIR}/WORK ]; then
+      \cp ${MYDIR}//WORK/${MYFILE/.f90/.F90} ${MYDIR}/NEMOFILES/obj/$MYFILE
    else
-      \cp ${CONFIG_DIR}/${NEW_CONF}/WORK/${MYFILE/.f90/.F90} ${MYDIR}/${NEW_CONF}/NEMOFILES/obj/$MYFILE
+      \cp ${MYDIR}/WORK/${MYFILE/.f90/.F90} ${MYDIR}/NEMOFILES/obj/$MYFILE
    fi   
 else
-cd ${MYDIR}/${NEW_CONF}/NEMOFILES/ppsrc/nemo ; ${MYDIR}/${NEW_CONF}/NEMOFILES/conv ${MYDIR}/${NEW_CONF}/NEMOFILES/agrif_oce.in -rm -incdir ${MYDIR}/${NEW_CONF}/NEMOFILES/inc -comdirout ${MYDIR}/${NEW_CONF}/NEMOFILES/obj -convfile ${MYFILE} > /dev/null 
+   cd ${MYDIR}/NEMOFILES/ppsrc/nemo ; ${MYDIR}/NEMOFILES/conv ${MYDIR}/NEMOFILES/agrif_oce.in -rm -incdir ${MYDIR}/NEMOFILES/inc -comdirout ${MYDIR}/NEMOFILES/obj -convfile ${MYFILE} > /dev/null 
 fi
diff --git a/mk/bld.cfg b/mk/bld.cfg
index ebc688aa93435ba102cd646200e53d6d925af05b..e239f0dc0ed0add5ce235b8495d3cb9adfd6bdbb 100644
--- a/mk/bld.cfg
+++ b/mk/bld.cfg
@@ -7,22 +7,21 @@ cfg::version                        1.0
 # Build information
 # ------------------------------------------------------------------------------
 
-inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm
-inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm
+inc NEMO_TDIR/CUR_CONF/BLD/arch_nemo.fcm
+inc NEMO_TDIR/CUR_CONF/BLD/cpp.fcm
 
 search_src           1
 
-src::ioipsl               $MAIN_DIR/ext/IOIPSL/src
-src::agrif                $MAIN_DIR/ext/AGRIF/AGRIF_FILES
-src::nemo                 $NEMO_TDIR/$NEW_CONF/NEMOFILES/obj
-src::ppr_1d               $MAIN_DIR/ext/PPR/src
+src::ioipsl               MAIN_DIR/ext/IOIPSL/src
+src::ppr_1d               MAIN_DIR/ext/PPR/src
+src::agrif                MAIN_DIR/ext/AGRIF/AGRIF_FILES
+src::nemo                 NEMO_TDIR/CUR_CONF/NEMOFILES/obj
 
-
-bld::target  nemo.exe
+bld::target nemo.exe
 bld::exe_dep
 
 
-dir::root            $NEMO_TDIR/$NEW_CONF/BLD
+dir::root            NEMO_TDIR/CUR_CONF/BLD
 
 
 bld::tool::cpp       %CPP
@@ -38,13 +37,13 @@ bld::tool::make      %MK
 
 # Pre-process code before analysing dependencies
 bld::pp::ioipsl   1
-bld::pp::nemo     1
-bld::pp::agrif    1
 bld::pp::ppr_1d   1
-bld::tool::fppflags::nemo      %FPPFLAGS -I$NEMO_TDIR/$NEW_CONF/NEMOFILES/inc
-bld::tool::fppflags::ioipsl    %FPPFLAGS
-bld::tool::fppflags::agrif     %FPPFLAGS -include ${MAIN_DIR}/ext/AGRIF/nemo_mpi.h
-bld::tool::fppflags::ppr_1d    %FPPFLAGS
+bld::pp::agrif    1
+bld::pp::nemo     1
+bld::tool::fppflags::ioipsl   %FPPFLAGS
+bld::tool::fppflags::ppr_1d   %FPPFLAGS
+bld::tool::fppflags::agrif    %FPPFLAGS -include MAIN_DIR/ext/AGRIF/nemo_mpi.h
+bld::tool::fppflags::nemo     %FPPFLAGS -INEMO_TDIR/CUR_CONF/NEMOFILES/inc
 
 # Ignore the following dependencies
 bld::excl_dep        inc::netcdf.inc
@@ -60,6 +59,7 @@ bld::excl_dep        use::mod_oasis
 bld::excl_dep        use::mkl_dfti
 bld::excl_dep        use::cudafor
 bld::excl_dep        use::openacc
+
 # Don't generate interface files
 bld::tool::geninterface none
 
diff --git a/mk/bld_preproagr.cfg b/mk/bld_preproagr.cfg
index 3f015aa12d66b93dd6ade8dcb536c1fc853faf4f..cb99ab0fc879057491200c49463cb10d7ea03dcc 100644
--- a/mk/bld_preproagr.cfg
+++ b/mk/bld_preproagr.cfg
@@ -7,20 +7,20 @@ cfg::version                        1.0
 # Build information
 # ------------------------------------------------------------------------------
 
-inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm
-inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm
+inc NEMO_TDIR/CUR_CONF/BLD/arch_nemo.fcm
+inc NEMO_TDIR/CUR_CONF/BLD/cpp.fcm
 search_src           1
 
-src::nemo                 $NEMO_TDIR/$NEW_CONF/WORK
+src::nemo    NEMO_TDIR/CUR_CONF/WORK
 
 bld::target  lib_cray.f90 nemo.f90 agrif_user.f90 agrif2model.f90 
 
-dir::root            $NEMO_TDIR/$NEW_CONF/NEMOFILES
+dir::root    NEMO_TDIR/CUR_CONF/NEMOFILES
 
 bld::tool::fc_output
 bld::tool::fc_compile
 bld::tool::fc_include
-bld::tool::fc        $COMPIL_DIR/agrifpp.sh ${NEMO_TDIR}
+bld::tool::fc        COMPIL_DIR/agrifpp.sh NEMO_TDIR/CUR_CONF
 bld::tool::fflags    
 bld::tool::ld       
 bld::tool::ldflags   
diff --git a/mk/bld_preproagr_tools.cfg b/mk/bld_preproagr_tools.cfg
index cc7eb552afb846fb3630ff2f0a6ddd83dbb9c0b4..32cd0956d6feb848e387ed5887c8cd293d7a8ff8 100644
--- a/mk/bld_preproagr_tools.cfg
+++ b/mk/bld_preproagr_tools.cfg
@@ -7,20 +7,21 @@ cfg::version                        1.0
 # Build information
 # ------------------------------------------------------------------------------
 
-inc $COMPIL_DIR/arch_tools.fcm
-inc $COMPIL_DIR/cpp_tools.fcm
+inc TOOLS_DIR/CUR_CONF/BLD/arch_tools.fcm
+inc TOOLS_DIR/CUR_CONF/BLD/cpp_tools.fcm
+
 search_src           1
 
-src::nemo                 $TOOLS_DIR/$NEW_CONF/src
+src::nemo            TOOLS_DIR/CUR_CONF/src
 
 bld::target  make_domain_cfg.f90 agrif_user.f90 agrif2model.f90 
 
-dir::root            $TOOLS_DIR/$NEW_CONF/NEMOFILES
+dir::root            TOOLS_DIR/CUR_CONF/NEMOFILES
 
 bld::tool::fc_output
 bld::tool::fc_compile
 bld::tool::fc_include
-bld::tool::fc        $COMPIL_DIR/agrifpp.sh $TOOLS_DIR
+bld::tool::fc        COMPIL_DIR/agrifpp.sh TOOLS_DIR
 bld::tool::fflags    
 bld::tool::ld       
 bld::tool::ldflags   
diff --git a/mk/bld_tools.cfg b/mk/bld_tools.cfg
index aa204b4c7d1bac9f8a5e2cfc9d2d9f09abd83778..4e7db957126b7ebd031a32f172aa45526bd23b06 100644
--- a/mk/bld_tools.cfg
+++ b/mk/bld_tools.cfg
@@ -7,25 +7,22 @@ cfg::version                        1.0
 # Build information
 # ------------------------------------------------------------------------------
 
-inc $COMPIL_DIR/arch_tools.fcm
-inc $COMPIL_DIR/cpp_tools.fcm
+inc TOOLS_DIR/CUR_CONF/BLD/arch_tools.fcm
+inc TOOLS_DIR/CUR_CONF/BLD/cpp_tools.fcm
 
 search_src           1
 
-src::agrif           $MAIN_DIR/ext/AGRIF/AGRIF_FILES
-src::nemo            $TOOLS_DIR/$NEW_CONF/NEMOFILES/obj
-
+src::agrif           MAIN_DIR/ext/AGRIF/AGRIF_FILES
+src::nemo            TOOLS_DIR/CUR_CONF/NEMOFILES/obj
 
 bld::target  make_domain_cfg.exe
 bld::exe_dep
 
-
-dir::root            $TOOLS_DIR/$NEW_CONF/BLD
-
+dir::root            TOOLS_DIR/CUR_CONF/BLD
 
 bld::tool::cpp       %CPP
 bld::tool::fpp       %CPP
-bld::tool::fc        %FC 
+bld::tool::fc        %FC
 bld::tool::fflags    %FCFLAGS %USER_INC
 bld::tool::ld        %LD
 bld::tool::ldflags   %LDFLAGS %USER_LIB
@@ -36,11 +33,8 @@ bld::tool::make      %MK
 # Pre-process code before analysing dependencies
 bld::pp::nemo     1
 bld::pp::agrif    1
-bld::tool::fppflags::nemo      %FPPFLAGS -I$TOOLS_DIR/$NEW_CONF/NEMOFILES/inc
-bld::tool::fppflags::agrif     %FPPFLAGS -include ${MAIN_DIR}/ext/AGRIF/nemo_mpi.h
-
-
-
+bld::tool::fppflags::nemo      %FPPFLAGS -ITOOLS_DIR/CUR_CONF/NEMOFILES/inc
+bld::tool::fppflags::agrif     %FPPFLAGS -include MAIN_DIR/ext/AGRIF/nemo_mpi.h
 
 # Ignore the following dependencies
 bld::excl_dep        inc::netcdf.inc
diff --git a/mk/bldxag.cfg b/mk/bldxag.cfg
index 78a775d5fdb2afbd13b61f24a2ddea349c34be8d..d305520a30118142afa351e203b6bf0a612c8f6e 100644
--- a/mk/bldxag.cfg
+++ b/mk/bldxag.cfg
@@ -7,20 +7,20 @@ cfg::version                        1.0
 # Build information
 # ------------------------------------------------------------------------------
 
-inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm
-inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm
+inc NEMO_TDIR/CUR_CONF/BLD/arch_nemo.fcm
+inc NEMO_TDIR/CUR_CONF/BLD/cpp.fcm
 
 search_src           1
 
-src::ioipsl               $MAIN_DIR/ext/IOIPSL/src
-src::nemo                 $NEMO_TDIR/$NEW_CONF/WORK
-src::ppr_1d               $MAIN_DIR/ext/PPR/src
+src::ioipsl               MAIN_DIR/ext/IOIPSL/src
+src::ppr_1d               MAIN_DIR/ext/PPR/src
+src::nemo                 NEMO_TDIR/CUR_CONF/WORK
 
 bld::target nemo.exe
 bld::exe_dep
 
 
-dir::root            $NEMO_TDIR/$NEW_CONF/BLD
+dir::root            NEMO_TDIR/CUR_CONF/BLD
 
 
 bld::tool::cpp       %CPP
@@ -35,11 +35,11 @@ bld::tool::make      %MK
 
 # Pre-process code before analysing dependencies
 bld::pp::ioipsl   1
-bld::pp::nemo     1
 bld::pp::ppr_1d   1
-bld::tool::fppflags::nemo     %FPPFLAGS
+bld::pp::nemo     1
 bld::tool::fppflags::ioipsl   %FPPFLAGS
 bld::tool::fppflags::ppr_1d   %FPPFLAGS
+bld::tool::fppflags::nemo     %FPPFLAGS
 
 # Ignore the following dependencies
 bld::excl_dep        inc::netcdf.inc
@@ -55,6 +55,7 @@ bld::excl_dep        use::mod_oasis
 bld::excl_dep        use::mkl_dfti
 bld::excl_dep        use::cudafor
 bld::excl_dep        use::openacc
+
 # Don't generate interface files
 bld::tool::geninterface none
 
@@ -66,4 +67,3 @@ bld::outfile_ext::mod .mod
 
 # rename executable to nemo.exe
 bld::exe_name::model  nemo.exe
-
diff --git a/mk/bldxag_tools.cfg b/mk/bldxag_tools.cfg
index 7f54517b3ecd90fa01fdb76ba5eddd7afd8a9b9d..93612cc779097538eac37c5e5ca9da0d5ad23e1d 100644
--- a/mk/bldxag_tools.cfg
+++ b/mk/bldxag_tools.cfg
@@ -7,14 +7,14 @@ cfg::version                        1.0
 # Build information
 # ------------------------------------------------------------------------------
 
-inc $TOOLS_DIR/$NEW_CONF/BLD/arch_tools.fcm
-inc $TOOLS_DIR/$NEW_CONF/BLD/cpp_tools.fcm
+inc TOOLS_DIR/CUR_CONF/BLD/arch_tools.fcm
+inc TOOLS_DIR/CUR_CONF/BLD/cpp_tools.fcm
 
 search_src           1
 
-src::nemo            $TOOLS_DIR/$NEW_CONF/src
+src::nemo            TOOLS_DIR/CUR_CONF/src
 
-dir::root            $TOOLS_DIR/$NEW_CONF/BLD
+dir::root            TOOLS_DIR/CUR_CONF/BLD
 
 bld::tool::cpp       %CPP
 bld::tool::fpp       %CPP
diff --git a/mk/bldxagxcdf.cfg b/mk/bldxagxcdf.cfg
index 28361348a9f56b219875cfa613e9089bc9ac25d6..b0cccd23fb49c732da723d0186c60b8bb0109a64 100644
--- a/mk/bldxagxcdf.cfg
+++ b/mk/bldxagxcdf.cfg
@@ -7,21 +7,21 @@ cfg::version                        1.0
 # Build information
 # ------------------------------------------------------------------------------
 
-inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm
-inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm
+inc NEMO_TDIR/CUR_CONF/BLD/arch_nemo.fcm
+inc NEMO_TDIR/CUR_CONF/BLD/cpp.fcm
 
 search_src           1
 
-src::nocdf                $MAIN_DIR/ext/DUMMY_NETCDF
-src::ioipsl               $MAIN_DIR/ext/IOIPSL/src
-src::nemo                 $CONFIG_DIR/$NEW_CONF/WORK
-src::ppr_1d               $MAIN_DIR/ext/PPR/src
+src::nocdf                MAIN_DIR/ext/DUMMY_NETCDF
+src::ioipsl               MAIN_DIR/ext/IOIPSL/src
+src::ppr_1d               MAIN_DIR/ext/PPR/src
+src::nemo                 NEMO_TDIR/CUR_CONF/WORK
 
 bld::target nemo.exe
 bld::exe_dep
 
 
-dir::root            $NEMO_TDIR/$NEW_CONF/BLD
+dir::root            NEMO_TDIR/CUR_CONF/BLD
 
 
 bld::tool::cpp       %CPP
@@ -37,12 +37,12 @@ bld::tool::make      %MK
 # Pre-process code before analysing dependencies
 bld::pp::nocdf    1
 bld::pp::ioipsl   1
-bld::pp::nemo     1
 bld::pp::ppr_1d   1
-bld::tool::fppflags::nemo     %FPPFLAGS
+bld::pp::nemo     1
 bld::tool::fppflags::nocdf    %FPPFLAGS
 bld::tool::fppflags::ioipsl   %FPPFLAGS
-bld::tool::fppflags::ppr_1d    %FPPFLAGS
+bld::tool::fppflags::ppr_1d   %FPPFLAGS
+bld::tool::fppflags::nemo     %FPPFLAGS
 
 # Ignore the following dependencies
 bld::excl_dep        inc::VT.inc
@@ -55,6 +55,7 @@ bld::excl_dep        use::mod_oasis
 bld::excl_dep        use::mkl_dfti
 bld::excl_dep        use::cudafor
 bld::excl_dep        use::openacc
+
 # Don't generate interface files
 bld::tool::geninterface none
 
@@ -66,4 +67,3 @@ bld::outfile_ext::mod .mod
 
 # rename executable to nemo.exe
 bld::exe_name::model  nemo.exe
-
diff --git a/mk/bldxcdf.cfg b/mk/bldxcdf.cfg
index 5a175b4517aef3b9de92b6bd3b95c552fd8533ef..459e0a151428af40dc2aaf32aebb5524cb915017 100644
--- a/mk/bldxcdf.cfg
+++ b/mk/bldxcdf.cfg
@@ -7,23 +7,22 @@ cfg::version                        1.0
 # Build information
 # ------------------------------------------------------------------------------
 
-inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm
-inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm
+inc NEMO_TDIR/CUR_CONF/BLD/arch_nemo.fcm
+inc NEMO_TDIR/CUR_CONF/BLD/cpp.fcm
 
 search_src           1
 
-src::nocdf                $MAIN_DIR/ext/DUMMY_NETCDF
-src::ioipsl               $MAIN_DIR/ext/IOIPSL/src
-src::agrif                $MAIN_DIR/ext/AGRIF/AGRIF_FILES
-src::nemo                 $CONFIG_DIR/$NEW_CONF/NEMOFILES/obj
-src::ppr_1d               $MAIN_DIR/ext/PPR/src
+src::nocdf                MAIN_DIR/ext/DUMMY_NETCDF
+src::ioipsl               MAIN_DIR/ext/IOIPSL/src
+src::ppr_1d               MAIN_DIR/ext/PPR/src
+src::agrif                MAIN_DIR/ext/AGRIF/AGRIF_FILES
+src::nemo                 NEMO_TDIR/CUR_CONF/NEMOFILES/obj
 
-
-bld::target  nemo.exe
+bld::target nemo.exe
 bld::exe_dep
 
 
-dir::root            $NEMO_TDIR/$NEW_CONF/BLD
+dir::root            NEMO_TDIR/CUR_CONF/BLD
 
 
 bld::tool::cpp       %CPP
@@ -40,14 +39,14 @@ bld::tool::make      %MK
 # Pre-process code before analysing dependencies
 bld::pp::nocdf    1
 bld::pp::ioipsl   1
-bld::pp::nemo     1
-bld::pp::agrif    1
 bld::pp::ppr_1d   1
-bld::tool::fppflags::nemo      %FPPFLAGS -I$CONFIG_DIR/$NEW_CONF/NEMOFILES/inc
+bld::pp::agrif    1
+bld::pp::nemo     1
 bld::tool::fppflags::nocdf     %FPPFLAGS
 bld::tool::fppflags::ioipsl    %FPPFLAGS
-bld::tool::fppflags::agrif     %FPPFLAGS -include ${MAIN_DIR}/ext/AGRIF/nemo_mpi.h
 bld::tool::fppflags::ppr_1d    %FPPFLAGS
+bld::tool::fppflags::agrif     %FPPFLAGS -include MAIN_DIR/ext/AGRIF/nemo_mpi.h
+bld::tool::fppflags::nemo      %FPPFLAGS -ICONFIG_DIR/CUR_CONF/NEMOFILES/inc
 
 # Ignore the following dependencies
 bld::excl_dep        inc::VT.inc
@@ -60,6 +59,7 @@ bld::excl_dep        use::mod_oasis
 bld::excl_dep        use::mkl_dfti
 bld::excl_dep        use::cudafor
 bld::excl_dep        use::openacc
+
 # Don't generate interface files
 bld::tool::geninterface none
 
diff --git a/mk/conv.cfg b/mk/conv.cfg
index f875796231e81454c8bb8b58a4fd5a2b30b523e9..b83cd1bb169e85d0f05eac7035725e468b52554e 100644
--- a/mk/conv.cfg
+++ b/mk/conv.cfg
@@ -7,18 +7,18 @@ cfg::version                        1.0
 # ------------------------------------------------------------------------------
 # Build information
 # ------------------------------------------------------------------------------
-inc $NEMO_TDIR/$NEW_CONF/BLD/$MYARCH
+inc NEMO_TDIR/CUR_CONF/BLD/arch_nemo.fcm
 
 bld::tool::cc        %CC
 bld::tool::cflags    %CFLAGS
 bld::tool::make      %MK
 
-src::convsrc   $MAIN_DIR/ext/AGRIF/LIB
+src::convsrc   MAIN_DIR/ext/AGRIF/LIB
 
  #----------------------------------------------------------------------------
 # Build options (code-specific, machine-independent)
 # ----------------------------------------------------------------------------
-dir::root            $NEMO_TDIR/$NEW_CONF/AGRIFLIB
+dir::root            NEMO_TDIR/CUR_CONF/AGRIFLIB
 
 #bld::tool::cflags::convsrc  -O0  
 #bld::tool::ld::convsrc   cc
diff --git a/sette/BATCH_TEMPLATE/batch-X64_AA_INTEL_OMPI b/sette/BATCH_TEMPLATE/batch-X64_AA_INTEL_OMPI
index 3eca6d7c613a4911733c6577b9a0bc0a05442565..3a2e37f41fbb523f8b10572894633279370a4b9b 100644
--- a/sette/BATCH_TEMPLATE/batch-X64_AA_INTEL_OMPI
+++ b/sette/BATCH_TEMPLATE/batch-X64_AA_INTEL_OMPI
@@ -3,12 +3,12 @@
 #SBATCH -J sette
 #SBATCH -o sette.%j.out
 #SBATCH -e sette.%j.err
+#SBATCH --parsable
 #SBATCH -N 1
-#SBATCH --time=0-00:20:00
+#SBATCH --time=0-00:30:00
 #SBATCH --account=frtomerc
 #SBATCH --partition=par
 #SBATCH --qos=np
-##SBATCH --ntasks=NPROCS
 #SBATCH --ntasks=TOTAL_NPROCS
 
 set -x
@@ -73,23 +73,17 @@ module list
   sed -i "s/one_file/multiple_file/" file_def_nemo-*.xml
 # 
 #  Run the parallel MPI executable 
-#
-  echo "Running time ${MPIRUN} ./nemo"
 #
   if [ $XCORES -gt 0 ]; then
 #
 #  Run MPMD case
 #
      #XIOS will run on a separate node so will run in parallel queue
-     if [ ! -f ./xios_server.exe ] && [ -f ${XIO_HOME}/bin/xios_server.exe ]; then
+     if [ $XCORES -gt 0 ] && [ ! -f ./xios_server.exe ] && [ -f ${XIO_HOME}/bin/xios_server.exe ]; then
         cp ${XIO_HOME}/bin/xios_server.exe .
      fi
-     if [ ! -f ./xios_server.exe ]; then
-        echo "./xios_server.exe not found"
-        echo "run aborted"
-        exit
-     fi
-      cat > ./config.file <<-EOF
+
+     cat > ./config.file <<-EOF
 0-$((OCORES-1)) ./nemo
 ${OCORES}-$((TOTAL_NPROCS-1)) ./xios_server.exe
 EOF
diff --git a/sette/BATCH_TEMPLATE/batch-X64_BELENOS_INTEL_IMPI b/sette/BATCH_TEMPLATE/batch-X64_BELENOS_INTEL_IMPI
index 481b788c1d6ceee865d63bf757b61c42f2e367b2..d8239fe036452cf3fdabd5e4741b7d1bc25a750b 100644
--- a/sette/BATCH_TEMPLATE/batch-X64_BELENOS_INTEL_IMPI
+++ b/sette/BATCH_TEMPLATE/batch-X64_BELENOS_INTEL_IMPI
@@ -41,8 +41,8 @@
 #
 # modules to load
 module purge
-module use /home/ext/mr/smer/samsong/modules
-module load gcc/9.2.0 intel/2018.5.274 intelmpi/2018.5.274 phdf5/1.8.18 netcdf_par/4.7.1_V2 xios/trunk/rev2320-impi
+module use ~samsong/modules
+module load gcc/9.2.0 intel/2018.5.274 intelmpi/2018.5.274 phdf5/1.8.18 netcdf_par/4.7.1_V2 xios/trunk/r2320_intel-impi
 export XIO_HOME=${XIOS_DIR}
 
 # Don't remove neither change the following line
diff --git a/sette/BATCH_TEMPLATE/batch-X64_BELENOS_INTEL_OMPI b/sette/BATCH_TEMPLATE/batch-X64_BELENOS_INTEL_OMPI
new file mode 100644
index 0000000000000000000000000000000000000000..cf73cb0c47b40cfbfcae4673e0f2ef9966295df7
--- /dev/null
+++ b/sette/BATCH_TEMPLATE/batch-X64_BELENOS_INTEL_OMPI
@@ -0,0 +1,110 @@
+#!/usr/bin/env bash
+
+#SBATCH -J sette
+#SBATCH -o sette.%j.out
+#SBATCH -e sette.%j.err
+#SBATCH --parsable
+#SBATCH --exclusive
+#SBATCH -N 1
+#SBATCH -p normal256
+#SBATCH --time=01:00:00
+##SBATCH --time=00:15:00
+##SBATCH -A smer
+#SBATCH -A cmems
+##SBATCH --qos=normal
+#SBATCH --qos=coper
+
+set -x
+
+# Test specific settings. Do not hand edit these lines; the fcm_job.sh script will set these
+# (via sed operating on this template job file). 
+#
+  echo " ";
+  OCORES=NPROCS
+  XCORES=NXIOPROCS
+  O_PER_NODE=32
+  X_PER_NODE=8
+  if [ $XCORES -le $X_PER_NODE ]; then X_PER_NODE=$XCORES; fi
+  if [ $OCORES -le $O_PER_NODE ]; then O_PER_NODE=$OCORES; fi
+  export SETTE_DIR=DEF_SETTE_DIR
+
+###############################################################
+#
+export MPIRUN="srun"
+#
+# load sette functions (only post_test_tidyup needed)
+#
+  . ${SETTE_DIR}/all_functions.sh
+###############################################################
+#
+# modules to load
+module purge
+module use ~samsong/modules
+module load gcc/9.2.0 intel/2018.5.274 openmpi/intel/4.0.2.2 hdf5-1.8.18-ompi netcdf-4.7.1-ompi_V2 xios/trunk/r2320_intel-ompi
+export OMPI_CC=icc
+export OMPI_CXX=icpc
+export OMPI_FC=ifort
+export OMPI_F77=ifort
+export OMPI_F90=ifort
+
+# Don't remove neither change the following line
+# BODY
+#
+# Test specific settings. Do not hand edit these lines; the fcm_job.sh script will set these
+# (via sed operating on this template job file). Note that the number of compute nodes required
+# is also set by the fcm_job.sh on the PBS select header line above.
+#
+# These variables are needed by post_test_tidyup function in all_functions.sh
+#
+  export XIO_HOME=${XIOS_DIR}
+  export INPUT_DIR=DEF_INPUT_DIR
+  export CONFIG_DIR=DEF_CONFIG_DIR
+  export TOOLS_DIR=DEF_TOOLS_DIR
+  export NEMO_VALIDATION_DIR=DEF_NEMO_VALIDATION
+  export NEW_CONF=DEF_NEW_CONF
+  export CMP_NAM=DEF_CMP_NAM
+  export TEST_NAME=DEF_TEST_NAME
+  export EXE_DIR=DEF_EXE_DIR
+  ulimit -a
+  ulimit -s unlimited
+#
+# end of set up
+###############################################################
+#
+# change to the working directory 
+#
+  cd ${EXE_DIR}
+  echo Running on host `hostname`
+  echo Time is `date`
+  echo Directory is `pwd`
+# 
+#  Run the parallel MPI executable 
+#
+  if [ $XCORES -gt 0 ]; then
+#
+#  Run MPMD case
+#
+     #XIOS will run on a separate node so will run in parallel queue
+     if [ $XCORES -gt 0 ] && [ ! -f ./xios_server.exe ] && [ -f ${XIO_HOME}/bin/xios_server.exe ]; then
+        cp ${XIO_HOME}/bin/xios_server.exe .
+     fi
+
+     cat > ./config.file <<-EOF
+0-$((OCORES-1)) ./nemo
+${OCORES}-$((TOTAL_NPROCS-1)) ./xios_server.exe
+EOF
+     $MPIRUN --ntasks=TOTAL_NPROCS --multi-prog config.file
+  else
+#
+# Run SPMD case
+#
+    $MPIRUN --ntasks=TOTAL_NPROCS ./nemo
+  fi
+#
+
+#
+  post_test_tidyup
+
+# END_BODY
+# Don't remove neither change the previous line
+  exit
diff --git a/sette/all_functions.sh b/sette/all_functions.sh
index 167263efbfc38e7aedd257888df333ee800a26e6..1b505c23c74a810e23a482480c2ed4c375598d4d 100755
--- a/sette/all_functions.sh
+++ b/sette/all_functions.sh
@@ -57,7 +57,7 @@
 #
 # REVISION_NUMBER(or DATE)      : revision number by svn info, if problems with svn date is taken
 #
-# TEST_NAME                     : set in sette.sh for each configuration to be tested (directory TEST_NAME is created under ${NEW_CONF} directory )
+# TEST_NAME                     : set in sette.sh for each configuration to be tested (directory TEST_NAME is created under ${config} directory )
 #
 # EXAMPLES
 # ========
@@ -99,9 +99,6 @@ sync_config() {
 
       echo '-------------------------------------------------------------------------------'
       echo '                    SOURCE AND CONFIG FILES SYNCHRONISATION                    '
-      echo ''
-      echo "configuration $lCFG/MY_SRC will be synchronised with $lREF/MY_SRC"
-      echo ''
       # synchronise MY_SRC if $lCFG directory exist
       if [ -d $lREF/MY_SRC ] && [ -d $lCFG ] ; then
 
@@ -124,20 +121,31 @@ sync_config() {
          fi
 
          # synchronisation $lREF/MY_SRC directory (and delete file in target location if needed)
+         echo ''
+         echo "configuration $lCFG/MY_SRC will be synchronised with $lREF/MY_SRC"
+         echo ''
          rsync -a --delete $lREF/MY_SRC/ $lCFG/MY_SRC
 
          # rsync keep preserve the modification time stamp.
          # To avoid case where a file in MY_SRC is replace by an older file, we touch the file
          touch --no-create $lCFG/MY_SRC/*
+      else
+          echo ''
+          echo "configuration $lCFG/MY_SRC not synchronised with $lREF/MY_SRC"
+          echo ''
       fi
 
-      echo ''
-      echo "configuration $lCFG/EXP00 will be synchronised with $lREF/EXPREF"
-      echo "(links are skipped)"
-      echo ''
       # synchronize EXPREF
       if [ -d $lREF/EXPREF ] && [ -d $lCFG/EXP00 ] ; then
-         rsync -a --no-links $lREF/EXPREF/ $lCFG/EXP00/.
+          echo ''
+          echo "configuration $lCFG/EXP00 will be synchronised with $lREF/EXPREF"
+          echo "(links are skipped)"
+          echo ''
+          rsync -a --no-links $lREF/EXPREF/ $lCFG/EXP00/.
+      else
+          echo ''
+          echo "configuration $lCFG/EXP00 not synchronised with $lREF/EXPREF"
+          echo ''
       fi
       echo '-------------------------------------------------------------------------------'
    fi
@@ -158,7 +166,6 @@ clean_config() {
         echo ''
         echo "$(basename $lCFG) configuration has been cleaned"
       else
-        echo ''
         echo "$(basename $lCFG) configuration does not exist; we skip cleaning"
       fi
       echo ''
@@ -168,35 +175,20 @@ clean_config() {
 
 # define validation dir
 set_valid_dir () {
-    if [ ${DETACHED_HEAD} == "no" ] ; then
-      REVISION_NB=`git -C ${MAIN_DIR} rev-parse --short HEAD`
-    else
-      REVISION_NB=${DETACHED_CMIT}
-    fi
+    REVISION_NB=`git -C ${MAIN_DIR} rev-parse --short HEAD`
     REV_DATE0="`git -C ${MAIN_DIR} log -1 | grep Date | sed -e 's/.*Date: *//' -e's/ +.*$//'`"
     REV_DATE=`${DATE_CONV}"${REV_DATE0}" +"%y%j"`
-    REVISION_NB=${REV_DATE}_${REVISION_NB}
-    if [ ${#REVISION_NB} -eq 0 ]
-    then
-        echo "some problems with git rev-list command"
-        echo "some problems with git rev-list command" >> ${SETTE_DIR}/output.sette
-        REVISION_NB=`date +%Y%m%d`
-        echo "put in ${REVISION_NB} date"
-        echo "put in ${REVISION_NB} date" >> ${SETTE_DIR}/output.sette
-    else
+    REVISION_NB=${REV_DATE}_${NEMO_REV}
     echo "value of revision number of NEMOGCM: ${REVISION_NB}"
-    fi
     localchanges=`git -C ${MAIN_DIR} status --short -uno | wc -l`
     if [[ $localchanges > 0 ]] ; then
      REVISION_NB=${REVISION_NB}+
     fi
-    # remove last _ST followed by zero or more alphanumeric characters
-    NEW_CONF1=$( echo $NEW_CONF | sed -e 's/_ST\([0-9a-zA-Z]*\)$//' )
     CMP_NAM_L=$(echo ${CMP_NAM} | tr '[:upper:]' '[:lower:]')
     if [[ -n "${NEMO_DEBUG}" && ! ${CMP_NAM_L} =~ ("debug"|"dbg") ]]; then
-      export NEMO_VALID=${NEMO_VALIDATION_DIR}/${CMP_NAM}_DEBUG/${REVISION_NB}/${NEW_CONF1}/${TEST_NAME}
+      export NEMO_VALID=${NEMO_VALIDATION_DIR}/${CMP_NAM}_DEBUG/${REVISION_NB}/${SETTE_CONFIG%${SETTE_STG}}/${TEST_NAME}
     else
-      export NEMO_VALID=${NEMO_VALIDATION_DIR}/${CMP_NAM}/${REVISION_NB}/${NEW_CONF1}/${TEST_NAME}
+      export NEMO_VALID=${NEMO_VALIDATION_DIR}/${CMP_NAM}/${REVISION_NB}/${SETTE_CONFIG%${SETTE_STG}}/${TEST_NAME}
     fi
 }
 
@@ -329,7 +321,7 @@ post_test_tidyup () {
 #  EXE_DIR
 #  CONFIG_DIR
 #  NEMO_VALIDATION_DIR
-#  NEW_CONF
+#  config
 #  CMP_NAM
 #  TEST_NAME
 echo "SETTE directory is : ${SETTE_DIR}"
@@ -337,7 +329,7 @@ echo "INPUT directory is : ${INPUT_DIR}"
 echo "EXECUTION directory is : ${EXE_DIR}"
 echo "CONFIG directory is : ${CONFIG_DIR}"
 echo "VALIDATION directory is : ${NEMO_VALID}"
-echo "NEW CONFIGURATION is : ${NEW_CONF}"
+echo "CONFIGURATION is : ${config}"
 echo "COMPILER is : ${CMP_NAM}"
 echo "TEST is : ${TEST_NAME}"
 echo "TOOLS directory is : ${TOOLS_DIR}"
diff --git a/sette/fcm_job.sh b/sette/fcm_job.sh
index 9fe32fabfdce10e9df493534f8b17c1437c1cdc4..235fb9e97de7d65f863995001ecd86df2a1df37b 100755
--- a/sette/fcm_job.sh
+++ b/sette/fcm_job.sh
@@ -93,11 +93,16 @@ cd ${EXE_DIR}
 if [ "${INTERACT_FLAG}" == "yes" ]; then
 	eval ${JOB_FILE}
 else if [ "${INTERACT_FLAG}" == "no" ]; then
+        if [[ "${BATCH_COMMAND_PAR}" =~ "sbatch" ]]; then
+          BATCH_NAME0="${BATCH_NAME}_${config}_${TEST_NAME}"
+          BATCH_COMMAND_PAR="sbatch -J ${BATCH_NAME0} --parsable"
+          BATCH_COMMAND_SEQ=${BATCH_COMMAND_PAR}
+        fi
 	# submit job to batch system 
         if [ "${NB_PROC}" == "1" ]; then
-		eval ${BATCH_COMMAND_SEQ} ${JOB_FILE} ; echo  ${BATCH_COMMAND_SEQ} ${JOB_FILE}
+		BATCH_LST+=( $( ${BATCH_COMMAND_SEQ} ${JOB_FILE} ) ) ; echo ${BATCH_COMMAND_SEQ} ${JOB_FILE}
         else
-		eval ${BATCH_COMMAND_PAR} ${JOB_FILE} ; echo ${BATCH_COMMAND_PAR} ${JOB_FILE}
+		BATCH_LST+=( $( ${BATCH_COMMAND_PAR} ${JOB_FILE} ) ) ; echo ${BATCH_COMMAND_PAR} ${JOB_FILE}
         fi
 fi
 fi
diff --git a/sette/input_AGRIF.cfg b/sette/input_AGRIF_DEMO.cfg
similarity index 100%
rename from sette/input_AGRIF.cfg
rename to sette/input_AGRIF_DEMO.cfg
diff --git a/sette/input_SAS.cfg b/sette/input_ORCA2_SAS_ICE.cfg
similarity index 100%
rename from sette/input_SAS.cfg
rename to sette/input_ORCA2_SAS_ICE.cfg
diff --git a/sette/param.default b/sette/param.default
index 92dba321cad73e278c15313fc00ca109bea03875..fe0b2d155c911dcfc127a5b561209d3c532da164 100644
--- a/sette/param.default
+++ b/sette/param.default
@@ -35,8 +35,6 @@ BATCH_NAME=${SETTE_BATCH_NAME:-sette}
 FORCING_DIR=${SETTE_FORCING_DIR:-$WORKDIR/FORCING}
 # validation files storing
 NEMO_VALIDATION_DIR=${SETTE_NEMO_VALIDATION_DIR:-$MAIN_DIR}/NEMO_VALIDATION
-# input files storing (namelist, iodef ...) (DO NOT CHANGE)
-INPUT_DIR=${CONFIG_DIR}/${NEW_CONF}/EXP00
 # optional custom SETTE tests directory
 #export CUSTOM_DIR=/path/to/custom/sette/tests
 # ------------------------------------------------------------------------------------------
@@ -72,11 +70,13 @@ fi
 #
 # TYPES OF TESTS TO PERFORM
 # Note an attempt will be made to compile each configuration even if none of these tests are activated
+export DO_COMPILE=0
 export DO_RESTART=0  
 export DO_REPRO=0
 export DO_CORRUPT=0
 export DO_PHYOPTS=0
-TEST_TYPES=(${SETTE_TEST_TYPES[@]:-"RESTART REPRO PHYOPTS CORRUPT"})
+TEST_TYPES=(${SETTE_TEST_TYPES[@]:-"COMPILE RESTART REPRO PHYOPTS CORRUPT"})
+if [[ ${TEST_TYPES[*]} =~ .*COMPILE.* ]]; then export DO_COMPILE=1 ;fi
 if [[ ${TEST_TYPES[*]} =~ .*RESTART.* ]]; then export DO_RESTART=1 ;fi
 if [[ ${TEST_TYPES[*]} =~ .*REPRO.* ]]; then export DO_REPRO=1 ;fi
 if [[ ${TEST_TYPES[*]} =~ .*CORRUPT.* ]]; then export DO_CORRUPT=1 ;fi
diff --git a/sette/prepare_exe_dir.sh b/sette/prepare_exe_dir.sh
index a1d93fb65a11d3847424155480689a6d51be35dd..c823b11ab1d0e4e275048f8ca81b30311896d9a3 100755
--- a/sette/prepare_exe_dir.sh
+++ b/sette/prepare_exe_dir.sh
@@ -66,21 +66,21 @@ set -o posix
 
 # PREPARE EXEC_DIR
 #==================
-if [ -z "${CUSTOM_DIR}" ]; then
-  EXE_DIR=${CONFIG_DIR}/${NEW_CONF}
-else
-  CMP_NAM_L=$(echo ${CMP_NAM} | tr '[:upper:]' '[:lower:]')
-  if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]; then
-    export EXE_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}_DEBUG/${NEW_CONF}
-  else
-    EXE_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}/${NEW_CONF}
-  fi
-fi
+#if [ -z "${CUSTOM_DIR}" ]; then
+#  EXE_DIR=${CONFIG_DIR}/${SETTE_CONFIG}
+#else
+#  CMP_NAM_L=$(echo ${CMP_NAM} | tr '[:upper:]' '[:lower:]')
+#  if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]; then
+#    export EXE_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}_DEBUG/${SETTE_CONFIG}
+#  else
+#    EXE_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}/${SETTE_CONFIG}
+#  fi
+#fi
+EXE_DIR=${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
 mkdir -p ${EXE_DIR}/${TEST_NAME}
 
-#cp -RL ${EXE_DIR:-${CONFIG_DIR}/${NEW_CONF}}/EXP00/* ${EXE_DIR}/${TEST_NAME}/.
-cp -an ${EXE_DIR:-${CONFIG_DIR}/${NEW_CONF}}/EXP00/* ${EXE_DIR}/${TEST_NAME}/.
-COMP_KEYS="`cat ${EXE_DIR}/cpp_${NEW_CONF}.fcm | sed -e 's/.*fppkeys *//'`"
+cp -an ${EXE_DIR}/EXP00/* ${EXE_DIR}/${TEST_NAME}/.
+COMP_KEYS="`cat ${EXE_DIR}/cpp_${SETTE_CONFIG}.fcm | sed -e 's/.*fppkeys *//'`"
 
 export EXE_DIR=${EXE_DIR}/${TEST_NAME}
 cd ${EXE_DIR}
diff --git a/sette/prepare_job.sh b/sette/prepare_job.sh
index 80d3fa1e23fdd99f2e805df8f8364a943051cc53..2c76c99d69c196730fb38357cf07213f7abc42d6 100755
--- a/sette/prepare_job.sh
+++ b/sette/prepare_job.sh
@@ -101,10 +101,10 @@ NEMO_VALID=$7
 #
 echo "date: `date`" >> ${SETTE_DIR}/output.sette
 echo "" >> ${SETTE_DIR}/output.sette
-echo "running config: ${NEW_CONF}" >> ${SETTE_DIR}/output.sette
+echo "running config: ${SETTE_CONFIG}" >> ${SETTE_DIR}/output.sette
 echo "" >> ${SETTE_DIR}/output.sette
 echo "list of cpp_keys: " >> ${SETTE_DIR}/output.sette
-echo "`more ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm`" >> ${SETTE_DIR}/output.sette
+echo "`more ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}/cpp_${SETTE_CONFIG}.fcm`" >> ${SETTE_DIR}/output.sette
 echo "" >> ${SETTE_DIR}/output.sette
 echo "compiling with: ${CMP_NAM}" >> ${SETTE_DIR}/output.sette
 echo "" >> ${SETTE_DIR}/output.sette
@@ -269,10 +269,10 @@ fi
              -e"s/NXIOPROCS/${NXIO_PROC}/" \
              -e"s:DEF_SETTE_DIR:${SETTE_DIR}:" -e"s:DEF_INPUT_DIR:${INPUT_DIR}:" \
              -e"s:DEF_EXE_DIR:${EXE_DIR}:" \
-             -e"s:DEF_CONFIG_DIR:${NEMO_TDIR}:" \
+             -e"s:DEF_CONFIG_DIR:${CMP_DIR:-${CONFIG_DIR0}}:" \
              -e"s:DEF_TOOLS_DIR:${TOOLS_DIR}:" \
              -e"s:MPI_FLAG:${MPI_FLAG}:" \
-             -e"s:DEF_NEMO_VALIDATION:${NEMO_VALID}:" -e"s:DEF_NEW_CONF:${NEW_CONF}:" \
+             -e"s:DEF_NEMO_VALIDATION:${NEMO_VALID}:" -e"s:DEF_NEW_CONF:${SETTE_CONFIG}:" \
              -e"s:DEF_CMP_NAM:${CMP_NAM}:" -e"s:DEF_TEST_NAME:${TEST_NAME}:" > run_sette_test.job
 
         case ${COMPILER} in
diff --git a/sette/sette.sh b/sette/sette.sh
index 96182e1677aa6e4d177d0d0805b1c3716cfca8f7..72af6c16192c915fae82889971daa8361549bd4a 100755
--- a/sette/sette.sh
+++ b/sette/sette.sh
@@ -1,5 +1,6 @@
 #!/bin/sh
 #set -x
+
 # initialise user dependent variable
 export cmd=$0 ; export cmdargs=$@
 SETTE_DIR=$(cd $(dirname "$0"); pwd)
@@ -8,7 +9,8 @@ export CMPL_CORES=8            # Number of threads to use for compiling
 export SETTE_STG="_ST"         # Base suffix to append to configuration name
 NEMO_DEBUG=""
 dry_run=0
-NO_REPORT=0
+SETTE_REPORT=0
+WAIT_SETTE=0
 #
 # controls for some common namelist, run-time options:
 #
@@ -35,62 +37,36 @@ export USER_INPUT='yes'        # Default: yes => request user input on decisions
                                #                 1. regarding mismatched options
                                #                 2. regardin incompatible options
                                #                 3. regarding creation of directories
-#
-# Check that git branch is usable
-export DETACHED_HEAD="no"
-git -C ${MAIN_DIR} branch --show-current >& /dev/null
-if [[ $? == 0 ]] ; then
-  # subdirectory below NEMO_VALIDATION_DIR defaults to branchname
-  export SETTE_SUB_VAL="$(git -C ${MAIN_DIR} branch --show-current)"
-  if [ -z $SETTE_SUB_VAL ] ; then
-   # Probabably on a detached HEAD (possibly testing an old commit).
-   # Verify this and try to recover original commit
-   MORE_INFO="$(git branch -a | head -1l | sed -e's/.*(//' -e 's/)//' )"
-   if [[ "${MORE_INFO}" == *"detached"* ]] ; then
-     export DETACHED_HEAD="yes"
-     export DETACHED_CMIT=$( echo \\${MORE_INFO} | awk '{print $NF}' )
-     # There is no robust way to recover a branch name in a detached state
-     # so just use the commit with a prefix
-     export SETTE_SUB_VAL="detached_"${DETACHED_CMIT}
-   else
-     export SETTE_SUB_VAL="Unknown"
-   fi
-  fi
-  export SETTE_THIS_BRANCH=${SETTE_SUB_VAL}
-else
-  # subdirectory below NEMO_VALIDATION_DIR defaults to "MAIN"
-  export SETTE_SUB_VAL="MAIN"
-  export SETTE_THIS_BRANCH="Unknown"
-fi
+export SETTE_THIS_BRANCH=$(git log -1 --pretty=%D HEAD | sed 's|.*origin/||g;s|, .*||g;s|.*-> ||g' )
+export SETTE_SUB_VAL=${SETTE_THIS_BRANCH}
+export NEMO_REV=$(git -C ${MAIN_DIR} rev-parse --short HEAD 2> /dev/null)
 
 # Parse command-line arguments
 if [ $# -gt 0 ]; then
-  while getopts n:x:v:g:cybrshTqQteiACFNXua option; do
+  while getopts n:x:v:g:cybrshTqQteiACFNXuaw option; do
      case $option in
         c) export SETTE_CLEAN_CONFIGS='yes'
            export SETTE_SYNC_CONFIGS='yes'
-           echo "-c: Configuration ${SETTE_TEST_CONFIGS[@]} will be cleaned; this option enforces also synchronisation"
+           echo "-c: Configuration(s) ${SETTE_TEST_CONFIGS[@]} will be cleaned; this option enforces also synchronisation"
            echo "";;
         y) dry_run=1
            echo "";;
         b) NEMO_DEBUG="-b"
-           echo "-b: Nemo will be compiled with DEBUG options"
+           echo "-b: Nemo will be compiled with DEBUG options if available in ARCH file"
            echo "";;
-        r) NO_REPORT=1
+        r) SETTE_REPORT=1
+           echo "-r: Sette report will be printed once jobs are finished"
+           WAIT_SETTE=1
+           echo "";;
+        w) WAIT_SETTE=1
+           echo "-w: Sette will wait for jobs to finish"
            echo "";;
         s) export SETTE_SYNC_CONFIGS='yes'
            echo "-s: MY_SRC and EXP00 in ${SETTE_TEST_CONFIGS[@]} will be synchronised with the MY_SRC and EXPREF from the reference configuration"
            echo "";;
         n) OPTSTR="$OPTARG"
-           OPTSTR="${OPTSTR/ORCA2_SAS_ICE/SAS}"              # Permit either shortened (expected) or full name for SAS
-           OPTSTR="${OPTSTR/AGRIF_DEMO/AGRIF}"               # Permit either shortened (expected) or full name for AGRIF
-           export SETTE_TEST_CONFIGS=(${OPTSTR})
-           echo "=================================="
-           if [ ${#SETTE_TEST_CONFIGS[@]} -gt 1 ]; then
-             echo "-n: Configurations ${SETTE_TEST_CONFIGS[@]} will be tested if they are available"
-           else
-             echo "-n: Configuration ${SETTE_TEST_CONFIGS[@]} will be tested if it is available"
-           fi
+           SETTE_TEST_CONFIGS=(${OPTSTR})
+           echo "-n: Configuration(s) ${SETTE_TEST_CONFIGS[@]} will be tested if they are available"
            echo "";;
         g) case $OPTARG in
              [0-9,a-z,A-Z] ) echo "-g: Using ${SETTE_STG}${OPTARG} as the configuration suffix";;
@@ -155,7 +131,7 @@ if [ $# -gt 0 ]; then
                echo '-A to run tests in attached (SPMD) mode (default: MPMD with key_xios)'
                echo '-n "CFG1_to_test CFG2_to_test ..." to test some specific configurations'
                echo '-x "TEST_type TEST_type ..." to specify particular type(s) of test(s) to run after compilation'
-               echo '              TEST_type choices are: RESTART REPRO CORRUPT PHYSICS - anything else will COMPILE only'
+               echo '              TEST_type choices are: COMPILE RESTART REPRO CORRUPT PHYSICS - anything else will COMPILE only'
                echo '-v "subdir" optional validation record subdirectory to be created below NEMO_VALIDATION_DIR'
                echo '-g "group_suffix" single character suffix to be appended to the standard _ST suffix used'
                echo '                  for SETTE-built configurations (needed if sette.sh invocations may overlap)'
@@ -164,6 +140,8 @@ if [ $# -gt 0 ]; then
                echo '-b to compile Nemo with debug options (only if %DEBUG_FCFLAGS if defined in your arch file)'
                echo '-c to clean each configuration'
                echo '-s to synchronise the sette MY_SRC and EXP00 with the reference MY_SRC and EXPREF'
+               echo '-w to wait for Sette jobs to finish'
+               echo '-r to print Sette report after Sette jobs completion'
                echo '-u to run sette.sh without any user interaction. This means no checks on creating'
                echo '          directories etc. i.e. no safety net!' ; exit 42 ;;
      esac
@@ -173,7 +151,6 @@ fi
 #
 # Get SETTE parameters
 . ./param.cfg
-
 #
 # Set the common compile keys to add or delete based on command-line arguments:
 #
@@ -216,8 +193,6 @@ if [ ! -d $NEMO_VALIDATION_DIR/$SETTE_SUB_VAL ] && [ ${dry_run} -eq 0 ] ; then
 fi
 export NEMO_VALIDATION_DIR=$NEMO_VALIDATION_DIR/$SETTE_SUB_VAL
 
-TEST_CONFIGS="${TEST_CONFIGS/ORCA2_SAS_ICE/SAS}"   # Shortening of 'ORCA2_SAS_ICE' to 'SAS'
-TEST_CONFIGS="${TEST_CONFIGS/AGRIF_DEMO/AGRIF}"    # Shortening of 'AGRIF_DEMO' to 'AGRIF'
 if [ ${#SETTE_TEST_CONFIGS[@]} -eq 0 ]; then
    echo "=================================="
    echo "Configurations $TEST_CONFIGS will be tested if they are available"
@@ -225,6 +200,7 @@ fi
 echo "Carrying out the following tests  : ${TEST_TYPES[@]}"
 echo "requested by the command          : "$cmd $cmdargs
 echo "on branch                         : "$SETTE_THIS_BRANCH
+echo "on revision                       : "$NEMO_REV
 printf "%-33s : %s\n" USING_TIMING $USING_TIMING
 printf "%-33s : %s\n" USING_ICEBERGS $USING_ICEBERGS
 printf "%-33s : %s\n" USING_ABL $USING_ABL
@@ -246,7 +222,6 @@ echo ""
 # Option compatibility tests
 #
 if [ ${USING_MPMD} == "yes" ] && [ ${USING_XIOS} == "no" ] ; then echo "Incompatible choices. MPMD mode requires the XIOS server" ; exit ; fi
-
 if [ ${dry_run} -eq 1 ] ; then echo "dryrun only: no tests performed" ; exit ; fi
 
 # run sette on reference configuration
@@ -271,28 +246,49 @@ if [[ $? != 0 ]]; then
    exit 42
 fi
 
-if [ ${NO_REPORT} -ne 0 ] ; then exit ; fi
+# wait for sette jobs to finish
+if [[ ${WAIT_SETTE} -eq 1 && "${TEST_TYPES[@]}" =~ (RESTART|REPRO|CORRUPT|PHYSICS) ]]; then
+   echo ""
+   echo "-------------------------------------------------------------"
+   echo "wait for sette jobs to finish..."
+   echo "-------------------------------------------------------------"
+   echo ""
+   NRUN=999
+   NIT=0
+   while [[ $NRUN -ne 0 && $nit -le 1080 ]]; do
+      nit=$((nit+1))
+      if [[ "${BATCH_STAT}" == "squeue" && -n "${BATCH_LST[@]}" ]]; then
+        BATCH_STAT="squeue -j $(echo ${BATCH_LST[@]} | tr ' ' ',') -h -o %j"
+        NRUN=$( ${BATCH_STAT} | wc -l )
+        echo "currently running jobs: "$(${BATCH_STAT})
+      else
+        NRUN=$( ${BATCH_STAT} | grep ${BATCH_NAME} | wc -l )
+      fi
+      if [[ $NRUN -ne 0 ]]; then
+         echo $NRUN "sette jobs still in queue or running ..."
+         sleep 10
+      else
+         echo "all sette runs completed"
+         break
+      fi
+   done
+fi
+
 # run sette report
-echo ""
-echo "-------------------------------------------------------------"
-echo "./sette_rpt.sh (script will wait all nemo_sette run are done)"
-echo "-------------------------------------------------------------"
-echo ""
-NRUN=999
-NIT=0
-while [[ $NRUN -ne 0 && $nit -le 1080 ]]; do
-   nit=$((nit+1))
-   NRUN=$( ${BATCH_STAT} | grep ${BATCH_NAME} | wc -l ) 
-   if [[ $NRUN -ne 0 ]]; then 
-      printf "%-3d %s\r" $NRUN 'nemo_sette runs still in queue or running ...';
-   else
-      printf "%-50s\n" " "
-      . ./sette_rpt.sh ${NEMO_DEBUG}
-      exit
+if [ ${SETTE_REPORT} -eq 1 ] ; then
+   echo ""
+   echo "-------------------------------------------------------------"
+   echo "./sette_rpt.sh"
+   echo "-------------------------------------------------------------"
+   ./sette_rpt.sh ${NEMO_DEBUG} -n "${TEST_CONFIGS[*]}"
+   if [[ $? != 0 ]]; then
+      echo ""
+      echo "-----------------------------------------------------------------"
+      echo "./sette_rpt.sh didn't finish properly, need investigations"
+      echo "-----------------------------------------------------------------"
+      echo ""
+      exit 42
    fi
-   sleep 10
-done
-printf "\n"
-echo ""
-echo "Something wrong happened, it tooks more than 3 hours to run all the sette tests"
-echo ""
+fi
+
+exit 0
diff --git a/sette/sette_eval.sh b/sette/sette_eval.sh
index 58263277a5944373b113686d7fdbe76e043469a8..44c0a57ce4b436e5cf9d4133c47895cdade53200 100755
--- a/sette/sette_eval.sh
+++ b/sette/sette_eval.sh
@@ -156,8 +156,6 @@ function runcmpres(){
   quiet=0
   . ./param.cfg
   TEST_CONFIGS_AVAILABLE=${TEST_CONFIGS_AVAILABLE[@]:-${TEST_CONFIGS[@]}}     # workaround for some dated param.cfgs files
-  TEST_CONFIGS_AVAILABLE=${TEST_CONFIGS_AVAILABLE[@]/ SAS / ORCA2_SAS_ICE }   # workaround for some dated param.cfgs files
-  TEST_CONFIGS_AVAILABLE=${TEST_CONFIGS_AVAILABLE[@]/ AGRIF / AGRIF_DEMO }    # workaround for some dated param.cfgs files
   USER_INPUT='yes'        # Default: yes => request user input on decisions.
 
   mach=${COMPILER}
diff --git a/sette/sette_list_avail_cfg.sh b/sette/sette_list_avail_cfg.sh
index 1f0878d3fc3354489dc616fb5a2fcb39ca45e536..08fcdd3a5d990a03e9746a8deafec7ab60ddbd2a 100755
--- a/sette/sette_list_avail_cfg.sh
+++ b/sette/sette_list_avail_cfg.sh
@@ -5,9 +5,9 @@ printf "%-15s \n" GYRE_PISCES
 printf "%-15s \n" ORCA2_ICE_PISCES
 printf "%-15s \n" ORCA2_OFF_PISCES
 printf "%-15s \n" AMM12
-printf "%-15s \n" SAS
+printf "%-15s \n" ORCA2_SAS_ICE
 printf "%-15s \n" ORCA2_ICE_OBS
-printf "%-15s \n" AGRIF
+printf "%-15s \n" AGRIF_DEMO
 printf "%-15s \n" WED025
 echo ''
 echo 'Test cases available are named :'
diff --git a/sette/sette_reference-configurations.sh b/sette/sette_reference-configurations.sh
index f5ea3374ccb5d104936aad2c13ba536815629448..d6d11b9f4482a386c8e62917213037c6ad43b709 100755
--- a/sette/sette_reference-configurations.sh
+++ b/sette/sette_reference-configurations.sh
@@ -111,7 +111,7 @@ fi
 CONFIG_DIR0=${MAIN_DIR}/cfgs
 TOOLS_DIR=${MAIN_DIR}/tools
 if [ -n "${CUSTOM_DIR}" ]; then
-  NEMO_REV=$( git rev-parse --short HEAD 2> /dev/null )
+  #NEMO_REV=$( git rev-parse --short HEAD 2> /dev/null )
   CMP_NAM_L=$(echo ${CMP_NAM} | tr '[:upper:]' '[:lower:]')
   if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]; then
     export CMP_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}_DEBUG
@@ -130,10 +130,10 @@ cp BATCH_TEMPLATE/${JOB_PREFIX}-${COMPILER} job_batch_template || exit
 # ORCA2_ICE_PISCES  :
 # ORCA2_OFF_PISCES  :
 # AMM12             :
-# SAS               : aka ORCA2_SAS_ICE
+# ORCA2_SAS_ICE     :
 # ORCA2_ICE_OBS     :
-# AGRIF             : AGRIF_DEMO: test AGRIF in a double zoom configuration in the nordic seas + 1 zoom in the eq. Pacific and
-#                     AGRIF_DEMO_NOAGRIF: check that key_agrif without zoom = no key_agrif
+# AGRIF_DEMO        : test AGRIF in a double zoom configuration in the nordic seas + 1 zoom in the eq. Pacific and
+# AGRIF_DEMO_NOAGRIF: check that key_agrif without zoom = no key_agrif
 # WED025            : regional configuration including sea-ice and tides (Spitzbergen)
 
 . ./all_functions.sh
@@ -143,7 +143,7 @@ do
 # -----------
 # GYRE_PISCES
 # -----------
-if [ ${config} == "GYRE_PISCES" ] ;  then
+if [ ${config} == "GYRE_PISCES" ] ; then
     SETTE_CONFIG="GYRE_PISCES"${SETTE_STG}
     if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]
     then
@@ -152,6 +152,8 @@ if [ ${config} == "GYRE_PISCES" ] ;  then
 	ITEND=1080  # 90 days
     fi
     ITRST=$( printf "%08d" $(( ${ITEND} / 2 )) )
+
+if [ ${DO_COMPILE} -eq 1 ] ;  then
     cd ${MAIN_DIR}
     #
     # syncronisation if target directory/file exist (not done by makenemo)
@@ -159,10 +161,11 @@ if [ ${config} == "GYRE_PISCES" ] ;  then
     sync_config  ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     #
     # GYRE uses linssh so remove key_qco if added by default
-    . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r GYRE_PISCES ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}"
+    ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r GYRE_PISCES ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}"
 fi
-if [ ${config} == "GYRE_PISCES" ] && [ ${DO_RESTART} == "1" ] ;  then
+
 ## Restartability tests for GYRE_PISCES
+if [ ${DO_RESTART} == "1" ] ;  then
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
     . ./prepare_exe_dir.sh
@@ -228,8 +231,8 @@ if [ ${config} == "GYRE_PISCES" ] && [ ${DO_RESTART} == "1" ] ;  then
 
 fi
 
-if [ ${config} == "GYRE_PISCES" ] && [ ${DO_REPRO} == "1" ] ;  then
 ## Reproducibility tests for GYRE_PISCES
+if [ ${DO_REPRO} == "1" ] ;  then
     export TEST_NAME="REPRO_2_4"
     cd ${MAIN_DIR}
     cd ${SETTE_DIR}
@@ -287,10 +290,13 @@ if [ ${config} == "GYRE_PISCES" ] && [ ${DO_REPRO} == "1" ] ;  then
 
 fi
 
+fi # GYRE_PISCES
+
+
 # -----------------
 # ORCA2_ICE_PISCES
 # -----------------
-if [ ${config} == "ORCA2_ICE_PISCES" ] ;  then
+if [ ${config} == "ORCA2_ICE_PISCES" ] ; then
     SETTE_CONFIG="ORCA2_ICE_PISCES"${SETTE_STG}
     if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]
     then
@@ -299,16 +305,19 @@ if [ ${config} == "ORCA2_ICE_PISCES" ] ;  then
 	ITEND=992  # 62 days
     fi
     ITRST=$( printf "%08d" $(( ${ITEND} / 2 )) )
+
+if [ ${DO_COMPILE} -eq 1 ] ;  then
     cd ${MAIN_DIR}
     #
     # syncronisation if target directory/file exist (not done by makenemo)
     clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     sync_config  ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     #
-    . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_ICE_PISCES ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}"
+    ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_ICE_PISCES ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}"
 fi
-if [ ${config} == "ORCA2_ICE_PISCES" ] && [ ${DO_RESTART} == "1" ] ;  then
+
 ## Restartability tests for ORCA2_ICE_PISCES
+if [ ${DO_RESTART} == "1" ] ;  then
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
     . ./prepare_exe_dir.sh
@@ -453,8 +462,8 @@ if [ ${config} == "ORCA2_ICE_PISCES" ] && [ ${DO_RESTART} == "1" ] ;  then
 
 fi
 
-if [ ${config} == "ORCA2_ICE_PISCES" ] && [ ${DO_REPRO} == "1" ] ;  then
 ## Reproducibility tests for ORCA2_ICE_PISCES
+if [ ${DO_REPRO} == "1" ] ;  then
     export TEST_NAME="REPRO_4_8"
     cd ${MAIN_DIR}
     cd ${SETTE_DIR}
@@ -574,10 +583,13 @@ if [ ${config} == "ORCA2_ICE_PISCES" ] && [ ${DO_REPRO} == "1" ] ;  then
     . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 fi
 
+fi # ORCA2_ICE_PISCES
+
+
 # ----------------
 # ORCA2_OFF_PISCES
 # ----------------
-if [ ${config} == "ORCA2_OFF_PISCES" ] ;  then
+if [ ${config} == "ORCA2_OFF_PISCES" ]  ;  then
     SETTE_CONFIG="ORCA2_OFF_PISCES"${SETTE_STG}
     if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]
     then
@@ -586,6 +598,8 @@ if [ ${config} == "ORCA2_OFF_PISCES" ] ;  then
 	ITEND=380  # 95 days
     fi
     ITRST=$( printf "%08d" $(( ${ITEND} / 2 )) )
+
+if [ ${DO_COMPILE} -eq 1 ];  then
     cd ${MAIN_DIR}
     #
     # syncronisation if target directory/file exist (not done by makenemo)
@@ -593,10 +607,11 @@ if [ ${config} == "ORCA2_OFF_PISCES" ] ;  then
     sync_config  ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     #
     # ORCA2_OFF_PISCES uses linssh so remove key_qco if added by default
-    . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_OFF_PISCES ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}"
+    ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_OFF_PISCES ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}"
 fi
-if [ ${config} == "ORCA2_OFF_PISCES" ] && [ ${DO_RESTART} == "1" ] ;  then
+
 ## Restartability tests for ORCA2_OFF_PISCES
+if [ ${DO_RESTART} == "1" ] ;  then
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
     . ./prepare_exe_dir.sh
@@ -675,8 +690,8 @@ if [ ${config} == "ORCA2_OFF_PISCES" ] && [ ${DO_RESTART} == "1" ] ;  then
 
 fi
 
-if [ ${config} == "ORCA2_OFF_PISCES" ] && [ ${DO_REPRO} == "1" ] ;  then
 ## Reproducibility tests for ORCA2_OFF_PISCES
+if [ ${DO_REPRO} == "1" ] ;  then
     export TEST_NAME="REPRO_4_8"
     cd ${MAIN_DIR}
     cd ${SETTE_DIR}
@@ -751,6 +766,8 @@ if [ ${config} == "ORCA2_OFF_PISCES" ] && [ ${DO_REPRO} == "1" ] ;  then
     . ./fcm_job.sh $NPROC  ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 fi
 
+fi # ORCA2_OFF_PISCES
+
 # -----
 # AMM12
 # -----
@@ -763,16 +780,19 @@ if [ ${config} == "AMM12" ] ;  then
 	ITEND=576  # 4 days
     fi
     ITRST=$( printf "%08d" $(( ${ITEND} / 2 )) )
+
+if [ ${DO_COMPILE} -eq 1 ] ;  then
     cd ${MAIN_DIR}
     #
     # syncronisation if target directory/file exist (not done by makenemo)
     clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     sync_config  ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     #
-    . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AMM12 ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}"
+    ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AMM12 ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}"
 fi
-if [ ${config} == "AMM12" ] && [ ${DO_RESTART} == "1" ] ;  then
-    ## Restartability tests for AMM12
+
+## Restartability tests for AMM12
+if [ ${DO_RESTART} == "1" ] ;  then
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
     . ./prepare_exe_dir.sh
@@ -831,8 +851,8 @@ if [ ${config} == "AMM12" ] && [ ${DO_RESTART} == "1" ] ;  then
 
 fi
 
-if [ ${config} == "AMM12" ] && [ ${DO_REPRO} == "1" ] ;  then
 ## Reproducibility tests for AMM12
+if [ ${DO_REPRO} == "1" ] ;  then
     export TEST_NAME="REPRO_8_4"
     cd ${MAIN_DIR}
     cd ${SETTE_DIR}
@@ -884,11 +904,13 @@ if [ ${config} == "AMM12" ] && [ ${DO_REPRO} == "1" ] ;  then
     . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 fi
 
+fi # AMM12
+
 
 # ---------
 # ORCA2_SAS_ICE
 # ---------
-if [ ${config} == "SAS" ] ;  then
+if [ ${config} == "ORCA2_SAS_ICE" ] ;  then
     SETTE_CONFIG="ORCA2_SAS_ICE"${SETTE_STG}
     if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]
     then
@@ -897,6 +919,8 @@ if [ ${config} == "SAS" ] ;  then
 	ITEND=256  # 16 days
     fi
     ITRST=$( printf "%08d" $(( ${ITEND} / 2 )) )
+
+if [ ${DO_COMPILE} -eq 1 ] ;  then
     cd ${MAIN_DIR}
     #
     # syncronisation if target directory/file exist (not done by makenemo)
@@ -904,10 +928,11 @@ if [ ${config} == "SAS" ] ;  then
     sync_config  ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     #
     # ORCA2_SAS_ICE uses linssh so remove key_qco if added by default
-    . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_SAS_ICE ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}"
+    ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_SAS_ICE ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}"
 fi
-if [ ${config} == "SAS" ] && [ ${DO_RESTART} == "1" ] ;  then
+
 ## Restartability tests
+if [ ${DO_RESTART} == "1" ] ;  then
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
     . ./prepare_exe_dir.sh
@@ -917,7 +942,7 @@ if [ ${config} == "SAS" ] && [ ${DO_RESTART} == "1" ] ;  then
     NPROC=32
     if [ -f ${JOB_FILE} ] ; then \rm ${JOB_FILE} ; fi
     cd ${EXE_DIR}
-    set_namelist namelist_cfg cn_exp \"SAS\"
+    set_namelist namelist_cfg cn_exp \"ORCA2_SAS_ICE\"
     set_namelist namelist_cfg nn_it000 1
     set_namelist namelist_cfg nn_itend ${ITEND}
     set_namelist namelist_cfg nn_stock $(( ${ITEND} / 2 ))
@@ -931,7 +956,7 @@ if [ ${config} == "SAS" ] && [ ${DO_RESTART} == "1" ] ;  then
     set_namelist_opt namelist_cfg ln_tile ${USING_TILING} .true. .false.
     set_xio_using_server iodef.xml ${USING_MPMD}
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_SAS.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
+    . ./prepare_job.sh input_ORCA2_SAS_ICE.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
 
     cd ${SETTE_DIR}
     export TEST_NAME="SHORT"
@@ -939,7 +964,7 @@ if [ ${config} == "SAS" ] && [ ${DO_RESTART} == "1" ] ;  then
     set_valid_dir
     clean_valid_dir
     cd ${EXE_DIR}
-    set_namelist namelist_cfg cn_exp \"SAS\"
+    set_namelist namelist_cfg cn_exp \"ORCA2_SAS_ICE\"
     set_namelist namelist_cfg nn_it000 $(( ${ITEND} / 2 + 1 ))
     set_namelist namelist_cfg nn_itend ${ITEND}
     set_namelist namelist_cfg nn_stock $(( ${ITEND} / 2 ))
@@ -949,8 +974,8 @@ if [ ${config} == "SAS" ] && [ ${DO_RESTART} == "1" ] ;  then
     set_namelist namelist_cfg ln_rstart .true.
     set_namelist namelist_cfg nn_rstctl 2
     set_namelist namelist_cfg nn_date0 010109
-    set_namelist namelist_cfg cn_ocerst_in \"SAS_${ITRST}_restart\"
-    set_namelist namelist_ice_cfg cn_icerst_in \"SAS_${ITRST}_restart_ice\"
+    set_namelist namelist_cfg cn_ocerst_in \"ORCA2_SAS_ICE_${ITRST}_restart\"
+    set_namelist namelist_ice_cfg cn_icerst_in \"ORCA2_SAS_ICE_${ITRST}_restart_ice\"
     set_namelist_opt namelist_cfg ln_timing ${USING_TIMING} .true. .false.
     set_namelist_opt namelist_cfg nn_hls ${USING_EXTRA_HALO} 3 2
     set_namelist_opt namelist_cfg nn_comm ${USING_COLLECTIVES} 2 1
@@ -959,18 +984,18 @@ if [ ${config} == "SAS" ] && [ ${DO_RESTART} == "1" ] ;  then
     for (( i=1; i<=$NPROC; i++)) ; do
         L_NPROC=$(( $i - 1 ))
         L_NPROC=`printf "%04d\n" ${L_NPROC}`
-        ln -sf ../LONG/SAS_${ITRST}_restart_${L_NPROC}.nc .
-        ln -sf ../LONG/SAS_${ITRST}_restart_ice_${L_NPROC}.nc .
+        ln -sf ../LONG/ORCA2_SAS_ICE_${ITRST}_restart_${L_NPROC}.nc .
+        ln -sf ../LONG/ORCA2_SAS_ICE_${ITRST}_restart_ice_${L_NPROC}.nc .
     done
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_SAS.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
+    . ./prepare_job.sh input_ORCA2_SAS_ICE.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
     cd ${SETTE_DIR}
     . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 
 fi
 
-if [ ${config} == "SAS" ] && [ ${DO_REPRO} == "1" ] ;  then
 ## Reproducibility tests
+if [ ${DO_REPRO} == "1" ] ;  then
     if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]
     then
 	ITEND=16  # 1 day
@@ -987,7 +1012,7 @@ if [ ${config} == "SAS" ] && [ ${DO_REPRO} == "1" ] ;  then
     NPROC=32
     if [ -f ${JOB_FILE} ] ; then \rm ${JOB_FILE} ; fi
     cd ${EXE_DIR}
-    set_namelist namelist_cfg cn_exp \"SAS_48\"
+    set_namelist namelist_cfg cn_exp \"ORCA2_SAS_ICE_48\"
     set_namelist namelist_cfg nn_it000 1
     set_namelist namelist_cfg nn_itend ${ITEND}
     set_namelist namelist_cfg jpni 4
@@ -999,7 +1024,7 @@ if [ ${config} == "SAS" ] && [ ${DO_REPRO} == "1" ] ;  then
     set_namelist_opt namelist_cfg ln_tile ${USING_TILING} .true. .false.
     set_xio_using_server iodef.xml ${USING_MPMD}
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_SAS.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
+    . ./prepare_job.sh input_ORCA2_SAS_ICE.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
     cd ${SETTE_DIR}
     . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 
@@ -1012,7 +1037,7 @@ if [ ${config} == "SAS" ] && [ ${DO_REPRO} == "1" ] ;  then
     NPROC=32
     if [ -f ${JOB_FILE} ] ; then \rm ${JOB_FILE} ; fi
     cd ${EXE_DIR}
-    set_namelist namelist_cfg cn_exp \"SAS_84\"
+    set_namelist namelist_cfg cn_exp \"ORCA2_SAS_ICE_84\"
     set_namelist namelist_cfg nn_it000 1
     set_namelist namelist_cfg nn_itend ${ITEND}
     set_namelist namelist_cfg jpni 8
@@ -1024,12 +1049,14 @@ if [ ${config} == "SAS" ] && [ ${DO_REPRO} == "1" ] ;  then
     set_namelist_opt namelist_cfg ln_tile ${USING_TILING} .true. .false.
     set_xio_using_server iodef.xml ${USING_MPMD}
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_SAS.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
+    . ./prepare_job.sh input_ORCA2_SAS_ICE.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
     cd ${SETTE_DIR}
     . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 
 fi
 
+fi
+
 
 # --------------
 # ORCA2_ICE_OBS
@@ -1038,23 +1065,25 @@ fi
 ## Restartability not tested (ASM code not restartable while increments are being applied)
 if [ ${config} == "ORCA2_ICE_OBS" ] ;  then
     SETTE_CONFIG="ORCA2_ICE_OBS"${SETTE_STG}
-## Reproducibility tests
     if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]
     then
 	ITEND=16  # 1 day
     else
 	ITEND=80  # 5 days
     fi
+
+if [ ${DO_COMPILE} -eq 1 ] ;  then
     cd ${MAIN_DIR}
     #
     # syncronisation if target directory/file exist (not done by makenemo)
     clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     sync_config  ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     #
-    . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_ICE_PISCES -d "OCE ICE" ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "key_asminc ${ADD_KEYS}" del_key "key_top ${DEL_KEYS}"
+    ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_ICE_PISCES -d "OCE ICE" ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "key_asminc ${ADD_KEYS}" del_key "key_top ${DEL_KEYS}"
 fi
-if [ ${config} == "ORCA2_ICE_OBS" ] && [ ${DO_RESTART} == "1" ] ;  then
+
 ## Reproducibility tests
+if [ ${DO_RESTART} == "1" ] ;  then
     export TEST_NAME="REPRO_4_8"
     cd ${SETTE_DIR}
     . ./prepare_exe_dir.sh
@@ -1154,10 +1183,13 @@ if [ ${config} == "ORCA2_ICE_OBS" ] && [ ${DO_RESTART} == "1" ] ;  then
     . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 fi
 
+fi
+
+
 # ------------
-# AGRIF ICE
+# AGRIF_DEMO
 # -----------
-if [ ${config} == "AGRIF" ] ;  then
+if [ ${config} == "AGRIF_DEMO" ] ;  then
     SETTE_CONFIG="AGRIF_DEMO"${SETTE_STG}
     if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]
     then
@@ -1169,16 +1201,19 @@ if [ ${config} == "AGRIF" ] ;  then
     ITRST_1=$( printf "%08d" $(( ${ITEND} / 2 )) )
     ITRST_2=$( printf "%08d" $(( ${ITEND} * 4 / 2 )) )
     ITRST_3=$( printf "%08d" $(( ${ITEND} * 4 * 3 / 2 )) )
+
+if [ ${DO_COMPILE} -eq 1 ] ;  then
     cd ${MAIN_DIR}
     #
     # syncronisation if target directory/file exist (not done by makenemo)
     clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     sync_config  ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     #
-    . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AGRIF_DEMO ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}"
+    ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AGRIF_DEMO ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}"
 fi
-if [ ${config} == "AGRIF" ] && [ ${DO_RESTART} == "1" ] ;  then
+
 ## Restartability tests
+if [ ${DO_RESTART} == "1" ] ;  then
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
     . ./prepare_exe_dir.sh
@@ -1188,24 +1223,24 @@ if [ ${config} == "AGRIF" ] && [ ${DO_RESTART} == "1" ] ;  then
     NPROC=16
     if [ -f ${JOB_FILE} ] ; then \rm ${JOB_FILE} ; fi
     cd ${EXE_DIR}
-    set_namelist namelist_cfg cn_exp \"AGRIF_LONG\"
+    set_namelist namelist_cfg cn_exp \"AGRIF_DEMO_LONG\"
     set_namelist namelist_cfg nn_it000 1
     set_namelist namelist_cfg nn_itend ${ITEND}
     set_namelist namelist_cfg nn_stock $(( ${ITEND} / 2 ))
     set_namelist namelist_cfg sn_cfctl%l_runstat .true.
     set_namelist namelist_cfg sn_cfctl%l_trcstat .true.
     #set_namelist_opt namelist_cfg ln_timing ${USING_TIMING} .true. .false.
-    set_namelist 1_namelist_cfg cn_exp \"AGRIF_LONG\"
+    set_namelist 1_namelist_cfg cn_exp \"AGRIF_DEMO_LONG\"
     set_namelist 1_namelist_cfg nn_it000 1
     set_namelist 1_namelist_cfg nn_itend ${ITEND}
     set_namelist 1_namelist_cfg nn_stock $(( ${ITEND} / 2 ))
     set_namelist 1_namelist_cfg sn_cfctl%l_runstat .true.
-    set_namelist 2_namelist_cfg cn_exp \"AGRIF_LONG\"
+    set_namelist 2_namelist_cfg cn_exp \"AGRIF_DEMO_LONG\"
     set_namelist 2_namelist_cfg nn_it000 1
     set_namelist 2_namelist_cfg nn_itend $(( ${ITEND} * 4 ))
     set_namelist 2_namelist_cfg nn_stock $(( ${ITEND} * 4 / 2 ))
     set_namelist 2_namelist_cfg sn_cfctl%l_runstat .true.
-    set_namelist 3_namelist_cfg cn_exp \"AGRIF_LONG\"
+    set_namelist 3_namelist_cfg cn_exp \"AGRIF_DEMO_LONG\"
     set_namelist 3_namelist_cfg nn_it000 1
     set_namelist 3_namelist_cfg nn_itend $(( ${ITEND} * 4 * 3 ))
     set_namelist 3_namelist_cfg nn_stock $(( ${ITEND} * 4 * 3 / 2 ))
@@ -1226,7 +1261,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_RESTART} == "1" ] ;  then
 
     set_xio_using_server iodef.xml ${USING_MPMD}
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_AGRIF.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
+    . ./prepare_job.sh input_AGRIF_DEMO.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
     
     cd ${SETTE_DIR}
     export TEST_NAME="SHORT"
@@ -1234,7 +1269,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_RESTART} == "1" ] ;  then
     set_valid_dir
     clean_valid_dir
     cd ${EXE_DIR}
-    set_namelist namelist_cfg cn_exp \"AGRIF_SHORT\"
+    set_namelist namelist_cfg cn_exp \"AGRIF_DEMO_SHORT\"
     set_namelist namelist_cfg nn_it000 $(( ${ITEND} / 2 + 1 ))
     set_namelist namelist_cfg nn_itend ${ITEND}
     set_namelist namelist_cfg nn_stock $(( ${ITEND} / 2 ))
@@ -1245,7 +1280,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_RESTART} == "1" ] ;  then
     set_namelist namelist_top_cfg ln_rsttr .true.
     set_namelist namelist_top_cfg nn_rsttr 2 
     #set_namelist_opt namelist_cfg ln_timing ${USING_TIMING} .true. .false.
-    set_namelist 1_namelist_cfg cn_exp \"AGRIF_SHORT\"
+    set_namelist 1_namelist_cfg cn_exp \"AGRIF_DEMO_SHORT\"
     set_namelist 1_namelist_cfg nn_it000 $(( ${ITEND} / 2 + 1 ))
     set_namelist 1_namelist_cfg nn_itend ${ITEND}
     set_namelist 1_namelist_cfg nn_stock $(( ${ITEND} / 2 ))
@@ -1255,7 +1290,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_RESTART} == "1" ] ;  then
     set_namelist 1_namelist_top_cfg ln_rsttr .true.
     set_namelist 1_namelist_cfg ln_init_chfrpar .false.
     set_namelist 1_namelist_top_cfg nn_rsttr 2 
-    set_namelist 2_namelist_cfg cn_exp \"AGRIF_SHORT\"
+    set_namelist 2_namelist_cfg cn_exp \"AGRIF_DEMO_SHORT\"
     set_namelist 2_namelist_cfg nn_it000 $(( ${ITEND} * 4 / 2 + 1 ))
     set_namelist 2_namelist_cfg nn_itend $(( ${ITEND} * 4 ))
     set_namelist 2_namelist_cfg nn_stock $(( ${ITEND} * 4 / 2 ))
@@ -1265,7 +1300,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_RESTART} == "1" ] ;  then
     set_namelist 2_namelist_cfg ln_init_chfrpar .false.
     set_namelist 2_namelist_top_cfg ln_rsttr .true.
     set_namelist 2_namelist_top_cfg nn_rsttr 2 
-    set_namelist 3_namelist_cfg cn_exp \"AGRIF_SHORT\"
+    set_namelist 3_namelist_cfg cn_exp \"AGRIF_DEMO_SHORT\"
     set_namelist 3_namelist_cfg nn_it000 $(( ${ITEND} * 4 * 3 / 2 + 1 ))
     set_namelist 3_namelist_cfg nn_itend $(( ${ITEND} * 4 * 3 ))
     set_namelist 3_namelist_cfg nn_stock $(( ${ITEND} * 4 * 3 / 2 ))
@@ -1275,18 +1310,18 @@ if [ ${config} == "AGRIF" ] && [ ${DO_RESTART} == "1" ] ;  then
     set_namelist 3_namelist_cfg ln_init_chfrpar .false.
     set_namelist 3_namelist_top_cfg ln_rsttr .true.
     set_namelist 3_namelist_top_cfg nn_rsttr 2 
-    set_namelist namelist_cfg cn_ocerst_in \"AGRIF_LONG_${ITRST}_restart\"
-    set_namelist namelist_ice_cfg cn_icerst_in \"AGRIF_LONG_${ITRST}_restart_ice\"
-    set_namelist namelist_top_cfg cn_trcrst_in \"AGRIF_LONG_${ITRST}_restart_trc\"
-    set_namelist 1_namelist_cfg cn_ocerst_in \"AGRIF_LONG_${ITRST_1}_restart\"
-    set_namelist 1_namelist_ice_cfg cn_icerst_in \"AGRIF_LONG_${ITRST_1}_restart_ice\"
-    set_namelist 1_namelist_top_cfg cn_trcrst_in \"AGRIF_LONG_${ITRST_1}_restart_trc\"
-    set_namelist 2_namelist_cfg cn_ocerst_in \"AGRIF_LONG_${ITRST_2}_restart\"
-    set_namelist 2_namelist_ice_cfg cn_icerst_in \"AGRIF_LONG_${ITRST_2}_restart_ice\"
-    set_namelist 2_namelist_top_cfg cn_trcrst_in \"AGRIF_LONG_${ITRST_2}_restart_trc\"
-    set_namelist 3_namelist_cfg cn_ocerst_in \"AGRIF_LONG_${ITRST_3}_restart\"
-    set_namelist 3_namelist_ice_cfg cn_icerst_in \"AGRIF_LONG_${ITRST_3}_restart_ice\"
-    set_namelist 3_namelist_top_cfg cn_trcrst_in \"AGRIF_LONG_${ITRST_3}_restart_trc\"
+    set_namelist namelist_cfg cn_ocerst_in \"AGRIF_DEMO_LONG_${ITRST}_restart\"
+    set_namelist namelist_ice_cfg cn_icerst_in \"AGRIF_DEMO_LONG_${ITRST}_restart_ice\"
+    set_namelist namelist_top_cfg cn_trcrst_in \"AGRIF_DEMO_LONG_${ITRST}_restart_trc\"
+    set_namelist 1_namelist_cfg cn_ocerst_in \"AGRIF_DEMO_LONG_${ITRST_1}_restart\"
+    set_namelist 1_namelist_ice_cfg cn_icerst_in \"AGRIF_DEMO_LONG_${ITRST_1}_restart_ice\"
+    set_namelist 1_namelist_top_cfg cn_trcrst_in \"AGRIF_DEMO_LONG_${ITRST_1}_restart_trc\"
+    set_namelist 2_namelist_cfg cn_ocerst_in \"AGRIF_DEMO_LONG_${ITRST_2}_restart\"
+    set_namelist 2_namelist_ice_cfg cn_icerst_in \"AGRIF_DEMO_LONG_${ITRST_2}_restart_ice\"
+    set_namelist 2_namelist_top_cfg cn_trcrst_in \"AGRIF_DEMO_LONG_${ITRST_2}_restart_trc\"
+    set_namelist 3_namelist_cfg cn_ocerst_in \"AGRIF_DEMO_LONG_${ITRST_3}_restart\"
+    set_namelist 3_namelist_ice_cfg cn_icerst_in \"AGRIF_DEMO_LONG_${ITRST_3}_restart_ice\"
+    set_namelist 3_namelist_top_cfg cn_trcrst_in \"AGRIF_DEMO_LONG_${ITRST_3}_restart_trc\"
 #
     set_namelist_opt namelist_cfg nn_hls ${USING_EXTRA_HALO} 3 2
     set_namelist_opt namelist_cfg nn_comm ${USING_COLLECTIVES} 2 1
@@ -1304,29 +1339,29 @@ if [ ${config} == "AGRIF" ] && [ ${DO_RESTART} == "1" ] ;  then
     for (( i=1; i<=$NPROC; i++)) ; do
         L_NPROC=$(( $i - 1 ))
         L_NPROC=`printf "%04d\n" ${L_NPROC}`
-        ln -sf ../LONG/AGRIF_LONG_${ITRST}_restart_${L_NPROC}.nc .
-        ln -sf ../LONG/AGRIF_LONG_${ITRST}_restart_ice_${L_NPROC}.nc .
-        ln -sf ../LONG/AGRIF_LONG_${ITRST}_restart_trc_${L_NPROC}.nc .
-        ln -sf ../LONG/1_AGRIF_LONG_${ITRST_1}_restart_${L_NPROC}.nc .
-        ln -sf ../LONG/1_AGRIF_LONG_${ITRST_1}_restart_ice_${L_NPROC}.nc .
-        ln -sf ../LONG/1_AGRIF_LONG_${ITRST_1}_restart_trc_${L_NPROC}.nc .
-        ln -sf ../LONG/2_AGRIF_LONG_${ITRST_2}_restart_${L_NPROC}.nc .
-        ln -sf ../LONG/2_AGRIF_LONG_${ITRST_2}_restart_ice_${L_NPROC}.nc .
-        ln -sf ../LONG/2_AGRIF_LONG_${ITRST_2}_restart_trc_${L_NPROC}.nc .
-        ln -sf ../LONG/3_AGRIF_LONG_${ITRST_3}_restart_${L_NPROC}.nc .
-        ln -sf ../LONG/3_AGRIF_LONG_${ITRST_3}_restart_ice_${L_NPROC}.nc .
-        ln -sf ../LONG/3_AGRIF_LONG_${ITRST_3}_restart_trc_${L_NPROC}.nc .
+        ln -sf ../LONG/AGRIF_DEMO_LONG_${ITRST}_restart_${L_NPROC}.nc .
+        ln -sf ../LONG/AGRIF_DEMO_LONG_${ITRST}_restart_ice_${L_NPROC}.nc .
+        ln -sf ../LONG/AGRIF_DEMO_LONG_${ITRST}_restart_trc_${L_NPROC}.nc .
+        ln -sf ../LONG/1_AGRIF_DEMO_LONG_${ITRST_1}_restart_${L_NPROC}.nc .
+        ln -sf ../LONG/1_AGRIF_DEMO_LONG_${ITRST_1}_restart_ice_${L_NPROC}.nc .
+        ln -sf ../LONG/1_AGRIF_DEMO_LONG_${ITRST_1}_restart_trc_${L_NPROC}.nc .
+        ln -sf ../LONG/2_AGRIF_DEMO_LONG_${ITRST_2}_restart_${L_NPROC}.nc .
+        ln -sf ../LONG/2_AGRIF_DEMO_LONG_${ITRST_2}_restart_ice_${L_NPROC}.nc .
+        ln -sf ../LONG/2_AGRIF_DEMO_LONG_${ITRST_2}_restart_trc_${L_NPROC}.nc .
+        ln -sf ../LONG/3_AGRIF_DEMO_LONG_${ITRST_3}_restart_${L_NPROC}.nc .
+        ln -sf ../LONG/3_AGRIF_DEMO_LONG_${ITRST_3}_restart_ice_${L_NPROC}.nc .
+        ln -sf ../LONG/3_AGRIF_DEMO_LONG_${ITRST_3}_restart_trc_${L_NPROC}.nc .
     done
     set_xio_using_server iodef.xml ${USING_MPMD}
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_AGRIF.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
+    . ./prepare_job.sh input_AGRIF_DEMO.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
     cd ${SETTE_DIR}
     . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 
 fi
 
-if [ ${config} == "AGRIF" ] && [ ${DO_REPRO} == "1" ] ;  then
 ## Reproducibility tests
+if [ ${DO_REPRO} == "1" ] ;  then
     export TEST_NAME="REPRO_2_8"
     cd ${MAIN_DIR}
     cd ${SETTE_DIR}
@@ -1337,7 +1372,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_REPRO} == "1" ] ;  then
     NPROC=16
     if [ -f ${JOB_FILE} ] ; then \rm ${JOB_FILE} ; fi
     cd ${EXE_DIR}
-    set_namelist namelist_cfg cn_exp \"AGRIF_28\"
+    set_namelist namelist_cfg cn_exp \"AGRIF_DEMO_28\"
     set_namelist namelist_cfg nn_it000 1
     set_namelist namelist_cfg nn_itend ${ITEND}
     set_namelist namelist_cfg jpni 2
@@ -1348,7 +1383,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_REPRO} == "1" ] ;  then
     set_namelist_opt namelist_cfg nn_comm ${USING_COLLECTIVES} 2 1
     set_namelist_opt namelist_cfg ln_tile ${USING_TILING} .true. .false.
     #set_namelist_opt namelist_cfg ln_timing ${USING_TIMING} .true. .false.
-    set_namelist 1_namelist_cfg cn_exp \"AGRIF_28\"
+    set_namelist 1_namelist_cfg cn_exp \"AGRIF_DEMO_28\"
     set_namelist 1_namelist_cfg nn_it000 1
     set_namelist 1_namelist_cfg nn_itend ${ITEND}
     set_namelist 1_namelist_cfg jpni 2
@@ -1357,7 +1392,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_REPRO} == "1" ] ;  then
     set_namelist_opt 1_namelist_cfg nn_hls ${USING_EXTRA_HALO} 3 2
     set_namelist_opt 1_namelist_cfg nn_comm ${USING_COLLECTIVES} 2 1
     set_namelist_opt 1_namelist_cfg ln_tile ${USING_TILING} .true. .false.
-    set_namelist 2_namelist_cfg cn_exp \"AGRIF_28\"
+    set_namelist 2_namelist_cfg cn_exp \"AGRIF_DEMO_28\"
     set_namelist 2_namelist_cfg nn_it000 1
     set_namelist 2_namelist_cfg nn_itend $(( ${ITEND} * 4 ))
     set_namelist 2_namelist_cfg jpni 2
@@ -1366,7 +1401,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_REPRO} == "1" ] ;  then
     set_namelist_opt 2_namelist_cfg nn_hls ${USING_EXTRA_HALO} 3 2
     set_namelist_opt 2_namelist_cfg nn_comm ${USING_COLLECTIVES} 2 1
     set_namelist_opt 2_namelist_cfg ln_tile ${USING_TILING} .true. .false.
-    set_namelist 3_namelist_cfg cn_exp \"AGRIF_28\"
+    set_namelist 3_namelist_cfg cn_exp \"AGRIF_DEMO_28\"
     set_namelist 3_namelist_cfg nn_it000 1
     set_namelist 3_namelist_cfg nn_itend $(( ${ITEND} * 4 * 3 ))
     set_namelist 3_namelist_cfg jpni 2
@@ -1378,7 +1413,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_REPRO} == "1" ] ;  then
 
     set_xio_using_server iodef.xml ${USING_MPMD}
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_AGRIF.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
+    . ./prepare_job.sh input_AGRIF_DEMO.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
     cd ${SETTE_DIR}
     . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 
@@ -1391,7 +1426,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_REPRO} == "1" ] ;  then
     NPROC=16
     if [ -f ${JOB_FILE} ] ; then \rm ${JOB_FILE} ; fi
     cd ${EXE_DIR}
-    set_namelist namelist_cfg cn_exp \"AGRIF_44\"
+    set_namelist namelist_cfg cn_exp \"AGRIF_DEMO_44\"
     set_namelist namelist_cfg nn_it000 1
     set_namelist namelist_cfg nn_itend ${ITEND}
     set_namelist namelist_cfg jpni 4
@@ -1403,7 +1438,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_REPRO} == "1" ] ;  then
     set_namelist_opt namelist_cfg ln_tile ${USING_TILING} .true. .false.
     #set_namelist_opt namelist_cfg ln_timing ${USING_TIMING} .true. .false.
     set_xio_using_server iodef.xml ${USING_MPMD}
-    set_namelist 1_namelist_cfg cn_exp \"AGRIF_44\"
+    set_namelist 1_namelist_cfg cn_exp \"AGRIF_DEMO_44\"
     set_namelist 1_namelist_cfg nn_it000 1
     set_namelist 1_namelist_cfg nn_itend ${ITEND}
     set_namelist 1_namelist_cfg jpni 4
@@ -1412,7 +1447,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_REPRO} == "1" ] ;  then
     set_namelist_opt 1_namelist_cfg nn_hls ${USING_EXTRA_HALO} 3 2
     set_namelist_opt 1_namelist_cfg nn_comm ${USING_COLLECTIVES} 2 1
     set_namelist_opt 1_namelist_cfg ln_tile ${USING_TILING} .true. .false.
-    set_namelist 2_namelist_cfg cn_exp \"AGRIF_44\"
+    set_namelist 2_namelist_cfg cn_exp \"AGRIF_DEMO_44\"
     set_namelist 2_namelist_cfg nn_it000 1
     set_namelist 2_namelist_cfg nn_itend $(( ${ITEND} * 4 ))
     set_namelist 2_namelist_cfg jpni 4
@@ -1421,7 +1456,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_REPRO} == "1" ] ;  then
     set_namelist_opt 2_namelist_cfg nn_hls ${USING_EXTRA_HALO} 3 2
     set_namelist_opt 2_namelist_cfg nn_comm ${USING_COLLECTIVES} 2 1
     set_namelist_opt 2_namelist_cfg ln_tile ${USING_TILING} .true. .false.
-    set_namelist 3_namelist_cfg cn_exp \"AGRIF_44\"
+    set_namelist 3_namelist_cfg cn_exp \"AGRIF_DEMO_44\"
     set_namelist 3_namelist_cfg nn_it000 1
     set_namelist 3_namelist_cfg nn_itend $(( ${ITEND} * 4 * 3 ))
     set_namelist 3_namelist_cfg jpni 4
@@ -1432,14 +1467,14 @@ if [ ${config} == "AGRIF" ] && [ ${DO_REPRO} == "1" ] ;  then
     set_namelist_opt 3_namelist_cfg ln_tile ${USING_TILING} .true. .false.
 
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_AGRIF.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
+    . ./prepare_job.sh input_AGRIF_DEMO.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
     cd ${SETTE_DIR}
     . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 
 fi
 
-if [ ${config} == "AGRIF" ] && [ ${DO_CORRUPT} == "1" ] ;  then
-## test code corruption with AGRIF (phase 1) ==> Compile with key_agrif but run with no zoom
+## test code corruption with AGRIF_DEMO (phase 1) ==> Compile with key_agrif but run with no zoom
+if [ ${DO_CORRUPT} == "1" ] ;  then
     if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]
     then
 	ITEND=16   # 1d
@@ -1473,15 +1508,14 @@ if [ ${config} == "AGRIF" ] && [ ${DO_CORRUPT} == "1" ] ;  then
 
     set_xio_using_server iodef.xml ${USING_MPMD}
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_AGRIF.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
+    . ./prepare_job.sh input_AGRIF_DEMO.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
     cd ${SETTE_DIR}
     . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 
 fi
 
-
-## test code corruption with AGRIF (phase 2) ==> Compile without key_agrif (to be compared with AGRIF_DEMO_ST/ORCA2)
-if [ ${config} == "AGRIF" ] && [ ${DO_CORRUPT} == "1" ] ;  then
+## test code corruption with AGRIF_DEMO (phase 2) ==> Compile without key_agrif (to be compared with AGRIF_DEMO_ST/ORCA2)
+if [ ${DO_CORRUPT} == "1" ] ;  then
     SETTE_CONFIG="AGRIF_DEMO_NOAGRIF"${SETTE_STG}
     export TEST_NAME="ORCA2"
     cd ${MAIN_DIR}
@@ -1490,7 +1524,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_CORRUPT} == "1" ] ;  then
     clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     sync_config  ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     #
-    . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AGRIF_DEMO ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "key_agrif ${DEL_KEYS}"
+    ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AGRIF_DEMO ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "key_agrif ${DEL_KEYS}"
     cd ${SETTE_DIR}
     . ./prepare_exe_dir.sh
     set_valid_dir
@@ -1513,12 +1547,15 @@ if [ ${config} == "AGRIF" ] && [ ${DO_CORRUPT} == "1" ] ;  then
 #
     set_xio_using_server iodef.xml ${USING_MPMD}
     cd ${SETTE_DIR}
-    . ./prepare_job.sh input_AGRIF.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
+    . ./prepare_job.sh input_AGRIF_DEMO.cfg $NPROC ${TEST_NAME} ${MPIRUN_FLAG} ${JOB_FILE} ${NUM_XIOSERVERS} ${NEMO_VALID}
     cd ${SETTE_DIR}
     . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 
 fi
 
+fi
+
+
 # -------
 # WED025
 # -------
@@ -1531,6 +1568,8 @@ if [ ${config} == "WED025" ] ;  then
 	ITEND=720  # 10 days
     fi
     ITRST=$( printf "%08d" $(( ${ITEND} / 2 )) )
+
+if [ ${DO_COMPILE} -eq 1 ] ;  then
     cd ${MAIN_DIR}
     #
     # syncronisation if target directory/file exist (not done by makenemo)
@@ -1538,10 +1577,11 @@ if [ ${config} == "WED025" ] ;  then
     sync_config  ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     #
     # WED025 uses ln_hpg_isf so remove key_qco if added by default
-    . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r WED025 ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}"
+    ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r WED025 ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}"
 fi
-if [ ${config} == "WED025" ] && [ ${DO_RESTART} == "1" ] ;  then
+
 ## Restartability tests
+if [ ${DO_RESTART} == "1" ] ;  then
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
     . ./prepare_exe_dir.sh
@@ -1603,8 +1643,8 @@ if [ ${config} == "WED025" ] && [ ${DO_RESTART} == "1" ] ;  then
 
 fi
 
-if [ ${config} == "WED025" ] && [ ${DO_REPRO} == "1" ] ;  then
 ## Reproducibility tests
+if [ ${DO_REPRO} == "1" ] ;  then
     export TEST_NAME="REPRO_6_7"
     cd ${MAIN_DIR}
     cd ${SETTE_DIR}
@@ -1659,6 +1699,8 @@ if [ ${config} == "WED025" ] && [ ${DO_REPRO} == "1" ] ;  then
     . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 fi
 
+fi
+
 
 done
 #
diff --git a/sette/sette_rpt.sh b/sette/sette_rpt.sh
index 4baa2e9c70a0b267e7f1d249df32c3dd3a2ef46a..a86b30cc8716d6899cff9fbb3a965f1410b6cc2d 100755
--- a/sette/sette_rpt.sh
+++ b/sette/sette_rpt.sh
@@ -7,7 +7,10 @@
 #
 #########################################################################################
 ######################### Start of function definitions #################################
-##
+#set -x
+
+# exit codes
+declare -i {REPRO_EC,RESTA_EC,REFCMP_EC,CPUCMP_EC,OCEOUT_EC,AGRIF_EC}=0
 
 function get_dorv() {
   if [ $lastchange == 'old' ] ; then 
@@ -44,6 +47,8 @@ function resttest() {
 # check if directory is here
   if [ ! -d $vdir/$mach/$dorv/$nam ]; then
     printf "%-27s %s %s\n" $nam  " directory                  MISSING : " $dorv
+    echo " please check $vdir/$mach/$dorv/$nam"
+    RESTA_EC=1
     return
   fi
 
@@ -60,12 +65,14 @@ function resttest() {
     f2t=$vdir/$mach/$dorv/$nam/SHORT/tracer.stat
 
     if  [ ! -f $f1s ] &&  [ ! -f $f1t ] ; then 
-      printf "%-27s %s\n" $nam " incomplete test";
-      return; 
+      printf "%-27s %s\n" $nam " incomplete test"
+      RESTA_EC=1
+      return
     fi
     if  [ ! -f $f2s ] &&  [ ! -f $f2t ] ; then 
-      printf "%-27s %s\n" $nam " incomplete test";
-      return; 
+      printf "%-27s %s\n" $nam " incomplete test"
+      RESTA_EC=1
+      return
     fi
 #
     done_oce=0
@@ -81,6 +88,7 @@ function resttest() {
       else
         get_ktdiff f1.tmp$$ $f2s
         printf "\e[38;5;196m%-27s %s %s %s %-5s %s\e[0m\n" $nam  " run.stat    restartability  FAILED : " $dorv " (results are different after " $ktdiff " time steps)"
+        RESTA_EC=1
 #
 # Offer view of differences on the second pass
 #
@@ -111,6 +119,7 @@ function resttest() {
       else
         get_ktdiff2 f1.tmp$$ $f2t
         printf "\e[38;5;196m%-27s %s %s %s %-5s %s\e[0m\n" $nam  " tracer.stat    restartability  FAILED : " $dorv " (results are different after " $ktdiff " time steps)"
+        RESTA_EC=1
 #
 # Offer view of differences on the second pass
 #
@@ -150,6 +159,8 @@ function reprotest(){
 # check if directory is here
   if [ ! -d $vdir/$mach/$dorv/$nam ]; then
     printf "%-27s %s %s\n" $nam  " directory                  MISSING : " $dorv
+    echo " please check $vdir/$mach/$dorv/$nam"
+    REPRO_EC=R1
     return
   fi
 #
@@ -171,12 +182,14 @@ function reprotest(){
     f2t=$vdir/$mach/$dorv/$nam/$rep2/tracer.stat
 
     if  [ ! -f $f1s ] && [ ! -f $f1t ] ; then 
-      printf "%-27s %s\n" $nam " incomplete test";
-      return; 
+      printf "%-27s %s\n" $nam " incomplete test"
+      REPRO_EC=1
+      return
     fi
     if  [ ! -f $f2s ] && [ ! -f $f2t ] ; then 
-      printf "%-27s %s\n" $nam " incomplete test";
-      return; 
+      printf "%-27s %s\n" $nam " incomplete test"
+      REPRO_EC=1
+      return
     fi
 #
     done_oce=0
@@ -190,6 +203,7 @@ function reprotest(){
       else
         get_ktdiff $f1s $f2s
         printf "\e[38;5;196m%-27s %s %s %s %-5s %s\e[0m\n" $nam  " run.stat    reproducibility FAILED : " $dorv " (results are different after " $ktdiff " time steps)"
+        REPRO_EC=1
 #
 # Offer view of differences on the second pass
 #
@@ -217,6 +231,7 @@ function reprotest(){
       else
         get_ktdiff2 $f1t $f2t
         printf "\e[38;5;196m%-27s %s %s %s %-5s %s\e[0m\n" $nam  " tracer.stat reproducibility FAILED : " $dorv " (results are different after " $ktdiff " time steps)"
+        REPRO_EC=1
 #
 # Offer view of differences on the second pass
 #
@@ -257,10 +272,14 @@ function runcmpres(){
 # check if reference directory is present
   if [ ! -d $vdirref/$mach/$dorvref/$nam ]; then
     printf "%-27s %s\n" $nam " REFERENCE directory at $dorvref is MISSING"
+    echo " please check $vdirref/$mach/$dorvref/$nam"
+    REFCMP_EC=1
     return
   fi
   if [ ! -d $vdir/$mach/$dorv/$nam ]; then
     printf "%-27s %s\n" $nam " VALID     directory at $dorv is MISSING"
+    echo " please check $vdir/$mach/$dorv/$nam"
+    REFCMP_EC=1
     return
   fi
 
@@ -273,12 +292,14 @@ function runcmpres(){
     f2s=$vdirref/$mach/$dorvref/${nam}/${TESTD}/run.stat
     f2t=$vdirref/$mach/$dorvref/${nam}/${TESTD}/tracer.stat
     if  [ ! -f $f1s ] && [ ! -f $f1t ] ; then
-      printf "%-20s %s\n" $nam " incomplete test";
-      return;
+      printf "%-20s %s\n" $nam " incomplete test"
+      REFCMP_EC=1
+      return
     fi
     if  [ ! -f $f2s ] && [ ! -f $f2t ] ; then
-      printf "%-20s %s\n" $nam " incomplete test";
-      return;
+      printf "%-20s %s\n" $nam " incomplete test"
+      REFCMP_EC=1
+      return
     fi
 #
     done_oce=0
@@ -292,6 +313,7 @@ function runcmpres(){
       else
         get_ktdiff $f1s $f2s
         printf "%-20s %s %s %-5s (%s)\n" $nam  " run.stat    files are DIFFERENT (results are different after " $ktdiff " time steps) " ${TESTD}
+        REFCMP_EC=1
 #
 # Offer view of differences on the second pass
 #
@@ -316,6 +338,7 @@ function runcmpres(){
       else
         get_ktdiff2 $f1t $f2t
         printf "%-20s %s %s %-5s (%s)\n" $nam  " tracer.stat files are DIFFERENT (results are different after " $ktdiff " time steps) " ${TESTD}
+        REFCMP_EC=1
 #
 # Offer view of differences on the second pass
 #
@@ -344,9 +367,11 @@ function runcmptim(){
 #
 # check if reference directory is present
   if [ ! -d $vdirref/$mach/$dorvref/$nam ]; then
+    CPUCMP_EC=1
     return
   fi
   if [ ! -d $vdir/$mach/$dorv/$nam ]; then
+    CPUCMP_EC=1
     return
   fi
 
@@ -400,7 +425,8 @@ function runtest(){
        f1o=$vdir/$mach/$dorv/$nam/$tdir/ocean.output
        if  [ ! -f $f1o ] ; then
           if [ $pass == 0 ]; then printf "%-27s %s %s\n" $nam " ocean.output               MISSING : " $dorv ; fi
-          return;
+          OCEOUT_EC=1
+          return
        else 
           nerr=`grep 'E R R O R' $f1o | wc -l`
           if [[ $nerr > 0 ]]; then
@@ -412,12 +438,15 @@ function runtest(){
                 echo ''
                 echo "full ocean.output available here: $f1o"
              fi
-             return;
+             OCEOUT_EC=1
+             return
           fi
        fi
     done
   else
-    if [ $pass == 0 ]; then printf "%-27s %s %s\n" $nam  " directory                  MISSING : " $dorv ; fi
+     if [ $pass == 0 ]; then printf "%-27s %s %s\n" $nam  " directory                  MISSING : " $dorv ; fi
+     OCEOUT_EC=1
+     return
   fi
 }
 
@@ -446,6 +475,7 @@ function identictest(){
       else
           get_ktdiff $f1s $f2s
           printf "\e[38;5;196m%-5s %s %-5s %s %s %s %s %-5s %s\e[0m\n" $rep "AGRIF vs" $rep "NOAGRIF run.stat    changed  -     FAILED : " $dorv $dorv2 " (results are different after " $ktdiff " time steps)"
+          AGRIF_EC=1
 #
 # Offer view of differences on the second pass
 #
@@ -474,16 +504,14 @@ function identictest(){
   SETTE_DIR=$(cd $(dirname "$0"); pwd)
   MAIN_DIR=$(dirname $SETTE_DIR)
   . ./param.cfg
-  TEST_CONFIGS_AVAILABLE=${TEST_CONFIGS_AVAILABLE[@]:-${TEST_CONFIGS[@]}}    # Workaround for some dated param.cfgs files
-  TEST_CONFIGS_AVAILABLE=${TEST_CONFIGS_AVAILABLE[@]/SAS /ORCA2_SAS_ICE }    # Workaround for some dated param.cfgs files
-  TEST_CONFIGS_AVAILABLE=${TEST_CONFIGS_AVAILABLE[@]/AGRIF /AGRIF_DEMO }     # Workaround for some dated param.cfgs files
+  TEST_CONFIGS_AVAILABLE=${TEST_CONFIGS_AVAILABLE[@]:-${TEST_CONFIGS[@]}}     # Workaround for some dated param.cfgs files
   if [ -z $USER_INPUT ] ; then USER_INPUT='yes' ; fi        # Default: yes => request user input on decisions.
                                                             # (but may br inherited/imported from sette.sh)
-
   mach=${COMPILER}
 # overwrite revision (later) or compiler
   if [ $# -gt 0 ]; then
-    while getopts r:R:c:v:V:ubh option; do
+    echo ""
+    while getopts n:r:R:c:v:V:ubh option; do
        case $option in
           c) mach=$OPTARG;;
           r) rev=$OPTARG;;
@@ -491,14 +519,20 @@ function identictest(){
           v) SETTE_SUB_VAL=$OPTARG;;
           V) SETTE_SUB_VAL2=$OPTARG
              if [ -d ${NEMO_VALIDATION_DIR}/${SETTE_SUB_VAL2} ] ; then
-               export NEMO_VALIDATION_REF=${NEMO_VALIDATION_DIR}/${SETTE_SUB_VAL2}
+               NEMO_VALIDATION_REF=${NEMO_VALIDATION_DIR}/${SETTE_SUB_VAL2}
              else
                echo "Requested comparison subdirectory: ${NEMO_VALIDATION_DIR}/${SETTE_SUB_VAL2} does not exist"
              fi
              ;;
           u) USER_INPUT='no';;
           b) mach=${mach//_DEBUG}_DEBUG
-             DEBUG="with DEBUG (-b) option";;
+             DEBUG="with DEBUG (-b) option"
+             echo "-b: will use DEBUG compilation directory"
+             echo "";;
+          n) OPTSTR="$OPTARG"
+             TEST_CONFIGS=(${OPTSTR})
+             echo "-n: Configuration(s) ${TEST_CONFIGS[@]} will be tested if they are available"
+             echo "";;
           h | *) echo ''
                  echo 'sette_rpt.sh : ' 
                  echo '     display result for the latest change'
@@ -524,86 +558,58 @@ function identictest(){
 # if $1 (remaining arguments)
   if [[ ! -z $1 ]] ; then rev=$1 ; fi
 
-  # Check that git branch is usable
-  git branch --show-current >&/dev/null
-  if [[ $? == 0 ]] ; then
-    # subdirectory below NEMO_VALIDATION_DIR defaults to branchname
-    NAM_MAIN="$(git branch --show-current)"
-  else
-    # subdirectory below NEMO_VALIDATION_DIR defaults to "MAIN"
-    NAM_MAIN="MAIN"
-  fi
-  if [ ! -z $SETTE_SUB_VAL ] ; then
-   export NEMO_VALIDATION_DIR=$NEMO_VALIDATION_DIR/$SETTE_SUB_VAL
+# https://stackoverflow.com/questions/6059336/how-to-find-the-current-git-branch-in-detached-head-state
+branchname=$(git log -1 --pretty=%D HEAD | sed 's|.*origin/||g;s|, .*||g;s|.*-> ||g' )
+if [ ! -z $SETTE_SUB_VAL ] ; then
+   NEMO_VALIDATION_DIR=$NEMO_VALIDATION_DIR/$SETTE_SUB_VAL
    if [ -d $NEMO_VALIDATION_REF/$SETTE_SUB_VAL ] && [ -z $SETTE_SUB_VAL2 ] && [ ${USER_INPUT} == "yes" ] ; then
-    while true; do
-        read -p "$NEMO_VALIDATION_REF/$SETTE_SUB_VAL exists. Do you wish to use it as a reference? " yn
-        case $yn in
-            [Yy]* ) export NEMO_VALIDATION_REF=$NEMO_VALIDATION_REF/$SETTE_SUB_VAL; break;;
-            [Nn]* ) echo "Ok, continuing with ${NEMO_VALIDATION_REF}/${NAM_MAIN} as the reference directory"
-                    export NEMO_VALIDATION_REF=${NEMO_VALIDATION_REF}/${NAM_MAIN}
-                    break
-                    ;;
-            * ) echo "Please answer yes or no.";;
-        esac
-    done
-   elif [ -d $NEMO_VALIDATION_REF/$SETTE_SUB_VAL ] && [ -z $SETTE_SUB_VAL2 ] ; then
-    # No user input: make a best guess as to intent
-    export NEMO_VALIDATION_REF=$NEMO_VALIDATION_REF/$SETTE_SUB_VAL
-   elif [ -z $SETTE_SUB_VAL2 ] ; then
-    # No user input: default to branchname or MAIN
-    export NEMO_VALIDATION_REF=$NEMO_VALIDATION_REF/${NAM_MAIN}
-   fi
-  else
-   export NEMO_VALIDATION_DIR=${NEMO_VALIDATION_DIR}/${NAM_MAIN}
+      while true; do
+      read -p "$NEMO_VALIDATION_REF/$SETTE_SUB_VAL exists. Do you wish to use it as a reference? " yn
+      case $yn in
+          [Yy]* ) NEMO_VALIDATION_REF=$NEMO_VALIDATION_REF/$SETTE_SUB_VAL; break;;
+          [Nn]* ) echo "Ok, continuing with ${NEMO_VALIDATION_REF}/${branchname} as the reference directory"
+                  NEMO_VALIDATION_REF=${NEMO_VALIDATION_REF}/${branchname}
+                  break
+                  ;;
+          * ) echo "Please answer yes or no.";;
+      esac
+  done
+ # No user input: make a best guess as to intent
+ elif [ -d $NEMO_VALIDATION_REF/$SETTE_SUB_VAL ] && [ -z $SETTE_SUB_VAL2 ] ; then
+    NEMO_VALIDATION_REF=$NEMO_VALIDATION_REF/$SETTE_SUB_VAL
+ # No user input: default to branchname or MAIN
+ elif [ -z $SETTE_SUB_VAL2 ] ; then
+    NEMO_VALIDATION_REF=$NEMO_VALIDATION_REF/${branchname}
+ fi
+else
+   NEMO_VALIDATION_DIR=${NEMO_VALIDATION_DIR}/${branchname}
    if [ -z $SETTE_SUB_VAL2 ] ; then
-    export NEMO_VALIDATION_REF=$NEMO_VALIDATION_REF/${NAM_MAIN}
+      NEMO_VALIDATION_REF=$NEMO_VALIDATION_REF/${branchname}
    fi
-  fi
-  NEMO_VALID=${NEMO_VALIDATION_DIR}
-  NEMO_VALID_REF=${NEMO_VALIDATION_REF}
-  if [ ! -z $refrev ] ; then
-    NEMO_REV_REF=${refrev}
-  fi
-#
-  if [ ! -d $NEMO_VALID ]; then
-    echo "$NEMO_VALID validation directory not found"
-    exit
-  fi
+fi
+NEMO_VALID=${NEMO_VALIDATION_DIR}
+NEMO_VALID_REF=${NEMO_VALIDATION_REF}
+if [ ! -z $refrev ] ; then
+   NEMO_REV_REF=${refrev}
+fi
+
+if [ ! -d $NEMO_VALID ]; then
+  echo "$NEMO_VALID validation directory not found"
+  exit
+fi
 #
 #
 # Show current revision tag and branch name
 #
 echo ""
-localchanges=`git status --short -uno | wc -l`
-# Check that git branch is usable and use it to detect detached HEADs
-git branch --show-current >& /dev/null
-if [[ $? == 0 ]] ; then
-  branchname="$(git branch --show-current)"
-  revision=`git rev-parse --short HEAD`
-  if [ -z $branchname ] ; then
-   # Probabably on a detached HEAD (possibly testing an old commit).
-   # Verify this and try to recover original commit
-   MORE_INFO="$(git branch -a | head -1l | sed -e's/.*(//' -e 's/)//' )"
-   if [[ "${MORE_INFO}" == *"detached"* ]] ; then
-     # There is no robust way to recover a branch name in a detached state
-     # so just use the commit with a prefix
-     branchname="detached_"${revision}
-   else
-     branchname="Unknown"
-   fi
-  fi
-else
-  branchname="Unknown"
-fi
+nemo_revision=$(git -C ${MAIN_DIR} rev-parse --short HEAD 2> /dev/null)
 rev_date0=`git log -1 | grep Date | sed -e 's/.*Date: *//' -e's/ +.*$//'`
 rev_date=`${DATE_CONV}"${rev_date0}" +"%y%j"`
-revision=${rev_date}_${revision}
+revision=${rev_date}_${nemo_revision}
+localchanges=`git status --short -uno | wc -l`
 if [[ $localchanges > 0 ]] ; then
- echo "Current code is : $branchname @ $revision  ( with local changes )"
  lastchange=${revision}+
 else
- echo "Current code is : $branchname @ $revision"
  lastchange=$revision
 fi
 
@@ -614,9 +620,9 @@ echo ""
 echo "SETTE validation report generated for : "
 echo ""
 if [[ $localchanges > 0 ]] ; then
- echo "       $branchname @ $revision (with local changes)"
+ echo "       $branchname @ $nemo_revision (with local changes)"
 else
- echo "       $branchname @ $revision"
+ echo "       $branchname @ $nemo_revision"
 fi
 echo ""
 echo "       on $COMPILER arch file $DEBUG"
@@ -641,7 +647,7 @@ do
 # Restartability test
  echo ""
  echo "   !----restart----!   "
- for restart_test in ${TEST_CONFIGS_AVAILABLE[@]}
+ for restart_test in ${TEST_CONFIGS[@]/ORCA2_ICE_OBS}
  do
    [ "${restart_test}" != "ORCA2_ICE_OBS" ] && resttest $NEMO_VALID $restart_test $pass
  done
@@ -649,17 +655,21 @@ do
 # Reproducibility tests
  echo ""
  echo "   !----repro----!   "
- for repro_test in ${TEST_CONFIGS_AVAILABLE[@]}
+ for repro_test in ${TEST_CONFIGS[@]}
  do
-   [ "${repro_test}" != "OVERFLOW" -a "${repro_test}" != "LOCK_EXCHANGE" ] && reprotest $NEMO_VALID $repro_test $pass
+   if [[ ${repro_test} != *"OVERFLOW"* && ${repro_test} != *"LOCK_EXCHANGE"* ]]; then
+      reprotest $NEMO_VALID $repro_test $pass
+   fi
  done
 
 # AGRIF special check to ensure results are unchanged with and without key_agrif
- echo ""
- echo "   !----agrif check----!   "
- dir1=AGRIF_DEMO_NOAGRIF
- dir2=AGRIF_DEMO
- identictest $NEMO_VALID $dir1 $dir2 $pass 
+ if [[ ${TEST_CONFIGS[@]} =~ "AGRIF" ]]; then
+   echo ""
+   echo "   !----agrif check----!   "
+   dir1=AGRIF_DEMO_NOAGRIF
+   dir2=AGRIF_DEMO
+   identictest $NEMO_VALID $dir1 $dir2 $pass 
+ fi
 #
 # before/after tests
  if [ $lastchange == 'old' ] ; then
@@ -669,30 +679,31 @@ do
  else
    echo ""
    echo "   !----result comparison check----!   "
-   if [ $NEMO_VALID_REF != "/path/to/reference/sette/results" ]; then
+   if [ $NEMO_VALID_REF != "/path/to/reference/sette/results" ] && [ $NEMO_REV_REF != "0000" ]; then
      echo ''
      echo 'check result differences between :'
      echo "VALID directory : $NEMO_VALID at rev $lastchange"
      echo 'and'
      echo "REFERENCE directory : $NEMO_VALID_REF at rev $NEMO_REV_REF"
      echo ''
-     for runcmp_test in ${TEST_CONFIGS_AVAILABLE[@]}
+     for runcmp_test in ${TEST_CONFIGS[@]}
      do
        runcmpres $NEMO_VALID $runcmp_test $NEMO_VALID_REF $NEMO_REV_REF $pass
      done
      echo ''
      echo 'Report timing differences between REFERENCE and VALID (if available) :'
-     for repro_test in ${TEST_CONFIGS_AVAILABLE[@]}
+     for repro_test in ${TEST_CONFIGS[@]}
      do
        runcmptim $NEMO_VALID $repro_test $NEMO_VALID_REF $NEMO_REV_REF $pass
      done
    else
      echo ''
-     echo ' No path for comparison specified. Result are not compare with any other revision. '
+     echo ' No path or revision for comparison specified. Result are not compare with any other revision. '
      echo ' To do it please fill NEMO_VALID_REF and NEMO_REV_REF in param.cfg. '
      echo ''
    fi
  fi
 done
 #
-exit
+echo "SETTE Report Exit Code: "$((REPRO_EC+RESTA_EC+REFCMP_EC+CPUCMP_EC+OCEOUT_EC+AGRIF_EC))
+exit $((REPRO_EC+RESTA_EC+REFCMP_EC+CPUCMP_EC+OCEOUT_EC+AGRIF_EC))
diff --git a/sette/sette_test-cases.sh b/sette/sette_test-cases.sh
index e1649645f1953dc6b90485712a2d9d3deb7cf7ff..9dc8968258c6de6dfa4a6fd60a8f9bebda1012ef 100755
--- a/sette/sette_test-cases.sh
+++ b/sette/sette_test-cases.sh
@@ -112,7 +112,7 @@ CONFIG_DIR0=${MAIN_DIR}/tests
 TOOLS_DIR=${MAIN_DIR}/tools
 
 if [ -n "${CUSTOM_DIR}" ]; then
-  NEMO_REV=$( git rev-parse --short HEAD 2> /dev/null )
+  #NEMO_REV=$( git rev-parse --short HEAD 2> /dev/null )
   CMP_NAM_L=$(echo ${CMP_NAM} | tr '[:upper:]' '[:lower:]')
   if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]; then
     export CMP_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}_DEBUG
@@ -143,7 +143,7 @@ do
 # ---------
 #  OVERFLOW
 # ---------
-if [ ${config} == "OVERFLOW" ] ;  then
+if [ ${config} == "OVERFLOW" ];  then
     SETTE_CONFIG="OVERFLOW"${SETTE_STG}
     if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]
     then
@@ -152,16 +152,19 @@ if [ ${config} == "OVERFLOW" ] ;  then
 	ITEND=120
     fi
     ITRST=$( printf "%08d" $(( ${ITEND} / 2 )) )
+
+if [ ${DO_COMPILE} == "1" ] ;  then
     cd ${MAIN_DIR}
     #
-    #
+    # syncronisation if target directory/file exist (not done by makenemo)
     clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     sync_config  ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     #
-    . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a OVERFLOW ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}"
+    ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a OVERFLOW ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}"
 fi
-if [ ${config} == "OVERFLOW" ] && [ ${DO_RESTART} == "1" ] ;  then
-    ## Restartability tests for OVERFLOW
+
+## Restartability tests for OVERFLOW
+if [ ${DO_RESTART} == "1" ] ;  then
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
     . ./prepare_exe_dir.sh
@@ -210,12 +213,11 @@ if [ ${config} == "OVERFLOW" ] && [ ${DO_RESTART} == "1" ] ;  then
     cd ${SETTE_DIR}
     . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 
-
 fi
 
-if [ ${config} == "OVERFLOW" ] && [ ${DO_PHYOPTS} == "1" ] ;  then
-    ## Test for all advection, vert. coordinates, vector form, flux form: test runability and complete all time steps
-    ## Needed namelist-xxxx for every type of run tested
+## Test for all advection, vert. coordinates, vector form, flux form: test runability and complete all time steps
+## Needed namelist-xxxx for every type of run tested
+if [ ${DO_PHYOPTS} == "1" ] ;  then
     if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]
     then
 	ITEND=12
@@ -255,6 +257,9 @@ if [ ${config} == "OVERFLOW" ] && [ ${DO_PHYOPTS} == "1" ] ;  then
      done
 fi
 
+fi
+
+
 # --------------
 #  LOCK_EXCHANGE
 # --------------
@@ -267,17 +272,19 @@ if [ ${config} == "LOCK_EXCHANGE" ] ;  then
 	ITEND=120
     fi
     ITRST=$( printf "%08d" $(( ${ITEND} / 2 )) )
+
+if [ ${DO_COMPILE} == "1" ] ;  then
     cd ${MAIN_DIR}
     #
     # syncronisation if target directory/file exist (not done by makenemo)
-    #
     clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     sync_config  ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     #
-    . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a LOCK_EXCHANGE ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}"
+    ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a LOCK_EXCHANGE ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}"
 fi
-if [ ${config} == "LOCK_EXCHANGE" ] && [ ${DO_RESTART} == "1" ] ;  then
-    ## Restartability tests for LOCK_EXCHANGE
+
+## Restartability tests for LOCK_EXCHANGE
+if [ ${DO_RESTART} == "1" ] ;  then
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
     . ./prepare_exe_dir.sh
@@ -328,9 +335,9 @@ if [ ${config} == "LOCK_EXCHANGE" ] && [ ${DO_RESTART} == "1" ] ;  then
 
 fi
 
-if [ ${config} == "LOCK_EXCHANGE" ] && [ ${DO_PHYOPTS} == "1" ] ;  then
-    ## Test for all advection, vector form, flux form: test runability and complete all time steps
-    ## Needed namelist-xxxx for every type of run tested
+## Test for all advection, vector form, flux form: test runability and complete all time steps
+## Needed namelist-xxxx for every type of run tested
+if [ ${DO_PHYOPTS} == "1" ] ;  then
     if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]
     then
 	ITEND=12
@@ -373,6 +380,9 @@ if [ ${config} == "LOCK_EXCHANGE" ] && [ ${DO_PHYOPTS} == "1" ] ;  then
    done
 fi
 
+fi
+
+
 # ---------
 # VORTEX
 # ---------
@@ -386,17 +396,19 @@ if [ ${config} == "VORTEX" ] ;  then
     fi
     ITRST=$(   printf "%08d" $(( ${ITEND} / 2 )) )
     ITRST_1=$( printf "%08d" $(( ${ITEND} * 3 / 2 )) )
+
+if [ ${DO_COMPILE} == "1" ] ;  then
     cd ${MAIN_DIR}
     #
     # syncronisation if target directory/file exist (not done by makenemo)
-    #
     clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     sync_config  ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     #
-    . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a VORTEX ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES}  add_key "${ADD_KEYS}" del_key "${DEL_KEYS}"
+    ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a VORTEX ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES}  add_key "${ADD_KEYS}" del_key "${DEL_KEYS}"
 fi
-if [ ${config} == "VORTEX" ] && [ ${DO_RESTART} == "1" ] ;  then
+
 ## Restartability tests for VORTEX
+if [ ${DO_RESTART} == "1" ] ;  then
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
     . ./prepare_exe_dir.sh
@@ -478,9 +490,8 @@ if [ ${config} == "VORTEX" ] && [ ${DO_RESTART} == "1" ] ;  then
     . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 fi
 
-if [ ${config} == "VORTEX" ] && [ ${DO_REPRO} == "1" ] ;  then
-
 ## Reproducibility tests for VORTEX
+if [ ${DO_REPRO} == "1" ] ;  then
     export TEST_NAME="REPRO_2_3"
     cd ${MAIN_DIR}
     cd ${SETTE_DIR}
@@ -565,6 +576,8 @@ if [ ${config} == "VORTEX" ] && [ ${DO_REPRO} == "1" ] ;  then
 
 fi
 
+fi
+
 
 # ---------
 # ICE_AGRIF
@@ -579,18 +592,20 @@ if [ ${config} == "ICE_AGRIF" ] ;  then
     fi
     ITRST=$(   printf "%08d" $(( ${ITEND} / 2 )) )
     ITRST_1=$( printf "%08d" $(( ${ITEND} * 3 / 2 )) )
+
+if [ ${DO_COMPILE} == "1" ] ;  then
     cd ${MAIN_DIR}
     #
     # syncronisation if target directory/file exist (not done by makenemo)
-    #
     clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     sync_config  ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     #
     # ICE_AGRIF uses linssh so remove key_qco if added by default
-    . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a ICE_AGRIF ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES}  add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}"
+    ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a ICE_AGRIF ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES}  add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}"
 fi
-if [ ${config} == "ICE_AGRIF" ] && [ ${DO_RESTART} == "1" ] ;  then
+
 ## Restartability tests for ICE_AGRIF
+if [ ${DO_RESTART} == "1" ] ;  then
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
     . ./prepare_exe_dir.sh
@@ -681,9 +696,8 @@ if [ ${config} == "ICE_AGRIF" ] && [ ${DO_RESTART} == "1" ] ;  then
 
 fi
 
-if [ ${config} == "ICE_AGRIF" ] && [ ${DO_REPRO} == "1" ] ;  then
-
 ## Reproducibility tests for ICE_AGRIF
+if [ ${DO_REPRO} == "1" ] ;  then
     export TEST_NAME="REPRO_2_3"
     cd ${MAIN_DIR}
     cd ${SETTE_DIR}
@@ -764,10 +778,13 @@ if [ ${config} == "ICE_AGRIF" ] && [ ${DO_REPRO} == "1" ] ;  then
 
 fi
 
+fi
+
+
 # ------
 # ISOMIP+
 # ------
-if [ ${config} == "ISOMIP+" ] ;  then
+if [ ${config} == "ISOMIP+" ]; then 
     SETTE_CONFIG="ISOMIP+"${SETTE_STG}
     if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]
     then
@@ -776,18 +793,20 @@ if [ ${config} == "ISOMIP+" ] ;  then
 	ITEND=1200
     fi
     ITRST=$( printf "%08d" $(( ${ITEND} / 2 )) )
+
+if [ ${DO_COMPILE} == "1" ] ;  then
     cd ${MAIN_DIR}
     #
     # syncronisation if target directory/file exist (not done by makenemo)
-    #
     clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     sync_config  ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     #
     # ISOMIP+ uses ln_hpg_isf so remove key_qco if added by default
-    . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a ISOMIP+ ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}"
+    ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a ISOMIP+ ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}"
 fi
-if [ ${config} == "ISOMIP+" ] && [ ${DO_RESTART} == "1" ] ;  then
+
 ## Restartability tests
+if [ ${DO_RESTART} == "1" ] ;  then
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
     . ./prepare_exe_dir.sh
@@ -846,8 +865,8 @@ if [ ${config} == "ISOMIP+" ] && [ ${DO_RESTART} == "1" ] ;  then
 
 fi
 
-if [ ${config} == "ISOMIP+" ] && [ ${DO_REPRO} == "1" ] ;  then
 ## Reproducibility tests
+if [ ${DO_REPRO} == "1" ] ;  then
     if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]
     then
 	ITEND=12
@@ -907,11 +926,13 @@ if [ ${config} == "ISOMIP+" ] && [ ${DO_REPRO} == "1" ] ;  then
 
 fi
 
+fi
+
 
 # ---------
 # SWG
 # ---------
-if [ ${config} == "SWG" ] && [ ${USING_QCO} == "yes" ] ;  then
+if [ ${config} == "SWG" ] ;  then
     SETTE_CONFIG="SWG"${SETTE_STG}
     if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]
     then
@@ -920,17 +941,19 @@ if [ ${config} == "SWG" ] && [ ${USING_QCO} == "yes" ] ;  then
 	ITEND=1728
     fi
     ITRST=$(   printf "%08d" $(( ${ITEND} / 2 )) )
+
+if [ ${USING_QCO} == "yes" ] && [ ${DO_COMPILE} == "1" ] ;  then
     cd ${MAIN_DIR}
     #
     # syncronisation if target directory/file exist (not done by makenemo)
-    #
     clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     sync_config  ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}
     #
-    . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a SWG ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES}  add_key "${ADD_KEYS}" del_key "${DEL_KEYS}"
+    ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a SWG ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES}  add_key "${ADD_KEYS}" del_key "${DEL_KEYS}"
 fi
-if [ ${config} == "SWG" ] && [ ${DO_RESTART} == "1" ] && [ ${USING_QCO} == "yes" ] ;  then
+
 ## Restartability tests for SWG
+if [ ${DO_RESTART} == "1" ] && [ ${USING_QCO} == "yes" ] ;  then
     export TEST_NAME="LONG"
     cd ${SETTE_DIR}
     . ./prepare_exe_dir.sh
@@ -989,9 +1012,8 @@ if [ ${config} == "SWG" ] && [ ${DO_RESTART} == "1" ] && [ ${USING_QCO} == "yes"
     . ./fcm_job.sh $NPROC ${JOB_FILE} ${INTERACT_FLAG} ${MPIRUN_FLAG}
 fi
 
-if [ ${config} == "SWG" ] && [ ${DO_REPRO} == "1" ] && [ ${USING_QCO} == "yes" ] ;  then
-
 ## Reproducibility tests for SWG
+if [ ${DO_REPRO} == "1" ] && [ ${USING_QCO} == "yes" ] ;  then
     export TEST_NAME="REPRO_2_3"
     cd ${MAIN_DIR}
     cd ${SETTE_DIR}
@@ -1053,6 +1075,7 @@ if [ ${config} == "SWG" ] && [ ${DO_REPRO} == "1" ] && [ ${USING_QCO} == "yes" ]
 
 fi
 
+fi
 
 
 #----
diff --git a/src/OCE/ISF/isfstp.F90 b/src/OCE/ISF/isfstp.F90
index 1c847f9b4c621da3473c68560fee060d26925032..180544331e974bda413c8ab8418107808426623c 100644
--- a/src/OCE/ISF/isfstp.F90
+++ b/src/OCE/ISF/isfstp.F90
@@ -151,11 +151,11 @@ CONTAINS
             &                     risfcpl_ssh, 'T', 1.0_wp, risfcpl_cons_ssh, 'T', 1.0_wp ) ! needed in dynspg_ts, stp2d
          CALL lbc_lnk( 'isf_stp', risfcpl_vol, 'T', 1.0_wp )                                ! needed in dynspg_ts, stp2d, sshwzv, dynatf
       ELSE
-         CALL lbc_lnk( 'isf_stp', fwfisf_par  , 'T', 1.0_wp, fwfisf_cav  , 'T', 1.0_wp, &
+         CALL lbc_lnk( 'isf_stp', fwfisf_par  , 'T', 1.0_wp, fwfisf_cav  , 'T', 1.0_wp  &
 #if ! defined key_RK3
-            &                     fwfisf_par_b, 'T', 1.0_wp, fwfisf_cav_b, 'T', 1.0_wp  &
-            &        )
-#endif         
+            &                   , fwfisf_par_b, 'T', 1.0_wp, fwfisf_cav_b, 'T', 1.0_wp  &
+#endif
+            &        )     
       ENDIF
       !
       !==================
diff --git a/src/OCE/SBC/sbcssr.F90 b/src/OCE/SBC/sbcssr.F90
index 2b607dbb95b6257935b108d45edcc1733e6b06b3..1cfc838b585424fc4cbea5bb39d66de1bb654d46 100644
--- a/src/OCE/SBC/sbcssr.F90
+++ b/src/OCE/SBC/sbcssr.F90
@@ -93,15 +93,14 @@ CONTAINS
          IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN      !    Add restoring term     !
             !                                      ! ========================= !
             !
-            qrp(:,:) = 0._wp ! necessary init
-            erp(:,:) = 0._wp
-            !
-            IF( nn_sstr == 1 ) THEN                                   !* Temperature restoring term
+            IF(     nn_sstr == 1 ) THEN                                   !* Temperature restoring term
                DO_2D( 0, 0, 0, 0 )
                   zqrp = rn_dqdt * ( sst_m(ji,jj) - sf_sst(1)%fnow(ji,jj,1) ) * smask0(ji,jj)
                   qns(ji,jj) = qns(ji,jj) + zqrp
                   qrp(ji,jj) = zqrp
                END_2D
+            ELSEIF( nn_sssr == 2 ) THEN
+               qrp(:,:) = 0._wp   ! necessary init, see bellow: qrp(ji,jj) = qrp(ji,jj) - ...
             ENDIF
             !
             IF( nn_sssr /= 0 .AND. nn_sssr_ice /= 1 ) THEN
@@ -233,8 +232,8 @@ CONTAINS
       !
       coefice(:,:) = 1._wp         !  Initialise coefice to 1._wp ; will not need to be changed if nn_sssr_ice=1
       !                            !* Initialize qrp and erp if no restoring 
-      IF( nn_sstr /= 1                   )   qrp(:,:) = 0._wp
-      IF( nn_sssr /= 1 .OR. nn_sssr /= 2 )   erp(:,:) = 0._wp
+      IF( nn_sstr /= 1 .AND. nn_sssr /= 2 )   qrp(:,:) = 0._wp
+      IF( nn_sssr /= 1 .AND. nn_sssr /= 2 )   erp(:,:) = 0._wp
       !
    END SUBROUTINE sbc_ssr_init
          
diff --git a/src/OCE/TRA/trazdf.F90 b/src/OCE/TRA/trazdf.F90
index bdcf5235431deecd0b2dd1cbeadf5c89f70e87a9..d5d8499568c9869a7df51ae76f1030081089bd9a 100644
--- a/src/OCE/TRA/trazdf.F90
+++ b/src/OCE/TRA/trazdf.F90
@@ -77,7 +77,7 @@ CONTAINS
       ENDIF
       !
       !                                      !* compute lateral mixing trend and add it to the general trend
-      CALL tra_zdf_imp( 'TRA', Kbb, Kmm, Krhs, pts, Kaa, jpts )
+      CALL tra_zdf_imp( 'TRA', rDt, Kbb, Kmm, Krhs, pts, Kaa, jpts )
 
 !!gm WHY here !   and I don't like that !
       ! DRAKKAR SSS control {
@@ -116,7 +116,7 @@ CONTAINS
    END SUBROUTINE tra_zdf
 
 
-   SUBROUTINE tra_zdf_imp( cdtype, Kbb, Kmm, Krhs, pt, Kaa, kjpt )
+   SUBROUTINE tra_zdf_imp( cdtype, p2dt, Kbb, Kmm, Krhs, pt, Kaa, kjpt )
       !!----------------------------------------------------------------------
       !!                  ***  ROUTINE tra_zdf_imp  ***
       !!
@@ -139,6 +139,7 @@ CONTAINS
       INTEGER                                  , INTENT(in   ) ::   Kbb, Kmm, Krhs, Kaa  ! ocean time level indices
       CHARACTER(len=3)                         , INTENT(in   ) ::   cdtype   ! =TRA or TRC (tracer indicator)
       INTEGER                                  , INTENT(in   ) ::   kjpt     ! number of tracers
+      REAL(wp)                                 , INTENT(in   ) ::   p2dt     ! tracer time-step
       REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt       ! tracers and RHS of tracer equation
       !
       INTEGER  ::  ji, jj, jk, jn   ! dummy loop indices
@@ -202,18 +203,18 @@ CONTAINS
                ! Diagonal, lower (i), upper (s)  (including the bottom boundary condition since avt is masked)
                IF( ln_zad_Aimp ) THEN         ! Adaptive implicit vertical advection
                   DO_2Dik( 0, 0,   1, jpkm1, 1 )
-                     zzwi = - rDt * zwt(ji,jk  ) / e3w(ji,jj,jk  ,Kmm)
-                     zzws = - rDt * zwt(ji,jk+1) / e3w(ji,jj,jk+1,Kmm)
+                     zzwi = - p2dt * zwt(ji,jk  ) / e3w(ji,jj,jk  ,Kmm)
+                     zzws = - p2dt * zwt(ji,jk+1) / e3w(ji,jj,jk+1,Kmm)
                      zwd(ji,jk) = e3t(ji,jj,jk,Kaa) - ( zzwi + zzws )   &
-                        &              + rDt * ( MAX( wi(ji,jj,jk  ) , 0._wp ) &
+                        &              + p2dt * ( MAX( wi(ji,jj,jk  ) , 0._wp ) &
                         &                      - MIN( wi(ji,jj,jk+1) , 0._wp ) )
-                     zwi(ji,jk) = zzwi + rDt *   MIN( wi(ji,jj,jk  ) , 0._wp )
-                     zws(ji,jk) = zzws - rDt *   MAX( wi(ji,jj,jk+1) , 0._wp )
+                     zwi(ji,jk) = zzwi + p2dt *   MIN( wi(ji,jj,jk  ) , 0._wp )
+                     zws(ji,jk) = zzws - p2dt *   MAX( wi(ji,jj,jk+1) , 0._wp )
                   END_2D
                ELSE
                   DO_2Dik( 0, 0,   1, jpkm1, 1 )
-                     zwi(ji,jk) = - rDt * zwt(ji,jk  ) / e3w(ji,jj,jk,Kmm)
-                     zws(ji,jk) = - rDt * zwt(ji,jk+1) / e3w(ji,jj,jk+1,Kmm)
+                     zwi(ji,jk) = - p2dt * zwt(ji,jk  ) / e3w(ji,jj,jk,Kmm)
+                     zws(ji,jk) = - p2dt * zwt(ji,jk+1) / e3w(ji,jj,jk+1,Kmm)
                      zwd(ji,jk) = e3t(ji,jj,jk,Kaa) - ( zwi(ji,jk) + zws(ji,jk) )
                   END_2D
                ENDIF
@@ -223,8 +224,8 @@ CONTAINS
                !
                IF( ln_zdfmfc ) THEN    ! add upward Mass Flux in the matrix
                   DO_2Dik( 0, 0,   1, jpkm1, 1 )
-                     zws(ji,jk) = zws(ji,jk) + e3t(ji,jj,jk,Kaa) * rDt * edmfm(ji,jj,jk+1) / e3w(ji,jj,jk+1,Kmm)
-                     zwd(ji,jk) = zwd(ji,jk) - e3t(ji,jj,jk,Kaa) * rDt * edmfm(ji,jj,jk  ) / e3w(ji,jj,jk+1,Kmm)
+                     zws(ji,jk) = zws(ji,jk) + e3t(ji,jj,jk,Kaa) * p2dt * edmfm(ji,jj,jk+1) / e3w(ji,jj,jk+1,Kmm)
+                     zwd(ji,jk) = zwd(ji,jk) - e3t(ji,jj,jk,Kaa) * p2dt * edmfm(ji,jj,jk  ) / e3w(ji,jj,jk+1,Kmm)
                   END_2D
                ENDIF
 !       DO_3D( 0, 0, 0, 0, 1, jpkm1 )
@@ -288,11 +289,11 @@ CONTAINS
             !
             DO_1Di( 0, 0 )             !* 2nd recurrence:    Zk = Yk - Ik / Tk-1  Zk-1
                pt(ji,jj,1,jn,Kaa) =       e3t(ji,jj,1,Kbb) * pt(ji,jj,1,jn,Kbb )    &
-                  &               + rDt * e3t(ji,jj,1,Kmm) * pt(ji,jj,1,jn,Krhs)
+                  &               + p2dt * e3t(ji,jj,1,Kmm) * pt(ji,jj,1,jn,Krhs)
             END_1D
             DO_2Dik( 0, 0,   2, jpkm1, 1 )
                zrhs =       e3t(ji,jj,jk,Kbb) * pt(ji,jj,jk,jn,Kbb )   &
-                  & + rDt * e3t(ji,jj,jk,Kmm) * pt(ji,jj,jk,jn,Krhs)   ! zrhs=right hand side
+                  & + p2dt * e3t(ji,jj,jk,Kmm) * pt(ji,jj,jk,jn,Krhs)   ! zrhs=right hand side
                pt(ji,jj,jk,jn,Kaa) = zrhs - zwi(ji,jk) / zwt(ji,jk-1) * pt(ji,jj,jk-1,jn,Kaa)
             END_2D
             !
diff --git a/src/OCE/ZDF/zdfgls.F90 b/src/OCE/ZDF/zdfgls.F90
index 4c2f666596c97eaec9c7f856d27604b06d2facdf..b0b4d7f128d4b19ddedd4bd85c81c5786b475ecc 100644
--- a/src/OCE/ZDF/zdfgls.F90
+++ b/src/OCE/ZDF/zdfgls.F90
@@ -836,8 +836,8 @@ CONTAINS
       DO_2D( 0, 0, 0, 0 )             ! update bottom with good values
          zstm(ji,jj,mbkt(ji,jj)+1) = zstm(ji,jj,mbkt(ji,jj))
       END_2D
-      zstt(:,:,  1) = wmask(A2D(0),  1)  ! default value not needed but avoid a bug when looking for undefined values (-fpe0)
-      zstt(:,:,jpk) = wmask(A2D(0),jpk)  ! default value not needed but avoid a bug when looking for undefined values (-fpe0)
+      zstt(:,:,  1) = wmask(T2D(0),  1)  ! default value not needed but avoid a bug when looking for undefined values (-fpe0)
+      zstt(:,:,jpk) = wmask(T2D(0),jpk)  ! default value not needed but avoid a bug when looking for undefined values (-fpe0)
 
 !!gm should be done for ISF (top boundary cond.)
 !!gm so, totally new staff needed!!gm
diff --git a/src/TOP/TRP/trczdf.F90 b/src/TOP/TRP/trczdf.F90
index b5a9dd4ccd34296c7f3ba759cc8830496b836d95..40a0fd6027b136507e21a9f0251a7eff771b055f 100644
--- a/src/TOP/TRP/trczdf.F90
+++ b/src/TOP/TRP/trczdf.F90
@@ -53,7 +53,7 @@ CONTAINS
       !
       IF( l_trdtrc )   ztrtrd(:,:,:,:)  = ptr(:,:,:,:,Krhs)
       !
-      CALL tra_zdf_imp( 'TRC', Kbb, Kmm, Krhs, ptr, Kaa, jptra )    !   implicit scheme          
+      CALL tra_zdf_imp( 'TRC', rDt_trc, Kbb, Kmm, Krhs, ptr, Kaa, jptra )    !   implicit scheme          
       !
       IF( l_trdtrc )   THEN                      ! save the vertical diffusive trends for further diagnostics
          DO jn = 1, jptra
diff --git a/tools/maketools b/tools/maketools
index cc4209713c40e2bf44ace8c025d74c2fe211bd0b..33ed7352846dd7556275ce74012de8250e6be58d 100755
--- a/tools/maketools
+++ b/tools/maketools
@@ -1,6 +1,6 @@
 #!/bin/bash
-#set -x
 set -o posix
+#set -x
 #set -u 
 #set -e
 #+
@@ -35,7 +35,7 @@ set -o posix
 #
 #  From user input
 #
-# - NEW_CONF    : configuration to be created
+# - CUR_CONF    : configuration to be created
 # - CMP_NAM     : compiler name 
 # - NBR_PRC     : number of processes used to compile  
 #
@@ -57,8 +57,6 @@ set -o posix
 # TODO
 # ====
 #
-# option debug
-#
 #
 # EVOLUTIONS
 # ==========
@@ -73,23 +71,24 @@ set -o posix
 
 #- Local variables ---
 b_n=$(basename ${0})
-export TOOLS_DIR=$(cd $(dirname "$0"); pwd)
-export MAIN_DIR=${TOOLS_DIR%/tools}
-export COMPIL_DIR=${MAIN_DIR}/mk
-export NEMO_DIR=${MAIN_DIR}/NEMO
+TOOLS_DIR=$(cd $(dirname "$0"); pwd)
+MAIN_DIR=${TOOLS_DIR%/tools}
+COMPIL_DIR=${MAIN_DIR}/mk
+NEMO_DIR=${MAIN_DIR}/NEMO
 #-
 #- FCM and functions location ---
-export PATH=${MAIN_DIR}/ext/FCM/bin:$PATH
+PATH=${MAIN_DIR}/ext/FCM/bin:$PATH
 
 #-
 #- Choice of the options ---
 x_h="";
 x_n="";
 x_m="";
+x_b="";
 x_t="";
 x_c="";
 x_j=1;
-while getopts :hm:n:r:j:t: V
+while getopts :hbm:n:r:j:t: V
   do
 	 case $V in
 		(h)  x_h=${OPTARG};
@@ -99,6 +98,7 @@ while getopts :hm:n:r:j:t: V
                           echo " -h institute : specific help for consortium members";
 			  echo " -n name : tool name, [-n help] to list existing tools";
 			  echo " -m arch : choose compiler, [-m help] to list exiting compilers";
+			  echo " -b      : compile with debug options";
 			  echo " -j No	 : number of processes used to compile (0=nocompilation)";
 			  echo " -t dir  : remporary directory for compilation"
 			  echo "";
@@ -113,6 +113,7 @@ while getopts :hm:n:r:j:t: V
 			  exit 0;;
 		(n)  x_n=${OPTARG};;
 		(m)  x_m=${OPTARG};;
+		(b)  x_b=1;;
 		(j)  x_j=${OPTARG};;
 		(t)  x_t=${OPTARG};;
 		(:)  echo ${b_n}" : -"${OPTARG}" option : missing value" 1>&2;
@@ -128,80 +129,72 @@ shift $(($OPTIND-1));
 [[ "${#@}" -ne 0 && "${@}" != clean ]] && echo "Invalid option "$@" " && exit
 [ "${#@}" -ne 0 ] && x_c="--$@"
 
-#-
-#- Go to NEMOGCM/tools directory ---
-cd ${TOOLS_DIR}
-
 #-
 #- Initialisation from input ---
-export NEW_CONF=${x_n}
+CUR_CONF=${x_n}
 NBR_PRC=${x_j}
 CMP_NAM=${x_m}
-NEMO_TDIR=${x_t:-$NEMO_TDIR}
-export NEMO_TDIR=${NEMO_TDIR:-$TOOLS_DIR}
+NEMO_TDIR=${x_t:-$TOOLS_DIR}
 
 #- Check if the tool or the compiler exist or list it
-[ "${NEW_CONF}" == help ] && printf "%s\n"  "Available tools :" `ls ${TOOLS_DIR}|grep -v COMPILE | grep -v maketools` && exit
-[ "${CMP_NAM}" ==  help ] && . ${COMPIL_DIR}/Flist_archfile.sh all && exit
+[ "${CUR_CONF}" == help ] && printf "%s\n"  "Available tools :" `ls ${TOOLS_DIR}|grep -v COMPILE | grep -v maketools` && exit
+[ "${CMP_NAM}" ==  help ] && ${COMPIL_DIR}/Flist_archfile.sh ${MAIN_DIR} && exit 0
 
 #- Choose a default tool if needed ---
 #- REBUILD or last one used ---
-. ${COMPIL_DIR}/Fcheck_config.sh ${TOOLS_DIR}/tools.txt ${NEW_CONF} || exit
+${COMPIL_DIR}/Fcheck_config.sh ${TOOLS_DIR}/tools.txt ${CUR_CONF} || exit
 
 #- Save new configuration ---
-echo "${NEW_CONF} "  > ${TOOLS_DIR}/tools.txt
+echo "${CUR_CONF} "  > ${TOOLS_DIR}/tools.txt
 
 #- Make the building directory
-. ${COMPIL_DIR}/Fmake_tools_bld.sh ${TOOLS_DIR} ${NEW_CONF} ${NEMO_TDIR} || exit
+${COMPIL_DIR}/Fmake_tools_bld.sh ${TOOLS_DIR} ${CUR_CONF} ${NEMO_TDIR} || exit
 
 #- At this stage cpp keys have been updated. we can check the arch file
 #- When used for the first time, choose a compiler ---
-. ${COMPIL_DIR}/Fcheck_archfile.sh ${TOOLS_DIR}/${NEW_CONF}/BLD/arch_tools.fcm ${TOOLS_DIR}/${NEW_CONF}/BLD/cpp_tools.fcm ${CMP_NAM} || exit
+${COMPIL_DIR}/Fcheck_archfile.sh ${TOOLS_DIR}/${CUR_CONF}/BLD/arch_tools.fcm ${TOOLS_DIR}/${CUR_CONF}/BLD/cpp_tools.fcm ${MAIN_DIR}/arch/arch-${CMP_NAM}.fcm ${x_b} || exit
 
 #- At this stage the configuration has beeen chosen
 #- We coose the default light file
-export USEBLD=bldxag_tools.cfg
+USEBLD=bldxag_tools.cfg
 
-#- We look after agrif
-grep key_agrif ${TOOLS_DIR}/${NEW_CONF}/BLD/cpp_tools.fcm && export AGRIFUSE=1 && export USEBLD=${USEBLD/xag/}
+#_ END OF CONFIGURATION PHASE
 
 
-. ${COMPIL_DIR}/Fprep_agrif.sh ${NEW_CONF} ${TOOLS_DIR} arch_tools.fcm|| exit 3
 
-#-
-#_ END OF CONFIGURATION PHASE
-#_
-
-#-
 #- Compile ---
 
 if [ "${NBR_PRC}" -gt 0 ]; then
-cd ${TOOLS_DIR}/${NEW_CONF} || cd -
 
 	## if AGRIF we do a first preprocessing
-	if [[ ${#x_c} -eq 0 && "$AGRIFUSE" -eq 1 ]]; then
-		fcm build --ignore-lock -j 1 ${COMPIL_DIR}/bld_preproagr_tools.cfg ||{ cd - ; exit 1 ;}
-		echo ''
+        grep key_agrif ${TOOLS_DIR}/${CUR_CONF}/BLD/cpp_tools.fcm && USEBLD=${USEBLD/xag/}
+	if [[ ${#x_c} -eq 0 && ! ${USEBLD} =~ "xag" ]]; then
+                ${COMPIL_DIR}/Fprep_agrif.sh ${MAIN_DIR} ${TOOLS_DIR}/${CUR_CONF} || exit 3
+
+                # compile & copy conv
+                sed -e "s~MAIN_DIR~${MAIN_DIR}~; s~NEMO_TDIR~${NEMO_TDIR}~; s~CUR_CONF~${CUR_CONF}~; s~COMPIL_DIR~${COMPIL_DIR}~" ${COMPIL_DIR}/conv.cfg > ${NEMO_TDIR}/${CUR_CONF}/BLD/conv.cfg
+                fcm build ${NEMO_TDIR}/${CUR_CONF}/BLD/conv.cfg || exit 1
+                cp -fa ${MAIN_DIR}/ext/AGRIF/agrif_oce.in $2/$1/AGRIFLIB/bin/conv ${NEMO_TDIR}/${CUR_CONF}/NEMOFILES/.
+
+                sed -e "s~MAIN_DIR~${MAIN_DIR}~; s~TOOLS_DIR~${TOOLS_DIR}~; s~CUR_CONF~${CUR_CONF}~; s~COMPIL_DIR~${COMPIL_DIR}~" ${COMPIL_DIR}/bld_preproagr_tools.cfg > ${NEMO_TDIR}/${CUR_CONF}/BLD/bld_preproagr_tools.cfg
+		fcm build --ignore-lock -j 1 ${NEMO_TDIR}/${CUR_CONF}/BLD/bld_preproagr_tools.cfg || exit 1
+		echo
 		echo "---------------------------------"
 		echo "CONV preprocessing successfull !!"
 		echo "---------------------------------"
-		echo ''
+		echo
 	fi
 
-   fcm build ${x_c} --ignore-lock -v 1 -j ${NBR_PRC} ${COMPIL_DIR}/${USEBLD} || cd -
-   if [ -n "$(ls ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/*.exe)" ]; then
-      for i in `ls ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/*.exe`
+   sed -e "s~MAIN_DIR~${MAIN_DIR}~; s~TOOLS_DIR~${TOOLS_DIR}~; s~CUR_CONF~${CUR_CONF}~; s~COMPIL_DIR~${COMPIL_DIR}~" ${COMPIL_DIR}/${USEBLD} > ${NEMO_TDIR}/${CUR_CONF}/BLD/${USEBLD}
+   fcm build ${x_c} --ignore-lock -v 1 -j ${NBR_PRC} ${NEMO_TDIR}/${CUR_CONF}/BLD/${USEBLD}
+
+   if ls ${NEMO_TDIR}/${CUR_CONF}/BLD/bin/*.exe 2>/dev/null && [ -z "${x_c}" ]; then
+      for i in ${NEMO_TDIR}/${CUR_CONF}/BLD/bin/*.exe
       do
-         ln -sf ${i}  ${TOOLS_DIR}/${NEW_CONF}/.
+         ln -sfv ${i} ${TOOLS_DIR}/${CUR_CONF}/.
       done
    fi
 fi
-#-
-#- Come back to original directory ---
-cd -
 
-#-
-#- Unset variables
-${COMPIL_DIR}/Fclean_var.sh
 
-exit 0;
+exit 0