Index: branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-ALTIX_NAUTILUS_MPT
===================================================================
--- branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-ALTIX_NAUTILUS_MPT	(revision 2890)
+++ branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-ALTIX_NAUTILUS_MPT	(revision 2890)
@@ -0,0 +1,87 @@
+#!/bin/bash 
+#!
+#PBS -N NEMO
+#PBS -l select=NODES:ncpus=8:mpiprocs=4
+#PBS -l place=scatter:excl
+#PBS -l walltime=00:59:00
+#PBS -q nemo
+#PBS -W group_list=nemo
+#PBS -j oe
+
+###############################################################
+#
+# set up mpp computing environment
+#
+#
+# Local settings. These settings are for a particular machine (the ALTIX ICE system at NOCS)
+# at a particular stage of that machine's evolution. This template file is provided for
+# illustration purposes only and will not work on any other machine. There should, however,
+# be sufficient similarity with other MPP platforms and batch systems for this example to provide
+# a useful guide for experienced users
+#
+  module load mpt/2.03
+  export MPT_HOME=/opt/sgi/mpt/mpt-2.03
+  export NC4_HOME=/sata/working/jeff/packages/netcdf4/netcdf-4.1.1/altix/intel10.1
+  export HD5_HOME=/sata/working/jeff/packages/hdf5/hdf5-1.8.4-patch1/altix/intel10.1
+  export IFT_HOME=/sw/Intel/fce/10.1.021
+  export SVN_HOME=/fibre/acc/UTILS/svn/v1.5/svn
+#
+#
+# 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
+# (half-populated on the NOCS ALTIX system) is also set by the fcm_job.sh on the PBS select
+# header line above.
+#
+  OCEANCORES=NPROCS
+  export SETTE_DIR=DEF_SETTE_DIR
+#
+# These variables are needed by post_test_tidyup function in all_functions.sh
+#
+  export INPUT_DIR=DEF_INPUT_DIR
+  export OUTPUT_DIR=DEF_OUTPUT_DIR
+  export CONFIG_DIR=DEF_CONFIG_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
+#
+# end of set up
+###############################################################
+#
+# change to the working directory 
+#
+  cd $PBS_O_WORKDIR
+#
+# load sette functions (only post_test_tidyup needed)
+#
+  . ${SETTE_DIR}/all_functions.sh
+#
+  echo Running on host `hostname`
+  echo Time is `date`
+  echo Directory is `pwd`
+  echo PBS job ID is $PBS_JOBID
+  echo This jobs runs on the following machines:
+  echo `cat $PBS_NODEFILE | uniq`
+# 
+# Create a machine file for MPI
+  cat $PBS_NODEFILE | uniq > host.file.$PBS_JOBID
+#
+  echo export LD_LIBRARY_PATH=${MPT_HOME}/lib:${IFT_HOME}/lib:${NC4_HOME}/lib:${HD5_HOME}/lib:${SVN_HOME}/lib
+  export LD_LIBRARY_PATH=${MPT_HOME}/lib:${IFT_HOME}/lib:${NC4_HOME}/lib:${HD5_HOME}/lib:${SVN_HOME}/lib
+# 
+  echo export PATH=${MPT_HOME}/bin:${SVN_HOME}/bin:$PATH
+  export PATH=${MPT_HOME}/bin:${SVN_HOME}/bin:$PATH
+#
+  export PSM_SHAREDPORTS=1
+  echo export MPI_PPN=4
+  echo export MPI_PPN_CLIST="2-3-6-7-0-1-4-5"
+  echo export OMP_NUM_THREADS=1 
+#
+#  Run the parallel MPI executable 
+#
+  echo "Running time ${MPT_HOME}/bin/mpiexec_mpt -np " $OCEANCORES " ./opa"
+#
+  time ${MPT_HOME}/bin/mpiexec_mpt -np $OCEANCORES ./opa
+#
+  post_test_tidyup
+  exit
Index: branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-PW6_VARGAS
===================================================================
--- branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-PW6_VARGAS	(revision 2890)
+++ branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-PW6_VARGAS	(revision 2890)
@@ -0,0 +1,63 @@
+#!/bin/bash 
+#!
+# @ job_name = MPI_config
+# standard output file  
+# @ output = $(job_name).$(jobid)
+# standard error file
+# @ error =  $(job_name).$(jobid)
+# job type
+# @ job_type = parallel
+# Number of procs 
+# @ total_tasks = NPROCS
+# time
+# @ wall_clock_limit = 0:30:00
+# @ queue
+
+###############################################################
+#
+# set up mpp computing environment
+#
+# Local settings for machine IBM Power6 (VARGAS at IDRIS France)
+#
+export MPIRUN="mpiexec -n"
+#
+# 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). 
+#
+  OCEANCORES=NPROCS
+  export SETTE_DIR=DEF_SETTE_DIR
+#
+# These variables are needed by post_test_tidyup function in all_functions.sh
+#
+  export EXE_DIR=DEF_EXE_DIR
+  export INPUT_DIR=DEF_INPUT_DIR
+  export CONFIG_DIR=DEF_CONFIG_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
+#
+# end of set up
+###############################################################
+#
+# change to the working directory 
+#
+cd ${EXE_DIR}
+
+#
+# load sette functions (only post_test_tidyup needed)
+#
+  . ${SETTE_DIR}/all_functions.sh
+#
+  echo Running on host `hostname`
+  echo Time is `date`
+  echo Directory is `pwd`
+# 
+#  Run the parallel MPI executable 
+#
+  echo "Running time ${MPIRUN} " $OCEANCORES " ./opa"
+#
+  time ${MPIRUN} " $OCEANCORES" ./opa
+#
+  post_test_tidyup
+  exit
Index: branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-X64_TITANE
===================================================================
--- branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-X64_TITANE	(revision 2890)
+++ branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-X64_TITANE	(revision 2890)
@@ -0,0 +1,57 @@
+#!/bin/bash 
+#!
+#MSUB -r DEF_TEST_NAME          # Nom du job                
+#MSUB -n NPROCS                 # Reservation de 16 processus
+#MSUB -T 10                     # Limite de temps elapsed du job ici 10 min     
+#MSUB -q test 
+###############################################################
+#
+# set up mpp computing environment
+#
+# Local settings for machine BULL (TITANE at CCRT France)
+#
+export MPIRUN="mpirun -np"
+#
+# 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). 
+#
+  OCEANCORES=NPROCS
+  export SETTE_DIR=DEF_SETTE_DIR
+#
+# These variables are needed by post_test_tidyup function in all_functions.sh
+#
+  export EXE_DIR=DEF_EXE_DIR
+  export INPUT_DIR=DEF_INPUT_DIR
+  export CONFIG_DIR=DEF_CONFIG_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
+# modules to load
+module load netcdf
+#
+# end of set up
+###############################################################
+#
+# change to the working directory 
+#
+cd ${EXE_DIR}
+
+#
+# load sette functions (only post_test_tidyup needed)
+#
+  . ${SETTE_DIR}/all_functions.sh
+#
+  echo Running on host `hostname`
+  echo Time is `date`
+  echo Directory is `pwd`
+# 
+#  Run the parallel MPI executable 
+#
+  echo "Running time ${MPIRUN} " $OCEANCORES " ./opa"
+#
+  time ${MPIRUN} " $OCEANCORES" ./opa
+#
+  post_test_tidyup
+  exit
+
Index: branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/BATCH_TEMPLATE/sette_batch_template
===================================================================
--- branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/BATCH_TEMPLATE/sette_batch_template	(revision 2890)
+++ branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/BATCH_TEMPLATE/sette_batch_template	(revision 2890)
@@ -0,0 +1,63 @@
+#!/bin/bash 
+#!
+# @ job_name = MPI_config
+# standard output file  
+# @ output = $(job_name).$(jobid)
+# standard error file
+# @ error =  $(job_name).$(jobid)
+# job type
+# @ job_type = parallel
+# Number of procs 
+# @ total_tasks = NPROCS
+# time
+# @ wall_clock_limit = 0:30:00
+# @ queue
+
+###############################################################
+#
+# set up mpp computing environment
+#
+# Local settings for machine IBM Power6 (VARGAS at IDRIS France)
+#
+export MPIRUN="mpiexec -n"
+#
+# 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). 
+#
+  OCEANCORES=NPROCS
+  export SETTE_DIR=DEF_SETTE_DIR
+#
+# These variables are needed by post_test_tidyup function in all_functions.sh
+#
+  export EXE_DIR=DEF_EXE_DIR
+  export INPUT_DIR=DEF_INPUT_DIR
+  export CONFIG_DIR=DEF_CONFIG_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
+#
+# end of set up
+###############################################################
+#
+# change to the working directory 
+#
+cd ${EXE_DIR}
+
+#
+# load sette functions (only post_test_tidyup needed)
+#
+  . ${SETTE_DIR}/all_functions.sh
+#
+  echo Running on host `hostname`
+  echo Time is `date`
+  echo Directory is `pwd`
+# 
+#  Run the parallel MPI executable 
+#
+  echo "Running time ${MPIRUN} " $OCEANCORES " ./opa"
+#
+  time ${MPIRUN} " $OCEANCORES" ./opa
+#
+  post_test_tidyup
+  exit
Index: branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/README
===================================================================
--- branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/README	(revision 2889)
+++ branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/README	(revision 2890)
@@ -11,4 +11,9 @@
                COMPILER    : compiler among those available in NEMOGCM/ARCH, needed for makenemo (see below)
                              can also be pass as an argument, e.g. ./sette.sh ifort_osx
