Importing Meshes
You can import a mesh from a COMSOL Multiphysics native file, from another meshing sequence, or from a results Dataset. In 3D you can also import meshes from NASTRAN, STL, VRML, sectionwise, PLY, and 3MF files. In 2D you can also import meshes from NASTRAN (the third coordinate must then be the same for all mesh points) and from sectionwise files.
Figure 8-20: The remeshed topology-optimized geometry of a bracket.
In this section:
Imported Meshes and Element Orders
When a mesh is conforming with a geometry, elements are curved using the geometry, according to the specified geometry shape function. If the mesh defines its own geometric model, as is the case for imported meshes, there are two possibilities:
If the imported mesh contains second-order elements, the Mesh Statistics includes the following information: Imported mesh with second-order elements.
Importing Meshes from Files with Length Unit
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.
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 tetrahedra — 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.
To add volume mesh to an imported surface mesh, add a Create Domains to form domains inside watertight regions, and add a Free Tetrahedral to generate a tetrahedral mesh in the unmeshed domains. Remeshing Imported Meshes discuss the options to improve the quality of a face mesh, if needed.
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 that 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.
See Conforming, Nonconforming, and Nonmatching Meshes for import of nonconforming mesh data.
Import of Native Files and Meshing Sequences
Use an Import node () to import a mesh from a file, from another meshing sequence, or from a mesh part. To position, rotate, and scale the mesh, use one or several Transform attributes.
To import additional meshes, add another Import node. Then COMSOL Multiphysics adds the elements of the newly imported mesh to the existing mesh.
Meshes from different Import nodes form an assembly. See Conforming, Nonconforming, and Nonmatching Meshes for more information about assembly type meshes.
Enter the properties for the import using the following sections:
Import
In the Source list, choose the type of data to import: Any importable file, Meshing sequence (if applicable meshing sequences are available), and COMSOL Multiphysics file are always available. In addition to the native file formats, you can choose NASTRAN file and Sectionwise file in 2D and 3D. In 3D you can also choose STL file (stereolithography file), PLY file (Polygon File Format or Stanford Triangle Format file), 3MF file (3D Manufacturing Format file), and VRML file (Virtual Reality Modeling Language file). Choose Geometry sequence to import a triangle mesh of the Component’s geometry. Choose Dataset to import the visualization mesh of a Filter or Partition dataset. This option is only available if there is at least one Filter or Partition node under Datasets in Results.
For file import, specify the filename in the Filename field or click the Browse button (). You can also click the downward arrow beside the Browse button and choose Browse From () to open the fullscreen Select File window. Click the downward arrow for the Location menu () to choose Show in Auxiliary Data () to move to the row for this file in the Auxiliary Data window, Copy Location (), and (if you have copied a file location) Paste Location ().
For import from another mesh in the model, select a meshing sequence or mesh part from the Mesh list below. To import a meshing sequence or a mesh part, click the Import button. For import of a dataset in the model, select a Filter or Partition dataset from the Dataset list below.
The Compact History action is not supported for models including a mesh imported from dataset.
If you have changed some property, the software automatically reimports the mesh when you click a build button. For import of a meshing sequence, select Build source mesh automatically (selected by default) to automatically build the source sequence and reimport the current version of the mesh. This is required when running a parametric sweep over some parameter that affects the source mesh.
Properties for COMSOL Multiphysics File Import
In 3D, you can import 3D meshes and planar 2D meshes from COMSOL Multiphysics files (.mphtxt or .mphbin). Planar 2D meshes, imported to a 3D component, always appear at z = 0.
When you import a mesh from a COMSOL Multiphysics file that contains mesh selections, you need to select the Import selections check box (selected by default) to import the selections together with the mesh. If you choose to import mesh selections, corresponding selections are created and appear in the Domain Selections, Boundary Selections, Edge Selections, or Point Selections sections, depending on space dimension and the entity level for the imported selections. You can use the imported selections, for example, to add as a selection to a dataset or plot during postprocessing. See also Entity Selections below.
To import the second-order elements in 2D and 3D as linear elements (that is, ignoring node points not in element vertices), select the Import as linear elements check box (not selected by default).
Import of Domain Elements
In 3D, select the Import domain elements check box to import volumetric elements, such as tetrahedrons, hexahedrons, prisms, and pyramids. Clear this check box to only import boundary elements. The check box is selected by default for the following options from the Source list: Meshing Sequence, COMSOL Multiphysics file, NASTRAN file, and Sectionwise file. However, when the software adds the Import operation automatically in a new meshing sequence, the default is OFF for Source: Meshing Sequence to allow for editing.
Import of Unmeshed Domains
This setting is available with the following option from the Source list: Meshing Sequence.
In 3D, select the Import unmeshed domains to import domain information from the source meshing sequence. Clear this check box to get voids inside surface meshes that form watertight regions. Domains can be created later, if needed, using the Create Domains operation. When Source is set to COMSOL Multiphysics file, NASTRAN, or Sectionwise, the default is ON. For Source: Sequence, the default depends on how the operation is added. When you add the Import operation manually from The Mesh Toolbar or The Model Builder Context Menu, the default is OFF. When the software adds the Import operation automatically in a new meshing sequence, the default is ON.
Most physics require a mesh on the domains. Use the Free Tetrahedral, Swept and Boundary Layers operations to fill the unmeshed domains with domain elements.
Boundary Partitioning Properties
These settings are available with the following options from the Source list: COMSOL Multiphysics file, Dataset, STL file, VRML file, NASTRAN file, PLY file, Sectionwise file, and 3MF file.
When a mesh is imported into COMSOL Multiphysics, the operation 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 use the Boundary partitioning list to control the partitioning:
Select Automatic to let the software partition the boundary elements into boundaries automatically (the default setting).
Select Minimal to make a minimal boundary partitioning. This is useful when you import a mesh from a measured geometry or a NASTRAN mesh with a predefined boundary partitioning. The automatic face partitioning is not desired then.
Select Manual (in 2D) or Detect boundaries (in 3D) to manually control the partitioning. Both choices add a set of parameters that make it possible to influence the result of the partitioning algorithm; for the Detect boundaries case in 3D, the Detect Faces and Detect Edges sections appear, containing settings for controlling the face and edge partitioning, respectively.
Detect Faces (3D) and 2D Settings
The partitioning algorithm aims to split boundary elements (edge elements in 2D, face elements in 3D) into boundary entities in such a way that no large angles appear between neighboring elements within the same boundary entity. In 2D, you can limit the angle between any two elements within the same boundary entity using the Maximum angle within boundary field. The maximum accepted neighbor angle can be set using the Maximum neighbor angle field (default: 40 degrees).
If the Detect planar faces check box (3D) or the Detect straight edges check box (2D) is selected (both are selected by default), the mesh import detects (approximately) planar faces or straight edges, respectively. The minimum size of a straight or planar boundary entity, relative to the entire boundary, can be set using the Minimum relative length field (2D) and Minimum relative area field (3D). The maximum accepted angle (in degrees) between elements for a boundary to be considered straight or planar can be set using the Maximum deviation angle field. If the Detect adjacent fillet faces check box (3D) is selected, the algorithm also searches for adjacent groups of boundary elements that form cylindrical faces.
Detect Edges (3D)
The partitioning algorithm aims to split edge elements into edge entities in such a way that no large angles appear between neighboring elements within the same edge entity. The maximum accepted neighbor angle can be set using the Maximum edge neighbor angle field (default: 60 degrees).
If the Detect planar edges check box is selected (it is selected by default), the mesh import detects (approximately) planar edges. The Detection parameter specifies to which extent the operation searches for planar edges. Use the slider to tune the detection level, where Strict means that only fully planar edges are searched for, and Tolerant means that the algorithm searches for planar edges with a wider tolerance. You can also enter the parameter value directly as a value between 0 (strict) and 1 (tolerant).
If the Detect straight edges check box is selected (it is selected by default), the mesh import detects (approximately) straight edges. The Detection parameter specifies to which extent the operation searches for straight edges. Use the slider to tune the detection level, where Strict means that only fully straight edges are searched for, and Tolerant means that the algorithm searches for straight edges with a wider tolerance. You can also enter the parameter value directly as a value between 0 (strict) and 1 (tolerant).
From the Minimum edge length list, choose one of the following options: Automatic (the default), Relative, or Absolute to specify the minimum required length of an edge to be detected. If you select Relative, specify a minimum relative length in the Minimum relative length field that appears, and if you select Absolute, specify a minimum absolute length in the Minimum absolute length field that appears.
Entity Selections
The sections Domain Selections, Boundary Selections, Edge Selections, and Point Selections appear after building the Import operation. The selections are generated during the import based on selections defined in the source. In the Name column, the name of each selection appears. For COMSOL Multiphysics file import, each name is by default the name of the selection in the imported file that appears in the Name in file column. Select the name in the Name column to highlight the selection in the Graphics window. You can change the name of a selection by editing the corresponding table entry in the Name column. Note that not all of these selection sections are available for all space dimensions.
The selections can be used to specify entity selections in operations and attributes within the same meshing sequence and, if the mesh defines the component’s geometric model, for physics and material settings. For more information about the component’s geometric model, see The Mesh Node.