Index: /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/cfg/user_template.cfg
===================================================================
--- /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/cfg/user_template.cfg	(revision 5382)
+++ /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/cfg/user_template.cfg	(revision 5383)
@@ -15,4 +15,5 @@
 NEMO_HOME=''                              # NEMOGCM equivalent root directory to find ./ARCH,./CONFIG, ...
                                           # (${DIR_WORK}/NEMO/${NEMO_BRAN}/NEMOGCM, ...)
+NEMO_RBDN=''                              # NEMO rebuild executable
 
 # Comparatives directories localization:
Index: /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.env
===================================================================
--- /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.env	(revision 5382)
+++ /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.env	(revision 5383)
@@ -16,8 +16,8 @@
 
 # Only interest for essential NEMO directories
-NEMO_ARCH=${NEMO_HOME}/ARCH        ; NEMO_CONF=${NEMO_HOME}/CONFIG         ; NEMO_ENGI=${NEMO_HOME}/NEMO
-NEMO_EFCM=${NEMO_HOME}/EXTERNAL/fcm; NEMO_IPSL=${NEMO_HOME}/EXTERNAL/IOIPSL; NEMO_TCMP=${NEMO_HOME}/TOOLS/COMPILE
-export NEMO_ARCH NEMO_CONF NEMO_EFCM
-export NEMO_ENGI NEMO_IPSL NEMO_TCMP
+NEMO_ARCH=${NEMO_HOME}/ARCH           ; NEMO_CONF=${NEMO_HOME}/CONFIG      ; NEMO_ENGI=${NEMO_HOME}/NEMO
+NEMO_EIOI=${NEMO_HOME}/EXTERNAL/IOIPSL; NEMO_EFCM=${NEMO_HOME}/EXTERNAL/fcm; NEMO_TCMP=${NEMO_HOME}/TOOLS/COMPILE
+export NEMO_ARCH NEMO_CONF NEMO_ENGI
+export NEMO_EIOI NEMO_EFCM NEMO_TCMP
 
 # Sourcing super-computer configuration
Index: /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.sh
===================================================================
--- /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.sh	(revision 5382)
+++ /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.sh	(revision 5383)
@@ -11,4 +11,5 @@
 #---------------------------------------------------
 NEMO_TRUS=$( pwd $( dirname $0 ) )
+SVN_CMD='svn status'
 DEBUG=0; PUBLISH=0; status='OK'
 
@@ -22,5 +23,5 @@
 	-n|--newconf) TEST_CONF=$2         ; shift 2;; -r|--refconf) REFE_CONF=$2         ; shift 2;;
 	-t|--time   ) TIME_LIMI=$2         ; shift 2;; -p|--publish) PUBLISH=1            ; shift  ;;
-        -u|--user   ) CFG_USER=$2          ; shift 2;; -v|--version) NEMO_REVI=$2         ; shift 2;;
+        -u|--user   ) CFG_USER=$2          ; shift 2;; -v|--version) NEMO_VERS=$2         ; shift 2;;
                    *) cat trusting_help.txt; exit  1;;
     esac
@@ -46,4 +47,8 @@
 fi
 
+# If -v|--version option has been set, modify svn command
+[ $( echo ${NEMO_VERS} | grep  "up\|update"         ) ] && SVN_CMD='svn update'
+[ $( echo ${NEMO_VERS} | tr -d '[:alpha:][:punct:]' ) ] && SVN_CMD='svn update -r '$( echo ${NEMO_VERS} | tr -d '[:alpha:][:punct:]' )
+
 datestr1=$( LC_ALL=C date -d"${DATE_STR}" +%Y-%m-%dT%H:%M )
 . ./trusting_func.sh
@@ -53,47 +58,28 @@
 printf "Date\n%s\n"       $datestr1 > mesg_01_date_${CFG_USER}_${CFG_ARCH}.txt
 # Only at end status will change to OK
-printf "Status\nFAILED\n"           > mesg_02_status_${CFG_USER}_${CFG_ARCH}.txt
+printf "Status\nFAILED\n"           > mesg_03_status_${CFG_USER}_${CFG_ARCH}.txt
 
 
 # Check softwares versions
 #---------------------------------------------------
