(comsol)= # Comsol ## Introduction [COMSOL](https://comsol.com/) delivers * General-purpose simulation software based on advanced numerical methods. * Fully coupled multiphysics and single-physics modeling capabilities. * Complete modeling workflow, from geometry to postprocessing. * User-friendly tools for building and deploying simulation apps. ## Availability COMSOL is available on [several ARC systems](/software). In the past, Virginia Tech purchased a limited quantity of COMSOL network licenses which are maintained on the university's [IT Procurement and Licensing Solutions](https://itpals.vt.edu/) license servers. These "perpetual" licenses are only for the indicated version of COMSOL. ### License availability As of November 2021, the licenses we have available are: | Module | Version | Qty | |-|-|-| |ACDC | 5.4 | 1 | |ACDCBATCH | 5.4 | 1 | |ACOUSTICS | 5.4 | 1 | |ACOUSTICSBATCH | 5.4 | 1 | |CFD | 5.4 | 1 | |CFDBATCH | 5.4 | 1 | |CHEM | 5.4 | 1 | |CHEMBATCH | 5.4 | 1 | |COMSOL | 5.4 | 5 | |COMSOLBATCH | 5.4 | 5 | |CORROSION | 5.4 | 1 | |CORROSIONBATCH | 5.4 | 1 | |HEATTRANSFER | 5.4 | 1 | |HEATTRANSFERBATCH | 5.4 | 1 | |LLMATLAB | 5.4 | 1 | |LLMATLABBATCH | 5.4 | 1 | |MICROFLUIDICS | 5.4 | 1 | |MICROFLUIDICSBATCH | 5.4 | 1 | |MULTIBODYDYNAMICS | 5.4 | 1 | |MULTIBODYDYNAMICSBATCH | 5.4 | 1 | |NONLINEARSTRUCTMATERIALS | 5.4 | 1 | |NONLINEARSTRUCTMATERIALSBATCH | 5.4 | 1 | |OPTIMIZATION | 5.4 | 1 | |OPTIMIZATIONBATCH | 5.4 | 1 | |STRUCTURALMECHANICS | 5.4 | 1 | |STRUCTURALMECHANICSBATCH | 5.4 | 1 | |WAVEOPTICS | 5.4 | 1 | |WAVEOPTICSBATCH | 5.4 | 1 | |COMSOLGUI | 5.4 | 5 | |CLIENTSERVER | 5.4 | 5 | |CLUSTERNODE | 5.4 | 5 | |COMSOLUSER | 5.4 | 5 | |ACO | 4.1 | 1 | |HT | 4.1 | 1 | |OPTLAB | 4.1 | 1 | |SME | 4.1 | 1 | ### Current License Status On Tinkercliffs, the a license checking utility, `lmstat` is available to check license status. By specifying the port and server for the COMSOL license server at VT, you can check that status of licenses you might need. For example: ``` $ lmstat -a -c 1718@comsol.software.vt.edu | grep WAVE Users of WAVEOPTICS: (Total of 1 license issued; Total of 1 license in use) "WAVEOPTICS" v5.4, vendor: LMCOMSOL, expiry: permanent(no expiration date) Users of WAVEOPTICSBATCH: (Total of 1 license issued; Total of 0 licenses in use) ``` From command line use of COMSOL, you may find it helpful to keep licenses you know you'll need repeatedly for the duration of your session. Because our license availability is limited, this should be used sparingly and only if you know that your workload requires the license for the duration. ``` -keeplicenses Keep checked out licenses throughout session ``` ## Interface ### OnDemand Interactive App COMSOL on ARC resources can be used via the [OnDemand](https://ood.arc.vt.edu) Interactive App which provides a graphical user interface. ### Command Line It can also be used from the command line. This requires knowledege of how to create and sumbit a job script and how to set the needed command options for Comsol to run as desired. Use the command ``` comsol -help ``` to get a listing of the options. For starters, something like this might work: ``` comsol batch -inputfile ABC.mph -outputfile Solution.mph > runlog.txt ``` ## Parallel Computing with COMSOL Links to COMSOL references which might be helpful: - [Running parametric sweeps, batch sweeps, and cluster sweeps from the command line](https://www.comsol.com/support/knowledgebase/1250 ) - [The Power of the Batch Sweep](https://www.comsol.com/blogs/the-power-of-the-batch-sweep/) - [How to Use the Cluster Sweep Mode in Comsol Multiphysics](https://www.comsol.com/blogs/how-to-use-the-cluster-sweep-node-in-comsol-multiphysics/) - [Hybrid Computing: Advantages of Shared and Distributed Memory Combined](https://www.comsol.com/blogs/hybrid-computing-advantages-shared-distributed-memory-combined/) ### Parallelizing across multiple nodes This is an example of hybrid mode parallelization across two nodes: ``` comsol batch -nn 16 -nnhost 8 -np 16 -inputfile -mpihosts host1,host2 inputfile.mph -outputfile Solution.mph -batchlog batch.log ``` COMSOL terminology |Option |explanation| recommended setting | |-|-|-| | `-nn 16`|total number of Comsol processes (ie. MPI ranks) to start| scale for the size of the job | |`-nnhost 8`|number of Comsol processes per host| one node/process per NUMA node| |`-np 16`|number of cores per Comsol process | # cores per NUMA node| |`-mpihosts $HOSTLIST`|comma delimited list of hosts in the job|`HOSTLIST=$(srun hostname \| sort -u \| paste -s -d, -)`|