Commit be84f454 authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: Removed misleading PSD13 output

parent 5653e2b1
......@@ -443,8 +443,7 @@ Foam::graph Foam::noiseFFT::PSD(const graph& gPSDf) const
Foam::graph Foam::noiseFFT::octaves
(
const graph& g,
const labelUList& freqBandIDs,
bool integrate
const labelUList& freqBandIDs
) const
{
if (freqBandIDs.size() < 2)
......@@ -478,22 +477,12 @@ Foam::graph Foam::noiseFFT::octaves
if (fb0 == fb1) continue;
if (integrate)
for (label freqI = fb0; freqI < fb1; ++freqI)
{
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];
}
label f0 = f[freqI];
label f1 = f[freqI + 1];
scalar dataAve = 0.5*(data[freqI] + data[freqI + 1]);
octData[bandI] += dataAve*(f1 - f0);
}
}
......
......@@ -177,8 +177,7 @@ public:
graph octaves
(
const graph& g,
const labelUList& freqBandIDs,
bool integrate
const labelUList& freqBandIDs
) const;
//- Convert the db into Pa
......
......@@ -183,22 +183,8 @@ void pointNoise::processData
// 1/3 octave data
// ---------------
// 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 Prms13f(nfft.octaves(PSDf, octave13BandIDs));
graph SPL13g
(
......@@ -206,7 +192,7 @@ void pointNoise::processData
"fm [Hz]",
"SPL(fm) [dB]",
octave13FreqCentre,
noiseFFT::SPL(Prms13f2.y())
noiseFFT::SPL(Prms13f.y())
);
Info<< " Creating graph for " << SPL13g.title() << endl;
SPL13g.write(outDir, graph::wordify(SPL13g.title()), graphFormat_);
......
......@@ -536,12 +536,10 @@ void surfaceNoise::calculate()
bandSize = octave13BandIDs.size() - 1;
}
List<scalarField> surfPSD13f(bandSize);
List<scalarField> surfPrms13f2(bandSize);
forAll(surfPSD13f, freqI)
List<scalarField> surfPrms13f(bandSize);
forAll(surfPrms13f, freqI)
{
surfPSD13f[freqI].setSize(nLocalFace);
surfPrms13f2[freqI].setSize(nLocalFace);
surfPrms13f[freqI].setSize(nLocalFace);
}
const windowModel& win = windowModelPtr_();
......@@ -566,17 +564,13 @@ void surfaceNoise::calculate()
surfPSDf[i][faceI] = PSDf.y()[freqI];
}
// 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 Prms13f(nfft.octaves(PSDf, octave13BandIDs));
// Store the 1/3 octave results in slot for face of surface
forAll(surfPSD13f, freqI)
forAll(surfPrms13f, freqI)
{
surfPSD13f[freqI][faceI] = PSD13f.y()[freqI];
surfPrms13f2[freqI][faceI] = Prms13f2.y()[freqI];
surfPrms13f[freqI][faceI] = Prms13f.y()[freqI];
}
}
}
......@@ -739,70 +733,35 @@ void surfaceNoise::calculate()
{
fileName outDir(outDirBase/"oneThirdOctave");
scalarField PSDfAve(surfPSD13f.size(), Zero);
scalarField Prms13f2Ave(surfPSD13f.size(), Zero);
scalarField PSDfAve(surfPrms13f.size(), Zero);
scalarField Prms13fAve(surfPrms13f.size(), Zero);
forAll(surfPSD13f, i)
forAll(surfPrms13f, i)
{
PSDfAve[i] = writeSurfaceData
(
outDir,
fNameBase,
"PSD13f",
octave13FreqCentre[i],
surfPSD13f[i],
procFaceOffset,
writeOctaves_
);
writeSurfaceData
(
outDir,
fNameBase,
"PSD13",
octave13FreqCentre[i],
noiseFFT::PSD(surfPSD13f[i]),
procFaceOffset,
writeOctaves_
);
writeSurfaceData
(
outDir,
fNameBase,
"SPL13",
octave13FreqCentre[i],
noiseFFT::SPL(surfPrms13f2[i]),
noiseFFT::SPL(surfPrms13f[i]),
procFaceOffset,
writeOctaves_
);
Prms13f2Ave[i] =
surfaceAverage(surfPrms13f2[i], procFaceOffset);
Prms13fAve[i] =
surfaceAverage(surfPrms13f[i], procFaceOffset);
}
if (Pstream::master())
{
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)
noiseFFT::SPL(Prms13fAve)
);
SPL13g.write
(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment