Before You Start
When setting up a COMSOL model for cosimulation observe the following requirements and recommendations:
•
Studies to be used with cosimulation are only allowed to contain a single study step, which may be either a time-dependent or a stationary study step. It is most common to have a time-dependent study when using a model for cosimulation.
•
Auxiliary sweep in time-dependent and stationary study step, as well as load cases for a stationary study step, are not supported in cosimulation.
•
Adaptation, like adaptive mesh refinement or adaptation and error estimates, are not supported in cosimulation.
•
In order to use the model for cosimulation the model must be saved with a filename, before exporting the cosimulation file. This is important since the name of the model is needed to load the cosimulation file in Simulink.
•
Cosimulation becomes easier to use if you save the model in the same directory as the exported cosimulation file.
•
Make sure that the model solves with the time interval and time steps that will be used when performing the cosimulation, that is, the communication time step.
•
Verify that the model solves with the intended input parameter range that will be used for the cosimulation.
•
The time unit for Simulink is assumed to be seconds. There is no check that the time units in COMSOL and Simulink are the same.
•
Unit conversion for inputs is not performed. Hence, all values that are transferred from Simulink to the COMSOL model are in the unit of the COMSOL model. You can however specify the unit for the output values, i.e the ones transferred from the COMSOL model to Simulink.
•
When performing cosimulation with Simulink, the parameters are changed abruptly at discrete communications points. In some cases, such abrupt changes make time stepping more challenging for the solvers compared to just performing the simulation within COMSOL.
•
Solver settings may have to be updated to take into account the change of input values. Manual scaling is often advised if a parameter directly controls a field variable.
•
The physics definitions in the model may have to be updated to describe the dynamics of the system accurately. This is especially important when converting a model from solving using a static solver to a time-dependent solver. For example, you may have to introduce damping or other material settings that affect the dynamics of the system.