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

How to extract sound file from pressure-time OpenFoam data?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 10, 2010, 10:15
Default How to extract sound file from pressure-time OpenFoam data?
  #1
New Member
 
Bertrand Delvaux
Join Date: Apr 2010
Posts: 29
Rep Power: 16
Bertrand is on a distinguished road
Hello,

I am very new to OpenFoam fantastic world, disovering stunning things everyday I try it. I already 'played' for a while with different functionalities. I got stuck at some point, though, and I hope you foamer experts could give a hand on that.
I would like to extract a sound file from the pressure-time data caculated after running any Foam solver on a pipe case, for instance, i.e. I ran the case, already, I have the pressure in the time directories, but I would like to transform it into a sound file, so I could assess the reliability of my results.

I had read (and tried) about probeToAudio, which was available in previous versions of OpenFoam (I have the lastest OpenFOAM-1.6-x) but although I implemented it and check it on pitzDaily tutorial case, with the probes as indicated in http://openfoamwiki.net/index.php/Contrib_probeToAudio, I got the same error result :

probeToAudio $FOAM_CASE/probes/0/p -column 1 -timeStretchRatio 10 -startTime 1e-4
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 1.6.x-3c7e63aa590d
Exec : probeToAudio /probes/0/p -column 1 -timeStretchRatio 10 -startTime 1e-4
Date : Apr 10 2010
Time : 16:12:43
Host : bertrand-laptop
PID : 3279
Case : /home/bertrand/OpenFOAM/bertrand-1.6.x/run/tutorials/incompressible/pisoFoam/les/pitzDaily
nProcs : 1
SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Create time

#0 Foam::error:rintStack(Foam::Ostream&) in "/home/bertrand/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libOpenFOAM.so"
#1 Foam::sigSegv::sigSegvHandler(int) in "/home/bertrand/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 ?? in "/lib/libc.so.6"
#3 std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) in "/home/bertrand/OpenFOAM/ThirdParty-1.6.x/gcc-4.3.3/platforms/linux64/lib64/libstdc++.so.6"
#4 main in "/home/bertrand/OpenFOAM/bertrand-1.6.x/applications/bin/linux64GccDPOpt/probeToAudio"
#5 __libc_start_main in "/lib/libc.so.6"
#6 _start at /build/buildd/eglibc-2.10.1/csu/../sysdeps/x86_64/elf/start.S:116
Segmentation fault

I am still not really familiar with implementing a new lib or application into an existing openFoam set, so I might have done something wrong.

I hope I was clear enough so that some of you can take a bit of their time to answer me.

Thank you!

Bertrand
Bertrand is offline   Reply With Quote

Old   April 10, 2010, 21:31
Default
  #2
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 20
7islands is on a distinguished road
Hi Bertrand,
I'm the one who wrote the utility and finally got a first feedback since the public release of more than two years ago! Shall take a look and let you know when fixed.

Takuya
7islands is offline   Reply With Quote

Old   April 11, 2010, 03:39
Default
  #3
New Member
 
Bertrand Delvaux
Join Date: Apr 2010
Posts: 29
Rep Power: 16
Bertrand is on a distinguished road
Hello Takuya,

Thank you for your very quick answer!

Actually, after writing my post, I tried again, and eventually could get it to work after installing setFunkyFields (which needs bison to be installed as well). The only thing is it didn't work with '/probes/0/p' but with 'probes/0/p' . I am pretty new to Linux, so I gotta get to know about syntaxes, installing packages and so on.

Although, I have 2 questions :

1. When I try to run potentialWaveFoam on the example case you gave, i.e. reverberationRoom, here is the error message that comes :

/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 1.6.x-3c7e63aa590d
Exec : potentialWaveFoam
Date : Apr 11 2010
Time : 09:23:42
Host : bertrand-laptop
PID : 4181
Case : /home/bertrand/OpenFOAM/bertrand-1.6.x/run/potentialWaveFoam/reverberationRoom
nProcs : 1
SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

