00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2010 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 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your 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, see <http://www.gnu.org/licenses/>. 00023 00024 Class 00025 Foam::noiseFFT 00026 00027 Description 00028 FFT of the pressure field 00029 00030 SourceFiles 00031 noiseFFT.C 00032 00033 \*---------------------------------------------------------------------------*/ 00034 00035 #ifndef noiseFFT_H 00036 #define noiseFFT_H 00037 00038 #include <OpenFOAM/scalarField.H> 00039 #include <OpenFOAM/graph.H> 00040 00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00042 00043 namespace Foam 00044 { 00045 00046 /*---------------------------------------------------------------------------*\ 00047 Class noiseFFT Declaration 00048 \*---------------------------------------------------------------------------*/ 00049 00050 class noiseFFT 00051 : 00052 public scalarField 00053 { 00054 // Private data 00055 00056 //- Time spacing of the raw data 00057 scalar deltat_; 00058 00059 00060 public: 00061 00062 //- Reference pressure 00063 static scalar p0; 00064 00065 00066 // Constructors 00067 00068 //- Construct from pressure field 00069 noiseFFT 00070 ( 00071 const scalar deltat, 00072 const scalarField& pressure 00073 ); 00074 00075 //- Construct from Istream 00076 noiseFFT(Istream&); 00077 00078 //- Construct from pressure field file name 00079 noiseFFT(const fileName& pFileName, const label skip = 0); 00080 00081 00082 // Member Functions 00083 00084 //- Return the graph of p(t) 00085 graph pt() const; 00086 00087 //- Return the nth window 00088 tmp<scalarField> window(const label N, const label n) const; 00089 00090 //- Return the Hanning window function 00091 tmp<scalarField> Hanning(const label N) const; 00092 00093 //- Return the fft of the given pressure data 00094 tmp<scalarField> Pf(const tmp<scalarField>& pn) const; 00095 00096 //- Return the multi-window mean fft of the complete pressure data 00097 graph meanPf(const label N, const label nw) const; 00098 00099 //- Return the multi-window RMS mean fft of the complete pressure data 00100 graph RMSmeanPf(const label N, const label nw) const; 00101 00102 //- Return the narrow-band PFL (pressure-fluctuation level) spectrum 00103 graph Lf(const graph& gPf) const; 00104 00105 //- Return the one-third-octave-band PFL spectrum 00106 // starting at octave with mean frequency f1 00107 graph Ldelta(const graph& gLf, const scalar f1, const scalar fU) const; 00108 00109 //- Return the one-third-octave-band pressure spectrum 00110 // starting at octave with mean frequency f1 00111 graph Pdelta(const graph& gLf, const scalar f1, const scalar fU) const; 00112 00113 //- Return the total PFL as the sum of Lf over all frequencies 00114 scalar Lsum(const graph& gLf) const; 00115 00116 //- Convert the db into Pa 00117 scalar dbToPa(const scalar db) const; 00118 00119 //- Convert the db-field into Pa 00120 tmp<scalarField> dbToPa(const tmp<scalarField>& db) const; 00121 }; 00122 00123 00124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00125 00126 } // End namespace Foam 00127 00128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00129 00130 #endif 00131 00132 // ************************ vim: set sw=4 sts=4 et: ************************ //