This document explains how to optimize the parallelization of parametric computations of COMSOL Multiphysics by using Cluster Sweep node and Batch mode license, which is available for all COMSOL licenses provided by CMC.
Note: This procedure is based on GUI access to COMSOL using the CMC cloud infrastructure and is not currently available using command line access to the CAD compute cluster.
The following description is based on a CMC Cloud design environment. If you need more information on using the cloud, refer to the Quick Start Guide: Using CMC Cloud Design Environments. You may use the CMC Cloud – My Linux CAD workstation, or a local Linux workstation at your university.
After logging in to your cloud workstation, open a terminal and enter following commands:
For demonstration purposes, the following steps are based on an example from the COMSOL application library. You can follow similar steps for your own design.
- When COMSOL tool (GUI mode) is running, from the main menu, select File | Application Libraries | COMSOL Multiphysics | tuning_fork.
- Click Open (See Figure 1).
Figure 1: Open an Example from Application Libraries
- From the tool bar, click Model Builder, as shown in Figure 2.
Figure 2: Change to Model Builder View
- From the main menu, select File | Save as. Save a copy to the folder /mydata/test1 and name it differently from the original file name, for example, tuning_fork_v2.mph.
- From the pane Model Builder, click the eye symbol. From the pull down menu, verify that the Advanced Physics Options is selected (See Figure 3).
Figure 3: Advanced Physics Options
- To add a cluster sweep over the device parameter, right-click the node Study 1, and then select Cluster Sweep (See Figure 4).
This step adds a node where you can set up your cluster settings.
Figure 4: Add Cluster Sweep into Study Node
- From the middle pane Settings, add the parameters that you want to sweep over. As an example, click the symbol plus.
- From the drop-down list Parameter, select Lp.
- In the field Parameter value list, enter a set of values, for example, 8, 10, 12, 16, 18. (See Figure 5).
Figure 5: Choose and Set Sweep Parameter
- In the field Number of nodes, enter the number of nodes you wish to use, and then check the box Use batch license. (See Figure 6).
Note: If you wish to bring the results back into your main model, be sure to check the box Synchronize solutions as shown in Figure 6. You will then have all the results available for further analysis and postprocessing.
Figure 6: Check the Box Use batch license
- From the pane Model Builder, select Mesh 1, and then click Size.
- From the pane Settings, under Calibrate for, choose Predefined, and then select Extra fine. (See Figure 7).
Note: This step is for test purpose. In this simple example, we want to take a longer simulation time by using the batch mode license.
Figure 7: Change Mesh Size
- To save the updated design, from the main menu, select File | Save.
- Right-click the node Study 1, and then select Compute.
After the simulation starts, wait for one to two minutes. The COMSOL Batch license and Cluster Node license are both checked out for you, but the regular COMSOL license will be checked back in. The Cluster Sweep becomes external processes (Figure 8), which use Batch mode license (for base and modules) until they are completed.
Note: During this period, you may open a second COMSOL GUI to work on other designs using the available COMSOL regular license. After the entire simulation is finished, the regular COMSOL license is checked out again for you and the Batch mode license will be checked in. You can then view the simulation results and perform data analysis or postprocessing. This is particularly useful for long-time simulation such as parameter sweep for a complicated design.
Figure 8: Running External Processes Using Batch Node License