Table of Contents
COMSOL
COMSOL Multiphysics is a finite element analysis, solver and simulation software/FEA software package for various physics and engineering applications, especially for coupled phenomena, and multiphysics. In addition to conventional physics-based user interfaces, COMSOL Multiphysics also allows entering coupled systems of partial differential equations (PDEs)
Prerequisite for use on the cluster
In order to use COMSOL on the cluster system, you need a valid license, which usually means that your home institute permits you to use theirs. Institutes buy licenses primarily for local use on their own workstations and you cannot use them by default on the cluster. That means if you want to use your institute’s licenses on the cluster system, you will need to contact us beforehand, because the corresponding user names need to be added to the unix group comsol
on the cluster system before they are allowed to use COMSOL here.
A license token can either be used only locally, or additionally on the cluster system. As long as it is in use, regardless of where that may be, it can not be used elsewhere. Please be aware that licenses available on the cluster system to the “comsol” unix group are available to everyone in that group. This includes multiple institutes. I.e. if you decide to make your license available for use on the cluster, it will not be exclusive to you or your institute. Usually, though, this does not pose a problem, since normally not all license tokens are used at the exact same times.
Please contact our colleagues from the license management department in order to purchase licenses1) .
Using COMSOL on the cluster
COMSOL can run either in graphical/interactive (GUI) mode or in batch mode.
To start the graphical user interface in an interactive batch job, you could use:
salloc --job-name=myjob --nodes=1 --ntasks=8 --time=2:00:00 --mem=30G --x11
After the system tells you your batch job is ready, load the corresponding module:
module load COMSOL
The following command lists all available versions:
module avail comsol
Then start the COMSOL GUI by typing
comsol -np $SLURM_NTASKS -3drend sw
Please avoid starting the program on login nodes so you do not steal resources from other users – your jobs would be killed here after using 30 minutes cpu time, anyway. Either use an interactive job or use “Interactive Apps” in the OnDemand web portal. Both methods are described in detail in this handbook.
In order to use COMSOL in batch mode, you will need a batch job script.
Attention: COMSOL is a rather memory intensive application. If you do not explicitly request memory, you will get a default value, which may be somewhere between 1600 MB and 4 GB for each cpu core requested, depending on the node you land on. So better make this clear by requesting what you need. Have a look in our available resources table that describes the various types of nodes we run in the cluster.
Here is a sample script to run a COMSOL job on one node:
- comsol_serial.sh
#!/bin/bash -login #SBATCH --job-name COMSOL #SBATCH --mail-user=youremail@...uni-hannover.de #SBATCH --mail-type=BEGIN,END,FAIL #SBATCH --time=1:00:00 #SBATCH --nodes=1 #SBATCH --ntasks=8 #SBATCH --mem=30G # load module module load COMSOL/5.4 # go to work dir cd $SLURM_SUBMIT_DIR # start comsol comsol batch -np $SLURM_NTASKS -inputfile infile.mph -outputfile outfile.mph -tmpdir $TMPDIR
Another sample script starting an MPI job on two nodes:
- comsol_parallel.sh
#!/bin/bash -login #SBATCH --job-name COMSOL #SBATCH --mail-user=youremail@...uni-hannover.de #SBATCH --mail-type=BEGIN,END,FAIL #SBATCH --time=1:00:00 #SBATCH --nodes=2 #SBATCH --ntasks=16 #SBATCH --mem=60G # load module module load COMSOL/5.4 # go to work dir cd $SLURM_SUBMIT_DIR echo "Running on $SLURM_JOB_NODELIST" /sw-eb/system/bin/expand-slurm-nodelist >hostfile # start comsol (all options must be on a single line) comsol -nn $SLURM_NNODES -np $SLURM_NPROCS batch -f hostfile -mpirsh ssh -inputfile input_cluster.mph -outputfile output_cluster.mph -tmpdir $TMPDIR
In case you want to run parallel COMSOL jobs, we strongly recommend to first do a scaling study.
We do not provide a central COMSOL server, but of course you may start one yourself from within the job.
WARNING: COMSOL can produce BIG recovery files that by default will be placed in your home directory. This in turn may be a reason to unexpectedly exceed your home quota (the maximum amount of space you may occupy in $HOME). You will not be able to login graphically if you exceed your home quota, so avoid this by either moving the recovery directory to $BIGWORK using the option -recoverydir $BIGWORK/comsol
, or by disabling recovery files altogether using the option -autosave off
.
If you work with the graphical interface, you should go to “Options → Preferences → Files” and set all directories to a subdirectory of your $BIGWORK directory, see figure 1