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, VRML, sectionwise, PLY, and 3MF files. In 2D you can also import 2D meshes from NASTRAN (the third coordinate must then be the same for all mesh points) and from sectionwise files. See also
Import for details about the options in the
Import node.
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.
After importing mesh data on the COMSOL Multiphysics native format or NASTRAN format, you can change the element order for the shape functions used for the COMSOL Multiphysics simulation regardless of whether the imported data contained first- or second-order element node information. You change the element order used in the Settings window of a physics interface (for example, Heat Transfer in Solids, Solid Mechanics, or Laminar Flow) in the
Discretization section. The second-order element node information is primarily used for representing curved boundaries. However, second-order information on the boundary will not be adjusted to the curvature of the boundary unless the original imported data contains second-order element node information that represent such curvature. This means, for example, that a triangular element on a curved boundary cannot in general have its element nodes all lying in the same plane. If you import a mesh containing second-order element node information and then lower the order in the
Discretization setting to linear, then the curvature of the boundary is no longer respected. If you import a mesh containing second-order element node information and increase the element order in the
Discretization settings to cubic or higher, the higher-order nodes are inserted on the boundary based on interpolation using the second-order element data.
When you import mesh from a file that defines a length unit, the import operation scales the imported mesh to match the length unit of the Component with the Mesh node containing the corresponding
Import node. For an
Import node under a
Mesh Part node, the import operation scales the mesh if the
Use units check box is selected.
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.
If you import mesh data defining a nonconforming mesh (for a definition, see Conforming Meshes) the import operation will typically create edge or face elements of the mesh edges or mesh faces corresponding to each nonconformity in the mesh because these mesh edges or mesh faces are typically only adjacent to one 2D or 3D element each. To illustrate this, import the 2D mesh file
mesh_nonconforming.mphtxt (available in the COMSOL Multiphysics installation under
applications/COMSOL_Multiphysics/Meshing_Tutorials/) using default settings. This file contains 8 mesh vertices and 3 quad elements only, defining a mesh with a so-called hanging node. Note that the imported mesh gets 2 domains, 8 edges, and 6 vertices.