# Power spectrum of LES: understanding of the result

 Register Blogs Members List Search Today's Posts Mark Forums Read

January 27, 2017, 10:52
Power spectrum of LES: understanding of the result
#1
Senior Member

Agustín Villa
Join Date: Apr 2013
Location: Brussels
Posts: 187
Rep Power: 7
Good afternoon,

I know that it is a very common doubt, it has been spoken several times... but I couldn't get a good idea about what should I expect from a power spectra density result.

The procedure to obtain my spectrum has been:
- At a given position, I have obtained the velocity value each time step dt, so my sampling frequency is Fs=1/dt
- I have done the same with several points in the spanwise direction, I suppose that the flow is isotropic in that direction
- This information, I give it to a PSD Welch algortihm, who provides me a frequency range, and the PSD for each frequency value.
- I apply an average in the spanwise direction to smooth the PSD

When I plot it, I obtain something like the attached figure.

As far as I know, the PSD it usually used to estimate if the mesh, the numerical setup of the LES... is good enough, but I don't know how to understand this.

If somebody can help me, I would be very gratefull. Many thanks in advance,

Agustin
Attached Images
 figure_5.jpg (28.6 KB, 40 views)

 January 27, 2017, 12:02 #2 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 3,483 Rep Power: 40 First of all, I suggest to do a check on your spectrum calculation to see if it works correctly. You can build your signal by sampling the sin(kx) function in [0:2pi] so that once you fix a value for k you have only a peack in your spectrum. Second, the spectrum you plot can not be discussed if you do not give details of your flow problem and mesh resolution. The shape is very strange. lcarasik likes this.

 January 27, 2017, 13:09 #3 Senior Member   Julio Mendez Join Date: Apr 2009 Location: Greensboro, U.S.A Posts: 254 Rep Power: 11 I agree with Professor Denaron comment. This spectrum does not look like a turbulent kinetic energy spectrum. I would start with a an isotrooic flow field; for example a channel flow. You can choose the center line (far from the walls). You can use the DNS data set from the jhon Hopkins turbulence data base and test your spectrum (code) with the one they provide. As far as understanding; profesor Davison has suggested in several papers that the energy spectrum computed from the two point correlation is the right approach to validate your les computation. This is also in line with Pope's textbook. I am looking forward to more contributions from other members and professor Denaro.

 January 27, 2017, 13:23 #4 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 3,483 Rep Power: 40 Yes. Correlations and spectra are mutually related by a mathematical transformation. This topic can be read in the book of Pope. A breif summary is here https://www.io-warnemuende.de/tl_fil...Chap4_WS08.pdf However, understanding if a resulting spectra is mathematically well computed does not imply that it is physically meaningful. For this reason I suggest to split the study first in a numerical assesement of the procedure and then in an application on a well controlled flow problem.

 January 30, 2017, 04:46 #5 Senior Member   Agustín Villa Join Date: Apr 2013 Location: Brussels Posts: 187 Rep Power: 7 Hello, sorry for not answering during the weekend. As Filippo told me, I have tried to use the PSD Welch with different sinusoidal signals, and I have checked that I obtain a peak of frequency in the specified one. I is, the code of the algorithm is ok. Now I have to see if my input is ok or not. The mistake in my spectrum may be here. I have my velocity signal, that I can decompose in a mean and fluctuating terms. With the fluctuating ones, I can get the turbulent kinetic energy as q=1/2 * (u'^2 + v'^2 + w'^2). So, I get the Fourier transform's for u'u', v'v' and w'w', and I get the FT of the turbulent kinetic energy with the previous expression. Is is like this? One question that comes to my mind is if we can get the expression of q along the time and get its FFT. Would we obtain the same results?

 January 30, 2017, 05:05 #6 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 3,483 Rep Power: 40 Using the sine function you get exactly 1 peak and the other coefficients are zero at machine accuracy?? How about the value of the peak? why do you perform the FFT of the kinetic energy?? How do you perform the periodic windowing of the time-signal?? I agree with Julio, I suggest to do a controlled case using the channel flow problem and performing the spectral analysis in streamwise and spanwise direction. Only once you can superimpose the spectra with the existing database you can be sure.

 January 30, 2017, 05:20 #7 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 3,483 Rep Power: 40 Just a final consideration, if you want to characterize a LES spectrum, you must analyze the spatial energy spectra to see the correspondance with the LES filter. The time step characterizes a different Nyquist cut-off that, usually, lies withint the Kolomogorov time-scale. juliom likes this.

January 30, 2017, 05:31
#8
Senior Member

