How to Automatically Remove Small Details in Your Model Geometry
When setting up a simulation in the COMSOL Multiphysics® software, you have probably wished once or twice for an automatic way to remove details in the geometry that are causing an unnecessarily fine mesh or a poor mesh quality. This is possible with the Remove Details operation in 3D. With a better knowledge of this functionality, you can get meshes with fewer elements and elements of better quality.
CAD Defeaturing, Virtual Geometry Operations, and the Remove Details Operation
Both the CAD defeaturing operations, which require either the CAD Import Module, Design Module, or any of the LiveLink™ products for CAD, and the virtual geometry operations, which are included in the core COMSOL Multiphysics® package, are useful tools for preparing a geometry for simulations. The CAD defeaturing operations act on the geometry objects before Form Union/Form Assembly, and you can use them to search for and remove various types of small details after specifying a tolerance. The virtual operations are manual: You select and remove the geometric entities you do not want in the geometry. Compared to the CAD defeaturing operations, virtual operations can be more flexible, since they act on the finalized object (i.e., after the Form Union/Form Assembly is built) and since they remove details on a virtual copy of the geometry that is not necessarily bound by the mathematical formulas underlying the real geometry.
Leveraging the virtual geometry operations, the Remove Details operation automatically detects and then deletes small details by picking appropriate tolerances and virtual geometry operations so that you can prepare a geometry for meshing in one click.
Let’s dive into an example…
Setting Up the Geometry for Two Parts of a Mountain Bike Fork
The geometry discussed here contains two parts of a mountain bike fork: the crown and the steerer tube. The assembly highlights challenges when working with imported CAD designs. However, most parts in the assembly have been removed to keep the tutorial relatively simple. Here, we will take a closer look at some of the smaller details, including narrow faces, short edges, and an overlap between the parts.
The steerer tube and crown of a mountain bike fork with suspension.
Building and meshing the geometry with default mesh sizes results in several mesh warnings. The Warning nodes highlight short edges, narrow faces, faces with narrow regions (shown in the image below), and thin domains, as well as report when poor-quality mesh elements are created.
Meshing the geometry gives warnings about small details, also indicated by the spots with high-density mesh. The warnings list short edges, narrow faces and faces with narrow regions (highlighted in blue in the mesh), and a thin domain.
Since we import two parts, we expect to get two domains (one for the tube and one for the crown). However, we end up with three domains due to an overlap between the parts. The difference in the radii of the hole and steerer tube can be seen if the geometry is inspected in detail, as shown in the two images below. Here, the overlap is exaggerated for illustrative purposes, but on real parts, it would be much smaller. The purpose of this overlap is to enable the secure mounting of the crown on the tube using a fastening technique called interference fit. The parts are either pressed together by force, or for larger interference, the crown is heated so that the hole expands before the tube is inserted. The amount of interference is determined to provide the desired strength for the assembly.
The overlap between the parts. The steerer tube is transparent in both images, while the crown is highlighted in blue on the left. The arrows in the left image highlight how an overlap can be spotted directly after the import of the CAD design. The right image highlights the thin domain created by the overlap of the two CAD parts after the Form Union is built.
To specify different material settings for the steerer tube and the crown, we want to keep these as separate domains, but the extra overlap domain and other reported small details are unwanted and should be removed. To do this, we could use a combination of CAD defeaturing operations and virtual operations. The reason we need both is that the former cannot be used to remove the thin overlap domain, as it is created as a result of the Form Union operation. Let’s see how much easier our task becomes using the Remove Details operation.
Setting Up the Remove Details Operation
The word “details” in Remove Details refers to short edges, sliver faces, small faces, thin domains, and unnecessary vertices. All of these items usually lead to the use of a very fine mesh size and/or a poor mesh quality. Small details can also cause the mesh operations to fail at meshing parts of the geometry. Within a tolerance, determined by the Detail Size setting, the operation finds short edges, small faces, narrow faces, and thin domains in the geometry and removes them by using virtual operations. The Remove Details operation is designed to remove small details, and it automatically determines a tolerance such that only smaller details are removed in the geometry. We should keep this in mind when manually setting the tolerance, as removing entities that are too large may result in a distorted geometry.
The default tolerance setting is Detail Size: Automatic, but this can be set manually by switching to either Relative or Absolute. The image below shows the latter setting with a Maximum element size close to the thickness of the overlap domain: 1 mm. The Information section contains information about the number of entities that has been removed and how they have been removed (ignored or collapsed). In general, a larger Maximum absolute size or Maximum relative size will give a higher probability for collapsed entities (domains, faces, and edges), while smaller sizes result in more ignored entities (faces, edges, and vertices).
The Settings window for Remove Details after the operation has completed. Changing the Maximum absolute size to 1 mm results in the removal of several ignored and collapsed entities, among which one is the previously mentioned overlap domain.
The setting Vertices with continuous tangent in the Details to Remove section removes vertices where the adjacent edges have a continuous tangent within the Continuous tangent tolerance that is given in the Parameters section. If a vertex has more than two adjacent edges, it is always kept.
Edges, faces, and domains that are smaller than the Detail size are removed when the respective check boxes are selected. The check boxes in the Details to Remove section can be cleared to keep certain types of entities or to focus the Remove operation on one or a couple of the entities within this operation. The entities can be combined with a specific set of parameters; for example, an absolute Maximum detail size to get rid of short edges and unnecessary vertices.
The vertices, edges, faces, and domains are removed using the operations found in the first section under the menu item Virtual Operations. The Virtual Operation on a Wheel Rim Geometry tutorial model goes through many of the virtual operations and their uses.
The Virtual Operations menu showing operations used by Remove Details.
The Collapse Face Regions operation, introduced as of COMSOL Multiphysics® version 5.4, is a virtual operation used to detect and resolve narrow face regions, which is a type of detail that is currently not detected by Remove Details. Going back to the mountain bike fork model, we can see this as there are still warnings when the mesh is built, as seen in the image below. The Selection of the Warning node highlights two faces with narrow regions that are not resolved by the Minimum element size specified for the mesh. We can see that the quality of the mesh triangles in this region is relatively poor.
The mesh warning highlights two faces with narrow regions underneath the crown part. The narrow regions are not resolved by the Minimum element size specified, which means that the mesh elements in this region have poorer quality.
Faces with narrow regions can be handled in different ways depending on the geometry at hand. One option is to join the faces with adjacent faces using a Form Composite Faces operation. Another option is to add the faces to a Collapse Face Regions operation. Below, the results of the two options are shown, where Form Composite Faces has been applied on the right-hand side and Collapse Face Regions to the faces on the left-hand side of the circular hole.
Two ways to remove the narrow regions: The faces on the left-hand side show the result of the Collapse Face Regions operation, while the large face on the right side of the circular hole is the result of a Form Composite Faces operation.
By modifying the Narrow regions tolerance for the Collapse Face Regions operation, you can determine how much of the narrow region is collapsed. A larger absolute or relative tolerance results in a larger region being collapsed.
As a comparison to the mesh shown in the second image showing the mesh and warnings for the geometry before we remove all of the small details, the image below shows the final mesh after applying the abovementioned operations.
Behind the Scenes of the Remove Details Operation
Now that we have gone through the first part of the example, let’s move on to what happens behind the scenes. The operation might look like a black box, but as with most functionality in COMSOL Multiphysics, it is possible to switch to a manual mode and inspect what has been done — even modify it. You should inspect the geometry after running the Remove Details operation to make sure only unwanted details have been removed. One way to do so is by stepping through the expanded sequence of operations and building one operation after the other.
If the Remove Details operation uses the Mode of Operation: Automatic setting at least once, it is possible to switch to the Manual setting to expand the sequence of virtual operations that have been added. Now, we can inspect each individual operation, modify the Selection of entities in each individual operation, and delete or add operations to the sequence. Changes to the expanded sequence are automatically reset if the Mode of Operation setting is changed back to Automatic when building the geometry again.
Details are removed in different passes using increasing tolerances to remove larger and larger details. A simple geometry may only need one pass, but with a more complicated geometry, like the one shown below, the Remove Details operation goes through three passes and a cleanup pass. The first pass starts out with Ignore Vertices 1, the second pass starts with Collapse Faces 2, the third pass starts with Collapse Faces 3. Lastly, the cleaning starts with Ignore Vertices 3.
Expanded Remove Details sequence after Mode of Operation has been set to Manual. This can be used to inspect and/or modify the automatic removal. The sequence of operations shows that three passes were made before the last three operations to clean up.
Using Multiple Remove Details Operations
Different parts of a geometry can have details of different sizes, which calls for different tolerances to be used. In cases like these, it makes sense to work with several Remove Details operations using different tolerances; maybe even different selections of Details to Remove check boxes. It is possible to have a selection of not only domains but also boundaries and edges, if needed.
Using the same geometry, let’s add a Remove Details operation with the Maximum absolute size set to 2 mm for the crown domain (Domain 1). After that, some edges are removed manually using an Ignore Edges operation. Lastly, another Remove Details is added for the overlap domain (Domain 3). As seen in the image below, only the Thin domains check box is selected for removal, and the Selection List shows that there are only two domains left after this operation is built.
The list of removed entities is rather extensive here to get rid of the overlap domain, as many different virtual operations are involved in this process. The overlap domain ends up as part of the domain of the steerer tube. It is not possible to select the domain it will become a part of beforehand, but you can do so by expanding the sequence of Remove Details operations and modifying the selections manually. As the overlap is much smaller in reality, it might not matter as much which domain it becomes a part of. However, for the cases where it does matter, this can be changed to fit your needs.
In this blog post, we have discussed the functionality and use of the Remove Details operation. This operation is both automatic and useful, and we recommend that you use it whenever you are working with a more complicated geometry in COMSOL Multiphysics. For imported CAD designs, Remove Details is especially useful, as you have less of a chance to modify the imported design directly. As it works with the finalized geometry, this operation can also remove entities created by intersecting objects, which are not available in the original objects.
Try the model featured in this blog post by clicking the button below, which will take you to the Application Gallery. Note that you must be logged into a COMSOL Access account and have a valid software license to download the MPH-file.
Read more about the use of Form Union and Form Assembly in this Knowledge Base article.
- COMSOL Now
- Today in Science
- COMSOL Now
- Today in Science