It can be useful to compare two versions of the same model or application to get an overview of the differences between the two versions. To do so, click the Compare button (
) in the
Compare section of the
Developer toolbar. A
Select Application window then opens, where you can select the Model MPH-file (the remote file) to which you want to compare the current model in the COMSOL Desktop (the local file). A comparison then starts, and the results, if there are any differences, appear as a tree in the
Comparison Result window. The comparison tool compares all the settings in the entire model, including visible and invisible settings in the Model Builder and the Application Builder.
At the top of the Comparison Result window there is a toolbar with the following buttons:
Under Comparing files, you find the file paths to the local model and the remote model. The local model is typically the model open in the COMSOL Desktop, and it can have been modified after the last save. The left column is called
Local file (Open application) when the local model is the opened model or application. When the local model is a new model that has not yet been saved, the left column is called
Open application.
Under Differences, you can use the
Filter results list to control filtering with the options
No filter,
Exclude all matching labels (the default), and
Include all matching labels. The entries in the
Regular expression field define what node labels to filter. You can make the filtering case sensitive by selecting the
Case Sensitive button (
) box next to the list. The filter matching is done with regular expressions, and any label that contains a matching text will be either included or excluded. Filtering can be disabled by choosing
No filter from the
Filter results list. Click the
Show Only Active button (
) next to the list to exclude inactive settings from the comparison. Such settings are not actively used in the current model state and do not typically appear in the COMSOL Desktop.
The tree of nodes with differences has a structure according the structure of the underlying model object, not the Model Builder or Application Builder trees. This means that the hierarchy can be somewhat different compared to the hierarchy seen in the Model Builder and
Application Builder windows. The comparison includes all nonbinary differences in the model object that can be saved to disk, with some exceptions. For nodes that correspond to a node in the Model Builder or Application Builder trees, double-click the node (or right-click and choose
Go to Source) in the tree of nodes with differences to display the corresponding node in one of those trees in the local file. When applicable, you can also right-click a node and choose
Go to Remote Source to display the corresponding node in one of those trees in the remote file.
Selecting a node in the tree will update the table under Comparing values below the tree. This table shows the attributes of the selected node, both in the local model (
Local value column) and the remote model (
Remote value column). This table is particularly interesting for the nodes labeled
Attributes differ because they show the values that differ. Parent nodes can also show the same differences but typically with a larger number of attributes that have the same local and remote values. For differences that contain long entries or large arrays, there is an option to show a more detailed difference in a separate window for a selected table. Either double-click the table row or click the
Detailed Comparison of Selected Attribute button (
) below the table to open the
Compare Attribute window.
When you select two nodes with settings in the Model Builder tree or Application Builder tree, right-click and choose Compare Selected Nodes to compare the contents of the two nodes. The comparison appears in the
Comparison Results window just like other comparisons, with similar functionality as described above.