advect report

18
NUMERICAL METHODS Assessment Of Numerical Schemes For Advection By: MAHANTESH NINGARADDY LALITHYA RANI SUKUMAR

Upload: harish-kp

Post on 14-Apr-2016

219 views

Category:

Documents


4 download

DESCRIPTION

Numerical analysis of Advection

TRANSCRIPT

Page 1: Advect Report

!!

!

NUMERICAL METHODS

Assessment Of Numerical Schemes For Advection

!

!

!

By:!

MAHANTESH NINGARADDY

LALITHYA RANI SUKUMAR

Page 2: Advect Report

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Numerical!Methods!!

2!!

1.INTRODUCTION

The advection mechanism is present in most transport equations in mechanical engineering.

In spite of its apparent simplicity, its discretization remains a major issue, in particular for

computational fluid mechanics dedicated to compressible flows, for which strong discontinuities are

likely to appear. For this practical work, we will study the relative performance of standard finite

difference schemes to represent this mechanism. The tests will be carried out on the simplest case of

one-dimensional linear advection equation, discretized on a periodic domain, which is sufficient to

observe the main features of these numerical schemes.

2 Numerical tests

2.1 Upwind first-order (FO) scheme We thus consider the 1D linear advection equation of a scalar ‘u’ at constant velocity ‘c’:

!"!" + !!

!"!" = 0

Apply first order upwind difference method for the above equation. We will first consider the trivial first-order upwind scheme which reads for positive advection velocity:

Put, CFL= c∆t/∆x

Note that, for a negative velocity, the scheme is given in a similar way by inverting the direction of upwinding.

On applying Von Neumann Stability analysis and solving we have,

G= [1- σ (1-cos!θ) + i (-σ sin!θ)]

Where, G = gain/ amplitude factor σ = CFL θ = Phase shift

• 0<CFL≤1 is the stability margin range which we obtained after solving the above equation analytically for Upwind first order scheme. For the same range we have checked stability in program and we got system stable for range 0 to 1. System is unstable for values more than 1. We also saw that for a CFL between -1 and 0, the program also gave a good solution but that is because it changes automatically the direction of upwinding. Unstability occurs when the signal takes more time than the required time, otherwise it is stable.

Page 3: Advect Report

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Numerical!Methods!!

3!!

• Harmonic signal is selected in order to initialize the solution. For a given number of periods, accuracy will increase with the increase in number of points. And for a fixed number of points accuracy will increase by increasing the periods. This is because we are decreasing the number of points per period. Then, the following parameter is obtained:

! = ! λ∆!

Where:

N = Number of points per wavelength

∆! = Wavelength or number of periods

! = Number of points

To maintain the accuracy of the system, N should be constant. If we increase the number of points or decrease the wavelength N increases, in turn we will have high accuracy.

• Following graph shows the error modulus (│G│) as a function of θ for CFL = 0.5.

Fig.1: CFL = 0.5

Now, the result for CFL = 0.1 is shown. When we tried for a CFL = 0.1, we observed that the curve has the same shape as the obtained earlier when we checked for a CFL = 0.9.

Page 4: Advect Report

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Numerical!Methods!!

4!!

Fig.2: CFL = 0.9 = 0.1

In this case we see that for higher values of ‘θ’ we have a smaller error, comparing with the CFL = 0.5 case. We have checked for other values and we can conclude that for this CFL range the maximum amplitude error is obtained for CFL = 0.5.

Now, the result for CFL = 1.1 is shown here the error magnitude is blowing up hence the system is unstable.

Fig.3: Unstable at CFL = 1.1

• For a fixed value of CFL=0.5, The empirical modulus of numerical gain is calculated.

From the gnu plot for 0.5 CFL we have the diffusive error of 0.72357 i.e.

Numerical gain:

!!"#!!"#

= ! ! ! = !0.72357!1! ! 100 = 0.723568

Page 5: Advect Report

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Numerical!Methods!!

5!!

Where:

Amax = Amplitude of the numerical solution

Aref = Amplitude of the exact solution

G = Numerical gain

n = Iterations

! !"" = 0.723568

! = 0.9967

Comparing theoretical and experimental values

The phase shift is given by, θ = !∆! = ! !!!∆!

!∆! = !

1005 = 20

θ = !2!20 = 0.3141

