CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Energy spectrum calculation (https://www.cfd-online.com/Forums/main/3287-energy-spectrum-calculation.html)

Robert March 27, 2001 04:46

Energy spectrum calculation
 
Hi,

My simple question is: wath is the best way (and fast) to calculate the energy spectrum of a 2D turbulent velocity field?

Thanks in advance for your help

andy March 27, 2001 07:34

Re: Energy spectrum calculation
 
Are you using a spectral code?

What are your boundary conditions?

Are you expecting the spectrum to look like "normal" 3D turbulence? (just checking)

Robert March 27, 2001 08:25

Re: Energy spectrum calculation
 
Thanks for your answer, Andy,

I have two codes: a DNS and a Kinematical Simulation. The boundary conditions are periodical in a (2pi x 2pi) box. The flow is (theoretically) homogeneous and isotropic.

What do you mean with "normal" 3D tuebulence? "-5/3" law? No, I don't expect that.

Patrick Godon March 27, 2001 11:32

Re: Energy spectrum calculation
 
The usual way that to obtain an energy spectrum of a turbulent flow, is first to calculate the kinetic energy (and you can chose each dimension separately E=u**2, E=v**2, or together E=u**2+v**2), then you decompose E as a function of the wave number k (E(k)) by carrying a Fourier Transform, a FFT.

For the FFT to work:

E has to be given on discrete points (the grid points) equally spaced (delta-x, delta-y or whatever). Then E(x,y) is entered in the FFT and E(k) is the output. Here also, you can decide on 1D or 2D FFT. One of the important things, here, is that the output E(k) of the FFT comes in a given order (which is different, depending on which software is used). So the output array for example could be: E(0), E(1), E(2), ... E(M), E(-1), E(-2), .. E(-M+1), where N=2M is the total number of grid points (Fastest when N is a power of 2).

The energy spectrum is then the amplitude for each k:

0 sqrt(E(0)**2)

1 sqrt(E(1)**2+E(-1)**2)

etc..

I hope this helps,

Patrick Godon

andy March 27, 2001 12:06

Re: Energy spectrum calculation
 
To add to Patrick's response. I have checked with the people here and they tend to use an assembly language routine for the FFT developed a while a go. If that seems like too much hassle try following a few links from:

http://www.fftw.org/benchfft/


kalyan March 27, 2001 13:37

Re: Energy spectrum calculation
 
Energy spectrum is not the Fourier transform of the kinetic energy in physical space. If you want to use physical space quantities to computed the energy spectrum, you need to compute 2-point velocity correlation and take FFT with respect to the separation distance. This is quite cumbersome. It is much easier to compute FFTs of u, v and then compute E(k).

Patrick Godon March 27, 2001 15:05

Correction
 
Sorry, my mistake, Kalyan is right, the energy spectrum is given by:

(1/2)*4*pi*k**2*|v(k)|**2,

where v(k) is the FFT of v(x). Thus the square is taken after the FFT is performed. I often decompose 'entities' in 'modes' using FFT, that's how I got mixed up.

Thanks Kalyan for correcting me.

Robert March 29, 2001 09:40

Re: Correction
 
Thank, Patrick,

I've applied your suggestion and it seems to work better, but I found some "anomalous" behavior at small scales (high k). I think that it can be due to the integration methode. In your last message, you write

E(k) = (1/2)*4*pi*k**2*|v(k)|**2,

That true for an isotropic 1D signal, and integrated in 3D. But my signal is 2D, and I have to integrate u(kx,ky)² + v(kx,ky)² over a 2D shell of radius k, and it is not easy to do. I am thinking in interpolate to a grid (k, phi) and then integrate over phi, but I would need a gridding algorithm, and I have no idea about hoe expensive is it, and where to find this code (ideally, I need just the algorithm in order to implementate a SciLab function).

Patrick Godon March 29, 2001 10:15

Re: Correction
 
I am not quite sure about grids for interpolation between (I guess probably what you have is a) cartezian and polar grid, since as you interpolate you might introduce error on the small scales.

At the smallest wavelenght (higher k) you should have something (like a viscosity of 'high order' - hyper viscosity) that takes care of dissipation (I am not sure whether you do DNS). There, at the large k, you want to have a steep slope in the spectrum.

And you want to have enough resolution (grid points) to resolve the rest of the spectrum (low and intermediate k). Since you have a 2D problem, the energy is going to accumulate in the largest scales (low k - the inverse cascade of energy).

Numerical instability and low resolution can introduce two-point oscillations, therefore large k growth. Whether the resolution is enough or not depends on the scale you want to resolve (and the problem of interest) and the (hyper)viscosity.

If the viscosity is too small for a given resolution, then you will not have a steep slope at high k in the spectrum and can have instabilities. You can either increase the viscosity or the resolution. You need for a given resolution to have the high k affected (cut off) by the viscosity.

If the viscosity is too large, then you damp too much of your signal at lower k and you cannot resolve the fine structure of the flow.

If originally your problem is 'polar', then the best is to use polar coordinate from the start.

I have no idea about commercial software for that, since I never use any commercial software.

kalyan March 29, 2001 13:20

Re: Correction
 
The high wavenumber spectrum has little to do with the time-integration method unless you are using really high time-steps (see the paper by Choi and Moin in Phys. of Fluids about the effect of time step in DNS and LES). You might get a better idea about what is going on from the suggestion made by Patrick.

germangsilva April 9, 2010 12:40

I have a question about turbulent energy spectrum !
Now I have the data of position and velocity at grid.

the data is like this:
t (time) ,X ,Y, Z , Vx ,Vy ,Vz

I have already used FFT to transform Vx ,Vy, Vz to V_kx ,V_ky. V_kz RESPECTLY


Now the data is like this:
Vx ,Vy, Vz V_kx ,V_ky. V_kz

How can I calculate the energy spectrum?

1. How can I calculate the k?

2. V(k) = sqrt(V_kx^2 + V_ky^2), is right??

3. plot(k,V(K),k^(-5/3)) ????

please tell me the detail of the calculation procedure!!!


Thanks in advance,:)

