Surface meshes and volume meshes can be used as bases for computational domains in the COMSOL Multiphysics® software. In Part 1 of this two-part blog series, I discussed how to repair and edit an imported STL surface mesh, using an example of a human skull mesh to demonstrate. In this second part, I will walk you through the process of combining that same mesh with an imported CAD assembly. You can download the model file to follow along. (Note that using this file requires a license for the CAD Import Module, the Design Module, or any of the LiveLink™ products for interfacing with CAD programs.)
Table of Contents
A mesh can take multiple forms. For example, it may be generated in the COMSOL Multiphysics® software or it may be imported from file. The software can also export topology optimization results as a mesh that can be used for verification studies or combined with other meshes or CAD for further simulations.
Note: The word “CAD” will be used in this blog post to mean either a:
- Geometry drawn in COMSOL Multiphysics® using the Design Module
- CAD part or CAD assembly imported using the CAD Import Module or synced via one of LiveLink™ products
A list of supported CAD file formats can be found here.
A mesh can also be a computational mesh that has been prepared for simulation in another software program. Or, as in the example I’m using for this series, it can be a surface mesh for a medical application imported in the STL format, which is a format used for sharing this type of data.
In some cases, you want to add to the modeling domains described by the mesh, for example, to model the effect of an implant added to the mesh of vertebrae or by adding surrounding domains for modeling the RF implant heating during MRI. In these cases, you will need to combine the mesh with the CAD describing the external parts by uniting them in a Mesh-Based Geometry sequence in the software. Compared to an imported mesh, which has a linear or second-order representation of a curved boundary, the representation of the surfaces are exact in CAD. Going over to a mesh-based representation of the CAD means losing the exact shape of the surfaces, but the software still uses a curved representation of the surfaces when placing new mesh vertices or higher-order nodes.
Steps to Combine CAD with Meshes
Use a Mesh Part sequence to import the mesh. In addition to organizing the work, moving the editing and repair to a part sequence also makes it possible to use the mesh for multiple purposes, as I will describe later in this post. The CAD assembly is imported into the Geometry sequence of the Component, and this is where all the modifications and cleanup of the CAD takes place to prepare it for being combined with the mesh.
The step of combining them will then be done in a Mesh-Based Geometry sequence. The physics will be defined on the domains and boundaries described by the Mesh-Based Geometry sequence. The computational mesh will also be generated for the Mesh-Based Geometry sequence and is built after all editing is done.
To summarize, the procedure for combining a mesh with CAD consists of the following steps:
- Import the mesh and repair it, if needed, to make it watertight.
- Import a CAD file or create a geometry in COMSOL Multiphysics®.
- Perform cleanup of the geometry.
- Add a Mesh-Based Geometry sequence, and import the CAD and mesh.
- Combine the mesh and the geometry to resolve any intersecting elements.
- Review the domains and create selections.
- Generate a mesh for simulation.
Demonstrating with a Human Skull Mesh
To show the details of each step, I will use the imported STL mesh of a part of the upper jaw from Part 1 of this series and the CAD of a dental implant.
The steps performed in an example of a dental implant.
Importing and Editing the STL Mesh in a Mesh Part
In Part 1: Editing and Repairing Surface Meshes in COMSOL Multiphysics®, I demonstrated how to edit the STL mesh of a human skull (Ref. 1) in a Mesh-Based Geometry sequence. Here, I’ll instead import the mesh directly into a 3D Mesh Part sequence and edit it using the same operations I used in Part 1. Moving the operations to the Mesh Part sequence allows me to better organize the model now that I am also going to import CAD; i.e., I can edit and reference the Mesh Part sequence throughout my model. Additionally, having the mesh available in a Mesh Part facilitates importing it as construction geometry to help with the positioning of the CAD relative to the mesh, as I’ll demonstrate in the next section.
Original STL mesh: Planes are used to cut out the part of the upper jaw where a tooth is missing (left). The mesh in the Mesh Part sequence after all of the editing has been done (right).
Importing CAD or Creating a Geometry
Next, I’ll import a STEP file containing a CAD assembly of a dental implant with colors assigned to the solid parts and some of the surfaces. The assembly contains four parts: the implant (outer part with threads), screw (attaching to the inner threads of the implant), crown (white), and abutment (attaching the crown to the implant).
The dental implant used in this example (left). A cross-section view of the implant showing the four parts (right).
When positioning the imported CAD properly with respect to the mesh, or if you are drawing a geometry, it helps to import the mesh from the Mesh Part as construction geometry. To do so, add an Import operation to the Geometry sequence and select the Construction geometry checkbox in the settings. Then, the objects created from the mesh will only serve as temporary tool objects and will not be part of the final geometry. A construction object is rendered with dashed edges, as seen in the following images. Use a Rigid Transform operation to move and rotate the dental implant.
Dental implant (white and pink) positioned relative to the construction geometry, seen from below (left). Seen from the side (right).
Cleaning Up the CAD
Once the Form Union operation has been built, the construction geometry is automatically removed and you are left with only the implant. When you leave the Geometry sequence, an analysis of the geometry is performed automatically to make sure the CAD doesn’t contain small details, gaps, or overlaps between parts that would cause unnecessary refinement of the mesh. If the geometry contains such small details, a Geometry Cleanup dialog with appear, giving you options to clean up the geometry automatically or by using the wizard.
In this example, when I move on from the Geometry sequence to add materials, clicking the Materials node will trigger the Geometry Cleanup dialog because the geometry includes some acute angles on the boundaries of the threads as well as some small faces. I’ll choose the Clean Up Automatically option from the dialog to remove them from the geometry. Next, I’ll also add a Form Composite Faces operation to the Geometry sequence to achieve a suitable face partitioning for the crown. Now, the geometry is ready to be combined with the mesh.
Selected crown faces (blue) added to the Form Composite Faces operation (left). The cleaned-up CAD, ready to be joined with the mesh (right).
Importing to the Mesh-Based Geometry
Add a Mesh-Based Geometry node by right-clicking the Component node and selecting the option from the list. The sequence will already contain an Import node that imports a meshed version of the implant. Add another Import node to import the mesh of the teeth and bone directly from the Mesh Part.
Mesh Part and geometry imported into the Mesh-Based Geometry sequence.
In this example, the implant has already been oriented with respect to the mesh. You can also do this in the Mesh-Based Geometry sequence using one or several Transform nodes. See Part 1 for more information about using the Transform attribute to rotate a mesh.
Combining the Mesh with CAD
It’s expected that the mesh elements of the dental implant will intersect the mesh of the bone. The Information section under the Import 2 node informs you about exactly this, and it adds colored points in the Graphics window highlighting the intersections. You would expect to see points all the way around the abutment, but you’ll only see a smaller number of points. Why? There may be a large number of intersecting elements in a mesh, so the list of locations is typically truncated. To get an idea of what is going on, use the buttons in the Settings window of the Information section to center the view and add a Clip Sphere around the listed locations, as shown in the following image.
The Information section presents details about some intersecting elements marked with colored points in the Graphics, shown here using a Clip Sphere.
Overlapping domains can be visualized using a Clip Plane operation with the settings Show Cross Section and Highlight Overlapping Intersections selected. This highlights the overlap in red, as you can see in the following image at left. If you don’t have domains for the teeth and the bone, check whether you had domains when finalizing the mesh in the Mesh Part. To form the domains in the Mesh-Based Geometry sequence after the intersections have been calculated, you can add a Create Domains node after you have built the Union operation. Additionally, check that you did not select the Import unmeshed domains checkbox in the Import 2 node. If you did, unselect the checkbox and rebuild the sequence.
I’ll use a mesh Union operation to calculate the intersection. As discussed in Part 1, it helps if the meshes of the intersecting faces have roughly similar element sizes. In the preceding image, you can see that the mesh of the bone (light yellow) is much coarser than the mesh of the abutment (blue). Use the Remesh Faces operation to reduce the element size on the largest boundary of the bone.
In Part 1, I also discussed using the Linear option in the Placement of vertices the setting to simplify building the Union operation. I’ll use this approach here as well. Building the Union operation partitions the domain of the abutment into two and the domain of the screw into two, as seen in the following image at right.
The Clip Plane operation visualizes the domains of the dental implant overlapping the domain of the bone in red (left). The resulting mesh-based geometry after the Union operation has been built (right).
If you need to combine meshes with surfaces that coincide or need to bridge small gaps or overlaps, use the Merge Entities operation instead, which is described in Part 1.
Joining Domains and Setting Up Selections
As expected, the domains of the screw and abutment have been partitioned by the surface of the bone. Now, I need to decide what to do with these domains: Do I want to keep the domains as they are or join them? For this example, I’ll join them using two Join Entities operations: one for the abutment and one for the screw. The selections for the CAD parts were kept by the import, so I’ll use the domain selections for each respective CAD part when choosing which domains to join.
Now that the computational domains have been configured, I can set up the remaining selections to simplify defining materials and physics later on. In materials, it would help, for example, to have one selection for all titanium domains. I accomplish this by adding a Union Selection feature to unite the selections for three of the CAD parts. Then, I create the domain selections for the bone and the teeth. The selections here are colored for visibility.
Joining the domains of the abutment (blue) using the imported selections from CAD (left). The colors of domain selections are also shown on the cross-section faces in the Clip Plane (right).
Generating a Computational Mesh
The last step is to generate a computational mesh. I’ll do this in the Mesh 1 node in the model, and I can choose to generate either a physics-controlled mesh or a user-controlled mesh. I’ll leave the task of setting up any physics as an exercise for you — which means that the physics-controlled mesh shown below was generated based on a general assumption of what constitutes a good mesh but also on an analysis performed on the mesh-based geometry to resolve curvature and small details.
The mesh at the beginning of this example was a very coarse linear mesh imported from an STL file; however, now we have a computational mesh of good quality, and COMSOL Multiphysics® will curve the elements when needed. For example, if you added the Solid Mechanics interface and solved using the mesh shown below, the Quadratic serendipity shape functions would be used.
A sample physics-controlled computational mesh, ready to be used in a study.
Next Steps
In this blog post, I demonstrated the process of combining imported CAD with an imported STL mesh in COMSOL Multiphysics®. To do this, I used mesh operations in a Mesh-Based Geometry sequence. If you haven’t already, you can download the model file, Combining CAD Geometry with Meshes in COMSOL Multiphysics® to try it out yourself. (Note that using this file requires a license for the CAD Import Module, the Design Module, or any of the LiveLink™ products for interfacing with CAD programs.)
For more information about this topic and related areas of modeling, check out these resources:
- To learn more about combining STL meshes with geometry created in COMSOL Multiphysics®, refer to the:
- STL Import Tutorial Series
- Spray Particle Deposition in Human Airways tutorial model
- Examples in the blog post Generating a Simulation Mesh of a Femur From 3D Data
- Watch this video on editing and repairing STL meshes and combining them with CAD files.
- Browse this comprehensive blog series on modeling irregular shapes.
Reference
- kbrowne, “Skull and Eyes – Visible Human Male. Version 1.03,” NIH 3D, 12, Apr. 2026; https://3d.nih.gov/entries/3DPX-020591.

Comments (0)