Strategies for Driving Mesh Adaptation in CFD (Invited)

20
American Institute of Aeronautics and Astronautics 092407 1 Strategies for Driving Mesh Adaptation in CFD (Invited) Christopher J. Roy 1 Virginia Polytechnic Institute and State University, Blacksburg, Virginia, 24061 This paper examines different approaches for driving mesh adaptation and provides theoretical developments for understanding the relationship between discretization error, the numerical scheme, and the mesh. Discrete and continuous equations governing the transport of discretization error are developed and it is shown that the truncation error acts as the local source for these equations. Examination of the truncation error in generalized coordinates provides insight into the role of mesh quality (mesh stretching for the 1D case) in the discretization error. Numerical results are presented for 1D steady-state Burgers equation at Reynolds numbers of 32 and 128. Four different approaches for driving mesh adaption are implemented for this case: solution gradients, solution curvature, discretization error, and truncation error. The truncation-error based adaption is shown to provide superior results for both cases. Finally, two approaches for estimating the truncation error are also discussed which would allow truncation error-based adaption to be implemented for complex numerical methods. I. Introduction ISCRETIZATION error occurs in every Computational Fluid Dynamics (CFD) solution and is often one of the main contributors to the overall uncertainty in a CFD prediction. It is formally defined as the difference between the exact solution to the discrete equations and the exact solution to the governing partial differential equations. Discretization error is the most difficult type of numerical error to estimate and is usually the largest of the numerical error sources, which also include iterative error, round-off error, and statistical error (where relevant). There are a number of different approaches for estimating discretization error, but they all rely on the underlying numerical solution (or solutions) being in the asymptotic range with regards to either the truncation error or the discretization error. In addition to the importance of estimating the discretization error, we also desire methods for reducing it. Applying uniform mesh refinement (required for extrapolation-based discretization error estimation such as Richardson extrapolation) is not the most efficient method for reducing the discretization error. Since uniform refinement, by definition, uniformly refines over the entire domain, it generally results in meshes with highly- refined cells/elements in regions where they are not needed. For 3D CFD applications, each time the mesh is refined by grid doubling in each coordinate direction, the number of cells/elements increases by a factor of eight. Thus uniform refinement for reducing discretization error can be extremely expensive. Targeted local refinement, or mesh adaptation, is a much better strategy for reducing the discretization error. There have been several extensive reviews of mesh adaption approaches for CFD (e.g., see Baker 1 and McRae 2 ); however much of this work has focused on methods for actually performing the adaption rather than the approach for driving the mesh adaptation. This paper examines several different criteria for driving a mesh adaptation scheme. After a brief discussion of different methods for determining which regions should be refined and which regions should be coarsened, the simple approach to mesh adaption is described. Then an extensive discussion of the truncation error and its relationship to the discretization error is given. Results are then given for the different mesh adaption methods applied to 1D steady-state Burgers equation for a viscous shock wave, followed by a discussion of two methods for approximating the truncation error. 1 Associate Professor, Aerospace and Ocean Engineering Department, 215 Randolph Hall, Associate Fellow AIAA. D 47th AIAA Aerospace Sciences Meeting Including The New Horizons Forum and Aerospace Exposition 5 - 8 January 2009, Orlando, Florida AIAA 2009-1302 This material is declared a work of the U.S. Government and is not subject to copyright protection in the United States.

Transcript of Strategies for Driving Mesh Adaptation in CFD (Invited)

Page 1: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

1

Strategies for Driving Mesh Adaptation in CFD (Invited)

Christopher J. Roy1 Virginia Polytechnic Institute and State University, Blacksburg, Virginia, 24061

This paper examines different approaches for driving mesh adaptation and provides theoretical developments for understanding the relationship between discretization error, the numerical scheme, and the mesh. Discrete and continuous equations governing the transport of discretization error are developed and it is shown that the truncation error acts as the local source for these equations. Examination of the truncation error in generalized coordinates provides insight into the role of mesh quality (mesh stretching for the 1D case) in the discretization error. Numerical results are presented for 1D steady-state Burgers equation at Reynolds numbers of 32 and 128. Four different approaches for driving mesh adaption are implemented for this case: solution gradients, solution curvature, discretization error, and truncation error. The truncation-error based adaption is shown to provide superior results for both cases. Finally, two approaches for estimating the truncation error are also discussed which would allow truncation error-based adaption to be implemented for complex numerical methods.

I. Introduction ISCRETIZATION error occurs in every Computational Fluid Dynamics (CFD) solution and is often one of the main contributors to the overall uncertainty in a CFD prediction. It is formally defined as the difference

between the exact solution to the discrete equations and the exact solution to the governing partial differential equations. Discretization error is the most difficult type of numerical error to estimate and is usually the largest of the numerical error sources, which also include iterative error, round-off error, and statistical error (where relevant). There are a number of different approaches for estimating discretization error, but they all rely on the underlying numerical solution (or solutions) being in the asymptotic range with regards to either the truncation error or the discretization error.

In addition to the importance of estimating the discretization error, we also desire methods for reducing it. Applying uniform mesh refinement (required for extrapolation-based discretization error estimation such as Richardson extrapolation) is not the most efficient method for reducing the discretization error. Since uniform refinement, by definition, uniformly refines over the entire domain, it generally results in meshes with highly-refined cells/elements in regions where they are not needed. For 3D CFD applications, each time the mesh is refined by grid doubling in each coordinate direction, the number of cells/elements increases by a factor of eight. Thus uniform refinement for reducing discretization error can be extremely expensive.

Targeted local refinement, or mesh adaptation, is a much better strategy for reducing the discretization error. There have been several extensive reviews of mesh adaption approaches for CFD (e.g., see Baker1 and McRae2); however much of this work has focused on methods for actually performing the adaption rather than the approach for driving the mesh adaptation. This paper examines several different criteria for driving a mesh adaptation scheme. After a brief discussion of different methods for determining which regions should be refined and which regions should be coarsened, the simple approach to mesh adaption is described. Then an extensive discussion of the truncation error and its relationship to the discretization error is given. Results are then given for the different mesh adaption methods applied to 1D steady-state Burgers equation for a viscous shock wave, followed by a discussion of two methods for approximating the truncation error.

