COMSOL Multiphysics installations on Tetralith & Sigma

COMSOL Multiphysics is a general-purpose software platform, based on advanced numerical methods, for modeling and simulating physics-based problems.

Official homepage: https://www.comsol.com

Licensing - Users not affiliated with Linköping University

To use COMSOL you need to have a license server running on your home institute. The license server must be reachable from NSC, i.e. any firewalls must be opened for access from the NSC systems.

To use COMSOL two environment variables have to be set to point to that license:

export LM_LICENSE_FILE=port@hostname.of.your.license.server
export LM_PROJECT=secret

Please, contact your local COMSOL license administrator for the correct values for port, hostname and secret.

Contact support@nsc.liu.se if you need help in your conntact with your local COMSOL license administrator.

Licensing - Users affiliated with Linköping University

COMSOL Multiphysics is set up such that those affiliated (researcher, student etc) with Linköping University automatically use the Linköping University COMSOL Multiphysics license and do not have to set the two environment variables above.

If you are a LiU user and cannot access COMSOL Multiphysics, please contact support@nsc.liu.se and we will add you to the license group (“liu”), which will give you access.

Available versions and modules

Login to Tetralith or Sigma and check the module system to list installed versions:

[pemun@tetralith1 ~]$ module avail COMSOL

-------------------------------------- /software/sse/modules ---------------------------------------
   COMSOL/recommendation (D)    COMSOL/6.1.0.346-nsc1        COMSOL/6.2.0.339-hpc1-bdist

  Where:
   D:  Default Module

Use "module spider" to find all possible modules.
Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys".

How to use COMSOL Multiphysics

COMSOL can be used either to perform interactive work or as batch jobs submitted to the batch queue system Slurm. Interactive work requiring limited resources, computationally and memory wise, can be performed on login nodes. More demanding interactive work should be performed within an interactive job on a compute node.

Interactive use of COMSOL

The recomended way to use COMSOL with its graphical user interface (GUI) for non demanding, computationally and memory wise, work is to login to Tetralith or Sigma with ThinLinc, load an appropriate COMSOL module and start COMSOL with vglrun for hardware accelerated OpenGL support. For more information on how to use ThinLinc, please see the page Running graphical applications.

[pemun@tetralith1 ~]$ module load COMSOL/6.2.0.339-hpc1-bdist
[pemun@tetralith1 ~]$ export LM_LICENSE_FILE=port@hostname.of.your.license.server
[pemun@tetralith1 ~]$ export LM_PROJECT=secret
[pemun@tetralith1 ~]$ vglrun comsol

Please, only use this method for non demanding work as the login nodes are shared among users. To set the two environment variables are not needed for LiU users.

Use the “interactive” command to request a compute node for more demanding interactive usage. Unfortunatelly graphics will be less fast as there is no hardware accelerated OpenGL on compute nodes and the Help system within COMSOL do not work.

[pemun@tetralith1 ~]$ interactive -n1 -c32 -t 4:00:00
salloc: Granted job allocation 107651
srun: Step created for job 107651
[pemun@n192 ~]$ module load COMSOL/6.2.0.339-hpc1-bdist
[pemun@n192 ~]$ export LM_LICENSE_FILE=port@hostname.of.your.license.server
[pemun@n192 ~]$ export LM_PROJECT=secret
[pemun@n192 ~]$ comsol

To set the two environment variables are not needed for LiU users.

Example batch script

A batch script for running COMSOL at NSC may look like this:

#!/bin/bash
#SBATCH --job-name=myjobname           # Your name of the job
#SBATCH --time=00:30:00                # Requested walltime 
#SBATCH --ntasks=20                    # Number of tasks allocate
#SBATCH --account=snicYYYY-XX-ZZ       # Account string for the project

module load COMSOL/6.2.0.339-hpc1-bdist
export LM_LICENSE_FILE=port@hostname.of.your.license.server
export LM_PROJECT=secret

INFILE=infile.mph                      # The name of your COMSOL input file

F=$(echo ${INFILE}|sed 's/.mph$//')

if ! [ -f ${F}.mph ];then
  echo "${F} not found, exiting"
  exit 1
fi

# Run COMSOL
echo "Running COMSOL. Output file is ${F}-out.mph, Log file is ${F}.log"
echo "and Error file is ${f}.err."

time comsol -clustersimple -mpibootstrap slurm batch -nnhost 4 \
            -inputfile ${F}.mph -outputfile ${F}-out.mph \
	-batchlog ${F}.log -error ${F}.err

#END OF SCRIPT

Note that you should at least edit the jobname, “–job-name”, and account, “–account”, before submitting. Probably also the number of tasks, “–ntasks”, requested walltime, “–time”, and the number of COMSOL nodes on each computer node, “–nnhost” need to be changed. To set the two environment variables are not needed for LiU users.

Setting the slurm flags “–ntasks” and “–cpus-per-task” to control the number of MPI tasks and number of OpenMP threads per MPI task do not work since COMSOL version 6.. Instead the COMSOL flag “–nnhost”, or alternatively “–nn”, need to be used to control the number of COMSOL nodes used per computer node.

Note that the optimal setting for “–ntasks”, and “–nnhost”, or alternatively “–nn”, is problem dependent. It depends on the COMSOL solver used and size of the problem etc. Scaling tests of COMSOL, with monitoring of utilization of allocated resources, need to be done for the problem at hand.


User Area

User support

Guides, documentation and FAQ.

Getting access

Applying for projects and login accounts.

System status

Everything OK!

No reported problems

Self-service

SUPR
NSC Express