How to mesh a real geometry
Hydac USA in Bethlehem, Pa., which provides fluid-power products, recently decided to assess computational fluid dynamics (CFD) software to analyze flow in models. But the company was having preprocessing difficulties dealing with CAD geometry as is. A challenge was to generate sufficient boundary-layer resolutions.
The flow path between the diffuser at the end of the oil-filter inlet (small-diameter horizontal tube) and main filter body (large-diameter vertical tube) is complex. The steps to meshing such a geometry show how real-world problems of this type typically proceed. (At the end of each step, we provided a count of the main Pointwise operations (PW), the keyboard strokes/mouse clicks (KM), and an estimate of the time for that step.)
1. Import native CAD file. The meshing software can import native CAD formats, including SolidWorks (part and assemblies), immediately solving Hydac’s first set of problems. There was no need to use an intermediate CAD format such as IGES, and Hydac could mesh directly on analytic CAD surfaces.
Model size tolerance is an important consideration when importing CAD files into the software. Pointwise recommends adjusting the model-size tolerance to within about an order of magnitude of the largest spatial dimension of the geometry. Setting the appropriate model-size tolerance helps the software’s geometry kernel interpret and process the geometric information with the highest accuracy. To maintain maximum integrity, this step must take place before importing the geometry. In this case, we set the tolerance to 1.0. (PW: 2; KM: 9; Time: 20 sec)
2. Check integrity of solid model. An important benefit of using native-CAD files is the capability to exploit the information in the solid model about how the surfaces stitch together. But even when using native CAD files, it is a good idea to check whether the solid model is watertight. When the solid model is watertight, the software shows a single model (all surfaces green) and zero lamina boundaries (red edges). When the solid model is not watertight, the tolerance can be tighter to close the gaps. (The Hydac oil-filter model was watertight.) (PW: 1; KM: 5; Time: 20 sec)
3. Reorganize surfaces. The arrangement of the surfaces created by the CAD software is often not optimal for meshing. For example, the body of the filter tube contains four surfaces, but probably only one surface-mesh patch suffices to represent the whole tube. Quilting, a feature in the meshing software, lets users redefine the meshing regions from the original CAD surfaces to something more meaningful. In the filter tube example, the goal was to have the software create one surface mesh patch on all four filter tube surfaces. This maneuver consisted of quilting the four surfaces into one logical meshing region. A simpler grid topology and higher mesh quality results from not requiring the grid boundaries to follow all the CAD topology. (PW Ops: 1; KM: 16; Time: 120 sec)
4. Set meshing defaults. Now that there is a solid model with a more logical arrangement of meshing regions, it is possible to apply an unstructured surface mesh to the model. The first step is to set some default meshing parameters. Although there are many parameters, users need only be concerned with two connector parameters and three unstructured domain parameters. The connector “Average ds” value is used to determine the number of points on subsequently created connectors. In this case, the appropriate values were 0.001 for Average ds and 15° for maximum angle.
The unstructured domain parameters that were changed are boundary decay, minimum edge length, maximum edge length, and maximum angle. We boosted the boundary decay value to 0.85, minimum edge length to 10times smaller than the connector spacing, and the maximum edge length to twice of the length of the connector spacing. Last, we set the maximum angle for domains equal the connectors, 15°. (PW: 0; KM: 25; Time: 30 sec)
5. Mesh the model. Because the pertinent meshing parameters are set, the model can be meshed with a single mouse click. The software creates one surface mesh for each quilt generated in Step 3. (PW: 2; KM: 3; Time: 15 sec)
6. Adjust resolution of surface meshes. Setting default meshing parameters helps create the appropriately refined surface meshes, but the surface mesh often needs additional adjustment. The maximum internal edge length had to lengthen to 0.004 to reduce the resolution of the filter body surface mesh. Finally, we reduced the connector spacing on the inlet and outlet connectors to better match the internal edge spacing. (PW: 2; KM: 20; Time: 40 sec)
7. Assemble unstructured block. The process of creating a volume mesh in the software consists of assembling the collection of surface meshes into a block. Because the surface meshes are watertight (the model was watertight), a single click created the block. (PW: 1; KM: 3; Time 5 sec)
8. Generate volume mesh with T-Rex. Creating a volume mesh also involves initializing the block with T-Rex, a technique for extruding regular layers of high-quality tetrahedra from boundaries. T-Rex is the best approach for generating boundary layer meshing in an automated fashion. (For more information, see www.pointwise.com/T-Rex.) Simply set a few T-Rex parameters, apply meshing boundary conditions, and initialize the block. TRex does the rest.
To create a T-Rex volume mesh, first select an unstructured block(s) and navigate to the Grid, T-Rex panel. Next, set the T-Rex parameters. Then, create the T-Rex boundary conditions. Finally, initialize the block.
In this case, we had to modify three parameters: the maximum number of mesh layers in the boundary layer (Max. Layers), the number of complete layers (Full Layers) and the growth rate. We chose 15 for the maximum layers, 2.0 for full layers, and 1.25 for growth rate.
A Push Attributes option pushes the boundary layer attributes from the volume mesh down to the surface grids to maintain consistency with the T-Rex boundary conditions. This is useful when the computational domain has a symmetry plane cutting through the boundary layer. It is also useful when some other boundary of the domain cuts through the boundary, as is the case at the inlet and outlet of the oil filter.
Next, we set boundary conditions to control the behavior of the volume mesh on the surface patches. We set two different boundary conditions for T-Rex: the surface patches from which to grow layers (solid walls) and the surface patches that cut through the boundary layer (inlet and outlet). The goal is to grow layers from all the patches except the inlet and outlet. They are assigned to the Match boundary because they cut through the boundary layer. For the Solid Walls boundary condition, we assigned an initial ds of 4.0E-5.
At this point, the volume mesh can be initialized with the click of a button. The final mesh contains a little less than 4 million cells and, depending on the user’s hardware, takes roughly 2 min. (PW: 1; KM: 39; Time: 240 sec)
9. Set CAE boundary conditions. Before exporting the mesh to the CFD solver, CAE boundary conditions must be applied. This operation resembles setting up T-Rex boundary conditions. For simplicity, three CAE boundaries were created: inlet, outlet and filter-body. Because it is also possible to assign type to a CAE boundary condition, however, the appropriate CAE solver must be set first. For the Hydac case, we used the OpenFoam CFD solver. (PW: 2; KM: 26; Time: 90 sec)
10. Export CAE files. Finally, export the mesh. Because we used the Open- Foam solver, Pointwise exports the four necessary files describing an Open- Foam mesh. CAE export contains a key feature called prism combination when using T-Rex volume meshes. Although the T-Rex algorithm only generates tetrahedral elements, triangular prisms can be recovered. This helps reduce cell count in removing the stretched T-Rex tets that most solvers don’t like. Typical cell count reductions are in the 50 to 60% range.
Prior to export, the volume mesh contained 3,885,601 cells (only tets). After prism recombination, the volume mesh contained 1,667,580 cells, a reduction of 57%, of which more than half are prisms. (PW: 1; KM: 8; Time: 30 sec)
In this meshing process, no steps were skipped. The geometry was new to the analyst, so this is not a “canned” demonstration case. The steps described are representative of the type of workflow users experience with Pointwise.