Using COMSOL

COMSOL is a multiphysics application which means that it can perform simulations involving a variety of physics and engineering disciplines.  Complex models involving different physical disciplines can be coupled together and solved as a single simulation.

Running COMSOL on Nova

There are two ways to run COMSOL:  Interactively or in batch mode.   

Interactive Sessions via OpenOnDemand

Users can run a graphical instance of COMSOL from a Nova Desktop session launched from Nova OnDemand.   COMSOL is available under the Applications menu.

Batch Mode

The most common way to run jobs on the Nova cluster is in batch mode.  If you have a COMSOL multiphysics input file (ends in .mph), you can submit your job to the cluster using sbatch.    

Load the COMOL software module

First, you will need to load the COMSOL software module for the version you need.   To see what versions are available, do:

$ module spider comsol

------------------------------------------------------------------------
 comsol:
------------------------------------------------------------------------
    Versions:
       comsol/4.4
       comsol/5.2
       comsol/5.3a
       comsol/5.4
       comsol/5.6
       comsol/6.0
       comsol/6.1
       comsol/6.2
       comsol/6.3
 

To load the COMSOL 6.3 software into your current session:

$ module load comsol/6.3  

Typical COMSOL Command Line Options

When you run COMSOL from the command line,you will need to supply some command line options to comsol.   A typical COMSOL batch command looks is shown below:

 $ comsol batch  -nn 1 -np 16  -inputfile project_input1.mph -outputfile project_output1.mph -batchlog batch-log-file.txt -mpi auto -mpibootstrap slurm 

 where:

-nn <numnodes>        Number of nodes requested.
-np <numprocs>         Number of processors requested.
-inputfile  <input_mph_file>         COMSOL input file.
-outputfile <output_mph_file>     COMSOL output file for the solution.
-batchlog <batch_output_log>    Standard out text messages from the job.
-mpi auto       Which version of MPI to use (auto is the default)
-mpibootstrap slurm     Tells COMSOL that the cluster is using the Slurm job scheduler.

 

A corresponding sbatch script for this job would look like so:

#!/bin/bash
# sample batch for a COMSOL job
#SBATCH --nodes=1              # Number of nodes to use
#SBATCH --ntasks-per-node=16   # Use 16 processor cores per node 
#SBATCH --time=8:00:00         # Walltime limit (DD-HH:MM:SS)
#SBATCH --mem=128G             # Maximum memory the job will need.
#SBATCH --account=researchit-staff   # Slurm account to use for the job
#SBATCH --job-name="project1"   # Job name to display in squeue
#SBATCH --mail-user=jedicker@iastate.edu   # Email address
#SBATCH --mail-type=BEGIN,END,FAIL   # Send an email when the job starts
#SBATCH --output="project1-%j.out"   # Job standard output file (%j will be replaced by the slurm job id)
#SBATCH --error="project1-%j.error"  # Job standard error file (%j will be replaced by the slurm job id)

# LOAD MODULES, INSERT CODE, AND RUN YOUR PROGRAMS HERE
# Load the desired version of COMSOL:
module load comsol/6.3

# Run the COMSOL batch command:
comsol batch  -nn 1 -np 16  -inputfile project_input1.mph -outputfile project_output1.mph -batchlog batch-log-file.txt -mpi auto -mpibootstrap slurm

 

Additional COMSOL Command Line Options

To see the full list of COMSOL command line options, do this:

$ comsol batch -h