CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Plot the Energy Spectrum

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 1 Post By Bazinga
  • 3 Post By Elyas_Mosibat
  • 1 Post By syavash

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 25, 2017, 13:08
Default Plot the Energy Spectrum
  #1
New Member
 
Elyas_Kermani
Join Date: Dec 2015
Location: Iran
Posts: 12
Rep Power: 11
Elyas_Mosibat is on a distinguished road
Hello
I simulated a turbulent channel with (2pi,2,pi) and Re_tau=590 to evaluate dynamic smagorinsky model.
I don't know how to plot the Energy spectrum!
can anyone help me to plot that?
Regards,
Elyas
Elyas_Mosibat is offline   Reply With Quote

Old   July 29, 2017, 08:44
Default
  #2
Senior Member
 
Join Date: Jun 2012
Location: Germany, Bochum
Posts: 230
Rep Power: 16
Bazinga is on a distinguished road
What exactly do you mean by "energy spectrum"?

If we are talking about the energy spectral density, in general, I would take the time series of the value that you need and use Fourier Transform. From the squared FT you get the energy spectral density that you can plot over frequencies.
Bazinga is offline   Reply With Quote

Old   July 29, 2017, 12:33
Default
  #3
New Member
 
Elyas_Kermani
Join Date: Dec 2015
Location: Iran
Posts: 12
Rep Power: 11
Elyas_Mosibat is on a distinguished road
Hi Bazinga
Thank you for your reply.
Can you tell me which type of the spectrum is common?
I want to show that my results agree with the -5/3 like the following pictures.
Which quantity have to extract to reach these figures.
What steps should be taken to plot the best spectrum?
regard
Attached Images
File Type: jpg pict.jpg (114.6 KB, 668 views)
Elyas_Mosibat is offline   Reply With Quote

Old   July 29, 2017, 14:35
Default
  #4
Senior Member
 
Join Date: Jun 2012
Location: Germany, Bochum
Posts: 230
Rep Power: 16
Bazinga is on a distinguished road
Yes, this is a common one to plot.

You need to get time series of the velocity at each time step at the points in your channel where you want to obtain the spectrum. For this, you need to add probes* to the controlDict file.

The rest is post processing these time series as very briefly explained in my first response.

*You should find more than enough information on how to set up probes in the tutorials and this forum.
qutadah.r likes this.
Bazinga is offline   Reply With Quote

Old   July 30, 2017, 01:47
Default
  #5
New Member
 
Elyas_Kermani
Join Date: Dec 2015
Location: Iran
Posts: 12
Rep Power: 11
Elyas_Mosibat is on a distinguished road
Thanks for your description.
Dear Bazinga I need to add probes* to the controlDict file?
But I have only one week to report my thesis results and my simulations is ended.
1-Can I use the probeDict file inside the system folder instead of adding probes to the controlDict file?
The legend of figures show that the energy spectral is plotted for the total resolved turbulent energy and you say I need to get time series of the velocity!
2-Which one have the best trend to -5/3?velocity or total resolved turbulent energy?

Regard
Attached Images
File Type: jpg pict.jpg (114.6 KB, 168 views)
Elyas_Mosibat is offline   Reply With Quote

Old   July 30, 2017, 02:54
Default
  #6
Senior Member
 
Join Date: Jun 2012
Location: Germany, Bochum
Posts: 230
Rep Power: 16
Bazinga is on a distinguished road
1. No. AFAIK you need to add probes before the simulation.
The way I see it it is the spectrum over the wavenumber.
2. I don't understand the question.


1 week?! Good luck. I suggest you talk to your supervisor.

Sent from my SM-G950F using CFD Online Forum mobile app
Bazinga is offline   Reply With Quote

Old   August 14, 2017, 12:27
Default
  #7
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22
jherb is on a distinguished road
Sorry for the late answer: You should be able to use the -postProcess command line option together with probes in your controlDict.


See: https://cfd.direct/openfoam/user-gui...rocessing-cli/ (the example is for simpleFoam but should work also for other solvers)


