Hello Luke Souza,
To compute the physical coordinates (x,y,z) and Fourier wave numbers (ξx,y,z) from the velocity field u(x) and its corresponding Fourier modes u(ξ), you can follow these steps:
- Define the size of your domain and grid points. Let's say you have an NxNxN grid.
- Define the physical size of your domain. Let's say it is LxLxL.
- Compute the spacing between grid points in each direction, dx = dy = dz = L/N.
- Compute the Nyquist frequency in each direction, ξ_nyq = π/dx.
- Compute the set of Fourier wave numbers in each direction, ξx = [-ξ_nyq, -ξ_nyq + 2π/L, ..., ξ_nyq - 2π/L, ξ_nyq], ξy = [-ξ_nyq, -ξ_nyq + 2π/L, ..., ξ_nyq - 2π/L, ξ_nyq], ξz = [-ξ_nyq, -ξ_nyq + 2π/L, ..., ξ_nyq - 2π/L, ξ_nyq]. You can use the fftfreq function from numpy.fft module to generate the frequency values.
- Compute the set of physical coordinates in each direction, x = [-L/2, -L/2 + dx, ..., L/2 - dx], y = [-L/2, -L/2 + dy, ..., L/2 - dy], z = [-L/2, -L/2 + dz, ..., L/2 - dz].
- Compute the spectral coefficient matrix using the 3D FFT of the physical data: ufourier = fftn(u_1).
- Compute the physical data using the inverse 3D FFT of the spectral data: uinverse = ifftn(u_2).
Note that in step 5, we include the Nyquist frequency in the set of Fourier wave numbers because the FFT algorithm assumes that the input signal is periodic, and the Nyquist frequency represents the highest possible frequency in a periodic signal.
Also can you please share the matlab files which you have used for further help
Hope this helps!