Agustín Villa
Join Date: Apr 2013
Location: Brussels
Posts: 187
Rep Power: 7
Quote:
 Originally Posted by FMDenaro Using the sine function you get exactly 1 peak and the other coefficients are zero at machine accuracy?? How about the value of the peak? why do you perform the FFT of the kinetic energy?? How do you perform the periodic windowing of the time-signal?? I agree with Julio, I suggest to do a controlled case using the channel flow problem and performing the spectral analysis in streamwise and spanwise direction. Only once you can superimpose the spectra with the existing database you can be sure.
Thanks for you answer. I attach my sinusoidal signal (20 Hz), with a sampling frequency of Fs=1000 Hz, and the output of the Welch algorithm. The other frequencies, as you can see, specially the higher ones, are very low, in the order of 10E-11 and lower.

About the FFT on the TKE, I was just asking. I give as input the velocity in this algorithm.

I am totally a newbie in all these things in LES, and I want to understand these concepts properly.
Attached Images
 sinsignal20Hz.jpg (114.3 KB, 12 views) welch.jpg (26.2 KB, 13 views)

 January 30, 2017, 05:52 #9 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 3,483 Rep Power: 40 Your spectrum is not correct...to see better do not use the continuous line but only symbols, you will see other contribution out of the peak at 20 Hz. You must se only one non-zero coefficients, the others being O(10^-13). So, your first task now is clear, focus on the right FFT procedure. Second, if you want to get into the LES field you must start learning the basis...for example, read the intro of book of Sagaut. You must be aware of the fact the LES has the aim of reducing the degree of freedom and that is obtained by filtering the spatial small flow scales. As a consequence, you must assess your results by looking at the spatial correlation and spectra. For this reason you have to start with well controlled flow problem. juliom likes this.

January 30, 2017, 08:54
#10
Senior Member

Agustín Villa
Join Date: Apr 2013
Location: Brussels
Posts: 187
Rep Power: 7
Hello again,

for sure, when I apply the FFT to the sinus signal I got what you say, however I have some discrepancies close to the peak of 20 Hz.

If I apply directly the FFT to the fluctuating part of the velocity. I obtain complex results, and in order to obtain the term u'u', I multiply by the conjugate. After that, I get the turbulent kinetic energy in the frequency domain as usual, k=0.5*uu+vv+ww. At the end, what I obtain is something like the image I attach.

I forgot to say that my case is a natural convection boundary layer, so, I don't know if the profile I obtain is due to that fact, or there is something bad in my procedure.

Attached Images
 ffttke.png (28.5 KB, 12 views) sinusFFT.png (18.5 KB, 9 views)

January 30, 2017, 09:44
#11
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 3,483
Rep Power: 40
Quote:
 Originally Posted by agustinvo Hello again, for sure, when I apply the FFT to the sinus signal I got what you say, however I have some discrepancies close to the peak of 20 Hz. If I apply directly the FFT to the fluctuating part of the velocity. I obtain complex results, and in order to obtain the term u'u', I multiply by the conjugate. After that, I get the turbulent kinetic energy in the frequency domain as usual, k=0.5*uu+vv+ww. At the end, what I obtain is something like the image I attach. I forgot to say that my case is a natural convection boundary layer, so, I don't know if the profile I obtain is due to that fact, or there is something bad in my procedure. Thanks for your replies!

Until you are not able to reproduce the correct sinus response in the PDS, you cannot apply your analysis to a flow problem...
You must see only one spike at the correct frequency and zero (at machine accuracy) everywhere. So, check if you passed correctly the periodic window to the FFT, it seems you get frequencies aliased.

Has your buoyancy-driven flow problem homogenous directions ?

January 30, 2017, 09:49
#12
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 3,483
Rep Power: 40
This is a plot of the spectrum for the sin kx function at k=1
Attached Images
 spectrum_k1.jpg (77.9 KB, 11 views)

January 30, 2017, 10:24
#13
Senior Member

Agustín Villa
Join Date: Apr 2013
Location: Brussels
Posts: 187
Rep Power: 7
Quote:
 Originally Posted by FMDenaro Until you are not able to reproduce the correct sinus response in the PDS, you cannot apply your analysis to a flow problem... You must see only one spike at the correct frequency and zero (at machine accuracy) everywhere. So, check if you passed correctly the periodic window to the FFT, it seems you get frequencies aliased. Has your buoyancy-driven flow problem homogenous directions ?
Yes. the flow ascends in the Y direction (streamwise), the normal direction to the wall is X, and the spanwise is the Z direction. It is a simple boundary layer, so it should be homogeneous in the Z direction, where I impose periodicity.

