Internal:Next Generation Boundary Layer

From crtc.cs.odu.edu
Jump to navigation Jump to search

Objectives

- Review boundary layer functionality implemented by Inria (sequential).
- Do a literature review of AFLR's Boundary Layer functionality. Understand how it works and find the places in the code for its functionality (sequential).
- Review parallel boundary layer work done by Juliette in her dissertation (parallel).
- Hold meetings with Christos to learn and discuss how boundary layer functionality can be implemented in a new fashion (based on the previous three lessons) in CDT3D.
- Begin experimenting with GPU parallel programming and utilize this hardware/functionality within the telescopic approach for CDT3D.
- Examine how Daniel implemented his mesh generation code on top of Kokkos, a parallel execution environment.

Spring 2021

Week 2/3 - Present Inria's and David's work on boundary layer
March - Complete Source Point Implementation in CDT3D

- Fully Understand how Operators work within CDT3D

April - Complete Design of Boundary Layer Functionality as a set of operators within CDT3D (Base Case similar to AFLR)
June - Complete Initial Implementation of Base Case BL Functionality
July - Complete Design of modifications to BL Functionality to include Inria's and Juliette's Conceptual Methods
October - Complete Updated Implementation of BL Functionality
December - Complete early exploitation of GPU parallelism within CDT3D

Robust Boundary Layer Mesh Generation (Adrian Paper) Notes

Based on paper available here

- A boundary layer mesh is a quasi-structured layered mesh around a given geometry. It is usually considered as an extrusion of the initial surface along its normals.
- These meshes are widely used in Computational Fluid Dynamics (CFD). Most of commonly-used second-order unstructured CFD numerical schemes or commercial packages need a boundary layer mesh to accurately approximate the speed profile around a body during a viscous simulation. The quality of the mesh is also crucial as it has a huge impact on the evaluation of functionals of interest used in industry such as lift or drag. This is especially true for unstructured flow solvers, and thus for complex geometries for which defining a structured grid is not tractable. Consequently, several severe difficulties need to be tackled in order to generate a boundary layer mesh that is well suited for numerical computations.
- Using the normals as sole extrusion information requires several enrichments to obtain a smooth layers transition on complex surfaces. For example, it may be required to add several normals to increase the quality of the boundary layer mesh. They replace the classical laplacian smoothing of normal by defining a normal merging. In addition, the normals are not computed once for all layers, but are re-evaluated after each layer insertion.
- Usually, a global mesh generation process is used to close a volume, but Delaunay-based methods and frontal methods are susceptible to failure when dealing with anisotropic or badly-shaped faces. They solve this problem by generating the boundary layer mesh with local mesh modification operators, and guarantee that a computation is always possible even though the generated mesh may be sub-optimal.
- The boundary layer mesh generation is thought as a unique pre-processing procedure that is done prior to any computations. In particular, these methods are not sought to work in an adaptive context where the (surface) mesh is modified iteratively during the adaptation. When an adaptation is performed, simpler strategies have been devised as keeping the boundary layer mesh unchanged.
- Achieving a full coupling between boundary layer mesh generation and mesh adaptation is tedious and remains a challenge. They proposed a first improvement in this context by defining a fast point re-projection. This operation is mandatory to adapt the surface mesh especially in strategies that keep a valid volume mesh. In addition, the local operator used to generate the boundary layer may be used on anisotropic surface. By using local modification operators, they also remove the need of calling a global mesh generator during the adaptive process.
- The following is a fundamental property for the local mesh modification operators: Given a valid mesh H, a point P and a set CP, if (1) holds for CP and P is visible for all faces of CP (boundary faces and internal faces) then the mesh given by H−CP+BP is valid, where CP is the cavity of P and BP is is the ball of P (i.e., the list of elements surrounding P, having P is a vertex).

(1) In a mono-normal context, previous inserter with initialization Cp=BP−K, automatically generates quasi-structured elements.

Generalized Point Reinsertion

- When projecting the adapted surface mesh on the geometry, the displacement of surface points must be propagated into the volume. However, if a boundary layer mesh is initially attached to an adapted surface mesh, the problem of point relocation becomes more complicated. A local operator is introduced which allows for the movement of a point to a given new position. This operator can be easily coupled with an adaptive algorithm to adapt the surface mesh even in the presence of a boundary layer mesh.
- Given a mesh Hk, a point P ( Pnew being its new position), the algorithm consists in reinserting P following: Hk+1=Hk−CP+BP, where P is now in Pnew in Hk+1. The construction of CP should guarantee that for any internal face [A,B,C] in CP, the volume of [Pnew,A,B,C] is positive.
- Algorithm 1 is straightforward for volume point relocation, but more care is needed when inserting a surface, line or corner point. If for new tetrahedra, the volume is the only quantity used to verify that the final set BP is valid, tests are more complex for new triangles. They verify the topology (to avoid multi-connected edges) and also the minimal angle in the triangles in order to increase the visibility of the boundary edges of CP. If Algorithm 1 exits on a constrained face, a Steiner point is added in order to remove this face from CP. Most of the time, it is sufficient to insert a volume point Pstei=P+αPPnew, with α sufficiently large to make sure that the faces that trigger the exit become visible from Pstei. To complete the reinsertion of P, the new surface and volume elements are created simply by triangulating each boundary face or boundary edge with Pnew.

Application of local operator to mono-normal boundary layer mesh generation

- The initial boundary front is moved iteratively to the position of the next layer. The boundary layer mesh is then stored separately from the remaining volume mesh. Each face of the initial front engenders either a prism (if all the points of the face are moved), or a pyramid (if only two points of the face are moved), or a tetrahedron (if only one point of the face is moved). The final mesh is obtained by gathering these two parts. If a simplicial mesh is required for computations, they decompose the hybrid entities into tetrahedra. Note that the front is moved (extruded) along one (normal) direction. Consequently, several passes of laplacian smoothing are done on these directions in order to improve the quality of the layers at opened ridges (along the trailing edge for instance). In this approach, a global PDE (elasticity, . . . ) does not need to be solved in order to propagate the boundary displacement into the volume. The necessary room to move the point is created automatically by the local operator.
- The main drawback of this approach is that two separate meshes must be handled. Adding multi-normals enhancement for instance is also tedious with this approach. As soon as the surface front is modified, conforming the two meshes is not trivial anymore. Consequently, the authors defined a new local operator that has much more flexibility and that removes the need to store two meshes.

Boundary Layer Mesh Generation

- The generation of a boundary layer mesh starts from a given surface mesh. The focus is only on the generation of the volume mesh meaning that the surface mesh that supports the boundary layer is kept constant during the whole process. No hypothesis is made on the features of the surface mesh. In particular, the process should handle anisotropic surface meshes.
- First, the previous re-inserter is modified to become a constrained point inserter. Specific choices of CP are exemplified that lead to the generation of quasi-structured elements. The main improvement from the method described in the Generalized Point Reinsertion section is to avoid the need of handling two distinct meshes while offering more flexibility in the generation of the boundary layer.
- The following describes the modifications of the previous re-inserter. When Pnew is inserted along a normal, the previously created elements that are in the boundary layer mesh should be kept. Consequently, a set K of (constrained) tetrahedra in the boundary layer is created and updated after each insertion. The cavity enlargement procedure of Algorithm 1 can exit if during the process a con-strained element is added to CP. The cavity initialization is also modified to remove from BP elements that belong to K. In order to ensure (1), it is necessary to verify that BP minus the constrained elements is still connex. From a technical point of view, as Pnew is not initially (topologically) present in the mesh (contrary to the case where P is moved), the main difficulty is related to the surface part of Algorithm 1. Every boundary face [A,B,C] will never contain Pnew, so additional information is required to derive each connex component type. If Pnew is inserted along a normal direction issued from P, the final mesh will contain the edge PPnew. Then if face [A,B,C] belongs to CP, then tetrahedron [A,B,C,Pnew] is created. Consequently, given a face [A,B,C] with the extruded vertices [Anew,Bnew,Cnew], insertion of Anew will create tetrahedron K1=[A,B,C,Anew], insertion of Bnew will create K2=[Anew,Bnew,B,C] and insertion of Cnew will create K3=[Cnew,Anew,Bnew,C]. The union of K1, K2 and K3 forms the prism [A,B,C,Anew,Bnew,Cnew]. Note that K1, K2 and K3 should be added to K after each insertion. The update of K is based on the different sets of hybrid elements than can be created.
- Note that changing the order of insertion of the extruded points will lead to different decompositions of the prismatic mesh. Consequently, the point insertion can be a priori optimized in order to favor the creation of the smallest diagonal edges when a quadrilateral face of a prism is decomposed. In addition, according to the current configuration, the remaining points cannot be inserted in any order as this may lead to an invalid decomposition (known as the Sch ̈onhardt’s prism). It is thus necessary to loop over the remaining points in order to solve this issue. Usually, no more than 10 iterations are required to insert all the points.
- Two main drawbacks of using only one normal per point arise at closed and opened ridges. At closed ridges, the normals may cross, leading to invalid elements. At opened ridges, the quality of the elements decreases as the deviation between the normals may be large. A common practice to solve this issue is to smooth the normals. In this approach, the authors choose a different initialization of CP in order to improve the boundary layer mesh quality. In order to reduce the number of invalid elements, they pre-process the given normal and current size and predict the volume of elements. For each invalid element found, they attempt to collapse the normals until no more negative elements are found. For a face, if three normals are merged, a tetrahedron is created, whereas a pyramid is created when two normals are merged. Normals are merged according to a minimal distance criterion. If we denote by (Pi)i=1,k the list of points associated with a given list of merged normals, the cavity is then initialized by UBPi−K. The standard inserter is then called with this initialization. Without normal smoothing, normals cross each other at each step. The quality of the generated boundary layer mesh is improved with the merge of normals (see paper for results).
- The multi-normal case is the most complicated. The way the cavity CP is initialized is crucial to ensure the desired connectivity. Given P and a (minimal) set of normals, we start from the list of the (interface) faces that surround P. Interface faces are the boundary triangles for the first layer and then become the internal faces defining the frontier between the previous and current layers. We then assign each face to a normal by trying to maximize the visibility. In addition, for a given normal, the list of faces should be adjacent by edges. If too many normals are given, remaining normals with no more faces are not inserted. For a normal n associated to the list of face L=(Fi)i, the cavity is initialized by CP=UAB∈Fi,FjSAB, where AB is an edge shared by two faces of L. The inserter is then called normally with this initial choice of CP.
- The main difficulty when using merged and multi-normals consists in the recovery of constrained elements in order to update K. In the mono-normal context, only face prisms are recovered whereas in this case, constrained elements can be also point-based and edge-based. Algorithm 2 summarizes the complete process.

AFLR Boundary Layer Notes

Based on paper available here

- In CFD applications, viscous boundary-layer (BL) regions are typically prominent near the vehicle or component surfaces and must be resolved to capture the relevant physics. BL regions often have very stringent numerical requirements as they involve high-gradient and non-linear physics and usually include turbulence. These regions are in general known a priori and are ideally suited to a pseudo-structured approach. Optimal meshes are highly aligned, precisely spaced and very structured in at least the normal direction.
- Overall methodologies used to generate the high-aspect-ratio elements in the BL mesh region commonly rely on an advancing-layer/normal type process in which the boundary surface mesh is inflated one layer at a time. There are two primary branches of techniques that can be classified as open- or closed-advancing-layer methods for generating valid non-intersecting BL meshes.
- With an open-type advancing-layer method, a boundary surface mesh is the starting point and it is inflated or advanced one or more layers at a time. Proximity and intersection checks are performed as each layer is generated. If the criteria for these checks are not met then BL advancement is terminated locally. The key to a successful open-type method is a robust proximity and intersection checking process. Typically the layers are advanced until a termination criterion is reached, such as a set normal spacing or number of layers. After all layers are advanced as far as possible, the inflated boundary surface is used to generate a tetrahedral volume mesh outside of the BL region.
- Alternatively, a closed-type advancing-layer method can be used which starts from an existing volume mesh. Two main approaches exist. The first one is local and consists in inserting the BL mesh one vertex at a time using a mesh generation scheme with iterative point placement. In the BL region an advancing-normal point placement is used that mimics the advancing-layer approach. Outside of the BL region an isotropic type point placement is used, such as advancing-front, edge bi-section, centroid, etc. A valid closed volume mesh is maintained and standard checks for addition of new points in the mesh are used. This approach works quite well in two dimensions. However, it is not cost effective in three dimensions and sliver elements can be introduced in the BL region. The more common closed approach is global and typically involves iteratively inflating the boundary surface as each layer (or group of layers) is advanced while deforming the existing volume mesh. Volume element quality and vertex proximity checks are performed as the mesh is deformed in response to the boundary surface displacement. If the criteria for these checks are not met then BL advancement is terminated locally. After all layers are generated the result is a complete volume mesh with a BL region and a displaced tetrahedral volume mesh outside of that. A controllable quality and guaranteed validity of the volume mesh is the primary advantage of the closed methodology, assuming a robust mesh movement strategy is used.
- The key to a successful closed-type advancing-layer method is an effective, efficient, and robust mesh deformation algorithm. In AFLR, a closed advancing-layer method is used that relies on a recent connectivity optimization based moving mesh algorithm. Mesh deformation is computed by means of a PDE-based method using a linear-elasticity analogy. To drastically improve the robustness, the efficiency and the resulting mesh quality, it is combined with a mesh optimization phase using vertex smoothing and local reconnection. Local reconnection allows AFLR to solve efficiently any shear movements that occur inside the mesh. Numerical results also demonstrate that, with this approach, merging BL mesh regions are handled naturally and layers can be allowed to merge very closely with a smooth size transition in all directions.

Boundary layer mesh generation by closed advancing-layer method

- The main advantages of this strategy are the following:
- it is robust because it starts from an already existing mesh and it always produces a valid result
- it automatically and naturally handles BL front collision as BL is inflated inside an existing volume mesh
- it produces automatically high-quality meshes with smooth size blending between colliding BL fronts and in concave regions
- it handles naturally anisotropic meshes if mesh optimizations are done in the provided metric field thus leading to a nice strategy to couple anisotropic mesh adaptation and BL meshing.
- Closed-type advancing-layer methods start from an existing volume mesh that is typically fully resolved and push or insert the boundary layer mesh into the existing mesh. Once an initial mesh has been generated, many boundary layer meshes can be generated with different characteristics without re-generating the initial mesh. Therefore, the problem of the existence of a mesh is solved only once (at the beginning). This is a main asset for coupling unstructured anisotropic mesh adaptation and high-aspect-ratio elements pseudo-structured BL meshes. Indeed, the problem of the existence of a mesh was one of the blocking point to achieve highly anisotropic adapted unstructured meshes for real-life CFD application. This robustness issue has been solved by devising local remeshing methods where the validity of the mesh is always guaranteed. Another key difference with open advancing-layer method is that no checking between nearby points and elements is done since mesh deformation is being used to inflate the boundary-surface. Collisions between merging layers are naturally prevented by the linear elasticity model.
- At each layer, the growing of the BL is done by using the closed advancing-normal/layer procedure presented in Algorithm 1.

Mesh Deformation Method

- For the closed advancing-layer method, the whole mesh must be deformed when the boundary layer is inserted within the domain. The mesh deformation for displacement of the vertices is computed by means of a PDE-based method using a linear-elasticity analogy. The inner vertices movement is obtained by solving an elasticity-like equation with a P1 Finite Element Method (FEM):

where σ and ε are respectively the Cauchy stress and strain tensors, and d is the Lagrangian displacement of the vertices. The Cauchy stress tensor follows the Hooke’s law for isotropic homogeneous medium. Dirichlet boundary conditions are used to enforce the displacement of vertices on BL surfaces. For symmetry planes or imprint surfaces, Neumann boundary conditions are used to enforce a displacement in the tangent plane. In the case of imprint surfaces, moving vertices are re-projected on the surface after each moving step. The FEM system is solved by a Conjugate Gradient algorithm coupled with an LU-SGS pre-conditioner. Another advantage of elasticity-like methods is the opportunity they offer to adapt the local material properties of the mesh, especially its stiffness, according to the distortion and efforts born by each element.

- The cost of the mesh deformation can be reduced seeing that it is not efficient to solve the mesh deformation at each layer insertion. Especially, at the beginning when the boundary layer inflation is quite small. In AFLR, the mesh deformation is solved each 10 layers or when the sum of the layer normal sizes, since the last mesh deformation solution, is larger than one fourth of the surface mean size. If the mesh deformation is avoided, then inner vertices displacements are updated using the boundary layer growth rate:

- The mesh deformation is coupled with local mesh optimization using smoothing and generalized swapping to achieve efficiently large displacement in moving mesh applications. In the context of anisotropic adapted meshes, these mesh optimizations are done in the metric to preserve (or improve) the adaptation of the mesh.

Managing Boundary Layer Progression

- At the end of each moving step, AFLR checks if the mesh is valid and meets all quality requirements. The validity requires all mesh elements to have a positive volume after the mesh deformation. Quality requirements are thresholds that are set depending on the initial mesh or actual mesh quality. They govern when the BL region will stop inflating: lower bound stops the BL sooner while larger bound allows the BL to propagate farther. For isotropic unstructured meshes, quality functions cannot directly be used to stop the BL progression because the BL inflation may lead to anisotropic elements. These anisotropic elements are considered bad for the quality function but, in fact, they are good for the transition from the BL to the outer region. The same remark applied for adapted anisotropic meshes as the metric (anisotropy) of the initial mesh may be different from the metric (anisotropy) requested by the BL transition. To solve this issue, quality criteria check for an element are only activated if the height of the element is below one fourth of the current layer normal size. In that case, AFLR compares its height h and its quality Q of with respect to its initial height hini and initial quality Qini (i.e., evaluated before inflating the BL) weighted by a prescribed coefficient, both quality criteria are violated if:

