Perform noise analysis on surface-based pressure data. More...


Public Member Functions | |
| TypeName ("surfaceNoise") | |
| Runtime type information. More... | |
| surfaceNoise (const dictionary &dict, const objectRegistry &obr, const word &name=typeName, 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, const objectRegistry &obr),(dict, obr)) | |
| Run time selection table. More... | |
| noiseModel (const noiseModel &)=delete | |
| No copy construct. More... | |
| void | operator= (const noiseModel &)=delete |
| No copy assignment. More... | |
| noiseModel (const dictionary &dict, const objectRegistry &obr, const word &name, 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... | |
Public Member Functions inherited from writeFile | |
| writeFile (const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true) | |
| Construct from objectRegistry, prefix, fileName. More... | |
| writeFile (const objectRegistry &obr, const fileName &prefix, const word &name, const dictionary &dict, const bool writeToFile=true) | |
| Construct from objectRegistry, prefix, fileName and read options from dictionary. More... | |
| writeFile (const writeFile &wf) | |
| Construct copy. More... | |
| virtual | ~writeFile ()=default |
| Destructor. More... | |
| virtual OFstream & | file () |
| Return access to the file (if only 1) More... | |
| virtual bool | writeToFile () const |
| Flag to allow writing to file. More... | |
| virtual bool | canWriteToFile () const |
| Flag to allow writing to the file. More... | |
| virtual bool | canResetFile () const |
| Flag to allow resetting the file. More... | |
| virtual bool | canWriteHeader () const |
| Flag to allow writing the header. More... | |
| virtual label | charWidth () const |
| Return width of character stream output. More... | |
| virtual void | writeCommented (Ostream &os, const string &str) const |
| Write a commented string to stream. More... | |
| virtual void | writeTabbed (Ostream &os, const string &str) const |
| Write a tabbed string to stream. More... | |
| virtual void | writeHeader (Ostream &os, const string &str) const |
| Write a commented header to stream. More... | |
| virtual void | writeCurrentTime (Ostream &os) const |
| Write the current time to stream. More... | |
| virtual void | writeBreak (Ostream &os) const |
| Write a break marker to the stream. More... | |
| template<class Type > | |
| void | writeHeaderValue (Ostream &os, const string &property, const Type &value) const |
| Write a (commented) header property and value pair. More... | |
| template<class Type > | |
| void | writeValue (Ostream &os, const Type &val) const |
| Write a given value to stream with the space delimiter. More... | |
Protected Member Functions | |
| void | initialise (const fileName &fName) |
| Initialise. More... | |
| void | readSurfaceData (const globalIndex &procFaceAddr, List< scalarField > &pData) |
| Read surface data. More... | |
| scalar | surfaceAverage (const scalarField &data, const globalIndex &procFaceAddr) const |
| Calculate the area average value. More... | |
| scalar | writeSurfaceData (const fileName &outDirBase, const word &fName, const word &title, const scalar freq, const scalarField &data, const globalIndex &procFaceAddr, const bool writeSurface) const |
| Write surface data to file. More... | |
Protected Member Functions inherited from noiseModel | |
| 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... | |
| fileName | baseFileDir (const label dataseti) const |
| Return the base output directory. More... | |
| void | writeFileHeader (Ostream &os, const string &x, const string &y, const UList< Tuple2< string, token >> &headerValues=UList< Tuple2< string, token >>::null()) const |
| Write output file header. More... | |
| void | writeFreqDataToFile (Ostream &os, const scalarField &f, const scalarField &fx) const |
| tmp< scalarField > | uniformFrequencies (const scalar deltaT, const bool check) const |
| Create a field of equally spaced frequencies for the current set of data - assumes a constant time step. More... | |
| 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 |
| Return the multi-window RMS mean fft of the complete pressure data [Pa]. More... | |
| tmp< scalarField > | PSDf (const scalarField &p, const scalar deltaT) const |
| Return the multi-window Power Spectral Density (PSD) of the complete pressure data [Pa^2/Hz]. More... | |
| 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 Member Functions inherited from writeFile | |
| void | initStream (Ostream &os) const |
| Initialise the output stream for writing. More... | |
| fileName | baseFileDir () const |
| Return the base directory for output. More... | |
| fileName | baseTimeDir () const |
| Return the base directory for the current time value. More... | |
| fileName | filePath (const fileName &fName) const |
| Return the full path for the supplied file name. More... | |
| virtual autoPtr< OFstream > | newFile (const fileName &fName) const |
| Return autoPtr to a new file using file name. More... | |
| virtual autoPtr< OFstream > | newFileAtTime (const word &name, scalar timeValue) const |
| Return autoPtr to a new file for a given time. More... | |
| virtual autoPtr< OFstream > | newFileAtStartTime (const word &name) const |
| Return autoPtr to a new file using the simulation start time. More... | |
| virtual void | resetFile (const word &name) |
| Reset internal file pointer to new file with new name. More... | |
| Omanip< int > | valueWidth (const label offset=0) const |
| Return the value width when writing to stream with optional offset. More... | |
| void | operator= (const writeFile &)=delete |
| No copy assignment. More... | |
| virtual autoPtr< OFstream > | createFile (const word &name, scalar timeValue) const |
| Deprecated(2022-09) Return autoPtr to a new file for a given time. More... | |
| virtual autoPtr< OFstream > | createFile (const word &name) const |
| Deprecated(2022-09) Return autoPtr to a new file using the simulation start time. 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 | nFaces_ |
| Global number of surface faces. More... | |
| label | fftWriteInterval_ |
| Frequency data output interval, default = 1. More... | |
| bool | areaAverage_ |
| Apply area average; default = no (ensemble average) for backwards compatibility. More... | |
| bool | useBroadcast_ |
| Use broadcast to send entire field to sub-ranks. More... | |
| UPstream::commsTypes | commType_ |
| Communication type (for sending/receiving fields) More... | |
| 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... | |
| 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... | |
Protected Attributes inherited from writeFile | |
| const objectRegistry & | fileObr_ |
| Reference to the region objectRegistry. More... | |
| const fileName | prefix_ |
| Prefix. More... | |
| word | fileName_ |
| Name of file. More... | |
| autoPtr< OFstream > | filePtr_ |
| File pointer. More... | |
| label | writePrecision_ |
| Write precision. More... | |
| bool | writeToFile_ |
| Flag to enable/disable writing to file. More... | |
| bool | updateHeader_ |
| Flag to update the header, e.g. on mesh changes. Default is true. More... | |
| bool | writtenHeader_ |
| Flag to identify whether the header has been written. More... | |
| bool | useUserTime_ |
| Flag to use the specified user time, e.g. CA deg instead of seconds. Default = true. More... | |
| scalar | startTime_ |
| Start time value. 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, const objectRegistry &obr) |
| Selector. More... | |
Static Public Attributes inherited from noiseModel | |
| static const Enum< weightingType > | weightingTypeNames_ |
Static Public Attributes inherited from writeFile | |
| static label | addChars = 8 |
| Additional characters for writing. More... | |
Static Protected Member Functions inherited from noiseModel | |
| static label | findStartTimeIndex (const instantList &allTimes, const scalar startTime) |
| Find and return start time index. More... | |
| static void | setOctaveBands (const scalarField &f, const scalar fLower, const scalar fUpper, const scalar octave, labelList &fBandIDs, scalarField &fCentre) |
| Return a list of the frequency indices wrt f field that correspond to the bands limits for a given octave. More... | |
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; // none
// 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;
}Communication Options
| Property | Description | Type | Req'd | Dflt |
|---|---|---|---|---|
commsType | Communication type for send/receive field | word | no | scheduled |
broadcast | (Experimental) broadcast all fields | bool | no | false |
Definition at line 151 of file surfaceNoise.H.
| surfaceNoise | ( | const dictionary & | dict, |
| const objectRegistry & | obr, | ||
| const word & | name = typeName, |
||
| const bool | readFields = true |
||
| ) |
Constructor.
Definition at line 422 of file surfaceNoise.C.
References dict, Foam::read(), and Foam::readFields().

