COMSOL¶
COMSOL Multiphysics is a general-purpose software platform, based on advanced numerical methods, for modeling and simulating physics-based problems.
Policy¶
COMSOL is available to users at HPC2N who has their own license server.
To use Comsol you need to have a license server running at your home institute. The license server must be reachable from HPC2N, i.e., any firewalls must be opened for access from HPC2N networks.
Citations
COMSOL does appreciate your referencing of our software in your publications. If your publisher does not have specific guidelines, we recommend either of the following formats:
"...
We used the COMSOL Multiphysics® software to perform the modeling [Ref. 1].
..."
[1]: COMSOL Multiphysics® v. 6.3. www.comsol.com. COMSOL AB, Stockholm, Sweden.
or
"...
This is explained in the AC/DC Module User's Guide [Ref. 2]
..."
[2]: AC/DC Module User's Guide, pp. 75-84. COMSOL Multiphysics® v. 6.3. COMSOL AB, Stockholm, Sweden. 2024
The second format is recommended if a specific section of the documentation is relevant.
Even if you are not required to reference COMSOL® software and documentation, you are required to use the appropriate trademark symbol, ® or ™, and to comply with the COMSOL trademark guidelines available at http://www.comsol.com/company/trademarks/.
Overview¶
COMSOL Multiphysics is a general-purpose software platform, based on advanced numerical methods, for modeling and simulating physics-based problems. With COMSOL Multiphysics, you will be able to account for coupled or multiphysics phenomena. With more than 30 add-on products to choose from, you can further expand the simulation platform with dedicated physics interfaces and tools for electrical, mechanical, fluid flow, and chemical applications.
Usage at HPC2N¶
On HPC2N we have COMSOL available as a module.
Loading¶
To use the COMSOL module, add it to your environment. You can find versions with
and you can then find how to load a specific version (including prerequisites), with
Running¶
To run COMSOL through the batch system your submit file must first load the correct module and then include a line that points it to your license server.
For information on the correct port and hostname, consult you local COMSOL license administrator.
You should then run comsol with the “batch” argument. See COMSOL’s documentation for details.
A small example is:
#!/bin/bash
#SBATCH -A <your-project>
#SBATCH -n 4
#SBATCH -t 00:10:00
module add COMSOL/5.6.0.401
export LMCOMSOL_LICENSE_FILE=someport@some.server.se
comsol batch -inputfile journalbearingDemo.mph -outputfile output.mph -batchlog batchlog.txt
Running COMSOL using the GUI (THIS SECTION IS WIP AND NOT FOR GENERAL CONSUMPTION YET)¶
To use the COMSOL GUI you must be logged in through the ThinLinc system.
- Open a terminal window inside ThinLinc (“Applications” → “System Tools” → “MATE Terminal”)
- Set
LMCOMSOL_LICENSE_FILE
to point to your license server as shown above - Load the correct COMSOL module.
- Then run “comsol”.
Note
Before running the computation there are a few things you need to setup.
If you have previously tried using the Comsol GUI we strongly advise you to first remove all previous settings that comsol saves.
When the settings has been created as per below, do not remove the settings again.
Do this if you need to remove the settings
Basic batch system settings¶
The changes here are global in nature and will be the same next time COMSOL is started.
- Go to “Options” -> “Preferences”:
- Under “Multicore and Cluster Computing”:
- Make sure “Scheduler type” is set to “SLURM”.
- In “Additional scheduler arguments” add “-A your-hpc2n-project-id” (without the quotation marks).
- Make sure “Scheduler” is set to “localhost”.
- Add “-c port@hostname.of.your.license.server” to “Postpend command”, using the same port and hostname that is used for LMCOMSOL_LICENSE_FILE above.
- Under “Show more options”:
- Under “Study”, mark the “Batch and Cluster” box.
- Click the “Ok” button.
- Under “Multicore and Cluster Computing”:
Case setup¶
- Go to “Options” -> “Preferences”:
- Under “Multicore and Cluster Computing”:
- Check that “Batch directory” is set to your working directory.
- Mark the “Number of cores” box and set the number of to the number of threads you want to use. This is the number of threads Comsol will use per MPI task.
- This step requires a restart of comsol later.
- Add “-c x” to “Additional scheduler arguments” replacing “x” with the value selected at the previous step. (This is not required if the value is 1).
If “-c x” is not set to the same value as in step 2, the cores will be over allocated and the performance will suffer. - Click the “Ok” button, and restart comsol.
- Under “Multicore and Cluster Computing”:
- Right-click “Study 1” and select “Cluster Computing”:
- Check that “Settings” is set to “Preferences controlled”.
- Right-click “Study 1” and select “Show Default Solver”:
- Under the new “Job Configurations” select “Cluster Computing 1”:
- Select the number of MPI tasks per host you want to use at “Number of processes on host”.
If you only want to use threaded computations, leave it at 1. - Unset the “Exclusive nodes” box.
- Change “Runtime” to the amount of time your computations is expected to take, make sure to NOT leave it as “Infinite”.
- Select the number of MPI tasks per host you want to use at “Number of processes on host”.
- Under the new “Job Configurations” select “Cluster Computing 1”:
- Select “Study 1” and run the computation.
Additional info¶
More information can be found on