Share This Article
Revisiting Output-Based Mesh Adaptation
Why Mesh Adaptation?
Improvements in computational capability, access to High Performance Computing (HPC) resources, and open-source tools have recently contributed to the prevalence of computational fluid dynamics (CFD) and its widespread adoption across several diverse industries. CFD simulations that leverage sophisticated physical models are regularly used throughout product development to help shape and refine the overall final prod-uct’s design.
Ensuring computed solutions are sufficiently accurate with respect to the physical sys-tem being modeled is often left to the computational analyst to determine. Even for rela-tively standard simulations, questions often arise as to the robustness with which CFD methods can accurately compute engineering metrics of interest. Numerical errors can often be directly traced to the configuration of the underlying mesh and orientation of individual and neighboring cells used in calculating a solution. A priori mesh quality assessments can be useful in identifying poor quality cells, but ascertaining whether a given mesh is good is far more challenging, particularly when complex geometry and flow physics are involved. To make matters worse, one mesh configuration may be more suitable for accurately representing a given engineering metric like pressure drag, while another configuration is used to reliably predict a different metric such as shock propa-gation as depicted in Figure 1.
Figure 1: Mesh adaptation of a diamond airfoil for two different objective functions. This helps illustrate that uniformly reducing discretization error is not ideal, because some errors are more important to different engineering metrics than others .
One approach that helps aid in reducing numerical errors is by changing the mesh in re-sponse to the developing flow solution. This technique is typically referred to as adap-tive mesh refinement, or simply mesh adaptation. While not new, application of mesh adaptation tends to be somewhat limited to only a few specialists throughout academia and industry who regularly employ it successfully. However, they continue to demon-strate time and again that error estimation and adaptive methods are critical components for improving the reliability of computational simulations efficiently and reliably. Giv-en these advantages, why is mesh adaptation not used more regularly within the CFD community? To answer this question, and get a better idea of what is involved when in-corporating mesh adaptation into the typical CFD simulation setup, we took a closer look.
Overview of the Mesh Adaptation Process
Metric-based mesh adaptation typically involves two steps. The first step is to construct a metric that describes the desired size and anisotropy of the adapted grid elements. The second step is to produce an adapted grid that is based on this metric. There are several methods in the literature for how this metric is formulated, but they typically fall within one of two categories: local error based or output based. Local error based adaptation constructs the metric based on properties of the flow solution; whereas, output based mesh adaptation constructs the metric from both flow and adjoint solutions to reduce estimated errors in a specific engineering metric. The differences between these two ap-proaches are illustrated in Figure 2.
The grid can be adapted in various ways as well. Many mesh refinement schemes simply add isotropic cells (hexahedra or tetrahedra) to resolve some gradient detected within the flow solver (i.e. local error based adaptation). Other schemes are capable of much more including parallel insertion and movement of nodes, collapsing and swapping cells, anisotropic stretching, support for time-accurate simulations, and more in order to iteratively drive mesh refinement and satisfy some anisotropic metric.
A Case Study
To better understand some of the nuances involved when using mesh adaptation, a small case study was devised to incorporate output based mesh adaptation to solve the flow around an ONERA M6 wing. Designed in 1972 by the ONERA Aerodynamics Depart-ment as an experimental geometry for studying three-dimensional, high Reynolds num-ber flows, the ONERA M6 is a widely known wing geometry that serves as a reference model for validating new numerical methods and CFD codes due to the availability of empirical data and intriguing flow features. A description of the wing geometry and sin-gle flow condition used in this exercise are shown in Figure 3 and Table 1, respectively.
Pointwise is used to create an unstructured surface mesh using anisotropic triangles along the leading and trailing edges of the wing to resolve the wing's curvature with an efficient number of cells. A spherical farfield boundary is created a distance 20 mean aerodynamic chord lengths away from the center of the root chord. The volume grid is initialized using Pointwise’s T-Rex (anisotropic tetrahedral extrusion) advancing layer extrusion technique. T-Rex marches layers of anisotropic tetrahedra from the surface grid at a constant growth rate until the tetrahedra reach isotropy, and then the interior volume is filled with isotropic tetrahedra. This provides a smooth transition from these high-quality, right-angled tetrahedra used for boundary layer refinement into isotropic tetrahedra in the volume’s interior.
For the ONERA M6 Wing, an initial normal wall spacing of 6.5e-05 inches (y+ = 1) is enforced, and a constant cell growth rate of 1.2 applied. T-Rex marched 38 full layers of tetrahedra normal to the surface mesh. Figure 4 shows the near-wall mesh created in Pointwise.
Figure 4: A constant x-plane cut through the mesh that highlights near body, right-angled tetrahedra cells created using Pointwise's T-Rex advancing layer technique. Meshes created in Pointwise can be natively exported to over 60 flow solvers including FUN3D.
For output-based mesh adaptation, NASA Langley's FUN3D software is used. FUN3D consists of both a node-based finite-volume flow solver, adjoint solver, and libraries for metric-based grid adaptation. In this case study, FUN3D's built-in refine library for met-ric-based grid adaptation is used. The metric tensor, M, for mapping the physical grid space into a computational space where everything is isotropic is reconstructed using a Hessian based on Mach number as shown in Equation 1.
Here 1/h1/2 are the eigenvalues of the symmetric positive definite matrix which denote sizing requests in each of the three principal directions along with corresponding eigen-vectors, X that describe an orthonormal basis with length specifications, hi .
FUN3D's mesh adaptation mechanics only support adaptation of simplex cells; and therefore, other cell types are ignored. FUN3D’s developers recommend freezing anisotropic cells near solid wall boundaries for best results based on earlier experience. From this advice, cells that are an equivalent distance of y+ = 100 (i.e. ∆s = 0.00582 inches) from solid wall boundaries were fixed in place and not modified by FUN3D's mesh ad-aptation library. While FUN3D’s flow solver provides support for wall functions, the adjoint solver does not. Accordingly, both were run using a Spalart-Allmaras turbulence model with an initial y+ = 1 spacing specified normal to solid wall boundaries. FUN3D also supports several engineering metrics to be used as objective functions in error estimation. If none of the built-in metrics are suitable, then the ability to formulate your own exists. For this example, the lift-to-drag ratio, L/D was chosen.
The simulation was run for ten adaptation cycles. A plot of the residual history from FUN3D's flow solver for all 10 cycles is shown in Figure 5a. Each uptick in the residuals corresponds to the beginning of one mesh adaptation cycle. In Figure 5b, N is the number of grid points in the mesh for the given adaptation cycle. As mesh adaptation continues, the number of points that FUN3D is permitted to insert into the mesh is restricted. This helps to avoid exceeding available computational resources by limiting the total number of points in the resulting adapted mesh at each step. It also helps reduce execution time on initial grids by keeping them smaller. As the number of points in the mesh is gradually increased (i.e. moving from right to left along the abscissa in Figure 5b), the solver converges to an asymptotic value for the objective function as one might expect when performing a grid refinement study.
The final adapted mesh at a constant y-plane is shown in Figure 6. The mesh shows some additional clustering and stretching of cells coincident with a shock on the upper wing’s surface. Cell clustering is also apparent at both leading and trailing edges.
Figure 7 shows a comparison of surface pressures plotted at several spanwise locations along the wing for the adapted tetrahedral mesh and empirical data gathered from NASA’s ONERA M6 Wing Validation Archive. Overall the numerical solution matches fairly closely to the available empirical data, and the solution tracks the shock on the upper wing’s surface at each constant spanwise cut pretty closely.
Mesh adaptation seems like an invaluable addition to every CFD practitioner’s set of tools, and could perhaps save users time over traditional grid refinement studies while delivering improved accuracy for a valued engineering metric. Mature implementations provide plenty of options to help control the overall mesh size and stretching of cells, while expanding access to, and increasing capabilities of, HPC resources should make adopting mesh adaptation techniques more reasonable than ever. If you are not already using mesh adaptation in your CFD process, then perhaps it is worth revisiting. Share your experiences with mesh adaptation, and send us your thoughts to firstname.lastname@example.org.
Try Pointwise Yourself
If you would like to generate your meshes using Pointwise request a free evaluation today.