+	       BATCH_COMMAND : command for job submission in batch mode
+	       MPI_INTERACT : "yes" if you want to run in interactive mode for MPI run
+	       		      "no" if you want to run in batch mode for MPI run
+			      NOTE : every job using only 1 proc is run in interactive mode
+
                makenemo -m : machine (compilator); see ./makenemo -m help (in NEMOGCM/CONFIG directory)
                         -n : config name (in examples config_name_nproci_nprocj), see ./makenemo -n help
@@ -17,18 +22,22 @@
                         del_key : to del list of keys
                and for more details and options of makenemo see ./makenemo -h
+
 	       set_namelist : to set namelist values 
 			(example : to set 75 time steps for one test : namelist nn_itend 75)
 			(        : to change cn_icerst_in name : namelist_ice cn_icerst_in  \"test_00101231_restart_icemod\")
 			(  	 : to activate control print : namelist ln_ctl false )
-	       copy_original : to namelist of reference configuration in configuration directory in which tests are done
+	       prepare_exe_dir.sh creates execution directory for each test
+	       			  : NOTE for EACH JOB EXECUTION it is needed to set TEST_NAME variable
+				    TEST_NAME variable gives name to execution directory (created in prepare_exe_dir.sh)
+				    IT is mandatory to have different TEST_NAME for each job run if not existing files are re-written (for example namelist)
+
                fcm_job.sh needs input: input_CONFIG_NAME TOTAL_NUMBER_OF_PROCS_used TEST_NAME
 			(for example if you compile ORCA2_LIM with key_mpp_mpi 
 			and only run short test ===> ./fcm_job input_ORCA2_LIM.cfg 4 SHORT)
+
  in param.cfg :
-               EXE_DIR     	   : directory in which job s executed (by default CONFIG_DIR)
                FORCING_DIR 	   : directory in which will be found input.tar file (same name in input_CONFIG_NAME.cfg)
-               INPUT_DIR   	   : directory in which store input files
+               INPUT_DIR   	   : directory in which store input files (tar file)
                TMPDIR      	   : temporary directory NEEDED ONLY FOR IBM machines (put EXP00 directory)
-               OUTPUT_DIR  	   : directory in which store output files
 	       NEMO_VALIDATION_DIR : directory in which create NEMO_VALIDATION tree, and store restart, solver.stat and ocean.output files in
       			             tree NEMO_VALIDATION_DIR/WCONFIG_NAME/WCOMPILER_NAME/TEST_NAME/REVISION_NUMBER(or DATE)
@@ -36,8 +45,7 @@
                IMPORTANT : control that name of tar file in FORCING directory
                is the same of that in input_REF_CONFIG.cfg, if not change one.
-               change in "RUN OPA" part the command line (some examples are already written)
-	       TEST_NAME by convention is LONG: 10 days run or SHORT: 5 days run
-	       so NEMO_VALIDATION tree is coherent,
-	       but user can choise a TEST_NAME that represent his own test.
+
+               change in "RUN OPA" if [ ${MPI_INTERACT} == "yes" ] mpirun command line (some examples are already written)
+	       NOTE: if MPI_INTERACT="no" it is neede a batch_file (see below to create a new one)
 
 NOTE:
@@ -62,2 +70,7 @@
 1. add arch-compiler.fcm in NEMOGCM/ARCH directory
 2. makenemo -m new_compiler  (see makenemo -h for help)
+
+TO ADD NEW BATCH-FILE:
+1. see in SETTE/BATCH_TEMPLATE directory existing examples
+2. create you own batch file like: batch-${COMPILER}
+(note: sette.sh will copy it in job_batch_template if you run tests in MPI_INTERACT="no")
Index: branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/all_functions.sh
===================================================================
--- branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/all_functions.sh	(revision 2889)
+++ branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/all_functions.sh	(revision 2890)
@@ -31,5 +31,5 @@
 #
 #  $ ./set_namelist INPUT_NAMELIST VARIABLE VALUE 
-#  $ ./copy_original INPUT_NAMELIST 
+#  $ post_test_tidyup 
 #
 #
@@ -39,8 +39,4 @@
 # function superegrep
 #   input variable value
-#
-# function copy_original
-#   input namelist_name
-#   output namelist 
 #
 # function set_namelist
@@ -48,4 +44,20 @@
 #   output namelist
 #
+# function post_test_tidyup
+#   creates nemo_validation tree, and save output & debug files
+#   this function creates tree of validation in NEMO_VALIDATION_DIR as follows : 
+#
+# NEMO_VALIDATION_DIR/WCONFIG_NAME/WCOMPILER_NAME/REVISION_NUMBER(or DATE)/TEST_NAME
+# 
+# NEMO_VALIDATION_DIR           : is choosen in param.cfg
+#
+# WCONFIG_NAME                  : set by makenemo at the moment of compilation
+#
+# WCOMPILER_NAME                : set by makenemo at the moment of compilation
+#
+# 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 )
+#
 # EXAMPLES
 # ========
@@ -53,7 +65,7 @@
 # ::
 #
-#  $ ./copy_original namelist_pisces         
 #  $ ./set_namelist namelist          nn_itend        75
 #  $ ./set_namelist namelist_ice_lim2 cn_icerst_in  \"00101231_restart_ice\"
+#  $ post_test_tidyup 
 #
 #
@@ -71,36 +83,4 @@
 #   * creation
 #-
-#
-
-
-# function to copy original namelists in ORIGINAL_namelist directory in ${INPUT_DIR} directory
-# to allow re-run same tests in same directory and start with all correct values of namelist
-copy_original () {
-        `mkdir -p ${INPUT_DIR}/ORIGINAL_namelist`
-	if [ -d ${INPUT_DIR}/ORIGINAL_namelist ] ; then
-	        echo "created ${INPUT_DIR}/ORIGINAL_namelist directory in ${INPUT_DIR}"   >> ${SETTE_DIR}/output.sette
-	else
-	        echo "problems in creating ${INPUT_DIR}/ORIGINAL_namelist directory"   >> ${SETTE_DIR}/output.sette
-	        echo "EXIT,"
-	        exit 1
-	fi
-        `cp ${CONFIG_DIR}/${REF_CONF}/EXP00/$1 ${INPUT_DIR}/ORIGINAL_namelist/$1.ori`
-	if [ -n "$(ls ${INPUT_DIR}/ORIGINAL_namelist/$1.ori)" ] ; then
-		echo "copied namelist of reference configuration in ${INPUT_DIR}/ORIGINAL_namelist/$1.ori " >> ${SETTE_DIR}/output.sette
-	else
-		echo "problem in copying namelist of reference configuration in ${INPUT_DIR}/ORIGINAL_namelist/$1.ori " >> ${SETTE_DIR}/output.sette
-	        echo "EXIT,"
-	        exit 1
-	fi
-        `cp ${INPUT_DIR}/ORIGINAL_namelist/$1.ori ${INPUT_DIR}/$1`
-	if [ -n "$(ls ${INPUT_DIR}/$1)" ] ; then
-		echo "copied original namelist in ${INPUT_DIR} directory " >> ${SETTE_DIR}/output.sette
-	else
-	        echo "problem in copying  original namelist in ${INPUT_DIR} directory"  >> ${SETTE_DIR}/output.sette
-	        echo "EXIT,"
-	        exit 1
-	fi
-}
-
 # function to find namelists parameters
 supergrep () {
@@ -128,10 +108,10 @@
         echo "################" >> ${SETTE_DIR}/output.sette
       
-	VAR_NAME=$( supergrep $2 ${INPUT_DIR}/$1 )
+	VAR_NAME=$( supergrep $2 ${EXE_DIR}/$1 )
 	if [ ${#VAR_NAME} -eq 0 ] 
 	then
 		echo "doing \"set_namelist $@\". "
 		echo "variable: \"$2\" is empty"
-		echo "control that variable $2 is in \"${INPUT_DIR}/$1\" "
+		echo "control that variable $2 is in \"${EXE_DIR}/$1\" "
 		echo "exit"
 		echo "error in executing script : set_namelist $@" >> ${SETTE_DIR}/output.sette
@@ -139,8 +119,8 @@
 		exit 1
 	fi
-        sed -e "s/${VAR_NAME}.*/${VAR_NAME}/" ${INPUT_DIR}/$1 > ${INPUT_DIR}/$1.tmp
-        mv ${INPUT_DIR}/$1.tmp ${INPUT_DIR}/$1
-        sed -e "s/${VAR_NAME}/$2=$3/"  ${INPUT_DIR}/$1 > ${INPUT_DIR}/$1.tmp
-        mv ${INPUT_DIR}/$1.tmp ${INPUT_DIR}/$1
+        sed -e "s/${VAR_NAME}.*/${VAR_NAME}/" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp
+        mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1
+        sed -e "s/${VAR_NAME}/$2=$3/"  ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp
+        mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1
 
         echo "finished script : set_namelist $@" >> ${SETTE_DIR}/output.sette
@@ -148,2 +128,82 @@
         echo "                " >> ${SETTE_DIR}/output.sette
 }
+
+# function to tidy up after each test and populate the NEMO_VALIDATION store
+post_test_tidyup () {
+#
+# requires the following variables defined and exported from the calling script:
+#  SETTE_DIR
+#  INPUT_DIR
+#  EXE_DIR
+#  CONFIG_DIR
+#  NEMO_VALIDATION_DIR
+#  NEW_CONF
+#  CMP_NAM
+#  TEST_NAME
+echo "SETTE directory is : ${SETTE_DIR}"
+echo "INPUT directory is : ${INPUT_DIR}"
+echo "EXECUTION directory is : ${EXE_DIR}"
+echo "CONFIG directory is : ${CONFIG_DIR}"
+echo "VALIDATION directory is : ${NEMO_VALIDATION_DIR}"
+echo "NEW CONFIGURATION is : ${NEW_CONF}"
+echo "COMPILER is : ${CMP_NAM}"
+echo "TEST is : ${TEST_NAME}"
+################################################################
+# SMALL DEBUG
+    if [ ! -r ${EXE_DIR}/time.step ]
+        then
+        echo "file time.step does not exist"   >> ${SETTE_DIR}/output.sette
+        echo "some problems during execution of model"  >> ${SETTE_DIR}/output.sette 
+        exit 1
+    else
+        echo "file time.step exists"  >> ${SETTE_DIR}/output.sette
+        echo "ok model run"   >> ${SETTE_DIR}/output.sette
+    fi
+################################################################
+
+################################################################
+# Creation of NEMO_VALIDATION tree
+    export LANG=en_US 
+    cd ${CONFIG_DIR}
+    cd ../
+    REVISION_NB=`svn info | grep -i "Revision:" | sed -e "s/ //" | cut -d ":" -f 2`
+    if [ ${#REVISION_NB} -eq 0 ]
+    then
+    	echo "some problems with svn info command"
+    	echo "some problems with svn info 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
+    echo "value of revision number of NEMOGCM: ${REVISION_NB}"
+    fi
+    cd ${NEMO_VALIDATION_DIR}
+    `mkdir -p ${NEMO_VALIDATION_DIR}/W${NEW_CONF}/${CMP_NAM}/${REVISION_NB}/${TEST_NAME}`
+    NEMO_VALID=${NEMO_VALIDATION_DIR}/W${NEW_CONF}/${CMP_NAM}/${REVISION_NB}/${TEST_NAME}
+    if [ -d ${NEMO_VALID} ] ; then
+	echo "created ${NEMO_VALID} directory"   >> ${SETTE_DIR}/output.sette
+    else 
+	echo "problems in creating ${NEMO_VALID} directory"   >> ${SETTE_DIR}/output.sette
+	echo "EXIT,"
+	exit 1
+    fi
+    # Save output & debug files in NEMO_VALIDATION tree
+    echo "saving ocean & ice output, solver.stat files ...." >> ${SETTE_DIR}/output.sette
+    echo "            " >> ${SETTE_DIR}/output.sette
+    [ -f ${EXE_DIR}/*ocean.output ] && cp ${EXE_DIR}/*ocean.output ${NEMO_VALID}/.
+    [ -f ${EXE_DIR}/*solver.stat ] && cp ${EXE_DIR}/*solver.stat ${NEMO_VALID}/.
+    if [ -n "$(ls ${NEMO_VALID}/*solver*)" ] ; then
+	echo "moved solver.stat in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
+	echo "moved solver.stat in ${NEMO_VALID} directory"  
+    else
+	echo "problem in looking for solver.stat file in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
+	echo "solver.stat IS NOT in ${NEMO_VALID} directory" 
+    fi
+    if [ -n "$(ls ${NEMO_VALID}/*ocean.output*)" ] ; then
+	echo "moved ocean.output in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
+	echo "moved ocean.output in ${NEMO_VALID} directory" 
+    else
+	echo "problem in looking for ocean.output file in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
+	echo "ocean.output IS NOT in ${NEMO_VALID} directory" 
+    fi
+}
Index: branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/fcm_job.sh
===================================================================
--- branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/fcm_job.sh	(revision 2889)
+++ branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/fcm_job.sh	(revision 2890)
@@ -31,20 +31,14 @@
 # ===========
 #
-#
 # Simple job for SET TESTS for NEMO (SETTE)
-#
-# this job creates tree of validation in NEMO_VALIDATION_DIR as follows : 
-#
-# NEMO_VALIDATION_DIR/WCONFIG_NAME/WCOMPILER_NAME/TEST_NAME/REVISION_NUMBER(or DATE)
 # 
-# NEMO_VALIDATION_DIR		: is choosen in param.cfg
-#
-# WCONFIG_NAME			: set by makenemo at the moment of compilation
-#
-# WCOMPILER_NAME		: set by makenemo at the moment of compilation
-#
-# TEST_NAME			: convention is LONG=10 days run, SHORT=5 days run
-#
-# REVISION_NUMBER(or DATE)	: revision number by svn info, if problems with svn date is taken
+#   get input files (if needed) : tar file  
+#  (note this job needs to have an input_CONFIG.cfg in which can be found input tar file name)
+#
+#   runs job in interactive or batch mode : all jobs using 1 process are run interactive, and all MPP jobs are
+#
+#   run in batch (MPI_INTERACT="no") or interactive (MPI_INTERACT="yes") see sette.sh and BATCH_TEMPLATE directory
+#
+#   and call post_test_tidyup function (that moves in NEMO_VALIDATION_DIR solver.stat & ocean.output)
 #
 # EXAMPLES
@@ -55,5 +49,5 @@
 #  $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME
 #
-#  run a job of config GYRE with 1 processor test REPRODUCTINILITY
+#  run a job of config GYRE with 1 processor SHORT test ( 5 days )
 #  $ ./fcm_job.sh input_GYRE.cfg 1 SHORT
 #
@@ -81,5 +75,5 @@
 
 usage=" Usage : ./fcm_job.sh input_CONFIG_NAME.cfg  NUMBER_OF_PROCS TEST_NAME"
-usage=" example : ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 8 RUN"
+usage=" example : ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 8 SHORT"
 
 
@@ -97,4 +91,14 @@
 	fi
        
+#
+# set and export TEST_NAME. It will be used within the post_test_tidyup function
+#
+export TEST_NAME=$3
+
+# export EXE_DIR. This directory is used to execute model 
+#
+export EXE_DIR
+#
+#
 echo "date: `date`" >> ${SETTE_DIR}/output.sette
 echo "" >> ${SETTE_DIR}/output.sette
@@ -117,4 +121,5 @@
 	echo "            " >> ${SETTE_DIR}/output.sette
 	cp ${FORCING_DIR}/${tar_file} ${INPUT_DIR}/.
+	echo "file in ${INPUT_DIR}"
 	if [ ! -f ${INPUT_DIR}/${tar_file} ] ; then 
 		echo "PROBLEM during copy of tar file" >> ${SETTE_DIR}/output.sette
@@ -124,14 +129,16 @@
 		exit 1
 	else  
-		cd ${INPUT_DIR} ; tar xvof ${INPUT_DIR}/*.tar ; gunzip -f *gz
+		cd ${EXE_DIR} ; tar xvof ${INPUT_DIR}/*.tar ; gunzip -f *gz
 	fi
 fi 
 
-if [ -f ${INPUT_DIR}/namelist_ice_lim2 ] ; then 
+if [ ! -f ${EXE_DIR}/namelist_ice ] ; then 
+if [ -f ${EXE_DIR}/namelist_ice_lim2 ] ; then 
    echo "choosing for namelist ice " >> ${SETTE_DIR}/output.sette
    echo "            " >> ${SETTE_DIR}/output.sette
-   cp ${INPUT_DIR}/namelist_ice_lim2 ${INPUT_DIR}/namelist_ice
-elif  [ -f ${INPUT_DIR}/namelist_ice_lim3 ] ; then 
-   cp ${INPUT_DIR}/namelist_ice_lim3 ${INPUT_DIR}/namelist_ice
+   cp ${EXE_DIR}/namelist_ice_lim2 ${EXE_DIR}/namelist_ice
+elif  [ -f ${EXE_DIR}/namelist_ice_lim3 ] ; then 
+   cp ${EXE_DIR}/namelist_ice_lim3 ${EXE_DIR}/namelist_ice
+fi
 fi
 
@@ -141,5 +148,5 @@
    	echo "choosing for namelist for AGRIF" >> ${SETTE_DIR}/output.sette
    	echo "            " >> ${SETTE_DIR}/output.sette
-	cp ${INPUT_DIR}/1_namelist_ice_lim2 ${INPUT_DIR}/1_namelist_ice 
+	cp ${EXE_DIR}/1_namelist_ice_lim2 ${EXE_DIR}/1_namelist_ice 
 fi
 ################################################################
@@ -147,7 +154,7 @@
 ################################################################
 # RUN OPA
-cd ${INPUT_DIR}
+cd ${EXE_DIR}
 NB_PROC=$2
-if [ ! -r ${INPUT_DIR}/opa ]
+if [ ! -r ${EXE_DIR}/opa ]
     then
     echo "executable opa does not exist"
@@ -159,103 +166,59 @@
     echo "            " >> ${SETTE_DIR}/output.sette
     ./opa
+#
+# Tidy out output from this test and populate the NEMO_VALIDATION_DIR tree
+#
+    post_test_tidyup
 else
     echo "running opa in MPI" >> ${SETTE_DIR}/output.sette
     echo "            " >> ${SETTE_DIR}/output.sette
-# example for brodie (NEC SX8) machine
-#	mpirun -np ${NB_PROC} opa
-# example for dedale machine
-#	mpirun --mca btl self,tcp -np ${NB_PROC} opa
-# example for vargas (IBM Power6) machine
-    mpiexec -n ${NB_PROC} opa
-fi
-################################################################
-# SMALL DEBUG
-# echo "control that time.step exists
-if [ ! -r ${INPUT_DIR}/time.step ]
-    then
-    echo "file time.step does not exist"   >> ${SETTE_DIR}/output.sette
-    echo "some problems during execution of model"  >> ${SETTE_DIR}/output.sette 
-    exit 1
-else
-    echo "file time.step exists"  >> ${SETTE_DIR}/output.sette
-    echo "ok model run"   >> ${SETTE_DIR}/output.sette
-fi
-################################################################
-
-################################################################
-# SAVE OUTPUT, DEBUG & RESTART FILES
-echo "saving ocean & ice output, debug & restart files" >> ${SETTE_DIR}/output.sette
-echo "            " >> ${SETTE_DIR}/output.sette
-[ ! -d ${OUTPUT_DIR} ] && mkdir ${OUTPUT_DIR}
-[ -f *ocean.output ] && mv *ocean.output ${OUTPUT_DIR}/.
-[ -f *solver.stat ] && mv *solver.stat ${OUTPUT_DIR}/.
-[ -n "$(ls *_grid_*)" ] && mv *_grid_*.nc ${OUTPUT_DIR}/.
-[ -n "$(ls *_ptrc_*)" ] && mv *_ptrc_*.nc ${OUTPUT_DIR}/.
-[ -n "$(ls *_diad_*)" ] && mv *_diad_*.nc ${OUTPUT_DIR}/.
-[ -n "`ls *restart*`" ] && cp *restart*.nc ${OUTPUT_DIR}/.
-[ -f ice_evolu ] && mv ice_evolu ${OUTPUT_DIR}/.
-[ -n "`ls *icemod*`" ] && mv *icemod* ${OUTPUT_DIR}/.
-#- Save ftrace file
-[ -f ftrace.out* ] && cp ftrace.out* ${OUTPUT_DIR}/.
-################################################################
-
-################################################################
-# SAVE IN NEMO_VALIDATION tree
-export LANG=en_US 
-cd ${CONFIG_DIR}
-cd ../
-REVISION_NB=`svn info | grep -i "Revision:" | sed -e "s/ //" | cut -d ":" -f 2`
-if [ ${#REVISION_NB} -eq 0 ]
-then
-	echo "some problems with svn info command"
-	echo "some problems with svn info 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
-echo "value of revision number of NEMOGCM: ${REVISION_NB}"
-fi
-cd ${NEMO_VALIDATION_DIR}
-export TEST_NAME=$3
-`mkdir -p ${NEMO_VALIDATION_DIR}/W${NEW_CONF}/${CMP_NAM}/${REVISION_NB}/${TEST_NAME}`
-NEMO_VALID=${NEMO_VALIDATION_DIR}/W${NEW_CONF}/${CMP_NAM}/${REVISION_NB}/${TEST_NAME}
-if [ -d ${NEMO_VALID} ] ; then
-	echo "created ${NEMO_VALID} directory"   >> ${SETTE_DIR}/output.sette
-else 
-	echo "problems in creating ${NEMO_VALID} directory"   >> ${SETTE_DIR}/output.sette
-	echo "EXIT,"
-	exit 1
-fi
-[ -f ${OUTPUT_DIR}/*ocean.output ] && mv ${OUTPUT_DIR}/*ocean.output ${NEMO_VALID}/.
-[ -f ${OUTPUT_DIR}/*solver.stat ] && mv ${OUTPUT_DIR}/*solver.stat ${NEMO_VALID}/.
-[ -n "`ls ${OUTPUT_DIR}/*restart*`" ] && mv ${OUTPUT_DIR}/*restart* ${NEMO_VALID}/.
-[ -f ${OUTPUT_DIR}/ice_evolu ] && mv ${OUTPUT_DIR}/ice_evolu ${NEMO_VALID}/.
-if [ -n "$(ls ${NEMO_VALID}/*solver*)" ] ; then
-	echo "moved solver.stat in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
-	echo "moved solver.stat in ${NEMO_VALID} directory"  
-else
-	echo "problem in looking for solver.stat file in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
-	echo "solver.stat IS NOT in ${NEMO_VALID} directory" 
-fi
-if [ -n "$(ls ${NEMO_VALID}/*ocean.output*)" ] ; then
-	echo "moved ocean.output in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
-	echo "moved ocean.output in ${NEMO_VALID} directory" 
-else
-	echo "problem in looking for ocean.output file in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
-	echo "ocean.output IS NOT in ${NEMO_VALID} directory" 
-fi
-if [ -n "`ls ${NEMO_VALID}/*restart*`" ] ; then
-	echo "moved restart files in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
-	echo "moved restart files in ${NEMO_VALID} directory" 
-else
-	echo "problem in looking for restart files in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
-	echo "restart files ARE NOT in ${NEMO_VALID} directory" 
-fi
-if [ -n "$(ls ${NEMO_VALID}/ice_evolu)" ] ; then
-        echo "moved ice_evolu in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
-        echo "moved ice_evolu in ${NEMO_VALID} directory"
-else
-        echo "problem looking for ice_evolu file in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
-        echo "ice_evolu IS NOT in ${NEMO_VALID} directory"
-fi
-################################################################
+
+    if [ ${MPI_INTERACT} == "yes" ] ; then
+	#
+	# example for brodie (NEC SX8) machine
+	#	mpirun -np ${NB_PROC} opa
+	# example for dedale machine
+	#	mpirun --mca btl self,tcp -np ${NB_PROC} opa
+	# example for vargas (IBM Power6) machine
+	mpiexec -n ${NB_PROC} opa
+	#
+	post_test_tidyup
+    fi
+#
+# example for NOCS Altix system using PBS batch submission (requires ${SETTE_DIR}/sette_batch_template file)
+#
+    if [ ${MPI_INTERACT} == "no" ] ; then
+		case ${COMPILER} in 
+			ALTIX_NAUTILUS_MPT)
+		        	if [ ${NB_REM} == 0 ] ; then
+					# number of processes required is an integer multiple of 4
+					#
+					NB_NODES=$( echo $NB_PROC | awk '{print $1 / 4}')
+				else
+					#
+					# number of processes required is not an integer multiple of 4
+					# round up the number of nodes required.
+					#
+					NB_NODES=$( echo $NB_PROC | awk '{printf("%d",$1 / 4 + 1 )}')
+	       			fi
+				;;
+			*)
+				NB_NODES=${NB_PROC}
+				;;
+
+		esac
+#
+# Pass settings into job file by using sed to edit predefined strings
+#
+        cat ${SETTE_DIR}/job_batch_template | sed -e"s/NODES/${NB_NODES}/" -e"s/NPROCS/${NB_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:${CONFIG_DIR}:" \
+             -e"s:DEF_NEMO_VALIDATION:${NEMO_VALIDATION_DIR}:" -e"s:DEF_NEW_CONF:${NEW_CONF}:" \
+             -e"s:DEF_CMP_NAM:${CMP_NAM}:" -e"s:DEF_TEST_NAME:${TEST_NAME}:" > run_sette_test.job
+#
+# submit job to batch system 
+	${BATCH_COMMAND} run_sette_test.job 
+    fi
+
+fi
Index: branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/input_ORCA2_LIM_AGRIF.cfg
===================================================================
--- branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/input_ORCA2_LIM_AGRIF.cfg	(revision 2890)
+++ branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/input_ORCA2_LIM_AGRIF.cfg	(revision 2890)
@@ -0,0 +1,1 @@
+ORCA2_LIM_AGRIF_nemo_v3.3.tar
Index: branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/param.cfg
===================================================================
--- branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/param.cfg	(revision 2889)
+++ branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/param.cfg	(revision 2890)
@@ -1,12 +1,8 @@
-#- execution directory 
-EXE_DIR=${CONFIG_DIR}     
 #- forcing files storing 
-FORCING_DIR=~/FORCING
+FORCING_DIR=/workgpfs/rech/eee/reee605/FORCING
 #- input files storing 
 INPUT_DIR=${CONFIG_DIR}/${NEW_CONF}/EXP00
 #- only for IBM
-# TMPDIR=${CONFIG_DIR}/${NEW_CONF}/EXP00
-#- output files storing 
-OUTPUT_DIR=${CONFIG_DIR}/${NEW_CONF}/EXP00/OUTPUT
+TMPDIR=${CONFIG_DIR}/${NEW_CONF}/EXP00
 #- VALIDATION files storing 
 NEMO_VALIDATION_DIR=~/NEMO_VALIDATION
Index: branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/prepare_exe_dir.sh
===================================================================
--- branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/prepare_exe_dir.sh	(revision 2890)
+++ branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/prepare_exe_dir.sh	(revision 2890)
@@ -0,0 +1,73 @@
+#!/bin/bash
+##########################################################################
+# Author : Simona Flavoni for NEMO
+# Contact : sflod@locean-ipsl.upmc.fr
+#
+# ----------------------------------------------------------------------
+# NEMO/SETTE , NEMO Consortium (2010)
+# Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+# ----------------------------------------------------------------------
+#
+# Some scripts called by sette.sh
+# prepare_exe_dir.sh : script prepares execution directory for test
+##########################################################################
+#set -x
+set -o posix
+#set -u
+#set -e
+#+
+#
+# ==================
+# prepare_exe_dir.sh
+# ==================
+#
+# ----------------------------------------------
+# Set of functions used by sette.sh (NEMO tests) 
+# ----------------------------------------------
+#
+# SYNOPSIS
+# ========
+#
+# ::
+#
+#  $ ./prepare_exe_dir.sh
+#
+# DESCRIPTION
+# ===========
+#
+# prepare_exe_dir.sh creates execution directory takes name of TEST_NAME defined in every test in sette.sh
+# 
+# it is necessary to define in sette.sh TEST_NAME ( example : export TEST_NAME="LONG") to create execution directory in where run test.
+#
+# NOTE : each test has to run in its own directory ( of execution), if not existing files are re-written (for example namelist)
+#
+# EXAMPLES
+# ========
+#
+# ::
+#
+#  $ ./prepare_exe_dir.sh
+#
+#
+# TODO
+# ====
+#
+# option debug
+#
+#
+# EVOLUTIONS
+# ==========
+#
+# $Id: $
+#
+#   * creation
+#-
+
+
+cd ${CONFIG_DIR}
+mkdir -p ${NEW_CONF}/${TEST_NAME}
+
+export EXE_DIR=${CONFIG_DIR}/${NEW_CONF}/${TEST_NAME}
+
+cp -r ${CONFIG_DIR}/${NEW_CONF}/EXP00/* ${EXE_DIR}/.
+cd ${EXE_DIR}
Index: branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/sette.sh
===================================================================
--- branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/sette.sh	(revision 2889)
+++ branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/sette.sh	(revision 2890)
@@ -35,49 +35,66 @@
 # ===========
 #
-# principal script is sette.sh, that calls 
+# Variables to be checked by user:
+#
+# COMPILER : name of compiler as defined in NEMOGCM/ARCH directory 
+#
+# BATCH_COMMAND :  name of the command for batch submission
+#
+# MPI_INTERACT :  
+#
+#         for MPP tests, "no" for batch execution, "yes" for interactive execution 
+#
+#         NOTE: for run with 1 process tests are run always in MPI_INTERACT="yes"
+#
+# Principal script is sette.sh, that calls 
 #
 #  makenemo 
 #
-#   creates the exectuable in ${CONFIG_NAME}/BLD/bin/nemo.exe 
-#
-#   (and its link opa in ${CONFIG_NAME}/EXP00)
-#
-#   param.cfg : sets and loads following directories
-#
-#   Executing directory (EXE_DIR)
-#
-
-#
-#   Input files storing (INPUT_DIR)
-#
-#   Temporary directory (if needed) (TMPDIR)
+#   creates the exectuable in ${CONFIG_NAME}/BLD/bin/nemo.exe  (and its link opa in ${CONFIG_NAME}/EXP00)
+#
+#  param.cfg : sets and loads following directories:
+#
+#   FORCING_DIR : is the directory for forcing files (tarfile)
+#
+#   INPUT_DIR : is the directory for input files storing 
+#
+#   TMPDIR : is the temporary directory (if needed)
 # 
-#   Validation directory (NEMO_VALIDATION_DIR)
-#
-#   (note: this file is the same for all configrations to be tested with sette)
+#   NEMO_VALIDATION_DIR : is the validation directory
+#
+#   (NOTE: this file is the same for all configrations to be tested with sette)
+#
 #
 #  all_functions.sh : loads functions used by sette (note: new functions can be added here)
 #
-#  set_namelist : function declared in all_functions that set namelist parameters for tests
+#   set_namelist : function declared in all_functions that set namelist parameters for tests
+#
+#   post_test_tidyup : creates validation storage directory and copy needed output files (solver.stat and ocean.output) in it after execution of test.
+#
+#   Tree of VALIDATION is:
+#
+#   NEMO_VALIDATION_DIR/WCONFIG_NAME/WCOMPILER_NAME/TEST_NAME/REVISION_NUMBER(or DATE)
+#
+#
+#  prepare_exe_dir.sh : defines and creates directory where the test is executed
+#
+#       execution directory takes name of TEST_NAME defined in every test in sette.sh
+#
+#       ( each test in executed in its own directory )
+#
 #
 #  fcm_job.sh 
 #
-#   runs job and saves output files (grid_files, restarts, ice_evolu, ftrace.out)
-#
-#   and it creates tree of VALIDATION, in which there are restart files, solver.stat and ocean.output
-#
-#   Tree of VALIDATION is:
-#
-#   NEMO_VALIDATION_DIR/WCONFIG_NAME/WCOMPILER_NAME/TEST_NAME/REVISION_NUMBER(or DATE)
+#   runs job in interactive or batch mode : all jobs using 1 process are run interactive, and all MPP jobs are
+#
+#   run in batch (MPI_INTERACT="no") or interactive (MPI_INTERACT="yes") see sette.sh and BATCH_TEMPLATE directory
+#
+#   (note this job needs to have an input_CONFIG.cfg in which can be found input tar file)
 # 
-#   (note this job needs to have an input_CONFIG.cfg in which can be found input tar file)
-#
-#   (note other files can be saved adding at the end of fcm_job list of saved files)
+#  NOTE: if job is not launched for some problems you have executable ready in ${EXE_DIR} directory
+#
+#  NOTE: the changed namelists are leaved in ${EXE_DIR} directory whereas original namelist remains in ${NEW_CONF}/EXP00
 # 
-#  NOTE: if job is not launched for some problems you have executable ready in ${CONFIG_NAME}/EXP00 directory
-#
-#  NOTE: the changed namelists are leaved in ${CONFIG_NAME}/EXP00 directory
-# 
-#  in ${SETTE_DIR} is created output.sette with the echo of commands run
+#  in ${SETTE_DIR} is created output.sette with the echo of executed commands
 #
 #  if sette.sh is stopped in output.sette there is written the last command executed by sette.sh
@@ -113,4 +130,6 @@
 # Compiler among those in NEMOGCM/ARCH
 COMPILER=PW6_VARGAS
+export BATCH_COMMAND=llsubmit
+export MPI_INTERACT="no"
 
 # Directory to run the tests
@@ -122,7 +141,7 @@
 
 CMP_NAM=${1:-$COMPILER}
-## NBTEST=8
-## echo "TOTAL NUMBER OF TEST" ${NBTEST}
-## for (( config=2; config<=${NBTEST}; config++ ))
+# Copy job_batch_COMPILER file for specific compiler into job_batch_template
+cd ${SETTE_DIR}
+cp BATCH_TEMPLATE/batch-${COMPILER} job_batch_template || exit
 
 for config in 1 2 3 4 5 6 7 8
@@ -131,4 +150,5 @@
 if [ ${config} -eq 1 ] ;  then
     # Restartability tests for GYRE_LOBSTER
+    export TEST_NAME="LONG"
     cd ${SETTE_DIR}
     . ../CONFIG/makenemo -m ${CMP_NAM} -n GYRELOB_LONG -r GYRE_LOBSTER del_key "key_diatrc"
@@ -136,6 +156,6 @@
     . param.cfg
     . all_functions.sh
-    copy_original namelist 
-    copy_original namelist_top
+    . prepare_exe_dir.sh
+    cd ${EXE_DIR}
     set_namelist namelist cn_exp \"GYRELOB_LONG\"
     set_namelist namelist nn_it000 1
@@ -145,9 +165,10 @@
     set_namelist namelist_top ln_trcrad .false.
     cd ${SETTE_DIR}
-    . ./fcm_job.sh input_GYRE.cfg 1 LONG
-    
-    cd ${SETTE_DIR}
-    copy_original namelist
-    copy_original namelist_top
+    . ./fcm_job.sh input_GYRE.cfg 1 ${TEST_NAME}
+
+    cd ${SETTE_DIR}
+    export TEST_NAME="SHORT"
+    . prepare_exe_dir.sh
+    cd ${EXE_DIR}
     set_namelist namelist cn_exp \"GYRELOB_SHORT\"
     set_namelist namelist nn_it000 61
@@ -157,23 +178,25 @@
     set_namelist namelist nn_rstctl 2
     set_namelist namelist ln_clobber .true.
+    cp ..\/LONG\/GYRELOB_LONG_00000060_restart.nc .
     set_namelist namelist cn_ocerst_in \"GYRELOB_LONG_00000060_restart.nc\"
     set_namelist namelist_top ln_trcrad .false.
     set_namelist namelist_top ln_rsttr .true.
     set_namelist namelist_top nn_rsttr 2
+    cp ..\/LONG\/GYRELOB_LONG_00000060_restart_trc.nc .
     set_namelist namelist_top cn_trcrst_in \"GYRELOB_LONG_00000060_restart_trc\"
     cd ${SETTE_DIR}
-    . ./fcm_job.sh input_GYRE.cfg 1 SHORT
+    . ./fcm_job.sh input_GYRE.cfg 1 ${TEST_NAME}
 fi
 
 if [ ${config} -eq 2 ] ;  then
 # Restartability tests for ORCA2_LIM_PISCES
+    export TEST_NAME="LONG"
     cd ${SETTE_DIR}
     . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2LIMPIS_LONG -r ORCA2_LIM_PISCES del_key "key_dtatrc key_diatrc"
     cd ${SETTE_DIR}
-    copy_original namelist
-    copy_original namelist_top
-    copy_original namelist_pisces
-    . param.cfg
-    . all_functions.sh
+    . param.cfg
+    . all_functions.sh
+    . prepare_exe_dir.sh
+    cd ${EXE_DIR}
     set_namelist namelist cn_exp \"O2LP_LONG\"
     set_namelist namelist nn_it000 1
@@ -190,11 +213,10 @@
     set_namelist namelist_pisces ln_sedinput .false.
     cd ${SETTE_DIR}
-    . ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 1 LONG
+    . ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 1 ${TEST_NAME}
     
     cd ${SETTE_DIR}
-    copy_original namelist
-    copy_original namelist_ice
-    copy_original namelist_top
-    copy_original namelist_pisces
+    export TEST_NAME="SHORT"
+    . prepare_exe_dir.sh
+    cd ${EXE_DIR}
     set_namelist namelist cn_exp \"O2LP_SHORT\"
     set_namelist namelist nn_it000 76
@@ -204,9 +226,12 @@
     set_namelist namelist nn_rstctl 2
     set_namelist namelist ln_clobber .true.
-    set_namelist namelist cn_ocerst_in \"O2LP_LONG_00000075_restart.nc\"
-    set_namelist namelist_ice cn_icerst_in \"O2LP_LONG_00000075_restart_ice.nc\"
+    cp ../LONG/O2LP_LONG_00000075_restart.nc .
+    set_namelist namelist cn_ocerst_in \"O2LP_LONG_00000075_restart\"
+    cp ../LONG/O2LP_LONG_00000075_restart_ice.nc .
+    set_namelist namelist_ice cn_icerst_in \"O2LP_LONG_00000075_restart_ice\"
     set_namelist namelist_top ln_trcrad .false.
     set_namelist namelist_top ln_rsttr .true.
     set_namelist namelist_top nn_rsttr 2
+    cp ../LONG/O2LP_LONG_00000075_restart_trc.nc .
     set_namelist namelist_top cn_trcrst_in \"O2LP_LONG_00000075_restart_trc\"
     # put ln_pisdmp, ln_dustfer, ln_river, ln_ndepo, ln_sedinput
@@ -218,9 +243,10 @@
     set_namelist namelist_pisces ln_sedinput .false.
     cd ${SETTE_DIR}
-    . ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 1 SHORT
+    . ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 1 ${TEST_NAME}
 fi
 
 if [ ${config} -eq 3 ] ;  then
     ## Restartability tests for POMME
+    export TEST_NAME="LONG"
     cd ${SETTE_DIR}
     . ../CONFIG/makenemo -m ${CMP_NAM} -n POMME_LONG -r POMME
@@ -228,29 +254,34 @@
     . param.cfg
     . all_functions.sh
-    copy_original namelist
+    . prepare_exe_dir.sh
+    cd ${EXE_DIR}
     set_namelist namelist cn_exp \"POMME_LONG\"
     set_namelist namelist nn_it000 1
+    set_namelist namelist nn_stock 300
     set_namelist namelist nn_itend 600
     set_namelist namelist ln_clobber .true.
     cd ${SETTE_DIR}
-    . ./fcm_job.sh input_POMME.cfg 1 LONG
+    . ./fcm_job.sh input_POMME.cfg 1 ${TEST_NAME}
     
     cd ${SETTE_DIR}
-    copy_original namelist
+    export TEST_NAME="SHORT"
+    . prepare_exe_dir.sh
+    cd ${EXE_DIR}
     set_namelist namelist cn_exp \"POMME_SHORT\"
     set_namelist namelist nn_it000 301
     set_namelist namelist nn_itend 600
-    set_namelist namelist nn_stock 300
     set_namelist namelist ln_rstart .true.
     set_namelist namelist nn_rstctl 2
     set_namelist namelist ln_clobber .true.
-    set_namelist namelist cn_ocerst_in \"POMME_LONG_00000075_restart.nc\"
-    mv ${OUTPUT_DIR}/restart.obc.output ${OUTPUT_DIR}/restart.obc
-    cd ${SETTE_DIR}
-    . ./fcm_job.sh input_POMME.cfg 1 SHORT
+    cp ../LONG/POMME_LONG_00000300_restart.nc .
+    set_namelist namelist cn_ocerst_in \"POMME_LONG_00000300_restart\"
+    cp ../LONG/restart.obc.output restart.obc
+    #mv restart.obc.output restart.obc
+    cd ${SETTE_DIR}
+    . ./fcm_job.sh input_POMME.cfg 1 ${TEST_NAME}
 fi
 
 if [ ${config} -eq 4 ] ;  then
-    ## Reproducilibity tests for GYRE_LOBSTER
+    export TEST_NAME="REPRO_1_4"
     cd ${SETTE_DIR}
     . ../CONFIG/makenemo -m ${CMP_NAM} -n GYRELOB_4 -r GYRE_LOBSTER add_key "key_mpp_mpi key_mpp_rep" del_key "key_vectopt_loop key_diatrc"
@@ -258,8 +289,9 @@
     . param.cfg
     . all_functions.sh
-    copy_original namelist
+    . prepare_exe_dir.sh
+    cd ${EXE_DIR}
     set_namelist namelist cn_exp \"GYRELOB_14\"
     set_namelist namelist nn_it000 1
-    set_namelist namelist nn_itend 75
+    set_namelist namelist nn_itend 60
     set_namelist namelist nn_fwb 0
     set_namelist namelist nn_bench 0
@@ -270,11 +302,13 @@
     set_namelist namelist jpnij 4
     cd ${SETTE_DIR}
-    . ./fcm_job.sh input_GYRE.cfg 4 REPRO_1_4
+    . ./fcm_job.sh input_GYRE.cfg 4 ${TEST_NAME}
     
     cd ${SETTE_DIR}
-    copy_original namelist
+    export TEST_NAME="REPRO_2_2"
+    . prepare_exe_dir.sh
+    cd ${EXE_DIR}
     set_namelist namelist cn_exp \"GYRELOB_22\"
     set_namelist namelist nn_it000 1
-    set_namelist namelist nn_itend 75
+    set_namelist namelist nn_itend 60
     set_namelist namelist nn_fwb 0
     set_namelist namelist ln_ctl .false.
@@ -284,16 +318,18 @@
     set_namelist namelist jpnij 4
     cd ${SETTE_DIR}
-    . ./fcm_job.sh input_GYRE.cfg 4 REPRO_2_2
+    . ./fcm_job.sh input_GYRE.cfg 4 ${TEST_NAME}
 fi
 
 if [ ${config} -eq 5 ] ;  then
     ## Repropducilibity tests for ORCA2_LIM_PISCES
-    cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2LIMPIS_16 -r ORCA2_LIM_PISCES add_key "key_mpp_mpi key_mpp_rep" del_key "key_vectopt_loop key_dtatrc key_diatrc" 
-    cd ${SETTE_DIR}
-    . param.cfg
-    . all_functions.sh
-    copy_original namelist
-    copy_original namelist_pisces
+    export TEST_NAME="REPRO_4_4"
+    cd ${SETTE_DIR}
+    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2LIMPIS_16 -r ORCA2_LIM_PISCES add_key "key_mpp_mpi key_mpp_rep" del_key "key_v
+ectopt_loop key_dtatrc key_diatrc"
+    cd ${SETTE_DIR}
+    . param.cfg
+    . all_functions.sh
+    . prepare_exe_dir.sh
+    cd ${EXE_DIR}
     set_namelist namelist nn_it000 1
     set_namelist namelist nn_itend 75
@@ -303,5 +339,5 @@
     set_namelist namelist jpni 4
     set_namelist namelist jpnj 4
-    set_namelist namelist jpnij 16 
+    set_namelist namelist jpnij 16
     # put ln_pisdmp, ln_dustfer, ln_river, ln_ndepo, ln_sedinput to false
     # if not you need input files, and for tests is not necessary
@@ -312,9 +348,10 @@
     set_namelist namelist_pisces ln_sedinput .false.
     cd ${SETTE_DIR}
-    . ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 16 REPRO_4_4
-    
-    cd ${SETTE_DIR}
-    copy_original namelist
-    copy_original namelist_pisces
+    . ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 16 ${TEST_NAME}
+
+    cd ${SETTE_DIR}
+    export TEST_NAME="REPRO_2_8"
+    . prepare_exe_dir.sh
+    cd ${EXE_DIR}
     set_namelist namelist nn_it000 1
     set_namelist namelist nn_itend 75
@@ -333,9 +370,10 @@
     set_namelist namelist_pisces ln_sedinput .false.
     cd ${SETTE_DIR}
-    . ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 16 REPRO_2_8
+    . ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 16 ${TEST_NAME}
 fi
 
 if [ ${config} -eq 6 ] ;  then
     ## Reproductibility tests for POMME
+    export TEST_NAME="REPRO_1_4"
     cd ${SETTE_DIR}
     . ../CONFIG/makenemo -m ${CMP_NAM} -n POMME_4 -r POMME add_key "key_mpp_mpi key_mpp_rep"
@@ -343,5 +381,6 @@
     . param.cfg
     . all_functions.sh
-    copy_original namelist
+    . prepare_exe_dir.sh
+    cd ${EXE_DIR}
     set_namelist namelist nn_it000 1
     set_namelist namelist nn_itend 300
@@ -353,8 +392,10 @@
     set_namelist namelist jpnij 4
     cd ${SETTE_DIR}
-    . ./fcm_job.sh input_POMME.cfg 4 REPRO_1_4
-    
-    cd ${SETTE_DIR}
-    copy_original namelist
+    . ./fcm_job.sh input_POMME.cfg 4 ${TEST_NAME}
+
+    cd ${SETTE_DIR}
+    export TEST_NAME="REPRO_2_2"
+    . prepare_exe_dir.sh
+    cd ${EXE_DIR}
     set_namelist namelist nn_it000 1
     set_namelist namelist nn_itend 300
@@ -366,16 +407,17 @@
     set_namelist namelist jpnij 4
     cd ${SETTE_DIR}
-    . ./fcm_job.sh input_POMME.cfg 4 REPRO_2_2
+    . ./fcm_job.sh input_POMME.cfg 4 ${TEST_NAME}
 fi
 
 if [ ${config} -eq 7 ] ;  then
     ## ORCA2_LIM with Agulhas AGRIF zoom
-    cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2AGUL -r ORCA2_LIM add_key "key_agrif" del_key "key_vectopt_loop key_zdftmx" 
-    cd ${SETTE_DIR}
-    . param.cfg
-    . all_functions.sh
-    copy_original namelist
-    copy_original 1_namelist
+    export TEST_NAME="SHORT"
+    cd ${SETTE_DIR}
+    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2AGUL -r ORCA2_LIM add_key "key_agrif" del_key "key_vectopt_loop key_zdftmx"
+    cd ${SETTE_DIR}
+    . param.cfg
+    . all_functions.sh
+    . prepare_exe_dir.sh
+    cd ${EXE_DIR}
     set_namelist namelist nn_it000 1
     set_namelist namelist nn_itend 75
@@ -387,16 +429,17 @@
     set_namelist 1_namelist ln_clobber .true.
     cd ${SETTE_DIR}
-    . ./fcm_job.sh input_ORCA2_LIM.cfg 1 SHORT
+    . ./fcm_job.sh input_ORCA2_LIM_AGRIF.cfg 1 ${TEST_NAME}
 fi
 
 if [ ${config} -eq 8 ] ;  then
     ## ORCA2_LIM with Agulhas AGRIF zoom in MPI
-    cd ${SETTE_DIR}
-    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2AGUL_1_2 -r ORCA2_LIM add_key "key_mpp_mpi key_agrif" del_key "key_vectopt_loop key_zdftmx" 
-    cd ${SETTE_DIR}
-    . param.cfg
-    . all_functions.sh
-    copy_original namelist
-    copy_original 1_namelist
+    export TEST_NAME="SHORT"
+    cd ${SETTE_DIR}
+    . ../CONFIG/makenemo -m ${CMP_NAM} -n ORCA2AGUL_1_2 -r ORCA2_LIM add_key "key_mpp_mpi key_agrif" del_key "key_vectopt_loop key_zdftmx"
+    cd ${SETTE_DIR}
+    . param.cfg
+    . all_functions.sh
+    . prepare_exe_dir.sh
+    cd ${EXE_DIR}
     set_namelist namelist nn_it000 1
     set_namelist namelist nn_itend 75
@@ -405,5 +448,5 @@
     set_namelist namelist jpni 1
     set_namelist namelist jpnj 2
-    set_namelist namelist jpnij 2 
+    set_namelist namelist jpnij 2
     set_namelist 1_namelist nn_it000 1
     set_namelist 1_namelist nn_itend 150
@@ -411,5 +454,5 @@
     set_namelist 1_namelist ln_clobber .true.
     cd ${SETTE_DIR}
-    . ./fcm_job.sh input_ORCA2_LIM.cfg 2 SHORT
+    . ./fcm_job.sh input_ORCA2_LIM_AGRIF.cfg 2 ${TEST_NAME}
 fi
 
Index: branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/sette_beginner.sh
===================================================================
--- branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/sette_beginner.sh	(revision 2889)
+++ branches/2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE/sette_beginner.sh	(revision 2890)
@@ -38,5 +38,7 @@
 #
 # Compiler among those in NEMOGCM/ARCH
-COMPILER=gfortran_linux
+COMPILER=PW6_VARGAS
+export BATCH_COMMAND=llsubmit
+export MPI_INTERACT="no"
 
 # Directory to run the tests
@@ -48,8 +50,12 @@
 
 CMP_NAM=${1:-$COMPILER}
+# Copy job_batch_COMPILER file for specific compiler into job_batch_template
+cd ${SETTE_DIR}
+cp BATCH_TEMPLATE/batch-${COMPILER} job_batch_template || exit
 
 # Run for GYRE CONFIG
 # small test to start
 # compile GYRE configuration with gfortran_osx compiler run with 1 proc, by default in cpp_GYRE.fcm file : 
+export TEST_NAME="TEST01"
 cd ${SETTE_DIR}
 . ../CONFIG/makenemo -m ${CMP_NAM} -n GYRE_SHORT -r GYRE
@@ -57,4 +63,7 @@
 . param.cfg 
 . all_functions.sh
+# creation of execution directory
+. prepare_exe_dir.sh
+cd ${EXE_DIR}
 # setting namelist parameters
 # experience name
@@ -68,3 +77,3 @@
 cd ${SETTE_DIR}
 # run job, with 1 processor, test named SHORT (= 60 time steps)
-. ./fcm_job.sh input_GYRE.cfg 1 SHORT
+. ./fcm_job.sh input_GYRE.cfg 1 ${TEST_NAME}
