From CC Doc
Jump to navigation Jump to search
This site replaces the former Compute Canada documentation site, and is now being managed by the Digital Research Alliance of Canada.

Ce site remplace l'ancien site de documentation de Calcul Canada et est maintenant géré par l'Alliance de recherche numérique du Canada.

Other languages:
English • ‎français


COMSOL is a general-purpose software for modeling engineering applications. We would like to thank COMSOL, Inc. for allowing its software to be hosted on our clusters via a special agreement.

Logo comsol blue 1571x143.png

We recommend that you consult the documentation included with the software under File > Help > Documentation prior to attempting to use COMSOL on one of our clusters. Links to the COMSOL blog, Knowledge Base, Support Centre and Documentation can be found at the bottom of the COMSOL homepage. Searchable online COMSOL Documentation is also available here.


We are a hosting provider for COMSOL. This means that we have COMSOL software installed on our clusters, but we do not provide a generic license accessible to everyone. Many institutions, faculties, and departments already have licenses that can be used on our clusters. Alternatively, you can purchase a license from CMC for use anywhere in Canada, or purchase a dedicated Floating Network License directly from COMSOL to be hosted on a SHARCNET license server.

Once the legal aspects are worked out for licensing, there will be remaining technical aspects. The license server on your end will need to be reachable by our compute nodes. This will require our technical team to get in touch with the technical people managing your license software. In some cases such as CMC, this has already been done. You should then be able to load the COMSOL modules, and it should find its license automatically. If this is not the case, please contact our Technical support, so that we can arrange this for you.

Configuring your own license file

Our module for COMSOL is designed to look for license information in a few places. One of those places is your /home folder. If you have your own license server, you can write the information to access it in the following format:

File : comsol.lic

SERVER <server> ANY <port>

and put this file in the folder $HOME/.licenses/, where <server> is your license server and <port> is the port number of the license server. Note that firewall changes will need to be done on both our side and your side. To arrange this, send an email containing the service port and IP address of your floating COMSOL license server to Technical support.

CMC license setup

Researchers who own a COMSOL license subscription from CMC should use the following public ip settings in their comsol.lic file on the respective systems:

  • Béluga: SERVER ANY 6601 (IP changed May 18, 2022)
  • Cedar: SERVER ANY 6601
  • Graham: SERVER ANY 6601
  • Narval: SERVER ANY 6601
  • Niagara: SERVER ANY 6601

If initial license checkout attempts fail contact <> to verify they have your username on file.

Installed products

To check which Comsol modules and products are available for use, start COMSOL in graphical mode and then click Options -> Licensed and Used Products on the upper pull-down menu. For a more detailed explanation click here. If a module/product is missing or reports being unlicensed contact Technical support as a reinstall of the cvmfs module you are using maybe required.

Submit jobs

Single compute node

Sample submission script to run a COMSOL job with eight cores on a single cluster compute node:

File :

#SBATCH --time=0-03:00            # Specify (d-hh:mm)
#SBATCH --account=def-group       # Specify (some account)
#SBATCH --mem=3G                  # Specify (set to 0 to use all available node memory when using all cores)
#SBATCH --cpus-per-task=8         # Specify (set to 32or44 on graham, 32or48 on cedar, or 40 on beluga to use all cores)
#SBATCH --nodes=1                 # Do not change
#SBATCH --ntasks-per-node=1       # Do not change

FILENAME="MyModel.mph"            # Specify (inputfile filename)

# Uncomment a version to use
#module load StdEnv/2016.4 comsol/5.5
#module load StdEnv/2020 comsol/5.6

comsol batch -inputfile $FILENAME -outputfile solved_out.mph -np $SLURM_CPUS_ON_NODE

Depending on the complexity of the simulation, COMSOL may not be able to efficiently use very many cores. Therefore, it is advisable to test the scaling of your simulation by gradually increasing the number of cores. If near-linear speedup is obtained using all cores on a compute node then consider running the job over multiple full nodes using the next Slurm script.

Multiple compute nodes

Sample submission script to run a COMSOL job with eight cores distributed evenly over two cluster compute nodes. Ideal for very large simulations (that exceed the capabilities of a single compute node), this script supports restarting interrupted jobs, allocation of large temporary files to /scratch and utilizing the default comsolbatch.ini file settings. There is also an option to modify the Java heap memory described below the script.

File :

#SBATCH --time=0-03:00            # Specify (d-hh:mm)
#SBATCH --account=def-account     # Specify (some account)
#SBATCH --mem=3G                  # Specify (set to 0 to use all available node memory when using all cores)
#SBATCH --cpus-per-task=4         # Specify (set to 32or44 on graham, 32or48 on cedar, or 40 on beluga to use all cores)
#SBATCH --nodes=2                 # Specify (the number of compute nodes)
#SBATCH --ntasks-per-node=1       # Do not change

FILENAME="MyModel.mph"            # Specify (inputfile filename)

module load StdEnv/2020
module load comsol/5.6

mkdir -p $SCRREC

cp -f ${EBROOTCOMSOL}/bin/glnxa64/comsolbatch.ini comsolbatch.ini
cp -f ${EBROOTCOMSOL}/mli/startup/java.opts java.opts

comsol batch -inputfile $FILENAME -outputfile solved_out.mph -autosave on \
-recoverydir $SCRREC -tmpdir $SLURM_TMPDIR  -comsolinifile comsolbatch.ini -alivetime 15 \
#-recover -continue  # uncomment this line to restart from latest recovery files

To increase the java heap, add the following sed lines immediately after the cp -f commands:

sed -i 's/-Xmx2g/-Xmx4g/g' comsolbatch.ini
sed -i 's/-Xmx768m/-Xmx2g/g' java.opts

For further information, please see this Out of Memory article.

Graphical use

COMSOL can be run interactively in full graphical mode using either of the following methods.

On cluster nodes

Suitable to interactively run computationally intensive test jobs requiring up to all cores or memory on a single cluster node.

1) Connect to a compute node (3hr time limit) with TigerVNC
2) Start COMSOL Multiphysics
module load StdEnv/2016.4
module load comsol/5.5
3) Start COMSOL Multiphysics
module load StdEnv/2020
module load comsol/5.6

On VDI nodes

Suitable interactive use on gra-vdi includes: running a single test job with up to 8 cores for upto 24hours, create or modify simulation input files, perform post processing or data visualization tasks. To start comsol in gui mode on gra-vdi do the following:

1) Connect to gra-vdi (no time limit) with TigerVNC
2) Start COMSOL Multiphysics (or newer versions)
module load CcEnv StdEnv/2020
module spider comsol
module load comsol/5.6
3) Start COMSOL Multiphysics (or older versions)
module load CcEnv StdEnv/2016.4
module spider comsol
module load comsol/5.5

Parameter sweeps

Batch sweep

When working interactively in the COMSOL gui, parametric problems may be solved using the Batch Sweep approach. Multiple parameter sweeps maybe carried out as shown in this video. Speedup due to Task Parallism may also be realized.

Cluster sweep

To run a parameter sweep on a cluster, a job must be submitted to the scheduler from the command line using sbatch slurmscript. For a detailed discussion regarding additional required arguments, see a and b for details. Support for submitting parametric simulations to the cluster queue from the graphical interface using a Cluster Sweep node is not available at this time.