Perform noise analysis on point-based pressure data. More...
Public Member Functions | |
TypeName ("pointNoise") | |
Runtime type information. More... | |
pointNoise (const dictionary &dict, const objectRegistry &obr, const word &name=typeName, const bool readFields=true) | |
Constructor. More... | |
virtual | ~pointNoise ()=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 | filterTimeData (const scalarField &t0, const scalarField &p0, scalarField &t, scalarField &p) const |
void | processData (const label dataseti, const Function1Types::CSV< scalar > &data) |
Process the CSV data. 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 - optional. 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 | sampleFreq_ |
Prescribed sample frequency. 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 point-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 { ... } // Pressure data supplied in CSV file format file "pressureData"; //files ("pressureData1" "pressureData2"); nHeaderLine 1; refColumn 0; componentColumns (1); separator " "; mergeSeparators yes;
Definition at line 88 of file pointNoise.H.
pointNoise | ( | const dictionary & | dict, |
const objectRegistry & | obr, | ||
const word & | name = typeName , |
||
const bool | readFields = true |
||
) |
Constructor.
Definition at line 220 of file pointNoise.C.
References dict, Foam::read(), and Foam::readFields().
|
virtualdefault |
Destructor.
|
protected |
Definition at line 40 of file pointNoise.C.
References forAll, p, p0, UList< T >::size(), and List< T >::transfer().
|
protected |
Process the CSV data.
Definition at line 65 of file pointNoise.C.
References Foam::average(), Foam::endl(), f(), filePtr, CSV< Type >::fName(), Foam::Info, UPstream::master(), Foam::nl, windowModel::nSamples(), os(), p, WarningInFunction, TableBase< Type >::x(), and TableBase< Type >::y().
Referenced by pointNoise::calculate().
TypeName | ( | "pointNoise" | ) |
Runtime type information.
|
virtual |
Read from dictionary.
Reimplemented from noiseModel.
Definition at line 262 of file pointNoise.C.
References dict, UList< T >::first(), pointNoise::inputFileNames_, noiseModel::read(), and List< T >::resize().
|
virtual |
Calculate.
Implements noiseModel.
Definition at line 238 of file pointNoise.C.
References noiseModel::dict_, argList::envGlobalPath(), string::expand(), forAll, pointNoise::inputFileNames_, fileName::isAbsolute(), UPstream::master(), and pointNoise::processData().
Input file names - optional.
Definition at line 100 of file pointNoise.H.
Referenced by pointNoise::calculate(), and pointNoise::read().