1 Associate Professor, Aerospace and Ocean Engineering Department, 215 Randolph Hall, Associate Fellow AIAA.

D

47th AIAA Aerospace Sciences Meeting Including The New Horizons Forum and Aerospace Exposition5 - 8 January 2009, Orlando, Florida

AIAA 2009-1302

This material is declared a work of the U.S. Government and is not subject to copyright protection in the United States.

Page 2: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

2

II. Approaches for Driving Mesh Adaptation One of the most difficult aspects of mesh adaptation is finding a good criterion for adapting the mesh. The less

rigorous methods for adaptation are based on either solution features or the reconstruction of solution values/gradients, and these methods are often referred to as discretization error indicators. More rigorous formulations based on either adjoint methods or truncation errors (i.e., residuals) have a better theoretical foundation for CFD problems, and their advantages and disadvantages are discussed.

A. Feature-Based Adaption The most widely-used approach to grid adaptation employs feature-based methods. These methods often use

solution gradients, solution curvature, or even identified solution features to drive the adaptation process. Feature-based adaptation often results in some feature being over-refined while other features are not refined enough. In some cases, gradient-based refinement can actually increase the solution error.

An example of the failure of feature-based adaptation is given by Dwight for the inviscid transonic flow over an airfoil using an unstructured finite-volume discretization.3 Figure 1 shows the discretization error in the drag coefficient as a function of the number of cells. Uniform (global) adaptation shows second order convergence on the coarser grids, then a reduction to first order on the finer grids, likely due to the presence of the shock discontinuities. Adaptation based on solution gradients initially shows a reduction in the discretization error for the drag coefficient, but then subsequent adaptation steps show an increase in the discretization error. The adjoint-based artificial dissipation estimator gives the best results. The adapted grids for the latter two cases are given in Figure 1. While the gradient-based adaptation refines the shock waves on the upper and lower surface as well as the wake, the adjoint-based adaptation also refines near the surface and in the region above the airfoil containing acoustic waves that impinge on the trailing edge.

Figure 1. Discretization error in the drag coefficient for transonic flow over an airfoil comparing uniformrefinement, local gradient-based adaptation, and an adjoint, artificial dissipation-based error estimator(reproduced from Dwight3).

Page 3: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

3

B. Discretization Error and Recovery-Based Adaption Since it is the discretization error that one wishes to reduce with mesh adaptation, on the surface it might appear

the discretization error (or its estimate) would serve as an appropriate driver for the adaption process. However, as will be shown in Section V discretization error is not an appropriate mesh adaption criterion.

In the finite element method, an error indicator that is frequently used for mesh adaptation is gradient recovery or reconstruction such as the Zienciwicz-Zhu4 error estimator. The main idea is that gradients of the finite element solution are compared to the gradients found from post-processing patches of neighboring elements. Larger mismatches between these two gradient computations serve as an indicator of larger errors in the gradients. This approach relies on the super-convergent properties of the finite element method which states that for sufficiently smooth solutions, the nodal values of the finite element solution converge at a higher rate than those at other locations.5 In this sense, recovery-based adaption is thus similar to adaption based on the discretization error and is not the ideal driver for mesh adaption. Furthermore, recovery-based adaptation, while possible for the finite element method, may not be feasible for other discretization methods which are not super-convergent.

C. Adjoint-Based Adaption Another promising method for grid adaptation is the adjoint approach. Adjoint methods hold the promise of

estimating the local contribution of each cell or element to the discretization error in any solution functionals of interest (e.g., lift, drag, and moments), and can thus provide targeted mesh adaption depending on the goals of the simulation. The main drawback for adjoint methods is their complexity and code intrusiveness, as evidenced by the fact that adjoint-based adaption has not yet found its way into commercial CFD codes. An example of adjoint-based mesh adaption in CFD is given by Venditti and Darmofal6-8 who successfully applied the method in finite-volume form to inviscid and viscous flow over airfoils at various Mach numbers. While adjoint methods hold much future promise in the area of mesh adaption, they are beyond the scope of the current paper.

D. Truncation Error-Based Adaption In broad terms, the truncation error is the difference between the partial differential equation and its discrete

approximation. As will be discussed in later in Section IV, the truncation error provides the contribution of the local element discretization (cell size, skewness, etc.) to the discretization error. As such, the truncation error is a good indicator of where mesh adaptation should occur. The general concept behind truncation error-based adaption is to equidistribute the truncation error over the entire domain to reduce the total discretization error. For simple discretization schemes, the truncation error can be computed directly. For more complex schemes where direct evaluation of the truncation is difficult, an approach for estimating the truncation error is needed. Section VII discusses two approaches for estimating the truncation error. Furthermore, in the finite element method, a class of error estimators has been developed that rely on the residual.9 This residual is found by inserting the finite element solution, which is made up of basis functions and corresponding coefficients, into the original partial differential equation. As will be shown in Section VII, this residual can be found in a similar manner as one approach for estimating the truncation error. Thus we expect there to be a close relationship between residual-based adaption in the finite element method and truncation error-based adaption with more general discretization schemes.

Figure 2. Adapted grids for transonic flow over an airfoil: a) solution gradient-based adaptation and b) adaptationwith an adjoint-based artificial dissipation estimator (reproduced from Dwight3).

Page 4: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

4

III. Current Approach for Performing Mesh Adaptation Local solution adaption can be conducted by moving points from one region to another (r-adaption), selectively

