Description
A local Model Manager database and the database of a Model Manager server installation use different underlying software components. It is therefore not possible to directly move a local database into a Model Manager server — something you may want to do, for example, after a preliminary testing period of using the Model Manager tools with a local database.
The following instructions describe two ways to get around this limitation by means of transferring model versions from one database to another database. The first is applicable to COMSOL Multiphysics 6.3 and later, and the second to COMSOL Multiphysics 6.2 and older.
Migrating via the Model Manager API
If you are running COMSOL Multiphysics 6.3, you can transfer all versions of your models and data files between databases using the Model Manager API. The attached model_manager_database_migration.mph
file contains code that you can either run as-is, or extend to your needs. For more information on the Model Manager API, see Chapter 6 in the Model Manager Reference Manual.
It is strongly recommended to first perform some test runs of the code by targeting another local database before running the migration for the server database. This way, you can easily retry the migration until you are satisfied with the end result by simply deleting the target database and creating a new one. To run the migration:
- From the Model Manager workspace in COMSOL Multiphysics, click Databases on the Database toolbar tab to open the Databases window.
- Select the database you want to migrate from in the tree (the source database). In the Settings window, write source in the Alias field. Click Save.
- Select the database you want to migrate to in the tree (the target database). In the Settings window, write target in the Alias field. Click Save.
- Open the attached file
model_manager_database_migration.mph
in COMSOL Multiphysics. - From the Application Builder workspace, right-click Database_Migration under Methods and select Run.
You will need to repeat steps 3 and 5 while testing out the migration against throw-away local databases before running the migration for the server database.
The code assumes that all versions should be migrated from the default branch in the default repository of the source database to the default branch in the default repository of the target database. In addition, the following caveats apply:
- The saved-timestamp and the user that saved a version will not be preserved when a version is migrated from the source database to the target database. Instead the current timestamp and current user will be set for the migrated version. The code appends the original timestamp and user to the migrated version's commit comment.
- The code preserves the origin relationship for models that were created from other models via, for example, Save as New or Save Draft. This requires, however, a workaround in which an intermediate copy of the origin model version is saved as a first version of the new model or draft.
- If a model version has a reference to a file version in the source database, that reference will continue to point to the source database for the migrated model version. The reference can be set to the corresponding file version in the target database from the Auxiliary Data window the next time the migrated model version is opened in the COMSOL Desktop.
Migrating via the file system
If you are running COMSOL Multiphysics 6.2 or older, you can export the models as MPH files to the file system and then import these files to the Model Manager server database. The Model Manager Reference Manual covers import and export in greater detail in Chapter 2, but an outline is provided here:
- From the Model Manager workspace in COMSOL Multiphysics, select the local database from the menu in the Database section on the Home toolbar tab. Click Export.
- In the Export dialog, make sure that the table contains the items that you want to export and that the Include auxiliary files stored in the database and Export tags as subfolders checkboxes are selected.
- Browse to an empty target folder on your file system. Click OK to begin the export.
The export will save the latest version of each model and data file to the target folder, i.e. older versions will not be exported. Tags in the database will be exported as subfolders on the file system, preserving the tag hierarchy set up in the database. If a model or data file is assigned multiple tags, they will only be exported to one of the subfolders.
- Select the server database from the menu in the Database section on the Home toolbar tab. Click Import.
- In the Import dialog, make sure that the Include auxiliary files found in imported models checkbox is selected and that Import subfolders as tags is selected in the Tags list.
- Click the Add Folder button and browse to the target folder selected in step 3 when exporting. The models and data files to be imported will be shown in the table. Click OK to begin the import.
As noted, you will not be able to preserve the version history you have built up in the local database with this automatic approach.
Related Files
model_manager_database_migration.mph | 660 KB |
Recherche par catégorie
Messages d'erreur (65)Import (10)
Géométrie (14)
Physiques (10)
Solveur (36)
Installation (41)
Maillage (14)
Général (36)
Mécanique des structures (2)
Mécanique des fluides (2)
Post-traitement (4)
Export (1)
Dessin (1)
Informations produit (6)
Multiphysique (1)
Modèles utilisateurs (1)
Electromagnétisme (1)
COMSOL makes every reasonable effort to verify the information you view on this page. Resources and documents are provided for your information only, and COMSOL makes no explicit or implied claims to their validity. COMSOL does not assume any legal liability for the accuracy of the data disclosed. Any trademarks referenced in this document are the property of their respective owners. Consult your product manuals for complete trademark details.