concepts and numerical experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/slide/21-artificial...

25
Numerical Dissipation ( 耗散 ), Dispersion( 离差) and Artificial Viscosity Concepts and Numerical Experiments

Upload: others

Post on 10-Mar-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

Numerical Dissipation ( 耗散 ) , Dispersion( 离差)

and Artificial Viscosity

Concepts and Numerical Experiments

Page 2: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

Introduction:Are you solving the original partial differential equation ?

• Many aspect of life are never quite what they appear to be at first impression.

• We think that numerical solutions of the Euler or N-S equations are being obtained within an accuracy determined by the truncation and round-off errors.

• But it is more complicated than you thought.

• We will take a different point of view on the partial differential equations and finite difference expressions.

• A simple one-dimensional wave equation will be use to illustrate the concepts on dissipation and dispersion.

Page 3: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

An example

• For simplicity, consider the one-dimensional wave equation

0 0 (6.38)u ua at x

∂ ∂+ = >

∂ ∂

• We solve it numerically by using a first-order forward difference in time and a a first-order rearward difference in space

1 0 (6.39)t t t t ti i i iu u u ua

t x

+∆

−− −+ =

∆ ∆

• We know that the accuracy of the above Eq. is given by O(∆t, ∆x).

Page 4: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

A Different Viewpoint• We replace ui

t+∆t and ui-1t in Eq.(6.39) with Taylor series

expansions as follows:2 2 3 3

2 3

( ) ( ) (6.40)2 6

t ttt t ti i

i i i

u u t u tu u tt t t

+∆ ⎛ ⎞ ⎛ ⎞∂ ∂ ∆ ∂ ∆⎛ ⎞= + ∆ + + +⎜ ⎟ ⎜ ⎟⎜ ⎟∂ ∂ ∂⎝ ⎠ ⎝ ⎠ ⎝ ⎠

2 2 3 3

1 2 3

( ) ( ) (6.41)2 6

t ttt ti i

i i i

u u x u xu u xx x x−

⎛ ⎞ ⎛ ⎞∂ ∂ ∆ ∂ ∆⎛ ⎞= − ∆ + − +⎜ ⎟ ⎜ ⎟⎜ ⎟∂ ∂ ∂⎝ ⎠ ⎝ ⎠ ⎝ ⎠

• Substitute Eqs. (6.40) and (6.41) into (6.39)

2 2 3 3

2 3

2 2 3 3

2 3

( ) ( )2 6

( ) ( ) 0 (6.42)2 6

t tt

i i i

t tt

i i i

u u t u tt t t

u u t u tax x x

⎡ ⎤⎛ ⎞ ⎛ ⎞∂ ∂ ∆ ∂ ∆⎛ ⎞ + + +⎢ ⎥⎜ ⎟ ⎜ ⎟⎜ ⎟∂ ∂ ∂⎝ ⎠⎢ ⎥⎝ ⎠ ⎝ ⎠⎣ ⎦⎡ ⎤⎛ ⎞ ⎛ ⎞∂ ∂ ∆ ∂ ∆⎛ ⎞+ − + + =⎢ ⎥⎜ ⎟ ⎜ ⎟⎜ ⎟∂ ∂ ∂⎝ ⎠⎢ ⎥⎝ ⎠ ⎝ ⎠⎣ ⎦

Page 5: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

• Rearranging Eq. (6.42), we obtain

2 3 3

2 3

2 3 2

2 3

( )2 6

( ) (6.43)2 6

t tt t

i i i it t

i i

u u u t u tat x t t

u a x u a xx x

⎛ ⎞ ⎛ ⎞∂ ∂ ∂ ∆ ∂ ∆⎛ ⎞ ⎛ ⎞+ = − −⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟∂ ∂ ∂ ∂⎝ ⎠ ⎝ ⎠ ⎝ ⎠ ⎝ ⎠

⎛ ⎞ ⎛ ⎞∂ ∆ ∂ ∆+ − +⎜ ⎟ ⎜ ⎟∂ ∂⎝ ⎠ ⎝ ⎠

