initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / randomProcesses / noise / noiseFFT.H
blob7306840674f085b59ae26e467ee59e90f65d3db6
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::noiseFFT
28 Description
29     FFT of the pressure field
31 SourceFiles
32     noiseFFT.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef noiseFFT_H
37 #define noiseFFT_H
39 #include "scalarField.H"
40 #include "graph.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 /*---------------------------------------------------------------------------*\
48                            Class noiseFFT Declaration
49 \*---------------------------------------------------------------------------*/
51 class noiseFFT
53     public scalarField
55     // Private data
57         //- Time spacing of the raw data
58         scalar deltat_;
61 public:
63     //- Reference pressure
64     static scalar p0;
67     // Constructors
69         //- Construct from pressure field
70         noiseFFT
71         (
72             const scalar deltat,
73             const scalarField& pressure
74         );
76         //- Construct from Istream
77         noiseFFT(Istream&);
79         //- Construct from pressure field file name
80         noiseFFT(const fileName& pFileName, const label skip = 0);
83     // Member Functions
85         //- Return the graph of p(t)
86         graph pt() const;
88         //- Return the nth window
89         tmp<scalarField> window(const label N, const label n) const;
91         //- Return the Hanning window function
92         tmp<scalarField> Hanning(const label N) const;
94         //- Return the fft of the given pressure data
95         tmp<scalarField> Pf(const tmp<scalarField>& pn) const;
97         //- Return the multi-window mean fft of the complete pressure data
98         graph meanPf(const label N, const label nw) const;
100         //- Return the multi-window RMS mean fft of the complete pressure data
101         graph RMSmeanPf(const label N, const label nw) const;
103         //- Return the narrow-band PFL (pressure-fluctuation level) spectrum
104         graph Lf(const graph& gPf) const;
106         //- Return the one-third-octave-band PFL spectrum
107         //  starting at octave with mean frequency f1
108         graph Ldelta(const graph& gLf, const scalar f1, const scalar fU) const;
110         //- Return the one-third-octave-band pressure spectrum
111         //  starting at octave with mean frequency f1
112         graph Pdelta(const graph& gLf, const scalar f1, const scalar fU) const;
114         //- Return the total PFL as the sum of Lf over all frequencies
115         scalar Lsum(const graph& gLf) const;
117         //- Convert the db into Pa
118         scalar dbToPa(const scalar db) const;
120         //- Convert the db-field into Pa
121         tmp<scalarField> dbToPa(const tmp<scalarField>& db) const;
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 } // End namespace Foam
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 #endif
133 // ************************************************************************* //