From CAD to CFD in Five Minutes: The Complete Story of Meshing a Real Geometry Using Pointwise
By Chris Sideroff, Pointwise Technical Sales Engineer
Customers have written many articles about how they apply Pointwise for their real applications. We have written many articles describing benefits about the features in Pointwise. However, these articles rarely describe the full meshing process in any detail. In this article, I will describe in detail the steps required to go from CAD import to completed mesh in Pointwise. I will also tabulate the number of Pointwise operations, a count of keyboard and mouse clicks, and the time needed.
HYDAC USA, a leader in fluid power, offers a complete range of hydraulic products. To maintain its position as a market leader, HYDAC invests in research and development technologies such as CFD. HYDAC recently evaluated Pointwise to help overcome some of the preprocessing difficulties it was having with its current tool set. Specifically, HYDAC wanted to improve two aspects of preprocessing: dealing with CAD geometry as-is and generating sufficient boundary layer resolution. The investigation began when Pointwise agreed to provide a demonstration mesh on an realistic oil filter geometry provided by HYDAC. The geometry is seen in Figure 1.
Figure 1: Hydraulic oil filter geometry as imported from SolidWorks. Flow enters from the right and is filtered in the large vertical body in the center. Interior details are not shown for proprietary reasons.
For proprietary reasons, the internal components cannot be shown, but the flow path between the diffuser at the end of the inlet (small diameter horizontal tube on the right) and main filter body (large diameter vertical tube in the middle) is complex.
Before describing the steps to go from CAD to CFD, I will briefly outline the general process in Pointwise:
At the end of each step, I will show a count of the main Pointwise operations (PW Ops), the keyboard strokes/mouse clicks (KB/MS), and an estimate of the time for that step.
1. Import Native SolidWorks File
The ability to import native CAD formats, including SolidWorks (part and assemblies), is bundled with every Pointwise license. Importing native CAD directly avoids the need for an intermediary neutral format, such as IGES. This solved the first set of issues for HYDAC – avoiding the need to use an intermediate CAD format and gaining ability to mesh directly on analytic CAD surfaces. Importing native CAD is the same process as importing neutral CAD formats in Pointwise. From the File menu, select Import, Database. Pointwise recognizes the correct format based on the file extension. In this case, SolidWorks part files end with .sldprt.
The model size tolerance is an important consideration when importing CAD files into Pointwise. We recommend adjusting the model size tolerance to within about an order of magnitude of the largest spatial dimension of the geometry. This parameter is found in the File menu under Properties (Figure 2). Setting the appropriate model size tolerance helps Pointwise's geometry kernel interpret and process the geometric information with the highest possible degree of accuracy. In order to maintain maximum integrity, this step must be performed prior to importing the geometry. If you do not know the actual model size, import the geometry using the default model size tolerance, record the value from the File, Properties panel, undo the import, set the appropriate model size tolerance and re-import the CAD file. Here, I set the model size tolerance to 1.0.
PW Ops: 2; KB/MS: 9; Time: 20 seconds
Figure 2: Tolerances Pane in the Properties panel
2. Check Integrity of Solid Model
An important benefit of using native CAD files is the ability to retain the solid model. Pointwise can import the solid model and exploit the information it contains about how the surfaces are stitched together. Even when using native CAD files, it is a good idea to check to see if the solid model is watertight. This is carried out in the Create, Assemble, Models panel by selecting the model and clicking Assemble. If the solid model is watertight, there should be a single model (all surfaces green) and zero lamina boundaries (red edges). If the solid model is not watertight, the tolerance can be increased to automatically close the gaps. In drastic cases, some additional geometry operations may have to occur to achieve a watertight assembly. As seen in Figure 3, the HYDAC oil filter model was found to be watertight without additional steps.
PW Ops: 1; KB/MS: 5; Time: 20 seconds
3. Reorganize Surfaces
Quite often the arrangement of the surfaces created by the CAD software is not optimal for meshing. For example, the body of the filter tube is made up of four surfaces, but we probably only need one surface mesh patch to represent the whole tube. The complementary capability to Pointwise's solid modeling is quilting. Quilting allows the user to redefine the meshing regions from the original CAD surfaces to something more meaningful. In the filter tube example, we want Pointwise to create one surface mesh patch on all four filter tube surfaces. This is accomplished by quilting the four surfaces into one logical meshing region. By not requiring the grid boundaries to follow all the CAD topology, we end up with a simpler grid topology and higher mesh quality.
The quilt assembly feature has the ability to automatically assemble the quilts based on an angle criterion. The angle is defined as angular deviation between the normals of the adjacent surfaces. For the HYDAC oil filter, using a combination of automatic quilt assembly and manual selection, I regrouped the quilts into a more logical arrangement. For the automatic assembly, I chose a relatively shallow angle of 20 degrees and then manually created quilts two specific regions inside the filter. Figure 4 shows the arrangement of the surfaces before (left) and after (right) the quilt assembly. Before quilt assembly, there were 83 meshing regions. After quilt assembly, there were 33.
PW Ops: 1; KB/MS: 16; Time: 120 seconds
4. Set Meshing Defaults
Now that there is a solid model with a more logical arrangement of meshing regions, we are ready to apply an unstructured surface mesh to the model. To facilitate this, some default meshing parameters need to be set. Default parameters are found in the Defaults panel (Figure 5). Although there are many parameters, the only ones we are concerned with are two connector parameters and three unstructured domain parameters. The connector Average Δs value is used to determine the number of points on subsequently created connectors. I found a value of 0.001 was appropriate. The connector maximum angle value ensures the turning angle between adjacent intervals is not greater than the chosen value, i.e. it will insert points until the angle is less than the chosen value. I chose a value of 15 degrees.
The unstructured domain parameters that I changed are boundary decay, minimum edge length, maximum edge length and maximum angle. Boundary decay controls the influence of the boundary spacing on the internal domain edge length. I increased the value from a default of 0.5 to 0.85 (the range is 0 to 1). The minimum edge length is a lower bound on the internal edge length when using the maximum angle parameter. I chose to use a value 10 times smaller than the connector spacing. The maximum edge length is a target value for the interior edge length. I chose a value twice as large of the connector spacing. Lastly, I set the maximum angle for domains the same as connectors, 15 degrees.
PW Ops: 0; KB/MS: 25; Time: 30 seconds
Figure 5: Setting default meshing parameters
5. Mesh the Model
Now that the pertinent meshing parameters are set, the model can be meshed. This is a very easy operation. Simply set the mesh type in the toolbar to unstructured, select the model, click the Domains on Database toolbar button and wait for the surface mesh to be generated. Pointwise will create one surface mesh for each quilt created in Step 3 (Figure 6).
PW Ops: 2; KB/MS: 3; Time: 15 seconds
6. Adjust Resolution of Surface Meshes
Setting default meshing parameters helps create the appropriately refined surface meshes in the initial creation, but there are often instances in which some additional adjustment of the surface mesh is warranted. One example in this case is the over-resolution of the filter body surface mesh. To reduce the resolution of the filter body surface, the maximum internal edge length needs to be increased. To do this type of operation, select the surface mesh(es) and adjust the parameters in the Solve panel in the Grid menu. The meshing parameters are defined in the Attributes tab in the Solve panel. For the filter body surface mesh, I changed the maximum edge length to 0.004 and re-initialized the domain.
A final adjustment I made was to reduce the connector spacing on the inlet and outlet connectors to match the internal edge spacing. To do this, select the four connectors at the inlet and outlet, go to the Dimension panel in the Grid menu, and enter a value of 0.002 for Average Δs. Note that the surface meshes are updated automatically by changes to the connector grid point distributions.
PW Ops: 2; KB/MS: 20; Time: 40 seconds
7. Assemble Unstructured Block
Creating a volume mesh in Pointwise is a two-step process. The first step in the process is to assemble the collection of surface meshes into a block. Since the surface meshes are watertight (because the model was watertight), block assembly is straightforward. Start by masking all entities except domains for selection (Tip: the domain mask shortcut key is F10), next select all the domains (Tip: Ctrl+A is the shortcut for select all) and finally push the Assemble Blocks button on the toolbar.
PW Ops: 1; KB/MS: 3; Time 5 seconds
8. Generate Volume Mesh with T-Rex
The second step in the volume meshing process is to initialize the block. In this case, since we want to resolve the boundary layer near the surface, I am going to do that with T-Rex. I am not going to describe all the characteristics of T-Rex, as we have many existing materials describing how it works, and will only say it is the best approach for generating boundary layer meshing in an automated fashion. You simply need to set a few T-Rex parameters, apply meshing boundary conditions and initialize the block. T-Rex will do the rest.
The general steps to create a T-Rex volume mesh are
In this case, I select the one and only block and enter the T-Rex tab in the Grid panel (Figure 7). In the Layers frame, I need to modify three parameters. The first is the maximum number of mesh layers we want in the boundary layer (Max. Layers). Recall that T-Rex will automatically stop layer growth locally once the cells become isotropic, so this parameter is more of an upper limit on the number of layers rather than a target. I generally set it larger than the desired number of layers so the T-Rex layers can keep growing until they become isotropic and provide a nice, smooth transition to the isotropic tetrahedral grid that will fill the remainder of the volume. I chose 15 for the maximum layers.
Figure 7: T-Rex parameters
The Full Layers parameter specifies how many complete layers are desired in the boundary layer region. This parameter is helpful if your solver requires complete layers of prisms, for example, for the turbulence model wall functions. I prefer to have at least two complete layers in the mesh. Note: There is no guarantee that T-Rex will be able to create complete layers. It only relaxes some of the quality checking methods to attempt to create the specified number of full layers. T-Rex will always stop layer growth if a negative volume will result.
The Push Attributes option, as the name implies, will push the aforementioned boundary attributes from the volume down to the surface grids and connectors to be consistent with the T-Rex boundary conditions you have set. This is useful when your computational domain has a symmetry plane cutting through the boundary layer or when some other boundary of the domain cuts through the boundary, as is the case in this example at the inlet and outlet. Push Attributes only applies to surface patches that have the Match boundary condition applied to them.
For the last parameter in this frame, the Growth Rate, I chose to use 1.25. This specifies how the layer height grows from one layer to the next.
Having a priori knowledge of the resulting mesh, I modified two additional parameters: Collision Buffer and Skew Criteria Maximum Included Angle. The collision buffer controls how close two layers can approach before they stop extruding, as is the case in the internal components of the HYDAC oil filter. I chose 2.0 for Collision Buffer. The maximum included angle criterion prevents the creation of boundary layer cells with a maximum included dihedral angle larger than the specified value. I chose a value of 160 degrees for Skew Criteria Maximum Included Angle. I refer you to the Pointwise User Manual or our technical support staff for a more complete description of these parameters.
The next step is to set boundary conditions for the behavior of the volume mesh on the surface patches. The boundary conditions are set in the Boundary Conditions tab while still in the Solve panel (Figure 8). I need to set up two different boundary conditions for T-Rex: the surface patches I want to grow layers from (solid walls) and the surface patches that cut through the boundary layer (inlet and outlet). The following outlines steps to do so for the walls:
To apply the second type, create another new boundary condition, assign only the inlet and outlet patches, change the name to Inlet Outlet set the Type to Match. It is the surface patches in this boundary condition on which Push Attributes option acts.
Now that the necessary parameters have been applied, go back to the Solve tab, push the Initialize button at the bottom of panel and the volume mesh will be created (Figure 9). The final mesh contains a little less than 4 million cells and takes, depending on your hardware, roughly 2 minutes. Once it is finished click OK to exit the Solve menu.
PW Ops: 1; KB/MS: 39; Time: 240 seconds
9. Set CAE Boundary Conditions
Prior to exporting the mesh for our CFD solver, the CAE boundary conditions need to be set up. This task is performed in an analogous manner to setting up T-Rex boundary conditions. For simplicity, I only created three CAE boundaries: Inlet, Outlet and Filter-Body. However, because we can also assign type to a CAE boundary condition, the appropriate CAE solver needs to be set. Go to the Select Solver panel in the CAE menu and choose OpenFOAM®. Click OK.
The CAE boundary conditions can now be created, surface mesh patches assigned to them and the name and type can be changed. Go to the Set Boundary Conditions panel in the CAE menu, select all the surface mesh patches except the inlet and outlet, push New, change the name to Filter-Body, and change the type to wall. Create another new boundary condition, assign only the inlet patch to it, change the name to Inlet, and change the Type to patch. Follow the last steps for the outlet patch. The Set Boundary Condition panel and Pointwise display should look similar to Figure 10.
PW Ops: 2; KB/MS: 26; Time: 90 seconds
10. Export CAE Files
The final step is to export the mesh. In this case, because we chose OpenFOAM as our CAE solver, Pointwise will export the four necessary files describing an OpenFOAM mesh into the user-chosen directory. However, you may ask the question, “Why is he describing something as trivial as exporting the mesh?” Because CAE export contains a critical feature when using T-Rex volume meshes called prism combination. In short, while the T-Rex algorithm only generates tetrahedral elements, it stores information that enables the combination of triplets of adjacent boundary layer tetrahedrons into one triangular prism. This has two very important benefits. The first and most obvious is a significant reduction in cell count. The theoretical maximum would be a 67 percent reduction in cells, if all the cells were T-Rex tets and all the T-Rex tets could be combined (three tets per prism). Typical cell count reductions are in the 50-60 percent range – still very significant. The second, less obvious benefit, is that the long, hypotenuse faces of the stretched T-Rex tets have been removed, leaving faces either normal or tangential to the wall. Normal or tangential faces are highly preferred by the majority of CFD solvers.
To perform the export and prism combination, select the block, go to CAE in the File, Export menu, select a directory in which to save the files, enable the Combine Anisotropic Tetrahedra option and push Save. This step, in unison with T-Rex, solved the second issue HYDAC was having previously: reliably creating a boundary layer resolved-volume mesh with the complex internal flow path of the filter.
Figure 11 shows a summary of the resulting prism combination when exporting the HYDAC oil filter mesh to OpenFOAM. Prior to export, the volume mesh contained 3,885,601 cells (only tets). After prism combination, the volume mesh contained 1,667,580 cells, a reduction of 57 percent, of which more than half are prisms.
PW Ops: 1; KB/MS: 8; Time: 30 seconds
The final tally on our data collection:
No steps were skipped. I should also note that, since I was provided this geometry by a customer I had no prior knowledge of its character, i.e. it is not “canned” demonstration case. I feel I was conservative on the total time, but it depends on the speed of your hardware and how quick you are with keyboard and mouse input. The steps I have described are representative of the type of workflow a user experiences with Pointwise. Pointwise is flexible and efficient, yet it does its work without sacrificing control.
I would like to thank Jim Cardillo at HYDAC for allowing the use of the hydraulic oil filter geometry in this article.
Try it For Yourself
Find out how many minutes it takes to generate your mesh using a free trial license of Pointwise. Start the process today.