refining/coarsening cells (h-adaption), or increasing/decreasing the order of accuracy of the method (p-adaption). For general unstructured grid methods the h-adaption approach is the most popular, while for structured grid methods the r-adaption approach is most often used. p-adaption has not found widespread use for CFD problems.1 In addition to mesh refinement, other issues that should be considered when adapting a mesh are mesh quality and the alignment of the mesh with key solution features.

Since the focus of this paper is on methods for driving mesh adaption and not for performing the mesh adaption itself, here we limit ourselves to a simple approach of r-adaption in one dimension based on a linear spring analogy.1 Extensions to handle multiple dimensions are possible based on a torsional spring, which serves to prevent skewing of the multi-dimensional cells. First, a mesh adaptation function φi is created based on solution features (e.g., gradients, curvature), discretization error, truncation error, etc., where i denotes the mesh node point (ordered from 1 to N). A weighting function is then created from the mesh adaptation function as:

qiiW φ= (1)

where q is an exponent that is set to unity in the present work. This weighting function is used to drive the mesh adaption process, with smaller values denoting a region for mesh coarsening and larger values a region for refinement. This weighting function is then passed through a smoothing algorithm to promote smoothness of the mesh adaptation. This smoothing algorithm includes 10 passes of the following smoothing operation for all interior points:

64 11 −+ ++

= iiii

WWWW (2)

Once this weighting function has been determined, it is used to determine a spring constant for linear springs connecting the nodes: ki+1/2 = (Wi + Wi+1)/2. The new nodal location can then be found according to:

)()( 12/112/1 iiiiii xxkxxk −=− ++−−

Nodes with high weighting functions will have higher spring constants and thus promote refinement in that region. The new nodal locations are solved for using an explicit iterative approach according to:

2/12/1

12/112/11

+−

++−−+

++

=ii

mii

miim

i kkxkxkx (3)

The weighting functions are interpolated as the nodes are moved, thus ensuring that the weighting functions are fixed in space for a given mesh adaptation step.

Four different techniques will be used to drive the mesh adaptation process. The first two are feature-based and adapt the mesh based on either the local solution gradients or solution curvature. The third technique adapts the mesh based on the discretization error and the fourth technique adapts the mesh based on the leading truncation error term. These four techniques are summarized below.

1) Solution Gradient: This feature-based adaptation technique sets i

i xu∂∂

2) Solution Curvature: This feature-based adaptation technique sets i

i xu2

2

∂∂

3) Discretization Error (DE): This approach uses the true discretization error in the solution to drive the adaptation process, although the estimated discretization error (e.g., from Richardson extrapolation) could be used in cases where the exact solution is not available: iii uu ~−=φ

Page 5: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

5

4) Truncation Error (TE): This approach uses the leading truncation error terms to drive the adaptation process as discussed in the next section. In this approach, the partial derivatives of the solution and the transformation metrics are replaced by second-order accurate finite difference approximations.

Examples of these different weighting functions applied to steady-state Burgers equation for a Reynolds number

of 32 are shown in Figure 3 for q = 1. Clearly each approach will produce meshes with different adaptation characteristics.

IV. Truncation Error The truncation error is the difference between the discretized equations and the original partial differential

equations. For the simplest case of finite-difference schemes, the truncation error can be found using Taylor series expansions of the solution variable(s). For example, for the smooth function u(x) expanded about the point x0, the Taylor series expansion can be written as

[ ]40

30

3

320

2

2

000

0)(

6)(

2)()()(

!)()(

0000

xxOxxxuxx

xuxx

xuxu

kxx

xuxu

xxx

k

xkk

k

−+−

∂∂

+−

∂∂

+−∂∂

+=−

∂∂

=∑∞

=

A. Burgers Equation in Cartesian Coordinates As an example, consider the steady-state form of Burgers equation given by

0~~~)~( 2

2

=∂∂

−∂∂

=xu

xuuuL ν (4)

where the first term is the nonlinear convection term and the second term is a diffusion term. The notation L(⋅) denotes the differential operator, and is the exact solution to the differential equation. Although technically ordinary derivatives should be used here, the partial differential notation is retained for later extension to multiple dimensions.

A simple second-order accurate finite difference discretization for steady-state Burgers equation is:

022

)( 21111 =⎟⎠⎞

⎜⎝⎛

Δ+−

−⎟⎠⎞

⎜⎝⎛

Δ−

= −+−+

xuuu

xuuuuL iiiii

ihh ν (5)

Figure 3. Steady-state Burgers equation for Reynolds number 32: a) exact solution and numerical solution using 33uniformly spaced nodes and b) example weighting functions for the region -2 ≤ x ≤ 0 based on solution gradients, solutioncurvature, discretization error (DE), and truncation error (TE).

Page 6: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

6

where Lh(⋅) denotes the discrete operator, uh is the exact solution to the discrete equations, and we have assumed a fixed, Cartesian mesh with node spacing h = Δx. To find the truncation error associated with this discretization method, we first find the Taylor series expansions of ui+1 and ui-1 expanded about ui:

[ ]54

4

43

3

32

2

2

1 2462xOx

xux

xux

xux

xuuu

iiiiii Δ+

Δ∂∂

∂∂

∂∂

+Δ∂∂

+=+ (6)

[ ]54

4

43

3

32

2

2

1 2462xOx

xux

xux

xux

xuuu

iiiiii Δ+

Δ∂∂

∂∂

−Δ

∂∂

+Δ∂∂

−=−

(7)

Plugging these expansions into the discrete operator Lh(⋅) and rearranging gives:

[ ]42

4

42

3

3

2

2

