Accurate simulation of viscous flows requires a mesh that resolves the boundary layer. Resolution in this context implies a sufficient number of cells to capture the gradients across the boundary layer, a smooth variation in cell-to-cell size ratio across the boundary layer, a sufficiently small near-wall spacing, orthogonality of the transverse grid lines to the walls, and well-shaped cells. The manner in which this resolution is achieved varies with meshing technique. This article describes a new optimization-based smoother in Pointwise that can be applied to advancing layer techniques on meshes of mixed cell types (i.e. extruding a mix of prisms and hexahedra).

For structured hexahedral grids, one of the earliest meshing techniques, transfinite interpolation, was shortly followed by elliptic PDE smoothing methods. Iterative solution of an elliptic PDE moves the grid points subject to prescribed forcing functions to achieve smoothness, clustering, and orthogonality to solid walls. Elliptic PDE smoothing is a boundary value problem requiring all boundaries of the grid to be predefined.

On the other hand, a hyperbolic PDE meshing technique is an initial value problem that extrudes a grid from a given, initial starting grid (e.g. a line when extruding a surface grid or a surface when extruding a volume grid). Hyperbolic PDE techniques require extensive smoothing to ensure that the extruded mesh does not fold onto itself, especially in the presence of geometric concavities.

For a summary of Pointwise's structured grid techniques see *Quality and Control – Two Reasons Why Structured Grids Aren't Going Away* in the March/April 2013 issue of The Connector.

When it comes to generating hybrid meshes, Pointwise includes two techniques: traditional algebraic extrusion and anisotropic tetrahedral extrusion, also known as T-Rex. Both techniques start from a tri or quad mesh and march outward, creating layers of cells (prisms and hexahedra, respectively). T-Rex is an advancing layer technique that marches each grid point on the extrusion front outward in a direction that is nominally orthogonal to the wall and with step sizes prescribed to achieve the proper boundary layer resolution. The anisotropic tetrahedra produced by joining each extruded point back to the extrusion front are combined to form stacks of prisms or hexahedra. T-Rex includes extensive smoothing methods to control the extrusion trajectory, adjust cell shapes, and avoid collisions with other extrusion fronts.

For more information on T-Rex, see *Construction of Prism and Hex Layers from Anisotropic Tetrahedra*, (AIAA-2015-2296) by John Steinbrenner.

Algebraic extrusion in Pointwise consists of defined trajectories for the mesh to follow including extrusion along a line, rotation around an axis, along a user-prescribed path, and normal to the initial mesh, the latter useful for extruding layers of prisms from a triangular mesh in a manner that mimics the behavior of the hyperbolic PDE method for extruding hexahedra from quads. A variety of smoothing options is necessary to ensure that the algebraic techniques generate a non-folded mesh simply due to the fact that they lack an elegant mathematical basis like the PDE methods.

The introduction of mixed-cell grids (i.e. surface grids that contain both triangles and quads, volume grids that contain tetrahedras, hexahedra, pyramids, and prisms) in Pointwise Version 18 required a new implementation of smoothing in the extrusion methods to account for cell-to-cell variation in type. In addition to supporting mixed cell types in the same grid, the goal of the new smoothing was to optimize element shape and size to ensure good boundary layer resolution.

The new smoothing method is based on optimization of a cost function related to element quality. In particular, a cost function is defined at each mesh cell's corners as follows, where WCN is the weighted condition number and J is the Jacobian.

Note that the Jacobian only comes into play for inverted corners and is computed as the determinant of a 3x3 matrix created by columns of the edge vectors E, F, and G shown in Figure 1.

Consider the prism shown in Figure 1 for which computations are being made at the lower left corner.

WCN is computed from two components: a matrix A created from the cell's actual edges (Figure 1) and matrix W that transforms a right-angled corner with unit edge lengths into the desired corner shape with the desired physical edge lengths. The two quantities in the numerator of the WCN equation below are the Frobenius norms of the matrix products.

