least squre gradient

13
i u u l r k

Transcript of least squre gradient

Revisiting the Least-Squares Procedure for

Gradient Reconstruction on Unstructured

Meshes

Dimitri J. Mavriplis

National Institute of Aerospace

144 Research Drive

Hampton, VA 23666

The accuracy of the least-squares technique for gradient reconstruction on unstruc-

tured meshes is examined. While least-squares techniques produce accurate results on

arbitrary isotropic unstructured meshes, serious di�culties exist for highly stretched

meshes in the presence of surface curvature. In these situations, gradients are typi-

cally under-estimated by up to an order of magnitude. For vertex-based discretizations

on triangular and quadrilateral meshes, and cell-centered discretizations on quadrilateral

meshes, accuracy can be recovered using an inverse distance weighting in the least-squares

construction. For cell-centered discretizations on triangles, both the unweighted and

weighted least-squares constructions fail to provide suitable gradient estimates for highly

stretched curved meshes. Good overall ow solution accuracy can be retained in spite

of poor gradient estimates, due to the presence of ow alignment in exactly the same

regions where the poor gradient accuracy is observed. However, the use of entropy �xes,

or the discretization of physical viscous terms based on these gradients has the poten-

tial for generating large but subtle discretization errors, which vanish in regions with no

appreciable surface curvature.

Introduction

Current-day unstructured mesh aerodynamic pro-duction codes rely almost exclusively on formallysecond-order accurate discretizations. The twomain approaches for achieving second-order accuracyinvolve centrally-di�erenced convective terms withadded arti�cial dissipation1, 2 and projection-evolutionschemes using linearly extrapolated values based ongradient reconstruction.3, 4 Other approaches include uctuation splitting schemes,5 and streamwise upwindPetrov-Galerkin schemes,6 although these approacheshave not seen widespread use in computational aero-dynamics. Although arti�cial dissipation schemes andprojection evolution schemes have di�erent origins, the�nal discretizations are closely related. Consider theevaluation of a ux at a control volume interface, asdepicted in Figure 1. The projection evolution schemerequires the solution of an approximate Rieman-solverat the interface. For example, the often-used RoeRieman-solver can be written as:7

Fik = F (uL; uR) = FL(u) + FR(u) + T j�jT�1(uL � uR) (1)

Copyright c 2003 by Dimitri J. Mavriplis. Published bythe American Institute of Aeronautics and Astronautics, Inc. withpermission.

i u ul r k

Fig. 1 Illustration of ux evaluation at control

volume interface

where uL and uR represent the value of the ow vari-ables at the left and right sides of the control volumeinterface. For a �rst-order scheme, these are simplytaken as the values at the vertices corresponding tothe control volume on either side of the face:

uL = ui (2)

uR = uk (3)

1 of 13

