#!/bin/bash -x
#SBATCH --job-name=MonAKARA
#SBATCH --nodes=8
#SBATCH --ntasks=512
#SBATCH --tasks-per-node=64
#SBATCH --partition=batch
#SBATCH --time=8:00:00
#SBATCH --output=/mnt/beegfs/luiz.sapucci/MONAN/scripts_CD-CT/dataout/2024022300/Model/logs/model.bash.o%j    # File name for standard output
#SBATCH --error=/mnt/beegfs/luiz.sapucci/MONAN/scripts_CD-CT/dataout/2024022300/Model/logs/model.bash.e%j     # File name for standard error output
#SBATCH --exclusive
##SBATCH --mem=500000


export executable=atmosphere_model

ulimit -c unlimited
ulimit -v unlimited
ulimit -s unlimited

. /mnt/beegfs/luiz.sapucci/MONAN/scripts_CD-CT/scripts/setenv.bash

cd /mnt/beegfs/luiz.sapucci/MONAN/scripts_CD-CT/run.2024022300


date
time mpirun -np ${SLURM_NTASKS} ./${executable}
date

#
# move dataout, clean up and remove files/links
#

mv MONAN_DIAG_* /mnt/beegfs/luiz.sapucci/MONAN/scripts_CD-CT/dataout/2024022300/Model
mv MONAN_HIST_* /mnt/beegfs/luiz.sapucci/MONAN/scripts_CD-CT/dataout/2024022300/Model
cp -f /mnt/beegfs/luiz.sapucci/MONAN/scripts_CD-CT/execs/MONAN-VERSION.txt /mnt/beegfs/luiz.sapucci/MONAN/scripts_CD-CT/dataout/2024022300/Model
cp -f /mnt/beegfs/luiz.sapucci/MONAN/scripts_CD-CT/execs/MONAN-VERSION.txt /mnt/beegfs/luiz.sapucci/MONAN/scripts_CD-CT/dataout/2024022300/Model/logs/
cp -f /mnt/beegfs/luiz.sapucci/MONAN/scripts_CD-CT/VERSION.txt /mnt/beegfs/luiz.sapucci/MONAN/scripts_CD-CT/dataout/2024022300/Model/logs/SCRIPTSCDCT-VERSION.txt
cp -f /mnt/beegfs/luiz.sapucci/MONAN/scripts_CD-CT/sources/MONAN-Model_release/1.4.1-rc/README.md /mnt/beegfs/luiz.sapucci/MONAN/scripts_CD-CT/dataout/2024022300/Model/logs/

mv log.atmosphere.*.out /mnt/beegfs/luiz.sapucci/MONAN/scripts_CD-CT/dataout/2024022300/Model/logs
mv log.atmosphere.*.err /mnt/beegfs/luiz.sapucci/MONAN/scripts_CD-CT/dataout/2024022300/Model/logs
mv namelist.atmosphere /mnt/beegfs/luiz.sapucci/MONAN/scripts_CD-CT/dataout/2024022300/Model/logs
mv stream* /mnt/beegfs/luiz.sapucci/MONAN/scripts_CD-CT/dataout/2024022300/Model/logs


