noiseFFT Class Reference

Performs FFT of pressure field to generate noise data. More...

Inheritance diagram for noiseFFT:
[legend]
Collaboration diagram for noiseFFT:
[legend]

Public Member Functions

 noiseFFT (const scalar deltaT, const label windowSize=-1)
 Construct from pressure field. More...
 
 ~noiseFFT ()
 Destructor. Cleanup/destroy plan. More...
 
void setData (scalarList &data)
 
void setData (const fileName &pFileName, const label skip=0)
 Set the pressure data by reading from file with an optional offset. More...
 
graph pt () const
 Return the graph of pressure as a function of time. More...
 
tmp< scalarFieldPf (const tmp< scalarField > &pn) const
 Return the fft of the given pressure data. More...
 
graph meanPf (const windowModel &window) const
 Return the multi-window mean fft of the complete pressure data [Pa]. More...
 
graph RMSmeanPf (const windowModel &window) const
 Return the multi-window RMS mean fft of the complete pressure. More...
 
graph PSDf (const windowModel &window) const
 Return the multi-window PSD (power spectral density) of the complete. More...
 
graph PSD (const graph &gPSDf) const
 Return the PSD [dB/Hz]. More...
 
graph octaves (const graph &g, const labelUList &freqBandIDs) const
 Generate octave data. More...
 
scalar dbToPa (const scalar db) const
 Convert the db into Pa. More...
 
tmp< scalarFielddbToPa (const tmp< scalarField > &db) const
 Convert the db-field into Pa. More...
 
- Public Member Functions inherited from Field< Type >
constexpr Field () noexcept
 Default construct. More...
 
 Field (const label len)
 Construct given size. More...
 
 Field (const label len, const Type &val)
 Construct given size and initial value. More...
 
 Field (const label len, const Foam::zero)
 Construct given size and initial values of zero. More...
 
 Field (const Foam::one, const Type &val)
 Construct with length=1, copying the value as the only content. More...
 
 Field (const Foam::one, Type &&val)
 Construct with length=1, moving the value as the only content. More...
 
 Field (const Foam::one, const Foam::zero)
 Construct with length=1, initializing content to zero. More...
 
 Field (const Field< Type > &fld)
 Copy construct. More...
 
 Field (const UList< Type > &list)
 Copy construct from UList<Type> More...
 
template<class Addr >
 Field (const IndirectListBase< Type, Addr > &list)
 Copy construct from IndirectList. More...
 
 Field (Field< Type > &&fld)
 Move construct from Field. More...
 
 Field (List< Type > &&list)
 Move construct from List. More...
 
template<int SizeMin>
 Field (DynamicList< Type, SizeMin > &&list)
 Move construct from DynamicList. More...
 
 Field (const UList< Type > &mapF, const labelUList &mapAddressing)
 Construct by 1 to 1 mapping from the given field. More...
 
 Field (const tmp< Field< Type >> &tmapF, const labelUList &mapAddressing)
 Construct by 1 to 1 mapping from the given tmp field. More...
 
 Field (const UList< Type > &mapF, const labelListList &mapAddressing, const scalarListList &weights)
 Construct by interpolative mapping from the given field. More...
 
 Field (const tmp< Field< Type >> &tmapF, const labelListList &mapAddressing, const scalarListList &weights)
 Construct by interpolative mapping from the given tmp field. More...
 
 Field (const UList< Type > &mapF, const FieldMapper &map, const bool applyFlip=true)
 Construct by mapping from the given field. More...
 
 Field (const UList< Type > &mapF, const FieldMapper &map, const Type &defaultValue, const bool applyFlip=true)
 Construct by mapping from the given field. More...
 
 Field (const UList< Type > &mapF, const FieldMapper &map, const UList< Type > &defaultValues, const bool applyFlip=true)
 Construct by mapping from the given field. More...
 
 Field (const tmp< Field< Type >> &tmapF, const FieldMapper &map, const bool applyFlip=true)
 Construct by mapping from the given tmp field. More...
 
 Field (const tmp< Field< Type >> &tmapF, const FieldMapper &map, const Type &defaultValue, const bool applyFlip=true)
 
 Field (const tmp< Field< Type >> &tmapF, const FieldMapper &map, const UList< Type > &defaultValues, const bool applyFlip=true)
 
 Field (Field< Type > &fld, bool reuse)
 Copy construct or re-use as specified. More...
 
 Field (const tmp< Field< Type >> &tfld)
 Copy or move construct from tmp. More...
 
 Field (Istream &is)
 Construct from Istream. More...
 
 Field (const word &keyword, const dictionary &dict, const label len)
 Construct from a dictionary entry. More...
 
