#!/bin/bash
# slurmsubmit.sh

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=2
#SBATCH --mem-per-cpu=5G
#SBATCH --tmp=10G
#SBATCH --job-name="test 1"
#SBATCH --time=00:30:00
#SBATCH --output=test_%j.out
#SBATCH --error=test_%j.err

module load Workspace/home

MODELTOCOMPUTE="test"
INPUTFILE="${HOME}/Jobs/TimeDependentSimulations/${MODELTOCOMPUTE}.mph"
OUTPUTFILE="${HOME}/Jobs/TimeDependentSimulations/${MODELTOCOMPUTE}_out.mph"
BATCHLOG="${HOME}/logs/${MODELTOCOMPUTE}.log"
TMPDIR="$SCRATCH/tmp"
RECOVERYDIR="$SCRATCH/recovery"

# COMSOL command, using -nn 2 deduced from SLURM
comsol -nn 2 batch -mpibootstrap slurm -recoverydir ${RECOVERYDIR} -tmpdir ${TMPDIR} -autosave on -usebatchlic -inputfile ${INPUTFILE} -methodcall myMethod -outputfile ${OUTPUTFILE} -batchlog ${BATCHLOG}