• The left-hand side is exactly the left-hand side of the original partial differential equation given by Eq. (3.38).

• The right -hand side of Eq. ( 6.43) is the truncation error associated with the difference equation.

• The truncation error is O(∆t, ∆x).

Page 6: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

• Differentiate Eq. (6.43) with respect to t

2 2 3 4 2 3 4 2

2 3 4 2 3

( ) ( ) (6.44)2 6 2 6

u u u t u t u a x u a xat x t t t x t x t

∂ ∂ ∂ ∆ ∂ ∆ ∂ ∆ ∂ ∆+ = − − + − +

∂ ∂ ∂ ∂ ∂ ∂ ∂ ∂ ∂

• Differentiate Eq. (6.43) with respect to x and multiply by a2 2 3 4 2 3 2 4 2 2

22 2 3 3 4

( ) ( ) (6.45)2 6 2 6

u u u a t u t u a x u a xa ax t x t x t x x x∂ ∂ ∂ ∆ ∂ ∆ ∂ ∆ ∂ ∆

+ = − − + − +∂ ∂ ∂ ∂ ∂ ∂ ∂ ∂ ∂

• Subtracting Eq. (6.45) from (6.44), we have

2 2 3 4 2 3 4 22

2 2 3 4 2 3

3 4 2 3 2 4 2 2

2 3 3 4

( ) ( )2 6 2 6

( ) ( ) (6.46)2 6 2 6

u u u t u t u a x u a xat t t t x t x t

u a t u a t u a x u a xt x t x x x

∂ ∂ ∂ ∆ ∂ ∆ ∂ ∆ ∂ ∆= − − + −

∂ ∂ ∂ ∂ ∂ ∂ ∂ ∂∂ ∆ ∂ ∆ ∂ ∆ ∂ ∆

+ + − + +∂ ∂ ∂ ∂ ∂ ∂

Page 7: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

• In more compact form by displaying only the first-order terms

2 2 3 3 3 32 2

2 2 3 2 2 3( ) ( ) (6.47)2 2

u u t u u x u ua O t a a O xt x t t x x t x

⎡ ⎤ ⎡ ⎤∂ ∂ ∆ ∂ ∂ ∆ ∂ ∂= − + + ∆ + − + ∆⎢ ⎥ ⎢ ⎥∂ ∂ ∂ ∂ ∂ ∂ ∂ ∂⎣ ⎦ ⎣ ⎦

• Now we treat the third time derivative on the right-hand side of Eq. (6.43) , differentiating Eq.(6.47) with respect to time, yielding

3 32

3 2 ( , ) (6.48)u ua O t xt x t

∂ ∂= + ∆ ∆

∂ ∂ ∂

Differentiating Eq.(6.45) with respect to x and multiply by a3 3

2 32 3 ( , ) (6.49)u ua a O t x

x t x∂ ∂

+ = ∆ ∆∂ ∂ ∂

Adding Eqs(6.48) and (6.49)3 3

33 3 ( , ) (6.50)u ua O t x

t x∂ ∂

= − + ∆ ∆∂ ∂

Page 8: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

• Now we have to treat the mixed derivatives with respect to t and x– Differentiating Eq. (6.47) with respect to x, we have

3 32

2 3 ( , ) (6.51)u ua O t xt x x∂ ∂

= + ∆ ∆∂ ∂ ∂

– Rearranging Eq. (6.48), we have

3 3

2 2 3

1 ( , ) (6.52)u u O t xx t a t∂ ∂

= + ∆ ∆∂ ∂ ∂

– Substituting Eq. (6.50) into (6.52), we have

3 3

2 3 ( , ) (6.53)u ua O t xx t x∂ ∂

= − + ∆ ∆∂ ∂ ∂

Page 9: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

• Substituting Eqs (6.50), (6.51) and (6.53) into (6.47)

2 2 3 32 3 3

2 2 3 3

3 32 2

3 3

( , )2

( , ) (6.54)2

u u t u ua a a O t xt x x x

x u ua a O t xx x

⎡ ⎤∂ ∂ ∆ ∂ ∂= − + + ∆ ∆⎢ ⎥∂ ∂ ∂ ∂⎣ ⎦

⎡ ⎤∆ ∂ ∂+ − − + ∆ ∆⎢ ⎥∂ ∂⎣ ⎦

• Substituting Eqs (6.54) and (6.50) into (6.43)

2 2 3 3 2 3 2

2 3 3

3 3 2 2 2 3 2

3 2 3

3 2 2 3

( ) ( )( )2 2 2

( ) ( )6 2 6

[( ) , ( ) ( ), ( )( ) , ( ) ] (6.56)

u u u a t u a t u a x tat x x x x

u a t u a x u a xx x x

O t t x t x x

∂ ∂ ∂ ∆ ∂ ∆ ∂ ∆ ∆+ = − − +

∂ ∂ ∂ ∂ ∂∂ ∆ ∂ ∆ ∂ ∆

+ + −∂ ∂ ∂

+ ∆ ∆ ∆ ∆ ∆ ∆

Page 10: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

• Rearranging Eq. (6.55), along with definition of ν as ν =a ∆t/∆x, 2 2 3

22 3

3 2 2 3

( )(1 ) (3 2 1)2 6

[( ) , ( ) ( ), ( )( ) , ( ) ] (6.56)

u u a x u a x uat x x x

O t t x t x x

ν ν ν∂ ∂ ∆ ∂ ∆ ∂+ = − + − −

∂ ∂ ∂ ∂+ ∆ ∆ ∆ ∆ ∆ ∆

• Discussion on Eq. (6.56)

• Eq. (6.56) is a partial differential equation in its own right

• Previous viewpoint on the solution• An exact solution (no round-off error) of the difference equation,

Eq.(6.39) constitutes a numerical solution of the original partial differential equation given by Eq.(6.38) but with an error given by the truncation error.

• Another way of viewpoint on the solution• In reality, the exact solution (no round-off error) of the difference

equation, Eq.(6.39) constitutes an exact solution ( no truncation error)of a different partial differential equation, namely , Eq.(6.56),

• Eq. (5.56) is a modified equation .

Page 11: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

Are you solving the original partial differential equation ?

• Discussion on Eq. (6.38) and (6.56) – When the difference equation, Eq. (6.39), is used to obtain a numerical

solution of the original partial differential equation, Eq. (6.38), in reality this difference equation is solving quite a different partial equation – it is solving Eq. (6.56) instead of Eq. (6.38).

2 2 32

2 3

3 2 2 3

( )(1 ) (3 2 1)2 6

[( ) , ( ) ( ), ( )( ) , ( ) ] (6.56)

u u a x u a x uat x x x

O t t x t x x

ν ν ν∂ ∂ ∆ ∂ ∆ ∂+ = − + − −

∂ ∂ ∂ ∂+ ∆ ∆ ∆ ∆ ∆ ∆

10 (6.38) 0 (6.39)t t t t ti i i iu u u uu ua a

t x t x

+∆−− −∂ ∂

+ = ⇒ + =∂ ∂ ∆ ∆

The original partial differential equation

The modified partial differential equation

Page 12: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

Before we examine Eq. (6.56), let’s review the N-S Eqs

• Euler equations (inviscid flow)

• N-S equations

0u u u u pu v wt x y z xρ

∂ ∂ ∂ ∂ ∂+ + + + =

∂ ∂ ∂ ∂ ∂

223

Du p u u v w uDt x x x y y x z x z

ρ µ µ µ µ⎡ ⎤⎛ ⎞∂ ∂ ∂ ∂ ∂ ∂ ∂ ⎡ ∂ ∂ ⎤⎛ ⎞ ⎛ ⎞+ = − ∇⋅ + + + +⎢ ⎥⎜ ⎟⎜ ⎟ ⎜ ⎟⎢ ⎥∂ ∂ ∂ ∂ ∂ ∂ ∂ ∂ ∂⎝ ⎠ ⎝ ⎠⎣ ⎦⎝ ⎠⎣ ⎦