-printf "Step......................\nGet softwares release\n"                     | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
-for rel in $CDO $COMPILER $MPI $NETCDF; do
-                             arch_rel=$( echo $LOADEDMODULES | sed "s#.*:$rel/\([^:]*\).*#\1#" )
-    [ -z "${arch_rel}"  ] && arch_rel=$( echo $PATH          | sed "s#.*$rel/\([^/]*\).*#\1#"  )
-#    [ $( echo $rel | grep $COMPILER ) ] && arch_rel=$( $rel --version | grep -m1 -o ' [0-9.]* ' >/dev/null )
-    echo $rel ${arch_rel} >> model.log
-done
-
-sed -n 2p model.log | sed 'i\Fortran compiler' > mesg_04_compiler_${CFG_USER}_${CFG_ARCH}.txt
-sed -n 3p model.log | sed 'i\MPI libraries   ' > mesg_05_mpi_${CFG_USER}_${CFG_ARCH}.txt
-sed -n 4p model.log | sed 'i\NetCDF libraries' > mesg_06_netcdf_${CFG_USER}_${CFG_ARCH}.txt
+printf "Step......................\nGet softwares release\n"                     | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
+. ${ARCH_ENV} > /dev/null    # Sourcing architecture environment
+get_rel
+sed -n 2p model.log | sed 'i\Fortran compiler' > mesg_05_compiler_${CFG_USER}_${CFG_ARCH}.txt
+sed -n 3p model.log | sed 'i\MPI libraries   ' > mesg_06_mpi_${CFG_USER}_${CFG_ARCH}.txt
+sed -n 4p model.log | sed 'i\NetCDF libraries' > mesg_07_netcdf_${CFG_USER}_${CFG_ARCH}.txt
 
 
 # SVN action on XIOS & NEMO essentials directories
 #---------------------------------------------------
-svn_cmd='svn status'
-# If -v|--version option has been set, modify svn command
-[ $( echo ${NEMO_VERS} | grep  "up\|update"         ) ] && svn_cmd='svn update'
-[ $( echo ${NEMO_VERS} | tr -d '[:alpha:][:punct:]' ) ] && svn_cmd='svn update -r '$( echo ${NEMO_VERS} | tr -d '[:alpha:][:punct:]' )
-
-printf "Step......................\nGet NEMO SVN revision with: ${svn_cmd}\n"    | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
-rev=0
-
-for dir in ${DIR_XIOS} ${NEMO_ARCH} ${NEMO_CONF} ${NEMO_EFCM} ${NEMO_ENGI} ${NEMO_IPSL} ${NEMO_TRUS} ${NEMO_TCMP}; do
-    # For time being, just get revision number from XIOS
-    [ $dir == ${DIR_XIOS} ] && echo 'XIOS '$( svn info $dir | awk '(NR == 9) {print $NF}' ) >> model.log && continue
-    ${svn_cmd} $dir
-    rev_loc=$( svn info $dir | awk '(NR == 9) {print $NF}' )
-    (( ${rev_loc} >= $rev )) && rev=${rev_loc}
-done
-echo 'NEMO '$rev >> model.log
+printf "Step......................\nGet NEMO SVN revision with: ${SVN_CMD}\n"    | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
+get_rev
+sed -n 6p model.log | sed 'i\NEMO revision' > mesg_02_nemo_${CFG_USER}_${CFG_ARCH}.txt
 
 
 # NEMO config compiled from scratch
 #---------------------------------------------------
-printf "Step......................\nCompiling ${CONF_REF} configuration\n"       | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
+printf "Step......................\nCompiling ${CONF_REF} configuration\n"       | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
 cd ${NEMO_CONF}
-. ${ARCH_ENV} > /dev/null    # Sourcing architecture environment
 #[ -d ${TEST_CONF} ] && ./makenemo -n ${TEST_CONF} clean
 ./makenemo -n ${TEST_CONF} -r ${REFE_CONF} -m $ARCH -j $NPROC > /dev/null 2>&1
@@ -103,5 +89,5 @@
 # Get namelists, xml & forced files for running
 #---------------------------------------------------
-printf "Step......................\nPreparing job\n"                             | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
+printf "Step......................\nPreparing job\n"                             | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
 cd ${TEST_DIR}
 find ${NEMO_CONF}/${TEST_CONF}/EXP00 -regex '.*\(cfg\|opa\|ref\|xml\)' -exec cp {} . \;
@@ -119,5 +105,5 @@
 # Job submission & computing
 #---------------------------------------------------
-printf "Step......................\nRunning\n"                                   | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt; echo ${JOB_SUBM}
+printf "Step......................\nRunning\n"                                   | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt; echo ${JOB_SUBM}
 job_num=$( ${JOB_SUBM} | awk '{print $NF}' )
 [ $? -ne 0 ] && get_out
