OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

noiseFFT.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::noiseFFT
00027 
00028 Description
00029     FFT of the pressure field
00030 
00031 SourceFiles
00032     noiseFFT.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef noiseFFT_H
00037 #define noiseFFT_H
00038 
00039 #include "scalarField.H"
00040 #include "graph.H"
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 /*---------------------------------------------------------------------------*\
00048                            Class noiseFFT Declaration
00049 \*---------------------------------------------------------------------------*/
00050 
00051 class noiseFFT
00052 :
00053     public scalarField
00054 {
00055     // Private data
00056 
00057         //- Time spacing of the raw data
00058         scalar deltat_;
00059 
00060 
00061 public:
00062 
00063     //- Reference pressure
00064     static scalar p0;
00065 
00066 
00067     // Constructors
00068 
00069         //- Construct from pressure field
00070         noiseFFT
00071         (
00072             const scalar deltat,
00073             const scalarField& pressure
00074         );
00075 
00076         //- Construct from Istream
00077         noiseFFT(Istream&);
00078 
00079         //- Construct from pressure field file name
00080         noiseFFT(const fileName& pFileName, const label skip = 0);
00081 
00082 
00083     // Member Functions
00084 
00085         //- Return the graph of p(t)
00086         graph pt() const;
00087 
00088         //- Return the nth window
00089         tmp<scalarField> window(const label N, const label n) const;
00090 
00091         //- Return the Hanning window function
00092         tmp<scalarField> Hanning(const label N) const;
00093 
00094         //- Return the fft of the given pressure data
00095         tmp<scalarField> Pf(const tmp<scalarField>& pn) const;
00096 
00097         //- Return the multi-window mean fft of the complete pressure data
00098         graph meanPf(const label N, const label nw) const;
00099 
00100         //- Return the multi-window RMS mean fft of the complete pressure data
00101         graph RMSmeanPf(const label N, const label nw) const;
00102 
00103         //- Return the narrow-band PFL (pressure-fluctuation level) spectrum
00104         graph Lf(const graph& gPf) const;
00105 
00106         //- Return the one-third-octave-band PFL spectrum
00107         //  starting at octave with mean frequency f1
00108         graph Ldelta(const graph& gLf, const scalar f1, const scalar fU) const;
00109 
00110         //- Return the one-third-octave-band pressure spectrum
00111         //  starting at octave with mean frequency f1
00112         graph Pdelta(const graph& gLf, const scalar f1, const scalar fU) const;
00113 
00114         //- Return the total PFL as the sum of Lf over all frequencies
00115         scalar Lsum(const graph& gLf) const;
00116 
00117         //- Convert the db into Pa
00118         scalar dbToPa(const scalar db) const;
00119 
00120         //- Convert the db-field into Pa
00121         tmp<scalarField> dbToPa(const tmp<scalarField>& db) const;
00122 };
00123 
00124 
00125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00126 
00127 } // End namespace Foam
00128 
00129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00130 
00131 #endif
00132 
00133 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd