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

Acoustic Post Processing in MATLAB for results from OpenFOAM.

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes
  • 1 Post By Alhasan
  • 1 Post By wyldckat
  • 1 Post By wyldckat
  • 1 Post By wyldckat
  • 1 Post By wyldckat
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 31, 2013, 17:30
Default Acoustic Post Processing in MATLAB for results from OpenFOAM.
  #1
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Hey All,

There is this Curle analogy that is provided
in post#10 http://www.cfd-online.com/Forums/ope...-openfoam.html

I have successfully implemented it the provided utility and got my results in Freq Vs SPL

- does anybody know how to perform 1/3 octave filtering for a data sets with Freq Vs SPL

there is some information here
http://www.mathworks.co.uk/help/dsp/...d-filters.html

but for some reason I am not able to perform it

Thanks for your time

Hasan K.J
chaitanyaarige likes this.
Alhasan is offline   Reply With Quote

Old   January 1, 2014, 08:12
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Hasan,

Sooo... what happens exactly?
More specifically, when you copy-paste the instructions from the MATLAB help, does everything work as intended?

Keep in mind that we are not able to see what you're seeing, unless you share it with us

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   January 1, 2014, 11:24
Default
  #3
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Hey Bruno,
wish you a happy new year

now on the attached image - the graph similar to that on the left is what i am able to create from OpenFOAM, I am supposed to filter to make the one on the right !!!

The codes on Matlab site that i shared, the first two graphs work on my Matlab i have 2011, I.e creating and designing the octave and 1/3 octave filters. (dunno how to use them for filtering)

-but the welch function doesn't work in my Matlab i think its a newly implemented function in Matlab 2012/13 and but I don't even require welch function because it is used to calculate the SPL and frequency.I have the SPL and frequency

- I have the SPL and Frequency data Sets, I just want it filtered and for some reason i am not able to make it happen i tired for 2 weeks, also posted it on Matlab forum [totally inactive forum]

- I have attached the data that i am trying to filter below swell.

Thanks,
Hasan K.J
Attached Images
File Type: jpg Screen Shot 2013-12-27 at 21.31.21.jpg (29.4 KB, 158 views)
Attached Files
File Type: zip fft-CurleAnalogy3-microphone-above.dat.zip (11.4 KB, 53 views)
Alhasan is offline   Reply With Quote

Old   January 1, 2014, 11:33
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Mmm... well, frequency analysis strongly depends on the sampling period of your data. In other words: what is the smallest period of time between each two data points in time in your datasets? And is that period the same between every consecutive data point?

edit: And the other question is: are you applying the 1/3 filter to the first filter or directly to the original data?

Last edited by wyldckat; January 1, 2014 at 11:35. Reason: see "edit:"
wyldckat is offline   Reply With Quote

Old   January 1, 2014, 11:40
Default
  #5
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
this is going to sound weird 1200Khz I sounds a bit too high, i just rechecked my calculations in case. it is 1200Khz

edit: I am not actually getting your question - It should be applied to the first filter from what i know, i haven't successfully applied anything, my graphs are off the charts after the filtering

Thanks,
Hasan K.J
Alhasan is offline   Reply With Quote

Old   January 1, 2014, 11:50
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by Alhasan View Post
this is going to sound weird 1200Khz I sounds a bit too high, i just rechecked my calculations in case. it is 1200Khz
So... 1/1200000 = 0.000000833 s = 8.33e-7 s

OK, then it should not be for the lack of enough data.

Quote:
Originally Posted by Alhasan View Post
edit: I am not actually getting your question - It should be applied to the first filter from what i know, i haven't successfully applied anything, my graphs are off the charts after the filtering
In ParaView, we usually apply filters on top of other filters, e.g. slicing a slice to get a line.
In this case, if you apply the 1/3 band filter to the original filter, you don't get what you want. In a diagram-like-list:
  • Data -> FFT -> Spectrum
  • Data -> FFT -> 1/3 band filter -> garbage
  • Data -> 1/3 band filter -> what you are looking for
    • It might be implied that what it does is actually this:
      Data -> 1/3 band filter -> FFT -> what you are looking for
wyldckat is offline   Reply With Quote

Old   January 1, 2014, 11:57
Default
  #7
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
you are right about the Frequency the time step is 8.3 e-7s

I haven't tried paraview and with the size of my case paraview is really slow. hence i stick to MATLAB i have 3 cases and 17 sets of data per case

The data i get out of openFOAM is after the FFT, what it does is gets the p' from the surface and calculates Curles and then performs FFT before delivering it to me in the form i have uploaded in Post #3.

-so you mean to say if i perform 1/3 filtering for it my results would be bad ?

-but the data i received is exactly similar to pic on Post #3

- the funny bit is that picture is from FLUENT and in that you just have to select 1/3 octave instead of SPL and already i was soo much time with matlab trying to figure it out.

Thanks,
Hasan K.J
Alhasan is offline   Reply With Quote

Old   January 1, 2014, 12:00
Default
  #8
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Hey Bruno,

my actual struggle is that I am not able to perform 1/3 filtering I am doing something drastically wrong. by any chance did u get what was going on in the matlab link ?

Thanks,
Hasan K.J
Alhasan is offline   Reply With Quote

Old   January 1, 2014, 12:23
Default
  #9
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
I only mentioned ParaView because certain work-flow habits are inherited from it.


I don't have MATLAB to test this, so I'm not sure what each step does.
And AFAIK about frequency analysis is that you must always apply the filters to the original data, not to the FFT data.

One analogy is that we cannot make purified flour from a cereal that has already been completely boiled in water and is still wet.
Alhasan likes this.
wyldckat is offline   Reply With Quote

Old   January 2, 2014, 16:14
Default
  #10
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Hey Bruno,

By any chance do you know what it means by extracting SPL for delta f = 3.15 Hz in the image below ?

Kind Regards,
Hasan K.J
Attached Images
File Type: jpg Screen Shot 2014-01-02 at 02.31.48.jpg (72.4 KB, 68 views)
Alhasan is offline   Reply With Quote

Old   January 2, 2014, 20:24
Default
  #11
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Hasan,

What a long search I did... all because you didn't provide me with all of the necessary information And when it's basically explained on this paper: http://www.mb.uni-siegen.de/iftsm/fo..._etal_fn07.pdf

So, first, what I found:
  1. According to this page: http://en.wikipedia.org/wiki/Weighting_filter - SPL means "Sound Pressure Level"
  2. Which lead me to it's page: http://en.wikipedia.org/wiki/Sound_p...pressure_level
  3. Well, the "delta f" didn't seem to fit properly the information in the wiki pages above. So I kept looking.
  4. Found this paper: http://ctr.stanford.edu/Summer/SP08/5_3_Winkler.pdf - the article looked familiar, from the mesh description. But it only had a pretty pointless indication of 3.125Hz (I hate scientific papers ... they are barely scientific!).
  5. Then I found this one: http://www.mb.uni-siegen.de/iftsm/fo..._etal_fn07.pdf - which says this:
    Quote:
    A single ½” B&K microphone (model 4190, 1m from the middle of the tunnel exit, under 45° to the center line) was used to measure the SPL (sampling rate: 25.6 kHz, ∆f =3.125 Hz)
  6. Took me a while to figure it out... tried checking if it was a resolution issue in the sampling rate... and then it hit me: it's the minimum resolution between two contiguously measurable frequencies... or the error in measurement for each frequency.
Therefore, the 3.125 Hz is very likely the precision of the measurements, since this seems to be a pretty complex microphone. In addition, given that the sampling rate is 25600 Hz, it leads to only being able to capture at most 12800Hz frequencies (catch the wave at both top and bottom), with a very bad resolution; but most likely won't give you much for frequencies beyond 6400Hz.


So... in theory, it can tell you the dB SPL for the frequencies that are a multiple of 3.125 Hz, up to 6400~12000 Hz.


If it still seems strange to you, it's rather simple: the measurements are actually histograms

Best regards,
Bruno
Alhasan likes this.
__________________
wyldckat is offline   Reply With Quote

Old   January 2, 2014, 20:39
Default
  #12
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Hey Bruno,

