You are on page 1of 38

Mesh Quality: Pacing CFD

Wagdi Habashi NSERC-J. Armand Bombardier Industrial Research Chair of Multidisciplinary CFD McGill University

A Workshop in Honor of Antony Jameson Jamesons 70-year-young B-day Stanford, November 19, 2004

Today Todays state-of-the-art in CFD meshing

Meshing By Guessing

Different Flow Physics Need Different Different Grids

Final optimal grids, for same geometry, at different Re are quite different

Users Cannot Generate Optimal Grids

For the same geometry, the optimum grid is different for different Re and Mach How can the user be asked to generate it?

This Severely Limits the Potential of CFD

Today, CFD still remains, somewhat, more a Qualitative Tool than a Quantitative Tool

CFD: Messing-by-guessing Remains a Culprit


Technology drivers and barriers:
Qualified engineers spend inordinate time to generate grids Mathematicians focus on developing more advanced algorithms that may end up being tested on inappropriate grids Grids are based on solution-second-guessing: user feels feels grid is good A mesh that is good for a flow condition can be shown not to be as good good good for a different condition, for same geometry More grid points = More expensive calculations Mesh independence studies = continuous (blind?) refinement Users of the same code may get slightly different answers if they distribute mesh points differently Codes may not converge on the initial grid No way to guarantee level of precision or cost

Dependence of Results on User and Mesh

The state-of-the-art (or The stay-as-an-art?)

CFD remains somewhat of an ART We mesh, we solve, we get an answer, we use it, without much idea how good (or how bad) it really is

Dependence of Solution on Solver

Initial Solution

Initial Mesh

FEM

FVM

Superimposed

Is See-FD a science based on Color?

In See-FD The Unaware User May Not Get the Answer He Seeks but Only the One He Deserves!

What are the Keys to Mesh-Independence?


The user has to be taken out of the loop
Cannot let user decide where to generate and concentrate points

The solver has to be taken out of the loop


There has to be a reliable error estimator The level of error must be detected automatically The solver type, FDM, FEM, FVM, should be unimportant The solver should become a black box: commercial or proprietary The artificial viscosity type should be unimportant

The CAD system has to be taken out of the loop:


Original CAD always respected during adaptation CAD package should have no effect, CATIA, ProE, UG, etc.

Computer type and cost have to be taken out of the loop:


Best solution for a fixed price, or lowest price for the best solution Platform independence, parallel

Mesh Optimization Strategy in 3D


It is not optimal to base adaptation on gradients (1st derivative) It is better to minimize the difference between the PDE and the DE: i.e. the TE The TE is proportional to the 2nd derivatives The TE is represented by the Hessian of the solution The Hessian matrix provides eigenvectors and eigenvalues that determine directionality and clustering Adapt the grid in order to homogenize the solution error The mesh becomes nearly uniform (Delaunay) in the metric space

3D Truncation Error Estimation, 1


