|
[Sponsors] |
How to extract sound file from pressure-time OpenFoam data? |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
Bertrand Delvaux
Join Date: Apr 2010
Posts: 29
Rep Power: 16 ![]() |
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: ![]() #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 |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Super Moderator
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 20 ![]() |
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! ![]() Takuya |
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
Bertrand Delvaux
Join Date: Apr 2010
Posts: 29
Rep Power: 16 ![]() |
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' ![]() 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 |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Super Moderator
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 20 ![]() |
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 |
|
![]() |
![]() |
![]() |
![]() |
#5 |
Senior Member
Mohammad
Join Date: Feb 2010
Location: Shiraz, Iran
Posts: 108
Rep Power: 16 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#6 |
Super Moderator
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 20 ![]() |
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 |
|
![]() |
![]() |
![]() |
![]() |
#7 |
New Member
Danya
Join Date: Feb 2020
Posts: 3
Rep Power: 6 ![]() |
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 |
|
![]() |
![]() |
![]() |
Tags |
acoustics, openfoam, pressure, signal, sound |
|
|
![]() |
||||
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 |