V

These terms represent the dissipative aspect of the physical viscosity

Page 13: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

Now compare the Eq. (6.56) to the N-S Eqs

• N-S equations223

Du p u u v w uDt x x x y y x z x z

ρ µ µ µ µ⎡ ⎤⎛ ⎞∂ ∂ ∂ ∂ ∂ ∂ ∂ ⎡ ∂ ∂ ⎤⎛ ⎞ ⎛ ⎞+ = − ∇⋅ + + + +⎢ ⎥⎜ ⎟⎜ ⎟ ⎜ ⎟⎢ ⎥∂ ∂ ∂ ∂ ∂ ∂ ∂ ∂ ∂⎝ ⎠ ⎝ ⎠⎣ ⎦⎝ ⎠⎣ ⎦

V

• Eq. (6.56)2 2 3

22 3

3 2 2 3

( )(1 ) (3 2 1)2 6

[( ) , ( ) ( ), ( )( ) , ( ) ] (6.56)

u u a x u a x uat x x x

O t t x t x x

ν ν ν∂ ∂ ∆ ∂ ∆ ∂+ = − + − −

∂ ∂ ∂ ∂+ ∆ ∆ ∆ ∆ ∆ ∆

• The term ∂2u/∂x2 acts as a dissipative term, much like the viscous terms in N-S Eqs.

• This term is a consequence of the numerical discretization embodied in the difference equation, and is purely of numerical origin, with no physical meanings.

• The appearance of this term is called numerical dissipation .• The coefficient in this term act much like the physical viscosity and is

called the artificial viscosity.

Page 14: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

An example of effect of numerical dissipation

• The original PDE is to describe the propagation of a wave through an inviscid fluid in one dimension.

Initial wave at time t = 0 Shape of the wave at some time t > 0

The reason is that the exact numerical solution of the difference equation, Eq. (6.39), is a solution of Eq. (6.56) instead of the original PDE (6.38)

Page 15: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

Numerical Dispersion• Dispersion results in a distortion of the propagation of

different phases of a wave, which shows up as “wiggles”in front of and behind the wave.

Initial wave at time t = 0 Shape of the wave at some time t > 0

Page 16: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

Difference between numerical dissipation and dispersion

• The modified equation has the even-order derivatives (∂2u/∂x2) and the odd-order derivatives (∂3u/∂x3) on the right-hand side.

• Numerical dissipation is the direct result of the even-order derivatives, while numerical dispersion is the direct result of odd-order derivatives.

• When the leading term of the truncation error is an even-order derivative, numerical solution will display mainly dissipative behavior, and when the leading term of the truncation error is an even-order derivative, numerical solution will display mainly dispersion behavior.

2 2 32

2 3

3 2 2 3

( )(1 ) (3 2 1)2 6

[( ) , ( ) ( ), ( )( ) , ( ) ] (6.56)

u u a x u a x uat x x x

O t t x t x x

ν ν ν∂ ∂ ∆ ∂ ∆ ∂+ = − + − −

∂ ∂ ∂ ∂+ ∆ ∆ ∆ ∆ ∆ ∆

Page 17: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

Discussion on the artificial viscosity

• Where does it come from ?– The artificial viscosity is present implicitly in numerical

solution because of the form of the modified equation

• What are its impacts on a solution ?– Bad thing

• The artificial viscosity compromises the accuracy

– Good thing• It always serves to improve the stability of a solution.

Page 18: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

Discussion on the artificial viscosity

• Why use the artificial viscosity explicitly in some cases ?– For many applications in CFD, the solution does not have enough

artificial viscosity implicitly in the algorithm.

– The solution will go unstable unless the artificial viscosity is added explicitly to the calculation.

– A typical cases that may need to add the artificial viscosity to the calculation.

• Flow problems with very strong gradients, such as shock waves are particularly sensitive and usually require the explicit addition of artificial viscosity for stable and smooth solution.