|
virtualdefault |
Destructor.
|
protected |
Initialise.
Definition at line 42 of file surfaceNoise.C.
References Pstream::broadcasts(), noiseModel::checkUniformTimeStep(), surfaceNoise::deltaT_, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, writeFile::fileObr_, instant::findStart(), forAll, Foam::Info, UPstream::master(), surfaceReader::New(), PrimitivePatch< FaceList, PointField >::nFaces(), surfaceNoise::nFaces_, surfaceNoise::pIndex_, surfaceNoise::pName_, surfaceNoise::readerPtr_, surfaceNoise::readerType_, TimePaths::relativePath(), List< T >::setSize(), UList< T >::size(), noiseModel::startTime_, surfaceNoise::startTimeIndex_, objectRegistry::time(), surfaceNoise::times_, noiseModel::windowModelPtr_, and UPstream::worldComm.
Referenced by surfaceNoise::calculate().


|
protected |
Read surface data.
Definition at line 120 of file surfaceNoise.C.
References Foam::average(), Pstream::broadcast(), Foam::endl(), forAll, Foam::Info, globalIndex::localSize(), UPstream::master(), UPstream::msgType(), Foam::nl, UPstream::parRun(), globalIndex::range(), List< T >::resize(), List< T >::resize_nocopy(), Foam::returnReduce(), globalIndex::scatter(), Field< Type >::slice(), and UPstream::worldComm.
Referenced by surfaceNoise::calculate().


|
protected |
Calculate the area average value.
Definition at line 246 of file surfaceNoise.C.
References Pstream::broadcast(), globalIndex::gather(), MeshedSurface< Face >::magSf(), UPstream::master(), UPstream::msgType(), UPstream::parRun(), Foam::reduce(), Foam::sum(), and UPstream::worldComm.
Referenced by surfaceNoise::calculate().