126)( xOx

xux

xuu

xu

xuuuL

iii

iiih Δ+

Δ∂∂

−Δ

∂∂

+∂∂

−∂∂

= νν (8)

L(u) -TEh(u)

The right-hand side of Equation (8) can be thought of as the actual differential equation that is solved with the discretization approach. It contains the original partial differential equation, higher-order derivatives of the solution, and coefficients which are functions of the grid spacing to different powers. Since the leading terms are on the order of Δx2, we find that the formal order of accuracy of this method is second order. Equation (8) also tells us that this discretization is consistent since the discrete equations approach the partial differential equation in the limit as Δx goes to zero. Equation (8) can also be written simply as

)()()( uTEuLuL hh += (9)

which states that the partial differential equation is equal to the discretized equation plus the truncation error (TE) associated with the discretization h = Δx. Note that in this form of the equation we have not specified what solution u is used. We will make extensive use of Equation (9) in the following discussion.

B. Burgers Equation in Generalized Coordinates One approach for computing solution on adapted meshes suitable for structured grids is to perform a global

transform of the governing equation. An additional motivation for performing such a global transformation is that it will provide insight into the role of mesh quality on the solution discretization and truncation errors. Following Thompson et al,10 the first derivative in physical space can be transformed into computational space using the transformation ξ = ξ (x) and the truncation error for the centered central difference method can be found as follows (see Ref. 10 for details):

HOTxux

xux

xu

xxuu

xu

xxu ii +

∂∂

−∂∂

−∂∂

−⎟⎠⎞

⎜⎝⎛ −

=∂∂

=∂∂ −+

3

32

2

211

61

21

61

211

ξξξξ

ξξξ

ξξ ξ (10)

L(u) Lh(u) Small Stretching Standard TE

The derivatives of x with respect to ξ (xξ , xξξ , etc.) are called metrics of the transformation and are functions only of the mesh and not the solution itself. On the right-hand side of this equation, the first term is the finite difference equation in transformed coordinates, the second term involving xξξξ goes away when the discrete form of the metrics with the same centered central difference is used, the third term involving xξξ is a grid stretching term, the fourth term involving the square of xξ is the standard leading truncation error term that appears when the equations are discretized in physical space, and HOT refers to higher order terms that can be neglected in the limit as the grid spacing goes to zero. The grid stretching term is zero for a uniformly space mesh, but gets large as the mesh is stretched (e.g., from coarse to fine spacing). The standard truncation error term is proportional to 2

ξx and when it is discretized will approximate the local grid spacing squared:

Page 7: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

7

( ) ( )22

112

2 iii xxxx Δ≈⎟⎠⎞

⎜⎝⎛ −

= −+ξ

This approach for examining the truncation error of the transformed equation illustrates some important features of the truncation error for adapted meshes. First, the truncation error is affected by the mesh resolution (xξ ), the mesh quality (xξξ ), and the local solution derivatives. Second, the quality of a mesh can only be assessed in the context of the solution itself since the grid stretching term xξξ is multiplied by the second derivative of the solution.

In a similar manner, the truncation error for the second-order accurate centered second derivative in non-conservative form can be found to be:

L(u) Lh(u)

( )

HOTxux

xux

xu

xxxx

xu

xxxxx

uuxx

uuux

uxxu

xxu ii

iii

+∂∂

−∂∂

−∂∂⎟⎟⎠

⎞⎜⎜⎝

⎛ −+

∂∂⎟⎟⎠

⎞⎜⎜⎝

⎛ −+

⎟⎠⎞

⎜⎝⎛ −

−+−=∂∂

−∂∂

=∂∂ −+

−+

4

42

3

3

2

2

2

2

3

11311232

2

22

2

121

3143

1212

121

2211

ξξξξ

ξξξξξξ

ξ

ξξξξξξξξξξ

ξ

ξξ

ξξ

ξξ

ξ ξξ (11)

Small Small Stretching Standard TE

The second and third terms on the right-hand side will again be small when the discrete form of the metrics are used. The fourth term involving xξξ is a grid stretching term, and the fifth term involving the square of xξ is the standard leading truncation error term that appears when the equations are discretized in physical space on a uniform grid.

Combining these two truncation error expressions and neglecting the small terms results in the following truncation error formulation for the transformed Burgers equation:

L(u) Lh(u)

( )

HOTxuu

xux

xuu

xux

uuux

uuxx

xuu

xu

xx

xu

xu

xuu

ii

iiiiii

+⎟⎟⎠

⎞⎜⎜⎝

⎛∂∂

−∂∂

+⎟⎟⎠

⎞⎜⎜⎝

⎛∂∂

−∂∂

+

+−−⎟⎠⎞

⎜⎝⎛ −⎟⎟⎠

⎞⎜⎜⎝

⎛+=

∂∂

−∂∂

⎟⎟⎠

⎞⎜⎜⎝

⎛+=

∂∂

−∂∂

−+−+

3

3

4

42

2

2

3

3

11211

32

2

232

2

61223

22

νν

ννξ

νξ

νν

ξξξ

ξξ

ξξ

ξξξ

ξξ

ξ (12)

Stretching Standard TE

Thus the truncation error for Burgers equation contains two main second-order accurate terms. The first is due to grid quality (stretching in 1D) and the second is due to the mesh resolution. For a fixed grid, the mesh stretching term is zero and the standard truncation error terms is exactly equal to the truncation error for Burgers equation discretized in physical space on a uniform grid given in Equation (8).

V. Relationship between Truncation Error and Discretization Error It is well-known that for linear differential equations, the discretization error is transported in the same manner

as the underlying solution. Recall that from the previous section, the governing partial differential equation L(⋅) and the discrete operator Lh(⋅) are exactly solved by u~ (the exact solution to the partial differential equation) and uh (the exact solution to the discrete equations), respectively. Thus we have:

0)~( =uL (13)

and

Page 8: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

8

0)( =hh uL (14)

Furthermore, from Equation (9), we know that the partial differential equation and the discretized equation are related through the truncation error as

)()()( uTEuLuL hh += (15)

Substituting uh into Equation (15) and then subtracting Equation (13) gives:

0)()~()( =−− hhh uTEuLuL (16)

If the equations are linear, then we have )~()~()( uuLuLuL hh −=− . The definition of the discretization error is

uuhh~−=ε (17)

and thus we can rewrite Equation (16) as

)()( hhh uTEL =ε (18)

Equation (18) is the partial differential equation that governs the transport of the discretization error εh through the domain. Furthermore, the truncation error acting upon the discrete solution serves as a source term which governs the local generation or removal of discretization error due to the local discretization parameters (Δx, Δy, etc.). Equation (18) is called the continuous error transport equation. This equation can be solved for the discretization error by discretizing the partial differential equation assuming that the truncation error is known or can be estimated.

If instead the exact solution u~ is substituted into Equation (15), and then Equation (14) is subtracted, we get:

0)~()~()( =−− uTEuLuL hhhh (19)

If the equations are again linear, then we can rewrite Equation (19) as:

)~()( uTEL hhh =ε (20)

Equation (20) is the discrete equation that governs the transport of the discretization error εh through the domain and is therefore called the discrete error transport equation.11 This equation can be solved for the discretization error if the truncation error and the exact solution to the original partial differential equation (or an approximation thereof) are known.

An example of error transport for the Euler equations is shown below in Figure 4, which gives the error in the flowfield density for the inviscid, Mach 8 flow over an axisymmetric sphere-cone.12 Large errors are generated at the bow shock wave where the shock and the grid lines are misaligned. In the subsonic region of the flow (immediately behind the normal shock) these errors are convected along the local streamlines. In the supersonic regions these errors propagate along characteristic Mach lines and reflect off the surface. Additional error is generated at the sphere-cone tangency point, which represents a singularity due to the discontinuity in the surface curvature. Errors from this region also propagate downstream along the characteristic line. An adaptation process which is driven by the global error levels would adapt to the characteristic line emanating from the sphere-cone tangency point, which is not desired. An adaptation process driven by the local contribution to the error should adapt to the sphere-cone tangency point, thus obviating the need for adaption to the characteristic line that emanates from it.

Page 9: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

9

VI. Results: Burgers Equation Burgers equation is a quasi-linear, parabolic partial differential equation of the form

2

2

xu

xuu

tu

∂∂

=∂∂

+∂∂ ν (21)

where u(x,t) is a scalar field. Here the position is given by x, the time by t, and ν is the viscosity. We have selected Burgers equation because it is a quasi-linear scalar equation with a number of known exact solutions.13 Since mesh adaptation will be used, we employ a global transformation ξ = ξ(x) onto uniformly spaced computational coordinates with Δξ = 1. The steady-state form of Burgers equation in transformed coordinates is thus

02

2

23 =∂∂

−∂∂

⎟⎟⎠

⎞⎜⎜⎝

⎛+

ξν

ξν

ξξ

ξξ

ξ

ux

uxx

xu

(22)

where xξ and xξξ are metrics of the transformation. Since Burgers equation in transformed coordinates is mathematically equivalent to the equation in physical coordinates, the exact solution discussed below will solve both equations.

A. Exact Solution We employ the steady-state viscous shock wave exact solution for the results presented herein. This solution is

chosen because it is smooth, non-trivial, and is in the real plane. Dirichlet boundary conditions are u → 2 as x → -∞ and u → -2 as x → ∞. This exact solution is given by

)cosh()sinh(2)(

xxxu′′−

=′ (23)

where the prime denotes a non-dimensional variables. The Reynolds number for Burgers equation can be defined as

νrefref Lu

=Re (24)

Figure 4. Estimated discretization error in the density for hypersonic, inviscid flow over a sphere-cone (reproducedfrom Roy12).

Page 10: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

10

where uref is taken as the maximum value for u(x,t) in the domain (here we set uref = 2 m/s), Lref is the domain width (here we use Lref = 8 m), and the choice for ν specifies the Reynolds number.

This exact solution can be related to dimensional quantities by the following transformations:

ν/and/ refref uLuLxx =′=′ (25)

Furthermore, the exact solution is invariant to scaling by a constant α :

uuxx αα == and/ (26)

For simplicity, we find it convenient to solve Burgers equation in dimensional coordinates on the physical domain -4 m ≤ x ≤ 4 m, choosing α such that the minimum and maximum u values always vary between -2 m/s and 2 m/s.

B. Discretization Approach A fully implicit finite-difference code was developed to solve the steady-state form of Burgers equation using

the following discretization:

( ) 022

11

1112

11

11

3

1

=+−−⎟⎟⎠

⎞⎜⎜⎝

⎛ −⎟⎟⎠

⎞⎜⎜⎝

⎛++

Δ− +

−++

+

+−

++

+ni

ni

ni

ni

ni

ni

ni

ni uuu

xuu

xx

xu

tuu

ξξ

ξξ

ξ

νν (27)

The nonlinear term is linearized and the resulting linear tridiagonal system is solved directly using the Thomas algorithm. This fully implicit method is formally second-order accurate in space for both the convection and diffusion terms as shown in Equation (12). The temporal term is retained and discretized using a backward difference in time. The resulting equations are marched in pseudo-time until the nonlinear system is converged to machine zero, an approximately 12 order of magnitude reduction in the residual since double precision is used. Thus round-off and iterative error can be neglected.

Numerical and exact solutions for Reynolds numbers of 32 and 128 are given in Figure 5a. These numerical solutions were computed on uniform meshes with 33 and 129 nodes for Re = 32 and 128, respectively. In order to verify the Burgers equation code,14 numerical solutions were run for a Reynolds number of 8 using both uniform and nonuniform meshes. The choice of a lower Reynolds number for this code verification study was made to ensure that the convection and diffusion terms were of similar magnitude. The order of accuracy of the discrete L2 norms of the discretization error is given in Figure 5b for increasingly refined meshes up to 513 nodes (h = 1). The numerical solutions quickly approach an observed order of accuracy of two with mesh refinement, thus providing evidence that there are no mistakes in the code which will affect the discretization error.

a) b) Figure 5. a) Numerical and exact solutions for Burgers equation in Cartesian coordinates for Reynolds number 32 and128 and b) order of accuracy of the L2 norms of the discretization error for Reynolds number 8.