Page 19: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

A specific form of artificial viscosity

• Consider the governing flow Eqs for 2-D flow

• We use MacCormack’s technique to solve the Eqs.

(6.57)U F G Jt x y

∂ ∂ ∂= − − +

∂ ∂ ∂

Where U is the solution vector, 2[ , , , ( / 2)]U u v e Vρ ρ ρ ρ= +

Page 20: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

• At each step of time-marching solution, a small amount of artificial viscosity can be added

1, , 1,, 1, , 1,

1, , 1,

, 1 , , 1, 1 , , 1

, 1 , , 1

2( 2 )

2

2( 2 ) (5.58)

2

t t tx i j i j i jt t t t

i j i j i j i jt t ti j i j i j

t t ty i j i j i j t t t

i j i j i jt t ti j i j i j

C p p pS U U U

p p p

C p p pU U U

p p p

+ −+ −

+ −

+ −+ −

+ −

− += − +

+ +

− ++ − +

+ +

• It is a forth-order numerical dissipation expression

• It is equivalent to adding an extra forth-order term to the right-hand side of the modified equations

• Cx and Cy are two arbitrarily specified parameters ranging from 0.1 to 0.3

• On the predictor step, Sti,j is evaluated based on the know

quantities at time t using Eq. (5.58)

Page 21: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

• On the corrector step, the values on the right-hand side Eq. (6.58) are the predicted quantities.

1, , 1,1, , 1,,

1, , 1,

, 1 , , 1, 1 , , 1

, 1 , , 1

2( 2 )

2

2( 2 ) (5.59)

2

t t t

x i j i j i j t t tti j i j i ji j t t t

i j i j i j

t t t

y i j i j i j t t ti j i j i jt t t

i j i j i j

C p p pS U U U

p p p

C p p pU U U

p p p

+ −

+ −

+ −

+ −

+ −

+ −

− += − +

+ +

− ++ − +

+ +

• Let us take U = ρ

On the predictor step , , ,,

(6.60)t

t t t t ti j i j i j

i j

t Stρρ ρ

+∆ +∆ ∂⎛ ⎞= + ∆ +⎜ ⎟∂⎝ ⎠

On the corrector step ,, , (6.61)t tt t t ti ji j i j

av

t Stρρ ρ

+∆+∆ +∆ ∂⎛ ⎞= + ∆ +⎜ ⎟∂⎝ ⎠

Page 22: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

Numerical experiments of the impact of artificial viscosity

• The example problem

• The flow field is calculated by means of a time marching numerical solution of N-S Eqs. Using the MacCormack technique

• We use the expression for artificial viscosity with different values of Cx and Cy

Page 23: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

Impact on the pressure contours

• As the magnitude of the artificial viscosity is progressively increased, the solution behaves in a more stable fashion, but the structure of the resulting stead-state flow are somewhat different.

• No wiggles in Fig. (d)

• The recompression shock has been smoothed by the increased numerical dissipation

Page 24: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

Discussions on the Numerical experiments

• The impact of the artificial viscosity on the qualitative aspects of a flow solution is like that of the physical viscosity µ.– By increasing the artificial viscosity, shock wave are thickened

and smoothed, just like an increased physical coefficient of viscosity would cause.

• Selecting a reasonable artificial viscosity still is a highly empirical aspect of CFD solutions.– You will usually play around with various amounts of artificial

viscosity until you are satisfied with the quality of the solution.

Page 25: Concepts and Numerical Experiments - nuaa.edu.cnaircraftdesign.nuaa.edu.cn/aca/Slide/21-Artificial Viscosity.pdf · artificial viscosity implicitly in the algorithm. – The solution

Final Remarks

• The purpose of this lecture is to introduce – Concepts of dissipation and dispersion

– The use of in algorithms for stabilization and smoothing of the numerical solutions

– Numerical experiments to illustrate the impact of the artificialviscosity

• Some advanced concepts, such as theTVD (total-variation-diminishing), automatically use only the proper amount of the artificial viscosity only in regions where it is needed.