Add option to use real-to-complex FT in PseudospectralEquation
Many standard PDEs have real-valued unknowns in the real space. It is therefore more performant to exploit the real-to-complex symmetry and use np.fft.rfft
instead of np.fft.fft
.
The symmetry is u_k = u_{-k}^*
. Therefore, np.fft.rfft
spares out the u_k
values with k<0
.
Since the corresponding Fourier space is smaller (N/2+1 complex values instead of N complex values) a new (positive only) k-vector is needed (as provided by np.fft.rfftfreq
). We should have this as a option in PseudospectralEquation
.