Quote:
 Originally Posted by FMDenaro This is a plot of the spectrum for the sin kx function at k=1
As you can see, I think that I am in the right way. In the FFT of sin(2*pi*t), I can see clearly the peak. That peak only contains the real part of the solution. If I plot the magnitude of the complex values, I get the other one. There are several orders of magnitude of difference. Could I consider that it is ok?
Attached Images
 sin2px.png (26.1 KB, 2 views) fftSin2px.png (32.6 KB, 6 views) absfftSin2px.png (34.9 KB, 6 views)

 January 30, 2017, 10:33 #14 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 3,483 Rep Power: 40 No, when you plot the magnitude, that is the modulus of the Fourier coefficient, you must get 0.25. The other coefficients are less than O(10^-14). Conversely your second plot has a wrong magnitude and other coefficients are aliased.

January 30, 2017, 11:13
#15
Senior Member

Agustín Villa
Join Date: Apr 2013
Location: Brussels
Posts: 187
Rep Power: 7
Quote:
 Originally Posted by FMDenaro No, when you plot the magnitude, that is the modulus of the Fourier coefficient, you must get 0.25. The other coefficients are less than O(10^-14). Conversely your second plot has a wrong magnitude and other coefficients are aliased.
Mmm... I am checking the values I get, and it seems that in that modulus, I should divide at a certain point by my number of samples, is it? For the moment, I was not using a window, but using the Hann one, I get really close of what you mean, only the closest points have a non negligible value.
Attached Images
 hannwindow.png (16.0 KB, 5 views)

 January 30, 2017, 11:51 #16 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 3,483 Rep Power: 40 Check the correct number of nodes you pass to the FFT and the correct value of the period... I think that is your problem

January 30, 2017, 12:55
#17
Senior Member

Agustín Villa
Join Date: Apr 2013
Location: Brussels
Posts: 187
Rep Power: 7
Hello again,

I have checked my code, and I obtain a peak of 0.5. I think I am missing something... What I do is

Code:
```N=8000
dt=1e_3
Fs=1000
time=linspace(0,8,8000)

signal=sin(2*pi*time)

fftSignal = fft(signal, n=N)/N % N is the number of samples, and I normalize
fftSignal = fftsignal(1:N/2)
freq=Fs/2*linspace(0,1,N/2)

plot(freq,abs(fftSignal))```
My max FFT value is 0.5 at 1Hz, as you can see in the figure. I think I am missing a factor of two in the input of my fft.

EDIT: well, the missing factor I think is the power of 2, otherwhise I am plotting a module, not the square of my signal. I should use fftSignal*conj(fftSignal)
Attached Images
 absfftSignal.png (18.7 KB, 4 views)

 January 30, 2017, 13:05 #18 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 3,483 Rep Power: 40 yes, you can compare with the portion of my Matlab script I posted here Energy Spectrum for a 3D turbulent Flow

January 31, 2017, 04:34
#19
Senior Member

Agustín Villa
Join Date: Apr 2013
Location: Brussels
Posts: 187
Rep Power: 7
Quote:
 Originally Posted by FMDenaro yes, you can compare with the portion of my Matlab script I posted here Energy Spectrum for a 3D turbulent Flow
Buongiorno Filippo, sorry for bothering you again.

I am taking a look into your code, and this part:
Code:
```for q = 1:np
sum_u = 0;
for k=1:l-1
sum_u = sum_u + 0.5*(cu(q,k) + cu(q,k+1))*dz;
end
ek1_uu(q) = sum_u/lz;
end```
In my case, I am getting a time-correlation, and in yours is a spatial one, but the theory behind is the same. I don't know what "l" means, but I suppose is an index related with position. Your sum_u, is the turbulent kinetic energy, so "k" and "l" are related with the x,y,z direction, aren't they?

At the end, you get ek1_uu dividing since you are averaging in space with dz.

 January 31, 2017, 05:04 #20 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 3,483 Rep Power: 40 The cycle is over "l", an index for the spanwise direction in a channel flow problem. This way I perform a statistical averaging of the one-dimensional spectra along the stream-wise direction at several position. Supplementary averaging is useful to get statistically meaningful results. For a time analysis, you should consider the same approach, using several periodical time-windows, performing spectra on each one and then averaging.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post atmcfd Main CFD Forum 38 March 14, 2016 15:52 selvam2487 CFX 0 March 16, 2014 14:59 atmcfd Main CFD Forum 5 July 20, 2012 22:16 Walid Main CFD Forum 2 December 2, 2005 09:29 Jake. Main CFD Forum 1 October 9, 2004 15:18

All times are GMT -4. The time now is 21:46.