From ee4f7feb30aab0486a1041a888664386d2ba6803 Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Thu, 10 Jun 2021 13:25:28 +0100 Subject: [PATCH] ENH: noiseModel - report missing octave bands --- .../noise/noiseModels/noiseModel/noiseModel.C | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.C b/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.C index 709ebe5fdc5..6ff862a709d 100644 --- a/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.C +++ b/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.C @@ -78,6 +78,7 @@ void Foam::noiseModel::setOctaveBands // Centre frequencies DynamicList<scalar> fc; + DynamicList<scalar> missedBins; // Convert to lower band limit fTest /= fRatioL2C; @@ -91,9 +92,12 @@ void Foam::noiseModel::setOctaveBands if (f[i] >= fTest) { // Advance band if appropriate + label stepi = 0; while (f[i] > fTest) { + if (stepi) missedBins.append(fTest/fRatio*fRatioL2C); fTest *= fRatio; + ++stepi; } fTest /= fRatio; @@ -113,6 +117,16 @@ void Foam::noiseModel::setOctaveBands fBandIDs = bandIDs.sortedToc(); + if (missedBins.size()) + { + label nMiss = missedBins.size(); + label nTotal = nMiss + fc.size() - 1; + WarningInFunction + << "Empty bands found: " << nMiss << " of " << nTotal + << " with centre frequencies " << flatOutput(missedBins) + << endl; + } + if (fc.size()) { // Remove the last centre frequency (beyond upper frequency limit) -- GitLab