
[Sponsors] 
August 19, 2013, 22:03 
OpenFOAM FFT of Entire Transient Data

#1 
Member
Join Date: Apr 2009
Posts: 36
Rep Power: 10 
I was wondering if there was any utility or outside code that could perform an FFT analysis of an entire unsteady solution set.
By that, I mean if I run my analysis and determine the fundamental frequency of concern. In the past I've used tools that allow the researcher to cleverly define his time step and file write frequency to obtain 2^n result files. He can then perform FFT on the entire set of result files to obtain a solution set in "frequencydomain" allowing the individual to see amplitudes and phases of certain frequencies. Anything related to this around? 

August 20, 2013, 01:33 

#2 
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 15 
FFT of a complete dataset? I am not sure what you have in mind by that. I know FFT of a time series, I know that you can apply a Fourier transform in more dimensions in space is possible for simple geometries, but which of these do you have in mind? Or just the FFT of a time series?


August 20, 2013, 15:24 

#3 
Member
Join Date: Apr 2009
Posts: 36
Rep Power: 10 
So, you're basically performing FFT at each data point using a reduced set of data (one temporal point for each saved time step). So, rather than doing FFT of a single probe location using 2,048 (2^n) data points, you're doing FFT at each grid point using something like 32 data points.
With a reduced set of points, you can typically only grab a few frequencies of interest, but consider the following: If you have something shedding at multiple frequencies, it may be of interest to "see" where the highest amplitudes are for the first fundamental frequency. . .the second, etc. 

August 20, 2013, 15:50 

#4 
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,757
Rep Power: 29 
Hi Minger,
As Bernhard, I am pretty unsure of what you would like to accomplish, however, analysis of timeseries using FFT has been implemented in the postprocessing part of waves2Foam (openfoamwiki.net/index.php/Contrib/waves2Foam), and you should be able to use is right out of the box for e.g. sampled forces and velocity probes. The implemented method is based on GSL's FFT, since I did not find the interface in the OF implementation that nice. You can defined the number of frequencies, the overlapping of windows and only use part of a sampled time series. All of it in native OF data format; except for the spectra, which are outputted in easily loadable ASCII format. Kind regards, Niels
__________________
Please note that I do not use the Friendfeature, so do not be offended, if I do not accept a request. 

September 6, 2013, 22:39 

#5 
Member
Join Date: Apr 2009
Posts: 36
Rep Power: 10 
OK, I've tried to find a solution to no avail. Let me try and describe my problem once again.
I'm not looking for FFT analysis at a single point, rather all points in the domain. So, rather than having 30,000 data points at a single probe location, let's say that I had 256 data files. I would then like to do FFT at each node, and then basically output a data file for each frequency (amplitude, phase, real, img, etc). So, if you were looking at spectral data at a probe location and noticed an unexpected peak, you could pull the amplitude data for that frequency and "see" what that unsteadiness looks like. I used to have a routine somewhere that did this on 2^n plot3d formatted files. It is truly a terrific tool. If anyone can provide any more insight, I would appreciate it. Thanks! 

September 8, 2013, 16:03 

#6 
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,757
Rep Power: 29 
Hi Minger,
I do not understand, what it is you want to achieve. Is it either of the following: 1. A FFT of the spatial data, i.e. a 2dimensional FFT for a xyplane and a 3dimensional FFT for a xyz volume? This FFT is then computed for each time step. 2. An FFT in each probe location in your domain, where the FFT is based on a time series. In the spatial dimensions you then want to visualise various spectral properties related to the FFT as a function of, say, x and y. Kind regards Niels
__________________
Please note that I do not use the Friendfeature, so do not be offended, if I do not accept a request. 

September 9, 2013, 13:05 

#7 
Member
Join Date: Apr 2009
Posts: 36
Rep Power: 10 
I apologize, I must be terrible at explaining things.
The end goal is to be able to plot the amplitude as a contour at each point for a given frequency. I have attached an incredibly crude illustration of what we're going for. The process is kind of like this:  Take 2^n results files and perform 1D FFT at each and every grid point.  The function will essentially read data as a 1D array in time for each grid point and perform the FFT analysis.  What I get is then 2^n / 2 data files. Let's assume that I get  p.0.amp > this file would contain the pressure amplitude for the mean flow  p.1.amp > this file would contain the pressure amplitude for the first frequency (which would be implicitly set by the number of files and the time between each file write)  p.1.phase > I would typically also get a phase  p.n.amp / p.n.phase  I would files for each FFT frequency computed. What I could then do is open up, e.g. p.1.amplitude and "plot" the pressure. I could then see where in my computational domain this frequency is dominant. (If I had a probe in the areas of high amplitude, it would show up on a traditional FFT plot  likewise if I had a probe in a low amplitude area here, it may not show up). 