The formulation of matrix W is illustrated in Figure 2. The parameters U, V, W, and θ are derived from the desired shape of the extruded cell. The height W is the marching step size and is usually much smaller than U and V. Therefore; the weight matrix W is computed as

For a prism, consider computation of the weight matrix W for its bottom and top faces as illustrated in Figure 3. For the bottom face (left), U, V, and θ are obtained from the extrusion front (layer k). W is perpendicular to the bottom face with a length equal to the extrusion step size at that location. For the top face (right), U, V, and θ are computed in a manner that influences the mesh to be optimal. In particular, U and V for layer k+1 are set to the average of their counterparts on the bottom face (layer k) and θ is set to π/3.

Computation of the weight matrix W for hexahedra proceeds in a manner similar to the computation for prism described above. Referring to Figure 4, the edge lengths U and V on the top face (layer k+1) are the average of the edge lengths on the bottom face (layer k). The angle θ is π/2. Together these tend to influence the extrusion to achieve square faces.

Keeping in mind that a goal of the current work is to smooth extrusions from a front consisting of both- triangles and quads (i.e. extruding prisms and hexahedra side by side) the perturbation of each node on the advanced layer has to be smoothed to account for competing effects of different cells types. This is accomplished by summing the sensitivity vectors (i.e. the coordinate derivatives of the cost function) and then blending the minimum and average cost vectors to obtain the final perturbation of the point. As shown below, the multiplying factor MF is an exponential function of the minimum (worst) cost function where the exponent P typically takes on values of 0, 1, or 2. When P=0, the worst cost value drives the point's perturbation. When P<1, the minimum perturbations have the stronger influence, while P>1 gives more weight to the average.

Smoothing on the advanced layer is also limited by the extrusion step size h which corresponds to the vector W in Figure 3 and Figure 4. This is done because the step size is usually significantly smaller than the edges U and V of the base cell and prevents possible inversions of the cell. The factor ωis typically 0.5.

Smoothing is iterative, and typically 5-200 iterations are used. Enforcement of the normal spacing is built into the cost function along with the desired shape or quality.

The ONERA M-6 wing is a slightly swept, low aspect ratio wing with rounded tip, and sharp trailing edge. A surface mesh consisting of zones of quads (for leading and trailing edge resolution) and triangles is shown in Figure 5. Algebraic extrusion using the normal method was applied with first step height of 0.0001 and step size growth rate of 10 percent per step.

Forty layers were extruded using 50 smoothing iterations per step for both P=0 and P=2 as shown in Figure 6. For the P=0 case (left), the smoothing is biased toward the worst cost function while the P=2 case (right) has smoothing biased toward the average cost function.

Views of the symmetry plane regions at the wing root of the same extruded grids are shown in Figure 7. The wiggles for the P=0 case (left) are a result of biasing the smoothing to the worst cost function which in this case is enforcement of the symmetry plane condition. The grid for the P=2 case (right) is smoother because it is biased toward the average cost function.

The finned store from the Eglin mutual interference experiment was meshed with all triangles and prisms extruded as a test of the new smoothing method's ability to handle convex regions such as the fin-body Junction. The outer extrusion fronts after 25 steps are shown in Figure 8 for 100 smoothing sweeps with smoothing exponent P set to 0, 1, and 2. The P=2 case (bottom) indicated nine prisms with inverted corners in the region near the fin trailing edge while the P=0 and P=1 cases identified no problem elements. This is due to the lower exponents biasing toward repair of the worst cost function.

Pointwise Version 18 with this new smoothing method in the algebraic extrusion normal method is coming soon. In the interim, we continue to work on the method for other types of mixed cell grids such as quad dominant (also coming in Pointwise V18). If you would like to try Pointwise extrusion techniques to resolve the boundary layers in your viscous CFD simulations, request a demo license today.

This work was originally published by Steve Karman and Mike Remotigue as *Optimization-Based Smoothing for Extruded Meshes*, AIAA-2016-1671 and presented at the AIAA SciTech 2016 event in San Diego, January 2016. All references in this article to work by other researchers may be found in this paper.