#!/bin/ksh
######################
## IRENE   TGCC/CEA ##
######################
#MSUB -r TEST-CM62-LR.01        # Job Name
#MSUB -o Script_Output_TEST-CM62-LR.01.000001    # standard output
#MSUB -e Script_Output_TEST-CM62-LR.01.000001    # error output
#MSUB -eo
#MSUB -n 385  # Number of MPI tasks (SPMD case) or cores (MPMD case)
#MSUB -x                    # exclusive node. To specify only for MPMD together with the one below
#MSUB -T 1800              # Wall clock limit (seconds)
#MSUB -A ra5424
#MSUB -Q test
#MSUB -q rome
#MSUB -m store,work,scratch

cd ${BRIDGE_MSUB_PWD}

module purge
module load intel/19.0.5.281
module load mpi/openmpi/4.0.2
module load flavor/hdf5/parallel
module load netcdf-fortran/4.4.4
module load hdf5/1.8.20
module load feature/bridge/heterogenous_mpmd
module load nco/4.9.1
module load cdo/1.9.5
module load c++/gnu/7.3.0
module load c/gnu/7.3.0

rm -f restartphy.nc restart.nc stomate_rest_out.nc sechiba_rest_out.nc

num_ensemble=0
rundir=ENSEMBLE_$num_ensemble
rm -rf $rundir
mkdir $rundir
cd $rundir
ln -s ../ENSEMBLE_TEMPLATE/* .
cd ..

num_ensemble=1
rundir=ENSEMBLE_$num_ensemble
rm -rf $rundir
mkdir $rundir
cd $rundir
ln -s ../ENSEMBLE_TEMPLATE/* .
cd ..

rundir=XIOS_ENSEMBLE
rm -rf $rundir
mkdir $rundir
cd $rundir
ln -s ../ENSEMBLE_TEMPLATE/* .
cd ..

/usr/bin/time ccc_mprun -E-K1 -f ./run_file
exit