September 9, 2013, 14:49 

#8 
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,757
Rep Power: 29 
Hi Minger,
Good, now it does make sense. To my knowledge nothing exactly as that exists in OF, but you might want to look into the POD utility (Prober Orthogonal Decomposition) in OF1.6ext, which decomposes the solution into eigenvalue space. Back to your problem at hand, then it will most probably require a bit of work from your hand, so let me try to sketch what is needed (at least for an efficient execution of the fullspace FFT decomposition): 1. One way or the other, you will need to store the transient data for every single computational cell in your computational domain. It could result in large amounts of data, though, it is definitely feasible. Two options exists: a. Utilise the function object to probe e.g. the velocities at a given rate. This merely requires you to create the probing dictionary, tedious but doable. A trick in this context would be to use Code:
writeCellCentres time 0 b. Write the data at a sufficiently high rate, such that you can walk through the data afterwards and recovering files with the transient information in one file per location. This will also ensure that the time series are equidistant in time for your FFT analysis. You should also be able to utilise the sampling utility for that (the parent utility for the probing). The reason that I want you to preprocess the data into files with (time, data) rather than (space,data) format is that the processing of the FFT will become much faster. 2. Now you have the data ready and you want to do the FFT. Therefore, you will need to read the probed data format and pass this to an FFT method. Here I can recommend that you uses the FFT decomposition already implemented in the waves2Foam framework as mentioned above. This method is not bound to a length of the data sets of 2^N, so it become somewhat more flexible, and know tricks as shifting windows, averaging of multiple spectra, etc, are already available there. It comes with a separate interface to the FFT, so you should be able to implemented something, which utilises the existing interface. 3. Now you have a function, which computes the FFT, but it does not store the data. This should be made as flexible as possible, so I recommend that you read the following thread on runTime allocation of multiple fields: http://www.cfdonline.com/Forums/ope...openfoam.html If you are interested in all 2^N/2 fields, then you will end up with a tremendous amount of data (too much?) in the memory, so if you are not performing some kind of flexible data management, where you move fields in and out of the memory, you will easily end up swapping. You are done and just about to begin Best of luck, Niels P.S. You should be aware that the probing/sampling methods output the data in the serial directory, i.e. not under the parallel processors. This means that you will have to do some additional thinking, if you what to execute the above described steps in parallel.
__________________
Please note that I do not use the Friendfeature, so do not be offended, if I do not accept a request. 

September 10, 2013, 08:45 

#9 
Member
Join Date: Apr 2009
Posts: 36
Rep Power: 10 
Niels,
This may be just what I was looking for! I was originally looking to find a way to compare several configurations to see where the different "modes" were. I was initially thinking that frequency space was the way to go  but in hindsight, if the frequencies are slightly off, it could make the FFT process tedious. I plan on installing 1.6ext tonight (after having read through a couple posts regarding running multiple version of OF concurrently), however could use a reference for the POD process. I can't seem to find a tutorial or any files online actually describing the process. Do you have anything? Thanks a bunch! 

September 10, 2013, 12:37 

#10 
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,757
Rep Power: 29 
Hi Minger,
No, unfortunately not, I merely know that it is there. Kind regards Niels
__________________
Please note that I do not use the Friendfeature, so do not be offended, if I do not accept a request. 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
studying a valve case  mina.basta  OpenFOAM  33  August 30, 2013 04:46 
Complex FFT for real data  Hisham  Main CFD Forum  0  November 12, 2011 15:53 
New OpenFOAM Forum Structure  jola  OpenFOAM  2  October 19, 2011 06:55 
Crosscompiling OpenFOAM 1.7.0 on Linux for Windows 32 and 64bits with Mingww64  wyldckat  OpenFOAM Announcements from Other Sources  3  September 8, 2010 06:25 
using topographical data in openfoam  kerim  OpenFOAM  2  June 27, 2010 08:45 