Mesh Generation in CFD

1 downloads 0 Views 13MB Size Report
Jul 5, 2012 - 3.2 Domain Decomposition and Multi-Block Strategy . ...... series of edge/face swaps and the occasional introduction of an extra point. The left ...
1

CFD Open Series Revision 1.85.3

Mesh Generation in CFD Ideen Sadrehaghighi, Ph.D.

Cyliner Head (Polyhedral cells)

Typical Turbo-Machine Mesh (Hexahedral cells)

ANNAPOLIS, MD

Mixer (SAMM cells)

Wing-Body-Pylon-Nacelle (Tetrahedral cells)

2

Contents 1 2

Introduction .................................................................................................................................. 9 Computer-Aided Design (CAD) ............................................................................................. 10

2.1 2.2

2.3 2.4 2.5

3

Structured Mesh Generation ................................................................................................. 18

3.1 3.2 3.3 3.4 3.5 3.6

1.8

4

Software and Technology ................................................................................................................................ 10 Commercially Available CAD Systems: .............................................................................. 11 Freeware and Open Source ............................................................................................... 12 Solid (Geometry) Modeling ............................................................................................................................. 12 Principal Characteristics of a Solid Modeling Software ..................................................... 12 Feature-Based Modeling ................................................................................................... 12 Constraint-Based Modeling ............................................................................................... 12 Parametric Modeling ......................................................................................................... 13 History-Based Modeling .................................................................................................... 13 Associative Modeling ......................................................................................................... 13 Constructive Solid Geometry (CSG) Representation of Solids.......................................................... 13 Basic Primitives .................................................................................................................. 13 Regularized Boolean Operators ......................................................................................... 14 The CSG Tree ......................................................................................................................................................... 14 Geometry Related Issues For Mesh Generation ..................................................................................... 14 Understanding the Analysis Requirements ....................................................................... 15 Disfeaturing ....................................................................................................................... 15 “Dirty” Geometry ............................................................................................................... 16

Classification of Mesh Generation Techniques ....................................................................................... 19 Domain Decomposition and Multi-Block Strategy ................................................................................ 20 Field (Domain) Discretization Process (Mesh Generation) ............................................................... 21 Conformal Mapping (The Sponge Analogy) ............................................................................................. 22 Domain Decomposition with Multi-Blocking (Multi-Sponge Analogy) ........................................ 23 Structured Grid Generation ............................................................................................................................ 24 Complex Variables ............................................................................................................. 24 Algebraic Methods -Transfinite Interpolation (TFI) ........................................................... 25 PDE Solver .......................................................................................................................... 26 3.6.3.1 Elliptic Schemes ............................................................................................................ 27 3.6.3.2 Hyperbolic Schemes ..................................................................................................... 28 3.6.3.3 Parabolic Scheme ......................................................................................................... 29 Variational Method............................................................................................................ 29 Structured Adaptive Grid.................................................................................................................................. 30 Case Study – 2D Euler Flow over and NACA Airfoil ........................................................... 31

Un-Structured Mesh Generation .......................................................................................... 34 4.1 4.2

Advancing Front Method ................................................................................................................................. 34 Advancing Front Triangular Mesh Generator .................................................................... 35 Delaney Triangulation Method ...................................................................................................................... 36 Algorithms ......................................................................................................................... 37

3

4.3 4.4 4.5 4.6 4.7 4.8

4.9 4.10 4.11 4.12 4.13 4.14

5

6

Advantages ........................................................................................................................ 38 Octree Decomposition ....................................................................................................................................... 39 Unstructured Hexahedral Meshes................................................................................................................ 40 Conversion of Triangular to Quadrilateral Meshes (2D) ................................................... 41 Overset Grids ........................................................................................................................................................ 42 Cartesian Grids ..................................................................................................................................................... 43 Trimmed (SAMM) Cells .................................................................................................................................... 44 Polyhedral Cells ................................................................................................................................................... 45 Cell Decomposition ............................................................................................................ 45 Mesh Duality ...................................................................................................................... 46 Methodology ..................................................................................................................... 46 Treatment of Boundary Layer ....................................................................................................................... 47 Domain Mesh Stretching in Unstructured Environment .............................................................. 48 Spatial (Field) Discretization ................................................................................................................... 50 Considerations for the Navier-Stokes Equation ............................................................................... 51 Unstructured Quadrilateral Mesh Generation .................................................................................. 52 Geometry Representation ................................................................................................. 53 Local mesh generation algorithm ...................................................................................... 53 Connectivity Information and Data Structure................................................................................... 55

Hybrid Meshes ........................................................................................................................... 58

5.1

Accuracy Consideration.................................................................................................................................... 58 Comparing Mesh Type for Viscous Accuracy..................................................................... 59 Effect of Prismatic Extrusion Sub-Layer in Viscous Layer .................................................. 59 5.2 Meshing tools in CD-Adapco® ........................................................................................................................ 60 A Novel Methodology for Extrusion Layer Meshing .......................................................... 62 5.3 Case Study - Hybrid Unstructured Meshes for Common Research Model (CRM & JSM) via ANSA®................................................................................................................................................................................... 63 Geometry and Mesh Generation Background................................................................... 63 Geometry Handling............................................................................................................ 64 5.3.2.1 The CRM Model ........................................................................................................... 64 5.3.2.2 The JSM Model ............................................................................................................. 65 Surface Meshing ................................................................................................................ 66 Volume Meshing ................................................................................................................ 70 5.3.4.1 Extrusion Layers Generation ........................................................................................ 70 5.3.4.2 Tetra Meshing............................................................................................................... 71 Sample CFD Results ........................................................................................................... 71 5.3.5.1 CRM .............................................................................................................................. 72 5.3.5.2 JSM ............................................................................................................................... 73 5.4 Listing of Available Meshing Software ....................................................................................................... 74

Adaptive Mesh (Unstructured) ............................................................................................ 76

6.1

6.2

Type of Mesh Refinement ................................................................................................................................ 76 R-Refinement (RR) ............................................................................................................. 78 H-Refinement (HR) ............................................................................................................ 78 6.1.2.1 Isotropic vs Anisotropic Meshing ................................................................................. 79 P-Refinement (PR) ............................................................................................................. 79 Adaptive Mesh Refinement (AMR) .............................................................................................................. 80

4

AMR for Transient Inviscid Flow ........................................................................................ 81 Case Study 1 – Unstructured Mesh Adaptation for 2D Airfoil........................................... 81 6.2.2.1 Adaption Control Mechanism ...................................................................................... 83 Case Study 2 – Parallel Implementation of Unstructured Mesh Refinement of Duct Flow 83 Case Study 3 – Generic Transonic Store Release............................................................... 84 6.3 Mesh Modification Operators......................................................................................................................... 85

7

8

Dynamic Meshing ...................................................................................................................... 88

7.1 7.2 7.3 7.4

Type of Mesh Motion ......................................................................................................................................... 88 Mesh Deformation .............................................................................................................................................. 89 Finite Volume in Dynamic Mesh ................................................................................................................... 89 Dynamic Mesh Techniques ............................................................................................................................. 91 Laplacian Mesh Morphing ................................................................................................. 91 Pseudo-Solid Equation ....................................................................................................... 91 7.4.2.1 Case Study – Motion of a Cylinder ............................................................................... 91 Radial Basis Function ......................................................................................................... 92 Generalized Grid Interface ................................................................................................ 94 Overset Methods ............................................................................................................... 95 Delaunay Method .............................................................................................................. 96 7.4.6.1 Case Study - Airfoil Rotation ......................................................................................... 97 Spring Analogy ................................................................................................................... 97 Six Degrees of Ferndom (6 DOF)........................................................................................ 98 7.4.8.1 Transitional Deformation ............................................................................................. 98 7.4.8.2 Rotational Deformation................................................................................................ 98

Assessment of Mesh Types ................................................................................................. 100

8.1

8.2

Structured vs Unstructured ......................................................................................................................... 100 Time and memory............................................................................................................ 100 Resolution ........................................................................................................................ 100 Alignment ........................................................................................................................ 100 Definable Normal............................................................................................................. 101 Effect of Cell Topology in Truncation Error ..................................................................... 101 Case Study – Flow through Pipe with 90 degree Bend.................................................... 102 Polyhedral vs Tetrahedral ................................................................................................ 103 8.1.6.1 Boundary Prismatic Cells ............................................................................................ 104 Accuracy Assessment of Gradient Calculation Methods ................................................................. 105 Geometric Properties ...................................................................................................... 106 Literature Survey ............................................................................................................. 106 Gradient Calculation ........................................................................................................ 106 8.2.3.1 Green-Gauss Gradient Method .................................................................................. 107 8.2.3.2 GG-Simple Face Averaging ......................................................................................... 107 8.2.3.3 GG-Inverse Distance Weighted (IDW) Face Interpolation.......................................... 107 Visual Inspection .............................................................................................................. 108 Results Based on L2 Norm ................................................................................................ 109 Concluding Remarks ........................................................................................................ 111

5

9

Mesh Sensitivity and Mesh Independence Study ........................................................ 112

9.1 9.2 9.3

10

Mesh Sensitivity via Direct Differentiation (DD) ................................................................................ 112 Surface Modeling Using NURBS....................................................................................... 112 9.1.1.1 Case Study - 2D Study of Airfoil Grid Sensitivity via Direct Differentiation (DD)........ 115 Adjoint Variable Sensitivity Analysis (AV) ............................................................................................ 116 Mesh Independence Study ........................................................................................................................... 117

Mesh Quality ............................................................................................................................ 120

10.1 10.2

Background .................................................................................................................................................. 120 Mesh Quality Metric .................................................................................................................................. 120 Mesh Quality from User’s Perspective ............................................................................ 122 Mesh Quality from Researcher’s Perspective ................................................................. 122 Mesh Quality from Solver’s Perspective.......................................................................... 123 10.2.3.1 CFD++..................................................................................................................... 123 10.2.3.2 Fluent and CFX ....................................................................................................... 123 10.2.3.3 Kestrel .................................................................................................................... 124 10.2.3.4 STAR-CCM+ ............................................................................................................ 124 10.2.3.5 Deducing Results ................................................................................................... 125 Some Geometric Properties ............................................................................................ 125 10.2.4.1 Aspect ratio ........................................................................................................... 125 10.2.4.2 Orthogonality ........................................................................................................ 125 10.2.4.3 Skewness ............................................................................................................... 126 10.2.4.4 Warpage ................................................................................................................ 126 10.2.4.5 Jacobian ................................................................................................................. 126 10.2.4.6 Tetrahedral Volume............................................................................................... 127 10.2.4.7 Polygonal Face Area and Centroid ........................................................................ 127 10.2.4.8 Polyhedral Volume and Centroid .......................................................................... 128 10.3 Best Practice for Mesh Generation ..................................................................................................... 128 Geometry Modeling and Geometry Cleanup .................................................................. 129 Computational Domain ................................................................................................... 129 Choice of Grid .................................................................................................................. 129 Surface Meshing .............................................................................................................. 130 Volume Meshing .............................................................................................................. 130 Boundary Layer Meshing ................................................................................................. 130 Guidelines for Aerodynamics in General ......................................................................... 131 Guidelines for Auto Aerodynamics .................................................................................. 131 Improvement of Grid Quality .......................................................................................... 132

11

Appendix A ............................................................................................................................... 133

A.1

Computer Code for a Transfinite Interpolation ................................................................................... 133

List of Tables Table 5.1 Abbreviations............................................................................................................................................ 63 Table 5.2 Currently Available Grid Generation Software ........................................................................... 74 Table 9.1 Pros & Cons of Different Grid Sensitivity Method (NDV = Number of Design Variable) ........................................................................................................................................................................... 117

6

List of Figures Figure 1.1 Methodology of General Grid Generation ....................................................................................... 9 Figure 2.1 Anatomy of commercial CAD Systems .......................................................................................... 11 Figure 2.2 Fighter Airplane F-16 calculation ................................................................................................... 11 Figure 2.3 Example of a CSG Tree ......................................................................................................................... 14 Figure 2.4 Different Analysis Require Different Geometric Representations .................................... 15 Figure 2.5 Small Feature (Left) vs Removed (Right) .................................................................................... 16 Figure 3.1 Classification of Grid Generation Algorithms (Courtesy of Steven Owen) .................... 18 Figure 3.2 Schwarz concept of iterating between domains ....................................................................... 20 Figure 3.3 Domain Decomposition for M6 wing using TIL scripts (Courtesy of GridPro) ............ 20 Figure 3.4 Example of Unstructured Tetrahedral Grids.............................................................................. 21 Figure 3.5 Examples of Structured grids for Turbine Blade ...................................................................... 21 Figure 3.6 Sponge Analogy ...................................................................................................................................... 22 Figure 3.7 Multi Block representation for C-H mesh around a wing ..................................................... 23 Figure 3.8 Topology and Grid on a Multi-Block Wings using GridPro® ................................................ 24 Figure 3.9 Multi-block gridding over Turbine blade (Courtesy of GridPro) ....................................... 24 Figure 3.10 Dual Block grid topology for a generic airplane configuration........................................ 26 Figure 3.11 Grid for dual-block generic airplane geometry ...................................................................... 26 Figure 3.12 Typical Elliptic Grid for an Airfoil with Orthogonality Enforced on the Boundary . 28 Figure 3.13 Euler Solution on a HSCT Wing-Fuselage ................................................................................. 29 Figure 3.14 Folded Grid by Transfinite Interpolation - Smooth Grid by Winslow Functional .. 29 Figure 3.15 1D Weight Function for High Gradient and Curvature........................................................ 31 Figure 3.16 Mesh and Mach contours for Transonic Flow ......................................................................... 32 Figure 3.17 Grid Adaption and Mack Contours for Supersonic Airfoil ................................................. 33 Figure 4.1 Closing stage of a Moving Front Method ...................................................................................... 34 Figure 4.2 Mesh parameters ................................................................................................................................... 35 Figure 4.3 Relationship between Delaunay triangles and the Voronoi diagram .............................. 37 Figure 4.4 Two-Three Tetrahedral swap .......................................................................................................... 38 Figure 4.5 Robust and fast way to detect if point D lies in the circumcircle of A, B, C .................... 38 Figure 4.6 Converging of an Octree decomposition around an Airfoil.................................................. 39 Figure 4.7 Hierarchy of Meshing Methodologies ........................................................................................... 40 Figure 4.8 Quadrilateral mesh generation ........................................................................................................ 42 Figure 4.9 Overset Mesh Combination ............................................................................................................... 43 Figure 4.10 Example of Cartesian Grid on a Generic Airplane ................................................................. 44 Figure 4.11 Meshing types in SAMM ................................................................................................................... 44 Figure 4.12 Typical Polyhedral Cell and their Decomposition ................................................................. 45 Figure 4.13 Polyhedral meshing using Delaunay triangulation............................................................... 46 Figure 4.14 Dual surface Triangulation resulting in Polyhedron ............................................................ 47 Figure 4.15 Boundary layer prisms generated on a cascade of a 2D triangulation and dual polyhedron ......................................................................................................................................................................... 48 Figure 4.16 Concept of cascading for boundary layer in 3D...................................................................... 49 Figure 4.17 Dual mesh for mixed triangular-quadrilateral unstructured mesh ......................................... 51 Figure 4.18 Conventional configuration geometry (a), final structural mesh (Courtesy of Hwang & Martins) ........................................................................................................................................................... 53 Figure 4.19 The six steps of the unstructured quad meshing algorithm ............................................. 55 Figure 5.1 Hybrid grid and steady state solution........................................................................................... 58 Figure 5.2 Comparison of different mesh types for RANS Computations............................................ 59 Figure 5.3 Constructions of Hybrid mesh ......................................................................................................... 60

7

Figure 5.4 Predominantly polyhedral meshing .............................................................................................. 60 Figure 5.5 Combined Volume and Extrusion Layer Meshes ...................................................................... 61 Figure 5.6 Meshing tools in CD-adapco .............................................................................................................. 61 Figure 5.7 Meshes Generated by a) Proposed Algorithm and b) Leading Commercial Vendor . 62 Figure 5.8 Computational Domain of the HL-CRM Gapped Flaps Model ............................................. 64 Figure 5.9 Computational Domain and Separation of Zones of the JSM Model with Engine Nacelle .................................................................................................................................................................................. 65 Figure 5.10 JSM Model with Engine Nacelle..................................................................................................... 65 Figure 5.11 Three Locations of Problematic Areas of the JSM Geometry for the Generation of Boundary Layers .............................................................................................................................................................. 66 Figure 5.12 Batch Mesh setup for the JSM Model with Size Boxes for Local Mesh Control.......... 67 Figure 5.13 Resulting Layers for Isotropic Surface Mesh (Top) and Anisotropic (Bottom) ........ 68 Figure 5.14 Close ups of Coarse CRM Gapped Flap Model with Comparison of Tridiagonal Dominant (Top) vs. Quad Dominant (Bottom) Surface Mesh ....................................................................... 69 Figure 5.15 Volume Mesh of the JSM................................................................................................................... 71 Figure 5.16 Lift and Drag Coefficients for CRM Geometry at 8 degree AoA using OpenFOAM and STAR-CCM+ ............................................................................................................................................................... 72 Figure 5.17 Lift and Drag Coefficients for the JSM Geometry using OpenFOAM and STARCCM+ ..................................................................................................................................................................................... 73 Figure 6.1 Adaptive Mesh Refinement types ................................................................................................... 77 Figure 6.2 An H-refinement mesh about a shuttle-like body (left) and computed CP (right)...... 78 Figure 6.3 Isotropic vs Anisotropic Meshing ................................................................................................... 79 Figure 6.4 Adaptive Mesh Refinement (HR) on 2D case using Cartesian grid ................................... 80 Figure 6.5 Selected initial meshes for the transient adaptive procedure (Meshes 3, 20, 27 and 29) .......................................................................................................................................................................................... 81 Figure 6.6 Grid Adaption using Supersonic Flow for an Airfoil (bow shock)..................................... 82 Figure 6.7 NACA 0012 test case: M∞= 0.8, α=1.25 ......................................................................................... 82 Figure 6.8 Two-pass approach for parallel coarsening and refinement. ..................................................... 84 Figure 6.9 Inter-Processor partitioning based on Laplace coefficients ................................................ 85 Figure 6.10 Store position, orientation, and surface pressures at selected points in trajectory ........... 85 Figure 6.11 Adapted mesh partitioning during store dispense........................................................................ 86 Figure 7.1 Mesh Deformation Problem .............................................................................................................. 89 Figure 7.2 Cylinder Motion in 2D.......................................................................................................................... 92 Figure 7.3 Mesh Deformation Via Laplace & RBF Methods ....................................................................... 93 Figure 7.4 GGI interface ............................................................................................................................................ 94 Figure 7.5 Overset Method ...................................................................................................................................... 96 Figure 7.6 Delaunay Method of Dynamic mesh .............................................................................................. 97 Figure 7.7 Mesh before and after the translational deformations .......................................................... 98 Figure 7.8 Mesh before and after the x-axis rotational deformation ..................................................... 99 Figure 8.1 Backward facing step in a duct using Polyhedral, Hexahedral and Tetrahedral cells ..................................................................................................................................................................................... 100 Figure 8.2 Average bees being smarter than CFD engineer? ................................................................. 101 Figure 8.3 Effect of truncation error on Hex and Tet cells ...................................................................... 101 Figure 8.4 Comparison of Hex (16 K Cells) and Tet (440 K Cells) for a Pipe with 90 Degree Bend ................................................................................................................................................................................... 102 Figure 8.5 Results of Hex vs Tet Meshes as well as Hybrid Mesh in a Pipe with 90 Degree Bend ................................................................................................................................................................................... 103 Figure 8.6 Polyhedral cells vs Tetrahedral cells .......................................................................................... 103 Figure 8.7 Boundary prims cells for tetrahedral (left) and polyhedral (right) cells .................... 105 Figure 8.8 GG simple face averaging ................................................................................................................ 107

8

Figure 8.9 GG Inverse Distance Weighted (IDW) Face Interpolation ................................................. 108 Figure 8.10 Methodologies for various Gradient Order of Accuracy .................................................. 109 Figure 8.11 Global error norms for x-direction gradient for various gradient methods ........... 110 Figure 9.1 Six Control Point Representation of a Generic Airfoil ......................................................... 113 Figure 9.2 B-Spline Approximation of NACA0012 (left) and RAE2822 (right) Airfoils .............. 113 Figure 9.3 Free Form Deformation (FFD) for Volume Grid with Control Points (Courtesy of Kenway et al.) ................................................................................................................................................................. 114 Figure 9.4 Sample Grid and Grid Sensitivity ................................................................................................. 115 Figure 9.6 Mesh Independence........................................................................................................................... 117 Figure 9.5 Effects of Mesh Density on Solution Domain .......................................................................... 118 Figure 10.1 Predicted Mesh Quality (Volume, Aspect Ratio, and Stretch) ....................................... 121 Figure 10.2 A simple Demonstration of How a Poor Mesh from a Cell Geometry Perspective 123 Figure 10.3 Using Kestrel one can Show a Correlation Between Mesh and Solution Quality .. 124 Figure 10.4 Concept of Orthogonality in Cells .............................................................................................. 126 Figure 10.5 Skewness and Warpage................................................................................................................. 126 Figure 10.6 Tetrahedral Volume ........................................................................................................................ 126 Figure 10.7 Triangulation of a polygon ........................................................................................................... 127 Figure 10.8 Tetrahedralization of a polyhedral (showing a single face) .......................................... 128 Figure 10.9 General estimation of surface mesh element size .............................................................. 130 Figure 11.1 Symmetry plane (XY) ..................................................................................................................... 134

9

1 Introduction A preprocessing step for the computational field simulation is the discretization of the domain of interest and is called mesh generation. The process of mesh generation can be broadly classified into two categories based on the topology of the elements that fill the domain. These two basic categories are known as structured and unstructured meshes. The different types of meshes have their advantages and disadvantages in terms of both solution accuracy and the complexity of the mesh generation process. A structured mesh is defined as a set of hexahedral elements with an implicit connectivity of the points in the mesh. The structured mesh generation for complex geometries is a time-consuming task due to the possible need of breaking the domain manually into several blocks depending on the nature of the geometry. An unstructured mesh is defined as a set of elements, commonly tetrahedrons, with an explicitly defined connectivity. The unstructured mesh generation process involves two basic steps: point creation and definition of connectivity between these points. Flexibility and automation make the unstructured mesh a favorable choice although solution accuracy may be relatively unfavorable compared to the structured mesh due to the presence of skewed elements in sensitive regions like boundary layers. In an attempt to combine the advantages of both structured and unstructured meshes, another approach in practice is hybrid mesh generation. In a hybrid mesh, the viscous region is filled with prismatic or hexahedral cells while the rest of the domain is filled with tetrahedral cells. It has been observed that a hybrid mesh in viscous regions creates a lesser number of elements than a completely unstructured mesh with a similar resolution. This type of mesh has no restrictions on the number of edges or faces on a cell, which makes it extremely flexible for topological adaptation. It is given that unstructured mesh has an advantage over the structured mesh in handling complex geometries, mesh adaptation using local refinement and de-refinements, moving mesh capability by locally repairing the bad quality elements, and load balancing using appropriate graph partitioning algorithms. In the case of a non-matched block-to-block boundary, interpolation issues have to be handled properly to satisfy the conservation principles. However, the structured mesh has a better accuracy for viscous calculations due to the fact that it can handle cells with very high aspect ratio cells in the boundary layer1. Precipitate of most grid generation procedure can be summarized as Figure 1.1 provided that everything goes according to plan.

CAD Data

Surface Grid

Figure 1.1

Volume Grid

Optimization of Grid

CFD

Methodology of General Grid Generation

Roy Koomullil, Bharat Soni, Rajkeshar Singh ,”A comprehensive generalized mesh system for CFD applications”, Mathematics and Computers in Simulation 78 (2008) 605–617. 1

10

2 Computer-Aided Design (CAD) Computer-Aided Design (CAD) is the use of computer systems (or workstations) to aid in the creation, modification, analysis, or optimization of a design2. CAD software is used to increase the productivity of the designer, improve the quality of design, improve communications through documentation, and to create a database for manufacturing. CAD output is often in the form of electronic files for print, machining, or other manufacturing operations. The term CADD (for Computer Aided Design and Drafting) is also used3. CAD may be used to design curves and figures in two-dimensional (2D) space; or curves, surfaces, and solids in three-dimensional (3D) space. CAD is an important industrial art extensively used in many applications, including automotive, shipbuilding, and aerospace industries, industrial and architectural design, prosthetics, and many more. CAD is also widely used to produce computer animation for special effects in movies, advertising and technical manuals, often called DCC digital content creation. The modern ubiquity and power of computers means that even perfume bottles and shampoo dispensers are designed using techniques unheard of by engineers of the 1960s. Because of its enormous economic importance, CAD has been a major driving force for research in computational geometry, computer graphics (both hardware and software), and discrete differential geometry4. CAD is an important industrial art extensively used in many applications, including automotive, shipbuilding, and aerospace industries, industrial and architectural design, prosthetics, and many more. CAD is also widely used to produce computer animation for special effects in movies, advertising and technical manuals, often called DCC digital content creation. The modern ubiquity and power of computers means that even perfume bottles and shampoo dispensers are designed using techniques unheard of by engineers of the 1960s. Because of its enormous economic importance, CAD has been a major driving force for research in computational geometry, computer graphics (both hardware and software), and discrete differential geometry5.

2.1 Software and Technology Originally software for Computer-Aided Design systems was developed with computer languages such as Fortran, ALGOL but with the advancement of object-oriented programming methods this has radically changed. Typical modern parametric feature based modeler and freeform surface systems are built around a number of key C modules with their own APIs. A CAD system can be seen as built up from the interaction of a graphical user interface (GUI) with NURBS geometry or boundary representation (B-rep) data via a geometric modeling kernel. A geometry constraint engine may also be employed to manage the associative relationships between geometry, such as wireframe geometry in a sketch or components in an assembly. Unexpected capabilities of these associative relationships have led to a new form of prototyping called digital prototyping. In contrast to physical prototypes, which entail manufacturing time in the design. That said, CAD models can be generated by a computer after the physical prototype has been scanned using an industrial CT scanning machine. Depending on the nature of the business, digital or physical prototypes can be initially chosen according to specific needs. Today, CAD systems exist for all the major platforms (Windows, Linux, UNIX and Mac OS X); some packages support multiple platforms. CAD software enables engineers and architects to design, inspect and manage engineering projects within an integrated graphical user interface (GUI) on a Narayan, K. Lalit (2008). Computer Aided Design and Manufacturing. New Delhi: Prentice Hall of India. p. 3. Duggal, Vijay (2000). Cadd Primer: A General Guide to Computer Aided Design and Drafting-Cadd, Mailmax Pub. ISBN 978-0962916595. 4 Wikipedia. 5 Same Source. 2 3

11

personal computer system. Most applications support solid modeling with boundary representation (B-Rep) and NURBS geometry, and enable the same to be published in a variety of formats. A geometric modeling kernel is a software component that provides solid modeling and surface modeling features to CAD management applications. Based on market statistics, commercial software from Autodesk, Dassault Systems, Siemens PLM Software and PTC dominate the CAD industry. Presently, most of commercially available CAD systems, such as SolidWorks, Autodesk or Siemens NX, calming to be able to do faster design loops, are also including a CFD analysis tool (some with limited capabilities), and Grid Generation kernel, in their product. (see Figure 2.1). For example, using SolidWorks, to solve the symmetric algebraic problem for pressure-correction, an original double preconditioned iterative procedure is used6. It is based on a specially-developed multigrid method from [Hackbusch (1985)]. This is an external flow around a F-16 fighter (Mach Number equals 0.6 and 0.85). The geometry is a native CAD model of the airplane with external tanks and armaments. Flow into the intake and exhaust from the engine’s nozzle are both taking into account. Calculations were performed with relatively coarse grid of approximately 200,000 cells. (see Figure 2.2) Calculation results are compared with the test data from [Nguyen, Luat T. et al. 1979]. Commercially Available CAD Systems: The following is a list of major CAD applications.  Alibre Design 6

CAD Management

Grid Generation

CFD

Figure 2.1

Anatomy of commercial CAD Systems

Figure 2.2

Fighter Airplane F-16 calculation

 Autodesk AutoCAD

Solidworks, “Numerical Basis of CAD-Embedded CFD”, White Paper.

12

   

Autodesk Inventor Bentley Systems MicroStation Bricsys BricsCAD Dassault Systemes CATIA Dassault Systemes SolidWorks Kubotek KeyCreator Siemens NX Siemens Solid Edge PTC PTC Creo (formerly known as Pro/ENGINEER) Trimble SketchUp AgiliCity Modelur TurboCAD IRONCAD

      

Freeware and Open Source 123D LibreCAD FreeCAD BRL-CAD OpenSCAD QCad SolveSpace

        

             

MEDUSA ProgeCAD SpaceClaim PunchCAD Rhinoceros 3D VariCAD Vectorworks Cobalt Gravotech Type3 RoutCad SketchUp Onshape ActCAD Remo 3D

2.2 Solid (Geometry) Modeling

A solid model is a computer model of a 3D solid. It is a virtual representation of the shape of a solid7. Solid models can be simple parts, or complex assemblies of multiple parts. We aim here at explaining how such solids can be described on a computer. We will principally focus on the ability of such solid models to serve as input to numerical simulations. Principal Characteristics of a Solid Modeling Software A solid modeling software may have some specific characteristics that enables to enhance both its efficiency and the productivity of the solid modeling process: Feature-Based Modeling Features are defined to be parametric shapes associated with attributes such as intrinsic geometric parameters (length, width, depth etc.), position and orientation, geometric tolerances, material properties, and references to other features. Feature-based modelers allow operations such as creating holes, fillets, chamfers, bosses, and pockets to be associated with specific edges and faces. When the edges or faces move because of a regeneration, the feature operation moves along with it, keeping the original relationships. Constraint-Based Modeling There are two types of constraints. Dimensional constraints are used to specify distances between items. Geometric constraints define positional relationships between entities in the model in terms of the geometry. Examples of geometric constraints include tangency, parallelism, symmetry, concentricity. Constraint-based modeling allows the engineer or designer to incorporate intelligence Christophe Geuzaine, Emilie Marchandise , and Jean-Francois Remacle, “An introduction to Geometrical Modelling and Mesh Generation”, The Gmsh Companion. 7

13

into the design. The initial sketch of a two-dimensional profile in constraint-based solid modeling does not need to be created with a great deal of accuracy. It just needs to represent the basic geometry of the cross section. The exact size and shape of the profile is defined through assigning enough parameters to fully constrain it. Parametric Modeling Parametric modeling means that parameters of the model may be modified to change the geometry of the model. A dimension is a simple example of a parameter. When a dimension is changed, the geometry of the part is updated. Thus, the parameter drives the geometry. An additional feature of parametric modeling is that parameters can reference other parameters through relations or equations. The power of this approach is that when one dimension is modified, all linked dimensions are updated according to specified mathematical relations, instead of having to update all related dimensions individually. History-Based Modeling The last aspect of solid modeling is that the order in which parts are created is critical. This is known as history-based modeling. For example, a hole cannot be created before a solid volume of material in which the hole occurs has been modeled. If the solid volume is deleted, then the hole is deleted with it. This is known as a parent-child relation. The child (hole) cannot exist without the parent (solid volume) existing first. Parent-child relations are critical to maintaining design intent in a part. Most solid modeling software recognizes that if you delete a feature with a hole in it, you do not want the hole to remain floating around without being attached to the feature. Consequently, careful thought and planning of the base feature and initial additional features can have a significant effect on the ease of adding subsequent features and making modifications. Associative Modeling The associative character of solid modeling software causes modifications in one object to \ripple though" all associated objects. For instance, suppose that you change the diameter of a hole on the engineering drawing that was created based on your original solid model. The diameter of the hole will be automatically changed in the solid model of the part, too. In addition, the diameter of the hole will be updated on any assembly that includes that part. Similarly, changing the dimension in the part model will automatically result in updated values of that dimension in the drawing or assembly incorporating the part. This aspect of solid model software makes the modification of parts much easier and less prone to error. As a result of being feature based, constraint based, parametric, history based, and associative, modern solid modeling software captures \design intent", not just the design. This comes about because the solid modeling software incorporates engineering knowledge into the solid model with features, constraints, and relationships that preserve the intended geometric relationships in the model.

2.3 Constructive Solid Geometry (CSG) Representation of Solids We discuss here briefly the Constructive Solid Geometry (CSG) representation of solids. CSG allow to construct complex solid through primitives, Boolean operators and rigid motions. Basic Primitives The standard CSG basic primitives are the sphere, the torus, the parallelepiped (block), the cylinder and the cone. All those primitives defined bounded closed orientable domains. All basic primitives are defined in the world system of coordinates. Rigid motions (rotations, translations) and scaling can be applied to re-position the primitives.

14

Regularized Boolean Operators Each primitive divides the 3D space into two parts: the one that is inside the primitive and the one that is outside. The closure of a primitive is the surface that separates its interior with its exterior. It is easy to think a primitive as a set where standard Boolean operations like union, intersection and difference can be defined. Basic primitives can be combined using Boolean operations. Three Boolean operators are defined. Consider two primitives A and B.  The Union A ⋃ B operation returns of all the points x ∈ R3 that are either inside A or inside B. Figure 2.3 Example of a CSG Tree  The Intersection A ⋂ B operation returns of all the points x ∈ R3 that are both inside A and inside B.  The Difference A n B operation returns of all the points x ∈ R3 that are inside A and outside B. Regularized Boolean operators differ from the set-theoretic ones in that dangling lower dimensional structures are eliminated, all remaining faces, edges and vertices belonging to the closure of the resulting volume.

2.4 The CSG Tree A CSG object can be easily represented in a tree structure where the leaves of the tree are simple primitives, nodes of the tree are solids, edges of the tree are Boolean operations and where the root of the tree is a solid that is the final CSG object. Figure 2.3 shows an example of a simple CSG tree. Most of the current commercial solid modelers enable to use CSG trees. Designing robust algorithms for computing both the geometry and the topology of surface intersections is a complex problem. A few number of software enable to perform CSG computations effciently and, to our best knowledge, only one is open source. In Gmsh, we have interfaced Open cascade primitives and operators to build the solid of Figure 2.3.

2.5 Geometry Related Issues For Mesh Generation One of the major issues of mesh generation is access to CAD geometry in an accurate and efficient manner, as addresses by [Beall et al.]8. Here, we will provide an overview the process of accessing 8

Mark W. Beall1, Joe Walsh2, Mark S. Shephard, “Accessing CAD Geometry For Mesh Generation”.

15

CAD geometry for mesh generation and will review several of the issues associated with accessing CAD geometry for mesh generation. The techniques for CAD geometry access to be reviewed include: Translation & Healing, Discrete Representations, Direct Geometry Access, and Unified Topology Accessing Geometry Directly. The intent of this paper is to provide an overview to the alternative approaches and how they address the specific issues related to accessing CAD geometry for mesh generation. It is not the intent of this paper to provide detailed algorithms related to accessing or repairing CAD data. There are several issues associated with effective and efficient access of CAD geometry for mesh generation. This section will provide a quick overview of several of the major issues and the ramifications that this issues have on mesh generation Understanding the Analysis Requirements The first major issue with CAD geometry access for mesh generation is the need to understand the analysis requirements. The appropriate mesh and geometry to be used for meshing is a function of the analysis to be performed and the desired accuracy. There does not exist an optimal mesh independent of the analysis to be performed. A-prior element shape quality test have often been used as a misleading indicator of a good mesh independent of the analysis to be performed or the accuracy desired. The appropriate mesh is one that produces the desired accuracy for the problem to be solved. In practice this is only achievable through adaptively. Different types of analyses require different instances of the geometry to capture the physics. For example, we can perform a dynamic structural response analysis and a Computational Fluid Dynamics (CFD) analysis on the same part. The dynamic structural response analysis requires the solid geometry of the part while the CFD analysis requires the geometry of the cavities through which the fluid will flow. This simple illustration of different use of geometry representations is illustrated in Figure 2.4. Dynamic structural response analysis requires solid geometry of the part. While CFD analysis requires geometry of the flow cavities. Different types of analysis also require different resolutions of mesh to achieve the desired accuracy on a particular design.

Figure 2.4

Different Analysis Require Different Geometric Representations

Disfeaturing Disfeaturing is one of the most complex issues associated with CAD geometry access for mesh generation. Indeed one of the major issues that the CAD and CAE software industries have encountered is developing a consistent definition of a feature. For the purposes of this paper we will classify features into two main groups. The first group of features will be called “intended features”.

16

Intended features are features that were explicitly defined as features in the model that drive the resulting geometry. In this case a feature-based modeling system was used to create a model which contains intended features. Intended features can only be created by feature-based modeling systems and can be suppressed by the original modeling system. The second group of features will be called “artifact features”. Artifact features are features that are created indirectly by the modeling process. One example of artifact features is the creation of engineering features such as holes by a modeling system that is not feature-based. The second example of artifact features is the creation of recognizable patterns of geometry / topology data that create a valid design model but also create difficulties associated with mesh generation. Artifact features can be created from any modeling system and cannot be suppressed in the original modeling system. Figure 2.5 illustrates small features removed from geometry. Part of the complexity associated with CAD geometry access for mesh generation is due to the fact that historically analyses are performed too late in the design process and the design model contains more details than are appropriate for analysis. Moving the analysis earlier in the design process will help to reduce, but will not remove, the need for defeating. Since multiple analysis types may be required for any design state there remains a need for defeating to various levels to support the range of analysis to be performed.

Figure 2.5

Small Feature (Left) vs Removed (Right)

“Dirty” Geometry Dirty geometry has been one of the most nagging issues related to geometry access. Dirty geometry consists of gaps, overlaps and other incompatibilities in the model preventing the model from being valid. These incompatibilities do not exist in the native CAD system and are introduced from translating the native CAD geometry to another format. Differences in representations, methods and tolerances between modeling engines create dirty geometry. Translators must then heal or repair the geometry to represent it as a valid model in the non-native system9-10-11. Note that without knowledge of the modeling system tolerances and methods, there is no a priori means to ensure a Butlin, G., Stops C., “CAD Data Repair”, Proc. 5th Int. Meshing Roundtable, pp. 7-12, 1996. Mezentsev, A.A. and Woehler, T., “Methods and algorithms of automated CAD repair for incremental surface meshing”, Proc. 8th Int. Meshing Roundtable, Sandia report SAND 99-2288, pp. 299-309, 1999. 11 Ribo, R., Bugeda, G. and Onate, E., “Some algorithms to correct a geometry in order to create a finite element mesh”, Computers and Structures, 80:1399-1408, 2002. 9

10

17

healing process will successfully recover the correct model representation.

18

3 Structured Mesh Generation Mesh generation or Domain Discretization has evolved to the point where highly complicated domains can be covered by a variety of mesh types including hexahedral, tetrahedral and overset meshes. It is an important and very tedious aspect of computational geometry and accounts for almost 70% of CFD works. The concept of a mesh as a field or domain discretization of space has been associated with computational methods since the first attempts to obtain numerical solutions of partial differential equations12. Establishing a suitable mesh was long considered to be a rather tedious exercise and a minor part of the computational effort involved in solving partial differential equations by either a finite difference or finite element method. But mesh generation has steadily evolved into a discipline in its own right drawing on ideas from other fields, in particular mathematics and computer science, and gradually developing a distinct identity of its own. Two series of international conferences are now devoted entirely to mesh generation and adaptation, and almost all conferences on computational methods have sessions that feature this topic. In addition, it is important to recognize the growing interest of the computer science community in mesh related problems. In addition, it is important to recognize the growing interest of the computer science

Figure 3.1

12

Classification of Grid Generation Algorithms (Courtesy of Steven Owen)

Richardson LF. Weather prediction by numerical process. Cambridge: Cambridge University Press; 1921.

19

community in mesh related problems13. Not only has this synergy brought new ideas and ways of viewing mesh related questions, it has also opened up whole new areas of application including medical imaging and segmentation, computer graphics and animation, and data interpolation and compression.14

3.1 Classification of Mesh Generation Techniques

As discussed before, the mesh generation techniques can be divided to two major categories of structured and un-structured mesh. Strictly speaking, a structured mesh can be recognized by all interior nodes of the mesh having an equal number of adjacent elements. For our purposes, the mesh generated by a structured grid generator is typically all quad or hexahedral. Algorithms employed generally involve complex iterative smoothing techniques that attempt to align elements with boundaries or physical domains. Where non-trivial boundaries are required, block structured techniques can be employed which allow the user to break the domain up into topological blocks15. Structured grid generators are most commonly used within the CFD field, where strict alignment of elements can be required by the analysis code or necessary to capture physical phenomenon16. Unstructured mesh generation, on the other hand, relaxes the node valence requirement, allowing any number of elements to meet at a single node. Triangle and Tetrahedral meshes are most commonly thought of when referring to unstructured meshing, although quadrilateral and hexahedral meshes can also be unstructured. While there is certainly some overlap between structured and unstructured mesh generation technologies, the main feature which distinguish the two fields are the unique iterative smoothing algorithms employed by structured grid generation. The semi-complete picture of grid generation algorithm is updated by S. Owens and presented here as reference17 (see Figure 3.1). In general, on the structure side, some mapping techniques such as Transfinite Interpolation (TFI), or Elliptic operator are used extensively and proven to be sufficient for majority of applications. On unstructured side, the same could be said about Advancing Front or Delaunay triangulation. The above table is too broad and extensive for our purpose. Our concentration, as red circles indicate, would be on 

Structured Grid  Complex Variables (Restricted to 2D)  Algebraic Techniques (TFI)  PDE Methods (PDE)



Unstructured Grid  Delany Triangulation  Advancing Front  Octree Method  Hybrid Meshes  Overset Meshes  Cartesian Meshes Adaptive Grids  Structured  Unstructured



Edelsbrunner H. “Geometry and topology for mesh generation”, Cambridge: Cambridge university, 2001. Baker, T., “Mesh generation: Art or science?” MAE Department, Princeton University, Princeton, NJ. 15 Steven J. Owen, “A Survey of Unstructured Mesh Generation Technology”, Carnegie Mellon University, PA. 16 Introduction: An Initial Guide to CFD and to this Volume; page 1, 2007. 17 Steven Owen: Introduction to unstructured mesh generation, 2005. 13 14

20

3.2 Domain Decomposition and Multi-Block Strategy One of the essential topics in grid generation is the topic of Domain Decomposition (DD). It is in essence a “divide and conquer” technique for arriving at the solution of problem defined over a domain from the solution of related problems posed on subdomains. The main reason is that the solution Iterate of the subdomain is qualitatively or quantitatively “easier” than Figure 3.2 Schwarz concept of iterating between domains the original one. Other factors are memory concern as well as that the subdomain can be solved with the aid of parallel programing. The issue of domain decomposition is vast and it involves a lot of math such as Schwarz concept18. He purposed that simply:  Solve the PDE in the circle with boundaries taken from interior of square.  Solve the PDE in the square with Boundaries taken from interior of circle. And then iterate as depicted in Figure 3.2. These days, with aid of strong work stations with visual aids, this is running on the background. The user does not know, or cared, what algorithm in running. Some of the vendors are opted for automatic DD schemes, or at least to begin with. User has options to change the topology later. But there is no free launch! There is usually a script which should be run prior to DD. An example would be GridPro® which is runes a TIL (Topology Input Language) script, written in C. The DD obtained using a TIL for an M6 wing is shown in Figure 3.3. Other venders have their own scripts or input data depending. Another example is Poitwise® which uses Glyph or newer Figure 3.3 Domain Decomposition for M6 wing using TIL Glyph2 as a scripting for the geometry. scripts (Courtesy of GridPro) There are generally two methods for generating the grid; Top to Bottom (TTB) and inversely Bottom to Top (BTT). While most of unstructured mesh engines use the TTB approaches, majority of structured ones are adapted to BTT. Some might think that multi-blocking approach is too tedious which of course is true. But the reward is in complete control of grid and its quality, something which is usually lacking in automated unstructured grid generates.

David E. Keyes, “Domain Decomposition Methods for Partial Differential Equations”, Department of Applied Physics & Applied Mathematics Columbia University. 18

21

3.3

Field (Domain) Discretization Process (Mesh Generation)

Once a mathematical model is selected, we can start with the major process of a simulation, namely the domain discretization process. Since the computer recognizes only numbers, we have to translate our geometrical and mathematical models into numbers which of course called discretization. The first action is to discretize the space, including the geometries and solid bodies present in the flow field or enclosing the flow domain. This set of points, which replaces the continuity of the real space by a finite number of isolated points in space, is called a grid or a mesh. The process of grid generation is in general extremely complex and requires dedicated software tools to help in defining grids that follow the solid surfaces (this is called ‘body-fitted’ grids) and have a minimum level of regularity. We wish already here to draw your attention to the fact that, when dealing with complex geometries, the grid generation process can be very delicate and time consuming. Grid generation is a major step in setting up a CFD analysis, since, as we will see the outcome of a CFD Figure 3.4 Example of Unstructured simulation and its accuracy can be extremely Tetrahedral Grids dependent on the grid properties and quality. Please notice here that the whole object of the simulation is for the computer to provide the numerical values of all the relevant flow variables, such as velocity, pressure, temperature, etc., at the positions of the mesh points. Hence, this first step of grid generation is essential and cannot be omitted. Without a grid, there is no possibility to start a CFD simulation. Figure 3.5 shows examples of 2D and 3D structured grids, while Figure 3.4 displays an example of mainly tetrahedral unstructured grids.

Figure 3.5

Examples of Structured grids for Turbine Blade

22

3.4

Conformal Mapping (The Sponge Analogy)

It is perhaps not surprising that conformal mapping was among the first and most effective techniques to carry out this task. The best way to the correspondence of a curvilinear grid in physical domain, with logically rectangle grid in computational domain, is through sponge analogy. Consider a rectangular sponge within which an equally spaced Cartesian grid has been drowned. Now wrapped the sponge around a circular cylinder and connect the two end of sponge together. Clearly the original Cartesian grid now becomes a curvilinear grid fitted the cylinder. But the rectangle logical form of grid lattice is still 19 preserved . Figure 3.6 spectacles a simply connected (as oppose to Figure 3.6 Sponge Analogy multiple connected) region which obviously results in O type grid. Since the difference formulae were applied in mapped space it was necessary to transform the partial differential equations to the coordinate system associated with the mapping. Conformal maps lead to a new set of fairly straightforward equations without messy cross-derivative terms. In addition, the orthogonality and smoothness properties of review of conformal mapping meshes obtained in this manner produce a high quality mesh in physical space. Perhaps the first published application of conformal mapping to Computational Fluid Dynamics (CFD) is circle plane mapping that transforms the space exterior to an airfoil onto the interior of the unit circle. This particular conformal mapping technique extends back a long way but its use for creating suitable meshes was a novel application. The same mapping was later used by Bauer et al.20 when they developed the first transonic flow code for solving the full potential equation. Other conformal mappings were developed to handle axisymmetric inlets and airfoil/slat combinations. A comprehensive techniques for mesh generation has been given by Moretti21. Another useful reference is the paper by22.

Baker, T.,J., “Mesh generation: Art or science?”, MAE Department, Princeton University, Princeton, NJ. Bauer F, Garabedian P, Korn D. Supercritical wing sections I, Lecture Notes in Economics and Mathematical Systems, vol. 66. Berlin: Springer; 1972. 21 Moretti G.”Grid generation using classical techniques”. Proceedings of the NASA Langley workshop on numerical grid generation techniques, Langley, VA, October, 1980. 22 CaugheyDA, “A systematic procedure for generating useful conformal mappings”, Int J Num Meth Eng 1978.1. 19 20

23

3.5

Domain Decomposition with MultiBlocking (Multi-Sponge Analogy)

This problem was largely solved by the second significant development, the multi block strategy, or Domain Decomposition. The basic idea, first formulated is to break up the domain into several smaller blocks (essentially an ultra-coarse mesh) and then generate separate meshes in each individual block. Figure 3.7 illustrates this idea by showing a schematic of a three block decomposition for the region around a wing. In this example, one would use an H–H-mesh combination in blocks 1 and 3 and a C–H-mesh combination in block 2. A block corresponds to a sub domain that is geometrically much simpler than the full Figure 3.7 Multi Block representation for Cconfiguration and which can therefore be easily H mesh around a wing meshed either by solving a partial differential 23 equation or, alternatively, by an algebraic method . It is, in fact, common practice nowadays to create the mesh in any particular block by an algebraic method such as transfinite interpolation and then smooth the mesh by some iterations of an elliptic solver. A slightly more complicated topology of a dual Block for generic airplane configuration shown on Figure 3.10. An example showing a multi block conformal mapping for a M6 wing is illustrated in Figure 3.8 (a). Another example of multi-block structure gridding for a Turbine Blade is giving by Figure 3.9. GridPro© has developed a Topology Input Language (TIL) which can be used for similar geometries with minimal effort24. As an example, the topology and grid is putted for M6 wing, can be used for Reference H wing, and results are displayed in Figure 3.8 (b).

Eriksson LE,”Generation of boundary-conforming grids around wing-body configurations using transfinite interpolation”, AIAA J 1982; 20:1313–20. 24 An overview of Grid Pro/az3000 for automated grid generation. 23

24

(a) M6 Wing

Figure 3.8

(b) Reference H

Topology and Grid on a Multi-Block Wings using GridPro®

3.6 Structured Grid Generation In general, decomposition of the physical domain produces several blocks. Each block is usually defined by six sides, and each side can be defined by either a surface, plane, line, or a point. If one side of a block collapses to a line or a point, then there would be a singularity in the block. In some instances, a block may have been defined by less than six surfaces. Once the surfaces are defined, the interior grid can be computed by any standard grid generation technique. The cell information stored in a 3D array, in random fashion and could be easily access. Complex Variables Complex variables techniques have the advantage that the transformation used are analytic as opposed to those methods that are entirely numerical. Figure 3.9 Multi-block gridding over Unfortunately, complex variable method are restricted Turbine blade (Courtesy of GridPro) to two dimension. For this reason, the technique has limited applicability and will not be covered here. For details readers should refer to Churchill25, Moretti, and Davis.

25

Churchill, R., V., “Introduction to Complex Variables”, McGraw-Hill, New York.

25

Algebraic Methods -Transfinite Interpolation (TFI) Transfinite Interpolation has been used to generate the interior grid points from the boundary surfaces. In 2D (I, J), we may inscribe a linear Lagrange interpolation function as: N M ξ  η r( , )    n   r(ξ n , η)   ψ m   r( , m )  I J n 1 m 1 N M ξ η  n  ψ m   r(ξ n , ηm )  I J n 1 m 1

Eq. 3.1

Where now the "blending" functions, φn and ψm, are any functions which satisfy the cardinality conditions:

ξ  n  L   δ nL n, L  1,2,..., N  I 

η  and ψ m  L   δ mL m, L  1,2,...., M  J 

Eq. 3.2 The interpolation function defined by Eq. 3.2 can be thought of two unidirectional interpolation the corner points which has been duplicated. With N=M=2, using the Lagrange interpolation polynomials as the blending functions, is termed the transfinite bilinear interpolant. With N=M=3, this form is the transfinite bi-cubic-interpolation. Other candidates for the blending functions are the Exponential, Hermit Interpolation Polynomials and Splines. For example, for n, L = 2, Eq. 3.3 shows a typical Exponential blending function as K

1 ( ) 

e

ξ 2 ξ ξ 2  ξ1

1 e 1 K

K

,

 2 ( ) 

e

ξ  ξ1 ξ 2  ξ1

1 e 1 K

Eq. 3.3 Where K is a negative constant greater than one. The greater the K, the less discontinuity will propagate. Similarly, a blending function could be constructed for η direction. The spline-blended form gives the smoothest grid with continuous second derivatives26. A sample coding in FORTRAN is given in Appendix A and the resultant grid and topology for a dual-block generic airplane geometry is display in Figure 3.11. A pioneering work in control point form of Algebraic Grid Generation using

26 Joe

F. Thompson, Z. U. A. Warsi, C. Wayne Mastin, “Numerical Grid Generation -Foundations and Applications”, North Holland, 1985.

26

a univariate interpolations can be attributed to [Eiseman and Smith]27.

Figure 3.10

Dual Block grid topology for a generic airplane configuration

PDE Solver Like algebraic methods, differential equation methods are also used to generate grids. Grid construction can be done using all three classes of partial differential equations. The generation of field values of a function from boundary values can be done in various ways, e.g., by interpolation between the boundaries, etc., as is discussed previously. The solution of such a boundary-value problem, however, is a classic problem of partial differential equations, so that it is logical to take the coordinates to be solutions of a system of partial differential equations. If the coordinate points (and/or slopes) are specified on the entire closed boundary of the physical region, the equations must be elliptic, while if the specification is on only a portion of the boundary the equations would be parabolic or 27

Figure 3.11 Grid for dual-block generic airplane geometry

Peter Eiseman and Robert E. Smith, “Applications of Algebraic Grid Generation”, April 1990.

27

hyperbolic. This latter case would occur, for instance, when an inner boundary of a physical region is specified, but a surrounding outer boundary is arbitrary. The present chapter, however, treats the general case of a completely specified boundary, which requires an elliptic partial differential system. 3.6.3.1 Elliptic Schemes At this stage grid is smooth enough to satisfy majority of applications, but if needed, further smoothing is obtained with solution of elliptic partial differential equations (PDE). For 2-D formulation, forcing function terms are used to construct stretched layers of the cells close to the domain boundaries.

ξ xx  ξ yy  P( , η)

,

ηxx  ηyy  Q( , η)

Eq. 3.4

Where (ξ, η) are the coordinates in the computational domain. Control functions are computed using the boundary point spacing, r, and then interpolated to the inner points28. The forcing terms (P, Q) are computed as:

P

r  2 r ξ ξ 2 r ξ

2

, Q

r  2 r η η2 Eq. 3.5

2

r η

Once P and Q are obtained at each boundary the values for the inner points are obtained using a linear interpolating along lines of constant ξ and η:

P ,   (1  η) P1    ηP2  

0  ξ 1

Q ,   (1  ξ) Q1    ξQ 2  

Eq. 3.6

0  η 1

Grid control of orthogonality at boundaries is introduced adding a second term in P and Q as:

P

r  2 r ξ ξ 2 r ξ

2

λ

r  2 r ξ η2 r η

2

,

Q

r  2 r 2 η η r η

2

λ

r  2 r η ξ 2 r ξ

2

Eq. 3.7

Where 0 < λ < 1 is a factor that relaxes the orthogonality at the boundaries. It has been observed that the range λ∈ [0.4-0.7] produces optimal results for our configurations. The elliptic PDEs are solved using a multi-grid method and the smoother is based on a point-wise Newton solver. When the

Thomas P., and Middlecoff J., ”Direct control of the Grid Point Distribution in Meshes Generated by Elliptic Equations”, AIAA Journal Vol. 18, No. 6., 1980. 28

28

forcing terms are used the convergence of the algorithm deteriorates slightly29. An important property in regard to coordinate system generation is the inherent smoothness that prevails in the solutions of elliptic systems. Furthermore, boundary slope discontinuities are not propagated into the field. Finally, the smoothing tendencies of elliptic operators, and the extremum principles, allow grids to be generated for any configurations Figure 3.12 Typical Elliptic Grid for an Airfoil with without overlap of grid lines (see Orthogonality Enforced on the Boundary Figure 3.12). There are thus a number of advantages to using a system of elliptic partial differential equations as a means of coordinate system generation. A disadvantage, of course, is that a system of partial differential equations must be solved to generate the coordinate system. 3.6.3.2 Hyperbolic Schemes This grid generation scheme is generally applicable to problems with open domains consistent with the type of PDE describing the physical problem. The advantage associated with Hyperbolic PDEs is that the governing equations need to be solved only once for generating grid. The initial point distribution along with the approximate boundary conditions forms the required input and the solution is the then marched outward. Steger and Sorenson30 proposed a volume orthogonality method that uses Hyperbolic PDEs for mesh generation. For a 2D problem, considering computational space to be given by Δξ = Δη =1, the inverse of the Jacobian is given by,

x ξ y η  x η yξ  I

Eq. 3.8

Where I represents the area in physical space for a given area in computational space. The second equation links the orthogonality of grid lines at the boundary in physical space which can be written as

dξ  0  ξ x dx  ξ y dy

Eq. 3.9

For ξ and η surfaces to be perpendicular the equation becomes:

x ξ y η  yξ y η  0

Eq. 3.10

The problem associated with such system of equations is the specification of I. Poor selection of I may lead to shock and discontinuous propagation of this information throughout the mesh. While mesh being orthogonal is generated very rapidly which comes out as an advantage with this method. Figure 3.13 displays a C-O type hyperbolic grid around an HSCT wing-fuselage configuration, with Sorenson R. L. and Steger J. L. Numerical Generation of Two dimensional Grids by the Use of Poisson Equations with Grid Control, in Numerical Grid Generation Techniques, R. E Smith, ed.. NASA CP 2166, NASA Langley Research Center, Hampton, VA, USA, 1980. 30 Steger, J.L; Sorenson, R.L (1980). "Use of hyperbolic partial differential equation to generate body fitted coordinates, Numerical Grid Generation Techniques". NASA conference publication 2166: 463–478. 29

29

Pressure contours mapped using an Euler solution and M∞ = 2.4. 3.6.3.3 Parabolic Scheme The solving technique is similar to that of hyperbolic PDEs by advancing the solution away from the initial data surface satisfying the boundary conditions at the end. Nakamura (1982) and Edwards (1985) developed the basic ideas for parabolic grid generation. The idea uses either of Laplace or the Poisson's equation and especially treating the parts which controls elliptic behavior. The initial values are given as the coordinates of the point along the surface η = 0 and the advancing the solutions to the outer surface of the object satisfying the boundary conditions along ξ edges. The control of the grid spacing has not been suggested till now. Figure 3.13 Euler Solution on a HSCT Wing-Fuselage Nakamura and Edwards, grid control was accomplished using non uniform spacing. The parabolic grid generation shows an advantage over the hyperbolic grid generation that, no shocks or discontinuities occur and the grid is relatively smooth. The specifications of initial values and selection of step size to control the grid points is however time consuming, but these techniques can be effective when familiarity and experience is gained. Variational Method These methods have evolved from elliptic grid generation. To solve an elliptic PDE is often equivalent to minimizing a functional. Variational methods has been used for improving quality of a given grid31. In the vibrational methods, a grid functional is defined. Grid functional is an algebraic expression of

Figure 3.14

Folded Grid by Transfinite Interpolation - Smooth Grid by Winslow Functional

the position vectors of the internal nodes of a mesh. Optimization of the grid functional may result in a grid with desired properties such as orthogonal grid lines, equal cell areas, linear or parallelogram cells and untangled mesh. There are many algebraic functional for grid generation and optimization. For example, algebraic grid generation methods such as Transfinite Interpolations though, one of 31

J.F. Thompson, B.K. Soni and N.P. Weatherill. Handbook of Grid Generation. CRC Press, 1998.

30

simplest method of grid generation, but can produce folded grids for curved domains as seen in the Figure 3.14. One other disadvantage of algebraic grid generation is that boundary discontinuity can prorogate inside the domain. As indicated in Figure 3.14, Winslow functional smooth the grid, and removes the folded grid lines. There are far too many algebraic functional for grid generation and optimization as reader should check with32.

1.8 Structured Adaptive Grid In an adaptive grid, the physics of the problem at hand must ultimately direct the grid points to distribute themselves so that a functional relationship on these points can represent the physical solution with sufficient accuracy33. The idea is to have the grid point’s move as the physical solution develops, concentrating in regions of large variation in the solution as they emerge. The mathematics controls the points by sensing the gradients in the evolving physical solution, evaluating the accuracy of the discrete representation of the solution, communicating the needs of the physics to the points, and finally by providing mutual communication among the points as they respond to the physics. The basic techniques involved then are as follows:    

A means of distributing points over the field in an orderly fashion, so that neighbors may be easily identified and data can be stored and handled efficiently. A means of communication between points so that a smooth distribution is maintained as points shift their position. A means of representing continuous functions by discrete values on a collection of points with sufficient accuracy, and a means for evaluation of the error in this representation. A means for communicating the need for a redistribution of points in the light of the error evaluation, and a means of controlling this redistribution.

Several considerations are involved here, some of which are conflicting. The points must concentrate, and yet no region can be allowed to become devoid of points. The distribution also must retain a sufficient degree of smoothness, and the grid must not become too skewed, else the truncation error will be increased as noted. This means that points must not move independently, but rather each point must somehow be coupled at least to its neighbors. Also, the grid points must not move too far or too fast, else oscillations may occur. Finally the solution error, or other driving measure, must be sensed, and there must be a mechanism for translating this into motion of the grid. The need for a mutual influence among the points calls to mind either some elliptic system, thinking continuously, of some sort of attraction (repulsion) between points, thinking discretely. Both approaches have been taken with some success, and both are discussed below. It should be noted that the use of an adaptive grid may not necessarily increase the computer time, even though more computations are necessary, since convergence properties of the solution may be improved, and certainly fewer points will be required. With the time derivatives at fixed values of the physical coordinates transformed to time derivatives taken at fixed values of the curvilinear coordinates, no interpolation is required when the adaptive grid moves. Thus the first derivative transformation given the chain rule is given by

Sanjay Kumar Khattri, “Grid Generation and Adaptation by Functionals”, Department of Mathematics, University of Bergen, Norway. 33 Joe F. Thompson, J., F., Warsi, Z., U., A., Mastin, .W. “Numerical Grid Generation; Foundations and Applications”, North-Holland Book, 1995. 32

31

(

∂A ∂A ∂x =( ) + ∇A. ( ) ) ∂t ξ,η,ζ ∂t x,y,z ∂t ξ,η,ζ 3

∂A ∂A ∂A =( ) +∑ ( ) ∂t ξ,η,ζ ∂t x,y,z ∂xi i=1

Eq. 3.11

or

∂xi ( ) ⏟∂t mesh movement

The computation thus can be done on a fixed grid in the transformed space, without need of interpolation, even though the grid points are in motion in physical space. The influence of the motion of the grid points registered through the grid speeds, (xi) t, appearing in the transformed time derivative. This is the appropriate approach when the grid evolves with the solution at each Time step. Some methods, however, change the grid only at selected time steps, and here interpolation must be used to transfer the values from the old grid to the new since the grid movement is not continuous. A combination of the weight functions given by Eq. 3.11 provides the desired tendency toward concentration both in regions of high gradient and near extrema. The effect of the inclusion of the curvature illustrated below:

  A  w  (1  β 2 K )1  α 2     x   

2

1/2

   

where

K

2A x 2   A  2  1      x    

3/2

Eq. 3.12

Where α and β are parameters to be specified. Clearly, concentration near high gradients is emphasized by large values of 𝜶 , while concentration near extrema (or other regions of large curvature) is emphasized by large β.

Figure 3.15

1D Weight Function for High Gradient and Curvature

Case Study – 2D Euler Flow over and NACA Airfoil In a grid adaptation method for structured grids without adding or removing grid points, adaptation is achieved through moving the grid points toward the desired locations. Changes in the mesh point

32

locations can be controlled by two methods.34 In the first method, the arc elements forming the ides of a control volume are directly related to specified functions. For a three-dimensional problem, this implies that three arc elements need to be given. In the second method, the cell volume may be altered by specifying that the volume of each element change according to a specific rule. To control the cell size, only one relationship must be specified that relates the volume to the quantity responsible for changes in the mesh. The specification of only one control function is an advantage in simplicity but may be less flexible than independently controlling arc lengths. The cell volume control method is applied successfully to calculating transonic Euler flows with shock waves. The method is applied to computing the flow field over an airfoil. Figure 3.16 shows the initial C-mesh of an NACA 0012 airfoil and the adaptive one on the right, with their respective Mach contours. Two flow cases were calculated over the initial grid. The first is a transonic case with free stream Mach number, M1 = 0.85 and an angle of attack, α = 1 where Left is without mesh adaption and Right is with. There is one strong shock wave on the upper side of the airfoil and a weaker one on the lower side. It can be seen from Figure 3.16 that the computed shock waves are rather thick. Shock waves zero thickness in the inviscid limit. To get better computational results, particularly to capture the shock waves more accurately, one would like to concentrate grid points around the shock waves. The deformation method is applied to get a new grid with prescribed distribution of cell sizes based on

Figure 3.16

Mesh and Mach contours for Transonic Flow

