Main Content Region

COMSOL

The COMSOL Multiphysics engineering simulation software environment facilitates all steps in the modelling process − defining your geometry, meshing, specifying your physics, solving, and then visualizing your results.

Running COMSOL on the TCHPC clusters is done in batch mode. The generation of models should be done locally on your own desktop. Save your model file (*.mph) and transfer it to the cluster for analysis.

COMSOL is a restricted access software due to limited available licences. Please contact the team (ops@tchpc.tcd.ie) if you require access.

Requirements

File transfer to the cluster

After you have generated your model file (usually named *.mph) you will need to transfer it to the cluster. Details on the transfer of files to and from our cluster are available here

You will typically have been assigned a storage area in association with your project id. This would be a good place to store model files and to run the analysis.

Generate a batch submission file

To run your COMSOL job you will need to generate another file know as a 'batch submission file'. This file will details the resources required for the job, will set up the required environment for the job and, finally, run the job. The batch file is submitted the the queue and run when the resources are available.

Below is a template batch file for Comsol 5. It would generally live in the same directory as your *.mph model file.

#!/bin/bash

# note: for COMSOL, specify the same number for -N and -n
#SBATCH -N2   # 2 nodes
#SBATCH -n2   # 2 COMSOL processes, one per node in this case, each
              # running 8 COMSOL threads; so total of 16 threads


# Submit to a partition (debug or compute)
#SBATCH -p compute

# Request a run time (max 4days on compute partition)
#SBATCH -t 24:00:00

# [optional] Set your email address to be notified of jobs updates
#SBATCH --mail-type=ALL
#SBATCH --mail-user=your@email.address

# load up the correct modules
. /etc/profile.d/modules.sh
module load apps comsol/5.3


# Details of your input and output files
INPUTFILE=/location/of/my/model.mph
OUTPUTFILE=/location/of/my/output_model.mph


######## DO NOT EDIT BELOW THIS LINE ########
# Run COMSOL in batch mode with the input and output detailed above.
comsol -mpibootstrap slurm -mpifabrics dapl batch -inputfile $INPUTFILE -outputfile $OUTPUTFILE
## ^^^ if the above fails with MPI errors, you may need to specify the MPI fabric:
##comsol -mpibootstrap slurm -mpifabrics dapl batch -inputfile $INPUTFILE -outputfile $OUTPUTFILE

Transfer this file (perhaps named .sbatch to the cluster. Typically is may live in the same location at the *.mph model file.

Submit the job to the queue

You will need to access the cluster via SSH to submit your job. Details on how to do this are available here

When you have logged in, do the following :

  • Navigate to the location of the batch file
    cd /projects/location/of/batchfile.sbatch
    
  • Submit the job to the queue
    sbatch batchfile.sbatch
    

Notes

  • COMSOL5.3 supports Slurm for launching, including support for multiple nodes over MPI. It uses the number of CPU cores available as threads per-process by default (so 8 threads on lonsdale, 12 on kelvin), so you must specify both -N and -n with the same value, and then it will run a total number of threads equal to that number multiplied by the number of CPU cores per node.
  • The older versions 4.2a & 4.4 of COMSOL are still available at
    /home/support/apps/apps/comsol42a/COMSOL42a/bin/comsol
    and
    /home/support/apps/apps/comsol44/COMSOL44/bin/comsol
    on the clusters.