Thanks a lot for the trouble you went through, I know they are hardly scientific.
well i knew about the mic sampling rate.

- They don't explain anywhere how things are done then how am i supposed to learn . 12 days more to go 15k words and post processing left .. phewwww

-the problem is when the same author performed the CFD he used a sampling rate of 100,000 HZ which is 5e-6 time steps

- then he has shown his results in similar manner with ∆f =3.125 Hz (he filtered the data some how), I dunno how he managed to do that to his data that he received from the CFD

- when it is necessary to sample the data in 100,000Khz to get all the fluctuations in the flow, on what basis can he filter with ∆f =3.125 Hz it is my doubt.

- Any idea what i could do it to my data to get that type of filtering to my data.

- coz say if Plot(1:10:end) that is plotting every 10 time steps to replicate a higher sampling rate. I will miss some important sounds right ?

Kind Regards,
Hasan K.J
Attached Images
File Type: jpg Screen Shot 2014-01-03 at 00.34.19.jpg (43.7 KB, 31 views)
Alhasan is offline   Reply With Quote

Old   January 2, 2014, 20:50
Default
  #13
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
I was going to quote myself about the histograms... but then I remembered: if he still indicates that the sampling error is 3.125 Hz, but the sampling rate increased to 100000 Hz, then that means that he only increased the maximum frequency that can be found on the spectrum. In this case, somewhere between 25000-50000 Hz, instead of 6400-12000 Hz.

Of course, this is assuming he knows what he's doing... because least-worst-case scenario I can see is that in one paper he indicates the maximum registrable frequency, according to the microphone specifications, while on the other paper he talks about the sampling rate...


Either way, I don't see any need to adjust the data from the CFD.
What you might need to adjust is the way you calculated the SPL in CFD, where you should in fact use the 3.125 Hz information for binning, namely for creating an histogram... but then again, I have no idea how you calculated the SPL in CFD...
Alhasan likes this.
wyldckat is offline   Reply With Quote

Old   January 2, 2014, 21:05
Default
  #14
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Your absolutely right, there is no need to adjust the data at all that i acquire from the CFD nor to do the 1/3 octave for the data.

- but the 1/3 octave is a good practice for acoustic post processing is what i heard

- and here since the experimental results are sampled for 3.125Hz due to the hardware restrictions, to plot my results with the experiments it would be presentable if filtered it.

- but if i directly sample the data from CFD with 3.125 Hz i would miss a lot of highs and lows in the pressure fluctuation.

- about SPL in CFD what we are essentially doing is using the utility i have mentioned above from that Korean openFOAM conference.
what it does is uses the pressure fluctuation on the surface and uses an acoustic analogy called Curle's analogy (but there are several other analogies there like Amiets Howes and fFW-H analogies Fluent uses FW-H). This analogy calculates the pressure amplitude at a distance that you want and the good thing is you can keep this point outside the CFD domain because it uses the density of the propagation fluid and speed of sound in that fluid to calculate this pressure amplitude.

we can easily calculate the SPL by 20*log10(pressureamplitude/reference pressure).

-that said i dunno how to he did that 3.125 Hz filtering still lol.

- I am more of an aerodynamics person dunno how got stuck with acoustics ;/

Thanks,
Hasan K.J
Alhasan is offline   Reply With Quote

Old   January 2, 2014, 21:12
Default
  #15
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Quote:
Found this paper: http://ctr.stanford.edu/Summer/SP08/5_3_Winkler.pdf - the article looked familiar, from the mesh description. But it only had a pretty pointless indication of 3.125Hz (I hate scientific papers ... they are barely scientific!).
Hey Bruno,
since you had a glance at this paper,

How do you think he performed that CFD between the wind tunnel and the C grid airfoil setup he has, has used RANS for the wind tunnel and LES for the small setup that I am trying to do.

Because I am exactly trying to replicate his paper with open foam and i thought about it and went with Map Fields which has failed misarably.

Thanks,
Hasan
Alhasan is offline   Reply With Quote

Old   January 18, 2014, 12:36
Default
  #16
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Hasan,