Feng Liu, Shanhong Ji, and Guojun Liao,” An Adaptive Grid Method and Its Application to Steady Euler Flow Calculations”, Siam J. Sci. Comput. C° 1998 Society For Industrial And Applied Mathematics Vol. 20, No. 3, Pp. 811{825 34

33

gradients of the flow field. The adaptive criterion here is to detect the shock waves. This suggests choosing the monitor function f of the form:

1  C1 (1  C2P) f

Eq. 3.13

Where P is the pressure and C1and C2 are constants. It can be seen that grid points are clustered closely in the areas where the two shock waves occur, although grid lines are somewhat skewed in the clustered regions because the deformation method does not guarantee orthogonality. However, since our flow solver is based on a finite volume scheme which does not require the use of an orthogonal grid, we are content with the locally reduced cell sizes. Another test case is the supersonic flow over the same airfoil with a free stream Mach number M∞ = 1.5, and α= 0. As can be seen, a strong bow shock wave appears in front of the airfoil leading edge. In addition, there are two weak shocks emanating from the trailing edge of the airfoil the Mach number distribution computed on the adapted grid. It can be seen that a sharper front of the bow shock is captured compared with that on the initial un-adapted grid. The resolution of the two trailing edge shocks is also slightly increased. The computational time needed for the grid adaptation and the flow solver for the supersonic case is the same as that for the transonic case. (See Figure 3.17).

Figure 3.17

Grid Adaption and Mack Contours for Supersonic Airfoil

34

4 Un-Structured Mesh Generation The 1980s also witnessed the rapid development of alternative meshing techniques. The most prominent of these are the unstructured methods based on triangles in 2D and tetrahedral in 3D. Some of the earliest ideas for generating triangular meshes over planar regions can be found in a review by Thacker35. It is interesting to note that until the mid-1980s little effort had been applied to the problem of computing aerodynamic flow fields on meshes of triangles or tetrahedral. The first attempts to solve the flow around a complete aircraft by means of a finite element solution on a tetrahedral mesh are described in the papers of [Bristeau et al.] and [Jameson et al.]. There are three essentially different approaches to generating triangular or tetrahedral meshes, the moving front technique36, Delaunay base methods37,38,39 and the Octree approach40. Moving front and Delaunay based methods create a triangulation that matches a prescribed boundary (a specified set of points and edges in 2D, a specified set of points and triangular faces in 3D). The Octree method, however, determines the boundary discretization as part of the domain meshing procedure and is thus closely related to the Cartesian approach. Each method is discussed below.

4.1 Advancing Front Method This technique has the virtue of starting from a prescribed boundary definition (set of edges in 2D, set of triangular faces in 3D) which remains intact throughout the mesh generation process. The boundary triangulation is regarded as a front on which a new layer of elements is built. The original front triangles become interior faces of the mesh and a new set of front faces is created, a process that continues until the entire domain has been filled. A particular difficulty of this method occurs in the closing stages when the front is collapsing on itself and the last vestiges of empty space are replaced by new elements. This is Figure 4.1 Closing stage of a Moving Front Method illustrated in Figure 4.1 which demonstrations an almost completed triangulation of the region around an airfoil with the edges on the current front marked in bold. In Thacker WC. A brief review of techniques for generating irregular computational grids. Intentional Journal Numerical Meth Eng. 1980; 15:1335–41. 36 Lo SH. A new mesh generation scheme for arbitrary planar domains. Int J Numer Meth Eng 1985;21:1403–2 37 Baker TJ. Three dimensional mesh generation by triangulation of arbitrary point sets, AIAA eighth CFD conference. Honolulu, HI. AIAA paper 87-1124, 1987. 38 Weatherill NP. , “A method for generating irregular computational grids in multiply connected planar domains”, International Journal Number Meth Fluids 1988; 8:181–97. 39 George PL, Hecht F, Saltel E. Constraint of the boundary and automatic mesh generation. Proceedings of the second international conference on num grid gen comp fluid dyn, Miami, FL, 1988. p. 589–97. 40 YerryMA, Shephard MS., “Automatic three-dimensional mesh generation by the modified Octree technique”, Int J Numer Meth Eng 1984; 20:1965–90. 35

35

practice, there is rarely any difficulty in completing the process for a planar triangulation. In three dimensions, however, the remaining region of space can have an extremely complicated shape which may not yield to an acceptable covering by tetrahedral elements, thus preventing the volume triangulation from filling the entire region to be meshed. The basic methodology is based on action performed for a certain boundary image as described by geometric rules or tests. These rules (2D and 3D) are to optimize the shape of the new element in the advancing front method. Each methodology depends on these rule, its complexity, and how they been applied. Therefore, the algorithm has to check the rules stored in data structures. The code complexity is independent of the number of rules. The algorithm is complicated, but well defined and can be, at least theoretically, implemented failsafe. Especially in 3D, the choice of the concrete rules is based on heuristics, which is put into an easily maintainable rule description data-base41. Advancing Front Triangular Mesh Generator The original advancing front algorithm has been developed over time into a family of programs which are very reliable and flexible for an easy incorporation of mesh adaptation42. The advancing front mesh generator can be described as .      

Input of geometric data (using control points); Input of mesh control parameters (through a background mesh); Geometric modeling (using cubic splines); Boundary discretization (placing new points on the boundary); Domain discretization (simultaneously generating points and triangles); Mesh quality enhancement (through topological and geometrical strategies).

The computational domain is modeled through the use of cubic splines which are defined by some control points. Close to singularities extra care must be taken in the definition of these points in order to avoid failure (Thompson et al., 1999). As a “pre-processing” stage, before the mesh generation begins, we must first build an initial and very coarse triangular background mesh that covers the whole domain. This coarser mesh is used only to provide a piecewise linear spatial distribution of the nodal parameters over the mesh to be constructed. Typically, elements of the generated mesh will have a projected length of δ2 in the direction parallel to α2 a and a projected length of St δ2 in the direction normal to α2 a (see Figure 4.2), with St being the stretching

41 Joachim

Figure 4.2

Mesh parameters

Sch¨ober, “NETGEN An advancing front 2D/3D-mesh generator based on abstract rules”, Computing and Visualization in Science, 1:41–52 (1997). 42 Paulo Roberto M. Lyra, Darlan Karlo E. de Carvalho, “A Computational Methodology for Automatic TwoDimensional Anisotropic Mesh Generation and Adaptation”, Methodology for Automatic Two-Dimensional Anisotropic Mesh Generation and Adaptation.

36

factor. During the generation process, the local values of these parameters will be obtained by a linear interpolation over the triangles of the background mesh. The boundary of the domain is represented by the union of boundary segments forming closed loops. External boundaries are defined in an anti-clockwise fashion while inner boundaries are set in a clockwise manner. As described previously, the generation of a triangular mesh by the advancing front technique begins by the discretization of the boundary of the domain. New points are created according to the mesh parameters which are interpolated from those of the background mesh. At the beginning of the process, the generation front is made by a set of linear segments connecting the boundary nodes. With the initial front defined, one segment is chosen and, in general, a triangle is created through the insertion of an internal node or by simply connecting existing nodes. New triangles are built following the same procedure. During the process any segment available to build a new triangle is set as “active” and the others which are set as “non-active” are removed from the generation front. Therefore the boundary segments are not modified during the mesh generation. The procedure continues until the whole domain is discretized. When solving problems which develop some essentially one dimensional features at certain regions (e.g. boundary layer, shocks, etc.) it is not very efficient to use uniform isotropic meshes. In these cases, it is important to have the possibility to define a direction and a stretching factor for the elements close to such regions. At least for linear triangular elements, the use of anisotropic meshes can be extremely important in terms of computational effort and accuracy. To generate an anisotropic triangulation of the desired domain, it is used a transformation T which is a function of the mesh parameters, i.e. αi , i = 1, 2. This transformation43, is given by, N

1 T(α i , δi )   (α i  α i ) i 1 δ i

Eq. 4.1

where X denotes the tensor product of two vectors and N is the number of dimensions, here, N = 2. The effect of this transformation is to map the physical domain into a normalized domain, where a mesh is generated in which the elements are approximately equilateral with unit average size. Applying the inverse of this transformation T -1, we end up with a directional stretched mesh dictated by the mesh parameters, which are defined either by the analyst or by the mesh adaptive procedure. This mesh generator provides an accurate geometric modeling and high quality meshes, where the high level of control of the distribution of local mesh parameters eases the incorporation of mesh adaptation strategies. The quality of the meshes is strongly influenced by the mesh optimization stage. A specific mesh improvement strategy for highly anisotropic meshes and the definition of an adequate sequence of mesh enhancement procedures are incorporated into the code. Several other modifications have been introduced in the original code in order to incorporate the flexibility to deal with predefined multi-domains and automatically defined sub-regions, to build boundary layer meshes, to make possible generating quadrilateral and mixed meshes and the automatic definition of which domains or sub-regions should be filled up by triangular or by quadrilateral elements. These features will be fully described in the correspondent sections.

4.2 Delaney Triangulation Method

Delaunay triangulation for a given set of discrete points in a plane is a triangulation such that no point in is inside the circumcircle of any triangle in. Delaunay triangulations maximize the minimum angle of all the angles of the triangles in the triangulation; they tend to avoid sliver triangles. The Peiró, J., Peraire, J. and Morgan, K., 1994, “{FELISA SYSTEM}: Reference Manual Part1 - Basic Theory”, University of Wales Swansea Report CR/821/94. 43

37

triangulation is named after [Boris Delaunay]44 for his work on this topic. For a set of points on the same line there is no Delaunay triangulation (the notion of triangulation is degenerate for this case). For four or more points on the same circle (e.g., the vertices of a rectangle) the Delaunay triangulation is not unique: each of the two possible triangulations that split the quadrangle into two triangles satisfies the "Delaunay condition", i.e., the requirement that the circumcircles of all triangles have empty interiors. By considering circumscribed spheres, the notion of Delaunay triangulation extends to three and higher dimensions. Generalizations are possible to metrics other than Euclidean distance. However, in these cases a Delaunay triangulation is not guaranteed to exist or be unique45. The Delaunay triangulation of a discrete point set points in general position corresponds to the dual graph of the Voronoi diagram for the same points, as revealed in Figure 4.3. Special cases include the existence of three points on a line and four points on circle.

The Delaunay triangulation with all the circumcircles and their centers (in red).

Figure 4.3

Connecting the centers of the circumcircles produces the Voronoi diagram (in red).

Relationship between Delaunay triangles and the Voronoi diagram

Algorithms Many algorithms for computing Delaunay triangulations rely on fast operations for detecting when a point is within a triangle's circumcircle and an efficient data structure for storing triangles and edges. In two dimensions, one way to detect if point D lies in the circumcircle of A, B, C is to evaluate the determinant:

Ax Bx Cx Dx

Ay By Cy Dy

A 2x  A 2y B2x  B2y C 2x  C 2y D 2x  D 2y

1 1 0 1 1

Eq. 4.2

Delaunay, Boris (1934). "Sur la sphère vide". Bulletin de l'Académie des Sciences de l'URSS, Classe des sciences mathématiques et naturelles. 6: 793–800. 45 From Wikipedia, the free encyclopedia. 44

38

As shown in Figure 4.5 when A, B and C are sorted in a counterclockwise order, this determinant is positive if and only if D lies inside the circumcircle. The majority of Delaunay based methods exploit an incremental algorithm that starts with an initial triangulation of just a few points. The complete triangulation is generated by introducing points and locally reconstructing the triangulation after each point insertion. A particularly attractive feature of this approach is the opportunity to place new points at specified locations with the aim of retaining, or possibly improving, the quality of the mesh46. The main difficulty is the need to ensure surface integrity. Most methods allow the boundary points to be inserted into the volume triangulation unchecked, reestablishing the surface edges and faces by a Figure 4.5 Robust and fast way to series of edge/face swaps and the occasional introduction of detect if point D lies in the an extra point. The left hand side of Figure 4.4 illustrates a circumcircle of A, B, C simplified complex formed by two tetrahedral which share a common face. If this face is removed and an edge is inserted connecting the vertices A and B one obtains three tetrahedral (shown on the right hand side of Figure 4.4 which occupy the same region of space as the two original tetrahedral. This so-called “2 to 3” swap can often be used to establish a boundary edge; the reverse operation can similarly be applied to establish a boundary face. Not all boundary edges and faces can be established by this one operation but other more complicated swapping operations are possible. When the boundary triangulation has been established within the initial volume mesh, additional points are then inserted into the triangulation in order to create a volume mesh of well-shaped tetrahedral. A detailed description of this process is given in the books by [George Figure 4.4 Two-Three Tetrahedral swap and Borouchaki] and by [Frey and George]47. Advantages The important advantage of triangulation techniques is the higher degree of automation that is achieved in the meshing process. It can be shown, for example, that a Delaunay mesh can be generated to conform to any prescribed boundary in 2D48. The situation in 3D is much more complicated and no similar mathematical guarantee exists. The method has, nevertheless, been brought to a high level of automation and current tetrahedral mesh generators will reliably create good quality isotropic meshes if they are provided with a good quality surface triangulation49-50. Delaunay triangulation is a concept that extends back well before the emergence of mesh Bowyer A. Computing Dirichlet tessellations. Computer J 1981; 24(2):162–6. Baker T.J., “Triangulations, mesh generation and point placement strategies”, Caughey DA, Hafez MM, editors. “Frontiers of computational fluid dynamics”, New York: Wiley, 1994, pp. 101–15. 48 Lee DT, Lin AK. Generalized Delaunay triangulation for planar graphs. Discrete Comput Geom 1986;1: 201– 49 George PL, Borouchaki H. Delaunay triangulation and meshing. Hermes; 1998. 50 Baker TJ, Vassberg JC. Tetrahedral mesh generation and optimization. In: Sixth international conference on numerical grid generation. ISGG; 1998. p. 337–49. 46 47

39

generation51. Together with its geometric dual, the Voronoı diagram, it has proved to be a fertile construct whose applications extend from cartography to crystallography. In the seventies it attracted the attention of computer scientists and quickly became an important topic within the then emerging discipline that is now known as computational geometry52. In the early nineties computer scientists rediscovered mesh generation as an application of Delaunay triangulation although computer graphics and animation was, and still remains, the main justification for their research into triangulation problems and Delaunay triangulation.

4.3 Octree Decomposition In two dimensions this procedure can be viewed as a division of the domain into a collection of rectangles followed by a division of rectangles into triangles. A rectangle can be further subdivided into four new rectangles. For a rectangle that intersects the boundary, this subdivision can be repeated until a sufficiently fine resolution has been achieved. Rectangles that intersect the boundary and are sufficiently small are then replaced by a polygon consisting of the part of the rectangle lying inside the domain together with the part of the boundary that lies inside the rectangle. Figure 4.6 (a) shows a schematic that illustrates the concept of an Octree decomposition of the space around an airfoil. A further division of rectangles and boundary polygons into triangles creates a valid triangulation of the domain (see Figure 4.6(b)). The concept generalizes in an obvious way to three dimensions although the cutting procedure at the boundaries becomes much more complicated. The main drawback of Octree based triangulation methods is their inability to match a prescribed surface triangulation since the surface triangulation arises as a byproduct of the volume meshing procedure. The size of the individual Octree components and hence the size of the tetrahedral elements in the near field can be tailored to match the variation in surface curvature. But the quality of elements adjacent to the boundary surface and likewise the quality of the surface triangulation can be very poor. This can be a considerable handicap since an accurate implementation of the boundary conditions often requires a good quality mesh near the boundary. For high Reynolds number Navier Stokes computations, which must capture the flow details inside thin boundary layers, the lack of a good quality mesh near a boundary causes considerable difficulties. One way to alleviate these problems is to build a good quality mesh in the near field by extrusion of hexahedra, prisms or tetrahedral off the boundary surface and then merge this extruded mesh with an Octree based mesh

(a)

Figure 4.6

(b)

Converging of an Octree decomposition around an Airfoil

DelaunayB. Sur la sphe`re vide, Izvestia Akademia Nauk SSSR, VII Seria. Otdelenie Matematicheskii Estestvennyka Nauk 1934; 7:793–800. 52 Preparata FP, Shamos MI. Computational geometry. Berlin: Springer; 1985. 51

40

at a position that is some way off the boundary 53,54. It is best when creating an octree mesh to do the following:    

Perform volume meshing Improve the quality of the volume mesh using Edit Mesh options Create prism layers for boundary layer near the walls Improve the total mesh quality using Edit Mesh options.

4.4 Unstructured Hexahedral Meshes It is possible, in principle, to cut up a triangle into three quadrilaterals by inserting an extra point at the triangle barycenter and an extra point at the mid-point of each edge. A similar division of a tetrahedron into four hexahedra is also possible. At first sight, this would appear to be a straightforward way to create unstructured quadrilateral or hexahedral meshes from 2D or 3D triangulations. In practice, the quality of the resulting meshes is generally very poor. Alternative ways to create unstructured hexahedral meshes have been based on paving techniques55 (essentially a moving front approach), Octree decomposition together with a means of merging, or snapping, the outermost Octree hexahedra to the boundary, or by making use of the medial axis in 2D, medial

Hexahedral

Hybrid

Single Block

Tetrahedral/

(Fully Structurd)

Hexahedral

Multiblock (contiguous)

Multiblock Overset (Chimera

Tetrahedral/ Primatic Cartesian (Hexahedral +assorted Polyhedral

Tetrahedral Octree Decompostion

Advancing Front

Delany

Fully unstructured Hexahedral Figure 4.7

Hierarchy of Meshing Methodologies

53 Karman SL, “SPLITFLOW: a 3-D unstructured Cartesian/prismatic grid CFD code for complex geometries”, AIAA

33rd aerospace sciences meeting, Reno, NV. AIAA paper 95-0853, 1995. 54 Shaw JA, Stokes S, Lucking MA, “The rapid and robust generation of efficient hybrid grids for rans simulations over complete aircraft”, International Journal Numeric Method Fluids 2003; 43:785–820. 55 Zhu JZ, Zienkiewicz OC, Hinton E, Wu J, “A new approach to the development of automatic quadrilateral Mesh generation”, Inter J Number Meth Eng. 1991; 32:849–66.

41

surface in 3D, to produce a type of multi-block decomposition that is more amenable to meshing by paving56. The possibility of automatically generating unstructured hexahedral meshes is tantalizing and offers the prospect of providing automated mesh generation suitable for solid mechanics computations using finite element methods as well as meshes suitable for the computation of the RANS equations. Much depends on the mesh quality near solid boundaries and it remains to be seen whether any of the current approaches to hexahedral mesh generation can provide the required flexibility in terms of geometry handled and the necessary quality in terms of mesh orthogonality near solid boundaries. Figure 4.7. displays different methodologies which currently available in mesh generation engines. Conversion of Triangular to Quadrilateral Meshes (2D) Another simple strategy is developing by [Lyra & de Carvalho]57 where quadrilateral mesh generated from triangular meshes. Unstructured quadrilateral meshes can be automatically generated in several different ways and do not impose serious topological restrictions on the meshes, being appropriated to deal with complex geometries, naturally allowing local non-uniform mesh refinement. Several different approaches have been proposed to generate unstructured quadrilateral meshes. These methodologies can be divided into two basic groups:  those that try to generate quadrilaterals directly,  and those that convert a previously generated mesh of triangles into a mesh of quadrilaterals The conversion of triangular meshes is particularly attractive because these meshes can inherit the properties of the triangular meshes, whose generators are very well developed and once it is always possible to build a triangular mesh over any arbitrary 2D domain, quadrilateral meshes can be constructed as general as the triangular ones. It also allows the use of any triangular mesh generator as a “black box”. As we generate a quadrilateral mesh using the conversion strategy, the quadrilateral mesh inherits the characteristics of the initial triangulation. For both, iso and anisotropic meshes this strategy consists of four main steps, as presented . 1. Generate a triangular mesh (either iso or anisotropic); 2. Remove an edge between two adjacent triangles, to forma quadrilateral; 3. Split all elements in the intermediate mixed mesh(triangles into three quadrilaterals and quadrilaterals into four quadrilaterals); 4. Perform some post processing steps in order to enhance mesh quality. The standard strategy of merging triangles into quadrilaterals consists in eliminating a common edge that belongs to two adjacent triangles. Following the work done by Xie and Ramaekers (1994) and Alquati and Groehs (1995), our mesh generator is such that it refrains from merging triangles that would form a non-convex quadrilateral. Besides, for anisotropic meshes, the merging process will remove a common edge between two adjacent triangles, only if the two quadrilaterals to be created satisfy a quality criteria which is controlled by two geometric parameters. The adopted procedure generates a quadrilateral mesh with edges that are approximately half of those of the corresponding triangular elements and usually this is not a serious concern, since the user can generate a coarser Sheehy, DJ, Armstrong CG, Robinson DJ,”Computing the medial surface of a solid from a domain Delaunay triangulation”, Proceedings of the ACM symposium on solid modeling and applications, Salt Lake City, UT, New York: ACM Press; 1995. p. 201–12. 57 Paulo Roberto M. Lyra, Darlan Karlo E. de Carvalho, “A Computational Methodology for Automatic TwoDimensional Anisotropic Mesh Generation and Adaptation”, Methodology for Automatic Two-Dimensional Anisotropic Mesh Generation and Adaptation. 56

42

initial triangulation to obtain the desired mesh density. The four steps involved in the quadrilateral mesh generation can be seen in Figure 4.8 (1-4).

(1) Initial triangulation

(3) Mesh non-optimized

Figure 4.8

(2) Intermediate mesh

(4) Final quadrilateral mesh

Quadrilateral mesh generation

4.5 Overset Grids There are several variants of multi-block depending on whether or not continuity of mesh lines is maintained across the block boundaries. Overset methods represent one extreme where no attempt is made to match meshes from neighboring blocks. Figure 4.9 shows a combination of two overset meshes, an O-mesh around an airfoil plus an H-mesh for the far field. First suggested by Atta58 the overset approach was extensively developed by Benek et al. 59 with later contributions by Chesshire Atta E. Component–adaptive grid interfacing. AIAA19th aerospace sciences meeting. AIAA paper 81-0382. Benek JA, Buning PG, Steger JL. “A 3-D Chimera grid embedding technique”. AIAA 7th CFD conference, Cincinnati, OH. AIAA paper 85-1523, 1985. 58 59

43

and Henshaw60. The lack of any constraint at the block boundaries means that mesh generation for the individual blocks is much easier. In particular, there is no a priori need to create block interfaces and this advantage has facilitated the early application of the overset approach to complicated geometries. Another advantage of permitting such a loose connection between neighboring meshes is the possibility of treating moving body problems (e.g. store separation). The penalty for these advantages lies in the need to transfer information between neighboring meshes. This requires a means of determining an appropriate overlap region and the development of interpolation formulae to ensure accurate data transfer. Figure 4.9 Overset Mesh Combination

4.6 Cartesian Grids It is generally accepted that a boundary conforming mesh is desirable to achieve accurate solutions from any numerical solver. If one is willing to sacrifice this requirement then mesh generation becomes a much simpler task. No approach beats regular structured grids in terms of efficiency and accuracy. Thus, there have been a number of efforts to use such grids for complex geometries which are called Cartesian grid approach. An early example of a non-aligned Cartesian mesh can be found in the work of Carlson61. Difficulties arise at the boundary where the Cartesian mesh intersects the boundary surface. Although finite difference methods can be derived to interpolate the boundary conditions onto the nearest mesh points, it is difficult to ensure solution accuracy. If extra points are inserted, however, where mesh lines intersect the surface then it is possible to create a boundary conforming mesh. In this respect, boundary conforming Cartesian methods are seen to be closely related to the Octree based triangulation methods. In fact, the elements obtained from the Octree and its intersection with the boundaries is precisely the elements that make up the Cartesian mesh. Conversely, any Cartesian mesh can be converted into an Octree type triangulation by splitting all elements into tetrahedral (or triangles in 2D). Most of the elements in a Cartesian mesh will be hexahedra although the elements adjacent to the surface can be expected to assume a variety of polyhedral shapes depending on the way in which an Octree hexahedron intersects any given region of the boundary surface. A Cartesian mesh is therefore well suited for use by a finite volume or finite element method that can accept arbitrarily shaped elements. This approach has been developed extensively by Aftosmis et al. 62. Given the close affinity between Cartesian meshes and Octree based triangulations it is to be expected that they share the same advantages and limitations. In particular, the problems of correctly finding the intersection between the Cartesian/Octree mesh and the Chesshire G, Henshaw WD,”Composite overlapping meshes for the solution of partial differential equations.” Journal of Computational Phys 1990; 90:1–64. 61 Carlson LA. Transonic airfoil analysis and design using Cartesian coordinates. AIAA second computational fluid dynamics conference, Hartford, CT, June 1975.p. 175–83. 62 Aftosmis MJ, Berger MJ, Melton JE. ,”Robust and efficient Cartesian mesh generation for component-based Geometry”, AIAA J 1998; 36:952–60. 60

44

boundary surface, identifying the element shapes for the intersected Cartesian cells and adequately refining the mesh near small boundary features, are substantial. Cartesian mesh methods also suffer from the drawback that the surface discretization is not known beforehand and it is therefore often difficult to ensure good surface mesh quality. On the plus side, since the surface discretization is a byproduct of the volume discretization, it is possible to generate meshes around highly complex geometries without the need for carefully crafted surface meshes. In fact, the surface definition can be obtained directly from the CAD description provided there is a utility to determine the intersection of given line with the surface. Cartesian and Octree based mesh generation methods thus circumvent the need for the prior creation of a surface mesh, a significant advantage if a fast turnaround time in going from design prototype to flow solution is desired. Figure 4.10 shows a Cartesian grid on a generic airplane configuration.

Figure 4.10

4.7

Example of Cartesian Grid on a Generic Airplane

Trimmed (SAMM) Cells

This was a novel idea which was generated by Wayne Oaks63 of CDAdapco® for better capturing geometry surfaces. The idea was to use the trimmed or deformed hexahedral cells (see Figure 4.11) or better known as SAMM (Semi-Automatic Meshing Methodology) to generate a sub-surface, then fill the gap with between subsurface and real surface, with prismatic layer and the core volume with regular hexahedral cells. If there is any

Figure 4.11

Meshing types in SAMM

W. Oaks, S. Paoletti, “Polyhedral Mesh Generation”, adapco Ltd, 60 Broadhollow Road, Melville 11747 New York, USA. 63

45

unresolved cells, then use the mesh quality button to fix that. Unfortunately, some meshing designers complained of too many unresolved cells. To that end, CD-Adapco added new features and fixes to decrease the amount of unresolved cells. Figure 4.11 shows a SAMM approach for meshing a manifold showing step by step procedures. It is most useful in modeling external aerodynamic flows due to its ability to refine cell in a wake region, unsteady, and turbulent fluid caused by boundary layer separation.

4.8 Polyhedral Cells As a new comer in the field of Mesh Generation, polyhedral cells merits special attention in CFD community. Polyhedral meshes, as the term implies, means many faces. It consist of cells of 12 and 14 faces (although the number of faces is unrestricted). This means that they fill space in close to the most efficient way possible. A polygonal face is defined by a list of vertex labels. The ordering of vertex labels defines the face normal (orientation) using the right-hand rule. A polyhedral cell is defined by a list of face labels that bound it. In Figure 4.12 (a) cell center is marked by P, face center and face includes by f, face normal Sf and neighboring cell center by N. Face center and cell volume are calculated using a decomposition into (a) typical polyhedral cells

Figure 4.12

(b) Cell Decompostion

(c) Cell and Face Decompostion

Typical Polyhedral Cell and their Decomposition

triangles or pyramids64. Cell Decomposition It remains to choose an appropriate decomposition of a polyhedron into tetrahedral; two methods used in OpenFOAM® are shown in Figure 4.12 (b-c). A cell is decomposed by introducing a point in its centroid and building tetrahedral above the triangular decomposition of a face. The two methods proposed here are the cell decomposition, Figure 4.12 (b), where additional points are introduced only in cell centers; and the cell-and-face decomposition, Figure 4.12(c), where points are introduced in both face and cell centers. In the first method, the number of algebraic equations in the matrix equals the sum of cell and point count, while the second method introduces an equation for each face, giving a considerable increase in the number of unknowns65. For a given resolution level, a mesh consisting of polyhedral cells has fewer faces than a mesh of any other cell type. As the lowestorder polyhedron, tetrahedral are often deformed during meshing to look more like wedges or slivers. Some of these point upstream, letting fluid flows hit their very oblique surfaces. The disparity

Hrvoje Jasak, ˇZeljko Tukovi´c, “Automatic Mesh Motion for the Unstructured Finite Volume Method”, ISSN 1333–1124, UDK 532.5:519.6. 65 See previous. 64

46

between the small inflow area and large outflow areas leads to excessive numerical diffusion. Figure shows manifold and piston cylinder head meshing using polyhedral. Mesh Duality A different approach in generating polyhedral meshes, which does not suffer by the aforementioned restrictions, comes with the introduction of indirect mesh generation methods. These are based on the principle of duality transforms, which define a mapping from entities of an input mesh, which is referred to as primal, to a destination mesh, referred to as dual. The main mapping process dictates that the vertices of a dual mesh are generated at the centers of the primal cells66. This relation is unique, leading to a one-to-one correspondence of the two counterpart meshes, while it is also characterized by inverse applicability. This means that the original primal mesh can Figure 4.13 Polyhedral meshing be obtained back, if the same mapping is applied to the dual using Delaunay triangulation mesh. This property can be applied for Voronoi tessellations, as well. The dual counterpart of a Voronoi mesh is a Delaunay triangulation, which is defined as a partitioning scheme, such that no vertex is inside the circumcircle of any triangle (Figure 4.13). The implementation of Delaunay triangulation algorithms is relatively simple and can be of complexity O (n log n), following Ruppert's algorithm67. As the duality property can be applied both ways, it is then possible to obtain a Voronoi mesh, by applying a duality transform on a previously generated Delaunay triangulation, considering the circumcenters of the primal tetrahedral as generator vertices. In 3D space, an equivalent mesh generation method would require a tetrahedral primal mesh that complies with the Delaunay criterion. Delaunay partitioning is known to maximize the minimum angle of all formed simples, which leads to well-conditioned tetrahedral. However, in order to obtain a valid dual mesh, a far stricter criterion needs to be filled: that of well centered tetrahedral, meaning that the circumcenter of a primal cell needs to be located within its volume68. This is something that is not always possible, as tetrahedral at the boundaries may be very at, having their circumcenters outside the model's domain, while the Delaunay criterion still remains fulfilled. Situations like this are especially encountered at sharp concavities of the geometric model, and several suggestions have been made in order to overcome this issue. Other possibilities include non-Delaunay tetrahedral meshes, hexahedral or even mixed meshes, which are further discussion. Finally, the advantage of indirect mesh generation lies in the fact that efficient algorithms can be implemented in order to obtain topologically involved dual meshes, based on primal meshes with simple topology. Furthermore, the primal meshes, themselves, can be created following equally efficient and wellstudied algorithms. This approach leads into an elective two-step mesh generation, rather than an expensive, direct one. Methodology 66 H. Ledoux, “Computing the 3D voronoi diagram robustly:

An easy explanation”, In Voronoi Diagrams in Science and Engineering, 2007. ISVD '07. 4th International Symposium on, pages 117{129, July 2007. 67 Paul-Louis George and Houman Borouchaki, “Delaunay Triangulation and Meshing - Application to Finite Elements”, Editions HERMES, 1998. 68 Rao V. Garimella, Jibum Kim, and Markus Berndt, “Polyhedral mesh generation and optimization for nonmanifold domains”, Proceedings of the 22nd International Meshing Roundtable, pages 313-330. Springer International Publishing, 2014.

47

Given a triangular mesh in 2D, such as that of (Figure 4.14), a polygonal mesh is formed, following the principle that a dual cell will be formed around every primal vertex. In the interior of the domain, this one-to-one correspondence between primal and dual entities extends to other types as well, with one dual edge per primal edge and a dual vertex for every primal face. However, generation of polygonal faces on the boundary demands for additional dual edges and vertices, at specific locations of the boundary that denote the classification of primal entities as significant. An slightly modified approach of the generic polygonal mesh generation, as previously described, is used to obtain a variation known as median meshes. This method differentiates itself by considering as significant every existing primal edge, thus creating dual vertices at the midpoints of primal edges lying in the interior as well. These dual vertices become, consequently, vertices of the dual faces formed around primal vertices in the interior, however the resulting polygons are characterized by highly concave shapes (Figure 4.14). Concave polygons are in general non-desirable in computational methods, due to their poor numerical properties. Additionally, they are also known for posing further difficulties in geometric computations, making the mesh generation itself problematic, whenever using plain topological relations is not adequate. It is, subsequently, clear that median meshes are not an optimal choice for numerical simulations. However, the concept behind median mesh generation provides a useful basis for meshing curved boundary surfaces of three-dimensional models, where the exact geometry of the primal mesh needs to be preserved.

4.9 Treatment of Boundary Layer The poor numerical properties of tetrahedral meshes have dictated the generation of a thin layer of prismatic, pentahedral elements at the boundary. With this common practice, analysts have been able to partially overcome the inability of tetrahedral to capture the details of a flow at regions close to the boundary . The appropriate generation of a corresponding boundary layer for polyhedral meshes, or even the need for one, are to be examined in future studies. An interesting, however, by-product of the polyhedral mesh generation method, is the automatic formation of a prismatic boundary layer. This effect comes as a result of connecting the centers of primal cells, in order to form dual entities, which, at the boundary, forms dual cells of approximately half the thickness of their primal counterparts. The phenomenon can be intensified by generating cascading dual meshes, having as a starting point an initial primal mesh. This is made possible, given the observation that the dual counterpart of a general bounded polyhedral mesh tends to resemble the primal, tetrahedral mesh,

Figure 4.14

Dual surface Triangulation resulting in Polyhedron

48

with the exception at the boundaries. This correspondence emerges in a similar way that the dual counterpart of a Voronoi tessellation is a Delaunay triangulation / tetrahedralization, and vice versa. Therefore, for each generation of meshes, the dual mesh that is obtained serves as the primal mesh for the next iteration. It can, then, be observed that for each generation, the boundary layer gets approximately half the thickness of that of the input mesh. Since two iterations are needed in order to cascade from a polyhedral mesh to a tetrahedral dominant and back to a polyhedral one, the formed boundary layer will conclude to a thickness of a 1/4 factor. It is, however, apparent that with such an approach it is difficult to control the properties and thickness of the formed boundary layer

2D

Figure 4.15

Boundary layer prisms generated on a cascade of a 2D triangulation and dual polyhedron

and the application of this method seems of limited use. Figure 4.15 and Figure 4.16 are displaying the involving concepts for 2D and 3D.

4.10 Domain Mesh Stretching in Unstructured Environment The drive towards full Navier-Stokes solvers has necessitated the development of stretched grid generation techniques in order to resolve the thin boundary layers, wakes, and other viscous regions characteristic of high-Reynolds number viscous flows . Proper boundary-layer resolution usually requires mesh spacing several orders of magnitude smaller in the direction normal to the boundaries than in the stream-wise direction, resulting in large cell aspect-ratios in these regions. In Babushka & Aziz it is shown how the accuracy of a two-dimensional finite-element approximation on triangular

49

elements degrades as the maximum angle of the element increases. Therefore, stretched obtuse triangles that contain one large angle and two small angles are to be avoided, while stretched rightangle triangles, with one small and two nearly right angles, are preferred. Delaunay triangulations, which maximize the minimum angles of any triangulation, tend to produce equiangular triangulations and are thus ill suited for the construction of highly stretched triangular elements. One of the earliest approaches for generating highly stretched triangulations for viscous flows makes use of a Delaunay triangulation performed in a locally mapped space [Mavriplis]69-70; [Vallet et al]71; [Castro-Diaz et al 1995]. By defining a mapped space based on the desired amount and direction of stretching, an isotropic Delaunay triangulation can be generated in this mapped space that, when mapped back to physical space, provides the desired stretched triangulation. Difficulties with such

3-D

Figure 4.16

Concept of cascading for boundary layer in 3D

Mavriplis, DJ. ,”Adaptive mesh generation for viscous flows using Delaunay triangulation”, Journal computational. Phys. 90(2):271–91. 70 Mavriplis, DJ.,” Unstructured and adaptive mesh generation for high-Reynolds number viscous flows”Proceedings of the International Conference on Numerical Grid Generation: Computational Fluid Dynamics and Related Fields, 3rd, Barcelona, Spain, ed. AS Arcilla, J Hauser, PR Eisman, JF Thompson, pp. 79–92. New York: North-Holland, 1991. 71 Vallet MG, Hecht F, Mantel B., “Anisotropic control of mesh generation based upon a Voronoi type method”, 1991. 69

50

methods involve defining the stretching transformations and determining suitable point distributions for avoiding obtuse triangular elements. An alternative to the above approaches is to generate a locally structured or semi structured mesh in the regions where high stretching is required. One approach [Nakahashi 1987, Ward & Kallinderis 1993] attempts to preserve the mesh structure in the direction normal to the boundary up to a specified distance away from the boundary, after which fully unstructured isotropic meshing techniques are employed. Special care must be taken in this case to avoid mesh cross-overs in regions of concave curvature and to ensure a smooth transition between the structured and unstructured region of the mesh. Another strategy [L¨ohner]72; [Pirzadeh]73; [Connell & Braaten 1995] consists of generating a semi structured mesh, where the “stack” of mesh cells emanating from each individual boundary face may terminate independently from those at other boundary faces, as shown in Figure 6. Termination of these “advancing-layers” [Pirzadeh]74 is triggered when the local cell aspect-ratio approaches unity, or when cross-over with other cells is detected, such as in concave corners. The remaining region is then gridded with a conventional isotropic unstructured mesh generation approach. The resulting structured or semi structured meshes can either be conserved as local structured entities of quadrilaterals in two dimensions and prisms in three dimensions (since the surface grid is generally assumed to be triangular), or the different element types may be divided into triangles or tetrahedral in two or three dimensions, respectively.

4.11 Spatial (Field) Discretization The previous section describes techniques for generating suitable meshes about arbitrary geometric configurations. Once such a mesh has been generated, it serves as the basis for the spatial discretization of the governing fluid dynamic equations. Unstructured mesh discretization techniques can generally be classified as finite-volume or finite-element strategies, depending on whether a discrete integral or Variational viewpoint is adopted, although many common discretization may be simultaneously interpreted from both viewpoints. For finite-volume formulations, a distinction between vertex-based and cell centered schemes can be made. In a vertex based scheme, the flow variables are stored at the vertices of the mesh. The discrete equations usually involve stencils that are defined by the nearest or next-to-nearest neighbors of each mesh point. In a cell-centered scheme, the flow variables are stored at the centers of the cells or elements of the mesh. The stencils of the discrete equations usually involve the nearest or next-to-nearest neighboring cells.

L¨ohner R.,” Matching semi-structured and unstructured grids for Navier-Stokes calculations”, AIAA Pap. 933348. 73 Pirzadeh S.,”Viscous unstructured three dimensional grids by the advancing-layers method”, AIAA Pap. 940417, 1994. 74 Pirzadeh S. 1994a, AIAA J. 32(8):1735–37. 72

51

The equivalence between vertex-based and cell-centered schemes can be demonstrated with the concept of a dual mesh. If a dual mesh point is created at each cell center and dual mesh edges are drawn by joining neighboring cell centers, the cell-centered scheme can be seen to be equivalent to a vertex-based scheme operating on the dual mesh. Figure 4.17 illustrates the dual mesh for a mixed quadrilateral and triangular mesh in two dimensions and associated control-volumes with edgebased fluxes for a vertex-based scheme. For a purely quadrilateral or hexahedral mesh, the dual mesh also contains quadrilateral or hexahedral elements, and the number of vertices and edges in the original and dual meshes is identical. For triangular or tetrahedral meshes, the number of dual mesh vertices is larger than the number of original mesh vertices. This is due to the fact that a triangular mesh contains twice as many triangles as vertices (neglecting boundary effects), and a tetrahedral mesh five to six times more elements than vertices. On the dual mesh, the degree of a vertex (number of incoming edges) is fixed and equal to three for triangular elements, or four for tetrahedral elements, whereas on the original mesh, the degree of each vertex is variable. Similar Figure 4.17 Dual mesh for mixed triangular-quadrilateral relationships hold for other unstructured mesh elements such as prisms and pyramids. Thus, cell-centered and vertex-based schemes operating on the same grid result in vastly different discretization when non-quadrilateral or non-hexahedral elements are present. In particular, a cellcentered scheme can be expected to result in a much larger number of unknowns while generating relatively simple stencils of fixed size. The vertex-based scheme, on the other hand, will result in a smaller number of unknowns with larger variable-size stencils. Because of the larger number of unknowns, cell-centered schemes generally incur larger overheads than vertex-based schemes on equivalent grids. However, there is evidence to suggest that they also provide more accurate solutions on equivalent grids. The question of whether the additional overheads are offset by the increase in accuracy is still an open one, especially since vertex-based schemes operate on more complex stencils (more fluxes per unknown) than cell-centered schemes.

4.12 Considerations for the Navier-Stokes Equation The above discussion on discretization is principally concerned with the purely convective terms that arise in the context of inviscid flows. With the exception of the finite-element methods described above, where convection and diffusion terms can be treated in a unified manner, additional viscous terms must be discretized for the Navier-Stokes equations. These terms are diffusive in nature and generally take the form of second differences. Stable second-order discretization can therefore be constructed using simple central differences. For cell-centered schemes, one approach consists of first computing the gradients at the mesh vertices and then averaging these to the cell faces in order to compute second derivatives at cell centers (Frink75). For vertex based schemes, a similar two-pass Frink NT. 1994. Recent progress toward a three dimensional unstructured Navier-Stokes flow solver. AIAA Pap. 94-0061 75

52

procedure based on finite-volume central difference arguments can be used to construct the viscous term discretization. For simplicial meshes, gradients can first be computed on the mesh elements, which can then be interpolated to the control-volume faces in order to form second differences at the mesh vertices. This type of discretization can be derived more formally using a Galerkin finiteelement procedure and assumes linear variation of the flow variables on the mesh elements. The resulting discretization produces a nearest-neighbor stencil and may be implemented as a single loop over the edges of the mesh, rather than as a two-pass procedure that computes intermediate cellbased gradients; [Barth]76 and [Mavriplis]77. For non-simplicial meshes, Galerkin finite-element formulations using bilinear or trilinear variations on quadrilateral or hexahedral elements can be constructed. The resulting stencils, however, are no longer compact, as they involve vertices within mesh elements that are not connected by a mesh edge, such as diagonally opposed vertices in hexahedral elements [Braaten & Connell78]. An alternative strategy for discretizing viscous terms for vertex-based schemes is to employ the vertex-based gradients already computed in the context of second-order upwind schemes (using a Green-Gauss integration around the vertex-based control volumes, for example), instead of the element-based gradients described above. A vertex-based second difference can then be computed by integrating these gradients themselves around the control-volume boundaries [Luo et al 1993]. This approach enables the viscous term discretization to be assembled on meshes of arbitrary element types using the same data structures as required for the upwind convection terms. The principal drawback of this method is that it results in a large stencil that involves neighbors and next to-neighbors, which on a structured mesh reduces to a stencil of size 2h, where h represents the mesh spacing. This not only reduces overall accuracy but is also ineffective at damping odd-even oscillations in the numerical scheme. For high-Reynolds-number flows of practical interest, the Reynolds-averaged form of the Navier-Stokes equations is generally employed, which requires the use of additional turbulence-modeling equation(s). Although algebraic models can be implemented on unstructured grids [Mavriplis]79, they were conceived for simple wall-bounded flows and are thus ill suited for flows over complex geometries. The current practice is to employ two-equation models of the K-ε or K-ω type, or simpler one-equation eddy viscosity models [Baldwin & Barth 1992], [Spalart & Allmaras]80. These equations contain convective, diffusive, and source terms that can be discretized in a manner analogous to the discretization of the flow equations. Turbulence modeling equations often result in stiff numerical systems, and care must be taken to devise schemes that preserve positivity of the turbulence quantities at all stages of the solution process. A common practice is to discretize the convective terms using a first order upwind strategy, from which a positive scheme that obeys a maximum principle can be obtained.

4.13 Unstructured Quadrilateral Mesh Generation Because commercial aircraft are built with thin-walled structures, their structural performance is well-modeled using shell-element meshes [Hwang and Martins]81. However, creating these meshes for the full aircraft configuration can be challenging and presents a bottleneck in the design process, Barth TJ. 1992. Aspects of unstructured grids and finite-element volume solvers for the Euler and NavierStokes equations. Von Karman Inst. Lect. Ser., AGARD Publ. R-787 77 Mavriplis DJ. 1995b. A three-dimensional multigrid Reynolds-averaged Navier-Stokes solver for unstructured meshes. AIAA J.33(3):445–53 78 Braaten ME, Connell SD. 1996. Three dimensional unstructured adaptive multigrid scheme for the Navier-Stokes equations. AIAA J. 34(2):281–90 79 Mavriplis DJ. 1991a. Algebraic turbulence modeling for unstructured and adaptive meshes. AIAA J. 29(12):2086–93 80 Spalart PR, Allmaras SR. 1992. A one-equation turbulence model for aerodynamic flows. AIAA Pap. 92-0439 81 J. T. Hwang and J. R. R. A. Martins, “An unstructured quadrilateral mesh generation algorithm for aircraft structures”. Aerospace Science and Technology, 59:172182, 2016. doi:10.1016/j.ast.2016.10.010. 76

53

especially in a configuration-level design space. The aim is to presents an algorithm that automatically creates unstructured quadrilateral meshes for the full airframe based on just the description of the desired structural members. The approach consists in representing each node in the mesh as a linear combination of points on the geometry so that the structural mesh morphs as the geometry changes, as it would, for example, in aero-structural optimization. The algorithm divides the aircraft skin into 4-sided domains based on the underlying B-spline representation of the geometry. It meshes each domain independently using an algorithm based on constrained Delaunay triangulation, triangle merging and splitting to obtain a quadrilateral mesh, and elliptical smoothing. Examples of full configuration structural meshes are provided, and a mesh convergence study is performed to show that element quality can be maintained as the structural mesh is refined. Here, presented an automatic unstructured quadrilateral mesh generation algorithm for aircraft structures that uniquely satisfies the four requirements mentioned above. The algorithms starts with a B-spline surface geometry representation and a list of requested structural members defined in terms of parametric locations on the surfaces. It then splits the geometry into domains, meshes each domain independently using Constrained Delaunay triangulation (CDT) as well as merging and splitting operations, and then applies Laplacian smoothing as a final step. Geometry Representation The only requirements on the geometry representation are that it is continuous and watertight. Representing the geometry using untrimmed B-spline surfaces, though this is not the only choice with which the structural mesh generation algorithm would work. B-splines are piecewise polynomials used frequently in computer-aided design because of their favorable mathematical properties: compact support for a desired order and smoothness, and flexibility in terms of the number of control points and polynomial degree. B-spline surfaces are tensor products of B-spline curves that maintain the advantages of smoothness and sparsity. Figure 4.18 illustrates how a conventional wing-body-tail aircraft geometry can be constructed with 4-sided B-spline surfaces82.

Figure 4.18 Conventional configuration geometry (a), final structural mesh (Courtesy of Hwang & Martins)

Local mesh generation algorithm In general, 2D quad meshing algorithms fall under three general categories: domain-decomposition, advancing-front, and triangulation-based methods. The first two recursively splitting the domain through heuristic algorithms and marching out from boundaries, respectively are not suitable for the current problem because of the line constraints imposed by the structural members intersecting the skin. Two additional ideas that have been successful are topology clean-up and smoothing. There has been work dealing with line constraints in structural mesh generation for marine engineering. The local mesh generation algorithm consists of six stages, as illustrated in Figure 4.19. The figure shows 82

Same as previous.

54

a domain for illustrative purposes, containing a vertical edge extending from the top to the bottom of the domain, two diagonal edges intentionally chosen to form a triangular region, and a shorter edge that is floating by itself near the center of the domain. The six stages are as follows:

1. Initial domain: We start with a 4-sided domain representing a single B-spline surface, with 2.

3. 4. 5. 6.

the internal members intersecting this surface pre-determined. Discretization: We discretize the boundaries and the interior of the domain. The boundaries are simply discretized using a global parameter representing the requested resolution. This guarantees that the bounding edges shared by two neighboring domains always agree on the boundary nodes because all domains use the same resolution parameter. The interior of the domain is populated with a grid of points that are spaced based on the sizes of the element boundaries, as measured from the preview mesh. Triangulation: We perform CDT on the domain while respecting the edges from the boundaries and from the intersecting structural members. Quad-dominant mesh: From the triangulation, we obtain a quad-dominant mesh by ranking all potential merges of adjacent triangles based on how close the angles would be to 90 degrees. The triangles are merged according to this ranking until no possible merges remain. Fully-quad mesh: We split all quads into four smaller quads and all triangles into three quads using its centroid to obtain a fully quad mesh. Smoothing: We perform an elliptical smoothing operator (Laplacian) as the last step.

55

Other noticeable sources regarding quad meshing are by [Remacle et al,]83, and [Verma & Tim Tautges]84.

Figure 4.19

The six steps of the unstructured quad meshing algorithm

4.14 Connectivity Information and Data Structure We must identify what information is required to identify the cell and all the neighbors of the cell in the computational mesh. We can choose to locate the arbitrary points anywhere we want for the unstructured grid. A point insertion scheme is used to insert the points independently and the cell connectivity is determined. This suggests that the point be identified as they are inserted. Logic for establishing new connectivity is determined once the points are inserted. Data that form grid point that identifies grid cell are needed. As each cell is formed it is numbered and the points are sorted. In addition the neighbor cell information is needed. Therefore, a brief discussion on data structures is useful because the success of most discretization methods ultimately depends on how efficiently they may be implemented85. Traditionally, finite-element methods have relied on element-based data structures, where for each element of the mesh a list of the forming vertex addresses is stored (i.e. four vertices for tetrahedral, eight vertices for hexahedra, etc.). For many fluid dynamics problems, the discretization, which are typically thought of as summations of fluxes, can be implemented more J.-F. Remacle, J. Lambrechts, B. Seny, E. Marchandise, A. Johnen and C. Geuzaine, “Blossom-Quad: a nonuniform quadrilateral mesh generator using a minimum cost perfect matching algorithm”, Int. J. Numerical Meth. Eng. 2010; 00:1-6 84 Chaman Singh Verma and Tim Tautges, “Jaal: Engineering a high quality all-quadrilateral mesh generator”, Argonne National Laboratory, Argonne IL, 60439. 85 Wikipedia. 83

56

effectively using an edge-based data structure. For a vertex-based scheme, this corresponds to storing, for each edge of the mesh, the addresses of the two vertices on either end of the edge. For a cell-centered scheme, the relevant entity is the dual edge that joins two neighboring cell centroids and pierces the face common to these two cells. The discretization may be evaluated by computing a flux on each edge, which is then added to and subtracted from the respective control volumes on each end of the edge. In order to compute this flux, a face area must be stored for each edge, which corresponds to the area of the dual control-volume face associated with the mesh edge in the vertexbased scheme, and to the area of the cell face pierced by the dual edge in the cell-centered scheme. The use of edge-based data structures results in lower memory overheads and increased computational throughputs because redundant computations are eliminated and the gather-scatter required for vectorization in supercomputers is minimized. Furthermore, because sets of edges can be used as building blocks for arbitrarily shaped elements, hybrid meshes with mixed element types may be handled by a single edge-based data structure, at least for inviscid flows. For viscous flows, the Galerkin finite-element discretization of the diffusion terms on simplicial meshes results in a nearest-neighbor stencil and thus may be implemented using an edge-based data structure 86. However, this is not the case for non-simplicial meshes, since the resulting stencils involve vertices that are not connected to the center vertex by a mesh edge (such as diagonally opposed vertices in hexahedral elements). In these situations, the element-based data structure must be retained87. An alternative is to resort to the thin-layer approximation of the viscous terms on non-simplicial meshes, which can be implemented exclusively along edges88. The limitations of this approach are obvious, although it is justifiable for highly stretched prismatic or hexahedral meshes, where stream wise resolution has been sacrificed for efficiency. An interesting property of the edge-based data structure is that it can provide an interpretation of the discrete operator as a sparse matrix. For nearest neighbor stencil discretization, all points in the stencil are joined to the center point by a mesh edge. The discretization operator can be written as a sparse matrix, where each nonzero entry in the matrix corresponds to a stencil coefficient or edge of the mesh. For systems of equations, the edges correspond to nonzero block matrix entries in the large sparse matrix. This interpretation has implications for the implementation of implicit and algebraic multigrid solution schemes 89-90. One of the disadvantages of the edge-based data structure is that it requires a preprocessing operation to extract a unique list of edges from the list of mesh elements and to compute the associated edge coefficients. For unsteady flows with dynamic meshes, this preprocessing must be performed every time the mesh is altered, although this may be done locally. Additionally, for dynamic grid cases, the element data structures are generally required for performing mesh motion or adaptation, since edge lists represent a lower-level description of the mesh91.

Mavriplis DJ, “Unstructured mesh generation and adaptively”, VKI Lect. Ser. Computational Fluid Dynamics, 26th, VKI-LS 1995. 87 Braaten ME, Connell SD., “Three dimensional unstructured adaptive multigrid scheme for the Navier-Stokes equations”, AIAA J. 34(2):281–90, 1996. 88 Mavriplis DJ, Venkatakrishnan V.,”A unified multigrid solver for the Navier-Stokes equations on mixed element meshes”, .AIAA Pap. 95-1666, 1995. 89 Venkatakrishnan V, Mavriplis DJ., ”Implicit solvers for unstructured meshes”, J. Computational. Phys. 105(1):83–91, 1993. 90 Mavriplis DJ, Venkatakrishnan V., “A unified multigrid solver for the Navier-Stokes equations on mixed element meshes”, AIAA Pap. 95-1666, 1995. 91 Annual. Rev. Fluid Mech. 1997.29:473-514, journals.annualreviews.org by Pennsylvania State University. 86

57

58

5 Hybrid Meshes A hybrid grid contains a mixture of structured portions and unstructured portions. It integrates the structured meshes and the unstructured meshes in an efficient manner. Those parts of the geometry that are regular can have structured grids and those that are complex can have unstructured grids. These grids can be nonconformal which means that grid lines don’t need to match at block boundaries92. In recent years due to accuracy consideration while capturing the physics (sun-layer in boundaries), and in the same time added flexibility in domain discretization (automated meshing using tetrahedral, polyhedral, etc.), received lots of attention. Figure 5.1 shows a Hybrid mesh obtained from a STL surface using an OpenFOAM© Figure 5.1 Hybrid grid and steady state solution meshing module and solution for a steady-state incompressible turbulent flow.

5.1 Accuracy Consideration It is known that the truncation error of a finite volume discretization depends on the shape of the control volume. In particular, a trapezoidal approximation for a vertex based method, though nominally second order, becomes first order accurate unless the control volume possesses central symmetry93. For a vertex based discretization, the control volume associated with a given point typically corresponds to the boundary of the collection of elements incident at that point. For a cell centered discretization it is the element boundary that functions as the control volume. On a structured mesh of hexahedra, one can generally expect central symmetry at all mesh points unless there are extreme distortions in the mesh. A planar triangulation will have central symmetry if the centered discretization it is the element boundary that functions as the control volume. On a structured mesh of hexahedra, one can generally expect central symmetry at all mesh points unless there are extreme distortions in the mesh. A planar triangulation will have central symmetry if the triangles are all equilateral resulting in hexagonal control volumes for vertex based schemes. In an anisotropic layer of highly stretched triangles central symmetry can only be achieved if the mesh maintains a structured appearance (e.g. advancing layers) and all the diagonal edges are oriented in the same direction. In a tetrahedral mesh, however, it appears impossible to achieve central symmetry under any circumstances. The possible loss of second order accuracy in truncation error for the Euler equations is localized and the first order error terms tend to cancel each other when averaged over several elements. As a result, the global solution error should remain second order94. It is possible, however, that this canceling of first order truncation error does not occur viscous From Wikipedia, the free encyclopedia. Roe PL. Error estimates for cell-vertex solutions of the compressible Euler equations. ICASE Report No. 876, 1987. 94 Giles MB. Accuracy of node-based solutions on irregular meshes. Eleventh international conference on numerical methods in fluid dynamics. Williamsburg, VA, June 1988. 92 93

59

regions where second order derivatives of the flow variables play a significant role. If this is the case then it will be necessary to maintain central symmetry of the control volumes in boundary layer regions for Navier Stokes computations. Comparing Mesh Type for Viscous Accuracy After the emergence of so many different mesh types it is reasonable to assume that mesh generation has reached a plateau and that the future is unlikely to expand the choice of element types or meshing methods. Figure 5.2 lays out a subjective view of the suitability of different meshing methods for the computation of high Reynolds number Navier Stokes solutions. The structured Multi-block methods achieve good viscous accuracy but are time consuming to apply. Tetrahedral meshes with anisotropic elements in boundary layer regions are easier to create but their accuracy is suspect. Overset methods lie on the diagonal and thus represent a compromise between ease of use and their purported solution accuracy for viscous flows. The best meshing types should lie near the diagonal and be as far away from the origin as possible. It seems likely that the trade-off between accuracy and ease of use will shift so that perhaps one of the meshing methods will stand out as clearly superior in meeting the dual Figure 5.2 Comparison of different mesh types for RANS requirements of solution accuracy and Computations ease of application. In the best of all possible worlds one might hope that all mesh generation methods would one day meet this goal. At the time of writing it appears that composite multi-block meshes of hexahedra offer the best accuracy for RANS computations but the lack of an algorithm for automated block decomposition renders these meshes time consuming to create. At the other extreme, approach offers essentially fully automated mesh generation but the poor quality of mesh elements near boundary surfaces severely limits the accuracy of these mesh types, particularly for RANS computations. Overset meshes of hexahedra represent a compromise that lies between these two extremes; they are more complicated to set up than tetrahedral meshes and computations on overset meshes are arguably less accurate than comparable computations on composite multi-block hexahedral meshes. Effect of Prismatic Extrusion Sub-Layer in Viscous Layer If prism shaped elements are used in the viscous layer there will be central symmetry provided that there is good triangle quality in the lateral direction parallel to the boundary surface. By combining prismatic elements in viscous regions with a tetrahedral mesh for the inviscid part of the flow field one might expect to achieve solutions of the Navier Stokes equations that match the accuracy of computations on structured hexahedral meshes. Since the prism layer is unstructured in the lateral direction there is much more flexibility in handling complex geometries and a greater opportunity to achieve a high level of automation in the mesh generation process than would be the case with purely hexahedral elements. For these reasons hybrid meshes of prisms and tetrahedral have considerable appeal as the best compromise to achieve accuracy in RANS computations while permitting ease of mesh generation for complex configurations. Hybrid meshes consisting of prisms and tetrahedral were first

60

proposed by [Nakahashi] and then developed extensively by [Kallinderis et al]. There is little hard evidence to support the contention that using prisms in the boundary layer region is more accurate than using tetrahedral, or that hybrid meshes achieve the same accuracy as composite multi-block meshes made up of hexahedra. In fact, the limited evidence that is available from an analysis of the results presented at the second drag prediction workshop tends to contradict both these beliefs. Figure 5.3 Constructions of Hybrid mesh The extrusion layer is usually extruded with linear or exponential stretching functions for desired spacing of viscous flow calculation. [Moxey, et al.]95 proposed an isoperimetric approach, whereby a mesh containing a valid coarse discretization comprising of highorder triangular prisms near walls is refined to obtain a finer prismatic or tetrahedral boundarylayer mesh.

5.2 Meshing tools in CD-Adapco® There are different methodologies developed for Hybrid meshes. Each has its own merits and of course who you talking to. One such method developed by [Star-CD©]96 where their automated meshing is involved. The essence of the method is Inside-Out where most of applications are interior domain. By creating a sub-surface along actual surface, the interior mesh, composed of Hex and a transition layer (Tetrahedron), is filled. Once the interior is done, an extrusion layer will extrude from sub-surface to the surface with prismatic cells as depicted in Figure 5.3. The automated meshing where sub-surface mesh (orange) is clearly visible. Same procedure can be applied using the (Advanced Layer) on a T-Section for Figure 5.4 Predominantly polyhedral meshing predominantly polyhedral cells and boundary prisms as shown in Figure 5.4. A detailed description of the tools available, from CAD data to sub-models, is provided in Figure 5.6 in particular reference to advanced layer generation and automatic meshing. Other relevant details of automatic meshing is provided in Figure 5.5.

D. Moxey∗, M.D. Green, S.J. Sherwin, J. Peir´o, “An isoperimetric approach to high-order curvilinear boundarylayer meshing”, Computer Methods Applied Mechanics Engineering, 283 (2015) 636–650. 96User Guide STAR-CCM+ Version 8.06. 2013. 95

Sub-Models

61

Figure 5.6

Meshing tools in CD-adapco

Trimmed cells (surface) with Hexahedral Core

All Tetraheadral Cells

Hybrid Meshing

Cell Layer Extusion for Trimmed Cells

Figure 5.5

Combined Volume and Extrusion Layer Meshes

62

A Novel Methodology for Extrusion Layer Meshing A configuration of prismatic elements in boundary layers created by marching a surface triangulation on viscous walls along certain directions is a typical mesh for viscous-flow simulations [Zheng et al.]97. The quality of the resulting elements and the reliability of the meshing procedure thus highly depend on the computing strategy used to determine the marching directions. Here, we propose to compute a field of marching directions governed by Laplacian equations. This new approach can ensure the smooth transition of marching directions, and thereby lead to more desirable element shapes. To demonstrate the effectiveness of the proposed method for computing the normal vectors, a comparison was made with the traditional geometric method.

Figure 5.7

Meshes Generated by a) Proposed Algorithm and b) Leading Commercial Vendor

To generate the boundary-layer mesh, it first generated an anisotropic tetrahedral mesh around the model and then formed the boundary-layer mesh by combining three tetrahedral elements into a prism. In this software, the vertex normal direction is initially defined as the area weighted average of the face normal of the manifold of adjacent triangles, and is then smoothed and adjusted as necessary to guarantee the mesh quality and avoid collisions. Figure 5.7 a presents a cut-out view of the boundary-layer mesh generated by the proposed method near the intake of the engine. It can be seen that the normal at nodes of a same layer change in a smooth way, whereas the counterparts generated using a commercial code change more sharply (see Figure 5.7-b), and stretched elements can be observed in this region. To evaluate the quality of the generated prismatic elements, the scaled-aspect-ratio quality measure proposed in the literature was adopted in this study. It has been reported that this quality measure in effect combines the measures of triangle shapes and edge orthogonality98.

Yao Zheng, Zhoufang Xiao, Jianjun Chen, and Jifa Zhang, “Novel Methodology for Viscous-Layer Meshing by the Boundary Element Method”, AIAA Journal Vol. 56, No. 1, January 2018. 98 See Previous. 97

63

5.3 Case Study - Hybrid Unstructured Meshes for Common Research Model (CRM & JSM) via ANSA® In this work an unstructured meshing approach is taken using the commercial software ANSA®, developed by BETA-CAE Systems [Skaperdas and Ashton]99. This describes the meshing process within ANSA as well as an CRM Common Research Model analysis of the unstructured GMGW Geometry and Mesh Generation Workshop grids, similar to the tools provided in CD-Adapco®. It is HLPW High Lift Prediction Work produced for the 1st AIAA JAXA Japan Aerospace Exploration Agency Geometry and Meshing JSM JAXA high-lift configuration Standard Model Workshop and 3rd AIAA HighMAC Mean Aerodynamic Chord Lift Workshop. Particular focus STEP Standard for the Exchange of Product is made on the process to generate suitable grids for Table 5.1 Abbreviations various CFD codes including OpenFOAM and Star-CCM+. Some of the Abbreviations is been provided in Table 5.1 for clarity. Geometry and Mesh Generation Background The AIAA Drag Prediction and High Lift Prediction provide an opportunity for engineers in the aerospace sector to present and exchange information on the latest CFD methods and tools and to directly compare these methods on open-source geometries. The 1st Geometry and Mesh Generation Workshop took place under the umbrella of the 3rd High Lift Prediction Workshop. It was the first of its kind to focus specifically on the details of preparing high fidelity mesh models for CFD simulations. The aim of was to assess the current state of the art in geometry pre-processing & mesh generation technology and to bring together meshing specialists to discuss challenges and possible solutions. The models studied were NASA’s Common Research Model and JAXA’s high-lift configuration Standard Model. The JSM model was not studied in the workshop but given its inclusion in HLPW-3, the same mesh procedure was applied to both geometries. Both geometries are available in high lift configuration with slats and flaps extracted while the JSM model is also available with an optional engine nacelle and pylon. The main goal for participating in HLPW-3 was to assess the open-source CFD code OpenFOAM. Many aerospace specific CFD codes are restricted for national security reasons e.g., NASA CFD codes are typically not available to researchers in the UK or Greece. Whilst a number of commercial CFD codes are routinely used for industrial aerospace simulations, the ability to implement custom turbulence models, numerical schemes and algorithms means that these are not ideal for research and collaboration. Open source CFD codes like OpenFOAM, SU2 and Saturne have grown in popularity in recent years as a growing movement of international collaboration that is improved by the ease of sharing . Over the past 15 years OpenFOAM has developed from a University code to one which is used by both major industries and Universities, largely because of its growing user base and the comprehensive set of solvers, turbulence models and meshing capabilities. Whilst it has become common in the automotive sector, its largest perceived weakness is a lack of verification and validation, which is particularly true in the aerospace sector, where it does not have a demonstrated track record of matching the results from standard aerospace codes. Whilst OpenFOAM has its own mesh generation utility; SnappyHexMesh, a Cartesian-prismatic unstructured generation tool, the experience of the authors have shown that it is not suitable for low y+ grids and the region between the prismatic and Cartesian is often subject to severe non99 Vangelis Skaperdas, and Neil Ashton, “Development

1 workshop using ANSA”, AIAA, January 2018.

of high-quality hybrid unstructured meshes for the GMGW-

64

orthongality and large cell size jumps. For this reason an alternative mesh generator is used, which is capable of generating high-quality grids that represent the kind of unstructured grids that are typically used by the aerospace industry; ANSA® 17.1, a pre-processor from BETA-CAE System. Geometry Handling The geometries for the CRM and JSM high-lift models were downloaded from the HLPW-3 website100. A multitude of CAD file formats were available and for this project the STEP format was selected for both CRM and JSM models. 5.3.2.1 The CRM Model The STEP file of the HL-CRM model is in inches. It has a MAC of 275.8 inches and it represents a full scale aero plane model. No clean-up was required as the geometry had already been cleaned. Based on the GMGW/HLPW-3 meshing guidelines document, a hemi-spherical domain, suitable for imposition of far field boundary conditions, with a radius of 100 times MAC was created in ANSA and connected to the half symmetric airplane model. The raw CAD model was separated only in two zones, the slat and the whole remaining model. In order to facilitate meshing and pre-processing, we separated the model in 17 zones as revealed in Figure 5.8. Two versions of the CRM model are available101. One where the inboard flap is unconnected referred to as “gapped”) and one where the gaps between the inboard flap and outboard flap and main fuselage were sealed (referred to as “sealed”). In the latter case the worst proximity areas are removed, facilitating layers generation.

Figure 5.8

Computational Domain of the HL-CRM Gapped Flaps Model

“HLPW-3 Geometry.” [Online]. Available: https://hiliftpw.larc.nasa.gov/Workshop2/geometries.html%0D. [Accessed: 11-Dec-2017]. 101 Vangelis Skaperdas, and Neil Ashton, “Development of high-quality hybrid unstructured meshes for the GMGW-1 workshop using ANSA”, AIAA, January 2018. 100

65

5.3.2.2 The JSM Model The JSM model is designed in mm and it represents the actual wind tunnel model with a MAC of 529 mm. Geometry was read into ANSA without any topological problems. A hemi-spherical domain was created with a radius of 100 times MAC. The model was separated in ANSA in 13 zones to facilitate meshing and pre-processing as shown in Figure 5.9. Similarly to the HL-CRM model, the JSM model is available in two variants, without engine nacelle, as well as with engine nacelle, as shown in Figure 5.10 using the HLPW-3 notation for cases.

Figure 5.9

Computational Domain and Separation of Zones of the JSM Model with Engine Nacelle

The geometry of the JSM model has a particularity, which the HL CRM model does not have, that would eventually lead to problems in the generation of layers102. Those areas can be easily identified in ANSA through a quick test layers generation run for one layer. Such areas are identified, marked and can optionally be excluded from layers generation, although for the case of this study we wanted to avoid any area of the model without layers, as that would result to solution instability and error. Three such areas were found in the JSM geometry as highlighted in Figure 5.11.

Figure 5.10

JSM Model with Engine Nacelle

Vangelis Skaperdas, and Neil Ashton, “Development of high-quality hybrid unstructured meshes for the GMGW-1 workshop using ANSA”, AIAA, January 2018. 102

66

Figure 5.11

Three Locations of Problematic Areas of the JSM Geometry for the Generation of Boundary Layers

It was therefore decided to perform some small local geometry modifications103. The size of these geometrical additions is limited to around one or two local element lengths so as not to cause a significant disturbance to the flow field. It is believed that the benefits of allowing for good quality layer generation in these regions surpass any side-effects from deviating from the original CAD geometry. Surface Meshing ANSA provides the user with full control and automation in meshing though the Batch Mesh tool. Batch Mesh is a template driven meshing tool that consists of meshing scenarios for surface meshing, layers generation and volume meshing. Each scenario consists of several sessions and each session contains different zones of the model and the corresponding meshing characteristics. The contents of each session can be assigned manually, or via standard name convention filters of the zones of the model (like name contains, name starts with, name ends with etc.). Using filters allows more automation, since for every new design variant, the sessions can be populated automatically. One of the advantages of Batch Mesh tool is the fact that a scenario can be defined once, saved and then run several times for every new geometry, ensuring automation and mesh consistency for every variant. The CFD meshing algorithm in ANSA creates a high quality surface mesh, controlled by the following settings for each session of the Batch Mesh:     

Mesh type (triangular or quad) Target curvature refinement Growth rate of mesh on flat areas Minimum and maximum length Assigned length on all identified feature lines (different for convex and concave ones)

Vangelis Skaperdas, and Neil Ashton, “Development of high-quality hybrid unstructured meshes for the GMGW-1 workshop using ANSA”, AIAA, January 2018. 103

67

 Proximity refinement via prescribed length to gap ratio  Target quality criteria threshold values In addition to these mesh controls, the user can create Size Boxes to limit the maximum length of the surface and the volume mesh in different areas. Figure 5.12 displays the Batch Mesh surface meshing scenario that contains eight sessions, each with different zone contents and mesh specifications for the Medium JSM model. Ten Size Boxes were used, each one with a larger maximum length limit the further away of the aircraft. Size Boxes case be cylindrical or hexahedral and can also be manipulated by the user to take various curved forms aligned to the flow field where necessary.

Figure 5.12

Batch Mesh setup for the JSM Model with Size Boxes for Local Mesh Control

The only feature currently missing from Batch Mesh tool is the creation of anisotropic mesh, usually at the leading and trailing edges. The reason for this is that anisotropic mesh is not used in the automotive industry where ANSA usage was built on, while if it offers a great advantage for aerospace meshing. The main difference between these two industries with respect to meshing, is that in the aerospace industry the dimensions of the wings are much larger, while they require very fine curvature refinement. The flow gradients are considerably larger in the chord wise direction than in the span wise direction and as a result anisotropic mesh provides the most efficient refinement method. For the same level of curvature refinement on a typical wing geometry, an isotropic mesh may require at least three times more elements than an equivalent anisotropic mesh. In addition, in the aerospace industry the total height of the boundary layer elements is considerably larger than that used in the automotive industry. In Figure 5.13 the advantage of anisotropic meshing is obvious as in highly convex areas like leading and trailing edges, starting from a span wise anisotropy allows the layer elements to improve in quality with every new step. In the end, the top cap of the layers is perfectly isotropic and this is the best basis for the remaining pyramid and tetra meshing to follow. In contrast, when starting from an isotropic mesh, the mesh quality of the layers deteriorates with each step. For the case of the isotropic surface mesh, the top cap does not have a good quality and this makes the remaining volume meshing process harder. Therefore, the surface meshing of all the models was performed with the following combination of manual and Batch Mesh automatic operations:  Identification and manual meshing of all trailing edges with map quad mesh of specific rows of elements.

68

 Automatic Batch Meshing of all remaining surfaces of the model.  Manual imprint of anisotropic mesh patterns away from the trailing edges and along all leading edges.

Figure 5.13

Resulting Layers for Isotropic Surface Mesh (Top) and Anisotropic (Bottom)

Note how the anisotropic mesh dies out near the ends with the span wise imposed nodal distribution, in order to smoothly transit to isotropic mesh. The first surface scenarios for both HL-CRM and JSM models were performed for the medium mesh size according to the meshing guidelines for rows of

69

elements across the trailing edges and mesh resolution. From the medium meshes we generated the coarse and fine versions by simply scaling up and down respectively the assigned element length of all sessions of Batch Mesh scenario. Of course when dealing with unstructured mesh and especially with anisotropic features and Size Boxes, it is not easy to determine a priori the scale length factor in order to achieve the desired volume cell count. This can only be done for structured hex meshes, where cell number and edge length scale directly. Therefore, after certain trial and error runs, we ended up with a length scale multiplying factor of 1.2 to 1.25. This resulted in volume cell count changes of 1.6 to 1.8 between the different levels of refinement.

Figure 5.14

Close ups of Coarse CRM Gapped Flap Model with Comparison of Tridiagonal Dominant (Top) vs. Quad Dominant (Bottom) Surface Mesh

Using the batch mesh and simply changing the mesh type of all sessions, we also generated a quad dominant surface mesh for the coarse CRM case. Figure 5.14 displays the two variations of surface mesh, tridiagonal dominant and quad dominant. The quad dominant mesh has 30% fewer shell elements for the same mesh resolution. The only problem that may arise with a quad dominant mesh

70

is that due to the fact that the near wall layers have extreme aspect ratios, there may be curved areas of the model where these quads may also have considerable warping. The combination of warping and high aspect ratio may lead to problems in the solution. At the time of the HLPW-3 the quad dominant meshes were not prepared, so no simulations were performed for them. Currently ANSA development work for the next version focuses on the integration of anisotropic meshing of leading and trailing edges inside Batch Mesh tool, thereby eliminating any manual work for the user. Volume Meshing Volume meshing is also a part of the Batch Mesh. Two scenarios were created, one for layers and one for volume meshing. The scenarios were setup once for the CRM and JSM models and then with simple modifications in their parameters (growth rate, max size etc.) were executed automatically in order to generate the final volume meshes. 5.3.4.1 Extrusion Layers Generation The generation of layers is the most demanding part of the meshing process as the there are many factors that should be considered: very high aspect ratio elements whose quality is difficult to control, large total boundary layer height, resulting in proximity issues, especially around the areas of the flaps and slats, where the gaps are small. ANSA layers generation algorithm is very robust and controllable, with characteristics like:  Generation of hex or penta layers from quad or triangle surface mesh.  Generation of initial layers without growth for better refinement of the near wall region.  Generation of initial layers without vector smoothing ensuring high orthogonality near the wall.  Advanced smoothing algorithm to overcome problems of layers extrusion in concave areas.  Generation of layers with different growth rate, number and first height from different zones of the model.  Local element squeezing and collapsing at proximities to avoid intersections and bad quality.  Local collapsing when a target aspect ratio is reached, ensuring a nice volume transition with the tetra mesh to be connected. Layers squeezing and collapsing modes work in combination. The user can specify a maximum aspect ratio that the elements can attain when squeezed in order to overcome proximities. If this limit is exceeded then ANSA switches to local layer collapsing. Collapsing works for both penta and hex elements. Depending on the number of nodes that need to be collapsed in a certain area, pyramid and tetra elements are created out of the original penta and hex elements. No collapsing of course must take place at the first layers as that would result to very skewed tetras and pyramids. As the layers grow thicker however, collapsing does not compromise the quality of the resulting elements. In contrast to the recommended meshing guidelines of the workshop, the first layer height was kept constant throughout the mesh refinement study. The reason for this is that the initial simulations that were performed showed that a y+ value of just below 1 was achieved with these values, so there was no reason to change this parameter, as it was set to its optimum value. During the mesh refinement study the growth rate of the layers was reduced from 1.25 for the coarse mesh to 1.1 for the fine mesh. The first two layers were kept with constant height, as prescribed by the meshing guidelines. The number of layers was increased for the finer meshes in order to maintain the same total boundary layer height. In addition, the number of layers differed between the main wing and the fuselage. The reason for this was that the surface mesh length on the wing was smaller than that of the fuselage. As a result we needed more layers from the fuselage in order to reach a layer thickness with aspect ratio just below 1 so as to have a nice volume ratio between the last layer

71

and the first tetra or pyramid to connect on it104. Hex layers growing from quad surface mesh are also checked in every step for warping. In certain cases, due to local squeezing at proximities, if the top cap warping exceeds a user specified threshold, ANSA splits the hex into two pentas, so as to avoid having highly warped quads that would have a negative effect in the pyramid generation for the tetra meshing. For further details regarding the meshing, consult the105. 5.3.4.2 Tetra Meshing After layers generation is completed, the third and final Batch Mesh scenario is executed. It consists of the automatic detection of the boundaries of the external volume, and its meshing with tetra elements using the TetraRapid volume meshing algorithm. This algorithm is a hybrid advancing front Delaunay, optimized for speed, smooth size variation and robust surface capturing even in aerospace applications where map anisotropic high aspect surface mesh is present and size variations exist from the surface of the model to the far field boundary of up to one hundred thousand orders of magnitude. Even in such cases, and despite of the fact that it runs on a single thread, it manages to generate high quality tetra mesh at the speed of one to three million tetras per minute, depending on the complexity of the domain and the presence of additional refinement Size Boxes. The growth rate of the volume mesh was set to 1.15. Figure 5.15 shows the medium JSM mesh.

Figure 5.15

Volume Mesh of the JSM

Sample CFD Results Full details of the results are given in [Ashton et al.]106 however a brief sample of the results are provided here to demonstrate the performance of the meshes generated. Simulations were Vangelis Skaperdas, and Neil Ashton, “Development of high-quality hybrid unstructured meshes for the GMGW-1 workshop using ANSA”, AIAA, January 2018. 105 See Above. 106 106 N. Ashton, M. Fuchs, C. Mockett, and B. Buda, “EC135 Helicopter Fuselage, ”Go4Hybrid: Grey Area Mitigation for Hybrid RANS-LES Methods”, C. Mockett, W. Haase, and D. Schwamborn, Springer International Publishing, 2018, pp. 2013–2015. 104

72

undertaken in STAR-CCM+ and OpenFOAM in order to assess the accuracy and robustness of OpenFOAM against a popular commercial code. In OpenFOAM a segregated pressure-based solver (rhoPimpleFoam) is used with local time-stepping to accelerate steady-state convergence. Second order upwind schemes were used for the both momentum and turbulence quantities with a greengauss scheme for the gradient operators. In STAR-CCM+ a fully implicit compressible density based scheme is used with the Roe scheme for the flux. A green-gauss scheme with a min-mod limiter was used for the gradient calculations and a second order upwind scheme was used for both the momentum and turbulence quantities. 5.3.5.1 CRM The flow conditions for the CRM geometry are a Reynolds number of Re = 3.2x106 and a Mach number of M = 0.2, however as the geometry is full-scale the flow parameters are adjusted to achieve the required Reynolds number. The viscosity is computed using Sutherlands Law and the density is based upon the ideal gas law. Simulations are conducted at 8 & 16 degrees angle of attack and for both STAR-CCM+ and OpenFOAM the Spalart-Allmaras turbulence model is used. Figure 5.16 displays the Lift and Drag coefficients for the CRM geometry at 8 degree for STAR-CCM+ and OpenFOAM. There is a clear mesh refinement trend for both codes, suggesting that even finer meshes would be required to reach a mesh converged solution for the lift. Given the finest mesh is 269 M cells, it is likely that a meshes up to a billion cells might be required. The agreement between OpenFOAM and STAR-CCM+ is within 0.5% for the lift coefficient and less than 2% for the drag coefficient. They show the same outboard flap separation with the size and position being almost identical. This less than 2% difference to a popular commercial CFD code would suggest that OpenFOAM is a competitive tool for engineering analysis, which reflects the recent findings of [Ashton et al.]107. Figure 5.16 Lift and Drag Coefficients for CRM Geometry at 8 degree AoA using OpenFOAM and STAR-CCM+

N. Ashton, M. Fuchs, C. Mockett, and B. Buda, “EC135 Helicopter Fuselage,” in Go4Hybrid: Grey Area Mitigation for Hybrid RANS-LES Methods, vol. 134, C. Mockett, W. Haase, and D. Schwamborn, Eds. Cham: Springer International Publishing, 2018, pp. 2013–2015. 107

73

5.3.5.2 JSM Close agreement between OpenFOAM and STAR-CCM+ was observed for the CRM geometry, however without experimental data it is not possible to assess the accuracy. The JAXA Standard Model (JSM) high-lift model is similar to the CRM but has a detailed experimental data set making it ideal to assess the accuracy of OpenFOAM and STARCCM+. The flow conditions are a Reynolds number of Re =1.9x106 and a Mach number of M = 0.172. The viscosity is computed using Sutherlands Law and the density is based upon the ideal gas law. Simulations are conducted at 4.36, 10.47, 14.54, 18.58, 20.59, 21.57degrees angle of attack and all simulations use the Spalart Allmaras turbulence model. Figure 5.17 shows the lift and drag coefficient throughout the angle of attack range using OpenFOAM and STAR-CCM+ for the geometry (no nacelle). It can be seen that there is again close agreement between STAR-CCM+ and OpenFOAM, with only changes becoming clear in the post-stall region. At 4.36 degree, the flow is completely attached in both CFD and the experiment, which is reflected in the close agreement between CFD and experimental for the lift in the lower angle of attack range. At 18.57 degree, just before stall, the agreement in the total lift is close, however the flow structures start to exhibit slightly too much stall in the outboard wing section. By 21.57 degree where the flow is now stalled, the agreement is close but actually for the wrong reason. Whereas the experimental flow-vis shows both separation at the root and the most outboard region of the wing, the CFD (both STAR-CCM+ and OpenFOAM) show almost no separation at the root Figure 5.17 Lift and Drag Coefficients for the JSM and much larger separation at the Geometry using OpenFOAM and STAR-CCM+ outboard of the wing. The total amount of separation is roughly similar which explains why the lift and to a lesser extent the drag

74

follow the experimental values. Given that all simulations were undertaken with the SpalartAllmaras model with no corrections for curvature nor anisotropy of the flow it is not surprising that the results do not perfectly correlate with the experiment. More details results for these cases are shown in [Ashton et al.]108. The results from both the CRM and JSM have shown that both STAR-CCM+ and OpenFOAM on ANSA generated grids can perform well for complex full aircraft geometries and in the case of the JSM, match experimental values up to the stall region. The next steps are to properly assess the code for transonic flows, which is the typical flow regime for industrial aerospace simulations.

5.4

Listing of Available Meshing Software

Table 5.2 shows the list of currently available grid generation software (some vendors and features might have been updated yet).

Grid Software

Structured

Un-Structured

Hybrid

3DGRAPE ANSA CFD-GEOM CSCMDO EAGLEVIEW GAMBIT GEMS GENIE++ GRID* GRIDGEN GridPro ICEM-CFD IGG INGRID Hyper Mesh MACGS MBGRID MEGACADS NGP PEGSUS Pro-Star RAGGS RAPID SAUNA TGRID TIGER UNISG VGRID

yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes -----yes yes yes yes -----yes yes ------

-----yes yes -----yes yes ---------------yes yes yes yes -----yes ---------------yes Chimera yes yes -----yes yes ----------yes

-----yes yes ----------yes ---------------yes ----------yes -----yes ---------------yes -----yes ----------yes ---------------------

Table 5.2

Currently Available Grid Generation Software

N. Ashton and V. Skaperdas, “Verification and Validation of OpenFOAM for High-Lift Aircraft Flows,” Submitted to AIAA Journal, 2017. 108

75

76

6 Adaptive Mesh (Unstructured) The case for structured adaptive grid is covered before, therefore, will not be mentioned here, therefore, this section is intended for unstructured adaptive meshing. Aside from the treatment of complex geometries, the second main advantage of unstructured meshes is the ease with which solution-adaptive meshing may be implemented109. Since no inherent structure is assumed in the representation of the mesh, mesh points may be added, deleted, or displaced, and the mesh connectivity may be locally reconfigured in the affected regions. The goal of mesh adaptation is the determination of the optimum mesh-point distribution that results in equipartition of the error for each individual simulation. The character of the problem to be solved dictates the requirements of the mesh adaptation strategy. For example, steady-state problems usually involve a small number of adaptation phases as part of a lengthy solution process. Therefore, relatively sophisticated adaptation strategies can be employed, such as, in the extreme case, complete mesh regeneration. Mesh refinement procedures are most important here, while de-refinement has only a minor effect and can often be omitted for steady-state cases. For transient problems, mesh adaptation must be performed every several time steps, and thus efficiency is much more important than optimality. Mesh refinement and de-refinement are both essential for transient cases, as well as mesh movement for cases with moving boundaries. Furthermore, the accuracy of interpolation from the original mesh to the refined mesh affects the solution accuracy (unlike the steady-state case), and thus accurate transfer schemes are required. Delaunay-based mesh generation techniques can easily be extended to incorporate adaptive refinement capabilities [Mavriplis]110-111; [Weatherill]112. Once a solution has been obtained on an initial mesh, new points can be added in regions where high errors are detected. These new points can be triangulated into the mesh using the Bowyer-Watson point insertion algorithm. Alternatively, if a Non-Delaunay mesh is employed, new points may be inserted through element subdivision, and the connectivity of the resulting mesh may be optimized through several face-edge swapping passes based on any appropriate criterion. Rule-based hierarchical element subdivision is a very effective adaptive technique, particularly for unsteady flows, where efficiency and accuracy of interpolation between successive grids are important considerations [Stoufflet 1987, L¨ohner & Baum 1992, Rausch1992, Braaten & Connell 1996]. The essential approach consists in recursively subdividing mesh elements where large solution errors are detected, but conforming to a set of well-defined subdivision rules, which are necessary to prevent the formation of degenerate element shapes and connectivity. Storing the hierarchy of the recursive process enables de-refinement to be implemented by simply retracing the subdivision history. Hierarchical subdivision is also applicable to non-simplicial hybrid meshes by constructing a library of subdivision rules for each element type.

6.1 Type of Mesh Refinement

Mesh movement or R-refinement (to be discussed later) has applications in both steady and unsteady flows. For example, R-refinement may be useful for optimizing the normal resolution of the mesh in

109 Mavriplis, DJ:”

Unstructured Grid Techniques”, Annual. Rev. Fluid. Mech. 1997. 29:473–514 ©1997 by Annual Reviews Inc. 110 Mavriplis DJ., “Accurate multigrid solution of the Euler equations on unstructured and adaptive meshes”, AIAA J. 28(2):213–21 111 Mavriplis DJ., “Adaptive mesh generation for viscous flows using Delaunay triangulation”, J. Computational Phys. 90(2):271–91 112 Weatherill NP, Hassan O, Marcum DL, “Calculation of steady compressible flow fields with the finite-element method”, AIAA Pap.93-0341

77

a developing boundary layer or for clustering points around shock waves (Palmerio113, Castro-Diaz et al 1995). For transient problems with moving boundaries, R-Refinement is indispensable. Difficulties center on conserving a minimum degree of grid quality under severe deformations. In areas where grid deformation becomes unacceptable, local reconnection through swapping techniques can easily be performed, but only for simplicial meshes (Kennon et al, Baum et al 1994, Venkatakrishnan & Mavriplis114). In practice, combinations of H and R-Refinement are often employed (Baum et al115, Castro-Diaz et al116) for such cases. Central to the implementation of any solution-adaptive scheme is the ability to detect and assess solution error (P-Refinement). The construction of a suitable refinement criterion represents the weakest point of most adaptive strategies. The main problem is that an exact characterization of the error requires a knowledge of the solution itself, which is obviously impractical. Most error estimates are based on the assumption that the solution is smooth and asymptotically close to the exact solution. This is often not the case for fluid dynamics problems, which are governed by nonlinear hyperbolic partial-differential equations. Solutions may contain discontinuities, and downstream flow features often depend on adequate resolution of upstream flow features. Most refinement criteria are heuristically based on (undivided) gradients and/or second differences of the various flow variables. Conservative criteria (i.e. over-refining) are often employed to compensate for the inability to accurately characterize the true solution error. Because adaptive meshing results in different mesh topologies for each simulation, even when the geometry of the problem is unchanged, parametric studies (typically used in design processes) are complicated by the requirement to distinguish between grid-induced and physical solution variations. Nevertheless, for problems with disparate length scales, adaptive meshing is often indispensable for resolving small flow features, and their full potential awaits the development of more well-founded adaptive criteria. Mesh adaptation, often referred to as Adaptive Mesh Refinement (AMR), refers to the modification of an existing mesh so as to accurately capture flow features. Generally, the goal of these modifications is to improve resolution of flow features without excessive increase in computational effort. We shall discuss in brief on some of the concepts important in mesh adaptation. Mesh adaptation strategies can usually be classified as one of three general types: R-refinement, H-refinement, or P-refinement as depicted in Figure 6.1.

(a) AMR R-refinement Figure 6.1

(b) AMR H-refinement

(c) Hanging Node

Adaptive Mesh Refinement types

Palmerio B.,” An attraction-repulsion mesh adaption model for flow solution on unstructured grids”, Computational Fluids 23(3):487- 506. 114 Venkatakrishnan V, Mavriplis DJ.,”Implicit method for the computation of unsteady flows on unstructured grids”, Proc. AIAA CFD Conf., 12th, San Diego. AIAA Pap. 95-1705-CP 115 Baum JD, Luo H, L¨ohner R., ”A new ALE adaptive unstructured methodology for the simulation of moving bodies”, AIAA Pap. 94-0414. 116 Castro-Diaz MJ, Hecht F, Mohammadi B.,”Anisotropic unstructured mesh adaptation for flow simulations”, Int. Mesh Roundtable, 4th, Albuquerque, NM, pp. 73–85. 113

78

R-Refinement (RR) This is the modification of mesh resolution without changing the number of nodes or cells present in a mesh or the connectivity of a mesh. The increase in resolution is made by moving the grid points into regions of activity, which results in a greater clustering of points in those regions. The movement of the nodes can be controlled in various ways. On common technique is to treat the mesh as if it is an elastic solid and solve a system equations (subject to some forcing) that deforms the original mesh. Care must be taken, however, that no problems due to excessive grid skewness arise. (See Figure 6.1 (a)). H-Refinement (HR) The modification of mesh resolution by changing the mesh connectivity. Depending upon the technique used, this may not result in a change in the overall number of grid cells or grid points. The simplest strategy for this type of refinement subdivides cells, while more complex procedures may insert or remove nodes (or cells) to change the overall mesh topology. In the subdivision case, every "parent cell" is divided into "child cells". The choice of which cells are to be divided is addressed in Figure 6.1 (b). For every parent cell, a new point is added on each face. For 2D quadrilaterals, a new point is added at the cell centroid also. On joining these points, we get 4 new "child cells”, (3 in tetrahedral). Thus, every quad parent gives rise to four new off springs. The advantage of such a procedure is that the overall mesh topology remains the same (with the child cells taking the place of the parent cell in the connectivity arrangement). It is easy to see that the subdivision process increases both the number of points and the number of cells. An additional point to be noted is that this type of mesh adaptation can lead to what are called "hanging nodes." In 2D, this happens when one of the cells sharing a face is divided and the other is not, as shown in Figure 6.1 (c). For two quad cells, one cell is divided into four quads and other remains as it is. The highlighted node is the hanging node. This leads to a node on the face between the two cells which does not belong (properly) to both of the cells. The node "hangs" on the face, and one of the cells becomes an arbitrary polyhedron. In the above case, the topology seemingly remains same, but the right (undivided) cell actually has five faces. Figure 6.2 show a mesh modeling supersonic flow around a space shuttle in which h-method

Figure 6.2

An H-refinement mesh about a shuttle-like body (left) and computed CP (right)

79

adaptivity has been employed to optimize the mesh structure to produce accurate simulation of flow features important in assessing the performance of the design such as the profiles of pressure distribution shown117. 6.1.2.1 Isotropic vs Anisotropic Meshing There are two ways of H-Refinement: Isotropic and Anisotropic. Anisotropic is the property of being directionally dependent, as opposed to isotropy, which implies identical properties in all directions. In isotropic refinement, new points are added in both the directions, say x and y. In anisotropic refinement, the division takes place in one predominant direction (see Figure 6.3). Thus, in short, an isotropic refinement for a quad would produce four new off springs, while anisotropic refinement would only generate two. Anisotropic refinement is made use of, when the user knows that the flow feature is predominantly to be resolved in one direction, for e.g. Boundary Layers. However, there are situations where an anisotropic refinement alone may not be satisfactory, such as a shockboundary layer interaction.

Figure 6.3

Isotropic vs Anisotropic Meshing

P-Refinement (PR) A very popular tool in Finite Element Modelling (FEM) rather than in Finite Volume Modelling (FVM), it achieves resolution by increasing the order of accuracy of the polynomial in each element (or cell). In AMR, the selection of "parent cells" to be divided is made on the basis of regions where there is appreciable flow activity. It is well known that in compressible flows, the major features would include Shocks, Boundary Layers and Shear Layers, Vortex flows, Mach Stem, Expansion fans and the like. It can also be seen that each feature has some "physical signature" that can be numerically exploited. For e.g., Shocks always involve a density/pressure jump and can be detected by their gradients, whereas boundary layers are always associated with rotationally and hence can be detected using curl of velocity. In compressible flows, the velocity divergence, which is a measure of compressibility is also a good choice for shocks and expansions. These sensing parameters which can indicate regions of flow where there are activity are referred to as Error Indicators and are very popular in AMR for CFD. The spectral order p of the approximation is raised or lowered to control error. In finite element methods or boundary element methods, the order p corresponds to the degree of the polynomial shape function used over an element. Just as refinement is possible by Error Indicators as mentioned above, certain other issues also assume relevance. Error Indicators do detect 117

The National Academies Press, “Research Directions In Computational Mechanics”, 1991.

80

regions for refinement, they do not actually tell if the resolution is good enough at any given time. In fact the issue is very severe for shocks, the smaller the cell, the higher the gradient and the indicator would keep on picking the region, unless a threshold value is provided. Further, many users make use of conservative values while refining a domain and generally end up in refining more than the essential portion of the grid, though not the complete domain. These refined regions are unnecessary and are in strictest sense, contribute to unnecessary computational effort. It is at this juncture, that reliable and reasonable measure of cell error become necessary to do the process of "coarsening", which would reduce the above-said unnecessary refinement, with a view towards generating an "optimal mesh". The measures are given by sensors referred to as Error Estimators, literature on which is in abundance in FEM, though these are very rare in FVM. Control of the refinement and/or coarsening via the error indicators is often undertaken by using either the 'solution gradient' or 'solution curvature'. Hence the refinement variable coupled with the refinement method and its limits all need to be considered when applying mesh adaptation.

6.2 Adaptive Mesh Refinement (AMR) The simplest refinement anyone can think of is to divide all cells in the domain. This is referred to as "Uniform Refinement". Although it does improve the solution vastly, it is easy to realize that we are going for a huge unwanted effort in doing so. For e.g., in the far field region of an airfoil, cell division is not bringing in any improvement because the flow such as a shock-boundary layer interaction. To achieve the goal of mesh adaptation, the refinement is done at "selected" regions alone based on certain criterion. This is referred to popularly as AMR or Adaptive Mesh Refinement. It is to be remarked that AMR does not only encompass division of cells into smaller ones (Refinement), but also the agglomeration of smaller cells into a larger one (De-Refinement or coarsening), when the need arises. An example of AMR is presented in Figure 6.4 using a 2D case on a Cartesian grid118.

Figure 6.4

Adaptive Mesh Refinement (HR) on 2D case using Cartesian grid

Paramesh, Parallel Adaptive Mesh Refinement, http://www.physics.drexel.edu/~olson/paramesh-doc/Users_manual/amr.html 118

81

AMR for Transient Inviscid Flow Considers the solution of an internal transient inviscid supersonic flow (Lyra et al.)119. The geometry consists in a wind tunnel with a step and the inflow boundary condition consists of a uniform Mach 3.0 flow with angle of attack 0°. At the right boundary the flow is let free to leave the domain and along the walls, reflecting boundary conditions are applied. During the transient adaptive procedure several adapted meshes are generated along the time integration according to the error analysis. Figure 6.5 shows some selected meshes: mesh 3, is the third mesh generated during the transient adaptive process, and meshes 20, 27 and 49 are meshes generated before and after the time when the shock starts to be reflected from the top boundary. The mesh refinement is clearly following the physical features of the flow. The adaptive algorithm try to obtain an “optimal” mesh for a pre-defined number of elements. The target number of elements for this analysis was 1000 and a limited aspect ratio of 4 was considered. The number of elements generated in the meshes shown was 620, 977, 994 and 1010, and the corresponding number of nodes was 638, 1007, 1029 and 1047, showing that the procedure obeyed well the imposed constraints.

Figure 6.5 Selected initial meshes for the transient adaptive procedure (Meshes 3, 20, 27 and 29)

Case Study 1 – Unstructured Mesh Adaptation for 2D Airfoil120 In order to be able to examine shock-dominated processes at high spatial resolutions without incurring heavy computational penalties, even in two dimensions, it is desirable to use some form of mesh adaptation. Adaptive codes make use of the local flow solution itself to determine where the high spatial mesh resolution is required and then employ some strategy to increase the grid resolution in those regions. This enables the high spatial mesh resolution to be concentrated around the important flow features (e.g. shocks, vortices and so on) rather than being wasted on parts of the computational domain where the flow activity is relatively unimportant. One increasingly popular approach to mesh adaptation is so-called refinement, where additional mesh nodes and elements are inserted into the computational domain in regions where the greater resolution is required and then removed from the mesh when the higher mesh node density is judged to be redundant. The process Lyra, P.R.M., de Carvalho, D.K.E., Willmersdorf, R.B. and Almeida, R.C.C., 2002, “Transient Adaptive Finite Element Analysis of Compressible Flows”, WCCM'2002-Proceedings of the 5th World Conference on Computational Mechanics, Vienna-Austria. 120 David A. Venditti and David L. Darmofal, “Grid Adaptation for Functional Outputs: Application to Two Dimensional Inviscid Flows", Journal of Computational Physics 176, 40–69 (2002). 119

82

of mesh adaptation is invoked automatically in response to some dynamically evolving flow solution criteria, with the regions of mesh refinement corresponding to regions of significant flow activity where it is desirable to have increased spatial resolution (see Figure 6.7 and Figure 6.6). How these criteria are chosen has important consequences for the overall operation of the adaptive solver. The complete adaptive solver may be thought of as consisting of three parts,   

mesh data structure, adaptation algorithm and flow integration algorithm, where these objects are organized as adaptation data structure integration

Figure 6.6

Grid Adaption using Supersonic Flow for an Airfoil (bow shock)

Thus the adaptation and integration operations can be thought of as two distinct processes that are applied to the central data structure. The connectivity outlined above is sufficient to completely specify a given mesh, but it does not contain the connectivity required to construct the adaption hierarchy. For this some additional information is required, which in the case of elements and edges consists of storing parent and child addresses. The bisection of a parent edge by the addition of a node to the mesh results in the creation of two child edges. To extend the, sequence of events involved in a complete adaption and integration of the mesh is shown at first, mesh elements are flagged for adaption. This results in each mesh edge being

Figure 6.7

NACA 0012 test case: M∞= 0.8, α=1.25

83

targeted either for refinement, de-refinement or no action data structure to include numerical parameters such as the flow variables. 6.2.2.1 Adaption Control Mechanism The Euler flow solver is combined with the adaptive algorithm by flagging regions of the mesh with (low) high density gradients for (de)refinement, with the calculation of local flow gradients being performed across element faces. Where the face normal density gradient falls below or exceeds a chosen tolerance, the edges on the face are flagged to de-regime. In addition, a `safety layer' of refinement flagging is employed to ensure the full capture of solution discontinuities, which is the principal concern for this application. Likewise, a maximum mesh refinement depth is also specified. Coupling the adaption algorithm to the solution integrator is managed in a similarly straightforward manner. Figure 6.7 depicts a NACA airfoil in a transonic flow, while Figure 6.6 shows the same geometry when placed in supersonic flow with a bow shock. Case Study 2 – Parallel Implementation of Unstructured Mesh Refinement of Duct Flow The simultaneous alteration of the decomposed domains of an unstructured mesh presents a number of challenges121. In parallel, each processor operates on its own partition, concurrent with and independent of the others. Previous work in parallel mesh refinement 122-123 demonstrated methods in which adaptation was performed on each processor, and patterns for cell subdivision were exchanged across inter-processor boundaries, ensuring a conforming mesh. Coarsening the interprocessor boundary was not a concern, nor was the possible motion of the mesh boundaries. Therefore the first issue that arises in parallel adaptation is how to treat the inter-processor boundaries. Rather than modify these faces, the inter-processor boundaries are shifted using a cell migration technique. The inter-processor faces and adjacent cells then become interior faces and interior cells, which may be readily modified through a second adaptation pass. In the second pass only the former inter-processor boundary region needs to be coarsened, refined, or smoothed, as the remainder of the mesh is already consistent with the prescribed point spacing illustrates the twopass approach for solution-based coarsening and refinement of supersonic flow entering a duct. The original mesh partitions, shown in Figure 6.8-(1), are independently coarsened and refined to produce the adapted mesh of (2). Note that the inter-processor boundaries are not modified, which leaves a region of the mesh that still requires adaptation. Several layers of cells are migrated from the right processor to the left, as seen in (3). The inter-processor boundary is now to the right of its original location. A second coarsening and refinement pass treats the former inter-processor faces and adjacent cells, producing the final adapted grid of (4). A consequence of the cell migration approach is that the shape and extent of the decomposed domains change. The cell migration process may introduce new pairs of adjacent domains that did not initially communicate. Similarly, pairs of processors that once shared common nodes, edges, and faces may become disconnected as a result of cell migration. Updating the inter-processor communication schedule proceeds in two stages. First, the current communication lists are updated for each pair of adjacent domains. If no common nodes are found between two domains, the communication is removed from the cycle. The second stage involves checking for any new communication pairs introduced as a result of migration. In addition, one can no longer refer to the Cavallo, P.A., Sinha, N., and Feldman, G.M.,” Parallel Unstructured Mesh Adaptation For Transient Moving Body And Aeropropulsive Applications”, Combustion Research and Flow Technology, Inc. (CRAFT Tech), Pipersville, PA. 122 De Keyser, J., and Roose, D., “Run-Time Load Balancing Techniques for a Parallel Unstructured Multi-Grid Euler Solver with Adaptive Grid Refinement”, Parallel Computing, Vol. 21, pp. 179-198, 1995. 123 Flaherty, J.E., Loy, R.M., Shephard, M.S., Szymanski, B.K., Teresco, J.D., and Ziantz, L.H., “Adaptive Local Refinement with Octree Load Balancing for the Parallel Solution of Three-Dimensional Conservation Laws”, Journal of Parallel and Distributed Computing, Vol. 47, pp. 139-152, 1997. 121

84

original decomposed grid to obtain data for solution transfer or for establishing point spacing after the coarsening phase. This issue is remedied by recomposing the global grid arrays at the start of the mesh adaptation process, such that the list of global vertex coordinates, solution vectors, and computed point spacing may be readily available to all processors. Case Study 3 – Generic Transonic Store Release124 The next application considered is the separation of a finned store from a wing/pylon configuration at Mach 1.2. Inviscid flow is assumed for this tetrahedral grid. A constant ejection force is applied over the first 0.1 seconds of the simulated separation. After the initial ejection stroke, the motion of the store is provided by general 6-degree-of-freedom (6-DOF) equations of motion using the current integrated surface pressure distribution. Gravitational acceleration is also included. Figure 6.10 provides an overview of the simulation. A total of ten adaptations were performed at regular intervals. The unstructured grid is comprised of approximately 2.7 million cells, and is decomposed on 16 processors. In this image, the store is colored by the current pressure distribution at each of the four instants shown, and the black lines indicate the changing inter-processor boundaries on the store surface resulting from cell migration and load rebalancing. As it translates, the store yaws nose away from the symmetry plane and pitches nose down. The surface pressure distribution reflects the changing local angle of attack and sideslip angle of the store. As the distance between the store and pylon surfaces increases, the mesh distortion becomes less severe. With each successive adaptation, the deformation measure reduces to a minimum value greater than the previous minimum. This (1) Original

(2) First Adaption Pass

(3) Cell Migration into inter processor boundary

(4) Second Addaption pass

Figure 6.8

Two-pass approach for parallel coarsening and refinement.

Cavallo, P.A., Sinha, N., and Feldman, G.M.,” Parallel Unstructured Mesh Adaptation For Transient Moving Body And Aeropropulsive Applications”, Combustion Research and Flow Technology, Inc. (CRAFT Tech), Pipersville, PA 18947. 124

85

indicates that mesh movement may likely be applied for a longer period of time before adaptation is warranted. Such strategies and tradeoffs are yet to be investigated. The evolution of the unstructured

Figure 6.9

Inter-Processor partitioning based on Laplace coefficients

mesh as the store falls away is depicted in Figure 6.10 where inter-processor boundaries are highlighted in red. Through the adaptive coarsening and refinement procedures, overall mesh quality is maintained, and an appropriate cell distribution is provided as the distance between the store and pylon increases. Although Figure 6.11 illustrates a slice through the mesh, one can readily see the migration and rebalancing of the inter-processor boundaries125 as left(before), right(after) redistribution. To improve the Figure 6.10 Store position, orientation, and surface partitioning through high aspect ratio pressures at selected points in trajectory cells, FLUENT® recently device a partitioning method based on grouping of the Laplace coefficients as shown in Figure 6.9. In addition, it improves convergence rate for cases with highly stretched cell.

6.3 Mesh Modification Operators The tetrahedral region of the grid is locally refined by means of a constrained Delaunay refinement algorithm combined with a circumcenter point placement strategy126. Any inconsistency between the circumradius of a tetrahedron and a desired point density triggers the point insertion procedure. This iterative cell refinement is repeated until the cell circumradii are consistent with a prescribed point spacing. Coarsening of the tetrahedral region is also permitted through an edge collapse procedure. In regions where the grid is distorted or where solution errors are negligible, edges may be selected for removal. All cells incident to the deleted edge are removed from the mesh, the adjacent Cavallo, P.A., Sinha, N., and Feldman, G.M.,” Parallel Unstructured Mesh Adaptation For Transient Moving Body And Aeropropulsive Applications”, Combustion Research and Flow Technology, Inc. (CRAFT Tech), Pipersville, PA 18947. 126 Cavallo, P.A., Sinha, N., and Feldman, G.M., “Parallel Unstructured Mesh Adaptation For Transient Moving Body And Aeropropulsive Applications”, Combustion Research and Flow Technology, Inc. (CRAFT Tech), Pipersville, PA. 125

86

cells are redefined, and the two nodes of the edge are collapsed to a single vertex. The prismatic and hexahedral regions of the grid may be refined through cell subdivision procedures. As the boundary of the tetrahedral region is refined the adjacent prism layers are also modified. This is accomplished by splitting edges at the tet/prism interface, and propagating this subdivision down to the wall through all of the layers. In addition, a procedure is in place to refine entire layers of prisms if an improved boundary layer resolution is desired. The refinement of the hexahedral region of the grid is accomplished using the pattern formation procedure of Biswas and Strawn127, which employs a parent-child data structure to split the cells. Each hexahedral cell is then split according to a pattern, to generate 2:1, 4:1, or 8:1 sub-divisions. This cell subdivision creates buffer cells, which are tetrahedral, pyramid, or prismatic elements used to transition between different levels of hexahedral refinement, thus ensuring a conforming mesh with no hanging nodes. An initial point spacing ρ0 is defined for each vertex as the average edge length for all edges incident to the node. A larger grid spacing produces an iterative coarsening of the mesh. Using the mesh deformation measure, we modify the local grid spacing to be

ρ

ρ0 σ where τ  min τ σ max

Eq. 6.1

Figure 6.11 Adapted mesh partitioning during store dispense

127

Biswas, R., and Strawn, R.C., "Tetrahedral and Hexahedral Mesh Adaptation for CFD Problems", NAS Technical Report NAS-97-007, 1997.

87

And σi represent the dilatation of the tetrahedron in each of three principal directions, and are equivalent to the singular values of the transformation matrix. Note that the more deformed the cell, the larger the prescribed spacing, and hence an increased amount of coarsening will be performed. This improves the likelihood of the distorted cell being removed. Conversely, the enrichment procedures are invoked by specifying a smaller spacing. After the coarsening phase, an appropriate gradation of cell size is restored by solving a Laplace equation for ρ, using the boundary mesh spacing as Dirichlet boundary conditions. An approximate solution is obtained by summing the difference in the point spacing for all edges N incident to the node using a relaxation technique.

ρ

n 1



ε N n n  ρ   ρk  ρ N k 1 n



Eq. 6.2

Prescribing new point spacing also drives solution-based coarsening and refinement. A variation on the solution error estimate developed in two dimensions by128 has been implemented in three dimensions for arbitrary mesh topologies. The method is based on forming a higher order approximation of the solution at each mesh point using a least squares approach. The difference between the higher order reconstruction from incident nodes and the current solution forms the error measurement. If the current mesh is sufficiently fine to support the spatial variation in the solution, the estimated error will be low, allowing coarsening to take place. Conversely, a high degree of error indicates additional refinement is needed.

C., Zhang, X.D., Trépanier, J.-Y., and Camarero, R., “A Comparison of Three Error Estimation Techniques for Finite-Volume Solutions of Compressible Flows”, Computer Methods in Applied Mechanics and Engineering, Vol. 189, pp. 1277-1294, 2000. 128 Ilinca,

88

7 Dynamic Meshing The moving-mesh provides a capability of tackling flow simulations where the domain shape changes during the simulation. In such cases, the computational mesh needs to adapt to the time-varying shape of the domain and preserve its validity and quality. The mesh motion solver support which calculates the internal point motion based on the prescribed motion of the boundary. The performance of the method is preserved through the choice of decomposition of cells, the bounded discretization and the use of iterative solvers129. We covered the dynamic mesh before a little bit with Adaptive Mesh Refinement (AMR) where it was characterized it as H, P, and R-Methods. To recap:   

H-Method - It involves automatic refinement or coarsening of the spatial mesh based on a posteriori error estimates or error indicators. The overall method contains two independent parts, i.e. a solution algorithm and a mesh selection algorithm. P-Method - the adaptive enrichment of the polynomial order. R-Method - The R-Method is also known as Moving Mesh Method (MMM). It relocates grid points in a mesh having a fixed number of nodes in such a way that the nodes remain concentrated in regions of rapid variation of the solution.

Where most of adaptive refinements is using R-Methods, with key ingredients which includes Interpolation of time dependent mesh equation130. In the Dynamic Mesh, the computational mesh is moved to follow the changing shape of the boundary by moving its points in every step of the transient simulation. The main difficulty in this case is maintaining the mesh validity and quality without user interaction where the performance will be quantified by speed, accuracy, robustness, and stability131.

7.1 Type of Mesh Motion Several deforming mesh algorithms have been presented in literature, with various approaches to defining mesh motion. The most popular method to date is the spring analogy132. Here, all point-topoint connections within the mesh are replaced by linear springs and point motion is obtained as a response to boundary displacement. However, this approach proved to lack robustness, particularly for arbitrarily unstructured (polyhedral) meshes. A review of merits and limitations of the spring analogy and its variants is given by [Blom]133. Other approaches to creating a robust mesh motion solver include the use of Laplacian smoothing 134 with the constant and variable diffusivity and the Pseudo-Solid Equation (static equilibrium equation for small deformations of a linear elastic solid)135 in Arbitrary Lagrangian-Eulerian (ALE) codes. In an effort to simultaneously control the position of

Hrvoje Jasak, ˇZeljko Tukovi´c, “Automatic Mesh Motion for the Unstructured Finite Volume Method”, ISSN 1333–1124, UDK 532.5:519.6. 130 Tao Tang, “Moving Mesh Methods for Computational Fluid Dynamics”, Contemporary Mathematics, 1991. 131 Hrvoje Jasak, ˇZeljko Tukovi´c, “Automatic Mesh Motion for the Unstructured Finite Volume Method”, ISSN 1333–1124, UDK 532.5:519.6. 132 Batina, J. T., “Unsteady Euler airfoil solutions using unstructured dynamic meshes”, AIAA Journal 28 (8) (1990), pp. 1381–1388. 133 Blom, F. J., “Considertions on the spring analogy, International journal for numerical methods in fluids”, (2000). 134 L¨ohner, R., Yang, C., “Improved ALE mesh velocities for moving bodies”, Communications in numerical methods in engineering 12 (1996), pp. 599–608. 135 Johnson, A. A., Tezduyar, T. E., “Mesh update strategies in parallel finite element computations of flow problems with moving boundaries and interfaces”, Computer methods in applied mechanics and engineering 119 (1994). 129

89

moving boundary and mesh spacing next to it, [Helenbrook]136 proposes the use of a bi-harmonic equation to govern mesh motion. Other methods includes Dynamic-Overset meshing, dynamic remeshing using Radial-Basis Functions (RBF), Delaunay Method and mesh motion and dynamic remeshing using a generalized grid interface (GGI)137. The Radial Basis Function (RBF) method and Delaunay Method which have been used widely in fluid-structure interaction. An analysis of dynamic-meshing techniques was one by quantifying the accuracy, robustness, stability, and speed of each one and while dynamic re-meshing via solution of a Laplace equation was robust and GGI was the fastest, Overset meshing was found to be the most stable and the most general technique for complex geometries and motions138. RBF proved to be too computationally expensive and unrealistic for 3D problem.

7.2 Mesh Deformation

The mesh deformation problem can be stated as follows. Let D represent a domain configuration at a given time t with its bounding surface B and a valid computational mesh, as shown in Figure 7.1. During a time interval Δt, D changes shape into a new configuration D′. A mapping between D and D′ is sought in such a way that the mesh on D forms a valid mesh on D′ with a minimal distortion of control volumes. In this study, the displacement vector u is chosen as the dependent variable in the mesh motion problem. Thus, the point position in the deformed configuration is calculated as r´ = r + u where r ∈ D and r′ ∈ D′ are point position vectors.

Figure 7.1

Mesh Deformation Problem

7.3 Finite Volume in Dynamic Mesh With respect to dynamic meshes, we start with scalar transport equation as:

Helenbrook, B. T., “Mesh deformation using the bi-harmonic operator”, International journal for numerical methods in engineering 56 (2003), pp. 1007–1021. 137 OpenFOAM ®. 138 Hrvoje Jasak, ˇZeljko Tukovi´c, “Automatic Mesh Motion for the Unstructured Finite Volume Method”, ISSN 1333–1124, UDK 532.5:519.6. 136

90

∂ ∂ ∂ ∂φ (ρφ) + (ρuj φ) = (Γφ ) + S⏟ φ ⏟ ∂t ∂x ∂x ∂x j ⏟j ⏟j Source Transient ⏟ Convection Diffusion Transport

Eq. 7.1 Where ϕ is the general scalar quantity, ρ is the fluid density, and u i is the flow velocity vector. Furthermore, Γ is the diffusion coefficient and S is the source term. After integrating over a Control Volume and applying the divergence theorem, we obtain the integral form

     Γ Q    S  dV  0     ρ    . ρ u    .  j  t  x   j  V     t ρ   dV  A ρ u j  . dA  A Γ  . dA  V S dV V

Eq. 7.2

d ρ   dV   ρ (u i  u g ) . dA   Γ  . dA   S dV dt V A A V Here, ug is the grid velocity of the moving mesh, and A is used to represent the boundary of the control volume V. The unsteady term (first term) could be written as

d (ρV) n 1  (ρV) n ρ dV  dt v Δt

 V n 1  V n 

dV Δt dt

Eq. 7.3

Where dV/dt is the volume time derivative of the control volume. In order to satisfy the grid conservation law, the volume time derivative of the control volume is computed from Face Face δV dV j   u g .dA   u gj.A j   dt V Δt j j

Eq. 7.4

With δVj is the volume swept out by the control volume face j over the time step Δt. In the case of the sliding mesh, the motion of moving zones is tracked relative to the stationary frame. Therefore, no moving reference frames are attached to the computational domain, simplifying the flux transfers across the interfaces139. In the sliding mesh formulation, the control volume remains constant, therefore, dV/dt = 0 and Vn+1 = Vn





d (ρ ) n 1  (ρ ) n V ρ  dV  dt v Δt

139

FLUENT 6.3 User’s Guide.

Eq. 7.5

91

7.4 Dynamic Mesh Techniques Laplacian Mesh Morphing A computationally robust dynamic-mesh technique used in CFD is Laplacian Mesh morphing, which solves a Laplace equation to move the mesh. [Bos]140 used this method along with solid body rotation stress to compare with radial basis function interpolation while studying insect flight. [Bos] found that the Laplace equation method was not able to maintain high mesh quality around the boundary of a rectangle when it rotates, shown in Figure 7.2-(a). The cell skewness in the domain is highest near the body, while the remaining mesh is relatively unaltered. However, the method remained quite robust even with the complex geometry and high amplitude mesh motion. The mathematical representation for mesh motion via solution of a Laplace equation is

.(ku i,mesh )  0

,

k

1 l2

Eq. 7.6

Where ui,mesh is the velocity of points in the mesh and k is a distance function that minimizes the mesh distortion, and l is the distance to the moving boundary. The body is rotated or transformed in some manner described by the user and the points on the body are moved based on a coordinate transformation. The points surrounding the body are moved based on the Laplace equation above. There is a modest amount of error introduced before the cells surrounding the body are moved141. Pseudo-Solid Equation While the Laplace equation only allows direction-decoupled transfinite mapping, the pseudo-solid equation also allows rotation. However, this comes at a relatively high price: the pseudo-solid equation couples the components of the motion vector due to rotation. The choice here is either an increase in storage associated with the block solution of all displacement components or an iterative segregated solution method.

[.μu  μ(u)T  λtr(u)I]  0

Eq. 7.7

7.4.2.1 Case Study – Motion of a Cylinder142 The case consists of a circle moving in a channel in 2D. An identical setup and a triangular mesh has been used by [Baker]143 with the pseudo-solid equation, and [Helenbrook]144 on the bi-harmonic equation. A polygonal mesh used for the test, where D is the cylinder diameter, the height of the channel is 2D and average mesh size is 0.15D. The first test consists of the determination of the maximum displacement of the cylinder in one step without mesh inversion when the outside boundary remains fixed. Mesh quality is determined in terms of the non-orthogonality angle αf. For reference, on the initial polygonal mesh αf,max = 18.45◦ and αf,mean = 0.34◦. The deformed meshes obtained using the Laplace and Pseudo-Solid mesh motion equations for one step maximum cylinder Frank Martijn BOS, “Numerical simulations of flapping foil and wing aerodynamics”, PhD thesis, 2009. Gina M. Casadei, “Dynamic-Mesh Techniques for Unsteady Multiphase Surface-Ship Hydrodynamics”, A Thesis in Mechanical Engineering, Pennsylvania State University, December 2010. 142 Hrvoje Jasak, ˇZeljko Tukovi´c, “Automatic Mesh Motion for the Unstructured Finite Volume Method”, ISSN 1333–1124, UDK 532.5:519.6. 143 Baker, T. J., Mesh modification for solution adaptation and time evolving domains, 7th International Conference on Numerical Grid Generation in Computational Field Simulations, Whistler, British Columbia, Canada, 2000. 144 Helenbrook, B. T., Mesh deformation using the biharmonic operator, International journal for numerical methods in engineering 56 (2003), pp. 1007–1021. 140 141

92

displacement are shown in Figure 7.2 (a-b). Maximum achievable single-step cylinder displacement is Δmax = 0.636D for the Laplace equation and Δmax = 0.995D for the pseudo-solid equation. In transient simulations, the mesh is moved in a number of time-steps. This situation will be examined by repeating the above test, but with the prescribed cylinder motion of 0.15D per timestep until the mesh becomes invalid. This equates to the effective Courant number of unity, based on the boundary motion velocity. Figure 7.2 (c-d) shows that this approach allows a considerably higher deformation, because it handles the inherent non-linearity of the mesh motion problem. It is interesting to notice that the Laplace and pseudo-solid equations allow the same cylinder displacement Δmax = 1.2D, contrary to the previous test. On the other hand, the increased cost of solving the pseudo-solid equation compared to the Laplace equation does not seem to be justified with the higher allowed single-step mesh deformation145.

Figure 7.2

Cylinder Motion in 2D

Radial Basis Function146 A common problem in CFD is maintaining high mesh quality during large transformations and rotations, as shown in the Laplace equation method as described before. One mesh technique that can handle large mesh deformations is based on the interpolation of Radial Basis Functions (RBF). This technique can offer superior mesh motion in terms of mesh quality on average but can be computationally expensive. It is critical when using RBF that the mesh quality remains high. If the worst mesh quality is too low, the simulation will diverge. However, if the mesh quality remains high, Tukovi´c, ˇZ. “Finite volume method on domains of varying shape (in Croatian)”, Ph.D. thesis, Faculty of mechanical engineering and naval architecture, University of Zagreb, 2005. 146 Gina M. Casadei, “Dynamic-Mesh Techniques for Unsteady Multiphase Surface-Ship Hydrodynamics”, A Thesis in Mechanical Engineering, Pennsylvania State University, December 2010. 145

93

the simulation will remain stable, accurate and efficient. Bos 147 studied the wing performance for flapping wings of insects at small scales. The RBF method can handle this motion by interpolating the displaced boundary nodes on the surrounding mesh. Bos also studied the difference between using the Laplace equation with variable diffusivity, solid body rotation stress equation and RBF. The skewness and non-orthogonality values were compared for all cases and the RBF showed higher mesh quality for both skewness and non-orthogonality.

Figure 7.3

Mesh Deformation Via Laplace & RBF Methods

Figure 7.3-(b) clearly displays that the RBF deforms around the rotating rectangle, unlike the Laplacian mesh motion (Figure 7.3-(a)) which has highly skewed cells around the rectangle. The high mesh quality is more preserved in regards to RBF. However, RBF requires much more computational effort between iterations during the mesh update scheme, which is a huge downfall to this method. The interpolation function s(x) as defined below describes the displacement of all computational mesh points by summing a set of basis functions: Nb





s(x)   γ j x  x b j  q(x) j1

where x b j  [ x b j , y b j , z b j ]

Eq. 7.8

are boundary value displacemen t

Furthermore, q is a polynomial, Nb is the number of boundary points, ϕ is a given basis function as a function of the Euclidean distance x. One of the first steps in solving equation is to evaluate the interpolation function s(x) in the known boundary points in equation, s(xbj) = Δxbj where Δxbj contains the known discrete values of the boundary point displacements.

147

Frank Martijn BOS. Numerical simulations of flapping foil and wing aerodynamics. PhD thesis, 2009.

94

Generalized Grid Interface The Generalized Grid Interface (GGI) refers to a grid on either side of two connected surfaces, where the grid connectors do not have to match. GGI connections allow non-matching of nodes which can be beneficial for many reasons. The main advantage to this meshing technique is that it does not have to adapt the topology of the mesh at the interface between two non-conformal meshes. Each of the GGI regions can be different sizes, but cannot have overlap regions. One paper studies the use of a GGI for the application of turbomachinery148. GGI can be described as using weighed interpolation to evaluate and transmit flow values over patches in the mesh. These flow values are controlled from the master patch to the shadow patch through a set of finite volume method discretization reasoning. The downfall to this method is that even with minimal error in the master patch variable, unacceptable discretization error can occur149. The GGI weighting factors relate to the percentage of surface intersection between two overlapping faces. The GGI method uses the Sutherland-Hodgman

Figure 7.4

GGI interface

148 M. Beaudoina and H. Jasak. “Development of a Generalized Grid Interface for Turbomachinery simulations with

OpenFOAM”. Open Source CFD International Conference, 2008. 149 Same as previous.

95

algorithm in OpenFOAM® to compute the master and shadow face intersection surface area. This algorithm must be used with convex polygons only, which could cause problems with complicated geometries where non-convex polygons are present. Inaccuracies can also occur at the border between a rotating and fixed part of the mesh due to possible gaps between the faces. The objective here is to mimic behavior of sliding interface without changing the mesh. (See Figure 7.4). The GGI design rationale with respect to examples like Turbomachinery is: •

Apart from “fully overlapped” cases, turbomachinery meshes contain similar features that should employ identical methodology, but are not quite the same.   

• •

Non-matching cylices for a single rotor passage. Partial overlap for different rotor-stator pitch. Mixing plane to perform averaging instead of coupling directly.

Component coupling requires data manipulation (copy, transform, average). In such cases, the behavior is closer to a coupled boundary condition, but the numeric is similar to sliding interface150.

Overset Methods One method of grid generation that has many advantages is an overset-grid approach. This process involves constructing several blocks that are overlapping, made up of structured or unstructured grids. Partial differential equations are solved on each component and boundary information is then exchanged between these grids based on interpolation151. The unused grid points are cut from the solution known as hole points. The points that are overlapped between grids are known as fringe points. The interpolation points are identified as the points that interpolate between the overlapped grids to obtain a solution152. Figure 7.5-(a) shows an example of a boundary layer grid and a background grid. Figure 7.5-(b-c) displays an overset grid arrangement showing hole, interpolated and active points correlates for a ship motions using dynamic overset grids153. This method uses rigid overset grids that move with relative motion at large amplitude motions. The code Suggar is used to obtain interpolation coefficients between the grids at each time step that the grid is moved. The overset grid comparison with experimental data for sink age, trim, and resistance showed good comparison proving that this meshing technique allows accurate computations of ship flows in motion.

Hrvoje Jasak, “General Grid Interface Theoretical Basis and Implementation”, Wikki Ltd, United Kingdom. S.E. Sherer and J.N. Scott. “High-order compact finite-difference methods on general overset grids”. Journal of Computational Physics, 210(2):459–496, 2005. 152 P.M. Carrica, R.V. Wilson, R.W. Noack, and F. Stern, “Ship motions using single phase level set with dynamic overset grids”, Computers and Fluids, 36(9):1415–1433, 2007. 153 See previous. 150 151

96

(b) Overset Mesh Motion with no rotation

(a) Initial Overset mesh

(c) Overset Mesh Motion with 45°Rotation

Figure 7.5

Overset Method

Delaunay Method Delaunay method used in mesh motion divide into four steps: First, we generate the Delaunay graph according to the geometry boundary. The Delaunay criterion is that the circum-circle for triangles or the circum-for tetrahedron should not include other points except the points which construct the triangular or tetrahedron. If the geometry boundary is convex, this mesh can always proceed and unique. Usually, wing surface and far boundary points take as geometry to generate the Delaunay triangular. After the Delaunay triangular generation, all spatial nodes should locate in its Delaunay triangular. For a point p, search the triangular which contain this point and calculate the surface or volume coordinates as

ej 

Sj S

j  1,2,3

ej 

Vj V

j  1,2,3,4

Eq. 7.9

The key step in Delaunay method is moving the Delaunay triangular base on boundary deformation. All the connectivity and vertex index should be kept. If the deformation is too large, triangular deformation may failure. In this case, split the deformation into two shell steps and go back to step 1 regenerating the Delaunay triangular. At last, relocate the spatial node. According to the surface or volume coordinate at step2, turn them into Cartesian at the moved triangular. As equation :

97

4

xp   ei xi i 1

Eq. 7.10

7.4.6.1 Case Study - Airfoil Rotation In this case, NACA 0012 airfoil will rotate about its back edge 30 degrees. All the fluid uses a structure mesh with lowest quality 0.7. The surface girds are quad with 200 nodes and spatial grids are hexahedron with 40325 nodes. Figure 7.6-(a) demonstrates the mesh before deformation. For Delaunay method, first step is generating Delaunay triangular according to geometry boundary as Figure 7.6-(b) displayed. Then, compute the surface coordinates of spatial nodes in Delaunay triangular. After the geometry deformation, the Delaunay triangular will deform as Figure 7.6-(c). By keeping the surface coordinates unchanged, we relocate the spatial nodes in Cartesian coordinates. Figure 7.6-(d) show the mesh after deformation154.

(a) mesh before deformation

(b) initial Delaunay triangular

(c) Delaunay triangular after deformation

(d) dynamic mesh by Delaunay

Figure 7.6

Delaunay Method of Dynamic mesh

Spring Analogy Other technique is the spring analogy, where the mesh nodes are connected through tension springs, where the stiffness is related to the length of the edge. This approach tends to produce highly deformed meshes with collapsed or negative volume and is incapable of reproducing solid body rotation. The tension spring model has been improved by attaching torsion springs to each vertex JIA Huana, SUN Qin b, “A Comparison of Two Dynamic Mesh Methods in Fluid –Structure interaction”, School of Aeronautics, Northwestern Polytechnic University, Xi‘an china. 2nd International Conference on Electronic & Mechanical Engineering and Information Technology (EMEIT-2012). 154

98

where the stiffness is related to the angle. Six Degrees of Ferndom (6 DOF) 7.4.8.1 Transitional Deformation The grid was deformed in the y- and zdirections using a spring analogy technique. The 6DOF solver uses the object's forces and moments in order to compute the translational and angular motion of the center of gravity of an object. The governing equation for the translational motion of the center of gravity is solved for in the inertial coordinate system. As an example, Figure 7.7 shows the mesh after the translational deformation for a wing. The original un-deformed mesh is shown in grey color, and the deformed mesh is shown in red. In this case the tip deformation along the yaxis is 20% of the wing semi-span155.

Figure 7.7

Mesh before and after the translational deformations

7.4.8.2 Rotational Deformation The rotational grid can be obtained by multiplying the original grid with the matrix on R as

 Cθ C ψ C θ Sψ - Sθ  R   S SθCψ - C Sψ S SθSψ  C Cψ S Cθ  C Sθ C ψ  S Sψ C SθSψ  S C ψ C Cθ   

Eq. 7.11

where, in generic terms, CX=Cos(X) and SX=Sin (X) . The angles φ , ϴ, and ψ are Euler angles that represent the following sequence of rotations:  rotation about the x-axis (e.g., roll for airplanes)  rotation about the y-axis (e.g., pitch for airplanes)  rotation about the z-axis (e.g., yaw for airplanes) Figure 7.8 illustrates an transitional (y axis) + rotation about x axis.

Joaquin Ivan Gargoloff, “A Numerical Method For Fully Nonlinear Aero-elastic Analysis”, Dissertation, Submitted to the Office of Graduate Studies of Texas A&M University in partial fulfillment of the requirements for the degree of Doctor of Philosophy, 2007. 155

99

Undeformed

Figure 7.8

Deformed

Mesh before and after the x-axis rotational deformation

100

8 Assessment of Mesh Types It is an old age question. Which is better? Structured or Unstructured meshes? Hexahedra (Polyhedral) vs Tetrahedral? It is a lengthy and heated debate which cannot be fully covered here. The answer may be depends in the case itself. In general, most people dislike unstructured meshes because of lack of direct control over the mesh and they produce more data points and cells than their structured ones, therefore, requiring more CPU. On the other hand, they mostly automated, easier to produce. An example using a backward step in a duct by means of all three types of meshing. The result clearly indicates that polyhedral meshing in superior. Error! eference source not found. displays residual comparison for three cell types. Polyhedral Figure 8.1 Backward facing step in a duct using Polyhedral, Hexahedral and Tetrahedral cells cells got the best results, then hexahedral cells closely second, with tetrahedral counting as third. But be aware that this is a modest highly anisotropic flow, and could not be used as a decisive criteria.

8.1 Structured vs Unstructured A major mesh generation vendor (Pointwise®) argues that Structured Meshing is not going away, mainly due to Control and Quality as the reasons are. Here are several factors they view including: Time and memory You can fill the same volume with fewer hexes than Tets, thereby lowering the cell count and your CFD computation time and memory usage. Structured grids generally have a different topology than unstructured grids, so it is difficult to make a direct cell count comparison. At its simplest, each hexahedron can be decomposed into 5 Tetrahedral that share its edges, giving a 5:1 reduction in cell count for the same flow field resolution. The benefit to reducing cell count becomes very apparent when generating a mesh with a wide variation in resolved length scales; you will use many more Tets than you would Hex cells. Resolution Flow of a fluid will often exhibit strong gradients in one direction with milder gradients in the transverse directions (e.g. boundary layers, shear layers, wakes). In these instances, high quality cells are easily generated on a hex grid with high aspect ratio (on the order of one thousand or more). It is much more difficult to generate accurate CFD solutions on highly stretched tetrahedral. (Plus, not all stretched Tet are equal depending on the maximum included angles.) Alignment CFD solvers converge better and can produce more accurate results when the grid is aligned with the predominant flow direction. Alignment in a structured grid is achieved almost implicitly because grid lines follow the contours of the geometry (as does the flow), whereas there's no such alignment in an unstructured mesh.

101

Definable Normal Application of boundary conditions and turbulence models work well when there is a well-defined computational direction normal to a feature such as a wall or wake. Transverse normal are easily defined in a structured grid. To demonstrate, following example is used. Effect of Cell Topology in Truncation Error In general, structured mesh are more aligned with flow gradient, therefore, producing less truncation errors, as depicted in Figure 8.3156. In contrast, tetra cells, have angle with the flow direction as shown in previously. It is suffice to say that the argument is not as simple as case in 2D here, like so many things in CFD where no clear cut definitions are involved (an art?). While some application like Turbomachinery (with clear flow direction) prefer hex meshes, others depend on tet meshes. Basically it comes down to whom you talking and case in hand. While unstructured meshes offer better flexibility for today’s application, then Figure 8.3 Effect of truncation error on Hex and Tet cells lack strict control of structure and overheads of data base. Also the availability of resources should be factor. With advent of Polyhedral cells and their relatively ease of use some vendors such as CD-Adapco© and others are keen to pursue their use (economical concerns?). In fact CD-Adapco© been one of the pioneers of poly cell, argued against the Tet meshing, and for poly meshing, in a blog in titled “Natures answer to Meshing”. That may be true since most of nature is composed of different (patch work) topology. With hummer, it argues that “So how is it that honeybees (average brain size 1g) manage to out mesh those CFD engineers (average brain size 1250g) who still religiously rely on tetrahedral meshing”? With exception of course. (See the smart bee in Figure 8.2)157. But seriously, the case for/or against structures vs unstructured meshes with particular attention to Poly versus Tet cells are argued in two folds as discussed Figure 8.2 Average bees being smarter than below. CFD engineer?

Sideroff, C,. “Multi-Block Structured Meshing and Pre-Processing for OpenFOAM Turbomachinery Analysis”, PointWise. 157 Stephen Ferguson, CD-Adapco Blog, “Nature’s Answer to Meshing”, 2013. 156

102

Case Study – Flow through Pipe with 90 degree Bend These last two items are why boundary layers are best modeled in an unstructured mesh with prism layers as they provide structure in the direction away from the wall. Further, another parametric study done by (Fluent®) as turbulent flow over a pipe with 90 degree bend and Reynolds number of ReD = 43000 and turbulent model of Realizable k-ε158. Axial velocity contour are compared at the 90 degree bend. The result show difference in 90 degree bend, as shown in Figure 8.4. It is clearly demonstrates the advantage of Hex cell over Tet in this example. (See Figure 8.5). This also indicates a good agreement with experimental data using the hybrid mesh (Tet + Prism). As you clearly see the argument about which mesh to use is far from over and depending to whom you talking. It appears that case against the Tet cells is relatively straight, but Poly cells and Hybrid meshing is still debatable. With most vendors, have capability of offering both structured as well as unstructured meshes at will and table below displays the type of meshing available.

Figure 8.4

158

Comparison of Hex (16 K Cells) and Tet (440 K Cells) for a Pipe with 90 Degree Bend

Fluent, “Meshing and CFD Accuracy”, CFD Summit, June 2005.

103

Figure 8.5

Results of Hex vs Tet Meshes as well as Hybrid Mesh in a Pipe with 90 Degree Bend

Polyhedral vs Tetrahedral The argument against the Tet cells versus Poly cells are relatively straight forward. Beside cell the count, a major advantage of polyhedral cells is that they have many neighbors (typically of order 10), so gradients can be much better approximated (using linear shape functions and the information from nearest neighbors) than is the case with tetrahedral cells. Two of the most common methods for gradient calculation are the Green-Gauss and the Least Squares approaches159. Polyhedral cells are also less sensitive to stretching than tetrahedral. Smart grid generation and optimization techniques offer limitless possibilities: cells can automatically be joined, split, or modified by introducing additional points, edges and faces. Indeed, substantial improvements in grid

Figure 8.6

Polyhedral cells vs Tetrahedral cells

Emre Sozer, Christoph Brehm and Cetin C. Kiris, “Gradient Calculation Methods on Arbitrary Polyhedral Unstructured Meshes for Cell-Centered CFD Solvers”, American Institute of Aeronautics and Astronautics. 159

104

quality are expected in the future, benefiting both solver efficiency and accuracy of solutions. Polyhedral cells are especially beneficial for handling recirculating flows. Tests have shown that, for example, in the cubic lid-driven cavity flow, many fewer polyhedral are needed to achieve a specified accuracy than even Cartesian hexahedra (which one would expect to be optimal for rectangular solution domains). In fact for a hexahedral cell, there are three optimal flow directions which lead to the maximum accuracy (normal to each of the three sets of parallel faces); for a polyhedron with 12 faces, there are six optimal directions which, together with the larger number of neighbors, leads to a more accurate solution with a lower cell count. Although tetrahedral are the simplest form of volume elements and tetrahedral meshes are able to approximate any arbitrarily shaped continuum with a remarkable level of detail. Automated tetrahedral mesh generation methods have been well studied and developed, providing currently the only robust solution for meshing complex geometries in 3D, making them a standard choice of major CFD codes. However, despite the fact that tetrahedral present several geometric assets, such as planar faces and well defined face and volume centroids, they suffer from certain disadvantages that make analysts deem them inferior to hexahedra. Tetrahedral elements cannot provide reasonable accuracy, as soon as they become too elongated, which is often the case in boundary layers or sharp corners of the domain. Furthermore, they have only four neighbors making them not an optimal choice for CFD, as computation of gradients at cell centers can become problematic. It is, therefore, not unusual during simulations serious numerical stability issues to appear, additionally to the reduced accuracy, and problematic convergence properties to dominate the analysis. Figure 8.6 indicate the pro and con of Polyhedral cells vs Tetrahedral ones. 8.1.6.1 Boundary Prismatic Cells An issue for general unstructured cells, are boundary cells. Several remedies exist in order to overcome those disadvantages. A boundary layer, formed using prismatic elements along walls, is able to balance, up to a certain degree, the negative effects in accuracy and stability (see Figure 8.7left). Furthermore, advanced discretization methods combined with very fine meshes can result to accurate solutions and good convergence properties. This, however, demands for increased memory usage and computing time, while it makes the analysis code more complicated. Recently, an alternative option to tetrahedral meshes has emerged, suggesting the use of polyhedral elements instead160. Polyhedral over the same level of automatic mesh generation as tetrahedral do, while they are able to overcome the disadvantages adherent to tetrahedral meshes (see Figure 8.7-right). A major advantage of polyhedral occurs from the fact that they are bounded by many neighbors, making approximation of gradients much better that tetrahedral. Furthermore, they are much less sensitive to stretching and, since their typically irregular shape is not a restriction for several CFD codes, they over the possibility of post-processing and optimization without the strict geometric criteria that are necessary for optimizing tetrahedral, or even hexahedral meshes. On the negative side, polyhedral are usually of much more complex geometry than regular volumes, and, depending on the generation method, it cannot always be guaranteed that they are convex, or, even more, that their faces are planar. The topology of polyhedral meshes is, typically, also complex, preventing the implementation of efficient and easy to maintain generation algorithms from being straightforward. As a further consequence, polyhedral meshes require a considerable amount of adjacency relations, in comparison to tetrahedral and hexahedral meshes, making them candidates for resource expensive solutions. All the above set the basis for an interesting field of exploration in volume meshing. Previous studies on the subject have shown promising results, however polyhedral meshing is still far from becoming a standard practice in CFD simulations. Some explanations for this

M. Peric, “Simulation of flows in complex geometries: New meshing and solution methods”, NAFEMS seminar: Simulation of Complex Flows (CFD). 160

105

may be its limited adoption from analysis codes and the fact that polyhedral are not an appropriate solution for every type of analysis. It should be mentioned that, currently, polyhedral meshes attract more attention in fields such as Computer Graphics and Medical Imaging, where in 3D volume rendering is of specific interest. However, the few researches dedicated to exploring polyhedral mesh generation for CFD remain active, making constant progress towards more efficient methods and high quality meshes.

Figure 8.7

Boundary prims cells for tetrahedral (left) and polyhedral (right) cells

8.2 Accuracy Assessment of Gradient Calculation Methods 161

An unstructured mesh, commonly depicted as consisting of tetrahedral elements, can be considered a superset encompassing any valid cell geometry including hexahedral, tetrahedral and arbitrary polyhedral. A survey of gradient reconstruction methods for cell-centered data on unstructured meshes is conducted within the scope of accuracy assessment. Formal order of accuracy, as well as error magnitudes for each of the studied methods, are evaluated on a complex mesh of various cell types through consecutive local scaling of an analytical test function. The tests highlighted several gradient operator choices that can consistently achieve 1st order accuracy regardless of cell type and shape. The tests further offered error comparisons for given cell types, leading to the observation that the “ideal” gradient operator choice is not universal. During implementation of an unstructured solver, a choice about where to place the discrete data must be made. Alternative choices include vertices, face-centers, cell-centers or a combination. While advantages and drawbacks of each

Emre Sozer, Christoph Brehm and Cetin C. Kiris,”Gradient Calculation Methods on Arbitrary Polyhedral Unstructured Meshes for Cell-Centered CFD Solvers”, American Institute of Aeronautics and Astronautics. 161

106

approach have been heavily debated in the CFD community162-163 the current feel is that no clear “best” choice emerges. Gradient operator choice for an unstructured solver has a strong impact on accuracy, efficiency and robustness. While all of these are crucial factors, we limit our scope to the analysis of accuracy alone. Geometric Properties For detail calculation of geometric properties such as Polygonal Face Area and Centroid as well as Polyhedral Volume and Centroid, the reader should refer to Sozer et al164. Literature Survey [Aftosmis, et al.]165 investigated the behavior of linear reconstruction techniques on unstructured meshes. Their chief concern was the behavior of limiters and the effect of element types (triangular vs. Quadrilateral) for CFD solutions, particularly for high aspect ratio or irregular elements. They did however, investigate the least squares (LSQR) and Green-Gauss methods for gradient calculation. The methods behaved similarly for regular meshes whereas the LSQR was found to be more tolerant to mesh distortions. [Mavriplis]166 examined the LSQR procedure for gradient reconstruction, observing that the method produced accurate gradients for isotropic meshes but the accuracy deteriorated for highly stretched meshes in the presence of curvature. In the latter case, they found the Green-Gauss reconstruction method to be more accurate. [Shima, et al.]167 devised an LSQR method where they incorporate weights based on face areas, attempting to inherit benefits of the Green-Gauss method for stretched meshes. While they note accuracy improvements, they still resort to a hybrid approach where Green-Gauss method is used for thin and distorted mesh regions168. A comprehensive survey of unstructured mesh gradient methods, in the context of computer graphics, is conducted by [Correa, et al.]169. They focus on cost and performance in volume rendering with respect to mesh resolution, element shapes, neighborhood size and scalar field complexity. They find the inverse weighted regression method to provide the highest accuracy for irregular meshes and the Green-Gauss method to perform poorly for badly shaped elements. Gradient Calculation The difficulty in calculating gradients in an unstructured mesh stems from the lack of a consistent and inherent connectivity. The stencil for gradient calculation, as well as the corresponding coefficients vary cell-by-cell and are costly to compute. Hence, those are typically pre-computed and stored. Two of the most common methods for gradient calculation are the Green-Gauss and the Least Squares approaches. Both have several common variations, some of which are explained in the following sections. Diskin, B., Thomas, J., Nielsen, E., Nishiwaka, H., and White, J., “Comparison of Node-Centered and CellCentered Unstructured Finite-Volume Discretization: Viscous Fluxes,” AIAA Journal, Vol. 48, No. 7, 2010. 163 Diskin, B. and Thomas, J. ,“Comparison of Node-Centered and Cell-Centered Unstructured Finite-Volume Discretization: Inviscid Fluxes,” AIAA Journal, Vol. 49, No. 4, 2011, DOI: 10.2514/1.J050897. 164 Emre Sozer, Christoph Brehm and Cetin C. Kiris, “Gradient Calculation Methods on Arbitrary Polyhedral Unstructured Meshes for Cell-Centered CFD Solvers”, American Institute of Aeronautics and Astronautics. 165 Aftosmis, M., Gaitonde, D., and Tavares, T., “Behavior of Linear Reconstruction Techniques on Unstructured Meshes,” AIAA J., vol. 33, no. 11, pp. 2038-2049, 1995. 166 Mavriplis, D., “Revisiting the Least-Squares Procedure for Gradient Reconstruction on Unstructured Meshes,”, AIAA Paper 2003-3986, 2003. 167 Shima, E., Kitamura, K., and Fujimoto, K., “New Gradient Calculation Method for MUSCL Type CFD Schemes in Arbitrary Polyhedra”, 48th AIAA Aerospace Sciences Meeting, Jan 4-7, Orlando, FL, 2010. 168 Shima, E., Kitamura, K., and Haga, T., “Green-Gauss/Weighted-Least-Squares Hybrid Gradient Reconstruction for Arbitrary Polyhedra Unstructured Grids,” AIAA Journal, Vol. 51, No. 11, 2013, DOI: 10.2514/1.J052095. 169 Correa, C., R., H., and K., M., “A Comparison of Gradient Estimation Methods for Volume Rendering on Unstructured Meshes,” IEEE Transactions on Visualization and Computer Graphics, vol. 18, no. 3, March, 2011. 162

107

8.2.3.1 Green-Gauss Gradient Method The Green-Gauss method represents an intuitive, sound basis for gradient calculation. According to the Green-Gauss theorem, average gradient of a scalar φ in a closed volume V can be obtained by

  dV    nˆ dA , V

 

A

1  nˆ dA V  A

Eq. 8.1

Where ň is the surface unit normal vector and A is the surface area. For a 2nd order scheme with midpoint quadrature, the Green-Gauss method takes on the following discrete form for a polyhedral:

1 N faces    f nˆ f A f V f 1

Eq. 8.2

Where Nfaces is the number of faces and φ͞f is the average of the scalar over the face f. Up to this point, average gradient of a linear function at the polyhedral cell centroid. The potential errors are introduced through the particular choice of a face averaging method to obtain φ͞f . Several common alternatives in this regard are discussed below. 8.2.3.2 GG-Simple Face Averaging Simple average of the cell center values at the left and right sides of the face is taken as the face center value (see Figure 8.8).

f 

Figure 8.8

c-left  c-right 2

GG simple face averaging

Eq. 8.3

As the most basic approach, the simple averaging method is still commonly used due to its attractive properties of straightforward and cheap implementation. In fact, its usage is usually implied when cell-centered Green-Gauss gradient method is referred to without mention of the associated face averaging method. 8.2.3.3 GG-Inverse Distance Weighted (IDW) Face Interpolation Another popular approach to face averaging, IDW method utilizes the entire neighbor stencil around face f (see Figure 8.9). The result show difference in 90 degree bend, as shown in Figure 8.4. It is clearly demonstrates the advantage of Hex cell over Tet in this example.. This also indicates a good agreement with experimental data using the hybrid mesh (Tet + Prism). As you clearly see the argument about which mesh to use is far from over and depending to whom you talking. It appears that case against the Tet cells is relatively straight, but Poly cells and Hybrid meshing is still debatable. With most vendors, have capability of offering both structured as well as unstructured meshes at will and table below displays the type of meshing available. Where the sum is carried out over the entire stencil and di = ri −rf represents the distance between the stencil point and the current face center. IDW has shortcomings when the neighboring cell centers are not evenly distributed around the face but clustered in certain directions; a scenario likely to occur for regions with poor

108

grid quality or at the interfaces of different cell types in mixed cell type meshes. In addition to this non-isotropy, potentially large discrepancies in stencil distances may occur for regions with poor grid quality or at the interfaces of different cell types in mixed cell type meshes. In addition to this non-isotropy, potentially large discrepancies in stencil distances may skew the weights significantly, a phenomena made worse by the usage of squared distances. Nonetheless, the squared weighting seems to be the most common approach taken with IDW and hence we chose to adopt it for our evaluation. Variations of this method involving different weightings (e.g. volume, inverse distance…) are possible but this does not change the fundamental flaws explained above. Other methodologies considered are:    

Figure 8.9

GG Inverse Distance Weighted (IDW) Face Interpolation

GG-Weighted Least Squares (LSQR) Face Interpolation GG-Weighted Tri-Linear Face Interpolation (WTLI) Least Squares (LSQR) Gradient Method Curvilinear Gradient Method

Detailed information regarding these methods and more are available in170. N

f 

i

d i 1 N

Eq. 8.4

1

d i 1

2 i

2 i

Visual Inspection The gradient order of accuracy (GOA) for various aforementioned methodologies are presented in Figure 8.10 (a-f) for x-coordinates. Note that for a 2nd order scheme, a gradient operator of at least order 1 is needed. Figure (a) shows the distribution of GOA for the LSQR scheme with compact stencil. The operator is able to produce at least 1st order accuracy in the entire field. The cells with a uniformly spaced stencil that are aligned with x or y directions exhibit 2 nd order accuracy in the corresponding directions. This is due to perfect cancellation of 1st order errors and it breaks down as soon as mesh uniformity is lost. The cancellation leading to the increased order now needs to be satisfied in a wider stencil. The Green-Gauss method with Simple averaging as well as IDW fails to achieve 1st order accuracy as seen in Figure 8.10 (b-c) respectively. Both of these methods neglect to incorporate directionality of their stencils and neither is linear-exact, i.e. can’t reproduce gradient Emre Sozer, Christoph Brehm and Cetin C. Kiris, “Gradient Calculation Methods on Arbitrary Polyhedral Unstructured Meshes for Cell-Centered CFD Solvers”, American Institute of Aeronautics and Astronautics. 170

109

of a linear function exactly. The WTLI and LSQR face interpolation methods for the Green-Gauss gradient yields very similar results (see Figure 8.10 (d-e)). The curvilinear gradient results, as shown in Figure 8.10 (f), are much like those of the LSQR with compact stencil. This is not surprising as both methods are linear-exact and both utilize compact stencils. Note that the curvilinear gradient operator has the most compact stencil of the alternative methods in scope here, utilizing at most 4 points (for 2D).

(a) LSQR (b) GG Simple

(c) GG IDW

(d) GG WTLI

(e) GG LSQR

(f) Curvlinear

Figure 8.10

Methodologies for various Gradient Order of Accuracy

Results Based on L2 Norm While order of accuracy is a crucial property to inspect, it is pertinent to look at the actual error levels as several of the gradient operator choices were demonstrated to satisfy 1st order accuracy. Figure 8.11 shows L2 error norms with respect to the refinement level. First we would like to clear the

110

peculiar behavior of the Green-Gauss method with simple and IDW face averaging. It seem to approach a 1st order convergence rate before stalling at a fixed error level. This is due to the aforementioned inconsistency as they converge, in a 1st order manner, to a gradient value that is not consistent with the exact value. Note here that without a deep enough L2 Norm (vertical) vs Refinement level convergence study, this issue could have been overlooked, leading to a false conclusion that these methods are 1st order accurate. The rest of the operators are all linearGlobal L2 norm for exact, and consequently x-direction vs they all consistently exhibit various gradient method 1st order accuracy as it was apparent from the GOA distributions shown earlier on the test mesh. The error norms shown in Figure 8.11 now reveal that the Green-Gauss methods (with WTLI or LSQR face averaging) yield significantly larger errors Figure 8.11 Global error norms for x-direction gradient for various compared to the curvilinear gradient methods or the LSQR methods. Within the latter group, the LSQR compact has slightly lower error then the LSQR extended while the curvilinear method places in between. It is possible to inspect errors for individual cells of various cell types. For regular cell types (square, equilateral triangle and right triangle), all the gradient operators are able to produce at least 1st order accuracy. In fact, the square cell type stencil yields 2nd order accuracy for each method. The curvilinear method produces a notably smaller error for this case. For irregular stencils, which are of greater practical interest, we start observing the familiar result of convergence stalling for the inconsistent schemes, namely the Green-Gauss method with simple or IDW face averaging. Discarding the special case of the square stencil, the LSQR gradient operator consistently produces the lowest errors except for the cases of thin triangles and thin quadrilaterals (commonly encountered in boundary layer regions of CFD meshes). For the thin cells, the trend reverses and the LSQR method yields the largest errors while the consistent Green-Gauss methods perform the best. Note that the thin cells mentioned here were sampled near the curved boundary region of the test mesh. Whereas the Green-Gauss method exhibited mediocre performance elsewhere, its favorable behavior in the crucial boundary layer type meshes demonstrates its appeal. The errors associated with the curvilinear method were erratic, yielding the best result for the square cells and placing among the lower error range elsewhere with two exceptions; the thin quadrilateral and the arbitrary polyhedral where it exhibited the largest errors. This suggests that a smarter logic for stencil reduction (in 2D, down-selection of 4 stencil points) needs to be developed. Otherwise, we consider this method promising, considering that it has the most compact stencil, hence the lowest computational cost.

111

Concluding Remarks A detailed accuracy study of gradient calculation methods for cell-centered unstructured data is presented. Necessity of the linear-exactness property for 1st order gradient accuracy, and consequently a 2nd order scheme, is emphasized. A straightforward, yet novel, approach utilizing local curvilinear transformation is proposed. The curvilinear method offers the most compact gradient stencil among those studied here. No clear “best” method emerged but strengths and shortcomings of the investigated methodologies for different cell types are exposed. Gradient operators with compact stencils, namely LSQR compact and curvilinear, generally exhibited lower errors. LSQR compact scheme caused stability issues for the solution of the inviscid standing vortex problem on the random triangulated mesh. The curvilinear scheme, on the other hand, had an erratic behavior for different cell types, yielding overall low error levels but exhibiting a large error for a sample arbitrary polyhedral cell. This suggests that the method could benefit from development of a smarter stencil reduction logic (to down-select 4 points from the available stencil in 2D). The Green-Gauss method stood out with lower errors for thin triangular or quadrilateral cell types, such as those found in typical boundary layer meshes, which is it is a very attractive quality for CFD solvers.

112

9 Mesh Sensitivity and Mesh Independence Study Although mesh sensitivity, in our opinion, could be grouped as one of mesh quality criteria, it is still debatable a, so we leave it as such. But more importantly what is the difference between mesh sensitivity and mesh independence? Very little. Although some argue that grid sensitivity is a real (measured quantity) while grid independence is merely a mist and cannot be truly achieved. So it dependence who is your audience. Here we homage first mesh sensitivity than mesh independence study.

9.1 Mesh Sensitivity via Direct Differentiation (DD) Several methods concerning the derivation of mesh sensitivity equations are currently available. Among the most frequently mentioned are :     

Direct (Analytical) Differentiation (DD), Adjoin Variable (AV), Symbolic Differentiation (SD), Automatic Differentiation (AD), ( e.g. Odyssée or ADIFOR) Finite Difference (FD), (Brute Force)

Each technique has its own unique characteristics. For example, the Direct Differentiation, used here, has the advantage of being exact, due to direct differentiation of governing equations with respect to design parameters, but limited in scope. The general equations can be written as Where R is the residual vector, X mesh vector, and P is the meshing parameters. This results in a large system of linear equations in delta form at each time step as for a steady-state solution (i.e., t → ∞) reduces to

𝐑( 𝐗 (𝐏), 𝐏) = 0 Eq. 9.1 Where the explicit dependency of R on grid and vector of parameters P is evident. The parameters P control the grid X. Using chain rule of differentiation

∂𝐑 ∂𝐗 ∂𝐑 [ ][ ] + [ ] = 0 ∂𝐗 ∂𝐏 ∂𝐏

Eq. 9.2 Further simplification could include the vector of grid sensitivity which is

 X   X   XB       P   XB   P  Eq. 9.3 Where XB denotes the boundary nodes171. Surface Modeling Using NURBS Among many ideas proposed for generating any arbitrary surface, the approximate techniques of using spline functions are gaining a wide range of popularity. The most commonly used approximate representation is the Non-uniform Rational B-Spline (NURBS) function. They provide a powerful 171 Sadrehaghighi, I., Smith, R.E., Tiwari, S., N., “Grid Sensitivity and Aerodynamic Optimization Of Generic Airfoils”,

Journal of Aircraft, Volume 32, No. 6, Pages 1234-1239.

113

geometric tool for representing both analytic shapes (conics, quadrics, surfaces of revolution, etc.) and free-form surfaces172; or occasionally called Free From Deformations (FFD). The surface is influenced by a set of control points and weights to where unlike interpolating schemes the control points might not be at the surface itself. By changing the control points and corresponding weights, the designer can influence the surface with a great degree of flexibility without compromising the accuracy of the design. The relation for a NURBS curve is n

X (r)   R i,p (r) Di

i  0,........., n

i 0

R i,p (r) 

N i,p (r) ωi n

N i 0

i, p

(r) ωi

Eq. 9.4 where X (r) is the vector surface coordinate in the r-direction, Di are the control points (forming a control polygon), ωi are weights, Ni,p (r) are the p-th degree B-Spline basis function, and Ri,p(r) are known as the Rational basis functions set n

∑ R i,p (r) = 1 , R i,p (r) ≥ 0 i=1

Eq. 9.5 Figure 9.1 represents a six control point representation of a generic airfoil. The points at the leading and trailing edges are fixed. Two control points at the 0% chord are used to affect the bluntness of the section. Similar procedure can be applied to other airfoil geometries such as NACA four or five digit series. Another example Figure 9.2 shows two airfoils NACA0012 and RAE2822 parameterized using BFigure 9.1 Six Control Point Representation of a Generic Airfoil Spline curve of order 4 with control points. The choice for number of control points and their locations are best determined using an inverse B-Spline interpolation of the initial data. The algorithm yields a system of linear equations with a positive and banded coefficient matrix.

Figure 9.2

B-Spline Approximation of NACA0012 (left) and RAE2822 (right) Airfoils

Tiller, W., “Rational B-Splines for Curve and Surface Representation," Computer Graphics and Applications, Volume 3, N0. 10, September 1983. 172

114

Therefore, it can be solved safely using techniques such as Gaussian elimination without pivoting. The procedure can be easily extended to cross-sectional configurations, when critical cross-sections are denoted by several circular conic sections, and the intermediate surfaces have been generated using linear interpolation. Increasing the weights would deform the circular segments to other conic segments (elliptic, parabolic, etc.) as desired for different flight regions. In this manner, the number of design parameters can be kept to a minimum, which is an important factor in reducing costs. The practice is effortlessly applicable to 3D for example like the common wing & fuselage as designated in Figure 9.3 [Kenway et al.]173. The choice for number of control points and their locations are best determined using an inverse B-Spline interpolation of the initial data. The algorithm yields a system of linear equations with a positive and banded coefficient matrix. Therefore, it can be solved safely using techniques such as Gaussian elimination without pivoting. The procedure can be easily extended to cross-sectional configurations, when critical cross-sections are denoted by several circular conic sections, and the intermediate surfaces have been generated using linear interpolation. Increasing the weights would deform the circular segments to other conic segments (elliptic, parabolic, etc.) as desired for different flight regions. In this manner, the number of design parameters can be kept to a minimum, which is an important factor in reducing costs. An efficient gradient-based algorithm for aerodynamic shape optimization is presented by [Hicken and Zingg]174 where to integrate geometry parameterization and mesh movement. The generalized B-spline volumes are used to parameterize both the surface and volume mesh. Volume mesh of B-spline control points mimics a coarse mesh where a linear elasticity mesh-movement algorithm is applied directly to this coarse mesh and the fine mesh is regenerated algebraically. Using this approach, mesh-movement time is reduced by two to three orders of magnitude relative to a node-based movement.

Figure 9.3

Free Form Deformation (FFD) for Volume Grid with Control Points (Courtesy of Kenway et al.)

Gaetan K.W. Kenway, Joaquim R. R. A. Martins, and Graeme J. Kennedy, “Aero structural optimization of the Common Research Model configuration”, American Institute of Aeronautics and Astronautics. 174 Jason E. Hickenand, David W. Zingg, “Aerodynamic Optimization Algorithm with Integrated Geometry Parameterization and Mesh Movement”, AIAA Journal Vol. 48, No. 2, February 2010. 173

115

9.1.1.1

Case Study - 2D Study of Airfoil Grid Sensitivity via Direct Differentiation (DD) The structured grid sensitivity of a generic airfoil with respect to design parameters using the NURBS parameterization is discussed. The geometry, as shown in Figure 9.1, has six pre-specified control points. The control points are numbered counterclockwise, starting and ending with control points (0 and 5), assigned to the tail of the airfoil. A total of 18 design parameters (i.e., three design parameters per control point) available for optimization purpose. Depending on desired accuracy and degree of freedom for optimization, the number of design parameters could be reduced for each particular problem. For the present case, such reduction is achieved by considering fixed weights and chord-length. Out of the remaining four control points with two degrees of freedom for each, control points 1 and 5 have been chosen as a case study. The number of design parameters is now reduced to four with XD = {X1; Y1; X5; Y5}T, with initial values specified in Figure 9.1. Non-zero contribution to the surface grid sensitivity coefficients of these control points are the basis functions R1,3(r) and R5,3(r). The sensitivity gradients are restricted only to the region influenced by the elected control point. This locality feature of the NURBS parameterization makes it a desirable tool for complex design and Figure 9.4 Sample Grid and Grid Sensitivity optimization when only a local perturbation of the geometry is warranted. Similar results can be obtained for design control point 5 where the sensitivity gradients are restricted to the lower portion of domain. Figure 9.4 shows C-type dual blocks structured grid and its sensitivity with respect to NURBS input for different design control points.

116

9.2 Adjoint Variable Sensitivity Analysis (AV) Following closely the development in [Luo and Liu]175, in the discipline of aerodynamics, a performance function I is usually dependent on flow solutions w and aerodynamic shape, which is essentially dependent on the geometric parameters x = {x1; · · · ;xN}, and subsequently the grid. The sensitivities of performance function to geometric parameters can be given as

δ𝐈 ∂𝐈 δ𝐰 ∂𝐈 = + δxi ∂𝐰 δxi ∂xi

Eq. 9.6 In the meantime, δw implicitly depends on aerodynamic shape change through the governing flow equations R(w , x) = 0. A similar form as Eq. 9.6 for R can be given as

δ𝐑 ∂𝐑 δ𝐰 ∂𝐑 = + =0 δxi ∂𝐰 δxi ∂xi

Eq. 9.7 By introducing a series of costate variables, Ψ and subtracting the product of ΨT and Eq. 9.6 from Eq. 9.7, we can get

δ𝐈 ∂𝐈 ∂𝐑 δ𝐰 ∂𝐈 ∂𝐑 ={ − ψT + { − ψT } } δxi ⏟∂𝐰 ∂𝐰 δxi ∂𝐱 𝐢 ∂xi 0

Eq. 9.8 The crucial issue of the adjoint method is to eliminate the effects of δw on δI to avoid the calculation of δw due to the change of aerodynamic shape. It can be achieved if the adjoint operator Ψ satisfies the adjoint equations, therefore the first term in Eq. 9.8 is set to zero. Then the sensitivities can be determined by

δ𝐈 ∂𝐈 ∂𝐑 = − ψT δxi ∂xi ∂xi

Eq. 9.9 Once the flow solutions and adjoint solutions are obtained by solving the governing flow equations and the adjoint equations, respectively, the complete sensitivities can be calculated by deforming the aerodynamic shape and thus the grid for each geometric parameter. Considering that the evaluation of an aerodynamic objective function involves perturbing the grid, it is to be expected that the sensitivities of the objective function to the design variables will in some way involve sensitivities of the grid perturbation algorithm. When evaluating the gradient using the discrete adjoint method, these mesh sensitivities are implicitly included in the terms ∂I/∂xi and ∂R/∂xi .176 Table show the pro and cons of different mesh sensitivity routine as envisioned by [Gabriele Luigi Mura]177.

175 Jiaqi Luo, Feng Liu, “Performance Impact Of Manufacturing Tolerances for a Turbine

Blade Using Second Order Sensitivities”, Proceedings of ASME Turbo Expo 2018: Turbomachinery Technical Conference and Exposition, GT2018, June 11-15, 2018, Oslo, Norway. 176 Chad Oldfield, “An Adjoint Method Augmented with Grid Sensitivities for Aerodynamic Optimization”, A thesis submitted in conformity with the requirements for the degree of M.A.Sc. Graduate Department of Aerospace Engineering University of Toronto, 2006. 177 Gabriele Luigi Mura, “ Mesh Sensitivity Investigation in the Discrete Adjoint Framework”, Thesis is submitted to University of Sheffield in partial fulfilment of the requirement for the degree of Doctor of Philosophy, 2017.

117

Method

Pro

Finite Difference

Easy To Implementation

Analytical

No Convergence Issue Low Memory and CPU Requirements

Adjoint Variables

Independent from the 𝑁𝐷𝑉

Automatic Differentiation

Easy to Implement - Largely Automatic

Table 9.1

Cons Prone to Cancellation and Round-off errorCost scales linearly with the 𝑁𝐷𝑉 - Poor accuracy and Consistency The Pre-Processing cost is Proportional to the 𝑁𝐷𝑉 Needs the Solution of a Large Linear System Increase in Memory When Used in Reverse Mode

Pros & Cons of Different Grid Sensitivity Method (NDV = Number of Design Variable)

9.3 Mesh Independence Study To perform a Mesh Independent Study, is fairly straight forward as seen in a compressible flow over a forwarding step size example (see Figure 9.6): 1. Run the initial simulation on your initial mesh and ensure convergence of residual error to 10-4, monitor points are steady, and imbalances below 1%. If not refine the mesh and repeat. 2. Once you have met the convergence criteria above for your first simulation, refine the mesh globally so that you have finer cells throughout the domain. Generally we would aim for around 1.5 times the initial mesh size. Run the simulation and ensure that the residual error drops below 10-4, that the monitor points are steady, and that the imbalances are below 1%. At this point you need to compare the monitor point values from Step 2 against the values from Step 1. If they are the same (within your own allowable tolerance), then the Figure 9.5 Mesh Independence mesh at Step 1 was accurate enough to capture the result. If the value at Step 2 is not within acceptable values of the Step 1 result, then this means that your solution is changing because of your mesh resolution, and hence the solution is not yet independent of the mesh. In this case you will need to move to Step 3. 3. Because your solution is changing with the refinement of mesh, you have not yet achieved a

118

mesh independent solution. You need to refine the mesh more, and repeat the process until you have a solution that is independent of the mesh. You should then always use the smallest mesh that gives you this mesh independent solution (to reduce your simulation run time). Briefly, according to [Ssheshan Pugazhendh], mesh or grid independent solution is a solution that does not vary significantly even when you refine your mesh further. The answer comes through the question that emphasizes the independence of numerical solution from grid structure, also called mesh. In every computational analysis, mesh independence studies, also expressed as mesh convergence, ought to be conducted to sustain credible results. Otherwise, the results that obtained would be considered as skeptical. (see Figure 9.5)

Figure 9.6

Effects of Mesh Density on Solution Domain

119

120

10 10.1

Mesh Quality Background

Make no mistake about it, mesh quality can have a large influence upon the accuracy (and efficiency) of a simulations based on the solution of partial differential equations (PDE)'s. Most argue that your CFD solution is as good as mesh it has. Many factors go into the influence of mesh on accuracy including the type of physics being simulated, details of the solution to the particular simulation, the method of discretization, and geometric mesh properties having to do with spacing, curvature, angles, smoothness, etc,178. The general consensus is that a good quadrilateral mesh would be formed by two families of orthogonal, or at least nearly orthogonal, curves with a smooth gradation between a coarse mesh in the far field and a fine mesh near the boundary. The following provisional definition is accepted as Mesh Quality concerns the characteristics of a mesh that permit a particular numerical PDE simulation to be efficiently performed, with fidelity to the underlying physics, and with the accuracy required for the problem. This description hints at several issues. First, mesh quality depends on the particular calculation which is undertaken and thus changes if a different calculation is performed. Second, a mesh should do no harm, i.e., it should not create difficulties for the simulation. As mesh generation methods evolved to handle complex three dimensional configurations, and the choice of element type broadened to include not just hexahedra but also tetrahedral and prisms, visual inspection of a mesh became much more difficult. The task was aided considerably by the advent of computer workstations with a powerful graphics capability and the development of good graphics software to view CFD solutions. Today, of course, it is often possible to undertake a CFD simulation and view the results on a laptop computer. Despite these developments in computer graphics and visualization software it is almost impossible to check a mesh with several million points around a complete aircraft and decide whether the quality and distribution of the mesh elements is acceptable. Even if this were a feasible option, visual inspection of large meshes is extremely time consuming and is clearly unacceptable in a design environment where a rapid turnaround is essential and numerous design variations must be evaluated in a timely manner.

10.2 Mesh Quality Metric

There is a move towards quantifying the mesh in terms of criteria that can measure the element quality and the gradation in mesh element size in a precise way. At the very least, analyzing the mesh in this way allows one to identify the hot spots and thus decide where a careful visual inspection maybe needed (eye pleasing ?). As this approach develops and gains in sophistication one can envision a time when visual assessment is replaced by a different aesthetic, one based entirely on mathematical criteria. The question of whether a mesh is sufficiently fine to achieve a solution that has a required level of accuracy depends to a large extent on the discretization of the flow equations. If the discretization has a formal order of accuracy O(h) where h is the local mesh width (i.e. the linear extent of a mesh element) one would generally expect that the solution error on a good quality mesh should also scale in the same way. By comparing computed solutions on a sequence of three progressively larger meshes it is possible to check this assumption by exploiting a generalized form of Richardson Extrapolation. Deciding whether mesh convergence has been achieved for a flow field computation over a given configuration and, if not, how fine a mesh one actually needs to achieve specified accuracy is critically important (i.e., discretization error will be dealt in detail). In general,

Patrick M. Knupp, “Remarks on Mesh Quality”, 45 th AIAA Aerospace Sciences Meeting and Exhibit, 7-10 January, 2007, Reno, NV. 178

121

   

Rate of convergence Solution accuracy Grid Independence result CPU time required

Now these days most of grid generation routines have sophisticated software of grid quality which shows the results graphically. Important metrics such as Volume, Orthogonality, Skewness, Stretching, Centroids, etc., are available on most grids generation software. Figure 10.1 shows the mesh quality (Volume, AR, and Stretching) for benchmark test case Turk/Hron.

(a) Volume

(b) Aspect Ratio

(c) Stretching

Figure 10.1

Predicted Mesh Quality (Volume, Aspect Ratio, and Stretch)

122

Mesh Quality from User’s Perspective The importance of a priori indicators of mesh quality is exemplified by NASA’s Stephen Alter179, who defined and demonstrated the utility of his grid quality (GQ) metric that combines both orthogonality and stretching into a single number. Driven by the desire to ensure the accuracy of supersonic flow solutions over blunt bodies computed using a Thin Layer Navier-Stokes (TLNS) solver, he has established criteria for the GQ metric that give him confidence prior to starting a CFD solution. Two aspects of GQ are notable. First, this metric’s reliance on orthogonality is closely coupled to the numerics of the solver where TLNS assumptions break down when the grid lacks orthogonality. Second, use of a global metric aids decision making, or as Thornburg180 wrote, “A local error estimate is of little use.” GQ represents domain expertise where the use of specific criteria within a specific application domain181. Mesh Quality from Researcher’s Perspective Dannenhoffer182 reported on an extensive benchmark study that involved parametric variation of a structured grid’s quality for a 5 degree double-wedge airfoil in Mach 2 inviscid flow at 3 degrees angle of attack. Variations of the mesh included resolution, aspect ratio, clustering, skew, taper, and wiggle (using the Verdict definitions). Dannenhoffer’s main conclusion was very interesting: there was little (if any) correlation between the grid metrics and solution accuracy. This may have been exacerbated by the fact that he found it difficult to change one metric without influencing another (e.g. adding wiggle to the mesh also affected skew) or it may have been due to the specific flow conditions. Dannenhoffer also introduced the concept of grid validity (as opposed to grid quality), which is intended to measure whether the grid conforms to the configuration being modeled (which in practice it sometimes does not). He proposed three types of validity checks: 1. Type 1 checks whether cells have positive volumes and faces that do not intersect each other. 2. Type 2 checks whether interior cell faces match uniquely with one other interior face and whether boundary cell faces lie on the geometry model of the object being meshed. 3. Type 3 checks whether each surface of the geometry model is completely covered by boundary cell faces, whether each hard edge of the geometry is covered by edges of boundary cell faces, and whether the sum of the boundary faces areas matches the actual geometry surface area. Prof. Christopher Roy183 from Virginia Tech showed a counter-intuitive example (at least from the standpoint of a priori metrics) that the solution of 2D Burger’s equation on an adapted mesh (with cells of widely varying skew, aspect ratio, and other metrics) has much less Discretization Error (DE) than the solution on a mesh of perfect squares as seen in Figure 10.2184. From this example alone, it is clear that metrics based solely on cell geometry are not good indicators of mesh quality as it pertains to solution accuracy.

Stephen Alter, “A Structured-Grid Quality Measure”, NASA Langley. Thornburg, Hugh J., “Overview of the PETTT Workshop on Mesh Quality/Resolution, Practice, Current Research, and Future Directions”, AIAA paper no. 2012-0606, Jan. 2012. 181 Another Fine Mesh, Pointwise blog, posted on July 5, 2012 by John Chawner. 182 John Dannehoffer , “On Grid Quality and Validity”, Syracuse University. 183 Christopher Roy, “Discretization Error”, Virginia Tech. 184 A simple demonstration of how a poor mesh from a cell geometry perspective (right) results in lower discretization error than one with “perfect” cells (left). 179 180

123

Figure 10.2

A simple Demonstration of How a Poor Mesh from a Cell Geometry Perspective

Mesh Quality from Solver’s Perspective The common thread among all participating CFD solvers was that convergence and stability are more directly affected by mesh quality than solution accuracy, namely: 10.2.3.1 CFD++ Metacomp Technologies’ Vinit Gupta185 cited cell skewness and cell size variation as two quality issues to be aware of for structured grids. In particular, grid refinement across block boundaries in the far field where gradients are low has a strong, negative impact on convergence. For unstructured and hybrid meshes, anisotropic tets in the boundary layer and the transition from prisms to tets outside the boundary layer also can be problematic. Gupta also pointed out two problems associated with metric computations. Cell volume computations that rely on a decomposition of a cell into tets are not unique and depend on the manner of decomposition. Therefore, volume (or any measure that relies on volume) reported by one program may differ from that reported by another. Similarly, face normal computations for anything but a triangle are not unique and also may differ from program to program. (This is a scenario can be often encountered when there is a disagreement with a solver vendor over a cell’s volume that turns out to be the result of different computation methods.) 10.2.3.2 Fluent and CFX ANSYS’ Konstantine Kourbatski186 showed how cell shapes that differ from perfect (dot product of face normal vector with vector connecting adjacent cell centers) make the system of equations stiffer slowing convergence. He then introduced metrics, Orthogonal Quality and two skewness definitions, with rules of thumb for the Fluent solver. It was interesting to note that the orthogonality measure ranges from 0 (bad) to 1 (good) whereas the skewness metric is directly opposite: 0 is good and 1 is bad. Another example of a metric criterion was that aspect ratios should be kept to less than 5 in the bulk flow. Kourbatski also provided guidelines for the CFX solver. He also pointed out that resolution of critical flow features (e.g. shear layers, shock waves) is vital to an accurate solution and that bad cells in benign flow regions usually do not have a significant effect on the solution. 185 186

Vinit Gupta, “CFD++ Perspective on Mesh Quality”, Metacomp Technologies. Konstantine Kourbataski, “Assessment of Mesh Quality in ANSYS CFD”, ANSYS.

124

10.2.3.3 Kestrel Kestrel, the CFD solver from the CREATE-AV program, was represented by David McDaniel187 from the University of Alabama at Birmingham. At the start, he made two important statements. First, their goal is to “do well with the mesh given to us.” (This is similar to Pointwise’s approach to dealing with CAD geometry – do the absolute best with the geometry provided.) Second, he notes that mixedelement unstructured meshes (their primary type) are terrible according to traditional mesh metrics, despite being known to yield accurate results. This same observation is true for adaptive meshes and meshes distorted by the relative motion of bodies within a mesh (e.g. flaps deflecting, stores dropping). More significantly, McDaniel notes a “scary” interdependence between solver discretization and mesh geometry by recalling Mavriplis’ paper on the drag prediction workshop188 in which two extremely similar meshes yielded vastly different results with multiple solvers. To address mesh quality, Kestrel’s developers have implemented non-dimensional quality metrics that are both local and global and that are consistent in the sense that 0 always means bad and 1 always means good. The metrics important to Kestrel are an area-weighted measure of quad face planarity, an interesting measure of flow alignment with the nearest solid boundary, a least squares gradient that accounts for the orientation and proximity of neighbor cell centroids, smoothness, spacing and isotropy. Differing from Dannenhoffer’s result, McDaniel showed a correlation of mesh quality with solution accuracy with the caution that a well resolved mesh can have poor quality and still produce a good answer. (In other words, more points always is better; see Figure 10.3).

Figure 10.3

Using Kestrel one can Show a Correlation Between Mesh and Solution Quality

10.2.3.4 STAR-CCM+ Alan Mueller’s189 presentation on CD-adapco’s STAR-CCM+ solver began by pointing out that mesh quality begins with CAD geometry quality and manifests as either a low quality surface mesh or an David McDaniel, “Kestrel/CREATE-AV Perspective on Mesh Quality”, University of Alabama at Birmingham. Mavriplis, Dimitri J., “Grid Quality and Resolution Issues from the Drag Prediction Workshop Series”, AIAA paper 2008-930, Jan. 2008. 189 Alan Mueller, “A CD-Adapco Perspective on Mesh Quality”,CD-Adapco. 187 188

125

inaccurate representation of the true shape. This echoes Dannenhoffer’s grid validity idea. After introducing a list of their quality metrics, Mueller makes the following statement, “Results on less than perfect meshes are essentially the same (drag and lift) as on meshes where considerable resources were spent to eliminate the poor cells in the mesh.” Here we note that the objective functions are integrated quantities (drag and lift,) instead of distributed data like pressure profiles. After all, integrated quantities are the type of engineering data we want to get from CFD. This insensitivity of accuracy to mesh quality supports Mueller’s position that poor cell quality is a stability issue. Accordingly, the approach with STAR-CCM+ is to be conservative opt for robustness over accuracy. Specifically, they are looking for metrics that will result in division by zero in the solver. Skewness as it effects diffusion flux and linearization is one such example. 10.2.3.5 Deducing Results 1. CFD solver developers believe mesh quality affects convergence much more than accuracy. Therefore, the solution error due to poor or incomplete convergence cannot be ignored. 2. One researcher was able to show a complete lack of correlation between mesh quality and solution accuracy. It would be valuable to reproduce this result for other solvers and flow conditions. 3. Use as many grid points as possible (Dannenhoffer, McDaniel). In many cases, resolution trumps quality. However, the practical matter of minimizing compute time by using the minimum number of points (what Thornburg called an optimum mesh) means that quality still will be important. 4. A priori metrics are valuable to users as an effective confidence check prior to running the solver. It is important that these metrics account for cell geometry but also the solver’s numerical algorithm. The implication is that metrics are solver-dependent. A further implication is that Dannehoffer’s grid validity checks be implemented. 5. There are numerous quality metrics that can be computed, but they are often computed inconsistently from program to program. Development of a common vocabulary for metrics would aid portability. 6. Interpreting metrics can be difficult because their actual numerical values are non-intuitive and stymie development of domain expertise. A metric vocabulary should account for desired range of result numerical values and the meaning of “bad” and “good.” Some Geometric Properties 10.2.4.1 Aspect ratio Prime example would be the Aspect Ratio for a simplified geometry is shown in Figure 10.1 (b) and defined for tetrahedral cells as the ratio between the maximum edge length l and the minimum cell height h as

ARi 

Max (li ) Min (h i )

Eq. 10.1 Similiarly, for hex and polyhedral cells. 10.2.4.2 Orthogonality The concept of mesh orthogonality relates to how close the angles between adjacent element faces or adjacent element edges are to some optimal angle (for example, 90º for quadrilateral faced elements and 60º for triangular faces elements). The most relevant measure of mesh orthogonality, as defined by the CFX-Solver is illustrated in Figure 10.4. It involves the angle between the vector that joins two mesh (or control volume) nodes (s) and the normal vector for each integration point

126

surface (n) associated with that edge. Significant orthogonality and nonorthogonality are illustrated at ip1 and ip2, respectively. 10.2.4.3 Skewness Skew of triangular elements is calculated by finding the minimum angle between the vector from each node to the opposing mid-side, and the vector between the two adjacent mid-sides at each node of the element as shown in Figure 10.5 (a). The minimum angle found is subtracted from ninety degrees and reported as the element‘s skew. Skew in quads is calculated by finding the minimum angle between two lines joining opposite mid-sides of the element. Ninety degrees minus the minimum angle found is reported as skew of the element. Maximum of 60-70 skewed elements are accepted in most of the solver beyond this limit solver can complain about the skewness of the grid.

Figure 10.4

Concept of Orthogonality in Cells

(a) Skewness in Triangle Figure 10.5

(b) Warpage calculation of a quadrilateral element

Skewness and Warpage

10.2.4.4 Warpage This is the amount by which an element (or in the case of solid elements, an element face) deviates from being planar. Since three points define a plane, this check only applies to quads. The quad is divided into two trias along its diagonal, and the angle between the trias normal is measured as shown in Figure 10.5 (b). The maximum angle found between the planes is the warpage of the element. Warpage in three-dimensional elements is performed in the same fashion on all faces of the element. Warpage of up to five degrees is generally acceptable. 10.2.4.5 Jacobian This measures the deviation of an element from its ideal or "perfect" shape, such as a triangle‘s deviation from equilateral. The Jacobian value ranges from -1.0 to 1.0, where 1.0 represents a perfectly shaped element. As the element becomes more distorted, the Jacobian value approaches zero. A Jacobian value of less than zero represents a concave element, which most analysis codes do not allow. So it is a good practice to keep the Jacobian of the grid greater than zero190. 190

HyperMesh9.0 Manual, Altair Inc.

Figure 10.6

Tetrahedral Volume

127

10.2.4.6 Tetrahedral Volume Since the tetrahedral is the most elementary of volumes, we start with that. Calculates the volumes of a tetrahedron and a parallelepiped which encompasses it with 6 volumes, given four vertices in right hand side order (see Figure 10.6):

VP  AD.(AB  AC)  (x 4  x1 )[(y 2  y1 )  (z 2  z1 )(y3  y1 )]  (y 4  y1 )[(z 2  z1 )  (x 2  x1 )(z 3  z1 )]  (z 4  z1 )[(x 2  x1 )  (y 2  y1 )(x 3  x1 )] Vtet  Eq. 10.2

VP 6

10.2.4.7 Polygonal Face Area and Centroid A polyhedral cell consists of a number of polygonal faces Figure 10.7 Triangulation of a polygon forming a closed volume. The area vector and the centroid location of each face needs to be computed. This can be achieved via triangulation of the polygon around a given point f as shown in Figure 10.7191. A convenient starting location for the point f is the midpoint (simple average of the nodes of the polygon).

1 rf  Nf

Nf

r i 1

i

Eq. 10.3 where Nf denotes number of face nodes and r is the position vector. The area of each of the triangular patches are added to get the area of the polygon face

A tri 

(ri  rf )  (ri 1  rf ) 2

for i  1, N f

Nf

A f   A tri i 1

Eq. 10.4 And rN+1 = r1. Centroid of the face is computed in a similar fashion as:

1 rf  Af

Nf

A tri (rn  rn 1  rf )

i 1

3



Eq. 10.5 Note that the face centroid rf was initially taken as simply the midpoint of the nodes but it is updated at the end of the process. In the case of a planar polygon, this updated location reflects the true centroid of the polygon. However, while not desirable, polygon nodes may be highly no coplanar in practice. This introduces ambiguity to the centroid location as no unique definition exists based solely on the knowledge of the node coordinates. In this case, simply iterating over Eq. 10.4 & Emre Sozer, Christoph Brehm and Cetin C. Kiris,”Gradient Calculation Methods on Arbitrary Polyhedral Unstructured Meshes for Cell-Centered CFD Solvers”, American Institute of Aeronautics and Astronautics. 191

128

Eq. 10.5 until convergence provides a reasonable answer. The triangulated polygonal face, even if non-coplanar, is still attached to each of the vertices defining it as opposed to an approach where one might fit a planar surface to the vertices. This ensures that, once all the faces of a cell is processed, a water-tight control volume is achieved. We note once again that regardless of the aforementioned ambiguity for non-coplanar polygons, consistency can be retained if the cells sharing a face use the same face centroid and area for their reconstruction and flux integration192. Figure 10.8 Tetrahedralization of a polyhedral 10.2.4.8 Polyhedral Volume and Centroid (showing a single face) The volume and the centroid location of a polyhedral cell can be computed via tetrahedralization, basically by extending the logic presented in the previous section to 3D. Figure 10.8 shows a single face of a polyhedral cell and the corresponding tetrahedralization around a midpoint m.

1 rm  Nc

Nc

r i 1

i

1 Vtet  A tri .(rm  rf ) 3

Eq. 10.6 Where Atri and rf for a given face f is obtained previously. This usage of face triangulation around the previously calculated centroid ensures that a consistent volume is obtained. The integrated volume and the centroid of the polyhedral cell is then calculated via summation of the contributions from Nf

Ni

V   Vtet f 1 i 1

,

1 Nf Ni rc   (rf,i  rf,i1  rf  rm )Vtet 4V f 1 i 1

Eq. 10.7 Where Nf is the number of faces, Ni is the number of face nodes193.

10.3 Best Practice for Mesh Generation There is no definite guild lines for meshing per say. It really depends to whom you are talking and application in hand. Therefore, each disciplines have its guide lines. In general, the mesh should exhibit some minimal grid quality as defined by measures of orthogonality (specially at boundaries), relative grid spacing (15% to 20% stretching is considered a maximum value), grid skewness, aspect ratio etc194. Also the maximum spacing should be according to the desired resolution of the physical phenomena. Optimum quality measures for the surface as well as volume grid have been described. To resolve the boundary layer it is required to cluster the grid in the direction normal to the surface with the spacing of the first grid point off the wall to be well within the laminar sub-layer of the Emre Sozer, Christoph Brehm and Cetin C. Kiris,”Gradient Calculation Methods on Arbitrary Polyhedral Unstructured Meshes for Cell-Centered CFD Solvers”, American Institute of Aeronautics and Astronautics. 193 Emre Sozer, Christoph Brehm and Cetin C. Kiris,”Gradient Calculation Methods on Arbitrary Polyhedral Unstructured Meshes for Cell-Centered CFD Solvers”, American Institute of Aeronautics and Astronautics. 194 Abhishek Khare, Ashish Singh, and Kishor Nokam, “Best Practices in Grid Generation for CFD Applications Using HyperMesh”, Member of Technical Staff Computational Research Lab. 192

129

boundary layer. Hexahedra or prisms elements are employed to discretize boundary layers to preserve the accuracy in the wall normal direction for highly stretched viscous grid. In case of turbulent flows, it is recommended that the first point off the wall should exhibit a wall normal dimensionless distance (y+) value of less than 1.0. Geometry Modeling and Geometry Cleanup Object about which flow has to be simulated requires modeling. This generally involves modeling the object geometry with some CAD software package. For doing this approximations and simplifications of the geometry are required to allow an analysis with reasonable effort. Unfortunately, CAD models are developed primarily for manufacturing purposes, and typically include details irrelevant for CFD simulations or omitting key components, such as boundaries to close a domain. While it appears that CAD designers are beginning to take better account of the needs of CAE engineers in their work, it is unlikely that CAD models will be delivered CFD ready for some time yet to come. There can be errors in CAD data in the form of gaps, overlaps, non-physical protrusions. So we need a lot of cleanup of the imported CAD geometry. Geometry cleanup is a time consuming step and it requires some intelligence to decide which feature of geometry has to remove and which feature to retain. Usual practice is to retain the details that matter for simulation and ensure water tight geometry. Computational Domain After importing geometry into grid generator, decisions has to be made about the extent of the finite flow domain which is called computational domain in which the flow has to be simulated. Shape and size of flow computational domain is depends on the geometry and the physics of flow. Since this modeled geometry along with the flow domain are used as an input for the grid generation hence the modeling should takes into account the structure and topology of the grid generation. For external flows, decision of computational domain is based on to replicate the actual physics. Many times this domain is decided by wind tunnel dimensions and the blockage ratio. A ratio of model frontal area to wind tunnel cross sectional area (Blockage ratio) should be less than 5%. In internal flows the flow path recognition is one of the major works for internal flows, specifically for conjugate heat transfer analysis. From the model search the interface between solid and fluid. Choice of Grid The choice of whether to use a structured or an unstructured mesh is problem specific which is discussed in detail before. Some advantages of structured meshes that hold generally over most applications are simplicity, availability of code, and suitability for multigrid and finite difference methods. On the other hand, unstructured meshes conform to the domain more easily and allow element sizes to vary more dramatically. Structured meshes are currently more popular, but unstructured are catching up195. Here some guidelines are listed based on three parameters for choosing between structured and unstructured grid: 1. Complex geometry: Unstructured grid generation is usually much faster than structured one. However, if the geometry is only slightly modified from a previously existing geometry with a structured grid, then structured grid generation can occur very rapidly. For a particular problem structured grid can take say a man weeks to one man month. On the other hand unstructured grid will take a man hour to a few days. 2. Accuracy: For simpler problem such as airfoil (single element) or an isolated wing, structured grids are generally more accurate per unknown than unstructured. However, for Abhishek Khare, Ashish Singh, and Kishor Nokam, “Best Practices in Grid Generation for CFD Applications Using HyperMesh”, Member of Technical Staff Computational Research Lab. 195

130

more complex flows, the adaptively facilitated by an unstructured grid may allow more accurate solutions. 3. Convergence: Structured grid calculations usually take less time than an unstructured grid calculation because, to date, the existing algorithms are more efficient. Surface Meshing Once the water tight geometry is ready, it is time to create surface mesh on the model surfaces to ensure good quality surface and volume mesh. Volume mesh largely depends on the quality of surface mesh e.g. min/max angle, skewness etc. High surface deviation areas should be meshed by dense grid with smooth transition to low surface deviation areas. According to surface mesh requirement, surfaces can be subdivided into parts. All sharp edges and turnings should be assured by clustering for good quality volume mesh generation. For external aerodynamics like aero and auto domains, a hybrid mesh is fast and cost effective. Volume Meshing Once the surface grid is ready, to generate the volume grid, it is good practice to check whether it is forming a closed volume or not. If the surface grid forms a closed volume, volume grid generation can be started. For structured grid we need to do mapping of the corresponding surfaces as per the topology of the domain. In case of the unstructured grid we need to decide some parameters like boundary layer thickness, element growth ratio, Y+ values, which are required for volume grid generation. Most important parameter is the first point distance from the wall. Placement of the first point near to Figure 10.9 General estimation of surface mesh element size the wall depends on the grid resolution required. This is discussed in more detail in next section which is boundary layer grid generation. The second crucial parameter is the stretching ratio (SR). The value of the SR should be taken in such a way, so that the size of the elements varies smoothly in the domain. The recommended value of the SR is around 1.1 to 1.3. Figure 10.9 shows the general estimation of surface mesh element size based on free stream velocity and Y+ value196. This estimation works as well for automobile aerodynamics. Boundary Layer Meshing Successful computations of turbulent flows require some boundary layer consideration during the mesh generation. Since turbulence (through the spatially-varying effective viscosity) plays a dominant role in the transport of mean momentum and other scalars for the majority of complex turbulent flows, one must ascertain that turbulence quantities are properly resolved, if high accuracy is required. Due to the strong interaction of the mean flow and turbulence, the numerical results for turbulent flows tend to be more susceptible to grid dependency than those for laminar flows. To Macro Lanfrit, “Best Practices Guidelines for Handling Automotive External Aerodynamics with Fluent“, Fluent Deutschland GmbH, Birkenweg 14a, 64295 Darmstadt/Germany, 2005. 196

131

resolve the boundary layer it is required to cluster the grid in the direction normal to the surface with the spacing of the first grid point off the wall to be well within the laminar sub-layer of the boundary layer. Hexahedral or prism elements are employed to discretize boundary layers to preserve the accuracy in the wall normal direction for highly stretched viscous grid. In case of turbulent flows, it is recommended that the first point off the wall should exhibit a wall normal dimensionless distance (y+) value of less than 1.0. This avoids the use of wall functions which generally over predicts the viscous drag in comparison to solve to wall approach. In complex geometries, particularly at high Reynolds numbers, the condition y+ < 1 can be rather stringent, requiring an excessive total number of grid points. In this case, the user should consider the use of wall functions, which allow much larger values for y+, at the expense of additional modeling assumptions introduced in the wall-fluxes and wall adjacent centroids. In case of LES simulation there are no computational restrictions on the near-wall mesh spacing. However, for best results, it might be necessary to use very fine near-wall mesh spacing (on the order of Y+)197. Guidelines for Aerodynamics in General Accurate Cl and Cd predictions are the major focusing areas, while dealing with aero aerodynamics. Decision of element size based on local chord length should be the strategy for surface gridding here. A size of 0.1% of local chord length at leading and trailing edge is good enough to resolve the wing flow physics. 2% of reference chord length produces good quality surface mesh near fuselage nose and after body. Approximately 5% of local chord length is fair enough to resolve flow phenomenon along span wise direction. Since Prediction of viscous drag is crucial here, boundary layer resolution plays a vital role in the prediction of Cd values. Y+ is the governing factor for boundary layer meshing. It is preferred that the value of Y+ must be less than 1 to avoid any kind of wall functions in simulation. Start from a coarse mesh to fine, Y+ can be 1, 0.67, 0.44, and 0.3. This may generate from 5 million to 100 million cells depending on other volume meshing parameters. One should be very careful while stretching cells from boundary layer to outer far field domain. Within the boundary layer, it is a good practice to keep first two cells with constant normal spacing. In general the limit of cell volume growth should be less than 1.25. Outside the viscous layer this can be 3 times for unstructured and 1.5 times for structured mesh. Guidelines for Auto Aerodynamics Surface meshing for ground vehicle aerodynamics should resolve both, boundary layer (less extent) and flow separation regimes (greater extent). In auto aerodynamics sector, the geometries and are quite complex and even if it is simpler, then also the flow physics is complex like modeling of under hood aerodynamics, rotating wheel aerodynamics, rear end aerodynamics etc. If we talk about Formula 1 race car, then it is complex from geometry as well as aerodynamics point of view. In ground vehicle aerodynamics (Mach < 0.3), pressure drag dominates over viscous drag (roughly pressure drag is more than 90% of total drag), so the mesh generation effort should be focused on capturing highly separated flows. Generally for surface gridding, element size variation less than 3% of vehicle reference length is acceptable with clustered mesh at corners and geometric turning. More to say, if it is less than or equal to 1%, the quality of mesh is of high standard. These numbers are independent of surface grid topology. Near the stagnant point and separation areas, the clustering must insure a ratio less than 1.5 between maximum and minimum element size. The user should first decide the degree of resolution needed for the simulation. The standard practice is to calculate an average surface element size, by means of viscous layer resolution criteria (y+ values) for near wall modeling. It can also be limit by aspect ratio at the wall. Aspect ratio values may

197

HyperMesh9.0 Manual, Altair Inc.

132

vary from order of 2 to order of 4 depending upon the curvature in the geometry. Based on Ref 198[6] and our experience, choosing a coarse surface mesh will lead to an initial mesh of approx. 2-5 million cells. A medium resolution, which currently is part of the standard approach, will lead to meshes that consist of approx. 5-10 million cells, while a fine resolution will correspond to meshes beyond 10 million cells. The overall mesh largely depends on the complexity of model and volume mesh parameters. Improvement of Grid Quality Since the quality of the grid strongly influence the accuracy of the solution. It is required that the resulting grid should have the elements which are as regular as possible. Also the variation of the elements size should be as smooth as possible. After the grid is generated two procedures can be applied to improve the quality of the unstructured grid, namely Edge Swapping and Grid Smoothing. These procedures do not change the total numbers of the elements inside the grid and most of the commercial grid generators are having these for the grid quality199-200.

Macro Lanfrit, 2005, “Best Practices Guidelines for Handling Automotive External Aerodynamics with Fluent“, Fluent Deutschland GmbH, Birkenweg 14a, 64295 Darmstadt/Germany. 199 Blazek, J, “Computational Fluid Dynamics: Principles and Applications”, Elsevier Science Publication, Oxford, UK, 2005. 200 Sven Perzon, “On blockage effects in wind tunnel - A CFD Study”, SAE - 2001-01-0705, 2001. 198

133

11 Appendix A A.1

Computer Code for a Transfinite Interpolation

This subroutine is based on a transfinite interpolation with a Lagrangian blending function. The following section describes the subroutine arguments. Nomenclature F

:

IL, JL :

Grid position (x, y, or z) Number of grid points in i and j-directions, respectively.

II(i), JJ(j) : This array stores the locations of known grid lines in i- and j-directions, respectively (1 for known grid lines). IS, IE, JS, JE : Starting and ending of region (computational) of interest. IMAX, JMAX : Array dimension Example: Consider surface IV in Figure 11.1. In this case, five grid lines are known: two lines at GH, two lines at GJLN, and one line at NO. The size of the grid is 95 in the I-direction and 50 in the Jdirection. Point G is at (70, 15) and point O is at (95, 25).

134

135

136

137

Figure 11.1

Symmetry plane (XY)