@@ -135,12 +121,12 @@
 # Eventual crash during computing
 #---------------------------------------------------
-printf "Step......................\nTest if ASCII output files exist\n"          | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
+printf "Step......................\nTest if ASCII output files exist\n"          | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
 if   [ ! -f ocean.output                  ]; then
-    printf "Step......................\nOpa crashed at initialization\n"         | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
+    printf "Step......................\nOpa crashed at initialization\n"         | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
     status='FAILED'
 elif [ $( grep 'E R R O R' ocean.output ) ]; then
-    printf "Step......................\nOpa crashed\n"                           | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
-    grep 'E R R O R'       ocean.output >> mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt
-    sed 's/^/Time step :/' time.step    >> mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt
+    printf "Step......................\nOpa crashed\n"                           | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
+    grep 'E R R O R'       ocean.output >> mesg_12_comments_${CFG_USER}_${CFG_ARCH}.txt
+    sed 's/^/Time step :/' time.step    >> mesg_12_comments_${CFG_USER}_${CFG_ARCH}.txt
     status='FAILED'
 fi
@@ -149,5 +135,5 @@
 # Inspect output text files
 #---------------------------------------------------
-printf "Step......................\nTest ASCII output files difference\n"        | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
+printf "Step......................\nTest ASCII output files difference\n"        | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
 for file in ocean.output solver.stat tracer.stat; do
     diff $file ${REFE_DIR}/$file
@@ -158,5 +144,5 @@
 # Inspect output NetCDF files
 #---------------------------------------------------
-printf "Step......................\nTest last restart NetCDF files difference\n" | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
+printf "Step......................\nTest last restart NetCDF files difference\n" | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
 diff_restart 2>/dev/null
 [ $? -ne 0 ] && status='FAILED'
@@ -165,6 +151,6 @@
 # Comments
 #---------------------------------------------------
-echo 'Comments'                    >  mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt
-grep 'W A R N I N G:' ocean.output >> mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt
+echo 'Comments'                    >  mesg_12_comments_${CFG_USER}_${CFG_ARCH}.txt
+grep 'W A R N I N G:' ocean.output >> mesg_12_comments_${CFG_USER}_${CFG_ARCH}.txt
 
 
@@ -172,15 +158,15 @@
 #---------------------------------------------------
 if [ $status != 'FAILED' ]; then
-    printf "Step......................\nGet real CPU time\n"                     | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
+    printf "Step......................\nGet real CPU time\n"                     | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
     real_cpu_time=$( ${JOB_VIEW} $job_num | awk 'END{print $9}' )
-    printf "Real CPU time\n%s\n" ${real_cpu_time} > mesg_08_realcputime_${CFG_USER}_${CFG_ARCH}.txt
+    printf "Real CPU time\n%s\n" ${real_cpu_time} > mesg_09_realcputime_${CFG_USER}_${CFG_ARCH}.txt
 else
-    printf "Step......................\nTest input files difference\n"           | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
+    printf "Step......................\nTest input files difference\n"           | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
     diff inputs_list.txt ${REFE_DIR}/inputs_list.txt
 
-    if [ $? -ne 0]; then
-	printf "Input files\nDifferent" > mesg_09_inputfiles_${CFG_USER}_${CFG_ARCH}.txt
+    if [ $? -ne 0 ]; then
+	printf "Input files\nDifferent" > mesg_10_inputfiles_${CFG_USER}_${CFG_ARCH}.txt
     else
-	printf "Input files\nSame"      > mesg_09_inputfiles_${CFG_USER}_${CFG_ARCH}.txt
+	printf "Input files\nSame"      > mesg_10_inputfiles_${CFG_USER}_${CFG_ARCH}.txt
     fi
 
@@ -191,6 +177,6 @@
 # So far, everything is good
 #---------------------------------------------------
-printf "Status\nOK\n" > mesg_02_status_${CFG_USER}_${CFG_ARCH}.txt
-printf "Step......................\nCode is reliable\n"                          | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
+printf "Status\nOK\n" > mesg_03_status_${CFG_USER}_${CFG_ARCH}.txt
+printf "Step......................\nCode is reliable\n"                          | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
 
 
Index: /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh
===================================================================
--- /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh	(revision 5382)
+++ /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh	(revision 5383)
@@ -1,11 +1,68 @@
 #!/bin/bash
 
