FFT ifft data turbulence

2 visualizaciones (últimos 30 días)
Luke Souza
Luke Souza el 11 de Mzo. de 2023
Editada: Sivapriya Srinivasan el 26 de Abr. de 2023
I was wondering if you could kindly help me with this problem I've been facing.
I only have the velocity field u(x) and corresponding Fourier modes u(ξ)) from a direct numerical simulation (DNS, NxNxN points). I need to reproduce the spectral coefficient matrix by 3D FFT of the physical one and the physical data by inverse FFT of the spectral data. How do I compute the physical coordinates(x,y,z) and Fourier wave numbers(ξx,y,z) ?
data_spectral = load('uvw_fourier.mat'); u,v,w = 192x192x192
data_physical = load('uvw_physical.mat');
u_1 = data_physical.u;
ufourier = fftn(u_1);
u_2 = data_spectral.uk;
uinverse = ifftn(u_2);

Respuestas (1)

Sivapriya Srinivasan
Sivapriya Srinivasan el 26 de Abr. de 2023
Editada: Sivapriya Srinivasan el 26 de Abr. de 2023
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:
  1. Define the size of your domain and grid points. Let's say you have an NxNxN grid.
  2. Define the physical size of your domain. Let's say it is LxLxL.
  3. Compute the spacing between grid points in each direction, dx = dy = dz = L/N.
  4. Compute the Nyquist frequency in each direction, ξ_nyq = π/dx.
  5. 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.
  6. 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].
  7. Compute the spectral coefficient matrix using the 3D FFT of the physical data: ufourier = fftn(u_1).
  8. 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!

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by