Page 11: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

11

C. Mesh Adaption Results: Re = 32 In this section, different methods for driving the mesh adaption are analyzed as well as the case without adaption

(i.e., a uniform mesh). The four different methods for driving the mesh adaptation are: adaption based on solution gradients, adaption based on solution curvature, adaption based on the discretization error (DE), and adaption based on the truncation error (TE). Numerical solutions to steady-state Burgers equation for Reynolds number 32 are given in Figure 6a for the uniform mesh and the four mesh adaption approaches, all using 33 nodes. The final local node spacing is given in Figure 6b for each method and shows significant variations in the vicinity of the viscous shock.

The discretization error is evaluated by subtracting the exact solution from Equation (23) from the numerical

solution. Figure 7a gives the discretization error for all five cases over the entire domain. The uniform mesh has the largest discretization error, while all mesh adaption approaches give discretization errors that are at least one-third of that from the uniform mesh. The different mesh adaption approaches are compared to each other in Figure 7b which shows an enlargement of the region -2.5 ≤ x ≤ 0. Note that the solutions and the discretization errors are all skew-symmetric about the origin, so we may concentrate on only one half of the domain. Truncation error-based adaption gives discretization errors that are less than half of that found from gradient-based adaption, while the other approaches fall in between the two.

a) b) Figure 6. Different adaption schemes applied to Burgers equation for Reynolds number 32: a) numerical solutions andb) local nodal spacing Δx.