cfdnewbie April 9, 2010 13:03

Regarding 1:
k is computed from sqrt(kx^2+ky^2+kz^2)

greetings
cfdnewbie

germangsilva April 9, 2010 13:13

dear cfdnewbie
How can I calculate the kx, ky,kz??
Thanks in advance for your help

PGodon April 12, 2010 11:59

the k's are just the indices of the discrete Fourier transform in each dimension, you don't compute them, you have them as the indices of your array.

germangsilva April 12, 2010 12:53

Dear Godon
is possible that you send me your email please?
germangsilva@gmail.com

PGodon April 12, 2010 13:33

Niet, ya nie Xochu

Amjad Asad April 29, 2014 15:13

Quote:

Originally Posted by PGodon (Post 254344)
the k's are just the indices of the discrete Fourier transform in each dimension, you don't compute them, you have them as the indices of your array.


Hallo,
could i get the code too pls thanks

juliom September 24, 2015 18:09

Energy Spectrum for a 3D turbulent Flow
 
Dear Community;
I have read many post about the topics but I still have a question. I am working with LES and I want to verify my LES code. Basically I am doing validation using the channel flow data base from JHUTB. So, I have a 3D flow field: u(x,y,z,t),v(x,y,z,t),w(x,y,z,t). I am interesting in compute the power spectrum at each plane. I have read about defining a point a collect the temporal velocity at a single point; which make sense, but I am more interested over the space rather than time..!!!
I have read about compute the FFT from the velocity, but from Wilcox book, I read that the Spectrum Energy is the FFT of the velocity correlation tensor.
I was planning to use FORTRAN to write the script, but I have read that the majority is using Matlab, so it seems that I will lean towards Matlab. However, I want to have the picture clear before starting!!!

Thanks community!

juliom September 24, 2015 18:45

Dear Mr. kalyan.
Could you please explain in more details your reply. So far I have read that the Energy Spectrum is the FFT of the Velocity Correlation tensor which is cumbersome, I agree. But you claimed that is also possible to obtain the PSD from the FFT of each velocity component How?? I was planning to make my own script in FORTRAN but I does not make sense to re-invent the wheel!. I just want to keep going but I would like to understand the physics.
I want to compute the PSD at a fixed height (y + 11.0) along the plane x-z

juliom September 29, 2015 08:35

Quote:

Originally Posted by Patrick Godon
;13740
Sorry, my mistake, Kalyan is right, the energy spectrum is given by:

(1/2)*4*pi*k**2*|v(k)|**2,

where v(k) is the FFT of v(x). Thus the square is taken after the FFT is performed. I often decompose 'entities' in 'modes' using FFT, that's how I got mixed up.

Thanks Kalyan for correcting me.

DEar Mr. Godon,
Where does this equation come from. The only equation I have read so far, is the eergy computation from the two point correlation. According to chapter 6 from Pope's book. I do not know where is that equation coming from that allows to circumvent the problem from the two point correlation and the spatial correlations.

Thanks


All times are GMT -4. The time now is 00:37.