Quote:
Originally Posted by Alhasan View Post
How do you think he performed that CFD between the wind tunnel and the C grid airfoil setup he has, has used RANS for the wind tunnel and LES for the small setup that I am trying to do.
Quoting from the paper:
Quote:
Preliminary RANS computations are required for generating
the LES boundary conditions, as described in the next section.
Looks like the whole domain was only used for generating initial data for the boundary conditions... but it doesn't detail how exactly they did that. You can always send them an email asking more information about it.
My guess is that only the flow at the entrance of the other mesh was used for the boundary conditions.

Further thinking leads me to believe that the initial mesh were the two parts in a single mesh, for running the RANS simulation. Then they cut out the mesh with the airfoil and used the data from the boundaries for the LES simulation.


And the paper also implies from the Figure 10.b, that the LES model has a wake that was pointing lower than the experimental data.

mapFields is useless in this case, since all that matters is the boundaries... probably only the inlet matters the most.


By the way, the mesh images seem to imply that the mesh was either manually created or with the assistance of a manual mesh generation GUI.

Best regards,
Bruno
Alhasan likes this.
__________________
wyldckat is offline   Reply With Quote

Old   January 18, 2014, 17:39
Default
  #17
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Hey Bruno,

Even initially i though the important bit was the only the inlet, I did a case with only inlet mapped and top and bottom as slip like 3 months ago and the results were off a lot,

I managed to get the Cp results only after I used the top and bottom as inlet,
Quote:
initial mesh were the two parts in a single mesh,
How can that be done..? never come across it and
Quote:
Then they cut out the mesh with the airfoil and used the data from the boundaries for the LES simulation.
How to do that as well any suggestions, I have submitted my thesis with good results except for the wake velocity using MapFields only, but not knowing something keeps me up at night :/ so i need to figure this out.

Thanks,
Regards,
Hasan K.J
Alhasan is offline   Reply With Quote

Old   January 19, 2014, 12:07
Default
  #18
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Hasan,

First a quick note to other readers - this thread is related to this other one: http://www.cfd-online.com/Forums/ope...-openfoam.html

Now for the questions:
Quote:
Originally Posted by Alhasan View Post
I managed to get the Cp results only after I used the top and bottom as inlet,
Makes sense... although... "outletInlet" or "inletOutlet" might have compensated for any missing detail... but again, I'm not sure which one, as discussed here: http://www.cfd-online.com/Forums/ope...tml#post469608 post #33

Quote:
Originally Posted by Alhasan View Post
Quote:
initial mesh were the two parts in a single mesh,
How can that be done..? never come across it and
If the mesh was created with a manual mesher, it should be easy enough. Or if the two meshes are perfectly attachable, then in OpenFOAM they could be merged and then stitched together.

Quote:
Originally Posted by Alhasan View Post
Quote:
Then they cut out the mesh with the airfoil and used the data from the boundaries for the LES simulation.
How to do that as well any suggestions, I have submitted my thesis with good results except for the wake velocity using MapFields only, but not knowing something keeps me up at night :/ so i need to figure this out.
I very vaguely remember this topic of "mapping data from one data source to OpenFOAM and vice-versa" being asked here on the forum a few times already... but I'm too lazy right now to go search for it

Nonetheless, there is a tutorial on OpenFOAM 2.2.2 that can give some ideas... it's the tutorial "heatTransfer/buoyantSimpleFoam/externalCoupledCavity".

Using changeDictionary is another possibility, but that will only work if the two meshes are properly compatible with each other... in the sense that the order of the faces is identical.

Best regards,
Bruno
Alhasan likes this.
__________________
wyldckat is offline   Reply With Quote

Reply


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
Post processing in ParaFoam Gitesh P OpenFOAM Post-Processing 3 November 2, 2012 07:30
problem Using Matlab for post processing nenazarian FLUENT 3 September 6, 2012 17:41
Post processing from OpenFoam to Tecplot danielec87 Tecplot 2 August 14, 2012 15:19
[OpenFOAM] is parallel processing available in parafoam for post processing? sachinlb ParaView 1 August 14, 2012 10:52
post processing in CFD MANISH BHARGAVA Main CFD Forum 0 October 17, 1998 21:51


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