1.1.5.3. The Diffusion of Heaviside and Sinusoidal Input

1.1.5.3.1. New Schemes for Linear Convection

  • Lax-Friedrichs \(\Rightarrow\) stabilizes CD, 1st order

  • Lax-Wendroff \(\Rightarrow\) stable CD with an additional dissipative term, 2nd order

  • Leapfrod \(\Rightarrow\) 2nd order, 3 level scheme (it is not self-starting)

1.1.5.3.2. Heaviside Function Input

The Heaviside Function represents a shock wave in velocity and pressure for compressible flow. One of the great challenges in numerical methods is representing sharp gradients.

  • The Wave Equation for these tests is described as follows:

\[{\partial u \over \partial t} + c {\partial u \over \partial x} = 0\]

1.1.5.3.2.1. Upwind Differencing with \(\sigma = 1\), \(\sigma = 0.5\) and \(\sigma = 0.25\)

\(\sigma = 1\)

  • If the value of \(\sigma = 1\) then the new velocity simply equals the old velocity.

  • The phase angle is zero, so there is no diffusion or dispersion error

\(\sigma = 0.5\)

  • The jump is diffused by the numerical diffusion arising from the first order truncation error

  • The amount of diffusion is increasing as we move through time (as n increases)

  • The numerical speed with which the solution moves through the domain is also reduced

\(\sigma = 0.25\)

  • Clearly, the smaller Courant Number reduces the speed at which the solution travels through the domain

  • At these very low frequencies, there is not much more added diffusion between \(\sigma = 0.50\) and \(\sigma = 0.25\)

(Source code)

(png, hires.png, pdf)

../_images/heavy_side_and_sinusoidal_input-1_01_00.png

(Source code)

(png, hires.png, pdf)

../_images/heavy_side_and_sinusoidal_input-2_01_00.png

(Source code)

(png, hires.png, pdf)

../_images/heavy_side_and_sinusoidal_input-3_01_00.png

1.1.5.3.2.2. Lax-Friedrichs with \(\sigma = 0.5\)

  • Numerical dissipation (more than upwind scheme) and odd-even decoupling

  • Amount of diffusion is still increasing with increasing n

(Source code)

(png, hires.png, pdf)

../_images/heavy_side_and_sinusoidal_input-4_01_00.png

1.1.5.3.2.3. Lax-Wendroff with \(\sigma = 0.5\)

  • This more accurately represents the step change

  • However, there is an oscillatory response

(Source code)

(png, hires.png, pdf)

../_images/heavy_side_and_sinusoidal_input-5_01_00.png

1.1.5.3.2.4. Leapfrog with \(\sigma = 0.5\)

  • More oscillatory than Lax-Wendroff, more accurate than Lax-Friedrichs

(Source code)

(png, hires.png, pdf)

../_images/heavy_side_and_sinusoidal_input-6_01_00.png

1.1.5.3.2.5. Results of Test 1: Heaviside Function

\[\sigma = 0.5\]
\[\Delta x = 0.05\]
\[n_{steps} = 40\]

Why does Lax-Friedrichs show step changes in the output?

This is a double solution effect:

  • \(u_i^{n+1}\) does not depend on \(u_i^n\)

  • Shifting the stencil by \(i\) shows that \(u_i^{n+1}\) and \(u_{i+1}^{n+1}\) do not share a single mesh point of their stencils

  • This is called “odd-even decoupling”

Odd-Even Decoupling: * Solutions on the odd points and even points have different error levels and can’t communicate information * One solution sightly ahead/slightly behind

../_images/lax_friedrichs_2.png

Why does Lax-Wendroff show good comparison with the analytical solution?

  • Lax-Wendroff is second order, so has reduced numerical diffusion

  • However, numerical oscillations occur. More oscillations occur with Leapfrog than Lax-Wendroff

1.1.5.3.3. Sinusoidal Input, \(k = 4 \pi\)

Travelling sinusoidal wave, 2 periods in a distance of 1m. Corresponding wave number:

\[k = {{2 \pi} \over \lambda} = 4 \pi\]

This is the initial condition.

1.1.5.3.3.1. Upwind Differencing with \(\sigma = 0.5\)

  • Amplitude is being diffused, effective numerical diffusion after a number of timesteps

  • Damped by backward difference method

(Source code)

(png, hires.png, pdf)

../_images/heavy_side_and_sinusoidal_input-7_01_00.png

1.1.5.3.3.2. Lax-Friedrichs with \(\sigma = 0.5\)

  • Substantial numerical diffusion over time

(Source code)

(png, hires.png, pdf)

../_images/heavy_side_and_sinusoidal_input-8_01_00.png

1.1.5.3.3.3. Lax-Wendroff with \(\sigma = 0.5\)

  • Better representation of the wave

  • Wiggles at the back of the wave, where there is a non-smooth slope

(Source code)

(png, hires.png, pdf)

../_images/heavy_side_and_sinusoidal_input-9_01_00.png

1.1.5.3.3.4. Leapfrog with \(\sigma = 0.5\)

  • Train of oscillations at the back

(Source code)

(png, hires.png, pdf)

../_images/heavy_side_and_sinusoidal_input-10_01_00.png

1.1.5.3.3.5. Results of Test 2: Sinusoidal Input

\[\sigma = 0.5\]
\[\Delta x = 0.01\]
\[n_{steps} = 200\]

Implications

  • Must avoid 1st order methods for the time propagation of a wave, i.e. Upwind and Lax-Friedrichs

  • Lax-Wendroff and Leapfrog much better, discontinuity causes oscillations in wave

1.1.5.3.4. Sinusoidal Input, \(k = 10 \pi\)

Travelling sinusoidal wave. Corresponding wave number:

\[k = 10 \pi\]

This is the initial condition.

1.1.5.3.4.1. Upwind Differencing with \(\sigma = 0.5\)

(Source code)

(png, hires.png, pdf)

../_images/heavy_side_and_sinusoidal_input-11_01_00.png

1.1.5.3.4.2. Lax-Friedrichs with \(\sigma = 0.5\)

(Source code)

(png, hires.png, pdf)

../_images/heavy_side_and_sinusoidal_input-12_01_00.png

1.1.5.3.4.3. Lax-Wendroff with \(\sigma = 0.5\)

(Source code)

(png, hires.png, pdf)

../_images/heavy_side_and_sinusoidal_input-13_01_00.png

1.1.5.3.4.4. Leapfrog with \(\sigma = 0.5\)

(Source code)

(png, hires.png, pdf)

../_images/heavy_side_and_sinusoidal_input-14_01_00.png

1.1.5.3.4.5. Results of Test 3: High Frequency Sinusoidal Input

\[\sigma = 0.5\]
\[\Delta x = 0.01\]
\[n_{steps} = 200\]

Implications

  • Upwind and Lax Friedrichs are catastrophically dissipative

  • Lax Wendroff shows some dissipation and a lag

  • Leapfrog shows less dissipation, but more oscillations and still a lag

1.1.5.3.5. Summary

1st order schemes:

  • Have poor accuracy - gets even worse for solutions with higher frequency, damping is catastrophic

2nd order schemes:

  • Provide better accuracy

  • Generate numerical oscillations - associated with locations where solution is not smooth. Oscillations are stronger with Leapfrog scheme

  • Numerical errors are sensitive to the frequency content of the solution, i.e frequency content of initial condition

We have obtained results from simple 1D models, however they are representative of real flow situations (2D, 3D etc)