-function mesg_make {
+
+diff_nc() {
+    stat=100; file1=$1; file2=$2
+
+    cdo diffv $file1 $file2 > out_tmp
+    ( [ $? -ne 0 ] && stat=100 ) || stat=$( grep -m 1 'records differ' out_tmp | awk -Fof '{print $1}' )
+    [ -f out_tmp ] && rm out_tmp
+
+    return $stat
+} 
+
+diff_restart() {
+    last_time_step=$( cat ${REFE_DIR}/time.step )
+    result_final=0
+
+    echo 'Last time step: '${last_time_step}
+
+    for file in restart restart_ice restart_trc; do
+	printf ${TEST_DIR}'/*'${last_time_step}'_'${file}'.nc: '
+
+	if [ $( find ${TEST_DIR} -name *${last_time_step}_$file.nc ) ]; then
+	    ${NEMO_RBDN} -t $NPROC ${TEST_CONF} $(( ${last_time_step} + 1 ))
+	    result=$( diff_nc ${TEST_DIR}/*${last_time_step}_$file.nc ${REFE_DIR}/*${last_time_step}_$file.nc )
+	    printf "cdo diffv $result\n"
+	    (( result_final = result_final + result ))
+	else
+	    printf "no restart files found for comparison\n"
+	fi
+
+    done
+
+    return ${result_final}
+}
+
+get_rel() {
+    for rel in $CDO $COMPILER $MPI $NETCDF; do
+                                arch_rel=$( echo $LOADEDMODULES | sed "s#.*$rel/\([^:]*\).*#\1#" )
+	[ -z "${arch_rel}" ] && arch_rel=$( echo $PATH          | sed "s#.*$rel/\([^/]*\).*#\1#" )
+#    [ $( echo $rel | grep $COMPILER ) ] && arch_rel=$( $rel --version | grep -m1 -o ' [0-9.]* ' >/dev/null )
+	echo $rel ${arch_rel} >> model.log
+    done
+}
+
+get_rev() {
+    rev=0
+
+    for dir in ${DIR_XIOS}  ${NEMO_ARCH} ${NEMO_CONF} ${NEMO_ENGI} ${NEMO_EIOI} \
+	       ${NEMO_EFCM} ${NEMO_TRUS} ${NEMO_TCMP} ${NEMO_TRBD}               ; do
+	# For time being, just get revision number from XIOS
+	[ $dir == ${DIR_XIOS} ] && echo 'XIOS '$( svn info $dir | awk '(NR == 9) {print $NF}' ) >> model.log && continue
+	${SVN_CMD} $dir
+	rev_loc=$( svn info $dir | awk '(NR == 9) {print $NF}' )
+	(( ${rev_loc} >= $rev )) && rev=${rev_loc}
+    done
+
+    echo 'NEMO '$rev >> model.log
+}
+
+mesg_make() {
     paste -d ';' mesg_*_${CFG_USER}_${CFG_ARCH}.txt > trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt
     cat trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt
 }
 
-#=============================================
-function mesg_publish {
+mesg_publish() {
   
 if [ $PUBLISH -eq 1 ]; then
@@ -43,9 +100,7 @@
 
 fi
-
 }
 
-#=============================================
-function get_out {
+get_out() {
 	cd ${TEST_DIR}
         mesg_make; mesg_publish
@@ -58,36 +113,2 @@
         exit
 }
-
-#=============================================
-function diff_nc {
-    stat=100; file1=$1; file2=$2
-
-    cdo diffv $file1 $file2 > out_tmp
-    ( [ $? -ne 0 ] && stat=100 ) || stat=$( grep -m 1 'records differ' out_tmp | awk -Fof '{print $1}' )
-    [ -f out_tmp ] && rm out_tmp
-
-    return $stat
-} 
-
-#---------------------------------------------
-function diff_restart {
-    last_time_step=$( cat ${REFE_DIR}/time.step )
-    result_final=0
-
-    echo 'Last time step: '${last_time_step}
-
-    if [ $( find ${REFE_DIR} -name *restart*_${last_time_step}.nc ) ]; then
-
-	for file in find ${REFE_DIR} -name *restart*_${last_time_step}.nc; do
-	    echo ${TEST_DIR}'/*'${file}'_'${last_time_step}'.nc: '
-	    result=$( diff_nc $file )
-	    printf "diffnc $result\n"
-	    (( result_final = result_final + result ))
-	done
-
-    else
-	echo 'No restart files found for comparison'
-    fi
-
-    return ${result_final}
-}
