Importing Meshes
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).
When a mesh is imported into COMSOL Multiphysics, the Import node automatically determines a partitioning of the mesh into domains, boundaries, edges, and points. If the automatically performed partitioning does not match the requirements, you can modify the face partitioning by manually adjusting the corresponding parameters. To hide the geometry based on an imported mesh in a view, use an Hide for Mesh Import node.
To import additional meshes, add another Import node. Then COMSOL Multiphysics adds the elements and points of the newly imported mesh to the existing mesh.
Using Several Meshing Sequences of Imported Mesh Type
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.
If you want to use the geometric multigrid solver, several meshing sequences must be added first.
Remeshing Imported Meshes
It is possible to remesh an imported mesh to create a new mesh more suited to solving the problem at hand. See Creating Geometry from Mesh for more information.
Importing Externally Generated Mesh Data
It is possible to import externally generated mesh data using a COMSOL mesh file. The file format contains a section with mesh points coordinates, followed by sections with mesh element information, divided into separate subsections for each mesh element type (see Mesh in the chapter The COMSOL File Formats in the COMSOL Multiphysics Programming Reference Manual).
Importing Incomplete Mesh Data
A COMSOL Multiphysics mesh contains elements for all space dimension levels. For example, a tetrahedral mesh consists of domain (tetrahedra), boundary (triangles), edge, and vertex elements. Furthermore, each element has an index to the geometric entity it belongs to. If a mesh file is incomplete — for example, if it only contains tetrahedrons — the Import operation automatically generates the missing element data. To illustrate this behavior, import the file mesh_example_1.mphtxt from
applications/COMSOL_Multiphysics/Meshing_Tutorials/
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.
Transferring Domain 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.
Transferring Boundary 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.