AFLR uses α = 0.25 and β = 3. This criteria ensures a smooth transition between colliding layers. If the validity or the quality requirement is not reached for an element at the end of a moving step, then displacements of the element’s vertices are cancelled (v = 0) and the element’s vertices positions are reset to their initial positions at the beginning of this moving step. This canceling action changes the neighboring elements quality, thus this procedure is iterated until no more vertices are cancelled. At worst, the displacement of all the vertices is cancelled and the mesh is returned to the previous stage position where it was valid.

- At the end of the mesh movement, the final position at the current layer of each BL vertex is compared with its targeted final position. Vertices are categorized in two groups:
- If the total displacement is greater than 60% of the expected displacement: this BL vertex remains active for progressing
- If the total displacement is less or equal to 60% of the expected displacement: this BL vertex advancement is terminated and AFLR seeks for an optimal final position.

The threshold 60% has been chosen because AFLR limits the maximum number of moving steps for each layer to five, and it is appropriate in that case.

Important Implementation Details

- Normal vectors at vertices play a fundamental role in boundary layer meshing as the mesh is extruded from the surface triangulation along the point normal vectors. Unfortunately, for a discrete mesh the normal vector is not unique at vertices. An appropriate computation of the normal is required, particularly along corners and ridges, since a bad normal may lead to a premature interruption of the boundary layer growth, a loss of orthogonality, or the creation of low quality elements. Two strategies are available for optimal normal vector computation.
- AFLR computes the ’most visible’ normal with the algorithm proposed by Aubry et al. (see paper). It is the normal that minimizes the maximal angle with the face normals surrounding a given point. From a visibility standpoint, this normal is optimal by construction.
- In the Least-Squares method, the optimal normal vector is obtained by minimizing the deviation between the individual face normals (that are unique) and the ’optimal’ normal. This cost function also minimizes the variation in surrounding element volumes and reduces perturbations due to topological and geometrical variations in the mesh. At ridges or singular points a multi-surface approach is used, wherein a normal vector is determined from each smooth surface attached to the discontinuity. This is equivalent to the normal vectors that would be determined from the underlying geometry of the surrounding surfaces. Least-squares optimization is applied to each surface and then in determining the appropriate ’optimal’ normal vector for the vertex.
- The ’optimal’ normal vector is sufficient very close to the surface where orthogonality is most critical. However, as the BL generation advances it is advantageous to smooth the normal vector for overall mesh quality at the expense of orthogonality. This is particularly important near discontinuities. Standard Laplacian based smoothing in topological space is applied over multiple iterations (typically 20). The smoothing level is varied by a weighted average between the true normal vector and the fully smoothed normal vector. The weight varies between 0 and 1 with the distance from the wall. Full smoothing is applied once the distance exceeds a threshold (0.5 of the surface spacing).
- The boundary layer growth can be parameterized. First, a number of fixed layers - i.e., a growth rate of 1 - can be prescribed. Then, a varying growth rate can be prescribed in the BL using three parameters: an initial growth rate, a growth rate acceleration and a maximal growth rate. These parameters are particularly useful for turbulent BL. The accelerated growth matches a turbulent velocity profile. For an initial spacing at y+ = 1 there are 5 no growth layers (growth rate of 1), the acceleration factor is 1.05, and the limit on growth rate is 1.5. The maximal growth rate is often set to a lower value of 1.2-1.3 for more resolution in the outer region of the BL.
- Multiple checks must be made to insure the BL region does not include low quality elements or have normal spacing that is inappropriate for the given case. If any given point will produce a low quality element (e.g., maximum angle > 160 degrees) it is terminated. This is allowed to be violated at ridges. Face angle in the tangential surface is also checked as elements may twist as they progress outward. Again, a maximal angle is used (e.g., > 160 degrees). Also, edge lengths may increase due to concavity and or neighboring termination. This is limited to be less than a factor (1.5) multiplied by the base length. In addition, the normal spacing itself is limited to be less than the surface spacing and is limited to be a factor of the surface spacing (0.7). One can either terminate locally when this limit is reached or continue on with constant layers if one is trying to maintain a set number of layers or maximize the BL thickness.