tmp< Field< Type > > clone () const
 Clone. More...
 
void map (const UList< Type > &mapF, const labelUList &mapAddressing)
 1 to 1 map from the given field More...
 
void map (const tmp< Field< Type >> &tmapF, const labelUList &mapAddressing)
 1 to 1 map from the given tmp field More...
 
void map (const UList< Type > &mapF, const labelListList &mapAddressing, const scalarListList &weights)
 Interpolative map from the given field. More...
 
void map (const tmp< Field< Type >> &tmapF, const labelListList &mapAddressing, const scalarListList &weights)
 Interpolative map from the given tmp field. More...
 
void map (const UList< Type > &mapF, const FieldMapper &map, const bool applyFlip=true)
 Map from the given field. More...
 
void map (const tmp< Field< Type >> &tmapF, const FieldMapper &map, const bool applyFlip=true)
 Map from the given tmp field. More...
 
void autoMap (const FieldMapper &map, const bool applyFlip=true)
 Map from self. More...
 
void rmap (const UList< Type > &mapF, const labelUList &mapAddressing)
 1 to 1 reverse-map from the given field More...
 
void rmap (const tmp< Field< Type >> &tmapF, const labelUList &mapAddressing)
 1 to 1 reverse-map from the given tmp field More...
 
void rmap (const UList< Type > &mapF, const labelUList &mapAddressing, const UList< scalar > &weights)
 Interpolative reverse map from the given field. More...
 
void rmap (const tmp< Field< Type >> &tmapF, const labelUList &mapAddressing, const UList< scalar > &weights)
 Interpolative reverse map from the given tmp field. More...
 
void negate ()
 Negate this field (negative). More...
 
tmp< Field< cmptType > > component (const direction) const
 Return a component field of the field. More...
 
void replace (const direction, const UList< cmptType > &)
 Replace a component field of the field. More...
 
void replace (const direction, const tmp< Field< cmptType >> &)
 Replace a component field of the field. More...
 
void replace (const direction, const cmptType &)
 Replace a component field of the field. More...
 
template<class VSForm >
VSForm block (const label start) const
 
tmp< Field< Type > > T () const
 Return the field transpose (only defined for second rank tensors) More...
 
void writeEntry (const word &keyword, Ostream &os) const
 Write the field as a dictionary entry. More...
 
SubField< Type > slice (const label pos, label len=-1)
 Return SubField slice (non-const access) - no range checking. More...
 
const SubField< Type > slice (const label pos, label len=-1) const
 Return SubField slice (const access) - no range checking. More...
 
SubField< Type > slice (const labelRange &range)
 Return SubField slice (non-const access) - with range checking. More...
 
const SubField< Type > slice (const labelRange &range) const
 Return SubField slice (const access) - with range checking. More...
 
void operator= (const Field< Type > &)
 Copy assignment. More...
 
void operator= (const tmp< Field< Type >> &)
 
void operator= (const UList< Type > &rhs)
 
void operator= (const SubField< Type > &rhs)
 
template<class Addr >
void operator= (const IndirectListBase< Type, Addr > &rhs)
 Copy assign from IndirectList. More...
 
void operator= (Field< Type > &&rhs)
 Move assignment. More...
 
void operator= (List< Type > &&rhs)
 
template<int SizeMin>
void operator= (DynamicList< Type, SizeMin > &&rhs)
 
