1.1.5.5. Spectral Analysis of Errors¶
1.1.5.5.1. von Neumann Stability Analysis¶
von Neumann stability analysis introduced a Fourier decomposition of the solution, defining an amplification factor, G, \(\Rightarrow\) stability condition G < 1
What else can we know about the errors?
Amplitude error \(\Rightarrow\) numerical diffusion
Phase error \(\Rightarrow\) numerical dispersion
We introduced a Fourier decomposition of the solution (where \(I = \sqrt{-1}\)):
A single harmonic is:
We define an amplification factor:
A function of the scheme parameters and of the phase angle \(\phi\) but not a function of \(n\)
von Neumann stability condition:
1.1.5.5.2. Amplitude and Phase Error¶
Now we want additional information on the error, in particular the time dependency of the:
Amplitude \(V^n\)
Phase \(\phi\)
1.1.5.5.2.1. Analytical Solution¶
Consider the analytical solution of:
Fourier decomposition - analytical solution is \(\tilde{u}\):
Rewrite with \(c = {{\tilde{\omega}} / k}\):
A single harmonic is:
With \(\hat{V}(k)\) from the initial condition \(u(x,t=0) = u_0(x)\) we get an initial amplitude:
Assume that I.C. is represented exactly on the mesh (except for round-off error)
1.1.5.5.2.2. Numerical Solution¶
Numerical amplitude represented similarly to (1) (\(\omega\) is analytical):
Phase waves \(\tilde{\omega} = \tilde{\omega}(k) \Rightarrow\) called a “dispersion relation”
Now write:
Hence:
Similarly with the analytical solution:
Where: \(\tilde{G}\) is the exact amplification factor
Note that \(\omega\) is a complex function, so:
And
1.1.5.5.2.3. Diffusion and Dispersion Error¶
For convection dominated flows \(\tilde{\phi} = kc \Delta t\) and \(\left | \tilde{G} \right | = 1\):
The error in amplitude is the diffusion or dissipation error:
The error in the phase of the solution is the dispersion error:
For pure diffusion \(\tilde{\phi} = 0\) so therefore use the alternative definition:
1.1.5.5.3. Error Analysis for Hyperbolic Problems¶
Considering 1D linear convection, we will define:
Leading error as numerical convection is faster than physical
Lagging error as numerical convection is slower than physical
We will also analyse the 1st-order upwind scheme
1.1.5.5.3.2. Analytical Solution¶
The exact solution for a wave form: \(\tilde{\omega} = ct\)
And:
Exact amplification factor \(\left | \tilde{G} \right | = 1\) and
Therefore
i.e. the exact solution propagates without change in amplitude For example, the exact solution of the wave equation with square wave input simply moves to the right with positive c
1.1.5.5.3.3. Numerical Solution¶
Initial wave damped by a factor \(\left| G \right|\) at each \(\Delta t\)
Diffusion error is \(\epsilon_D = \left| G \right|\)
Phase of numerical solution defines a numerical convection speed:
And since:
Dispersion error:
1.1.5.5.3.4. Leading and Trailing Error¶
When the dispersion error is larger than 1 \(\epsilon_\phi \gt 1\) the phase error is a “leading error”, the numerical convection speed \(c_{num}\) is larger than the exact \(c\). The computed solution moves faster than the physical one.
When \(\epsilon_{\phi} \lt 1\) the phase error is a lagging error and the computed solution travels at a lower velocity than the physical one.
1.1.5.5.3.5. Accuracy and Stability Paradox¶
Accuracy requires \(\left| G \right |\) to be as close to 1 as possible, but stability requires \(\left | G \right | \lt 1\).
To maintain stability we always need a diffusion error.
1.1.5.5.4. Analysis of 1st Order Upwind¶
We found:
Separate real and imaginary parts of \(G\), \(\xi\), \(\eta\)
Amplitude error:
Phase error:
1.1.5.5.4.1. Dispersion (Phase) Error for 1st Order Upwind¶
For \(\sigma \gt 0.5 \Rightarrow \epsilon_\phi \gt 1 \Rightarrow\) Leading Error
For \(\sigma = 0.5 \Rightarrow \epsilon_\phi = 1 \Rightarrow\) No Error
For \(\sigma \lt 0.5 \Rightarrow \epsilon_\phi \lt 1 \Rightarrow\) Lagging Error
1.1.5.5.4.2. Diffusion (Amplitude) Error for 1st Order Upwind¶
Using \(\sigma = 0.5\) may give no dispersion error, but gives large diffusion error
The amplitude error increases dramatically with an increase in “frequency” i.e. reduced wavelength
Explanation of the Frequency Axis¶
Phase:
Wavenumber:
So Phase i.t.o Wavenumber:
Highest frequency you can represent in a mesh given by \(\lambda = 2 \Delta x \quad \Rightarrow \quad \phi = \pi\)
Test 1¶
\(k = 4 \pi\) and \(\phi = {\pi \over {12.5}}\)
Diffusion Error = 0.995
For 80 timesteps \(\left| G \right| ^n = (0.995)^{80} = 0.67\)
Test 2¶
\(\phi = {\pi \over {6.25}} = 28.8^{\circ}\)
For 80 timesteps \(\left| G \right| ^n = (0.98)^{80} = 0.20\)
This is a problem for first order schemes:
Only a small diffusion error (1%) for one timestep after 100 timesteps will lead to an amplitude error of 36%
1.1.5.5.5. Analysis of Lax-Friedrichs¶
Diffusion error:
Dispersion error:
1.1.5.5.5.1. Diffusion Error for Lax-Friedrichs¶
Amplitude strongly damped for small values of \(\sigma\)
No diffusion error for \(\phi = 0\) and \(\phi = \pi\)
\(\phi = \pi\) is related to the minimum realisable wavelength \(2 \Delta x\)
Any errors that occur at \(2 \Delta x\) will not be damped by the solution, which is related to the odd-even decoupling (the value of the point at i, n+1 doesn’t depend on the value at i, n)
1.1.5.5.5.2. Dipersion Error for Lax-Friedrichs¶
Dispersion error \(\epsilon_{\Phi} \gt 1 \quad \Rightarrow \quad\) Leading Error
1.1.5.5.6. Analysis of Lax-Wendroff¶
Dissipation error:
Dispersion error:
1.1.5.5.6.1. Diffusion Error for Lax-Wendroff¶
Diffusion Error is close to one for a large phase range
Test 2¶
\(\phi = {\pi \over {6.25}} = 28.8^{\circ}\)
For \(sigma = 0.8 \qquad \epsilon_D = 0.9985\)
After 80 timesteps \(\left| G \right| ^n = (0.9985)^{80} = 0.89\)
1.1.5.5.6.2. Dispersion Error for Lax-Wendroff¶
1.1.5.5.7. Summary¶
1.1.5.5.7.1. Spectral Analysis¶
Error in amplitude or diffusion error:
Error in the phase or dipsersion error:
For a hyperbolic problem \(\left| \tilde{G} \right| = 1\)
Looked at plots of \(\epsilon_D\), \(\epsilon_{\phi}\) vs \(\phi ( = k \Delta x)\) with \(\sigma\) as parameter
1.1.5.5.7.2. 1st order Upwind¶
\(\epsilon_D\) decreases away from 1 quickly with increasing frequency. For high frequencies damping is very large - very difficult to use 1st order upwind for any transport problems
\(\epsilon_{\phi} \lt 1\) (lagging error - numerical convection velocity is slower than analytical) for \(\sigma \gt 0.5\)
\(\epsilon_{\phi} \gt 1\) (leading error) for \(\sigma \lt 0.5\)
\(\epsilon_{\phi} = 1\) (no error) for \(\sigma = 0.5\)
1.1.5.5.7.3. Lax-Friedrichs¶
Why? Introduced to stabilize FTCS
What? Introduced considerable numerical diffusion
\(\epsilon_D\) shows strong damping for smaller \(\sigma\) and no damping for \(\phi = \pi\) any errors that appear in the solution at twice the mesh size will not be damped - results in the staircase “jagged” result observed for the 1D Burgers Equation.
\(\epsilon_{\phi} \gt 1\) (leading error)
1.1.5.5.7.4. Lax-Wendroff¶
Second Order Method - little numerical diffusion
Oscillations appear in the solution - especially where the solution is non-smooth
\(\epsilon_D\) shows larger accurate region where \(\epsilon_D = 1\)
\(\epsilon_{\phi} \lt 1\) (lagging error)
1.1.5.5.8. Analysis of Leapfrog¶
1.1.5.5.8.1. Diffusion Error¶
Note that \(\left| G \right| = 1 \quad \Rightarrow \quad\) No diffusion error
Leapfrog scheme is useful for simulations that are required for long-time simulations e.g. weather forecast codes
Can have stability problems with non-linear PDEs
1.1.5.5.8.2. Dispersion Error¶
\(\epsilon_{\phi} \lt 1\) (lagging error)
Accurate results for smooth solutions \(u(x)\) smooth:
Amplitudes correctly modelled
Low frequencies, the phase error is close to 1
Neutral stability \(\left| G \right| =1\) for all \(\sigma\) some problems, as high frequency errors are not damped
Leapfrog unstable for Burgers Equation. Not good for any high speed flows with shocks
1.1.5.5.9. What is the Origin of the Oscillations?¶
Have not explained the origin of oscillations
We can explain why they occur behind the travelling wave
Oscillations have high frequency
Dispersion error \(\epsilon_{\phi} \lt 1\) for LW and Leapfrog (especially at higher frequency) - Convection speed of errors is slower than the physical one
Leapfrog \(\epsilon_{\phi} \Rightarrow 0\) for \(\phi \Rightarrow \pi\) and so oscillations are stronger than for LW
1.1.5.5.10. Analysis of Beam-Warming¶
Consider an alternative scheme due to Beam and Warming
1.1.5.5.10.1. Lax-Wendroff¶
Recalled derivation of LW for linear convection:
Lax Wendroff uses CD for the derivatives
1.1.5.5.10.2. Beam-Warming¶
Beam-Warming uses 2nd order upwind for the derivatives
Diffusion Error¶
Conditionally stable for \(0 \le \sigma \le 2\)
Diffusion error:
Dispersion Error¶
Beam-Warming shows flat region for a range of frequencies
Dispersion error \(\epsilon_{\phi} \gt 1\) for \(\sigma \lt 1\)
Numerical solution will move faster than analytical solution. High frequency oscillations should move ahead of the solution.
1.1.5.5.11. Final Notes¶
1st order schemes generate large errors - not recommended
2nd order schemes acceptable errors - but should be careful with oscillations at higher frequencies
1.1.5.5.12. Implications of Diffusion Error for Grid Density¶
Look at plot for \(\epsilon_D\) for LW, establishes a phase angle limit. We require \(\epsilon_D\) close to 1. Choose \(\phi_{lim} = 10^{\circ} = {\pi \over {18}}\) (arbitrarily).
Key quantity defining accuracy:
Number of mesh points per wavelength = \(N_{\lambda} = {\lambda \over {\Delta x}}\)
We require \(\phi = k \Delta x = {{2 \pi} \over \lambda} \le \phi_{lim}\)
Or:
So if \(\phi_{lim} = {\pi \over {18}}\) then \(N_{lambda} = 36\) points per wavelength to resolve frequencies up to \({\pi \over {18}}\)
This is quite a severe requirement for unsteady problems
Even in steady problems you have artificial time in a transient period - otherwise you have an excessively damped solution.
1.1.5.5.13. Question¶
What is the dissipation error for \(\sigma = 1\) ? For upwind is this a horizontal line?