// using new solver syntax:
phi
{
solver diagonal;
}

Reading transportProperties

Reading speed of sound c0

Reading density of medium rho

Reading field phi



--> FOAM FATAL IO ERROR:
size 53910 is not equal to the given value of 55500

file: /home/bertrand/OpenFOAM/bertrand-1.6.x/run/potentialWaveFoam/reverberationRoom/0/phi_0 from line 18 to line 53971.

From function Field<Type>::Field(const word& keyword, const dictionary&, const label)
in file /home/bertrand/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude/Field.C at line 237.

FOAM exiting


2. About the probeToAudio utility :

I tried on my 'special cavities' with initial conditions such as sinus or 1st half of a sinus and then clamped for the 2nd half. I could get the fundamental frequency I gave as an input. So it roughly gave me the tune I was looking for, which is a good start!!

A. How shall I use the sample rate now, if I want to have the exact fundamental frequency (and not an octave higher, lower), if I have, let's say, I have a pitch of F0 = 500 Hz, but I would like to catch more details about the overtones produced by this frequency?

B. How to represent data's from the probe file into a spectrum-plot? Is there a possibility for paraView?


Again, thanks a lot if you have time to answer one of these questions, I know I asked some...

Best,

Bertrand
Bertrand is offline   Reply With Quote

Old   April 11, 2010, 09:46
Default
  #4
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 20
7islands is on a distinguished road
Bertrand,

1. Can you try removing the whole potentialWaveFoam and its subdirectories, and start over from checking out the subversion repository?

2.A. I am not sure if I am getting your question right. The utility simply sets the sampling rate from the deltaT entry in controlDict and does no more complex processing. If you want to extract overtones you have to use a high-pass filter of some audio processing software or write your own somehow.

2.B. In theory yes you can use "FFT Of Selection Over Time" in ParaView, but I don't think it's a realistic option because you have to save/load the field data at every time step. I'd suggest you start by trying any one of audio processing softwares, for example Audacity, which is available from Synaptic if you are using Ubuntu. If that's not enough for you, you may have to write your own with e.g. SciPy.

Takuya
7islands is offline   Reply With Quote

Old   December 10, 2010, 16:00
Default
  #5
Senior Member
 
Mohammad
Join Date: Feb 2010
Location: Shiraz, Iran
Posts: 108
Rep Power: 16
m2montazari is on a distinguished road
7islands,

about the third answer(2B), I'm not so sure if using fft over time really needs to write all timesteps! I think we can write just SOME timesteps and have a good estimate of the result by for example 200 or 300 timesteps saved. although this might be inefficient for large cases, but could be used in some simpler cases.
help me if I'm wrong!!
Thank you,

Mohammad H.
m2montazari is offline   Reply With Quote

Old   December 10, 2010, 23:59
Default
  #6
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 20
7islands is on a distinguished road
Note that I said "I don't think it's a realistic option", of course only from my point of view. If you think different, just feel free to go ahead (and hopefully share your experience).

Takuya
7islands is offline   Reply With Quote

Old   May 18, 2020, 02:01
Default potentialWaveFoam Source code
  #7
New Member
 
Danya
Join Date: Feb 2020
Posts: 3
Rep Power: 6
Danya is on a distinguished road
Dear All,

Can any one please share the source code for potentialWaveFoam?
Looks like the link "https://www.openacoustics.org/svn-repo/foac/trunk/survey/OpenFOAM/potentialWaveFoam" is broken.

Thanks
Danya is offline   Reply With Quote

Reply

Tags
acoustics, openfoam, pressure, signal, sound


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
Installation of OpenFOAM-1.6 on Ubuntu 9.10 marval OpenFOAM Installation 2 March 17, 2010 08:33
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 10:23
[Gmsh] Compiling gmshFoam with OpenFOAM-1.5 BlGene OpenFOAM Meshing & Mesh Conversion 10 August 6, 2009 04:26
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 09:11


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