Page 12: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

12

As discussed in Section V, the truncation error acts as a local source term for the discretization error. Thus it is

also instructive to examine the truncation error and its components. The truncation error for the uniform mesh case and the case of truncation error-based adaption is given in Figure 8a. The truncation error terms shown are the standard truncation error term, the stretching term, and their sum (TE-Total) as defined by Equation (12). For the uniform mesh, the stretching truncation error term is exactly zero, but the standard truncation error term is large. For the adapted case, the standard and stretching terms are much smaller, and are generally of opposite sign, thus providing some truncation error cancellation. An enlarged view is presented in Figure 8b which shows that the total truncation error (i.e., the sum of the standard and stretching terms) is an order of magnitude smaller for the adapted case than for the uniform mesh.

a) b) Figure 8. Truncation error for a uniform mesh and truncation error-based adaptation (TE) applied to Burgersequation for Reynolds number 32: a) entire domain and b) enlargement of the region -2.5 ≤ x ≤ 0.

a) b)

Figure 7. Discretization error for different adaptation schemes applied to Burgers equation for Reynolds number 32:a) entire domain and b) enlargement of the region -2.5 ≤ x ≤ 0.

Page 13: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

13

The total truncation error for all cases is shown in Figure 9a, with an enlargement showing only the adaption cases given in Figure 9b. The magnitude of the total truncation error is smallest and shows the smoothest variations for the truncation error-based adaption case, while the other three cases show spikes at either x = -0.4 m (gradient) or x = -0.2 m (discretization error and curvature).

The two components of the truncation error, the standard terms and the stretching terms, are given in Figure 10a

and b, respectively. The standard truncation error terms are actually quite similar for all mesh adaption cases, with the gradient-based adaption showing a slightly larger magnitude than the other cases. The biggest differences are seen in the stretching truncation error terms (Figure 10b), where the feature-based adaption cases (gradient and curvature) show large mesh stretching contributions. The truncation error-based adaption approach provides the smallest magnitude of the truncation error due to mesh stretching.

a) b) Figure 10. Truncation error terms for various adaptation approaches applied to Burgers equation for Reynolds number32: a) standard terms and b) stretching terms.

a) b) Figure 9. Total truncation error for various adaptation approaches applied to Burgers equation for Reynolds number32: a) entire domain and b) enlargement of the region -2.5 ≤ x ≤ 0.

Page 14: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

14

D. Mesh Adaption Results: Re = 128 Numerical solutions to steady-state Burgers equation for Reynolds number 128 are given in Figure 11a for the

uniform mesh and the four mesh adaption approaches. The uniform mesh uses 129 nodes, while the four adaption cases use only 65 nodes. The local node spacing variation is given in Figure 11b for each method and shows even larger variations in the spacing in the vicinity of the viscous shock than found for the Reynolds number 32 case (see Figure 6b).

The discretization error for this case is presented in Figure 12. The uniform mesh case with 129 nodes shows the

largest discretization error, while the discretization error-based adaption case with only 65 nodes gives nearly a 50% error reduction. While the other three mesh adaption cases perform better, examination of Figure 12b shows that truncation error-based adaption is clearly better than feature-based adaption, giving peak discretization errors approximately four times smaller than gradient-based adaption and more than two times smaller than curvature-based adaption. When compared to the uniform mesh with 129 nodes, truncation error-based adaption provides a factor of fifteen smaller discretization error while using only half as many nodes.

Figure 12 also has some important implications for applying recovery/reconstruction approaches from the finite element method to mesh adaption. While these methods are generally applied to the gradient of the finite element solution rather than the values themselves, they operate by comparing the local solution gradients to higher-order accurate estimates of the gradients. (The higher-order accurate gradient estimates come from interpolating the solution gradients from the super-convergent locations on the mesh.) Nevertheless, they work by estimating the discretization error in the solution gradients. Figure 12b clearly shows that adapting the mesh based on the discretization error will not provide the most efficient means for mesh adaptation.

a) b) Figure 11. Different adaption schemes applied to Burgers equation for Reynolds number 128: a) numerical solutionsand b) local nodal spacing Δx.

Page 15: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

15

Distributions of the total truncation error for this Reynolds number 128 case are given in Figure 13. As expected,