I tested it for OpenFOAM 4.x and it seems to work.
jherb is offline   Reply With Quote

Old   August 14, 2017, 14:12
Default
  #8
New Member
 
Elyas_Kermani
Join Date: Dec 2015
Location: Iran
Posts: 12
Rep Power: 11
Elyas_Mosibat is on a distinguished road
Hi Joachim
Thank you for your reply.
I plotted the Energy Spectrum for my new SGS model that I implemented in OpenFOAM Library.
Do you think this trend is correct?
Do you have any idea about that?
regard
Attached Images
File Type: png EE.PNG (42.6 KB, 599 views)
Elyas_Mosibat is offline   Reply With Quote

Old   March 28, 2019, 10:12
Default
  #9
New Member
 
Join Date: Jan 2017
Posts: 13
Rep Power: 9
ghazal_1989 is on a distinguished road
Hi Elyas,

Can you please give me a guide that how you have calculated the E(k) value?

Best,
Ghazal

Quote:
Originally Posted by Elyas_Mosibat View Post
Hi Joachim
Thank you for your reply.
I plotted the Energy Spectrum for my new SGS model that I implemented in OpenFOAM Library.
Do you think this trend is correct?
Do you have any idea about that?
regard
ghazal_1989 is offline   Reply With Quote

Old   March 29, 2019, 13:03
Default
  #10
New Member
 
Elyas_Kermani
Join Date: Dec 2015
Location: Iran
Posts: 12
Rep Power: 11
Elyas_Mosibat is on a distinguished road
Dear Ghazal,

First, I used another version of pimpleFoam solver that is modified by Mr. Ehsan Askari. This solver writes UPrime [UPrime=(U-UMean)] for each time step. Then I extracted it for a period of time e.g. 40s with small time step (0.01s) which means I extracted the UPrime in each time step from 3200s to 3240s in my case with the probeLocations utility in four different locations. There are three components of UPrime for each location. Afterward I used this formulation [ 0.5*(POWER(X1,2)+POWER(X2,2)+POWER(X3,2))] to determine the turbulent kinetic energy value as a funtion of time. In the final step you need to transform variables to wave number environment.
mrishi, altinel and qutadah.r like this.
Elyas_Mosibat is offline   Reply With Quote

Old   March 29, 2019, 13:05
Default
  #11
New Member
 
Elyas_Kermani
Join Date: Dec 2015
Location: Iran
Posts: 12
Rep Power: 11
Elyas_Mosibat is on a distinguished road
Dear Ghazal,

First, I used another version of pimpleFoam solver that is modified by Mr. Ehsan Askari. This solver writes UPrime [UPrime=(U-UMean)] for each time step. Then I extracted it for a period of time e.g. 40s with small time step (0.01s) which means I extracted the UPrime in each time step from 3200s to 3240s in my case with the probeLocations utility in four different locations. There are three components of UPrime for each location. Afterward I used this formulation [ 0.5*(POWER(X1,2)+POWER(X2,2)+POWER(X3,2))] to determine the turbulent kinetic energy value as a funtion of time. In the final step you need to transform variables to wave number environment.









Quote:
Originally Posted by ghazal_1989 View Post
Hi Elyas,

Can you please give me a guide that how you have calculated the E(k) value?

Best,
Ghazal
Elyas_Mosibat is offline   Reply With Quote

Old   May 13, 2019, 04:26
Default
  #12
New Member
 
Join Date: Jan 2017
Posts: 13
Rep Power: 9
ghazal_1989 is on a distinguished road
Quote:
Originally Posted by Elyas_Mosibat View Post
Dear Ghazal,

First, I used another version of pimpleFoam solver that is modified by Mr. Ehsan Askari. This solver writes UPrime [UPrime=(U-UMean)] for each time step. Then I extracted it for a period of time e.g. 40s with small time step (0.01s) which means I extracted the UPrime in each time step from 3200s to 3240s in my case with the probeLocations utility in four different locations. There are three components of UPrime for each location. Afterward I used this formulation [ 0.5*(POWER(X1,2)+POWER(X2,2)+POWER(X3,2))] to determine the turbulent kinetic energy value as a funtion of time. In the final step you need to transform variables to wave number environment.
Hi Ehsan,

