#
#
# TODO
# ====
#
# option debug
#
#
# EVOLUTIONS
# ==========
#
# $Id: sette.sh 2158 2010-10-28 12:30:03Z sflod $
#
#   * creation
#-
#
# This is the principal script of SETTE 
# here are described some examples to run nemo
# this script creates MY_CONFIG directory and in this one there is VALIDATION directory
# in which are stored output files
# at this point of developpement there is no automatic diff of solver.stat files
# user have to set duration of the run with set_namelist function
# and if he wants to do a restart (again with set_namelist function)
# and then he has to compare by hand output solver.stat
#
# USER MODIFICATIONS
# in sette.sh script :
#		SETTE_DIR : base directory for SETTE
#		makenemo -m : machine (compilator); see ./makenemo -m help 
#			 -n : config name (in examples config_name_nproci_nprocj), see ./makenemo -n help 
#			 -r : reference configuration (if you don't give it you have to choise directories to install)
#			 add_key : to add list of keys (for example to test reproductibility: add_key mpp_rep)
#			 del_key : to del list of keys
# 		and for more details and options of makenemo see ./makenemo -h
#		fcm_job.sh needs input: input_CONFIG_NAME and TOTAL NUMBER OF PROCS used
# in param.cfg :
#		EXE_DIR     : directory in which execute jobs (by default CONFIG_DIR)    
#		FORCING_DIR : directory where to get input tar file 
#		INPUT_DIR   : directory in which store input files
#		TMPDIR      : temporary directory NEEDED ONLY FOR IBM machines (put EXP00 directory)
#		OUTPUT_DIR  : directory in which store output files
# in fcm_job.sh :
#		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)

SETTE_DIR=PATH OF SETTE

echo "starting first test"
sleep 3

cd ${SETTE_DIR}
. ../CONFIG/makenemo -m ifort_linux -n GYRE_1_1 -r GYRE
cd ${SETTE_DIR}
. param.cfg
. all_functions.sh
set_namelist namelist nn_it000 1
set_namelist namelist nn_itend 75
cd ${SETTE_DIR}
. ./fcm_job.sh input_GYRE.cfg 1
echo "finished first test"
echo "###################"
sleep 3

echo "starting second test"
sleep 3
cd ${SETTE_DIR}
. ../CONFIG/makenemo -n ORCA2_LIM_1_2 add_key "key_mpp_mpi key_nproci=1 key_nprocj=2"
cd ${SETTE_DIR}
. param.cfg
. all_functions.sh
set_namelist namelist nn_it000 1
set_namelist namelist nn_itend 75
cd ${SETTE_DIR}
. ./fcm_job.sh input_ORCA2_LIM.cfg 2
echo "finished second test"
sleep 3

