COMSOL Multiphysics is a versatile finite element analysis and simulation package from COMSOL. The COMSOL Desktop GUI (graphical user interface) offers an environment for building and solving models. It provides script-based modeling capabilities. Currently, we host a three floating network licenses, allowing three concurrent COMSOL sessions on the HPC system or on a local machine. For extensive use and/or GUI-intensive work, it is recommended to run it locally on a workstation or laptop to avoid latency from data transfers over the network.
Building a COMSOL model
Here is an example of building and running a COMSOL model. NOTE: Extensive documentation is available in the menu: Help > Documentation and in Help > Dynamic Help. For beginners, it is highly recommended to follow the steps in Introduction to COMSOL Multiphysics found in Help > Documentation
Detailed documentation for building a model with COMSOL can be found by expanding menus on the left panel.
Instructional videos are available on the COMSOL website: http://www.comsol.com/video/browse/multiphysics. A good video introducing the basics of grid generation/meshing can be found at http://www.comsol.com/video/browse/meshing/.
A listing of videos in chronological order can be found at http://www.comsol.com/video/browse/all/, with the latest videos at the top. Most if not all releases have their own presentation video.
Running COMSOL Interactively
COMSOL can be used by starting the COMSOL GUI that allows one to build models, run the COMSOL computational engine and analyze results. With the COMSOL engine running on peregrine, the input to and output from the GUI must be available on a remote machine. The remote machine must be able to send/receive information for X Windows. If an X Windows application is not present on your machine you will have to install one.
Use ssh to securely logon to Peregrine. For the X windows communication to work correctly on the HPC system, execute the ssh command with a -Y option like
ssh -Y peregrine.hpc.nrel.gov
License info, including how many licenses are presently checked out, can be viewed by invoking the following command:
To run COMSOL interactively through its graphical interface, one can request time on compute nodes through the job scheduler by submitting a job to the 'interactive queue.' This will give you sole access to a compute node on the Peregrine cluster. To submit an interactive job suitable for using with a GUI, at the shell prompt issue the command
qsub -I -X -l nodes=1 -l walltime=0:20:00
where the -I tells Torque to use interactive mode, -X enables piping X Windows information and -l walltime=<hr:min:sec> specifies the requested length of the session. Naturally, the session must run sufficiently long for a simulation to complete but a shorter walltime parameter could start more quickly in the queue.
Before running COMSOL, set up your environment via the following commands:
module load epel/6.6
module load comsol/5.2
comsol -3drend sw &
(Note: the epel module is needed so the correct X Windows runtime libraries can be found). This should start an X Window on your local workstation, and open up a COMSOL Desktop GUI.
Running COMSOL in Batch Mode
comsol batch -inputfile myinputfile.mph -outputfile out.mph
This will let COMSOL run myinputfile.mph and save output into out.mph. To submit the COMSOL job into queue, you need should follow the instructions above to start a job in an interactive queue on the cluster.
Running a Parallel COMSOL job
To submit a COMSOL job for running on multiple processing elements, you need to use a PBS script file like the one below (script-comsol.pbs).
#!/bin/bash #PBS -N comsol-batch-test #PBS -l walltime=00:20:00 #PBS -l nodes=1:ppn=4 #PBS -A #PBS -q batch #PBS -o comsol.out #PBS -e comsol.err # this helps ensure your job runs from the directory # from which you run the qsub command cd $PBS_O_WORKDIR # Set up environment, and list to stdout for verification module purge module load comsol/5.2 echo " " module list echo " " # Run a 4-process parallel COMSOL job mpirun -n 4 comsol batch -inputfile $PBS_O_WORKDIR/myinputfile.mph -outputfile $PBS_O_WORKDIR/.mph
Once this script file is saved, it can be submitted to the job scheduler with