void operator= (const Type &val)
 Value assignment. More...
 
void operator= (const Foam::zero)
 
template<class Form , class Cmpt , direction nCmpt>
void operator= (const VectorSpace< Form, Cmpt, nCmpt > &)
 
void operator+= (const UList< Type > &)
 
void operator+= (const tmp< Field< Type >> &)
 
void operator-= (const UList< Type > &)
 
void operator-= (const tmp< Field< Type >> &)
 
void operator*= (const UList< scalar > &)
 
void operator*= (const tmp< Field< scalar >> &)
 
void operator/= (const UList< scalar > &)
 
void operator/= (const tmp< Field< scalar >> &)
 
void operator+= (const Type &)
 
void operator-= (const Type &)
 
void operator*= (const scalar &)
 
void operator/= (const scalar &)
 
template<class Type>
void operator= (const tmp< Field > &rhs)
 

Static Public Member Functions

static tmp< scalarFieldfrequencies (const label N, const scalar deltaT)
 Return the FFT frequencies. More...
 
static tmp< scalarFieldPSD (const scalarField &PSDf)
 Return the PSD [dB/Hz]. More...
 
static tmp< scalarFieldSPL (const scalarField &Prms2)
 Return the SPL [dB]. More...
 
static void octaveBandInfo (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. More...
 
- Static Public Member Functions inherited from Field< Type >
static const Field< Type > & null ()
 Return nullObject reference Field. More...
 
static autoPtr< Field< Type > > New (Istream &is)
 Return a pointer to a new Field created on freestore. More...
 
template<class Type2 >
static tmp< Field< Type > > NewCalculatedType (const Field< Type2 > &f)
 

Static Public Attributes

static scalar p0 = 2e-5
 Reference pressure. More...
 

Additional Inherited Members

- Public Types inherited from Field< Type >
typedef pTraits< Type >::cmptType cmptType
 Component type. More...
 
typedef SubField< Type > subField
 Declare type of subField. More...
 

Detailed Description

Performs FFT of pressure field to generate noise data.

General functionality:

  • Pf: fft of the pressure data
  • meanPf: multi-window mean fft
  • RMSmeanPf: multi-window RMS mean fft
  • PSDf: multi-window power spectral density (PSD) in frequency domain
  • PSD: power spectral density in dB/Hz
  • SPL: sound pressure level in dB

Octave-based data:

  • PSD spectrum
  • SPL spectrum
Source files
See also
windowModel.H

Definition at line 69 of file noiseFFT.H.

Constructor & Destructor Documentation

◆ noiseFFT()

noiseFFT ( const scalar  deltaT,
const label  windowSize = -1 
)

Construct from pressure field.

Definition at line 144 of file noiseFFT.C.

◆ ~noiseFFT()

~noiseFFT ( )

Destructor. Cleanup/destroy plan.

Definition at line 176 of file noiseFFT.C.

Member Function Documentation

◆ frequencies()

Foam::tmp< Foam::scalarField > frequencies ( const label  N,
const scalar  deltaT 
)
static

Return the FFT frequencies.

Definition at line 44 of file noiseFFT.C.

References f(), forAll, N(), tmp< T >::New(), and Foam::Zero.

Here is the call graph for this function:

◆ PSD() [1/2]

Foam::tmp< Foam::scalarField > PSD ( const scalarField PSDf)
static

Return the PSD [dB/Hz].

Input PSD in [Pa^2/Hz]

Definition at line 62 of file noiseFFT.C.

References Foam::log10(), p0, and Foam::sqr().

Here is the call graph for this function:

◆ SPL()

Foam::tmp< Foam::scalarField > SPL ( const scalarField Prms2)
static

Return the SPL [dB].

Input P(rms)^2 in [Pa^2]

Definition at line 68 of file noiseFFT.C.

References Foam::log10(), p0, and Foam::sqr().

Here is the call graph for this function:

◆ octaveBandInfo()

void octaveBandInfo ( const scalarField f,
const scalar  fLower,
const scalar  fUpper,
const scalar  octave,
labelList fBandIDs,
scalarField fCentre 
)
static

Return a list of the frequency indices wrt f field that.

correspond to the bands limits for a given octave

Definition at line 75 of file noiseFFT.C.

References f(), forAll, and Foam::pow().

Here is the call graph for this function:

◆ setData() [1/2]

void setData ( scalarList data)

Set the pressure data

Note
transfers storage to *this

Definition at line 189 of file noiseFFT.C.

References Foam::average(), and p.

Here is the call graph for this function:

◆ setData() [2/2]

void setData ( const fileName pFileName,
const label  skip = 0 
)

Set the pressure data by reading from file with an optional offset.

Definition at line 198 of file noiseFFT.C.

References Foam::average(), IOstream::eof(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, IOstream::good(), p, and T0.

Here is the call graph for this function:

◆ pt()

Foam::graph pt ( ) const

Return the graph of pressure as a function of time.

Definition at line 256 of file noiseFFT.C.

References forAll.

◆ Pf()

Foam::tmp< Foam::scalarField > Pf ( const tmp< scalarField > &  pn) const

Return the fft of the given pressure data.

Definition at line 276 of file noiseFFT.C.

References Foam::abort(), tmp< T >::clear(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::mag(), n, tmp< T >::New(), Foam::constant::atomic::re, fft::realTransform1D(), and Foam::sqrt().

Here is the call graph for this function:

◆ meanPf()

Foam::graph meanPf ( const windowModel window) const

Return the multi-window mean fft of the complete pressure data [Pa].

Definition at line 323 of file noiseFFT.C.

References windowModel::apply(), f(), forAll, N(), windowModel::nSamples(), windowModel::nWindow(), and Foam::Zero.

Here is the call graph for this function:

◆ RMSmeanPf()

Foam::graph RMSmeanPf ( const windowModel window) const

Return the multi-window RMS mean fft of the complete pressure.

data [Pa]

Definition at line 355 of file noiseFFT.C.

References windowModel::apply(), f(), forAll, N(), windowModel::nSamples(), windowModel::nWindow(), Foam::sqr(), Foam::sqrt(), and Foam::Zero.

Here is the call graph for this function:

◆ PSDf()

Foam::graph PSDf ( const windowModel window) const

Return the multi-window PSD (power spectral density) of the complete.

pressure data [Pa^2/Hz]

Definition at line 386 of file noiseFFT.C.

References windowModel::apply(), Foam::average(), Foam::endl(), f(), forAll, N(), windowModel::nSamples(), windowModel::nWindow(), Foam::Pout, Foam::sqr(), and Foam::Zero.

Here is the call graph for this function:

◆ PSD() [2/2]

Foam::graph PSD ( const graph gPSDf) const

Return the PSD [dB/Hz].

Takes PSD in [Pa^2/Hz]

Definition at line 431 of file noiseFFT.C.

References Foam::log10(), p0, Foam::sqr(), graph::x(), and graph::y().

Here is the call graph for this function:

◆ octaves()

Foam::graph octaves ( const graph g,
const labelUList freqBandIDs 
) const

Generate octave data.

Definition at line 445 of file noiseFFT.C.

References Foam::endl(), f(), g, UList< T >::size(), WarningInFunction, and Foam::Zero.

Here is the call graph for this function:

◆ dbToPa() [1/2]

Foam::scalar dbToPa ( const scalar  db) const

Convert the db into Pa.

Definition at line 501 of file noiseFFT.C.

References p0, and Foam::pow().

Here is the call graph for this function:

◆ dbToPa() [2/2]

Foam::tmp< Foam::scalarField > dbToPa ( const tmp< scalarField > &  db) const

Convert the db-field into Pa.

Definition at line 508 of file noiseFFT.C.

References p0, and Foam::pow().

Here is the call graph for this function:

Member Data Documentation

◆ p0

Foam::scalar p0 = 2e-5
static

Reference pressure.

Definition at line 109 of file noiseFFT.H.


The documentation for this class was generated from the following files: