CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Noise postprocessing utility setup (https://www.cfd-online.com/Forums/openfoam-post-processing/181423-noise-postprocessing-utility-setup.html)

RFlamm December 14, 2016 04:45

Noise postprocessing utility setup
 
Just sharing how to set up the noise utility

I recently took a CFD class and wanted to try OpenFoam for the purpose of studying acoustics. After digging around I found the Noise utility, which uses the FFT library, and thought it might be useful. That being said, it was very difficult to find much documentation on how to set up and use it. So after messing with it for a while, I thought I would post what I was able to do so others have a little more direction on how to use it.

You will need a noiseDict file in the system directory with the format:

XXXXXXXXXXXXXXXXXX

pRef 16.32e-06;
N 128;
nw 100;
f1 25;
fU 10000;
graphFormat raw;

pressureData
{
fileName /* "$FOAM_CASE*/ "pressureData";
nHeaderLine 0; // number of header lines
refColumn 80; // reference column index
componentColumns (1); // component column indices
separator " "; // optional (defaults to ",")
mergeSeparators yes; // merge multiple separators
outOfBounds clamp; // optional out-of-bounds handling
interpolationScheme linear; // optional interpolation scheme
}
XXXXXXXXXXXXXXXXXXX


more info on the format can be found in the noice.C file.


To get the pressure data I used a probe at a desired point in the case grid. To run the utility you will also need to add the following to the Functions section of your controlDict. (though I think it can also be added in the noiseDict as well.)


XXXXXXXXXXX

noise
{
type noise;
functionObjectLibs ("libutilityFunctionObjects.so");
outputControl timeStep;
ouputInterval 1;
}

XXXXXXXXXXX


Now you will need to run your solver. Unfortunately the noise utility does not seem to create the pressureData file. So instead I manually pulled the pressure data file from my probe directory and copied it to the case directory, though I'm sure it wouldn't be difficult to automate this. Once your pressureData file is in place and correctly named, you can run the noise postprocessing utility. The terminal command is noise. If everything is set up correctly, 4 data files will be added to your case file directory containing the following data
- FFT of the pressure data
- narrow-band PFL (pressure-fluctuation level) spectrum
- one-third-octave-band PFL spectrum
- one-third-octave-band pressure spectrum
These data files can then be graphed with your preferred method. I used gnuplot as well as mathematica.


Possible errors
  • Cannot open CSV file for reading
    • file is either named incorrectly or not present
  • Invalid first character found
    • the probe data comes with some headers, so either delete them from the data file or add more header place holders in your noiseDict
  • Block size N=65536 is larger than number of data
    • N needs to be a value of 2^n, and can't be larger then the number of rows in your data file.
  • unable to process data with variable time step
    • self explanatory, make sure the time step is consistent


P.S I apologize if this information is elementary. Just trying to help. :D

Mahe88 December 14, 2016 05:14

Hey,

I've just read your post, interesting informations!!

I want to do something similar. My goal is to investigate the noise of a wind turbine wing. Therefore I would be interested in more information. For example, do you have any recommendation in which solver or turbulence model should be used. If you tried out multiple combinations you could share your experience using them?

Thanks a lot!

pankajhrajput January 19, 2017 10:40

Quote:

Originally Posted by RFlamm (Post 629608)
Possible errors
  • Cannot open CSV file for reading
    • file is either named incorrectly or not present
  • Invalid first character found
    • the probe data comes with some headers, so either delete them from the data file or add more header place holders in your noiseDict
  • Block size N=65536 is larger than number of data
    • N needs to be a value of 2^n, and can't be larger then the number of rows in your data file.
  • unable to process data with variable time step
    • self explanatory, make sure the time step is consistent


P.S I apologize if this information is elementary. Just trying to help. :D

Thanks for sharing that piece of information. I followed the steps outlined by you (as there's no documentation whatsoever for noise utility), However, I am getting a weird error mentioned below:
Code:

--> FOAM FATAL ERROR:
out-of-order value: 102355 at index 10

    From function void Foam::Function1Types::TableBase<Type>::check() const [with Type = double]
    in file /home/pankaj/OpenFOAM+/OpenFOAM-v1612+/src/OpenFOAM/lnInclude/TableBase.C at line 208.

FOAM exiting

Any ideas what could be going wrong? Why does the pressure data need to be in ascending order??

Attesz March 29, 2017 04:58

Many thanks for this info. Any success on automating the probe postprocessing after the simulation finished? Thanks!

rarnaunot June 25, 2018 04:00

Hi!

How did you solve this error?
I got the same FOAM FATAL ERROR message :(

Thanks

[QUOTE=pankajhrajput;633930]
Code:

--> FOAM FATAL ERROR:
out-of-order value: 102355 at index 10

    From function void Foam::Function1Types::TableBase<Type>::check() const [with Type = double]
    in file /home/pankaj/OpenFOAM+/OpenFOAM-v1612+/src/OpenFOAM/lnInclude/TableBase.C at line 208.

FOAM exiting


kirby031 July 30, 2018 10:06

pressure File
 
Quote:

Originally Posted by RFlamm (Post 629608)
Just sharing how to set up the noise utility

I recently took a CFD class and wanted to try OpenFoam for the purpose of studying acoustics. After digging around I found the Noise utility, which uses the FFT library, and thought it might be useful. That being said, it was very difficult to find much documentation on how to set up and use it. So after messing with it for a while, I thought I would post what I was able to do so others have a little more direction on how to use it.

You will need a noiseDict file in the system directory with the format:

XXXXXXXXXXXXXXXXXX

pRef 16.32e-06;
N 128;
nw 100;
f1 25;
fU 10000;
graphFormat raw;

pressureData
{
fileName /* "$FOAM_CASE*/ "pressureData";
nHeaderLine 0; // number of header lines
refColumn 80; // reference column index
componentColumns (1); // component column indices
separator " "; // optional (defaults to ",")
mergeSeparators yes; // merge multiple separators
outOfBounds clamp; // optional out-of-bounds handling
interpolationScheme linear; // optional interpolation scheme
}
XXXXXXXXXXXXXXXXXXX


more info on the format can be found in the noice.C file.


To get the pressure data I used a probe at a desired point in the case grid. To run the utility you will also need to add the following to the Functions section of your controlDict. (though I think it can also be added in the noiseDict as well.)


XXXXXXXXXXX

noise
{
type noise;
functionObjectLibs ("libutilityFunctionObjects.so");
outputControl timeStep;
ouputInterval 1;
}

XXXXXXXXXXX


Now you will need to run your solver. Unfortunately the noise utility does not seem to create the pressureData file. So instead I manually pulled the pressure data file from my probe directory and copied it to the case directory, though I'm sure it wouldn't be difficult to automate this. Once your pressureData file is in place and correctly named, you can run the noise postprocessing utility. The terminal command is noise. If everything is set up correctly, 4 data files will be added to your case file directory containing the following data
- FFT of the pressure data
- narrow-band PFL (pressure-fluctuation level) spectrum
- one-third-octave-band PFL spectrum
- one-third-octave-band pressure spectrum
These data files can then be graphed with your preferred method. I used gnuplot as well as mathematica.


Possible errors
  • Cannot open CSV file for reading
    • file is either named incorrectly or not present
  • Invalid first character found
    • the probe data comes with some headers, so either delete them from the data file or add more header place holders in your noiseDict
  • Block size N=65536 is larger than number of data
    • N needs to be a value of 2^n, and can't be larger then the number of rows in your data file.
  • unable to process data with variable time step
    • self explanatory, make sure the time step is consistent


P.S I apologize if this information is elementary. Just trying to help. :D

Hi, could you provide the format of the pressure file? I have time and pressure data but it does not function.
Best wishes


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