Given a discretization with N degrees of freedom, the FFT of such an array has the Nyquist mode at N//2. Typically, for each mode, except the mean mode (k=0), there is both a "positive wavenumber" and a "negative wavenumber." However, if N is even (i.e., N%2 == 0), only one wavenumber carries the energy in the Nyquist mode. This is problematic because it only allows the cosine component of the Nyquist mode to be captured.
Let's say N=6, and I want to sample cos(3 2pi/L x). This will give a contribution to the Nyquist mode [at unscaled wavenumber -3] of N + 0i (N in the real part of the complex number, and zero in the imaginary part). Then, there are three scenarios:
I want to obtain the first derivative: I would multiply with 1j (-3), turning the coefficient into 0 - 3N j. In an inverse transform, the imaginary Nyquist component would result in an imaginary cosine signal (precisely: 3j cos(3 2*pi/L x) ). However by using the rfft, we zero out any imaginary components at the Nyquist mode, so there essentially is only a zero real signal, which is fine because the analytical derivative of the cosine at Nyquist mode (a sine) would be seen as a zero signal anyway.
I want to obtain the second derivative efficiently: I would multiply with (1j (-3))^2 = -9. Hence, I would just scale the real component. Transforming back would give the correct derivative signal of -9 cos(3 2*pi/L x).
I want to obtain the second derivative by applying the former first derivative twice: This would - incorrectly - also give a zero signal. This can be problematic, but the effect can also be very small because a signal with a Nyquist component likely also has higher modes that, with their aliases, produce issues anyway.
I am still thinking about how this is in 2D and 3D and whether that affects the ETDRK methods.
Given a discretization with
N
degrees of freedom, the FFT of such an array has the Nyquist mode atN//2
. Typically, for each mode, except the mean mode (k=0
), there is both a "positive wavenumber" and a "negative wavenumber." However, ifN
is even (i.e.,N%2 == 0
), only one wavenumber carries the energy in the Nyquist mode. This is problematic because it only allows the cosine component of the Nyquist mode to be captured.Let's say N=6, and I want to sample cos(3 2pi/L x). This will give a contribution to the Nyquist mode [at unscaled wavenumber -3] of N + 0i (N in the real part of the complex number, and zero in the imaginary part). Then, there are three scenarios:
I want to obtain the first derivative: I would multiply with 1j (-3), turning the coefficient into 0 - 3N j. In an inverse transform, the imaginary Nyquist component would result in an imaginary cosine signal (precisely: 3j cos(3 2*pi/L x) ). However by using the rfft, we zero out any imaginary components at the Nyquist mode, so there essentially is only a zero real signal, which is fine because the analytical derivative of the cosine at Nyquist mode (a sine) would be seen as a zero signal anyway.
I want to obtain the second derivative efficiently: I would multiply with (1j (-3))^2 = -9. Hence, I would just scale the real component. Transforming back would give the correct derivative signal of -9 cos(3 2*pi/L x).
I want to obtain the second derivative by applying the former first derivative twice: This would - incorrectly - also give a zero signal. This can be problematic, but the effect can also be very small because a signal with a Nyquist component likely also has higher modes that, with their aliases, produce issues anyway.
I am still thinking about how this is in 2D and 3D and whether that affects the ETDRK methods.