This node allows you to use COMSOL inside optiSLang. It requires a prepared COMSOL model (.mph) with defined input parameters and supported result objects. There is no need for additional manual work, for example, to export JAVA or MATLAB code inside COMSOL.
Setup
There are two methods for setting up the COMSOL integration.
Solver Wizard Setup
Drop the Solver wizard onto the Scenery pane to set up new process chain or onto an existing subsystem to extend a solver chain, as described in Solver Wizard in the optiSLang User's Guide.
From the list of solvers, select
.Select your COMSOL model file (.mph) and click .
The parametric system containing the COMSOL node is created automatically.
Double-click the COMSOL node to open the integration dialog box and define parameters and responses using the inputs and outputs of the COMSOL model.
Manual Setup
In the Modules pane, expand > .
Drop a Parametric System onto the Scenery pane to set up new process chain or onto an existing subsystem to extend a solver chain.
In the Modules pane, expand > .
Drop the COMSOL node onto the Parametric System.
Confirm the initialization settings by clicking
.Double-click the COMSOL node to open the integration dialog box.
Select your COMSOL model file (.mph) and click .
The inputs and outputs of the COMSOL model are extracted automatically.
Define parameters and responses using the inputs and outputs of the COMSOL model.
The COMSOL node serves as input, solver and output node by default (see the settings in the following image).
However, you can create different workflows using nodes with other combinations of input, solve, and output nodes. The functionality of each usage mode is described in the following image.
Combining nodes with different usage modes allows you to create complex custom workflows. Two typical examples are shown in the following image.
Parameters
Only COMSOL input parameters defined in objects Parameters under object Global Definitions (see the following image) are supported by the COMSOL integration node.
Responses
The following outputs are automatically extracted from a COMSOL model:
Dependent parameters: COMSOL parameters with expression
Evaluation groups: The columns are extracted from the table data and provided as vectors
1D Plot groups: x-y data is extracted as vectors from Line Graph and Point Graph
The structure of the output is illustrated in the following image.
The vectors can be defined as internal variables and further used with standard optiSLang functionality such as scalar responses, xy-data, or signals.
If the table data in Evaluation Group contains complex numbers, both real and imaginary values are provided.
To ensure that the data in Evaluation Group is updated after each design is solved, select the Reevaluate all evaluation groups after solving check box in the Result object settings.
Solver
The following security permissions must be set in the COMSOL preferences to
run the COMSOL connector using the comsolbatch
command:
Allow access to system properties
Allow changes to the runtime system
File system access: All files
Allow access to classes through reflection
The integration node with solver capability automatically updates all studies in the COMSOL project including Solver configurations and Job configurations. All objects in the study must be correctly configured to run the solution properly. Use Sequences to perform the following actions automatically after the solution:
Update of the results object (for example, evaluation groups, plots, and tables)
Export of data to text files
Export of images or animations
The export of images is demonstrated in the example 20401 Beam with a Traveling Load.
Parallelization
Parallelization is supported.
Settings
[Windows; COMSOL 5.5] C:\Program Files\COMSOL\COMSOL55\Multiphysics
[Windows; COMSOL 5.6] C:\Program Files\COMSOL\COMSOL56\Multiphysics
[Windows; COMSOL 6.0] C:\Program Files\COMSOL\COMSOL60\Multiphysics
[Windows; COMSOL 6.1] C:\Program Files\COMSOL\COMSOL61\Multiphysics
[Linux; COMSOL 5.5] /usr/local/comsol55/multiphysics
[Linux; COMSOL 5.6] /usr/local/comsol56/multiphysics
[Linux; COMSOL 6.0] /usr/local/comsol60/multiphysics
[Linux; COMSOL 6.1] /usr/local/comsol61/multiphysics
Run Options
This node has general Run Options. The number of supported options is individual for each node.
Examples
The following examples are available for the COMSOL integration. You can download the example files here:
Example / Model | Additional information | Parameters | Responses | Modification of COMSOL project |
---|---|---|---|---|
Deformation of a feeder clamp | https://www.comsol.com/model/deformation-of-a-feeder-clamp-115 | Dimensions of model, load | Max. displacements in X, Y and Z, directions | Evaluation Group 1 with object Volume Maximum 1 to evaluate responses max. displacements in X, Y and Z directions |
Tuning fork | https://www.comsol.com/model/tuning-fork-8499 | Dimensions of model | First eigen frequency | Parametric sweep from Study 1 was removed |
Beam with a traveling load | https://www.comsol.com/model/beam-with-a-traveling-load-20401 | Speed | 1D point graph | Parametric sweep from Study 1 was removed |
These examples were taken from the COMSOL Multiphysics® Application Gallery.
Version and Requirements
Supported operating systems:
All Windows versions supported by ANSYS 2024 R1 (Tested on Windows 10 Pro (22H2))
All Linux versions supported by ANSYS 2024 R1 (Tested on Ubuntu 20.04.4 LTS)
See the Supported Integration Versions table.
Troubleshooting
The optiSLang logging system provides useful information about the solution process (for more information, see Logging Management in the optiSLang User's Guide.
The COMSOL custom Integration provides additional logging files for detailed information about:
Parameter extraction from the COMSOL model:
cmd_Export_params_stdout.log (standard output)
cmd_Export_params_stderr.log (standard error)
Solution of the COMSOL model:
cmd_Solve_model_stdout.log (standard output)
cmd_Solve_model_stderr.log (standard error)
These files can be found in each design directory (see Project Directory Structure in the optiSLang User's Guide) in the COMSOL_MODEL_FILE_NAME.optislang folder.
Limitations
Input parameters determined by complex mathematical expressions cannot be used.
Only COMSOL input parameters defined in the Parameters objects under the Global Definitions object are supported by the integration.
There are some limitations when it comes to separating input, solver and output usage modes. For example, the input node cannot set parameters to a COMSOL .mph file and the output node cannot read results from a COMSOL .mph file. The usage of one node for input, solve and output combined is recommended.