Many thanks for your answer and so sorry for my late response. I also deeply appreciate if you please help me on the following questions.
1) In your answer, the variables of X1,X2,X3 are the fft(Fast Fourier Transformation) of UPrime, VPrime and WPrime?
2) In the final step, you refer to transform variables to wave numbers. Do you mean this formula? λf=c where λ is the wavelength, f is the frequency and c is the speed of sound in flow.

With kind regards,
Ghazaleh
ghazal_1989 is offline   Reply With Quote

Old   May 19, 2019, 03:02
Default
  #13
New Member
 
Elyas_Kermani
Join Date: Dec 2015
Location: Iran
Posts: 12
Rep Power: 11
Elyas_Mosibat is on a distinguished road
Quote:
Originally Posted by ghazal_1989 View Post
Hi Ehsan,

Many thanks for your answer and so sorry for my late response. I also deeply appreciate if you please help me on the following questions.
1) In your answer, the variables of X1,X2,X3 are the fft(Fast Fourier Transformation) of UPrime, VPrime and WPrime?
2) In the final step, you refer to transform variables to wave numbers. Do you mean this formula? λf=c where λ is the wavelength, f is the frequency and c is the speed of sound in flow.

With kind regards,
Ghazaleh
Hi Ghazaleh,

My name is Elyas not Ehsan.
1- I used only UPrime, VPrime and WPrime for X1,X2,X3 respectively.
2- I used (2*pi*f)/(2*pi*dt) and (2*pi*dt*E(f))/(2*pi) For horizontal and vertical axis repectively. Like the following pic.

Best,
Attached Images
File Type: png image_2017-08-11_20-49-06.png (38.7 KB, 306 views)
Elyas_Mosibat is offline   Reply With Quote

Old   May 22, 2019, 06:11
Default
  #14
New Member
 
Join Date: Jan 2017
Posts: 13
Rep Power: 9
ghazal_1989 is on a distinguished road
Hi,



Thank you for your reply. I think, in some point we need to use Fourier Transformation in order to convert time and rms of velocity into frequency and energy spectrum ..



Best, Gh



Quote:
Originally Posted by Elyas_Mosibat View Post
Hi Ghazaleh,

My name is Elyas not Ehsan.
1- I used only UPrime, VPrime and WPrime for X1,X2,X3 respectively.
2- I used (2*pi*f)/(2*pi*dt) and (2*pi*dt*E(f))/(2*pi) For horizontal and vertical axis repectively. Like the following pic.

Best,
ghazal_1989 is offline   Reply With Quote

Old   June 3, 2019, 14:46
Default
  #15
Senior Member
 
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18
syavash is on a distinguished road
Quote:
Originally Posted by ghazal_1989 View Post
Hi,



Thank you for your reply. I think, in some point we need to use Fourier Transformation in order to convert time and rms of velocity into frequency and energy spectrum
RMS is a time-averaged quantity so it doesn't relate to time. Therefore, taking FFT would not have a sense in that case.

Syavash
Gang Wang likes this.
syavash is offline   Reply With Quote

Reply

Tags
energy spectrum, fft code, openfoam, turbulent channel


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Energy Spectrum !!! stanking Main CFD Forum 107 October 21, 2016 11:48
Energy Spectrum using Python ChGr Main CFD Forum 0 July 28, 2016 13:26
Plot values such as turbulent kinetic energy at the first grid point from the surface eddykendo OpenFOAM Post-Processing 0 July 1, 2016 06:27
Energy Spectrum helly Main CFD Forum 4 January 7, 2016 22:57
Energy spectrum from velocity histroy in time Chang Main CFD Forum 1 October 2, 2006 08:23


All times are GMT -4. The time now is 16:54.