#!/bin/csh
#PBS -l ncpus=15
#PBS -l walltime=72:00:00
#PBS -j oe
#PBS -o /nobackup/menemenl/arctic40km_AD/MITgcm
#PBS -m ea
#PBS -M menemenlis@jpl.nasa.gov

#====>>> REPLACE FOLLOWING LINE WITH CORRECT RUNTIME DIRECTORY <<<====
limit stacksize unlimited
module list
module purge
module load modules scsl.1.5.0.0 intel-comp.8.1.024 mpt.1.12.0.0
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/opt/sgi/histx+/1.2a/lib:${HOME}/lib

#===============================================================

set iter = 0
#
cd  /nobackup/menemenl/arctic40km_AD/MITgcm
mkdir ctrlvec iter${iter}
cd iter${iter}
#
cp -f ../bin/mitgcmuv_ad .
cp -f ../arctic40km/input_ad/* .
ln -s ../ctrlvec/ecco_ctrl_MIT_CE_000.opt*${iter} .
#
cat >! data.optim <<EOF
 &OPTIM
 optimcycle=${iter},
 &
EOF
#
mpirun -np 15 mitgcmuv_ad

\rm tapelev*
\rm ad*bar*

# --- end of script ---
