Skip to content

Commit 0d5bf6f

Browse files
authored
Merge pull request #287 from FourierFlows/ncc/enhance-docs-aliasing
Clarifications and better phrasing in Docs/Aliasing
2 parents 7a963c1 + 33fd5cc commit 0d5bf6f

File tree

1 file changed

+31
-20
lines changed

1 file changed

+31
-20
lines changed

docs/src/aliasing.md

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ Plots.scalefontsizes(1.25)
88
Plots.default(lw=3)
99
```
1010

11-
In pseudospectral methods, often aliasing errors come into play. These errors originate from
12-
the discrete version of the grid. A grid discretized with ``n_x`` points can only resolve a
13-
total of ``n_x`` wavenumbers in Fourier space.
11+
In pseudospectral methods, when computing nonlinear terms then aliasing errors come into play.
12+
These aliasing errors originate from the discrete nature of the grid and, specifically, with
13+
the restriction that a grid discretized with ``n_x`` points can only resolve a total of ``n_x``
14+
wavenumbers in Fourier space.
1415

1516
On a grid with a total of ``n_x`` wavenumbers, both harmonics ``e^{2\pi i k x / L_x}`` and
1617
``e^{2\pi i (k+n_x) x / L_x}``, with ``k`` an integer, are indistinguishable when evaluated
@@ -41,28 +42,38 @@ savefig("assets/plot4.svg"); nothing # hide
4142

4243
![](assets/plot4.svg)
4344

44-
The take home message is that on this grid we cannot distinguish harmonics of wavenumbers 4 and 6
45-
and attempting to represent harmonics with wavenumber 6 on this grid will lead to aliasing errors.
46-
For example, say that we are solving an equation on this grid and at some point we compute the product
47-
``\cos(2x) \cos(4x)``. The result is ``\frac1{2} \cos(2x) + \frac1{2} \cos(6x)``, but on this
48-
grid ``\cos(6x)`` is indistinguishable from ``\cos(4x)`` and, therefore, we get an answer
49-
which is the sum of ``\frac1{2} \cos(2x) + \frac1{2} \cos(4x)``!
50-
51-
There are two ways to avoid aliasing errors we either *(i)* need to discard some of the wavenumber
52-
components in Fourier space before we tranform to physical space, or *(ii)* pad our Fourier
53-
represresentation with more wavenumbers that will have zero power. In FourierFlows.jl the former
54-
is implemented
45+
The take home message is that on this grid we cannot distinguish harmonics of wavenumbers 4
46+
and 6 and attempting to represent harmonics with wavenumber 6 on this grid will lead to aliasing
47+
errors. For example, say that we are solving an equation on this grid and at some point we compute
48+
the product ``\cos(2x) \cos(4x)``. The result is ``\frac1{2} \cos(2x) + \frac1{2} \cos(6x)``,
49+
but on this grid ``\cos(6x)`` is indistinguishable from ``\cos(4x)`` and, therefore, we get an
50+
answer which is the sum of ``\frac1{2} \cos(2x) + \frac1{2} \cos(4x)``!
51+
52+
To avoid aliasing errors we either *(i)* discard some of the wavenumber components in Fourier
53+
space from our fields before we tranform to physical space, or *(ii)* pad our fields with Fourier
54+
components with zero power that correspond to higher wavenumbers than those resolved by the grid
55+
before transforming to physical space. This way, the aliasing errors, which will involve the
56+
higher wavenumbers, will be either *(i)* zero-ed out or *(ii)* only come about for wavenumbers
57+
beyond what our grid can resolve anyway. In FourierFlows.jl, the former dealiasing scheme is
58+
implemented.
5559

5660
!!! info "De-aliasing scheme"
5761
FourierFlows.jl curently implement dealiasing by zeroing out the top-`aliased_fraction`
5862
wavenumber components on a `grid`.
5963

60-
How many wavenumber components we need to discard depends on the order of the nonlinearity. For
61-
quadradic nonlinearities, one would intuitively say that we need to discard the top-1/2 of the
62-
wavenumber components. However, Orszag (1972) pointed out that simply only discarding the
63-
top-1/3 of wavenumber components is enough. Actally, with Orszag's so-called 2/3-rule for dealiasing,
64-
still some aliasing errors occur, but only into wavenumbers that will be zero-ed out next time
65-
we dealias.
64+
The number of wavenumber components that we need to zero-out to be sure the no aliasing errors
65+
infiltrate our solution depends on the order of the nonlinearities. For example, for quadratic
66+
nonlinearities, one expects that we need to discard the top-1/2 of the wavenumber components.
67+
This way, when computing the product of two fields we won't have anything that projects onto
68+
harmonics with wavenumbers beyond those that our grid is able to resolve and, therefore, no
69+
aliasing errors.
70+
71+
The above-mentioned 1/2-rule for dealiasing for quadratic nonlinearities is, however, not the
72+
most efficient. Orszag (1972) pointed out that for quadratic nonlirearities, simply only discarding
73+
the top-1/3 of wavenumber components is enough to save us from aliasing errors. To be fair,
74+
with Orszag's so-called 2/3-rule for dealiasing, still some aliasing errors occur, but those
75+
errors only occur to the higher-1/3 wavenumber components that will be zero-ed out next time
76+
we dealias our solution anyway.
6677

6778
When constructing a `grid` we can specify the `aliased_fraction` parameter. By default, this is
6879
set to ``1/3``, appropriate for quadratic nonlinearities. Then `dealias!(fh, grid)` will zero-out

0 commit comments

Comments
 (0)