COMSOL

From SciNet Users Documentation
Jump to navigation Jump to search

The COMSOL general-purpose engineering application is installed in both the Niagara and CC software stacks.

Getting a license

Licenses are provided by COMSOL. As commercial software you will require a license to use this package.

Running using the Niagara installation

COMSOL 5.3.1.275

In the Niagara software stack, commercial modules can only be accessed using the 'module use' command.

module use /scinet/niagara/software/commercial/modules
module load comsol/5.3.1.275

The same must be done to see these packages using module spider.

Setting up your .comsol directory

COMSOL will attempt to write to your $HOME/.comsol directory. This will work when you are testing your workflow on the login nodes, because they can write to $HOME. However, recall that the compute nodes cannot write to the /home filesystem. If you attempt to run COMSOL from a compute node using the default configuration, it will fail because COMSOL cannot write to $HOME/.comsol.

The solution is to create an alternative directory called $SCRATCH/.comsol, and create a soft link from $HOME/.comsol to $SCRATCH/.comsol:

mkdir $SCRATCH/.comsol
ln -s $SCRATCH/.comsol $HOME/.comsol

This will fool COMSOL into thinking it is writing to $HOME/.comsol, when in fact it is writing to $SCRATCH/.comsol. This command only needs to be run once.

Running COMSOL

Example submission script for a job running on 1 node, with max walltime of 11 hours:

#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=40
#SBATCH --time=11:00:00
#SBATCH --job-name test

module use /scinet/niagara/software/commercial/modules
module load comsol/5.3.1.275

# DIRECTORY TO RUN - $SLURM_SUBMIT_DIR is directory job was submitted from
cd $SLURM_SUBMIT_DIR

NCORE=$((SLURM_NTASKS * SLURM_CPUS_PER_TASK))
comsol batch -np $NCORE -inputfile myinputfile.mph -outputfile myoutputfile.mph

Running using the CC installation

COMSOL 5.3.1.275

To access the CC software stack you must unload the Niagara stack.

module load CCEnv
module load comsol/5.3.1.275

You can run the script given in the previous section by substituting the previous module commands with the above two.