Fig 4: Amplitude Error v/s phase angle

Now for this value of phase shift using the ‘gnu plot’ we obtain the modulus G value from the above

graph.

! = 0.9876

Comparing the theoretical and experimental modulus values we see that error between the values is

very low and negligible.

Page 6: Advect Report

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Numerical!Methods!!

6!!

2.2 Second-order (SO) scheme We will then consider the second-order centered scheme:

For the above scheme the system is unstable hence we will prefer to add a physical diffusion, so that we consider:

Where ‘ν’ stands for the viscosity, and S = !"#!"! the reduced viscosity. Applying Finite difference and

von Neumann stability criterion Amplitude factor is obtained.

G= [1+2s (cos!θ - 1) + i (-σ sin!θ)]

│G│= [1+2s (cos!θ - 1)]2 + (-σ sin!θ)]2 ≤ 1

Solution is given in Apendix

• 0<CFL≤1 is the stability margin range which we got after solving the above equation analytically for Second order scheme. For the same range we have checked stability in program and we got system stable for range 0 to 1. System is unstable for values more than 1.

• For different values of CFL ranging from 0 to 1we checked stability for reduced viscosity, and the system is stable for reduced viscosity range 0.1 to 0.5. After this range the system is unstable.

Fig.5: CFL = 0.4 and S = 0. i.e. system is unstable

Page 7: Advect Report

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Numerical!Methods!!

7!!

Fig.6: CFL = 0.3 and S = 0.5 i.e. system is stable

We tabulated values for ‘s’ varying with CFL value and the graph is plotted for the above, this shows the domain of stability in terms of CFL and reduced viscosity. The area inside the domain represents the stability points. The theoretical estimation of reduced viscosity value for stable condition resulted in following condition ( given in appendix)

S≤ !!!

Fig.7: Stability region

0!

0.2!

0.4!

0.6!

0! 0.2! 0.4! 0.6! 0.8! 1! 1.2!

'S'#

CFL#

CFL#V/S#'S'#

Stable!!

Unstable!!

Page 8: Advect Report

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Numerical!Methods!!

8!!

2.3 Lax-Wendroff (LW) scheme

Lax-Wendroff scheme is built by resorting to i/ a second-order Taylor development in time of the first term of equation 1, ii/ an equivalence transform of the second-order time derivative retained into a second-order space derivative, iii/ a second-order accurate finite difference scheme retained for the spatial derivatives. Lax-Wendroff scheme then reads:

By comparison with the FTCS scheme, we note that it adds a numerical diffusion term which will help to stabilize the computation.

G= [(σ2 cos!θ - σ2 +1) + i (-σ sin!θ)]

│G│= [σ2 cos!θ - σ2 +1]2 + (-σ sin!θ)]2 ≤ 1

• -1<CFL≤1 is the stability margin range which we got after solving the above equation analytically for Lax-Wendroff scheme. For the same range we have checked stability in program and we got system stable for range 0 to 1. System is unstable for values more than 1.

• Diffusive error is more in FO scheme when compared to LW scheme.

Fig.8: FO with CFL=0.5

• Diffusive error is more in SO scheme when compared to LW scheme.

Fig.9: SO with CFL=0.5

Page 9: Advect Report

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Numerical!Methods!!

9!!

• Magnitude of dispersive error is present in LW scheme unlike in other two schemes i.e.FO and SO scheme. Phase shift is lagging in this method.

Fig.10: LW with CFL=0.5

• The solution obtained for an initialization with a square impulse and for fixed CFL = 0.5.

For this particular case, there is less diffusive error when compared to dispersive error (i.e. Phase lag is present). It is seen that the Diffusive error is minimized since we employ the SO scheme, which is more accurate. In this case, some oscillations arise, and these are due to the discontinuity at the corners of the input function. The oscillations are generated by the error in the numerical algorithm as a result of continuous iteration of the process. In case of the Sinusoidal input, the oscillations do not arise due to the absence of discontinuity.

Fig.11: Top hat profile

Page 10: Advect Report

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Numerical!Methods!!

10!!

• The dispersive error is the function of the time step which we are fixing in this case. From the below graphs we observed that as the CFL decreases, in turn the dispersive error increases and vice versa.

CFL = 0.3 CFL = 0.5 CFL = 0.8

Fig.12: Stability

2.3.1 Beam-Warming scheme