American Institute of Aeronautics and Astronautics Paper 2003{3986

To obtain second-order accuracy, the left and rightstates must be obtained by extrapolating the con-trol volume values based on a reconstructed gradient.Thus, the second-order accurate scheme is obtainedusing:

uL = ui +rui:~rif (4)

uR = uk +ruk:~rkf (5)

where ~rif represents the position vector drawn fromvertex i to the center point of the control volume in-terface. This formulation requires the evaluation ofthe gradients ru at the mesh vertices. These gradi-ents may be evaluated using a Green-Gauss contourintegration around the vertex-based control volumes,or by taking a least-squares approximation to the gra-dient at each vertex by constructing a tangent planewhich best �ts the surrounding neighboring data insome (weighted) least-squares sense.8, 9 The Green-Gauss and least-squares constructions are outlined inthe Appendix. The least-squares construction may in-clude weights on the error terms, leading to di�erentgradient approximations for non-linear functions. Inall cases, the least-squares constructions represent alinear function exactly for vertex and cell-centered dis-cretizations on arbitrary mesh types, while the Green-Gauss construction represents a linear function exactlyonly for a vertex-based discretization on simplicial ele-ments (triangles or tetrahedra). Various constructiontechniques for the least-squares gradients have beenproposed and discussed in the literature. In this work,a Gramm-Schmidt construction,8 and a QR decompo-sition method9, 10 have been implemented and tested.However, very little di�erences in the computed gradi-ents has been observed between these two constructiontechniques, while much more important di�erences dueto the choice of weights has been found, as will beshown in the paper.Arti�cial dissipation schemes employ a central dif-

ference for the convective terms, and augment thesequantities by a dissipative term which is required forstability. The ux at an interface for a �rst-order ac-curate arti�cial dissipation scheme can be written as:

Fik = Fi(u) + Fk(u) + �(ui � uk) (6)

where � may be a scalar (scalar arti�cial dissipation)or a matrix (matrix arti�cial dissipation). In the casewhere � is a matrix, a natural choice for �, by analogywith equation (1) is:

� = � T j�jT�1 (7)

where � is a constant to be determined empirically.If � is taken as unity, then the �rst-order accurate

matrix dissipation scheme becomes identical to the�rst-order accurate projection evolution scheme. Onstructured meshes, second-order accurate arti�cial dis-sipation schemes are obtained by replacing the �rstdi�erence in equation (6) by a third di�erence.11 Onunstructured meshes, a second-order accurate arti�cialdissipation ux can be constructed as:

Fik = Fi(u) + Fk(u) + � (Li(u)� Lk(u)) (8)

where Li(u) represents an undivided Laplacian opera-tor, taken as:

Li(u) =

neighborsXk=1

(uk � ui) (9)

resulting in an arti�cial dissipation term which is of thesame order as a third di�erence. Thus, the second-order accurate matrix dissipation scheme can be ob-tained by replacing the di�erence of reconstructedstates in the projection evolution scheme by a di�er-ence of undivided Laplacian operators. Although thesequantities are of the same order, they are not directlyproportional to each other, and therefore the parame-ter � cannot be taken as unity in this case, but mustbe determined empirically. There are also discrepan-cies between the centrally di�erenced convective uxesin both schemes, since these are evaluated at recon-structed states in the upwind scheme, rather than atvertex values as in the arti�cial dissipation scheme.However, numerical experiments reveal that these dif-ferences have virtually no e�ect on solution accuracyin the subsonic and transonic regimes.The T matrices on the right hand side of equation

(1) represent the eigenvectors associated with the lin-earization of the equations of inviscid compressible ow normal to the control volume face ik, while thej�j matrix is a diagonal matrix containing the ab-solute values of the �ve eigenvalues associated withthese equations. Of these �ve eigenvalues, three arerepeated, leaving three distinct eigenvalues which areproportional to: u, u+c, u-c, where u is the velocitynormal to the control volume face, and c is the speedof sound. When one of these eigenvalues vanishes, thedissipation for that component at that location alsovanishes, which may lead to numerical instabilities.For this reason, it is common to limit the eigenvaluesto a minimum fraction of the maximum eigenvalue,such as:

u=sign(u) �max(juj; �(juj+ c)) (10)

u+ c=sign(u+ c) �max(ju+ cj; �(juj+ c)) (11)

u� c=sign(u� c) �max(ju� cj; �(juj+ c)) (12)

where juj+c is the maximum eigenvalue, and � is a pa-rameter to be chosen empirically which varies between

2 of 13

American Institute of Aeronautics and Astronautics Paper 2003{3986

0 and 1. When � is taken as 0, no eigenvalue limit-ing is applied. When � is taken as 1, the j�j matrixreverts to a scaled identity matrix, since all eigenval-ues are now taken as juj + c, and the triple matrixproduct T j�jT�1 reduces to a scalar quantity. For thearti�cial dissipation discretization, this constitutes thede�nition of the scalar arti�cial dissipation, i.e.

� = � �max eigenvalue (13)

which can be computationally cheaper than requiringthe evaluation of the full matrices. Small values of � ofthe order of 0.1 are common in many production codes,and this process is often referred to as an entropy �x.For ows with strong gradients, most notably in

the vicinity of shock waves, the above second-orderaccurate formulations may lead to instabilities, andadditional dissipative mechanisms are required. In theupwind scheme, these take the form of limiters appliedto the computed gradients,3 while in the arti�cial dissi-pation schemes, the di�erences of undivided Laplacianoperators is replaced by a blend of �rst di�erences andundivided Laplacian operators.1, 12 In both cases, ac-curacy is reduced from �rst to second order locally inregions where this additional dissipation is required.For transonic ows with shocks of moderate strength,the use of limiters or additional dissipation is generallynot required. For the purposes of the current study,we will con�ne ourselves to cases where no limiting oradditional dissipation is employed.

Motivation

The motivation for the current study comes fromthe observed behavior of various unstructured meshdiscretizations for a Reynolds-averaged Navier-Stokessolver on problems of aerodynamic interest. The vis-cous transonic ow over a wing-body con�guration hasbeen computed using the vertex-based unstructuredmesh ow solver NSU3D13 using a matrix arti�cialdissipation discretization and an upwind scheme basedon the unweighted least-squares gradient constructiontechnique, and the sensitivity of the solution to thedi�erent discretizations has been investigated.14 Theparticular test case is taken from the 1st AIAA Dragprediction workshop.15 Figure 2 illustrates the meshand a sample solution for a Mach number of 0.75, aReynolds number of 3 million and CL = 0.6. Themesh contains a total of 1.65 million vertices, and usesprismatic elements in the boundary layer regions andtetrahedral elements elsewhere. The solution is shownas computed surface pressure contours, illustrating theshock wave on the upper surface of the wing.

Fig. 2 Computed surface pressure contours

for transonic ow over wing-body con�guration.

Mach=0.75, CL = 0.6, Reynolds number =

3,000,000

Figure 3 depicts the computed lift and drag valuesusing both the arti�cial dissipation discretization, withan entropy �x value of � = 0:1 and the least-squaresupwind discretization scheme using the entropy �xvalue of � = 0:0 as well as � = 0:1The lift values produced by the upwind scheme with

no entropy �x are slightly lower than those given bythe matrix dissipation case. Comparing these di�er-ences with the increased lift values reported by thematrix dissipation on a �ner grid of 13 million points,one can conclude that the least-squares based dis-cretization is slightly more di�usive than the matrixdissipation discretization. Because the nominal valueof the � coe�cient in the matrix dissipation schemehas been determined empirically, it is conceivable thata simple rescaling of the dissipation terms could beused to improve the accuracy in the upwind schemeas well. However, there are signi�cant di�erences be-tween these two discretizations which extend beyondthe simple scaling of the �nal terms. When the entropy�x parameter for the arti�cial dissipation scheme is in-creased from � = 0:0 to � = 0:1, which is the level usedin the baseline matrix dissipation settings, the resultsof the upwind scheme are now much di�erent thanin either baseline cases. The lift is reduced by over20% and the drag values in the polar plot are sub-stantially overpredicted. In essence, the accuracy ofthe upwind scheme has been completely compromisedby this small value of the entropy �x. For the ma-trix dissipation scheme, previous studies14 have shownthe solution accuracy to be insensitive to small values(� = 0:1 to 0:2) of the entropy �x parameter, while thescalar dissipation scheme (� = 1:0) achieves reasonableaccuracy in lift with slight drag overprediction (� 25counts) for the case shown above.14 The unexpected

3 of 13

American Institute of Aeronautics and Astronautics Paper 2003{3986

sensitivity of the upwind scheme to small values of theentropy �x prompted the current investigation.

ALPHA

CL

-3 -2 -1 0 1 20

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8Art. Dissipation (Fine Grid)Art. Dissipation (Baseline Grid)Least Squares : d 1 = 0.0Least Squares : d 1 = 0.1

CD

CL

0.02 0.03 0.04 0.050

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

Art. Dissipation (Fine Grid)Art. Dissipation (Baseline Grid)Least Squares : d 1 = 0.0Least Squares : d 1 = 0.1

Fig. 3 Variations in computed lift and drag coef-

�cients as a function of discretization for transonic

ow over wing-body con�guration

To better study this problem, we resort to a sim-pler two-dimensional example. Figure 4 illustrates themesh for computations of viscous transonic ow aboutan RAE2822 airfoil at Mach=0.73, Reynolds=6.5 mil-lion, and an incidence of 2.31 degrees. The meshcontains a total of 16167 vertices, with the distance ofthe �rst point normal to the wall being 2.e-06 chords.Although the �gure shows a fully triangular mesh,quadrilateral elements are employed by the solver inthe boundary layer regions by removing the diago-nal associated with pairs of stretched triangles. A ow solution behavior similar to that discussed forthe three-dimensional example is observed in Figure5. The solutions using the matrix arti�cial dissipationscheme and the least-squares based upwind scheme

with a vanishing entropy �x agree closely, while theupwind scheme accuracy degrades severely when thevalue � = 0:1 for the entropy �x is used.

Fig. 4 Two-dimensional unstructured mesh for

computation of transonic ow over RAE2822 airfoil

Cp

-1

-0.5

0

0.5

1

Matrix DissipationLeast Squares (entropy fix)Least Squares (no entropy fix)

Fig. 5 Variations in computed surface pressure

coe�cients as a function of discretization for two-

dimensional transonic airfoil problem. Mach=0.73,

Incidence=2.31 degrees, Re = 6.5 million

Investigation

To investigate the cause of this accuracy degrada-tion, we study the accuracy of the various gradientconstruction techniques. Clearly, all the employed gra-dient construction techniques produce the exact resultfor a linear function. Thus, we must investigate the ac-curacy of these constructions for non-linear functions,

4 of 13

American Institute of Aeronautics and Astronautics Paper 2003{3986

and preferably functions which are representative ofthe types of gradients found in real ow simulations.We seek an analytic function for which an exact valueof the gradient is available, against which the discretegradient values can be compared. This is achievedusing the distance function, which represents the dis-tance from any given point in the plane to the nearestpoint on the airfoil surface. Contours of the distancefunction are shown in Figure 6. This represents a con-venient choice, since the distance function has similarcharacteristics to boundary layer velocity gradients,(i.e. exhibits strong normal gradients, and vanishingstreamwise gradients) and is readily available, since itis required in the formulation of the Spalart-Allmarasturbulence model.16 By de�nition, the gradient of thedistance function in the direction normal to the surfaceis unity:

~rD : ~n = 1:0 (14)

and the streamwise gradient vanishes. Thus, the normof the derivative is given by:

�@D

@x

�2

+

�@D

@y

�2

= 1:0 (15)

Figure 7 illustrates the contours of the percent errorbetween the unweighted least-squares computed gra-dient of the distance function and the exact value.For regions away from the leading and trailing edges,the maximum error is no more than 0.5%, illustrat-ing the accuracy of this construction for nearly linearfunctions. Similar results are observed with the Green-Gauss gradient construction.

A more non-linear function is constructed by con-sidering a quadratic variation in D:

F = (1 + �D)2 (16)

At any point, the norm of the gradient in F is givenby:

krFk = 2�(1 + �D)

"�@D

@x

�2

+

�@D

@y

�2#

(17)

or

krFk = 2�(1 + �D) (18)

following equation (15). For the purposes of this study,the value � = 200 was used exclusively. This choicewas motivated by the desire to minimize roundo� errorproblems for small values of D.

Fig. 6 Contours of distance function on grid of

Figure 4

0.5

0.5

0.5

0.50.5

0.5

0.5

0.5

0.5

0.5

0.5

0.5

0.5

0.5

0.5

0.5

0.5

11 35

Fig. 7 Contours of percent error between com-

puted and exact distance function gradient. Errors

are below 0.5% except near the leading and trailing

edges

.

In Figure 8, the ratio of the computed to the ex-act value of krFk is plotted at the station x=0.3on the airfoil, using the Green-Gauss gradient con-struction, and the unweighted least-squares gradientconstruction. Additionally, the values obtained froma weighted least-squares gradient construction (usinginverse distance weighting) are shown, as well as thevalue of dF/dn obtained by �nite di�erence along thenormal grid line in the boundary layer region. TheGreen-Gauss and the �nite-di�erence approach pro-duce very accurate estimates of the gradient in allregions of the domain. However, the unweighted least-squares construction is seen to grossly underpredict

5 of 13

American Institute of Aeronautics and Astronautics Paper 2003{3986

the gradient near the wall, and throughout a largeinner portion of the boundary layer region. When in-verse distance weighting is used in the least-squares ap-proach, accuracy similar to that achieved by the othermethods is recovered. Figure 9 shows the value of thegradient at the �rst grid point away from the airfoilsurface (in the normal direction), plotted along the en-tire upper and lower surfaces of the airfoil. Once again,the gradient values are well predicted by all meth-ods except the unweighted least-squares construction,which shows severe under-prediction and considerablescatter aft of the mid-chord location.

Computed/Exact Normal Gradient

Dis

tanc

efro

mW

all(

Cho

rds)

0 0.25 0.5 0.75 1 1.2510-6

10-5

10-4

10-3

10-2

10-1

Green-GaussUnweighted Least SquaresWeighted Least SquaresFinite Difference

Fig. 8 Ratio of computed to exact gradient of func-

tion F using various methods along normal station

at x=0.3 location on RAE2822 airfoil grid using

quadrilateral elements in boundary layer region

Com

pute

d/E

xact

Gra

dien

t

-0.5

-0.25

0

0.25

0.5

0.75

1

1.25

1.5Green-GaussUnweighted Least SquaresWeighted Least SquaresFinite-Difference

Fig. 9 Ratio of computed to exact gradient of

function F at �rst interior grid point closest to wall

along RAE2822 airfoil

To obtain insights into this behavior, we perform thesame experiment on a at plate geometry. The gridfor this case is shown in Figure 10. The geometry con-sists of a at plate with a rounded and tapered leadingedge. Figure 11 illustrates the comparison between an-alytical and computed gradients at the �rst point o�the wall as a function of streamwise coordinate. In thiscase, the unweighted least-squares gradients comparepoorly with the exact values near the leading edge,but compare favorably over the downstream region ofthe plate. In fact, the sudden increase in accuracy forthese gradients occurs precisely at the location wherethe plate surface becomes horizontal, or more impor-tantly, where the surface curvature vanishes.

Fig. 10 Illustration of unstructured mesh em-

ployed for computation of viscous ow over at

plate with rounded and tapered leading edge

Com

pute

d/E

xact

Gra

dien

t

-0.25

0

0.25

0.5

0.75

1

1.25Green-GaussUnweighted Least SquaresWeighted Least SquaresFinite-Difference

Fig. 11 Ratio of computed to exact gradient of

function F at �rst interior grid point closest to wall

along upstream portion of at plate geometry

6 of 13

American Institute of Aeronautics and Astronautics Paper 2003{3986

This provides an indication as to the mechanismsubverting the accuracy of the unweighted least-squares gradient construction. This is illustrated inFigure 12 using the simplest possible con�guration, i.e.a highly stretched quadrilateral mesh in the presenceof surface curvature. Without loss of generality, we as-sume the surface normal at the station under consider-ation to be in the y-coordinate direction, and plot thetopology using an expanded scale in the normal direc-tion. Due to the surface curvature, the upstream anddownstream neighbors are not aligned with the cen-ter point in the y-coordinate. While this y-directionvariation is indeed very small (order 1.e-04 chords onthe RAE 2822 mesh near the mid-chord location), it isnonetheless much larger than the small normal spacingused in the inner portion of the boundary layer region(2.e-06 chords). Therefore, for the unweighted least-squares gradient, these points exert a large in uenceon the determination of the normal gradient, in spiteof the fact that they are much more distant from thepoint under consideration than the two neighboringvalues in the upper and lower y-direction. This is anunavoidable consequence of the use of an unweightedprocedure, which treats all (neighboring) stencil pointsequally. Using the inverse distance weighting in theleast-squares construction deemphasizes these distantupstream and downstream points, thus resulting inmuch more accurate gradients in such situations. Re-ferring to Figure 12, the accuracy of the unweightedleast-squares gradient is seen to break down when thenormal grid spacing h becomes comparable to the dis-tance H . Writing H as a function of the angle � yieldsthe necessary condition for avoiding accuracy break-down of the unweighted least-squares gradient:

h > R(1� cos�) (19)

or

h >s2

2R(20)

where s denotes the streamwise grid spacing, and the

approximations cos� � 1 + �2

2+ ::: and � � s

Rhave

been used. Considering a circle of unit radius, dis-cretized with O(102) circumferential points, equation(20) predicts poor gradient accuracy for normal gridspacing below O(104). This rough estimate correlateswell with the behavior observed in Figure 8 for theairfoil case.The failure of the unweighted least-squares gradient

construction is perhaps surprising because this methodpossesses many of the often sought-after properties fornumerical schemes:

� It represents a linear function exactly, for arbi-trary grid topologies.

� It has been shown to produce superior gradi-ent estimates for highly irregular (but isotropic)meshes.

� It performs well for cases with no surface cur-vature, such as at plate boundary layer cases.where most numerical investigations of viscous ow solvers are initiated.

� It has often been found to be more robust for vis-cous ows.

Although the combination of high mesh stretchingwith surface curvature may be considered pathologi-cal situations in some disciplines, such topologies arecommon-place for aerodynamic simulations and bettergradient estimates are desirable.

h

H

s

R

α

Fig. 12 Illustration of stencil for least-squares

gradient calculation on quadrilateral mesh in the

presence of stretching and surface curvature

E�ects with Alternate Discretizations

The above discussion was con�ned to vertex-basedschemes operating on prismatic (3D) or quadrilateral(2D) element meshes in the boundary layer region. Inthis section we examine the suitability of the variousgradient construction methods for vertex-based dis-cretizations on triangular boundary layer meshes, andfor cell-centered discretizations using fully triangularor mixed triangular and quadrilateral meshes. Figure13 illustrates the topology of the least-squares stencilfor a vertex-based triangular mesh, and Figure 14 de-picts the estimates of the gradient of the function Fproduced by the various methods. In this case, thestencil is augmented by two additional points joinedby the triangle diagonals, which are at upstream anddownstream locations from the point under considera-tion. These additional points are similar in characterto the upstream and downstream points obtained fromthe quadrilateral stencil, and thus both the unweightedand weighted least-squares methods retain similar per-formance on triangular meshes as on quadrilateralmeshes. Additionally, the Green-Gauss approach is

7 of 13

American Institute of Aeronautics and Astronautics Paper 2003{3986

seen to yield similar results on triangular meshes as inthe previous case on quadrilateral meshes. Note thatthe Green-Gauss construction is exact for linear func-tions on triangular meshes only, although this does notappear to have any appreciable e�ect on the accuracyof the results shown in Figure 14.

Extra Stencil Point

Extra Stencil Point

Fig. 13 Illustration of stencil for least-squares

gradient calculation on triangular mesh in the pres-

ence of stretching and surface curvature

Computed/Exact Normal Gradient

Dis

tanc

efro

mW

all(

Cho

rds)

0 0.25 0.5 0.75 1 1.2510-6

10-5

10-4

10-3

10-2

10-1

Green-GaussUnweighted Least SquaresWeighted Least SquaresFinite Difference

Fig. 14 Ratio of computed to exact gradient of

function F using various methods along normal sta-

tion at x=0.3 location on fully triangular RAE2822

airfoil grid

For cell-centered schemes operating on quadrilateralmeshes, the stencil is topologically similar to that ofa vertex scheme operating on a quadrilateral mesh, asshown in Figure 15. Thus similar behavior for the var-ious gradient construction methods can be expected.

For a cell-centered method operating on a fully trian-gular mesh, the stencil topology is shown in Figure16. In all cases, a stencil with only three neighborsis obtained, and none of these neighbors are locatedclose (within the order of a cell normal height) tothe cell center under consideration. Hence, it is notsurprising that the unweighted least-squares gradientexhibits poor accuracy in the boundary layer region,similarly to the vertex discretization cases. However,inverse distance weighted least-squares constructionalso exhibits poor accuracy in these cases, as shownin Figures 17 and 18, since there are no close points toprovide accurate normal derivative information. Forcell-centered discretizations, the Green-Gauss gradi-ent construction generally will not produce the exactvalue for a linear function. This is only achieved ifthe segments joining neighboring cell centroids bisectthe mesh edges, which is generally not achieved.3 Forthe function F, the gradient values are either over-predicted or under predicted by roughly 10 % depend-ing on the orientation of the triangle diagonal, as seenby the oscillatory behavior in the plot of Figure 18.(Only one branch of these two triangle types is plottedin Figure 17.) The average of these two triangle esti-mates closely approximates the exact gradient value,which is equivalent to performing the integral aroundthe quadrilateral formed by the union of the two con-stituent triangles. In spite of this shortcoming ontriangular meshes, the Green-Gauss gradients are seento provide superior estimates of the gradients of F inthe boundary layer regions to the least-squares meth-ods. This illustrates the danger of relying on simpleproperties such as exact representation of linear func-tions for accuracy certi�cation.

Fig. 15 Illustration of stencil for least-squares gra-

dient calculation for cell-centered discretization on

quadrilaterals

8 of 13

American Institute of Aeronautics and Astronautics Paper 2003{3986

Fig. 16 Illustration of stencil for least-squares gra-

dient calculation on cell-centered discretization on

triangular mesh

Computed/Exact Normal Gradient

Dis

tanc

efro

mW

all(

Cho

rds)

0 0.25 0.5 0.75 1 1.2510-6

10-5

10-4

10-3

10-2

10-1

Green-GaussUnweighted Least SquaresWeighted Least Squares

Fig. 17 Ratio of computed to exact gradient of

function F along normal station at x=0.3 location

for cell-centered discretization on fully triangular

RAE2822 airfoil grid

Com

pute

d/E

xact

Gra

dien

t

-0.5

-0.25

0

0.25

0.5

0.75

1

1.25

1.5Green-GaussUnweighted Least SquaresWeighted Least Squares

Fig. 18 Ratio of computed to exact gradient of

function F at second layer of triangles o� wall

for cell-centered discretization on fully triangular

RAE2822 airfoil grid

Alternate techniques for constructing gradients oncell centered simplicial discretizations have been de-veloped.17{20 In one of these approaches,19, 20 vertexvalues are obtained by averaging surrounding cell-centroidal values, often using a weighting factor, andthe cell based gradient is then computed using aGreen-Gauss contour integral using the constructedvertex values. The technique described in17, 18 extrap-olates gradients computed on neighboring trianglesusing a Green-Gauss contour integration. The perfor-mance of these strategies for highly stretched meshesin the presence of curvature has not been studied inthis work, but warrants further investigation.

E�ect on Solution Accuracy

While we have pointed out inadequacies in the un-weighted least-squares gradient formulation, the factremains that in the absence of any entropy �x, up-wind discretizations based on this approach achievegood overall accuracy, as evidenced by the results inFigures 3 and 5. It may seem perplexing how one canobtain a viable solution with such poor gradient esti-mates in the inner boundary layer region, and why thissolution is so sensitive to small values of the entropy�x parameter. The answer lies in the alignment of thegrid with the ow direction in the boundary layer re-gion. The use of a highly stretched mesh aligned withthe wall direction in boundary layer regions, which iscommonplace for high-Reynolds number fow simula-tions, results in near vanishing ow velocity normal tothe control volume interfaces in this direction. Thisis shown in Figure 19, where the computed normaland streamwise ow velocities are plotted along the

9 of 13

American Institute of Aeronautics and Astronautics Paper 2003{3986

normal station at x=0.3 for the transonic airfoil owsolution using matrix dissipation depicted in Figure 5.This plot indicates that the normal velocity is two tothree orders of magnitude smaller than the streamwisevelocity throughout the inner portion of the boundarylayer. In Figure 20, the normal and streamwise convec-tive eigenvalues are plotted at the same station. Theconvective eigenvalue is de�ned as the integrated ve-locity ux through the control volume face. Due to thehigh cell aspect ratios, the normal control volume faceis much larger than the streamwise face, and the nor-mal eigenvalue becomes substantially larger than thestreamwise value in the inner boundary layer region.Thus, in spite of decoupling through ow alignment,the high grid cell aspect-ratio ensures strong couplingbetween neighboring normal points in the boundarylayer, even for the convective modes. However, theoverall dissipation terms are formed by the productof the eigenvalue with the jump in left and right owvariables across the control volume face. Assuming(as a worst case scenario) a �rst order variation inthe ow variables, the normal (streamwise) dissipationterms scale as the product of the normal (streamwise)eigenvalue and the normal (streamwise) grid spacing,with this latter quantity being of the same order asthe streamwise (normal) control volume face. Thusthe overall scaling of the dissipation terms is closelyapproximated by Figure 19, which implies much lowerdi�usion in the normal direction as compared to thestreamwise direction. The application of an entropy�x places a lower limit on the velocity values used inscaling the dissipation terms, which from Figure 19 canbe seen to have a large e�ect on the normal velocityvalues.It is interesting to note that, although the dissi-

pation terms associated with the normal velocity aresmall, the two acoustic wave eigenvalues associatedwith u+c and u-c are not a�ected by ow alignment,and yet good accuracy is retained despite the use of in-accurate gradients for the dissipative terms associatedwith the acoustic waves. On the other hand, the use ofmore accurate gradient estimates resolves the loss ofaccuracy for small values of the entropy �x parameter.In Figure 21, the transonic airfoil ow case has beenrecomputed using the upwind scheme with an inverse-distance weighted least-squares gradient construction,using a vanishing entropy �x, as well as an entropy�x parameter value of � = 0:1. The computed surfacepressures in both cases compare well with each otherand agree closely with those produced by the matrixarti�cial dissipation scheme, illustrating the superiorcharacteristics of the weighted versus the unweightedleast-squares construction.

Velocity

Dis

tanc

efro

mW

all(

Cho

rds)

10-4 10-3 10-2 10-1 10010-6

10-5

10-4

10-3

10-2

10-1

Normal VelocityStreamwise Velocity

Fig. 19 Magnitudes of normal and streamwise ve-

locities along normal station at x=0.3 for transonic

airfoil ow solution

Convective Eigenvalue

Dis

tanc

efro

mW

all(

Cho

rds)

10-8 10-7 10-6 10-5 10-4 10-3 10-210-6

10-5

10-4

10-3

10-2

10-1

Normal EigenvalueStreamwise Eigenvalue

Fig. 20 Magnitudes of normal and streamwise con-

vective eigenvalues along normal station at x=0.3

for transonic airfoil ow solution

10 of 13

American Institute of Aeronautics and Astronautics Paper 2003{3986

Cp

-1

-0.5

0

0.5

1

Matrix DissipationWeighted Least Squares (entropy fix)Weighted Least Squares (no entropy fix)

Fig. 21 Variations in computed surface pressure

coe�cients for weighted least-squares gradient con-

struction as a function of discretization for two-

dimensional transonic airfoil problem. Mach=0.73,

Incidence=2.31 degrees, Re = 6.5 million

Implications

In the above discussion, we have demonstrated howand why the unweighted least-squares gradient con-struction severely under-estimates normal gradientsfor highly stretched meshes in the presence of surfacecurvature. Furthermore, it has been shown that thisbehavior can be expected for vertex based discretiza-tions operating on triangular and quadrilateral meshes(tetrahedral and prismatic meshes in 3D) and for cellcentered discretizations on either types of meshes aswell. The use of inverse distance weighting in theleast-squares construction can be used to recover goodaccuracy in these situations for vertex and cell centereddiscretizations on quadrilateral meshes, and for vertexdiscretizations on triangular meshes. However, thistechnique is not e�ective for cell centered discretiza-tions on triangular meshes. The Green-Gauss con-struction technique produces adequate gradient esti-mates in all cases, even for cell centered discretizationswhere it may not represent linear functions exactly.On the other hand, the failure of the un-weighted

least-squares gradient is mitigated by the phenomenonof ow alignment in precisely the same locations, thusenabling adequate overall accuracy to be achieved.Therefore, the least-squares gradient construction canbe used competitively for producing accurate solu-tions, but the user must be aware of the limitationsof this approach: notably that no entropy �x be used,and that the mesh be well aligned with the viscoussurfaces, and thus with the boundary layer ow direc-tion. Alternately, mesh cell aspect ratio constraintsbased on equation (20) may be enforced.

Discretization of the physical viscous terms in theNavier-Stokes equations is often achieved in a two passapproach where the ow gradients are evaluated in the�rst pass, and then used in the second pass to buildup these terms. Clearly, the use of unweighted least-squares gradients in the construction of these viscousterms has the potential to generate large discretizationerrors overall. However, the de�ciency of this approachmay be extremely subtle in that it will not at all man-ifest itself for at plate boundary layer calculations,where most viscous ow solvers are initially validated,but only in the presence of bodies with non-negligiblesurface curvature.Finally, a more prudent strategy would appear to

be one which employs inverse distance weighted least-squares gradients or even Green-Gauss gradients in thediscretization of convective and viscous terms. How-ever, these approaches have proven to be substantiallyless robust than upwind schemes based on unweightedleast-squares gradients, and often require gradient lim-iting to achieve stable solutions, which in turn, mayhave an adverse impact on accuracy. While it wasinitially argued that this was due to superior approxi-mation properties of the unweighted least-squares ap-proach especially for irregular meshes, it should nowbe evident that the main reason for the robustness ofthis approach can be attributed to the use of under-predicted gradients, e�ectively using limited gradientswhich correspond to a �rst order scheme in the innerpart of the boundary layer.An alternative to the inadequacies of the unweighted

approach, and the poor robustness of the weighted ap-proach, is to resort to di�erent gradient formulations,such as those described in,17{20 or to employ one-dimensional reconstruction and limiting in the normaldirection in the boundary layer, analogous to struc-tured mesh techniques, although this incurs obviousdata-structure drawbacks for an unstructured meshapproach. Future work will investigate the accuracyand robustness of various such discretizations for bothvertex-based and cell centered approaches.

Appendix

The Green-Gauss formulation constructs gradientsby integrating around the boundary of a closedcontrol-volume. From Green's theorem, the averagegradients over a control volume can be written as:

(ux)i =1

V oli

Z ZuxdV =

1

V oli

Iudy (21)

(uy)i =1

V oli

Z ZuydV =

�1V oli

Iudx (22)

where V oli represents the area of the two-dimensionalcontrol volume. These contour integrals are then dis-cretized as:

(ux)i =1

V oli

NXk=1

ui + uk

2�yik (23)

11 of 13

American Institute of Aeronautics and Astronautics Paper 2003{3986

(uy)i =�1V oli

NXk=1

ui + uk

2�xik (24)

where the x and y subscripts denote di�erentiation,and i and k identify the associated control volume. Forvertex schemes, the median dual control volumes areemployed, as depicted in Figure 1. In this case, i and krefer to the vertices on either side of the control volumeface, and �xik and �yik denote the increments of xand y along the control volume face. For cell-centeredschemes, the grid cells themselves form the control vol-umes. In this case, i and k refer to the cells on eitherside of a mesh edge, and �xik and �yik denote theincrements of x and y along the mesh edge. The Green-Gauss formulation is exact for vertex discretizationsof linear functions only on triangular elements. Forcell-centered discretizations, this formulation is gener-ally not exact for linear functions on quadrilaterals ortriangles. In the special case where the segments join-ing neighboring triangle cell centers exactly bisect theshared mesh edge, the formulation becomes exact forlinear functions on triangles.

The least-squares gradient construction is a tech-nique which is unrelated to the mesh topology. Thisconstruction relies on a stencil which identi�es relevantneighboring points for use in the gradient estimation.Although this stencil can be chosen arbitrarily, themost obvious construction for mesh-based data is tochose the stencil of nearest neighboring values. For avertex-based discretization, the stencil is thus formedby the set of mesh edges incident on the considered ver-tex i. For a cell-centered discretization, the stencil isformed by the edges joining neighboring cell centroids,which corresponds to the dual graph of the mesh, asshown in Figures 15 and 16. The least-squares gradi-ent construction is obtained by solving for the valuesof the gradients which minimize the sum of the squaresof the di�erences between neighboring values k = 1; Nand values extrapolated from the point i under con-sideration to the neighboring locations. The objectiveto be minimized is given as

NXk=1

w2ikE

2ik (25)

The error is given as

E2ik = (�duik + (ux)i:dxik + (uy)i:dyik)

2 (26)

where duik represents the di�erence uk�ui, with simi-lar expressions for dxik and dyik , and wik is a weightingfactor. Dropping the i subscripts on the gradients forclarity, a system of two equations for the two gradi-ents ux and uy is obtained by solving the minimizationproblem i.e.

@PN

k=1 w2ikEik

2

@ux= 0 (27)

and

@PN

k=1 w2ikEik

2

@uy= 0 (28)

Using straight-forward algebra, the following set ofequations is obtained

aiux + biuy = di (29)

biux + ciuy = ei (30)

where

ai =PN

k=1 w2ikdx

2ik (31)

bi =PN

k=1 w2ikdxikdyik (32)

ci =PN

k=1 w2ikdy

2ik (33)

di =PN

k=1 w2ikduikdxik (34)

ei =PN

k=1 w2ikduikdyik (35)

In practice, all the above terms can be precomputedand stored, since these are only a function of the gridmetrics. The above system of equations for the gra-dients is then easily solved using Cramer's rule. Notethat the determinant of this system is given by:

DET = ac� b2 (36)

For the unweighted case (wik = 1), the determi-nant corresponds to a di�erence in quantities of theorder O(dx4), which may lead to ill-conditioned sys-tems. This may be the motivation for investigationsinto alternate solution techniques for the least-squaresconstruction, such as the QR factorization method ad-vocated in.9, 10 For the ows computed in this work,very little di�erence in the calculated gradients wasobserved between these methods. Note that when in-verse distance weighting is used (wik = 1p

dx2ik+dy2

ik

),

the determinant scales as O(1), and the system is muchbetter conditioned.

References1A. Jameson, T. J. Baker, and N. P. Weatherill. Calculation

of inviscid transonic ow over a complete aircraft. AIAA Paper86-0103, January 1986.

2D. J. Mavriplis. A three-dimensional multigrid Reynolds-averaged Navier-Stokes solver for unstructured meshes. AIAA

Journal, 33(3):445{4531, March 1995.3T. J. Barth and D. C. Jespersen. The design and applica-

tion of upwind schemes on unstructured meshes. AIAA Paper89-0366, January 1989.

4W. K. Anderson. A grid generation and ow solutionmethod for the Euler equations on unstructured grids. Jour-

nal of Computational Physics, 110(1):23{38, January 1994.5H. Deconinck, H. Paillere, R. Struijs, and P. L. Roe. Mul-

tidimensional upwind schemes based on uctuation-splitting ofconservation laws. Comp. Mechanics, 11(5/6):323{340, 1993.

6T. J. R. Hughes. Recent progress in the development andunderstanding of SUPG methods with special reference to thecompressible Euler and Navier-Stokes equations. Intl. J. for

Numer. Meth. in Fluids, 7:1261{1275, 1987.

12 of 13

American Institute of Aeronautics and Astronautics Paper 2003{3986

7P. L. Roe. Approximate Riemann solvers, parameter vec-tors and di�erence schemes. J. Comp. Phys., 43(2):357{372,1981.

8T. J. Barth. Numerical aspects of computing viscous highReynolds number ows on unstructured meshes. AIAA Paper91-0721, January 1991.

9A. Haselbacher and J. Blazek. On the accurate and e�cientdiscretizationof the Navier-Stokes equations on mixed grids. InProceedings of the 14th AIAA CFD Conference, Snowmass,

CO, pages 946{956, June 1999. AIAA Paper 99-3363-CP.10W. K. Anderson and D. L. Bonhaus. An implicit upwind

algorithm for computing turbulent ows on unstructured grids.Computers Fluids, 23(1):1{21, 1994.

11A. Jameson, W. Schmidt, and E. Turkel. Numerical so-lution of the Euler equations by �nite volume methods usingRunge-Kutta time stepping schemes. AIAA Paper 81-1259,1981.

12D. J. Mavriplis. Solution of the Two-Dimensional Euler

Equations on Unstructured Triangular Meshes. PhD thesis,Princeton University, MAE Department, 1987.

13D. J. Mavriplis and D. W. Levy. Transonic drag predictionusing an unstructured multigrid solver. AIAA-Paper 2002-838,January 2002.

14D. J. Mavriplis. Aerodynamic drag prediction using un-structured mesh solvers. In Lecture notes from the VKI Lecture

Series on CFD-Based Drag Prediction and Reduction, February2003.

15D. W. Levy, T. Zickuhr, J. Vassberg, S. Agrawal, R. A.Wahls, S. Pirzadeh, and M. J. Hemsch. Summary of data fromthe �rst AIAA CFD drag prediction workshop. AIAA Paper2002-0841, January 2002.

16P. R. Spalart and S. R. Allmaras. A one-equation turbu-lence model for aerodynamic ows. La Recherche A�erospatiale,1:5{21, 1994.

17J. A. Desideri and A. Dervieux. Compressible ow solversusing unstructured grids. VKI Lecture Series, 1988-05:1{115,1988.

18A. Jameson. Analysis and design of numerical schemes forgas dynamics 1, arti�cial di�usion, upwind biasing, limiters andtheir e�ect on multigrid convergence. Int. J. of Comp. Fluid

Dyn., 4:171{218, 1995.19N. T. Frink. Recent progress toward a three-dimensional

unstructured ow solver. AIAA Paper 94-0061, January 1994.20R. D. Rausch, J. T. Batina, and H. T. Y. Yang. Spatial

adaptation of unstructured meshes for unsteady aerodynamic ow computations. AIAA J., 30(5):1243{1251, 1992.

13 of 13

American Institute of Aeronautics and Astronautics Paper 2003{3986