the truncation error-based adaption provides a small, evenly distributed truncation error over the domain (Figure 13b), while the other adaption methods are significantly larger in magnitude. The curvature-based adaption has a region of negative truncation error followed by a region of positive truncation error. Recall that the truncation error serves as the local source for the discretization error, which is transported by the governing equation. Thus these truncation error sources for curvature-based adaption will provide some cancellation of discretization error due to diffusional processes.

a) b) Figure 13. Total truncation error for various adaptation approaches applied to Burgers equation for Reynolds number128: a) entire domain and b) enlargement of the region -0.5 ≤ x ≤ 0.

a) b) Figure 12. Discretization error for different adaptation schemes applied to Burgers equation for Reynolds number 128:a) entire domain and b) enlargement of the region -0.5 ≤ x ≤ 0.

Page 16: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

16

The standard and stretching term contributions to the truncation error are given in Figure 14a and b, respectively. The standard truncation error terms for both curvature and truncation error-based adaption are of similar magnitude; however, the stretching terms for curvature-based adaption are relatively large. These figures thus illustrate the important interplay between mesh resolution (standard truncation error terms) and mesh quality (stretching terms).

VII. Methods for Approximating the Truncation Error The truncation error can be difficult to derive for complex, nonlinear numerical flux schemes such as Roe’s

method.15 However, if the truncation error can be reliably approximated, then this approximation can be used to drive the mesh adaptation.

Here we present two approaches for approximating the truncation error. Both approaches begin with Equation (9) which is repeated here for convenience:

)()()( uTEuLuL hh += (28)

In the first approach, the exact solution to the partial differential equation u~ is inserted into Equation (28). Since this exact solution will exactly solve the partial differential equation, the term 0)~( =uL , thus allowing the truncation error to be approximated as:

)~()~( uLuTE hh −= (29)

Since this exact solution is generally not known, it could be approximated by plugging an estimate of the exact solution, for example from Richardson extrapolation, into the discrete operator:

)()( REhREh uLuTE −≈ (30)

Alternatively, the solution from a fine grid solution uh could be inserted into the discrete operator for a coarse grid L2h(⋅):

a) b) Figure 14. Truncation error terms for various adaptation approaches applied to Burgers equation for Reynolds number128: a) standard terms and b) stretching terms.

Page 17: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

17

)()( 22 hhhh uLuTE −≈ (31)

Note that the nomenclature 2h implies that the grid spacing on the coarse mesh is twice the grid spacing on the fine mesh h, where the coarse mesh could be formed by eliminating every other point in each direction of a structured mesh. This approach was used by Shih and Qin to estimate the truncation error for use with a discrete error transport equation.11

A second approach for estimating the truncation error is to insert the exact solution to the discrete equations uh into Equation (28). Since this solution exactly solves the discrete equations 0)( =hh uL , we have:

)()( hhh uLuTE = (32)

If a continuous representation of the solution is available then this evaluation is straightforward. For example, for the finite-element method, this is simply the finite element residual as discussed in Section II.D. For other numerical methods (e.g., finite difference and finite volume), a continuous approximation (such as curve or spline fitting) of the numerical solution must be made in order to estimate the truncation error. If a curve fit approximation uCF of the numerical solution uh is used, then substituting this into equation (28) gives:

)()()( CFhCFhCF uTEuLuL += (33)

where uCF = uh + εCF, and εCF is the error in the curve fit approximation. If the discrete operator is linear (or perhaps linearized), then we have

0)()()()()( ≈=+=+= CFhCFhhhCFhhCFh LLuLuLuL εεε (34)

assuming that the curve fitting error εCF is small and since uh exactly solves the discrete operator Lh(⋅). We thus end up with:

)()( CFCFh uLuTE ≈ (35)

This continuous truncation error approximation from Equation (35) was examined using a spline fitting approximation originally proposed by Junkins and Junkaitis.16 This spline fitting approach has been used to develop continuous approximations of 2D heat transfer and Navier-Stokes CFD simulations by Roy and Sinclair17 and is referred to as the Method of Nearby Problems (MNP). The MNP curve fitting procedure involves breaking the numerical solution up into overlapping zones that are approximated with local least squares polynomial fits. These local fits are then merged into one global piecewise approximation using weighting functions which can enforce an arbitrary level of continuity in the solution at the zone boundaries. The result is an analytic expression which can be used to approximate the truncation error.

The MNP curve fitting approach was applied to the one-dimensional steady-state Burgers equation. The Reynolds number was set to 16 and the numerical solution was computed using 129 uniform nodes. The curve fit was generated from the series of 7th order polynomial least squares fits merged together with C3 continuous weighting functions (i.e., continuous up to the third derivative). The numerical solution and curve fit are shown together in Figure 15a. The truncation error was then evaluated by inserting the exact solution into the truncation error terms of Equation (8). This truncation error is compared to the approximated truncation error found by operating the differential operator (i.e., Burgers equation) onto the curve fit according to Equation (35). As shown in Figure 15b, the continuous truncation error approximation provides a good estimate of the actual truncation error over the entire domain.

Page 18: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

18

This same case was examined using the discrete truncation error approximation. Since an exact solution is

available for this case, Equation (29) was used directly. Figure 16 shows that the discrete truncation error approximation, where the exact solution to the partial differential equation is plugged into the discretized equation, also provides a good estimate of the actual truncation error for this case. We have thus demonstrated two different truncation error approximation methods which can be used for cases where the actual truncation error is difficult to estimate.

Figure 16. Burgers equation with Reynolds number 16 solved using a Cartesian mesh with 129 nodes: discreteapproximation of the truncation error from Equation (29) compared to the actual truncation error.

a) b) Figure 15. Burgers equation with Reynolds number 16 solved using a uniform mesh with 129 nodes: a) numericalsolution and curve fit using 32 spline zones and b) estimated truncation error using the continuous approximation fromEquation (35) compared to the actual truncation error.

Page 19: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

19

VIII. Conclusions In this paper we focused on the reduction of discretization error in CFD solutions through the use of mesh