Beam-Warming scheme is built on the same principle as LW scheme, but by using now an upwind discretization of spatial derivatives at second order of accuracy instead of centered discretization. For a positive velocity c > 0, it reads:

Note that, for a negative velocity, the scheme is given in a similar way by inverting the direction of upwinding.

LW scheme is modified in order to get BW scheme.

Fig.13: Beam Warming Scheme

Fig.14: Square impulse for CFL=0.7

Page 11: Advect Report

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Numerical!Methods!!

11!!

Solution of Beam Warming scheme and Lax-Wendroff scheme are one and the same, but instead of phase lag we saw phase leading in BW scheme. Dispersive error is upwards and there is less diffusive error and we can neglect it.

• For stability range for CFL values 0 to 2 we got stable system and for the other values system is unstable.

Fig 15: gain v/s phase angle CFL=1=2 Fig 16: gain v/s phase angle CFL=0.5=1.5

Fig 17: gain v/s phase angle CFL=2.1

The evolution of dispersive and dissipative errors as a function of CFL are described below.

As the CFL varies between 0 and 2 there is no dispersive error for same CFL values in stable domain.

But the diffusive error varies. From CFL values of 0 to 0.9 the amplitude or diffusive error decreases

and it will be zero for CFL=1. And then for CFL =1.1 the error will be same as for CFL=0.1. Then

from 1.1 to 1.9 the diffusive error will decrease and will tend to zero for CFL=2.0. Hence there is a

symmetry of diffusive error along CFL=1.0.

The main difference between the Lax wendroff and Beam warming schemes are :

• The stability margin for LW scheme is between CFL range of 0 and 1. For beam

warming scheme it is found to be between 0 and 2.

Page 12: Advect Report

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Numerical!Methods!!

12!!

• Dispersive error lags in LW scheme and its direction is downwards, in BW scheme dispersive error leads and its direction is upwards.

2.4 Fromm scheme Fromm scheme is average expressions of Lax-Wendroff and Beam-Warming schemes.

Modification is done on Lax-Wendroff scheme to initialize the Fromm scheme as shown below

Fig.18: Program alteration

• Fromm scheme is the combination of both LW and BW schemes. In this scheme there is no Diffusive error.

Fromm scheme will become LW scheme for higher CFL values and phase lag in the signal. For lower CFL values this scheme will become BW scheme and phase leads in the signal. Steady solution is obtained for 0.5 CFL. In this case, the Dispersive error is symmetric and there is no Diffusive error.

Fig.19: CFL = 0.9

Page 13: Advect Report

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Numerical!Methods!!

13!!

Fig.20: CFL=0.5

Comparison of hybrid scheme with LW and BW schemes

• For CFL 0.5 value there will be no dispersive as well as diffusive error.

• No oscillations for CFL=1, because it is the mean CFL value for this scheme.

• Range of stability is better when compared to LW and BW scheme.

Fig.21: CFL=1

Conclusion

We have studied different cases

• First Order scheme: This is the simplest numerical scheme. The main advantages are that it is easy to implement and that it results in very stable calculations, but it also very diffusive. Gradients in the flow field tend to be smeared out. This is often the best scheme to start calculations with. The first Order scheme will be stable as long as the CFL lies between 0 and 1 (0 <CFL<1). However, the amplitude error is maximum when CFL=0 .5

• Second order scheme: !This is more accurate than the first order upwind scheme, but it leads to oscillations in the solution due to addition of viscosity term.

Page 14: Advect Report

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Numerical!Methods!!

14!!

• Lax-Wendroff scheme: is second order accurate in both space and time. This scheme is better than the two previous schemes as it has no diffusive error but it has a phase lag. The CFL value near to 1 would be recommended for this scheme.

• Beam Warming scheme: It is implicit second order type. There is no diffusive error but dispersive error is in upward direction i.e phase leads. CFL range for stability is 0 to 2.

• Fromm scheme: This scheme is combination of both LW and BW schemes. There will be no dispersive as well as diffusive error at certain values of CFL. Solution signal coincides with the reference signal. This is the only ideal case.

Page 15: Advect Report

Scanned by CamScanner

Page 16: Advect Report

Scanned by CamScanner

Page 17: Advect Report

Scanned by CamScanner

Page 18: Advect Report

Scanned by CamScanner