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. For comparing versions of a model or application in the Model Manager, see
The Versions Window in this book and
Comparing Models Saved in Databases in the
Model Manager Reference Manual for more information.
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 (Saved 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. The right column is called
Remote file. Both columns contain a path to the selected files, unless the
Local file column contains the file that is open in the COMSOL Desktop.
If you compare two versions of a model or application in a database, this section is instead called Compare versions, and the left column and right column are called
Older version and
Newer version, respectively.
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 only 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 Settings 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. Select or clear the
Include Only Outgoing Changes (
),
Include Only Incoming Changes (
), and
Include Only Conflicting Changes (
) buttons as desired to change the view to include one of those types of changes.
Incoming changes here are changes that someone has made to the remote file since the last update of the local file. Such incoming changes will be merged to the local file during an update of that file.
Outgoing changes are changes that someone has made to the local file and that has not been committed to the remote file yet. Such outgoing changes will be merged to the remote file during a commit of the file. The categorization of incoming and outgoing changes requires version information (available for models that use version control in the Model Manager). For models without version information the categorization have little meaning, and they both just represent a general difference.
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.
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 or older model (
Local value or
Value in older column) and the remote or newer model (
Remote value or
Value in newer column). This table is particularly interesting for the nodes labeled
Properties differ,
Variables differ, or
Selections differ because they show the settings where there are differences. Parent nodes can also show the same differences but typically with a larger number of attributes that have the same local and remote or older and newer 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 applicable, you can also right-click a node and choose
Go to Remote Source,
Go to Older Version, or
Go to Newer Version to display the corresponding node in one of those trees. For nodes where values differ, right-click and choose
Go to Node in Local File,
Go to Node in Remote File,
Override Difference in Local File, or
Override Difference in Remote File, where you can use the last two options to discard the local changes or to transfer them to the remote file, respectively.
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.