adaptation. The example problem was 1D steady-state Burgers equation which has an exact solution for a viscous shock wave. Two different Reynolds numbers were examined, 32 and 128, with the higher Reynolds number case resulting in a narrow shock region. Four different strategies for driving mesh adaption were examined: solution gradients, solution curvature, discretization error, and truncation error. All approaches provided reduction in discretization error when compared to a uniform mesh solution. Of the four adaption approaches, the truncation error-based adaption provided the smallest discretization errors, generally a factor of two smaller than curvature-based adaption (the next best method). The results showed that gradient-based adaption, which is the most common method found in commercial codes, did not perform well. Furthermore, mesh adaption based on the discretization error, which can be related to recovery/reconstruction methods from the finite element method, performed poorly for the higher Reynolds number case.

The theoretical developments discussed here were focused around Equation (9) which states that the discrete equation is related to the partial differential equation through the truncation error:

)()()( uTEuLuL hh += (9)

Using this equation, the relationship between the truncation error and the discretization error was investigated and it was shown that the truncation error serves as the local source for discretization error transport equations (both continuous and discrete). Furthermore, Equation (9) was used to develop two different methods for approximating the truncation error. Truncation error approximation is critical for the application of truncation error-based adaption when complex discretization schemes are employed.

While adjoint-based mesh adaption schemes are becoming more popular, possibly due to their complexity they have not yet seen widespread use, especially in the commercial CFD community. Truncation error-based adaption appears to provide promising results, and its potential implementation in commercial CFD codes is aided by the fact that there exist approaches for estimating the truncation error rather than computing it directly. Future work on truncation-error based adaption will focus on the Euler and Navier-Stokes equations in multiple dimensions; however, further work is required to extend these approaches to unstructured grids.

Acknowledgments The author would like to thank his graduate students Santhip Kanholy and Matthew Kurzen for providing the

code for solving Burgers equation (Kanholy) and for generating the truncation error approximations in Section VII (Kurzen). Partial support for this work was provided by a grant from Sandia National Laboratories through a U.S. Department of Energy Presidential Early Career Award for Scientists and Engineers.

References 1. Baker, T. J., “Mesh Adaptation Strategies for Problems in Fluid Dynamics,” Finite Elements in Analysis and Design, Vol. 25,

1997, pp. 243-273. 2. McRae, D. S., “r-Refinement Grid Adaptation Algorithms and Issues,” Computer Methods in Applied Mechanics and

Engineering, Vol. 189, 2000, pp. 1161-1182. 3. Dwight, R.P., “Heuristic A Posteriori Estimation of Error due to Dissipation in Finite Volume Schemes and Application to

Mesh Adaptation,” Journal of Computational Physics, Vol. 227, No. 5, 2008, pp. 2845-2863. 4. Zienkiewicz, O. C. and Zhu, J. Z., “A Simple Error Estimator and Adaptive Procedure for Practical Engineering Analysis,”

International Journal for Numerical Methods in Engineering, Vol. 24, 1987, pp. 337-357. 5. Babuska, I., Accuracy Estimates and Adaptive Refinements in Finite Element Computations, Wiley, New York, 1986. 6. D.A. Venditti, D.L. Darmofal, “Adjoint error estimation and grid adaptation for functional outputs: application to quasi-one

dimensional flow,” Journal of Computational Physics, Vol. 164, 2000, pp. 204–227. 7. D.A. Venditti, D.L. Darmofal, “Grid adaptation for functional outputs: application to two-dimensional inviscid flows,”

Journal of Computational Physics, Vol. 176, 2002, pp. 40–69. 8. D.A. Venditti, D.L. Darmofal, “Anisotropic grid adaptation for functional outputs: application to two-dimensional viscous

flows,” Journal of Computational Physics, Vol. 187, 2003, pp. 22–46.

Page 20: Strategies for Driving Mesh Adaptation in CFD (Invited)

American Institute of Aeronautics and Astronautics

092407

20

9. Babuska, I., and Miller, A., “Post-Processing Approach in the Finite Element Method – Part 3: a Posteriori Error Estimates and Adaptive Mesh Selection,” International Journal for Numerical Methods in Engineering, Vol. 20, No. 12, 1984, pp. 2311-2324.

10. Thompson, J. F., Warsi, Z. U. A., and Mastin, C. W., Numerical Grid Generation: Foundations and Applications, Elsevier, New York, 1985.

11. Shih, T. I-P., and Qin, Y. C., “A Posteriori Method for Estimating and Correcting Grid-Induced Errors in CFD Solutions Part 1: Theory and Method,” AIAA Paper 2007-100, Jan. 2007.

12. Roy, C. J., “Grid Convergence Error Analysis for Mixed-Order Numerical Schemes,” AIAA Journal, Vol. 41, No. 4, April 2003, pp. 595-604.

13. Benton, E. R., and Platzman, G. W., “A Table of Solutions of the One-Dimensional Burger’s Equation,” Quarterly of Applied Mathematics, Vol. 30, 1972, pp. 195-212.

14. Roy, C. J., “Review of Code and Solution Verification Procedures for Computational Simulation,” Journal of Computational Physics, Vol. 205, No. 1, 2005, pp. 131-156.

15. Roe, P. L., “Approximate Riemann Solvers, Parameter Vectors, and Difference Schemes,” Journal of Computational Physics, Vol. 43, No. 2, 1981, pp. 357-372.

16. Junkins, J. L., Miller, G. W., and Jancaitis, J. R., “A Weighting Function Approach to Modeling of Irregular Surfaces,” Journal of Geophysical Research, Vol. 78, No. 11, 1973, pp. 1794–1803.

17. Roy, C. J., and Sinclair, A. J., “On the Generation of Exact Solutions for Evaluating Numerical Schemes and Estimating Discretization Error,” to appear in the Journal of Computational Physics, 2009 (doi:10.1016/j.jcp.2008.11.008).