First time you run an COMSOL job?

This page contains info aimed at first time users of COMSOL on Stallo, but may also be usefull to more experienced users. Please look carefully through the provided examples. Also note that the job-script example is rather richly commented to provide additional and relevant info.

If you want to run this testjob, download the copies of the scripts and put them into your test job folder (which I assume you have created in advance).

COMSOL input example

The file used in this example can also downloaded here: Small test for COMSOL.

Place this file in a job folder of choice, say COMSOLFIRSTJOB in your home directory on Stallo.

then, copy the job-script as seen here:

#!/bin/bash -l

# Note that this is a setup for the highmem 128GB nodes. To run on the regular
# nodes, change to the normal partition and reduce the memory requirement.
#####################################
#SBATCH --job-name=comsol_runex
#SBATCH --nodes=2
#SBATCH --cpus-per-task=16      # Highmem nodes have 16 cores
#SBATCH --mem-per-cpu=7500MB    # Leave some memory for the system to work
#SBATCH --time=0-01:00:00       # Syntax is DD-HH:MM:SS
#SBATCH --partition=highmem     # For regular nodes, change to "normal"
#SBATCH --mail-type=ALL         # Notify me at start and finish
#SBATCH --exclusive             # Not necessary, implied by the specs above
##SBATCH --account=nnXXXXk      # Change to your account and uncomment
#####################################

# define input
inp=$1  # First input argument: Name of input without extention
std=$2  # Second input argument: Type of study
ext=mph # We use the same naming scheme as the software default extention

# define directories
submitdir=${SLURM_SUBMIT_DIR}
workdir=/global/work/${USER}/${SLURM_JOBID}

# create work directory
mkdir -p ${workdir}

# move input to workdir
cp ${inp}.${ext} ${workdir}

# load necessary modules
module purge --quiet
module load COMSOL/5.3-intel-2016a

# run calculation in workdir
cd ${workdir}
time comsol -nn ${SLURM_NNODES}\
            -np ${SLURM_CPUS_PER_TASK}\
            -mpirsh /usr/bin/ssh\
            -mpiroot $I_MPI_ROOT\
            -mpi intel batch\
            -inputfile ${inp}.${ext}\
            -outputfile ${inp}_out.${ext}\
            -study ${std}\
            -mlroot /global/apps/matlab/R2014a

# move output back
mv *out* $submitdir

# cleanup
cd $submitdir
rm -r ${workdir}

exit 0

(Can also be downloaded from here: run_comsol.sh)

Before you can submit a job, you need to know what “type” of study you want to perform (please read more about that on the vendor support page). For example purpose, I have chosed study 4 - named std04; and this is the second variable argument to the run script (see comments in script).

Place this script in the same folder and type:

sbatch run_comsol.sh comsol_smalltest std04

You may now have submitted your first COMSOL job.

Good luck with your (MULTI)physics!