The 2nd derivatives of any scalar gh (say, Mach #) on which one wishes to adapt are computed in the direction of a given unit vector V (any edge), to give a Hessian matrix
2 gh x 2 2 h g H = y x 2 gh zx

emax =

l 2 2g h 8 2
2

h 2g 2 = V T HV V

g I xi xj I d 2 g = x i x j I I d I

2 gh xy 2 gh y 2 2 gh y z

2g h xz 2g h yz 2g h z 2

3D Truncation Error Estimation, 2


The matrix H is modified into a metric, M, to ensure a symmetric positive-definite matrix, by taking the absolute value of its eigenvalues The eigenvalues of M indicate the interpolation error The eigenvectors R of M give the error directionality

M=R R

Since M is a function of the coordinates, the eigenfunctions describe a Riemannian space

3D Error Estimation, 3
The strategy is to modify the mesh so that all edges are equal in the Riemannian metric Equi-distributing the edge lengths in the metric metrics space is equivalent to equi-distributing the error in the physical space, with the length defined as:
1

e( x i x j ) = ( x i x j )T M ( l) ( xi x j ) dl
0

Library of Elements
Structured Mesh Unstructured Mesh Transition Elements

Trilinear Hexahedron (mesh movement only)

Linear Tetrahedron

Linear Prism

Linear Pyramid

Adaptation Maintains (and improves) CAD


OptiMesh is interfaced to most CAD systems (CATIA, UG, ProE, etc.) Adapted nodes on the surface are reprojected onto the original CAD surfaces CAD integrity is thus fully maintained The degree of mesh clustering required to accurately model surface curvature can be controlled by the user, hence not only solution improves through OptiMesh, but also the CAD definition gets better!

Mesh Adaptation Operations


Edge coarsening Edge refinement Edge swapping

Node movement

Remarks:
Node movement is the continuous mechanism that homogenizes the error across the mesh Coarsening, refinement and swapping are binary mechanisms that accelerate adaptation

Mesh Adaptation Sequence


The following sequence defines a cycle (repeated 3-5 times): Geometric node movement on surface (smoothing) Refinement on surface (based on curvature) Swapping on surface (based on curvature) Error-driven global node movement Error-driven global refinement and coarsening Error-driven global swapping Error-driven global node movement

Smoothing Initial CAD

10

Adjusting Normals at Walls

Target Number of Nodes

11

Error Reduction and Control

Single Single Mesh Adaptation Step

Initial Mesh

Initial Solution

Adapted Mesh

12

Convergence of Single Single Adaptation Step

Overall Adaptation Convergence

13

Mesh Control: Reverse Adaptation, Hexas

Mesh Control: Reverse Adaptation, Tetras

14

Mesh Control Parameters


Specified error level - determines mesh density (best solution at lowest cost) Option for a maximum number of nodes or elements (best solution for a fixed price) Minimum/maximum edge lengths - controls clustering Tet aspect ratio - controls clustering and stretching Maximum prisms and hexahedra deformation Limit coarsening on surfaces, to preserve CAD curvature Limit number of inner and outer adaptation iterations

Independence of Solution from Initial Mesh, 2

Without Optimization

With Optimization

15

Independence from Solver: Before/After


Adapted Mesh FEM and FVM Superimposed Adapted Solution Fixed Mesh

Comparison of Cp and Cf

Unadapted Solution

16

Cut through the Bow Shock

Shock slope is proportional to Re

Cut through Boundary Layer

Laminar B/L thickness proportional to Re

17

Adapting on Structured Meshes: Before/After

Adapting for a Scramjet: Before/After

18

The grid is not a problem, if if

With Anisotropy the Grid is never the Problem Rather, the Grid is the Solution

Mesh Adaptation on Boeing 747


6 adaptation cycles Initial mesh: 431,131 nodes, 2,282,840 elements Final mesh: 242,310 nodes, 1,293,740 elements Normal and oblique shocks, vortices, entropy discontinuities are captured Large domains, large edge length variations High aspect ratios Surfaces with high degree of curvature

19

Boeing 747, M=0.88, AoA=4 AoA=4, 6 Adaptations

Boeing 747 Adaptation Animation

20

OptiGrid on a Boeing 747: Before and After

WITHOUT OPTIGRID

WITH OPTIGRID

Boeing, M=0.88, AoA=4 AoA=4, 6 Adaptations

21

Boeing 747, M=0.88, AoA=4 AoA=4, 6 Adaptations

Boeing 747, M=0.88, AoA=4 AoA=4, 6 Adaptations

22

Boeing 747, M=0.88, AoA=4 AoA=4, 6 Adaptations

Nacelle lip details

Summary: Adaptation on a Boeing 747

23

Spanwise Mach for Boeing 747 Before and After Adaptation

Canadian Patrol Frigate: Initial Error

24

Canadian Patrol Frigate: Final Error (9 cycles)

CPF: Solution Evolution on Deck

25

Automatic Error-density Control

Error-density distribution E(x,y,z)

Binarization with Otsus threshold

Initial grid smoothing, NACA0012 wing


Initial mesh

Local mesh densities are conserved during the smoothing

Smoothed mesh

Smoothed mesh with wall treatment

26

Initial grid smoothing, Boeing 737-300 nacelle

Initial mesh

Smoothed mesh, with anisotropic wall treatment

Near-wall Adaptation, 1

Original Mesh

Constant height

Set height

27

Near-wall Adaptation, Nacelle

Original Mesh

Wall treatment

Near-wall Adaptation, Symmetry Plane

Original surface

Wall treatment

28

Near-wall Adaptation, Symmetry Plane Zoom

Original surface

Wall treatment

Near-wall Adaptation, Surface View

Original surface

Wall treatment

29

Dynamic Y+ Adaptation for Turbulent Flows

Dynamic Y+ Adaptation: Flat Plate

30

Capturing Weak Discontinuities and B/L


Filtering noisy solutions pre-processing (convolution) Improves the quality of adaptation starting from a noisy solution OptiMesh weak shocks and boundary layers capturing improvement (deconvolution) Improve the capability to adapt around weak shocks, boundary layers, etc. Reduce the number of Adaptation-Solver cycles Automatic error-density detection

Sample of Noisy Solution, NACA 2821

Mach profile

31

Noise Removal, Shock Example

Before noise removal

After noise removal

Adaptation, with Noise Removed

Before noise removal

After noise removal

32

Shock-filter Effect on Degraded Signal

Original signal

Degraded signal

Restored signal using shock-filter process

Shock-filter Effect on Shock Capturing

Original grid

Mach profile

Adaptation using original solution U0

Adaptation using preprocessed solution U

NACA 0012, AoA=0.8, Mach=0.85

33

Shock-filter for Wake and Boundary Layer

Adaptation using original solution U0

Original grid Adaptation using preprocessed solution U

NACA 0012, AoA=0.8, Mach=0.85

CAD reconstruction, 1

Raw grid

Optional input data

In CAD reconstruction for mesh adaptation; the initial grid is used to generate a suitable CAD for the topology.

Edge detection/ Manual edition

Curves/Surfaces reconstruction

CAD

34

High-lift LB606b MDD multi-element wing

Initial grid

CAD reconstruction with automatic detection of the needed geometric features (sharp edges)

Reconstructed CAD

Boeing 747 Airplane

Input grid

CAD reconstruction with automatic detection of the needed geometric features (used boundary conditions outlines)

Reconstructed CAD

35

CAD reconstruction of a ship, 2

From the deduced edges; CAD splines, parametric surfaces and planar primitives are built. Producing a CAD useable in adaptation.

CAD-based CAD-based Anisotropic mesh adaptation

36

Why Does Anisotropic Adaptation Work?


Newton-Cotes: increase number of sampling points to increase accuracy; an impractical ceiling is quickly reached Gauss-Legendre: sampling points for "exact" integration Much fewer points, much higher precision, often exact The last decade has emphasized algorithms The next few years will also emphasize grid quality Good grids will show little differences between codes Confidence will develop in the solution of CFD-anchored multi-disciplinary problems

Adaptation is CFD CFDs auto-focus video camera

37

Conclusions: Advantages of Mesh Adaptation


Spend much less time generating a grid On the initial grid a large error, end up with a smaller mesh + a smaller error Improved N-S solver efficiency and convergence Improved iterative solver efficiency and convergence Grid convergence studies eliminated Improved flow resolution: target error As a bonus, even CAD surface defects are corrected by geometric metric!

38