#!/bin/bash


# Time-stamp
date_test=$( date )
export DATESTR=$( LC_ALL=C date -d"${date_test}" +%Y%m%dT%H%M )

# External softs directories
export DIR_XIOS=${DIR_WORK}/XIOS/xios-1.0 DIR_OASI=${DIR_WORK}/OASIS

# Environment architecture (XIOS for compliance)
. ${DIR_XIOS}/arch/arch-${ARCH}.env

# Super-computers configuration
if   [ $USER == ${IDRIS_ID} ]; then 
    ARCH=X64_ADA_trust  ; COMPILER=ifort; MPI=intel
    # Job commands : LoadLeveler
    JOB_SUB=llsubmit; JOB_LIST=llq    ; JOB_VIEW='llq -xl'; JOB_DEL=llcancel                          
    # Directories $HOME $WORKDIR $COMMONDIR $TMPDIR     ergon
    DIR_WORK=$WORKDIR   ; DIR_SCRA=$TMPDIR/trusting    ; DIR_STOR=trusting_sav
elif [ $USER == ${TGCC_ID}  ]; then
    ARCH=X64_CURIE_trust; COMPILER=ifort; MPI=bullxmpi
    # Job commands : ccc_*
    JOB_SUB=ccc_msub; JOB_LIST=ccc_mpp; JOB_VIEW=ccc_macct; JOB_DEL=ccc_mdel                          
    # Directories $HOME $WORKDIR            $SCRATCHDIR $STOREDIR
    DIR_WORK=$CCCWORKDIR; DIR_SCRA=$SCRATCHDIR/trusting; DIR_STOR=$CCCSTOREDIR/trusting_sav
else
    ARCH=''             ; COMPILER=''   ; MPI=''
    JOB_SUB=''      ; JOB_LIST=''     ; JOB_VIEW=''       ; JOB_DEL=''                                
    DIR_WORK=''     	; DIR_SCRA=''                  ; DIR_STOR=''
fi

[ -z "$FC" ] && COMPILER=$FC

export ARCH     COMPILER MPI
export JOB_SUB  JOB_LIST JOB_VIEW JOB_DEL 
export DIR_WORK DIR_SCRA DIR_STOR 

# NEMO directories
NEMO_HOME=${DIR_WORK}/NEMO/${NEMO_BRAN}/NEMOGCM
export NEMO_HOME
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 NEMO_ENGI NEMO_IPSL NEMO_TCMP
# NEMO inputs
export NEMO_FORC=${DIR_WORK}/NEMO/FORC FORC_TAR=ORCA2_LIM_nemo_v3.6.tar

# Comparatives directories localization
DIR_REFE=${DIR_STOR}/${CONF_REFE}/${NEMO_BRAN}
DIR_TEST=${DIR_SCRA}/${CONF_REFE}/${NEMO_BRAN}/trusting_${DATESTR}
export DIR_REFE DIR_TEST
