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

## 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

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

## 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

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!

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

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

10

11

Initial Mesh

Initial Solution

12

13

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

Comparison of Cp and Cf

16

17

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

20

WITHOUT OPTIGRID

WITH OPTIGRID

21

22

23

24

25

Initial mesh

Smoothed mesh

26

Initial mesh

Original Mesh

Constant height

Set height

27

Original Mesh

Wall treatment

Original surface

Wall treatment

28

Original surface

Wall treatment

Original surface

Wall treatment

29

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

Mach profile

31

32

Original signal

Original grid

Mach profile

33

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

34

## High-lift LB606b MDD multi-element wing

Initial grid

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

## Boeing 747 Airplane

Input grid

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

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.

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

37