|
protected |
Write surface data to file.
Returns the area average value
Definition at line 309 of file surfaceNoise.C.
References Pstream::broadcast(), Foam::endl(), globalIndex::gather(), Foam::Info, MeshedSurface< Face >::magSf(), UPstream::master(), UPstream::msgType(), Foam::name(), UPstream::parRun(), PrimitivePatch< FaceList, PointField >::points(), UList< T >::size(), Foam::sum(), MeshedSurface< Face >::surfFaces(), and UPstream::worldComm.
Referenced by surfaceNoise::calculate().


| TypeName | ( | "surfaceNoise" | ) |
Runtime type information.
|
virtual |
Read from dictionary.
Reimplemented from noiseModel.
Definition at line 454 of file surfaceNoise.C.
References surfaceNoise::areaAverage_, UPstream::commsTypeNames, surfaceNoise::commType_, dict, Foam::endl(), surfaceNoise::fftWriteInterval_, UList< T >::first(), surfaceWriter::formatOptions(), Foam::Info, surfaceNoise::inputFileNames_, surfaceWriter::New(), Foam::nl, UPstream::parRun(), surfaceNoise::pName_, noiseModel::read(), surfaceNoise::readerType_, Enum< EnumType >::readIfPresent(), dictionary::readIfPresent(), List< T >::resize(), Foam::type(), surfaceNoise::useBroadcast_, and surfaceNoise::writerPtr_.

|
virtual |
Calculate.
Implements noiseModel.
Definition at line 522 of file surfaceNoise.C.
References surfaceNoise::areaAverage_, writeFile::baseFileDir(), Pstream::broadcasts(), surfaceNoise::deltaT_, UList< T >::empty(), Foam::endl(), argList::envGlobalPath(), string::expand(), surfaceNoise::fftWriteInterval_, writeFile::filePath(), filePtr, noiseModel::fLower_, forAll, noiseModel::fUpper_, Foam::Info, surfaceNoise::initialise(), surfaceNoise::inputFileNames_, fileName::isAbsolute(), MeshedSurface< Face >::magSf(), UPstream::master(), Foam::max(), Foam::min(), Switch::name(), writeFile::newFile(), surfaceNoise::nFaces_, UPstream::nProcs(), windowModel::nSamples(), noiseModel::octaves(), globalIndex::offsets(), os(), p, UPstream::parRun(), noiseModel::PSD(), noiseModel::PSDf(), surfaceNoise::readerPtr_, surfaceNoise::readSurfaceData(), globalIndex::reset(), noiseModel::RMSmeanPf(), noiseModel::setOctaveBands(), List< T >::setSize(), UList< T >::size(), MeshedSurface< Face >::size(), noiseModel::SPL(), fileName::stem(), Foam::sum(), surfaceNoise::surfaceAverage(), noiseModel::uniformFrequencies(), WarningInFunction, noiseModel::windowModelPtr_, UPstream::worldComm, noiseModel::writeFileHeader(), noiseModel::writeFreqDataToFile(), noiseModel::writeOctaves_, noiseModel::writePrmsf_, noiseModel::writePSD_, noiseModel::writePSDf_, noiseModel::writeSPL_, surfaceNoise::writeSurfaceData(), and Foam::Zero.

Input file names.
Definition at line 162 of file surfaceNoise.H.
Referenced by surfaceNoise::calculate(), and surfaceNoise::read().
|
protected |
Name of pressure field.
Definition at line 167 of file surfaceNoise.H.
Referenced by surfaceNoise::initialise(), and surfaceNoise::read().
|
protected |
Index of pressure field in reader field list.
Definition at line 172 of file surfaceNoise.H.
Referenced by surfaceNoise::initialise().
|
protected |
Sample times.
Definition at line 177 of file surfaceNoise.H.
Referenced by surfaceNoise::initialise().
|
protected |
Time step (constant)
Definition at line 182 of file surfaceNoise.H.
Referenced by surfaceNoise::calculate(), and surfaceNoise::initialise().
|
protected |
Start time index.
Definition at line 187 of file surfaceNoise.H.
Referenced by surfaceNoise::initialise().
|
protected |
Global number of surface faces.
Definition at line 192 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 200 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 206 of file surfaceNoise.H.
Referenced by surfaceNoise::calculate(), and surfaceNoise::read().
|
protected |
Use broadcast to send entire field to sub-ranks.
Definition at line 211 of file surfaceNoise.H.
Referenced by surfaceNoise::read().
|
protected |
Communication type (for sending/receiving fields)
Definition at line 216 of file surfaceNoise.H.
Referenced by surfaceNoise::read().
|
protected |
Reader type.
Definition at line 221 of file surfaceNoise.H.
Referenced by surfaceNoise::initialise(), and surfaceNoise::read().
|
mutableprotected |
Pointer to the surface reader.
Definition at line 226 of file surfaceNoise.H.
Referenced by surfaceNoise::calculate(), and surfaceNoise::initialise().
|
mutableprotected |
Pointer to the surface writer.
Definition at line 231 of file surfaceNoise.H.
Referenced by surfaceNoise::read().
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.