mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Noise functionality library and application updates
This commit is contained in:
@ -107,7 +107,7 @@ int main(int argc, char *argv[])
|
|||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|
||||||
word dictName("noiseDict");
|
fileName dictName(runTime.system()/"noiseDict");
|
||||||
if (args.optionFound("dict"))
|
if (args.optionFound("dict"))
|
||||||
{
|
{
|
||||||
dictName = args["dict"];
|
dictName = args["dict"];
|
||||||
@ -118,7 +118,6 @@ int main(int argc, char *argv[])
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
dictName,
|
dictName,
|
||||||
runTime.system(),
|
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::MUST_READ
|
IOobject::MUST_READ
|
||||||
)
|
)
|
||||||
|
|||||||
136
applications/utilities/postProcessing/noise/noiseDict
Normal file
136
applications/utilities/postProcessing/noise/noiseDict
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: plus |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
location "system";
|
||||||
|
object noiseDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
noiseModel surfaceNoise;
|
||||||
|
|
||||||
|
surfaceNoiseCoeffs
|
||||||
|
{
|
||||||
|
windowModel Hanning;
|
||||||
|
|
||||||
|
HanningCoeffs
|
||||||
|
{
|
||||||
|
// Window overlap percentage
|
||||||
|
overlapPercent 50;
|
||||||
|
symmetric yes;
|
||||||
|
extended yes;
|
||||||
|
|
||||||
|
// Optional number of windows, default = all available
|
||||||
|
// nWindow 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
windowModel uniform;
|
||||||
|
|
||||||
|
uniformCoeffs
|
||||||
|
{
|
||||||
|
// Window overlap percentage
|
||||||
|
overlapPercent 50;
|
||||||
|
|
||||||
|
value 1;
|
||||||
|
|
||||||
|
// Optional number of windows, default = all available
|
||||||
|
// nWindow 1;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// Input file
|
||||||
|
inputFile "postProcessing/faceSource1/surface/patch_motorBike_rider-helmet%65/patch_motorBike_rider-helmet%65.case";
|
||||||
|
|
||||||
|
// Surface reader
|
||||||
|
reader ensight;
|
||||||
|
|
||||||
|
// Surface writer
|
||||||
|
writer ensight;
|
||||||
|
|
||||||
|
// Collate times for ensight output - ensures geometry is only written once
|
||||||
|
writeOptions
|
||||||
|
{
|
||||||
|
ensight
|
||||||
|
{
|
||||||
|
collateTimes 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reference density (to convert from kinematic to static pressure)
|
||||||
|
rhoRef 1.205;
|
||||||
|
|
||||||
|
// Number of samples in sampling window
|
||||||
|
// Must be a power of 2, default = 2^16 (=65536)
|
||||||
|
N 4096; // 8192; // 4096;
|
||||||
|
|
||||||
|
// Lower frequency limit, default = 25Hz
|
||||||
|
//fl 25;
|
||||||
|
|
||||||
|
// Upper frequency limit, default = 10kHz
|
||||||
|
fu 15000;
|
||||||
|
|
||||||
|
// Start time, default = 0s
|
||||||
|
//startTime 0;
|
||||||
|
|
||||||
|
// Write interval for FFT data, default = 1
|
||||||
|
// fftWriteInterval 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
pointNoiseCoeffs
|
||||||
|
{
|
||||||
|
csvFileData
|
||||||
|
{
|
||||||
|
fileName "pressureData";
|
||||||
|
nHeaderLine 1;
|
||||||
|
refColumn 0;
|
||||||
|
componentColumns (1);
|
||||||
|
separator " ";
|
||||||
|
mergeSeparators yes;
|
||||||
|
}
|
||||||
|
|
||||||
|
HanningCoeffs
|
||||||
|
{
|
||||||
|
// Window overlap percentage
|
||||||
|
overlapPercent 50;
|
||||||
|
symmetric yes;
|
||||||
|
extended yes;
|
||||||
|
|
||||||
|
// Optional number of windows, default = all available
|
||||||
|
//nWindow 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Graph format, default = raw
|
||||||
|
graphFormat raw;
|
||||||
|
|
||||||
|
// Reference density (to convert from kinematic to static pressure)
|
||||||
|
rhoRef 1.2;
|
||||||
|
|
||||||
|
// Number of samples in sampling window
|
||||||
|
// Must be a power of 2, default = 2^16 (=65536)
|
||||||
|
N 4096;
|
||||||
|
|
||||||
|
// Lower frequency limit, default = 25Hz
|
||||||
|
//fl 25;
|
||||||
|
|
||||||
|
// Upper frequency limit, default = 10kHz
|
||||||
|
//fu 10000;
|
||||||
|
|
||||||
|
// Start time, default = 0s
|
||||||
|
//startTime 0;
|
||||||
|
|
||||||
|
// Write interval for FFT data, default = 1
|
||||||
|
fftWriteInterval 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -3,7 +3,6 @@ $(Kmesh)/Kmesh.C
|
|||||||
|
|
||||||
fft = fft
|
fft = fft
|
||||||
$(fft)/fft.C
|
$(fft)/fft.C
|
||||||
$(fft)/fftRenumber.C
|
|
||||||
$(fft)/calcEk.C
|
$(fft)/calcEk.C
|
||||||
$(fft)/kShellIntegration.C
|
$(fft)/kShellIntegration.C
|
||||||
|
|
||||||
@ -26,6 +25,7 @@ windowModels = windowModels
|
|||||||
$(windowModels)/windowModel/windowModel.C
|
$(windowModels)/windowModel/windowModel.C
|
||||||
$(windowModels)/windowModel/windowModelNew.C
|
$(windowModels)/windowModel/windowModelNew.C
|
||||||
$(windowModels)/Hanning/Hanning.C
|
$(windowModels)/Hanning/Hanning.C
|
||||||
|
$(windowModels)/uniform/uniform.C
|
||||||
|
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/librandomProcesses
|
LIB = $(FOAM_LIBBIN)/librandomProcesses
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
|
-I$(FFTW_ARCH_PATH)/include \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/sampling/lnInclude \
|
-I$(LIB_SRC)/sampling/lnInclude \
|
||||||
-I$(LIB_SRC)/surfMesh/lnInclude
|
-I$(LIB_SRC)/surfMesh/lnInclude
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
|
-L$(FFTW_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) -lfftw3 \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
-lsampling \
|
-lsampling \
|
||||||
-lsurfMesh
|
-lsurfMesh
|
||||||
|
|||||||
@ -26,9 +26,10 @@ License
|
|||||||
#include "noiseFFT.H"
|
#include "noiseFFT.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
#include "fft.H"
|
|
||||||
#include "SubField.H"
|
#include "SubField.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "mathematicalConstants.H"
|
||||||
|
#include "HashSet.H"
|
||||||
|
#include "fft.H"
|
||||||
|
|
||||||
using namespace Foam::constant;
|
using namespace Foam::constant;
|
||||||
|
|
||||||
@ -44,7 +45,7 @@ Foam::tmp<Foam::scalarField> Foam::noiseFFT::frequencies
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
tmp<scalarField> tf(new scalarField(N/2, 0));
|
tmp<scalarField> tf(new scalarField(N/2, 0));
|
||||||
scalarField& f = tf();
|
scalarField& f = tf.ref();
|
||||||
|
|
||||||
scalar deltaf = 1.0/(N*deltaT);
|
scalar deltaf = 1.0/(N*deltaT);
|
||||||
forAll(f, i)
|
forAll(f, i)
|
||||||
@ -56,70 +57,80 @@ Foam::tmp<Foam::scalarField> Foam::noiseFFT::frequencies
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::noiseFFT::octaveFrequenciesIDs
|
Foam::tmp<Foam::scalarField> Foam::noiseFFT::PSD(const scalarField& PSDf)
|
||||||
|
{
|
||||||
|
return 10*log10(PSDf/sqr(p0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::scalarField> Foam::noiseFFT::SPL(const scalarField& Prms2)
|
||||||
|
{
|
||||||
|
return 10*log10(Prms2/sqr(p0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::noiseFFT::octaveBandInfo
|
||||||
(
|
(
|
||||||
const scalarField& f,
|
const scalarField& f,
|
||||||
const scalar fLower,
|
const scalar fLower,
|
||||||
const scalar fUpper,
|
const scalar fUpper,
|
||||||
const scalar octave,
|
const scalar octave,
|
||||||
labelList& freqBandIDs
|
labelList& fBandIDs,
|
||||||
|
scalarField& fCentre
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Set the indices of to the lower frequency bands for the input frequency
|
// Set the indices of to the lower frequency bands for the input frequency
|
||||||
// range. Ensure that the centre frequency passes though 1000 Hz
|
// range. Ensure that the centre frequency passes though 1000 Hz
|
||||||
|
|
||||||
// Low frequency bound given by:
|
// Low frequency bound given by:
|
||||||
// fLow = f0*(2^(bandI/octave/2))
|
// fLow = f0*(2^(0.5*bandI/octave))
|
||||||
// Centre frequency given by:
|
|
||||||
// fCentre = f0*(2^(bandI/octave))
|
|
||||||
|
|
||||||
scalar f0 = 1000;
|
// Initial (lowest centre frequency)
|
||||||
scalar minFrequency = max(fLower, min(f));
|
scalar fTest = 15.625;
|
||||||
|
|
||||||
// Lower frequency band limit
|
const scalar fRatio = pow(2, 1.0/octave);
|
||||||
label band0Low = ceil(2*octave*log(minFrequency/f0)/log(2.0));
|
const scalar fRatioL2C = pow(2, 0.5/octave);
|
||||||
|
|
||||||
// Centre frequency band limit
|
// IDs of band IDs
|
||||||
//label band0Centre = ceil(octave*log(fLower/f0)/log(2.0));
|
labelHashSet bandIDs(f.size());
|
||||||
|
|
||||||
scalar fLowerBand = f0*pow(2, band0Low/octave/2);
|
// Centre frequencies
|
||||||
scalar fRatio = pow(2, 1.0/octave);
|
DynamicList<scalar> fc;
|
||||||
|
|
||||||
|
// Convert to lower band limit
|
||||||
|
fTest /= fRatioL2C;
|
||||||
|
|
||||||
bool complete = false;
|
|
||||||
DynamicList<label> bandIDs(f.size());
|
|
||||||
forAll(f, i)
|
forAll(f, i)
|
||||||
{
|
{
|
||||||
while (f[i] >= fLowerBand)
|
if (f[i] >= fTest)
|
||||||
{
|
{
|
||||||
bandIDs.append(i);
|
// Advance band if appropriate
|
||||||
fLowerBand *= fRatio;
|
while (f[i] > fTest)
|
||||||
|
{
|
||||||
|
fTest *= fRatio;
|
||||||
|
}
|
||||||
|
fTest /= fRatio;
|
||||||
|
|
||||||
if (fLowerBand > fUpper)
|
if (bandIDs.insert(i))
|
||||||
|
{
|
||||||
|
// Also store (next) centre frequency
|
||||||
|
fc.append(fTest*fRatioL2C);
|
||||||
|
}
|
||||||
|
fTest *= fRatio;
|
||||||
|
|
||||||
|
if (fTest > fUpper)
|
||||||
{
|
{
|
||||||
complete = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (complete) break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
freqBandIDs.transfer(bandIDs);
|
fBandIDs = bandIDs.toc();
|
||||||
}
|
|
||||||
|
|
||||||
|
// Remove the last centre frequency (beyond upper frequency limit)
|
||||||
|
fc.remove();
|
||||||
|
|
||||||
Foam::tmp<Foam::scalarField> Foam::noiseFFT::octaveFrequencies
|
fCentre.transfer(fc);
|
||||||
(
|
|
||||||
const scalarField& f,
|
|
||||||
const scalar fLower,
|
|
||||||
const scalar fUpper,
|
|
||||||
const scalar octave
|
|
||||||
)
|
|
||||||
{
|
|
||||||
labelList freqBandIDs;
|
|
||||||
octaveFrequenciesIDs(f, fLower, fUpper, octave, freqBandIDs);
|
|
||||||
tmp<scalarField> tf(new scalarField(f, freqBandIDs));
|
|
||||||
return tf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -133,7 +144,10 @@ Foam::noiseFFT::noiseFFT
|
|||||||
:
|
:
|
||||||
scalarField(pressure),
|
scalarField(pressure),
|
||||||
deltaT_(deltaT)
|
deltaT_(deltaT)
|
||||||
{}
|
{
|
||||||
|
scalarField& p = *this;
|
||||||
|
p -= average(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::noiseFFT::noiseFFT(const fileName& pFileName, const label skip)
|
Foam::noiseFFT::noiseFFT(const fileName& pFileName, const label skip)
|
||||||
@ -191,6 +205,9 @@ Foam::noiseFFT::noiseFFT(const fileName& pFileName, const label skip)
|
|||||||
deltaT_ = (T1 - T0)/pData.size();
|
deltaT_ = (T1 - T0)/pData.size();
|
||||||
|
|
||||||
this->transfer(pData);
|
this->transfer(pData);
|
||||||
|
|
||||||
|
scalarField& p = *this;
|
||||||
|
p -= average(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -220,6 +237,8 @@ Foam::tmp<Foam::scalarField> Foam::noiseFFT::Pf
|
|||||||
const tmp<scalarField>& tpn
|
const tmp<scalarField>& tpn
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
// Calculate the 2-sided fft
|
||||||
|
// Note: result not scaled
|
||||||
tmp<scalarField> tPn2
|
tmp<scalarField> tPn2
|
||||||
(
|
(
|
||||||
mag
|
mag
|
||||||
@ -234,17 +253,15 @@ Foam::tmp<Foam::scalarField> Foam::noiseFFT::Pf
|
|||||||
|
|
||||||
tpn.clear();
|
tpn.clear();
|
||||||
|
|
||||||
|
// Only storing the positive half
|
||||||
|
// Note: storing (N/2) values, DC component at position (0)
|
||||||
tmp<scalarField> tPn
|
tmp<scalarField> tPn
|
||||||
(
|
(
|
||||||
new scalarField
|
new scalarField
|
||||||
(
|
(
|
||||||
scalarField::subField(tPn2(), tPn2().size()/2)
|
scalarField::subField(tPn2(), tPn2().size()/2 + 1)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
scalarField& Pn = tPn();
|
|
||||||
|
|
||||||
Pn *= 2.0/sqrt(scalar(tPn2().size()));
|
|
||||||
Pn[0] /= 2.0;
|
|
||||||
|
|
||||||
return tPn;
|
return tPn;
|
||||||
}
|
}
|
||||||
@ -255,7 +272,7 @@ Foam::graph Foam::noiseFFT::meanPf(const windowModel& window) const
|
|||||||
const label N = window.nSamples();
|
const label N = window.nSamples();
|
||||||
const label nWindow = window.nWindow();
|
const label nWindow = window.nWindow();
|
||||||
|
|
||||||
scalarField meanPf(N/2, 0.0);
|
scalarField meanPf(N/2 + 1, 0.0);
|
||||||
|
|
||||||
for (label windowI = 0; windowI < nWindow; ++windowI)
|
for (label windowI = 0; windowI < nWindow; ++windowI)
|
||||||
{
|
{
|
||||||
@ -287,14 +304,13 @@ Foam::graph Foam::noiseFFT::RMSmeanPf(const windowModel& window) const
|
|||||||
const label N = window.nSamples();
|
const label N = window.nSamples();
|
||||||
const label nWindow = window.nWindow();
|
const label nWindow = window.nWindow();
|
||||||
|
|
||||||
scalarField RMSMeanPf(N/2, 0.0);
|
scalarField RMSMeanPf(N/2 + 1, 0.0);
|
||||||
|
|
||||||
for (label windowI = 0; windowI < nWindow; ++windowI)
|
for (label windowI = 0; windowI < nWindow; ++windowI)
|
||||||
{
|
{
|
||||||
RMSMeanPf += sqr(Pf(window.apply<scalar>(*this, windowI)));
|
RMSMeanPf += sqr(Pf(window.apply<scalar>(*this, windowI)));
|
||||||
}
|
}
|
||||||
|
|
||||||
RMSMeanPf = sqrt(RMSMeanPf/scalar(nWindow));
|
RMSMeanPf = sqrt(RMSMeanPf/scalar(nWindow))/scalar(N);
|
||||||
|
|
||||||
scalar deltaf = 1.0/(N*deltaT_);
|
scalar deltaf = 1.0/(N*deltaT_);
|
||||||
scalarField f(RMSMeanPf.size());
|
scalarField f(RMSMeanPf.size());
|
||||||
@ -305,9 +321,9 @@ Foam::graph Foam::noiseFFT::RMSmeanPf(const windowModel& window) const
|
|||||||
|
|
||||||
return graph
|
return graph
|
||||||
(
|
(
|
||||||
"P(f)",
|
"Prms(f)",
|
||||||
"f [Hz]",
|
"f [Hz]",
|
||||||
"P(f) [Pa]",
|
"Prms(f) [Pa]",
|
||||||
f,
|
f,
|
||||||
RMSMeanPf
|
RMSMeanPf
|
||||||
);
|
);
|
||||||
@ -319,19 +335,30 @@ Foam::graph Foam::noiseFFT::PSDf(const windowModel& window) const
|
|||||||
const label N = window.nSamples();
|
const label N = window.nSamples();
|
||||||
const label nWindow = window.nWindow();
|
const label nWindow = window.nWindow();
|
||||||
|
|
||||||
scalarField psd(N/2, 0.0);
|
scalarField psd(N/2 + 1, 0.0);
|
||||||
|
|
||||||
for (label windowI = 0; windowI < nWindow; ++windowI)
|
for (label windowI = 0; windowI < nWindow; ++windowI)
|
||||||
{
|
{
|
||||||
psd += 0.5*sqr(Pf(window.apply<scalar>(*this, windowI)));
|
psd += sqr(Pf(window.apply<scalar>(*this, windowI)));
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar deltaf = 1.0/(N*deltaT_);
|
scalar deltaf = 1.0/(N*deltaT_);
|
||||||
|
scalar fs = 1.0/deltaT_;
|
||||||
|
psd /= scalar(nWindow)*fs*N;
|
||||||
|
|
||||||
psd /= nWindow*deltaf;
|
// Scaling due to use of 1-sided FFT
|
||||||
|
// Note: do not scale DC component
|
||||||
|
psd *= 2;
|
||||||
|
psd.first() /= 2;
|
||||||
|
psd.last() /= 2;
|
||||||
|
|
||||||
scalarField f(psd.size());
|
scalarField f(psd.size());
|
||||||
|
|
||||||
|
if (0) // if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "Average PSD: " << average(psd) << endl;
|
||||||
|
}
|
||||||
|
|
||||||
forAll(f, i)
|
forAll(f, i)
|
||||||
{
|
{
|
||||||
f[i] = i*deltaf;
|
f[i] = i*deltaf;
|
||||||
@ -348,159 +375,87 @@ Foam::graph Foam::noiseFFT::PSDf(const windowModel& window) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::graph Foam::noiseFFT::PSD(const graph& gPSD) const
|
Foam::graph Foam::noiseFFT::PSD(const graph& gPSDf) const
|
||||||
{
|
{
|
||||||
return graph
|
return graph
|
||||||
(
|
(
|
||||||
"PSD(dB)",
|
"PSD(f)",
|
||||||
"f [Hz]",
|
"f [Hz]",
|
||||||
"PSD_dB(f) [dB]",
|
"PSD_dB(f) [dB_Hz]",
|
||||||
gPSD.x(),
|
gPSDf.x(),
|
||||||
10*log10(gPSD.y()/sqr(p0))
|
10*log10(gPSDf.y()/sqr(p0))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::graph Foam::noiseFFT::Lf(const graph& gPf) const
|
Foam::graph Foam::noiseFFT::octaves
|
||||||
{
|
|
||||||
return graph
|
|
||||||
(
|
(
|
||||||
"L(f)",
|
const graph& g,
|
||||||
"f [Hz]",
|
const labelList& freqBandIDs,
|
||||||
"L(f) [dB]",
|
bool integrate
|
||||||
gPf.x(),
|
|
||||||
20*log10(gPf.y()/p0)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::graph Foam::noiseFFT::Ldelta
|
|
||||||
(
|
|
||||||
const graph& gLf,
|
|
||||||
const labelList& freqBandIDs
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (freqBandIDs.size() < 2)
|
if (freqBandIDs.size() < 2)
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "Octave frequency bands are not defined "
|
<< "Octave frequency bands are not defined "
|
||||||
<< "- skipping Ldelta calculation"
|
<< "- skipping octaves calculation"
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
return graph
|
return graph
|
||||||
(
|
(
|
||||||
"Ldelta",
|
"octave",
|
||||||
"fm [Hz]",
|
"x",
|
||||||
"Ldelta [dB]",
|
"y",
|
||||||
scalarField(),
|
scalarField(),
|
||||||
scalarField()
|
scalarField()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalarField& f = gLf.x();
|
const scalarField& f = g.x();
|
||||||
const scalarField& Lf = gLf.y();
|
const scalarField& data = g.y();
|
||||||
|
|
||||||
scalarField ldelta(freqBandIDs.size() - 1, 0.0);
|
scalarField octData(freqBandIDs.size() - 1, 0.0);
|
||||||
scalarField fm(freqBandIDs.size() -1, 0.0);
|
scalarField fm(freqBandIDs.size() -1, 0.0);
|
||||||
|
|
||||||
for (label bandI = 0; bandI < freqBandIDs.size() - 1; bandI++)
|
for (label bandI = 0; bandI < freqBandIDs.size() - 1; bandI++)
|
||||||
{
|
{
|
||||||
label f0 = freqBandIDs[bandI];
|
label fb0 = freqBandIDs[bandI];
|
||||||
label f1 = freqBandIDs[bandI+1];
|
label fb1 = freqBandIDs[bandI+1];
|
||||||
fm[bandI] = f[f0];
|
fm[bandI] = f[fb0];
|
||||||
|
|
||||||
if (f0 == f1) continue;
|
if (fb0 == fb1) continue;
|
||||||
|
|
||||||
for (label freqI = f0; freqI < f1; freqI++)
|
if (integrate)
|
||||||
{
|
{
|
||||||
ldelta[bandI] += pow(10, Lf[freqI]/10.0);
|
for (label freqI = fb0; freqI < fb1; freqI++)
|
||||||
|
{
|
||||||
|
label f0 = f[freqI];
|
||||||
|
label f1 = f[freqI + 1];
|
||||||
|
scalar dataAve = 0.5*(data[freqI] + data[freqI + 1]);
|
||||||
|
octData[bandI] += dataAve*(f1 - f0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (label freqI = fb0; freqI < fb1; freqI++)
|
||||||
|
{
|
||||||
|
octData[bandI] += data[freqI];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ldelta[bandI] = 10*log10(ldelta[bandI]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return graph
|
return graph
|
||||||
(
|
(
|
||||||
"Ldelta",
|
"octaves(f)",
|
||||||
"fm [Hz]",
|
"fm [Hz]",
|
||||||
"Ldelta [dB]",
|
"octave data",
|
||||||
fm,
|
fm,
|
||||||
ldelta
|
octData
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::graph Foam::noiseFFT::Pdelta
|
|
||||||
(
|
|
||||||
const graph& gPf,
|
|
||||||
const labelList& freqBandIDs
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (freqBandIDs.size() < 2)
|
|
||||||
{
|
|
||||||
WarningInFunction
|
|
||||||
<< "Octave frequency bands are not defined "
|
|
||||||
<< "- skipping Pdelta calculation"
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
return graph
|
|
||||||
(
|
|
||||||
"Pdelta",
|
|
||||||
"fm [Hz]",
|
|
||||||
"Pdelta [dB]",
|
|
||||||
scalarField(),
|
|
||||||
scalarField()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const scalarField& f = gPf.x();
|
|
||||||
const scalarField& Pf = gPf.y();
|
|
||||||
|
|
||||||
scalarField pdelta(freqBandIDs.size() - 1, 0.0);
|
|
||||||
scalarField fm(pdelta.size());
|
|
||||||
|
|
||||||
for (label bandI = 0; bandI < freqBandIDs.size() - 1; bandI++)
|
|
||||||
{
|
|
||||||
label f0 = freqBandIDs[bandI];
|
|
||||||
label f1 = freqBandIDs[bandI+1];
|
|
||||||
fm[bandI] = f[f0];
|
|
||||||
|
|
||||||
if (f0 == f1) continue;
|
|
||||||
|
|
||||||
for (label freqI = f0; freqI < f1; freqI++)
|
|
||||||
{
|
|
||||||
pdelta[bandI] += sqr(Pf[freqI]);
|
|
||||||
}
|
|
||||||
pdelta[bandI] = sqrt((2.0/3.0)*pdelta[bandI]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return graph
|
|
||||||
(
|
|
||||||
"Pdelta",
|
|
||||||
"fm [Hz]",
|
|
||||||
"Pdelta [dB]",
|
|
||||||
fm,
|
|
||||||
pdelta
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::scalar Foam::noiseFFT::Lsum(const graph& gLf) const
|
|
||||||
{
|
|
||||||
const scalarField& Lf = gLf.y();
|
|
||||||
|
|
||||||
scalar lsum = 0.0;
|
|
||||||
|
|
||||||
forAll(Lf, i)
|
|
||||||
{
|
|
||||||
lsum += pow(10, Lf[i]/10.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
lsum = 10*log10(lsum);
|
|
||||||
|
|
||||||
return lsum;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::scalar Foam::noiseFFT::dbToPa(const scalar db) const
|
Foam::scalar Foam::noiseFFT::dbToPa(const scalar db) const
|
||||||
{
|
{
|
||||||
return p0*pow(10.0, db/20.0);
|
return p0*pow(10.0, db/20.0);
|
||||||
|
|||||||
@ -32,12 +32,12 @@ Description
|
|||||||
- meanPf: multi-window mean fft
|
- meanPf: multi-window mean fft
|
||||||
- RMSmeanPf: multi-window RMS mean fft
|
- RMSmeanPf: multi-window RMS mean fft
|
||||||
- PSDf: multi-window power spectral density (PSD) in frequency domain
|
- PSDf: multi-window power spectral density (PSD) in frequency domain
|
||||||
- PSD: multi-window power spectral density (PSD) in dB
|
- PSD: power spectral density in dB/Hz
|
||||||
- Lf: narrow-band pressure-fluctuation level (PFL) in frequency domain
|
- SPL: sound pressure level in dB
|
||||||
|
|
||||||
Octave-based data:
|
Octave-based data:
|
||||||
- Ldelta: PFL spectrum
|
- PSD spectrum
|
||||||
- Pdelta: pressure spectrum
|
- SPL spectrum
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
noiseFFT.C
|
noiseFFT.C
|
||||||
@ -72,6 +72,17 @@ class noiseFFT
|
|||||||
//- Time spacing of the raw data
|
//- Time spacing of the raw data
|
||||||
scalar deltaT_;
|
scalar deltaT_;
|
||||||
|
|
||||||
|
struct octaveBandInfo
|
||||||
|
{
|
||||||
|
label octave;
|
||||||
|
|
||||||
|
// IDs of bin boundaries in pressure data
|
||||||
|
labelList binIDs;
|
||||||
|
|
||||||
|
// Centre frequencies for each bin
|
||||||
|
scalarField centreFreq;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -104,27 +115,27 @@ public:
|
|||||||
const scalar deltaT
|
const scalar deltaT
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Return the PSD [dB/Hz]
|
||||||
|
// Input PSD in [Pa^2/Hz]
|
||||||
|
static tmp<scalarField> PSD(const scalarField& PSDf);
|
||||||
|
|
||||||
|
//- Return the SPL [dB]
|
||||||
|
// Input P(rms)^2 in [Pa^2]
|
||||||
|
static tmp<scalarField> SPL(const scalarField& Prms2);
|
||||||
|
|
||||||
//- Return a list of the frequency indices wrt f field that
|
//- Return a list of the frequency indices wrt f field that
|
||||||
// correspond to the bands limits for a given octave
|
// correspond to the bands limits for a given octave
|
||||||
static void octaveFrequenciesIDs
|
static void octaveBandInfo
|
||||||
(
|
(
|
||||||
const scalarField& f,
|
const scalarField& f,
|
||||||
const scalar fLower,
|
const scalar fLower,
|
||||||
const scalar fUpper,
|
const scalar fUpper,
|
||||||
const scalar octave,
|
const scalar octave,
|
||||||
labelList& freqBandIDs
|
labelList& fBandIDs,
|
||||||
|
scalarField& fCentre
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Return the 1/octave octave frequency bounds
|
//- Return the graph of pressure as a function of time
|
||||||
static tmp<scalarField> octaveFrequencies
|
|
||||||
(
|
|
||||||
const scalarField& f,
|
|
||||||
const scalar fLower,
|
|
||||||
const scalar fUpper,
|
|
||||||
const scalar octave
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Return the graph of p(t)
|
|
||||||
graph pt() const;
|
graph pt() const;
|
||||||
|
|
||||||
//- Return the fft of the given pressure data
|
//- Return the fft of the given pressure data
|
||||||
@ -141,32 +152,18 @@ public:
|
|||||||
// pressure data [Pa^2/Hz]
|
// pressure data [Pa^2/Hz]
|
||||||
graph PSDf(const windowModel& window) const;
|
graph PSDf(const windowModel& window) const;
|
||||||
|
|
||||||
//- Return the PSD [dB]
|
//- Return the PSD [dB/Hz]
|
||||||
graph PSD(const graph& gPSD) const;
|
// Takes PSD in [Pa^2/Hz]
|
||||||
|
graph PSD(const graph& gPSDf) const;
|
||||||
|
|
||||||
//- Return the narrow-band PFL (pressure-fluctuation level)
|
//- Generate octave data
|
||||||
// spectrum [dB]
|
graph octaves
|
||||||
graph Lf(const graph& gPf) const;
|
|
||||||
|
|
||||||
//- Return the octave-band PFL spectrum starting at octave
|
|
||||||
// frequencies given by the supplied frequency bands [dB]
|
|
||||||
graph Ldelta
|
|
||||||
(
|
(
|
||||||
const graph& gLf,
|
const graph& g,
|
||||||
const labelList& freqBandIDs
|
const labelList& freqBandIDs,
|
||||||
|
bool integrate
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return the octave-band pressure spectrum at octave
|
|
||||||
// frequencies given by the supplied frequency bands [dB]
|
|
||||||
graph Pdelta
|
|
||||||
(
|
|
||||||
const graph& gLf,
|
|
||||||
const labelList& freqBandIDs
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Return the total PFL as the sum of Lf over all frequencies
|
|
||||||
scalar Lsum(const graph& gLf) const;
|
|
||||||
|
|
||||||
//- Convert the db into Pa
|
//- Convert the db into Pa
|
||||||
scalar dbToPa(const scalar db) const;
|
scalar dbToPa(const scalar db) const;
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -97,12 +97,13 @@ Foam::label Foam::noiseModel::findStartTimeIndex
|
|||||||
Foam::noiseModel::noiseModel(const dictionary& dict)
|
Foam::noiseModel::noiseModel(const dictionary& dict)
|
||||||
:
|
:
|
||||||
dict_(dict),
|
dict_(dict),
|
||||||
pRef_(dict.lookupOrDefault("pRef", 0)),
|
rhoRef_(dict.lookupOrDefault<scalar>("rhoRef", 1)),
|
||||||
nSamples_(dict.lookupOrDefault("N", 65536)),
|
nSamples_(dict.lookupOrDefault<label>("N", 65536)),
|
||||||
fLower_(dict.lookupOrDefault("fl", 25)),
|
fLower_(dict.lookupOrDefault<scalar>("fl", 25)),
|
||||||
fUpper_(dict.lookupOrDefault("fu", 10000)),
|
fUpper_(dict.lookupOrDefault<scalar>("fu", 10000)),
|
||||||
startTime_(dict.lookupOrDefault("startTime", 0)),
|
startTime_(dict.lookupOrDefault<scalar>("startTime", 0)),
|
||||||
windowModelPtr_(windowModel::New(dict, nSamples_))
|
windowModelPtr_(windowModel::New(dict, nSamples_)),
|
||||||
|
graphFormat_(dict.lookupOrDefault<word>("graphFormat", "raw"))
|
||||||
{
|
{
|
||||||
// Check number of samples - must be a power of 2 for our FFT
|
// Check number of samples - must be a power of 2 for our FFT
|
||||||
bool powerOf2 = ((nSamples_ != 0) && !(nSamples_ & (nSamples_ - 1)));
|
bool powerOf2 = ((nSamples_ != 0) && !(nSamples_ & (nSamples_ - 1)));
|
||||||
|
|||||||
@ -30,7 +30,7 @@ Description
|
|||||||
Data is read from a dictionary, e.g.
|
Data is read from a dictionary, e.g.
|
||||||
|
|
||||||
\verbatim
|
\verbatim
|
||||||
pRef 0;
|
rhoRef 0;
|
||||||
N 4096;
|
N 4096;
|
||||||
fl 25;
|
fl 25;
|
||||||
fu 25;
|
fu 25;
|
||||||
@ -40,10 +40,12 @@ Description
|
|||||||
where
|
where
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default value
|
Property | Description | Required | Default value
|
||||||
pRef | Reference pressure | no | 0
|
rhoRef | Reference density | no | 1
|
||||||
N | Number of samples in sampling window | no | 65536 (2^16)
|
N | Number of samples in sampling window | no | 65536 (2^16)
|
||||||
fl | Lower frequency bounds | no | 25
|
fl | Lower frequency bounds | no | 25
|
||||||
fu | Upper frequency bounds | no | 10000
|
fu | Upper frequency bounds | no | 10000
|
||||||
|
startTime | Start time | no | 0
|
||||||
|
graphFormat | Graph format | no | raw
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
Note
|
Note
|
||||||
@ -94,8 +96,8 @@ protected:
|
|||||||
//- Copy of dictionary used for construction
|
//- Copy of dictionary used for construction
|
||||||
const dictionary dict_;
|
const dictionary dict_;
|
||||||
|
|
||||||
//- Reference pressure
|
//- Reference density (to convert from kinematic to static pressure)
|
||||||
scalar pRef_;
|
scalar rhoRef_;
|
||||||
|
|
||||||
//- Number of samples in sampling window, default = 2^16
|
//- Number of samples in sampling window, default = 2^16
|
||||||
label nSamples_;
|
label nSamples_;
|
||||||
@ -112,6 +114,8 @@ protected:
|
|||||||
//- Window model
|
//- Window model
|
||||||
autoPtr<windowModel> windowModelPtr_;
|
autoPtr<windowModel> windowModelPtr_;
|
||||||
|
|
||||||
|
//- Graph format
|
||||||
|
word graphFormat_;
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|||||||
@ -43,7 +43,7 @@ addToRunTimeSelectionTable(noiseModel, pointNoise, dictionary);
|
|||||||
|
|
||||||
void pointNoise::filterTimeData
|
void pointNoise::filterTimeData
|
||||||
(
|
(
|
||||||
const CSV<scalar>& pData,
|
const Function1Types::CSV<scalar>& pData,
|
||||||
scalarField& t,
|
scalarField& t,
|
||||||
scalarField& p
|
scalarField& p
|
||||||
)
|
)
|
||||||
@ -80,12 +80,13 @@ void pointNoise::calculate()
|
|||||||
|
|
||||||
Info<< "Reading data file" << endl;
|
Info<< "Reading data file" << endl;
|
||||||
|
|
||||||
CSV<scalar> pData("pressure", dict_, "Data");
|
Function1Types::CSV<scalar> pData("pressure", dict_, "Data");
|
||||||
fileName baseFileName(pData.fName().lessExt());
|
|
||||||
|
|
||||||
// Time and pressure history data
|
// Time and pressure history data
|
||||||
scalarField t, p;
|
scalarField t, p;
|
||||||
filterTimeData(pData, t, p);
|
filterTimeData(pData, t, p);
|
||||||
|
p *= rhoRef_;
|
||||||
|
|
||||||
Info<< " read " << t.size() << " values" << nl << endl;
|
Info<< " read " << t.size() << " values" << nl << endl;
|
||||||
|
|
||||||
Info<< "Creating noise FFT" << endl;
|
Info<< "Creating noise FFT" << endl;
|
||||||
@ -93,38 +94,94 @@ void pointNoise::calculate()
|
|||||||
|
|
||||||
// Determine the windowing
|
// Determine the windowing
|
||||||
windowModelPtr_->validate(t.size());
|
windowModelPtr_->validate(t.size());
|
||||||
|
const windowModel& win = windowModelPtr_();
|
||||||
|
const scalar deltaf = 1.0/(deltaT*win.nSamples());
|
||||||
|
fileName outDir(fileName("postProcessing")/"noise"/typeName);
|
||||||
|
|
||||||
// Create the fft
|
// Create the fft
|
||||||
noiseFFT nfft(deltaT, p);
|
noiseFFT nfft(deltaT, p);
|
||||||
|
|
||||||
nfft -= pRef_;
|
|
||||||
|
|
||||||
graph Pf(nfft.RMSmeanPf(windowModelPtr_()));
|
// Narrow band data
|
||||||
Info<< " Creating graph for " << Pf.title() << endl;
|
// ----------------
|
||||||
Pf.write(baseFileName + graph::wordify(Pf.title()), graphFormat_);
|
|
||||||
|
|
||||||
graph Lf(nfft.Lf(Pf));
|
// RMS pressure [Pa]
|
||||||
Info<< " Creating graph for " << Lf.title() << endl;
|
graph Prmsf(nfft.RMSmeanPf(win));
|
||||||
Lf.write(baseFileName + graph::wordify(Lf.title()), graphFormat_);
|
Info<< " Creating graph for " << Prmsf.title() << endl;
|
||||||
|
Prmsf.write(outDir, graph::wordify(Prmsf.title()), graphFormat_);
|
||||||
|
|
||||||
graph PSDf(nfft.PSDf(windowModelPtr_()));
|
// PSD [Pa^2/Hz]
|
||||||
|
graph PSDf(nfft.PSDf(win));
|
||||||
Info<< " Creating graph for " << PSDf.title() << endl;
|
Info<< " Creating graph for " << PSDf.title() << endl;
|
||||||
PSDf.write(baseFileName + graph::wordify(PSDf.title()), graphFormat_);
|
PSDf.write(outDir, graph::wordify(PSDf.title()), graphFormat_);
|
||||||
|
|
||||||
graph PSD(nfft.PSD(PSDf));
|
// PSD [dB/Hz]
|
||||||
Info<< " Creating graph for " << PSD.title() << endl;
|
graph PSDg
|
||||||
PSD.write(baseFileName + graph::wordify(PSD.title()), graphFormat_);
|
(
|
||||||
|
"PSD_dB_Hz(f)",
|
||||||
|
"f [Hz]",
|
||||||
|
"PSD(f) [dB_Hz]",
|
||||||
|
Prmsf.x(),
|
||||||
|
noiseFFT::PSD(PSDf.y())
|
||||||
|
);
|
||||||
|
Info<< " Creating graph for " << PSDg.title() << endl;
|
||||||
|
PSDg.write(outDir, graph::wordify(PSDg.title()), graphFormat_);
|
||||||
|
|
||||||
|
// SPL [dB]
|
||||||
|
graph SPLg
|
||||||
|
(
|
||||||
|
"SPL_dB(f)",
|
||||||
|
"f [Hz]",
|
||||||
|
"SPL(f) [dB]",
|
||||||
|
Prmsf.x(),
|
||||||
|
noiseFFT::SPL(PSDf.y()*deltaf)
|
||||||
|
);
|
||||||
|
Info<< " Creating graph for " << SPLg.title() << endl;
|
||||||
|
SPLg.write(outDir, graph::wordify(SPLg.title()), graphFormat_);
|
||||||
|
|
||||||
labelList octave13BandIDs;
|
labelList octave13BandIDs;
|
||||||
noiseFFT::octaveFrequenciesIDs(Pf.x(), fLower_, fUpper_, 3, octave13BandIDs);
|
scalarField octave13FreqCentre;
|
||||||
|
noiseFFT::octaveBandInfo
|
||||||
|
(
|
||||||
|
Prmsf.x(),
|
||||||
|
fLower_,
|
||||||
|
fUpper_,
|
||||||
|
3,
|
||||||
|
octave13BandIDs,
|
||||||
|
octave13FreqCentre
|
||||||
|
);
|
||||||
|
|
||||||
graph Ldelta(nfft.Ldelta(Lf, octave13BandIDs));
|
|
||||||
Info<< " Creating graph for " << Ldelta.title() << endl;
|
|
||||||
Ldelta.write(baseFileName + graph::wordify(Ldelta.title()), graphFormat_);
|
|
||||||
|
|
||||||
graph Pdelta(nfft.Pdelta(Pf, octave13BandIDs));
|
// 1/3 octave data
|
||||||
Info<< " Creating graph for " << Pdelta.title() << endl;
|
// ---------------
|
||||||
Pdelta.write(baseFileName + graph::wordify(Pdelta.title()), graphFormat_);
|
|
||||||
|
// PSD [Pa^2/Hz]
|
||||||
|
graph PSD13f(nfft.octaves(PSDf, octave13BandIDs, false));
|
||||||
|
|
||||||
|
// Integrated PSD = P(rms)^2 [Pa^2]
|
||||||
|
graph Prms13f2(nfft.octaves(PSDf, octave13BandIDs, true));
|
||||||
|
|
||||||
|
graph PSD13g
|
||||||
|
(
|
||||||
|
"PSD13_dB_Hz(fm)",
|
||||||
|
"fm [Hz]",
|
||||||
|
"PSD(fm) [dB_Hz]",
|
||||||
|
octave13FreqCentre,
|
||||||
|
noiseFFT::PSD(PSD13f.y())
|
||||||
|
);
|
||||||
|
Info<< " Creating graph for " << PSD13g.title() << endl;
|
||||||
|
PSD13g.write(outDir, graph::wordify(PSD13g.title()), graphFormat_);
|
||||||
|
|
||||||
|
graph SPL13g
|
||||||
|
(
|
||||||
|
"SPL13_dB(fm)",
|
||||||
|
"fm [Hz]",
|
||||||
|
"SPL(fm) [dB]",
|
||||||
|
octave13FreqCentre,
|
||||||
|
noiseFFT::SPL(Prms13f2.y())
|
||||||
|
);
|
||||||
|
Info<< " Creating graph for " << SPL13g.title() << endl;
|
||||||
|
SPL13g.write(outDir, graph::wordify(SPL13g.title()), graphFormat_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -132,8 +189,7 @@ void pointNoise::calculate()
|
|||||||
|
|
||||||
pointNoise::pointNoise(const dictionary& dict)
|
pointNoise::pointNoise(const dictionary& dict)
|
||||||
:
|
:
|
||||||
noiseModel(dict),
|
noiseModel(dict)
|
||||||
graphFormat_(dict.lookupOrDefault<word>("graphFormat", "raw"))
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -100,17 +100,11 @@ class pointNoise
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
|
||||||
|
|
||||||
//- Graph format
|
|
||||||
word graphFormat_;
|
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
void filterTimeData
|
void filterTimeData
|
||||||
(
|
(
|
||||||
const CSV<scalar>& pData,
|
const Function1Types::CSV<scalar>& pData,
|
||||||
scalarField& t,
|
scalarField& t,
|
||||||
scalarField& p
|
scalarField& p
|
||||||
);
|
);
|
||||||
|
|||||||
@ -46,6 +46,8 @@ addToRunTimeSelectionTable(noiseModel, surfaceNoise, dictionary);
|
|||||||
|
|
||||||
void surfaceNoise::initialise(const dictionary& dict)
|
void surfaceNoise::initialise(const dictionary& dict)
|
||||||
{
|
{
|
||||||
|
label nAvailableTimes = 0;
|
||||||
|
|
||||||
// All reading performed on the master processor only
|
// All reading performed on the master processor only
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
@ -81,10 +83,22 @@ void surfaceNoise::initialise(const dictionary& dict)
|
|||||||
startTimeIndex_ = findStartTimeIndex(allTimes, startTime_);
|
startTimeIndex_ = findStartTimeIndex(allTimes, startTime_);
|
||||||
|
|
||||||
// Determine the windowing
|
// Determine the windowing
|
||||||
label nAvailableTimes = allTimes.size() - startTimeIndex_;
|
nAvailableTimes = allTimes.size() - startTimeIndex_;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pstream::scatter(pIndex_);
|
||||||
|
Pstream::scatter(startTimeIndex_);
|
||||||
|
Pstream::scatter(nAvailableTimes);
|
||||||
|
|
||||||
|
|
||||||
|
// Note: all processors should call the windowing validate function
|
||||||
label nRequiredTimes = windowModelPtr_->validate(nAvailableTimes);
|
label nRequiredTimes = windowModelPtr_->validate(nAvailableTimes);
|
||||||
|
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
// Restrict times
|
// Restrict times
|
||||||
|
const instantList allTimes = readerPtr_->times();
|
||||||
|
|
||||||
times_.setSize(nRequiredTimes);
|
times_.setSize(nRequiredTimes);
|
||||||
forAll(times_, timeI)
|
forAll(times_, timeI)
|
||||||
{
|
{
|
||||||
@ -92,13 +106,12 @@ void surfaceNoise::initialise(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
deltaT_ = checkUniformTimeStep(times_);
|
deltaT_ = checkUniformTimeStep(times_);
|
||||||
|
|
||||||
|
// Read the surface geometry
|
||||||
const meshedSurface& surf = readerPtr_->geometry();
|
const meshedSurface& surf = readerPtr_->geometry();
|
||||||
nFace_ = surf.size();
|
nFace_ = surf.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
Pstream::scatter(pIndex_);
|
|
||||||
Pstream::scatter(times_);
|
Pstream::scatter(times_);
|
||||||
Pstream::scatter(startTimeIndex_);
|
|
||||||
Pstream::scatter(deltaT_);
|
Pstream::scatter(deltaT_);
|
||||||
Pstream::scatter(nFace_);
|
Pstream::scatter(nFace_);
|
||||||
}
|
}
|
||||||
@ -154,6 +167,9 @@ void surfaceNoise::readSurfaceData
|
|||||||
// Read pressure at all faces for time timeI
|
// Read pressure at all faces for time timeI
|
||||||
scalarField p(readerPtr_->field(timeI, pIndex_, scalar(0)));
|
scalarField p(readerPtr_->field(timeI, pIndex_, scalar(0)));
|
||||||
|
|
||||||
|
// Apply conversions
|
||||||
|
p *= rhoRef_;
|
||||||
|
|
||||||
// Send subset of faces to each processor
|
// Send subset of faces to each processor
|
||||||
for (label procI = 0; procI < Pstream::nProcs(); procI++)
|
for (label procI = 0; procI < Pstream::nProcs(); procI++)
|
||||||
{
|
{
|
||||||
@ -201,7 +217,7 @@ void surfaceNoise::readSurfaceData
|
|||||||
|
|
||||||
forAll(p, faceI)
|
forAll(p, faceI)
|
||||||
{
|
{
|
||||||
pData[faceI][i] = p[faceI];
|
pData[faceI][i] = p[faceI]*rhoRef_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -214,7 +230,7 @@ void surfaceNoise::readSurfaceData
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void surfaceNoise::writeSurfaceData
|
Foam::scalar surfaceNoise::writeSurfaceData
|
||||||
(
|
(
|
||||||
const word& fName,
|
const word& fName,
|
||||||
const word& groupName,
|
const word& groupName,
|
||||||
@ -245,6 +261,7 @@ void surfaceNoise::writeSurfaceData
|
|||||||
|
|
||||||
pBufs.finishedSends();
|
pBufs.finishedSends();
|
||||||
|
|
||||||
|
scalar areaAverage = 0;
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
const meshedSurface& surf = readerPtr_->geometry();
|
const meshedSurface& surf = readerPtr_->geometry();
|
||||||
@ -278,7 +295,20 @@ void surfaceNoise::writeSurfaceData
|
|||||||
allData,
|
allData,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TODO: Move faceAreas to demand-driven function in MeshedSurface
|
||||||
|
scalarField faceAreas(surf.faces().size());
|
||||||
|
forAll(faceAreas, i)
|
||||||
|
{
|
||||||
|
faceAreas[i] = surf.faces()[i].mag(surf.points());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// areaAverage = sum(allData*faceAreas)/sum(faceAreas);
|
||||||
|
areaAverage = sum(allData)/allData.size();
|
||||||
|
}
|
||||||
|
Pstream::scatter(areaAverage);
|
||||||
|
|
||||||
|
return areaAverage;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -294,6 +324,91 @@ void surfaceNoise::writeSurfaceData
|
|||||||
data,
|
data,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TODO: Move faceAreas to demand-driven function in MeshedSurface
|
||||||
|
scalarField faceAreas(surf.faces().size());
|
||||||
|
forAll(faceAreas, i)
|
||||||
|
{
|
||||||
|
faceAreas[i] = surf.faces()[i].mag(surf.points());
|
||||||
|
}
|
||||||
|
|
||||||
|
// return sum(data*faceAreas)/sum(faceAreas);
|
||||||
|
return sum(data)/data.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::scalar surfaceNoise::surfaceAverage
|
||||||
|
(
|
||||||
|
const scalarField& data,
|
||||||
|
const labelList& procFaceOffset
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (Pstream::parRun())
|
||||||
|
{
|
||||||
|
// Collect the surface data so that we can output the surfaces
|
||||||
|
|
||||||
|
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||||
|
|
||||||
|
if (!Pstream::master())
|
||||||
|
{
|
||||||
|
UOPstream toProc(0, pBufs);
|
||||||
|
toProc << data;
|
||||||
|
}
|
||||||
|
|
||||||
|
pBufs.finishedSends();
|
||||||
|
|
||||||
|
scalar areaAverage = 0;
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
const meshedSurface& surf = readerPtr_->geometry();
|
||||||
|
|
||||||
|
scalarField allData(surf.size());
|
||||||
|
|
||||||
|
forAll(data, faceI)
|
||||||
|
{
|
||||||
|
// Master procFaceOffset is zero...
|
||||||
|
allData[faceI] = data[faceI];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (label procI = 1; procI < Pstream::nProcs(); procI++)
|
||||||
|
{
|
||||||
|
UIPstream fromProc(procI, pBufs);
|
||||||
|
scalarList dataSlice(fromProc);
|
||||||
|
forAll(dataSlice, i)
|
||||||
|
{
|
||||||
|
label faceI = procFaceOffset[procI] + i;
|
||||||
|
allData[faceI] = dataSlice[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Move faceAreas to demand-driven function in MeshedSurface
|
||||||
|
scalarField faceAreas(surf.faces().size());
|
||||||
|
forAll(faceAreas, i)
|
||||||
|
{
|
||||||
|
faceAreas[i] = surf.faces()[i].mag(surf.points());
|
||||||
|
}
|
||||||
|
|
||||||
|
// areaAverage = sum(allData*faceAreas)/sum(faceAreas);
|
||||||
|
areaAverage = sum(allData)/allData.size();
|
||||||
|
}
|
||||||
|
Pstream::scatter(areaAverage);
|
||||||
|
|
||||||
|
return areaAverage;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const meshedSurface& surf = readerPtr_->geometry();
|
||||||
|
|
||||||
|
// TODO: Move faceAreas to demand-driven function in MeshedSurface
|
||||||
|
scalarField faceAreas(surf.faces().size());
|
||||||
|
forAll(faceAreas, i)
|
||||||
|
{
|
||||||
|
faceAreas[i] = surf.faces()[i].mag(surf.points());
|
||||||
|
}
|
||||||
|
|
||||||
|
// return sum(data*faceAreas)/sum(faceAreas);
|
||||||
|
return sum(data)/data.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,86 +473,103 @@ void surfaceNoise::calculate()
|
|||||||
const label nLocalFace = pData.size();
|
const label nLocalFace = pData.size();
|
||||||
const scalarField freq1(noiseFFT::frequencies(nSamples_, deltaT_));
|
const scalarField freq1(noiseFFT::frequencies(nSamples_, deltaT_));
|
||||||
const label nFFT = freq1.size()/fftWriteInterval_;
|
const label nFFT = freq1.size()/fftWriteInterval_;
|
||||||
List<scalarField> surfPf(nFFT);
|
List<scalarField> surfPrmsf(nFFT);
|
||||||
List<scalarField> surfLf(nFFT);
|
List<scalarField> surfPSDf(nFFT);
|
||||||
List<scalarField> surfPSD(nFFT);
|
forAll(surfPrmsf, freqI)
|
||||||
forAll(surfPf, freqI)
|
|
||||||
{
|
{
|
||||||
surfPf[freqI].setSize(nLocalFace);
|
surfPrmsf[freqI].setSize(nLocalFace);
|
||||||
surfLf[freqI].setSize(nLocalFace);
|
surfPSDf[freqI].setSize(nLocalFace);
|
||||||
surfPSD[freqI].setSize(nLocalFace);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Storage for 1/3 octave data
|
// Storage for 1/3 octave data
|
||||||
labelList octave13BandIDs;
|
labelList octave13BandIDs;
|
||||||
noiseFFT::octaveFrequenciesIDs(freq1, fLower_, fUpper_, 3, octave13BandIDs);
|
scalarField octave13FreqCentre;
|
||||||
|
noiseFFT::octaveBandInfo
|
||||||
|
(
|
||||||
|
freq1,
|
||||||
|
fLower_,
|
||||||
|
fUpper_,
|
||||||
|
3,
|
||||||
|
octave13BandIDs,
|
||||||
|
octave13FreqCentre
|
||||||
|
);
|
||||||
|
|
||||||
List<scalarField> surfPdelta(octave13BandIDs.size() - 1);
|
List<scalarField> surfPSD13f(octave13BandIDs.size() - 1);
|
||||||
List<scalarField> surfLdelta(octave13BandIDs.size() - 1);
|
List<scalarField> surfPrms13f2(octave13BandIDs.size() - 1);
|
||||||
forAll(surfPdelta, freqI)
|
forAll(surfPSD13f, freqI)
|
||||||
{
|
{
|
||||||
surfPdelta[freqI].setSize(nLocalFace);
|
surfPSD13f[freqI].setSize(nLocalFace);
|
||||||
surfLdelta[freqI].setSize(nLocalFace);
|
surfPrms13f2[freqI].setSize(nLocalFace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const windowModel& win = windowModelPtr_();
|
||||||
|
|
||||||
forAll(pData, faceI)
|
forAll(pData, faceI)
|
||||||
{
|
{
|
||||||
const scalarField& p = pData[faceI];
|
const scalarField& p = pData[faceI];
|
||||||
|
|
||||||
noiseFFT nfft(deltaT_, p);
|
noiseFFT nfft(deltaT_, p);
|
||||||
|
graph Prmsf(nfft.RMSmeanPf(win));
|
||||||
nfft -= pRef_;
|
graph PSDf(nfft.PSDf(win));
|
||||||
graph Pf(nfft.RMSmeanPf(windowModelPtr_()));
|
|
||||||
graph Lf(nfft.Lf(Pf));
|
|
||||||
graph PSDf(nfft.PSDf(windowModelPtr_()));
|
|
||||||
graph PSD(nfft.PSD(PSDf));
|
|
||||||
|
|
||||||
// Store the frequency results in slot for face of surface
|
// Store the frequency results in slot for face of surface
|
||||||
forAll(surfPf, i)
|
forAll(surfPrmsf, i)
|
||||||
{
|
{
|
||||||
label freqI = (i + 1)*fftWriteInterval_ - 1;
|
label freqI = (i + 1)*fftWriteInterval_ - 1;
|
||||||
surfPf[i][faceI] = Pf.y()[freqI];
|
surfPrmsf[i][faceI] = Prmsf.y()[freqI];
|
||||||
surfLf[i][faceI] = Lf.y()[freqI];
|
surfPSDf[i][faceI] = PSDf.y()[freqI];
|
||||||
surfPSD[i][faceI] = PSD.y()[freqI];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
graph Pdelta(nfft.Pdelta(Pf, octave13BandIDs));
|
// PSD [Pa^2/Hz]
|
||||||
graph Ldelta(nfft.Ldelta(Lf, octave13BandIDs));
|
graph PSD13f(nfft.octaves(PSDf, octave13BandIDs, false));
|
||||||
|
|
||||||
|
// Integrated PSD = P(rms)^2 [Pa^2]
|
||||||
|
graph Prms13f2(nfft.octaves(PSDf, octave13BandIDs, true));
|
||||||
|
|
||||||
// Store the 1/3 octave results in slot for face of surface
|
// Store the 1/3 octave results in slot for face of surface
|
||||||
forAll(surfPdelta, freqI)
|
forAll(surfPSD13f, freqI)
|
||||||
{
|
{
|
||||||
surfPdelta[freqI][faceI] = Pdelta.y()[freqI];
|
surfPSD13f[freqI][faceI] = PSD13f.y()[freqI];
|
||||||
surfLdelta[freqI][faceI] = Ldelta.y()[freqI];
|
surfPrms13f2[freqI][faceI] = Prms13f2.y()[freqI];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free the storage for p
|
// Free the storage for p
|
||||||
// p.clear();
|
// p.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Writing fft surface data" << endl;
|
// Output directory for graphs
|
||||||
|
fileName outDir(fileName("postProcessing")/"noise"/typeName);
|
||||||
|
|
||||||
forAll(surfPf, i)
|
const scalar deltaf = 1.0/(deltaT_*win.nSamples());
|
||||||
|
Info<< "Writing fft surface data" << endl;
|
||||||
|
{
|
||||||
|
scalarField PrmsfAve(surfPrmsf.size(), 0);
|
||||||
|
scalarField PSDfAve(surfPrmsf.size(), 0);
|
||||||
|
scalarField fOut(surfPrmsf.size(), 0);
|
||||||
|
|
||||||
|
forAll(surfPrmsf, i)
|
||||||
{
|
{
|
||||||
label freqI = i*fftWriteInterval_;
|
label freqI = i*fftWriteInterval_;
|
||||||
|
fOut[i] = freq1[freqI];
|
||||||
const word& fName = inputFileName_.name(true);
|
const word& fName = inputFileName_.name(true);
|
||||||
const word gName = "fft";
|
const word gName = "fft";
|
||||||
writeSurfaceData
|
PrmsfAve[i] = writeSurfaceData
|
||||||
(
|
(
|
||||||
fName,
|
fName,
|
||||||
gName,
|
gName,
|
||||||
"Pf",
|
"Prmsf",
|
||||||
freq1[freqI],
|
freq1[freqI],
|
||||||
surfPf[i],
|
surfPrmsf[i],
|
||||||
procFaceOffset
|
procFaceOffset
|
||||||
);
|
);
|
||||||
writeSurfaceData
|
|
||||||
|
PSDfAve[i] = writeSurfaceData
|
||||||
(
|
(
|
||||||
fName,
|
fName,
|
||||||
gName,
|
gName,
|
||||||
"Lf",
|
"PSDf",
|
||||||
freq1[freqI],
|
freq1[freqI],
|
||||||
surfLf[i],
|
surfPSDf[i],
|
||||||
procFaceOffset
|
procFaceOffset
|
||||||
);
|
);
|
||||||
writeSurfaceData
|
writeSurfaceData
|
||||||
@ -446,35 +578,121 @@ void surfaceNoise::calculate()
|
|||||||
gName,
|
gName,
|
||||||
"PSD",
|
"PSD",
|
||||||
freq1[freqI],
|
freq1[freqI],
|
||||||
surfPSD[i],
|
noiseFFT::PSD(surfPSDf[i]),
|
||||||
|
procFaceOffset
|
||||||
|
);
|
||||||
|
writeSurfaceData
|
||||||
|
(
|
||||||
|
fName,
|
||||||
|
gName,
|
||||||
|
"SPL",
|
||||||
|
freq1[freqI],
|
||||||
|
noiseFFT::SPL(surfPSDf[i]*deltaf),
|
||||||
procFaceOffset
|
procFaceOffset
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Writing one-third octave surface data" << endl;
|
graph Prmsfg
|
||||||
|
(
|
||||||
|
"Average Prms(f)",
|
||||||
|
"f [Hz]",
|
||||||
|
"P(f) [Pa]",
|
||||||
|
fOut,
|
||||||
|
PrmsfAve
|
||||||
|
);
|
||||||
|
Prmsfg.write(outDir, graph::wordify(Prmsfg.title()), graphFormat_);
|
||||||
|
|
||||||
forAll(surfPdelta, i)
|
graph PSDfg
|
||||||
|
(
|
||||||
|
"Average PSD_f(f)",
|
||||||
|
"f [Hz]",
|
||||||
|
"PSD(f) [PaPa_Hz]",
|
||||||
|
fOut,
|
||||||
|
PSDfAve
|
||||||
|
);
|
||||||
|
PSDfg.write(outDir, graph::wordify(PSDfg.title()), graphFormat_);
|
||||||
|
|
||||||
|
graph PSDg
|
||||||
|
(
|
||||||
|
"Average PSD_dB_Hz(f)",
|
||||||
|
"f [Hz]",
|
||||||
|
"PSD(f) [dB_Hz]",
|
||||||
|
fOut,
|
||||||
|
noiseFFT::PSD(PSDfAve)
|
||||||
|
);
|
||||||
|
PSDg.write(outDir, graph::wordify(PSDg.title()), graphFormat_);
|
||||||
|
|
||||||
|
graph SPLg
|
||||||
|
(
|
||||||
|
"Average SPL_dB(f)",
|
||||||
|
"f [Hz]",
|
||||||
|
"SPL(f) [dB]",
|
||||||
|
fOut,
|
||||||
|
noiseFFT::SPL(PSDfAve*deltaf)
|
||||||
|
);
|
||||||
|
SPLg.write(outDir, graph::wordify(SPLg.title()), graphFormat_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "Writing one-third octave surface data" << endl;
|
||||||
|
{
|
||||||
|
scalarField PSDfAve(surfPSD13f.size(), 0);
|
||||||
|
scalarField Prms13f2Ave(surfPSD13f.size(), 0);
|
||||||
|
|
||||||
|
forAll(surfPSD13f, i)
|
||||||
{
|
{
|
||||||
const word& fName = inputFileName_.name(true);
|
const word& fName = inputFileName_.name(true);
|
||||||
const word gName = "oneThirdOctave";
|
const word gName = "oneThirdOctave";
|
||||||
writeSurfaceData
|
PSDfAve[i] = writeSurfaceData
|
||||||
(
|
(
|
||||||
fName,
|
fName,
|
||||||
gName,
|
gName,
|
||||||
"Pdelta",
|
"PSD13f",
|
||||||
octave13BandIDs[i],
|
octave13FreqCentre[i],
|
||||||
surfPdelta[i],
|
surfPSD13f[i],
|
||||||
procFaceOffset
|
procFaceOffset
|
||||||
);
|
);
|
||||||
writeSurfaceData
|
writeSurfaceData
|
||||||
(
|
(
|
||||||
fName,
|
fName,
|
||||||
gName,
|
gName,
|
||||||
"Ldelta",
|
"PSD13",
|
||||||
octave13BandIDs[i],
|
octave13FreqCentre[i],
|
||||||
surfLdelta[i],
|
noiseFFT::PSD(surfPSD13f[i]),
|
||||||
procFaceOffset
|
procFaceOffset
|
||||||
);
|
);
|
||||||
|
writeSurfaceData
|
||||||
|
(
|
||||||
|
fName,
|
||||||
|
gName,
|
||||||
|
"SPL13",
|
||||||
|
octave13FreqCentre[i],
|
||||||
|
noiseFFT::SPL(surfPrms13f2[i]),
|
||||||
|
procFaceOffset
|
||||||
|
);
|
||||||
|
|
||||||
|
Prms13f2Ave[i] = surfaceAverage(surfPrms13f2[i], procFaceOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
graph PSD13g
|
||||||
|
(
|
||||||
|
"Average PSD13_dB_Hz(fm)",
|
||||||
|
"fm [Hz]",
|
||||||
|
"PSD(fm) [dB_Hz]",
|
||||||
|
octave13FreqCentre,
|
||||||
|
noiseFFT::PSD(PSDfAve)
|
||||||
|
);
|
||||||
|
PSD13g.write(outDir, graph::wordify(PSD13g.title()), graphFormat_);
|
||||||
|
|
||||||
|
graph SPL13g
|
||||||
|
(
|
||||||
|
"Average SPL13_dB(fm)",
|
||||||
|
"fm [Hz]",
|
||||||
|
"SPL(fm) [dB]",
|
||||||
|
octave13FreqCentre,
|
||||||
|
noiseFFT::SPL(Prms13f2Ave)
|
||||||
|
);
|
||||||
|
SPL13g.write(outDir, graph::wordify(SPL13g.title()), graphFormat_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,6 +703,3 @@ void surfaceNoise::calculate()
|
|||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -158,7 +158,8 @@ protected:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Write surface data to file
|
//- Write surface data to file
|
||||||
void writeSurfaceData
|
// Returns the area average value
|
||||||
|
scalar writeSurfaceData
|
||||||
(
|
(
|
||||||
const word& fName,
|
const word& fName,
|
||||||
const word& groupName,
|
const word& groupName,
|
||||||
@ -168,6 +169,12 @@ protected:
|
|||||||
const labelList& procFaceOffset
|
const labelList& procFaceOffset
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Calculate the area average value
|
||||||
|
scalar surfaceAverage
|
||||||
|
(
|
||||||
|
const scalarField& data,
|
||||||
|
const labelList& procFaceOffset
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user