You can import a mesh from a COMSOL Multiphysics native file or from another meshing sequence. In 3D you can also import meshes from NASTRAN, STL, or VRML files. In 2D you can also import 2D meshes from NASTRAN (the third coordinate must then be the same for all mesh points).
You can define several meshing sequences for the same geometry (see Adding, Editing, and Building Meshing Sequences). If the geometry sequence is empty (a necessary condition for the
Imported mesh sequence type), the first
Mesh node under the
Meshes node defines a topology and is referred to as the
master sequence. All of the other
Mesh nodes should define a geometry topologically similar to the one defined by the master sequence. Two geometries are considered to be similar if they have the same number of geometric entities and their points have the same coordinates.
When you build a non-master sequence, COMSOL Multiphysics first builds the master sequence. If the build of the master sequence fails or if the geometries defined by these two sequences are not similar, an error occurs.
This file contains domain elements only with geometric entity information dividing the mesh into two domains. Now, export the imported mesh to a file using the default settings. Then, compare the resulting file (see mesh_example_4.mphtxt) with the file
mesh_example_1.mphtxt and note that the exported file contains complete mesh information; that is, it contains domain elements, boundary elements, edge elements, vertex elements, and geometric entity information.
If you have an externally generated mesh with a predefined partitioning of the elements, you can transfer this partitioning to COMSOL Multiphysics by specifying geometric entity information in the .mphtxt file. To illustrate this, import the file
mesh_example_2.mphtxt. This file contains domain elements only, without any geometric entity information. The imported mesh consists of one domain only. Note that the imported mesh from the file
mesh_example_1.mphtxt consists of two domains according to the given geometric entity information.
To transfer boundary partitioning information of an externally generated mesh you need to include boundary elements with the corresponding geometric entity information in the .mphtxt file. To illustrate this, import the file
mesh_example_3.mphtxt with the
Boundary partitioning option set to
Minimal. This file contains domain and boundary elements with geometric entity information defining 5 boundaries. Note that the imported mesh also has 5 boundaries. Now import the file
mesh_example_1.mphtxt, which has no boundary information, using the same import settings. Note that the imported mesh now has 3 boundaries only because the Minimal option generates the minimal possible partitioning that is required by the topological criteria.