Perform noise analysis on surface-based pressure data. More...
Public Member Functions | |
TypeName ("surfaceNoise") | |
Runtime type information. More... | |
surfaceNoise (const dictionary &dict, const bool readFields=true) | |
Constructor. More... | |
virtual | ~surfaceNoise ()=default |
Destructor. More... | |
virtual bool | read (const dictionary &dict) |
Read from dictionary. More... | |
virtual void | calculate () |
Calculate. More... | |
Public Member Functions inherited from noiseModel | |
TypeName ("noiseModel") | |
Runtime type information. More... | |
declareRunTimeSelectionTable (autoPtr, noiseModel, dictionary,(const dictionary &dict),(dict)) | |
Run time selection table. More... | |
noiseModel (const dictionary &dict, const bool readFields=true) | |
Constructor. More... | |
virtual | ~noiseModel ()=default |
Destructor. More... | |
tmp< Foam::scalarField > | PSD (const scalarField &PSDf) const |
PSD [dB/Hz]. More... | |
tmp< scalarField > | SPL (const scalarField &Prms2, const scalar f) const |
SPL [dB]. More... | |
tmp< scalarField > | SPL (const scalarField &Prms2, const scalarField &f) const |
SPL [dB]. More... | |
void | cleanFFTW () |
Clean up the FFTW. More... | |
void | writeWeightings () const |
Helper function to check weightings. More... | |
Protected Member Functions | |
void | initialise (const fileName &fName) |
Initialise. More... | |
void | readSurfaceData (const labelList &procFaceOffset, List< scalarField > &pData) |
Read surface data. More... | |
scalar | writeSurfaceData (const fileName &outDirBase, const word &fName, const word &title, const scalar freq, const scalarField &data, const labelList &procFaceOffset, const bool writeSurface) const |
Write surface data to file. More... | |
scalar | surfaceAverage (const scalarField &data, const labelList &procFaceOffset) const |
Calculate the area average value. More... | |
Protected Member Functions inherited from noiseModel | |
void | readWriteOption (const dictionary &dict, const word &lookup, bool &option) const |
Helper function to read write options and provide info feedback. More... | |
scalar | checkUniformTimeStep (const scalarList ×) const |
Check and return uniform time step. More... | |
bool | validateBounds (const scalarList &p) const |
Return true if all pressure data is within min/max bounds. More... | |
label | findStartTimeIndex (const instantList &allTimes, const scalar startTime) const |
Find and return start time index. More... | |
fileName | baseFileDir (const label dataseti) const |
Return the base output directory. More... | |
tmp< scalarField > | uniformFrequencies (const scalar deltaT, const bool check) const |
tmp< scalarField > | octaves (const scalarField &data, const scalarField &f, const labelUList &freqBandIDs) const |
Generate octave data. More... | |
tmp< scalarField > | Pf (const scalarField &p) const |
Return the fft of the given pressure data. More... | |
tmp< scalarField > | meanPf (const scalarField &p) const |
Return the multi-window mean fft of the complete pressure data [Pa]. More... | |
tmp< scalarField > | RMSmeanPf (const scalarField &p) const |
tmp< scalarField > | PSDf (const scalarField &p, const scalar deltaT) const |
scalar | RAf (const scalar f) const |
A weighting function. More... | |
scalar | gainA (const scalar f) const |
A weighting as gain in dB. More... | |
scalar | RBf (const scalar f) const |
B weighting function. More... | |
scalar | gainB (const scalar f) const |
B weighting as gain in dB. More... | |
scalar | RCf (const scalar f) const |
C weighting function. More... | |
scalar | gainC (const scalar f) const |
C weighting as gain in dB. More... | |
scalar | RDf (const scalar f) const |
D weighting function. More... | |
scalar | gainD (const scalar f) const |
D weighting as gain in dB. More... | |
Protected Attributes | |
List< fileName > | inputFileNames_ |
Input file names. More... | |
word | pName_ |
Name of pressure field. More... | |
label | pIndex_ |
Index of pressure field in reader field list. More... | |
scalarList | times_ |
Sample times. More... | |
scalar | deltaT_ |
Time step (constant) More... | |
label | startTimeIndex_ |
Start time index. More... | |
label | nFace_ |
Number of surface faces. More... | |
label | fftWriteInterval_ |
Frequency data output interval, default = 1. More... | |
bool | areaAverage_ |
word | readerType_ |
Reader type. More... | |
autoPtr< surfaceReader > | readerPtr_ |
Pointer to the surface reader. More... | |
autoPtr< surfaceWriter > | writerPtr_ |
Pointer to the surface writer. More... | |
Protected Attributes inherited from noiseModel | |
const dictionary | dict_ |
Copy of dictionary used for construction. More... | |
scalar | rhoRef_ |
Reference density (to convert from kinematic to static pressure) More... | |
label | nSamples_ |
Number of samples in sampling window, default = 2^16. More... | |
scalar | fLower_ |
Lower frequency limit, default = 25Hz. More... | |
scalar | fUpper_ |
Upper frequency limit, default = 10kHz. More... | |
scalar | startTime_ |
Start time, default = 0s. More... | |
autoPtr< windowModel > | windowModelPtr_ |
Window model. More... | |
word | graphFormat_ |
Graph format. More... | |
weightingType | SPLweighting_ |
Weighting. More... | |
scalar | dBRef_ |
Reference for dB calculation, default = 2e-5. More... | |
scalar | minPressure_ |
Min pressure value. More... | |
scalar | maxPressure_ |
Min pressure value. More... | |
fileName | outputPrefix_ |
Output file prefix, default = ''. More... | |
bool | writePrmsf_ |
Write Prmsf; default = yes. More... | |
bool | writeSPL_ |
Write SPL; default = yes. More... | |
bool | writePSD_ |
Write PSD; default = yes. More... | |
bool | writePSDf_ |
Write PSDf; default = yes. More... | |
bool | writeOctaves_ |
Write writeOctaves; default = yes. More... | |
planInfo | planInfo_ |
Plan information for FFTW. More... | |
Additional Inherited Members | |
Public Types inherited from noiseModel | |
enum | weightingType { none, dBA, dBB, dBC, dBD } |
Static Public Member Functions inherited from noiseModel | |
static autoPtr< noiseModel > | New (const dictionary &dict) |
Selector. More... | |
Static Public Attributes inherited from noiseModel | |
static const Enum< weightingType > | weightingTypeNames_ |
Static Protected Member Functions inherited from noiseModel | |
static void | setOctaveBands (const scalarField &f, const scalar fLower, const scalar fUpper, const scalar octave, labelList &fBandIDs, scalarField &fCentre) |
Perform noise analysis on surface-based pressure data.
Input data is read from a dictionary, e.g.
// Pressure reference pRef 0; // Number of samples in sampling window, default = 2^16 (=65536) N 4096; // Lower frequency bounds fl 25; // Upper frequency bounds fu 25; // Start time startTime 0; windowModel <modelType> <modelType>Coeffs { ... } // Input file file "postProcessing/faceSource1/surface/patch/patch.case"; //files ("postProcessing/faceSource1/surface/patch/patch.case"); // Write interval for FFT data, default = 1 fftWriteInterval 100; // Area-weighted averaging switch, default = no (ensemble) for backwards // compatibility areaAverage yes; // Surface reader reader ensight; // Surface writer writer ensight; // Collate times for ensight output - ensures geometry is only written once writeOptions { ensight { collateTimes true; } // Write Prmsf; default = yes writePrmsf no; // Write SPL; default = yes writeSPL yes; // Write PSD; default = yes writePSD yes; // Write PSDf; default = yes writePSDf no; // Write writeOctaves; default = yes writeOctaves yes; }
Definition at line 130 of file surfaceNoise.H.
surfaceNoise | ( | const dictionary & | dict, |
const bool | readFields = true |
||
) |
Constructor.
Definition at line 430 of file surfaceNoise.C.
References dict, surfaceNoise::read(), and Foam::readFields().
|
virtualdefault |
Destructor.
|
protected |
Initialise.
Definition at line 49 of file surfaceNoise.C.
References noiseModel::checkUniformTimeStep(), surfaceNoise::deltaT_, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, fieldNames(), noiseModel::findStartTimeIndex(), forAll, Foam::Info, UPstream::master(), surfaceReader::New(), surfaceNoise::nFace_, surfaceNoise::pIndex_, surfaceNoise::pName_, surfaceNoise::readerPtr_, surfaceNoise::readerType_, Pstream::scatter(), List< T >::setSize(), MeshedSurface< Face >::size(), noiseModel::startTime_, surfaceNoise::startTimeIndex_, surfaceNoise::times_, and noiseModel::windowModelPtr_.
Referenced by surfaceNoise::calculate().
|
protected |
Read surface data.
Definition at line 118 of file surfaceNoise.C.
References UPstream::allProcs(), Foam::average(), PstreamBuffers::clear(), Foam::endl(), PstreamBuffers::finishedSends(), forAll, Foam::Info, UPstream::master(), UPstream::myProcNo(), Foam::nl, UPstream::nonBlocking, p, UPstream::parRun(), Foam::returnReduce(), and List< T >::setSize().
Referenced by surfaceNoise::calculate().
|
protected |
Write surface data to file.
Returns the area average value
Definition at line 241 of file surfaceNoise.C.
References List< T >::clear(), Foam::endl(), PstreamBuffers::finishedSends(), forAll, Foam::Info, MeshedSurface< Face >::magSf(), UPstream::master(), Foam::name(), UPstream::nonBlocking, UPstream::parRun(), Pstream::scatter(), MeshedSurface< Face >::size(), UPstream::subProcs(), Foam::sum(), and MeshedSurface< Face >::surfFaces().
Referenced by surfaceNoise::calculate().
|
protected |
Calculate the area average value.
Definition at line 365 of file surfaceNoise.C.
References PstreamBuffers::finishedSends(), forAll, UPstream::master(), UPstream::nonBlocking, UPstream::parRun(), Pstream::scatter(), MeshedSurface< Face >::size(), UPstream::subProcs(), and Foam::sum().
Referenced by surfaceNoise::calculate().
TypeName | ( | "surfaceNoise" | ) |
Runtime type information.
|
virtual |
Read from dictionary.
Reimplemented from noiseModel.
Definition at line 455 of file surfaceNoise.C.
References surfaceNoise::areaAverage_, dict, Foam::endl(), surfaceNoise::fftWriteInterval_, Foam::Info, surfaceNoise::inputFileNames_, surfaceWriter::New(), Foam::nl, surfaceNoise::pName_, noiseModel::read(), surfaceNoise::readerType_, List< T >::resize(), and surfaceNoise::writerPtr_.
Referenced by surfaceNoise::surfaceNoise().
|
virtual |
Calculate.
Implements noiseModel.
Definition at line 504 of file surfaceNoise.C.
References noiseModel::baseFileDir(), surfaceNoise::deltaT_, Foam::endl(), argList::envGlobalPath(), string::expand(), surfaceNoise::fftWriteInterval_, noiseModel::fLower_, forAll, noiseModel::fUpper_, noiseModel::graphFormat_, Foam::Info, surfaceNoise::initialise(), surfaceNoise::inputFileNames_, fileName::isAbsolute(), UPstream::master(), Foam::max(), Foam::min(), fileName::nameLessExt(), surfaceNoise::nFace_, UPstream::nProcs(), windowModel::nSamples(), noiseModel::octaves(), p, UPstream::parRun(), noiseModel::PSD(), noiseModel::PSDf(), surfaceNoise::readSurfaceData(), noiseModel::RMSmeanPf(), noiseModel::setOctaveBands(), List< T >::setSize(), noiseModel::SPL(), surfaceNoise::surfaceAverage(), graph::title(), noiseModel::uniformFrequencies(), WarningInFunction, noiseModel::windowModelPtr_, graph::wordify(), graph::write(), noiseModel::writeOctaves_, noiseModel::writePrmsf_, noiseModel::writePSD_, noiseModel::writePSDf_, noiseModel::writeSPL_, surfaceNoise::writeSurfaceData(), and Foam::Zero.
Input file names.
Definition at line 140 of file surfaceNoise.H.
Referenced by surfaceNoise::calculate(), and surfaceNoise::read().
|
protected |
Name of pressure field.
Definition at line 143 of file surfaceNoise.H.
Referenced by surfaceNoise::initialise(), and surfaceNoise::read().
|
protected |
Index of pressure field in reader field list.
Definition at line 146 of file surfaceNoise.H.
Referenced by surfaceNoise::initialise().
|
protected |
Sample times.
Definition at line 149 of file surfaceNoise.H.
Referenced by surfaceNoise::initialise().
|
protected |
Time step (constant)
Definition at line 152 of file surfaceNoise.H.
Referenced by surfaceNoise::calculate(), and surfaceNoise::initialise().
|
protected |
Start time index.
Definition at line 155 of file surfaceNoise.H.
Referenced by surfaceNoise::initialise().
|
protected |
Number of surface faces.
Definition at line 158 of file surfaceNoise.H.
Referenced by surfaceNoise::calculate(), and surfaceNoise::initialise().
|
protected |
Frequency data output interval, default = 1.
nSamples/2 data points are returned from the FFT, which can result in a very large number of output files (1 per frequency)
Definition at line 163 of file surfaceNoise.H.
Referenced by surfaceNoise::calculate(), and surfaceNoise::read().
|
protected |
Apply area average; default = no (ensemble average) for backwards compatibility
Definition at line 167 of file surfaceNoise.H.
Referenced by surfaceNoise::read().
|
protected |
Reader type.
Definition at line 170 of file surfaceNoise.H.
Referenced by surfaceNoise::initialise(), and surfaceNoise::read().
|
mutableprotected |
Pointer to the surface reader.
Definition at line 173 of file surfaceNoise.H.
Referenced by surfaceNoise::initialise().
|
mutableprotected |
Pointer to the surface writer.
Definition at line 176 of file surfaceNoise.H.
Referenced by surfaceNoise::read().