# Tag Info

2

Indeed the problem was that you were trying to calculate your nonlinear term incorrectly and you forgot that: $$\mathcal{F}[(f(x))^{2}] \neq (\mathcal{F}[f(x)])^{2}$$ I changed your code to this: import numpy as np import matplotlib.pyplot as plt from matplotlib.pyplot import cm nu = 1 L = 100 nx = 1024 t0 = 0 tN = 200 dt = 0.05 nt = int((tN - t0) / 0....

1

In 2D you don't have a wavelength anymore. In 1D you have a wavenumber $k$ and this is the spatial frequency and it is related to the wavelength by $$k = \frac{2 \pi}{\lambda}\, ,$$ or without the $2\pi$, that depends on the definition. On the other hand, in 2D you have a wavevector $$\mathbf{k} = (k_x, k_y)\, .$$ I guess that you could could use the ...

1

The base FFT is defined for both negative and positive frequencies. What you see here is not what you think. Scipy returns the bin of the FFT in that order: positive frequencies from 0 to fs/2, then negative frequencies from -fs/2 up to 0. If your signal is real, you should look at the real FFT:https://docs.scipy.org/doc/scipy/reference/generated/scipy.fft....

1

Welcome to scicomp! If I remember correctly, then in order to Fourier transform a function it has to be a periodical so that you can use the sine and cosine functions as base for it. In your case the peak will have a discontinuity in the derivative at the ends at x=30 or x=-30. The Fourier base is not well suited for discontinuities. If my hunch is correct, ...

1

The whole point of the guru interface is to do complicated FFTs without copying the data into contiguous arrays. This advantage is not very important if data needs to be communicated through MPI anyway. Taking advantage of a guru like interface would be complicated and ineffective in an MPI setting. In other words, if your data is not in the expected MPIFFTW ...

Only top voted, non community-wiki answers of a minimum length are eligible