Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop

This commit is contained in:
mattijs
2017-03-15 12:01:55 +00:00
10 changed files with 449 additions and 188 deletions

View File

@ -28,6 +28,7 @@ License
#include "IOmanip.H" #include "IOmanip.H"
#include "Pair.H" #include "Pair.H"
#include "OSspecific.H" #include "OSspecific.H"
#include "SubField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -160,6 +161,45 @@ Foam::scalarField& Foam::graph::y()
} }
void Foam::graph::setXRange(const scalar x0, const scalar x1)
{
if (x1 < x0)
{
FatalErrorInFunction
<< "When setting limits, x1 must be greater than x0" << nl
<< " x0: " << x0 << nl
<< " x1: " << x1 << nl
<< abort(FatalError);
}
label i0 = 0;
label i1 = 0;
forAll(x_, i)
{
if (x_[i] < x0)
{
i0 = i + 1;
}
if (x_[i] < x1)
{
i1 = i;
}
}
label nX = i1 - i0 + 1;
scalarField xNew(SubField<scalar>(x_, nX, i0));
x_.transfer(xNew);
forAllIter(HashPtrTable<curve>, *this, iter)
{
curve* c = iter();
scalarField cNew(SubField<scalar>(*c, nX, i0));
c->transfer(cNew);
}
}
Foam::autoPtr<Foam::graph::writer> Foam::graph::writer::New Foam::autoPtr<Foam::graph::writer> Foam::graph::writer::New
( (
const word& graphFormat const word& graphFormat

View File

@ -178,6 +178,9 @@ public:
scalarField& y(); scalarField& y();
// Limit the data for all axes based on x-limits
void setXRange(const scalar x0, const scalar x1);
// Write // Write

View File

@ -35,6 +35,26 @@ namespace Foam
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::noiseModel::readWriteOption
(
const dictionary& dict,
const word& lookup,
bool& option
) const
{
dict.readIfPresent(lookup, option);
if (option)
{
Info<< " " << lookup << ": " << "yes" << endl;
}
else
{
Info<< " " << lookup << ": " << "no" << endl;
}
}
Foam::scalar Foam::noiseModel::checkUniformTimeStep Foam::scalar Foam::noiseModel::checkUniformTimeStep
( (
const scalarList& times const scalarList& times
@ -92,6 +112,22 @@ Foam::label Foam::noiseModel::findStartTimeIndex
} }
Foam::fileName Foam::noiseModel::baseFileDir(const label dataseti) const
{
fileName baseDir("$FOAM_CASE");
word datasetName("input" + Foam::name(dataseti));
baseDir =
baseDir.expand()
/"postProcessing"
/"noise"
/outputPrefix_
/type()
/datasetName;
return baseDir;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::noiseModel::noiseModel(const dictionary& dict, const bool readFields) Foam::noiseModel::noiseModel(const dictionary& dict, const bool readFields)
@ -101,9 +137,16 @@ Foam::noiseModel::noiseModel(const dictionary& dict, const bool readFields)
nSamples_(65536), nSamples_(65536),
fLower_(25), fLower_(25),
fUpper_(10000), fUpper_(10000),
customBounds_(false),
startTime_(0), startTime_(0),
windowModelPtr_(), windowModelPtr_(),
graphFormat_("raw") graphFormat_("raw"),
outputPrefix_(),
writePrmsf_(true),
writeSPL_(true),
writePSD_(true),
writePSDf_(true),
writeOctaves_(true)
{ {
if (readFields) if (readFields)
{ {
@ -124,10 +167,18 @@ bool Foam::noiseModel::read(const dictionary& dict)
{ {
dict.readIfPresent("rhoRef", rhoRef_); dict.readIfPresent("rhoRef", rhoRef_);
dict.readIfPresent("N", nSamples_); dict.readIfPresent("N", nSamples_);
dict.readIfPresent("fl", fLower_); customBounds_ = false;
dict.readIfPresent("fu", fUpper_); if (dict.readIfPresent("fl", fLower_))
{
customBounds_ = true;
}
if (dict.readIfPresent("fu", fUpper_))
{
customBounds_ = true;
}
dict.readIfPresent("startTime", startTime_); dict.readIfPresent("startTime", startTime_);
dict.readIfPresent("graphFormat", graphFormat_); dict.readIfPresent("graphFormat", graphFormat_);
dict.readIfPresent("outputPrefix", outputPrefix_);
// 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)));
@ -164,6 +215,14 @@ bool Foam::noiseModel::read(const dictionary& dict)
} }
Info<< " Write options:" << endl;
dictionary optDict(dict.subOrEmptyDict("writeOptions"));
readWriteOption(optDict, "writePrmsf", writePrmsf_);
readWriteOption(optDict, "writeSPL", writeSPL_);
readWriteOption(optDict, "writePSD", writePSD_);
readWriteOption(optDict, "writeOctaves", writeOctaves_);
windowModelPtr_ = windowModel::New(dict, nSamples_); windowModelPtr_ = windowModel::New(dict, nSamples_);
return true; return true;

View File

@ -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-2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -35,6 +35,18 @@ Description
fl 25; fl 25;
fu 25; fu 25;
startTime 0; startTime 0;
outputPrefix "test1";
// Optional write options dictionary
writeOptions
{
writePrmsf no;
writeSPL yes;
writePSD yes;
writePSDf no;
writeOctaves yes;
}
\endverbatim \endverbatim
where where
@ -45,7 +57,13 @@ Description
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 startTime | Start time | no | 0
outputPrefix | Prefix applied to output files| no | ''
graphFormat | Graph format | no | raw graphFormat | Graph format | no | raw
writePrmsf | Write Prmsf data | no | yes
writeSPL | Write SPL data | no | yes
writePSD | Write PSD data | no | yes
writePSDf | Write PSDf data | no | yes
writeOctaves | Write octaves data | no | yes
\endtable \endtable
Note Note
@ -108,6 +126,9 @@ protected:
//- Upper frequency limit, default = 10kHz //- Upper frequency limit, default = 10kHz
scalar fUpper_; scalar fUpper_;
//- Flag to indicate that custom frequenct bounds are being used
bool customBounds_;
//- Start time, default = 0s //- Start time, default = 0s
scalar startTime_; scalar startTime_;
@ -118,8 +139,37 @@ protected:
word graphFormat_; word graphFormat_;
// Write options
//- Output file prefix, default = ''
fileName outputPrefix_;
//- Write Prmsf; default = yes
bool writePrmsf_;
//- Write SPL; default = yes
bool writeSPL_;
//- Write PSD; default = yes
bool writePSD_;
//- Write PSDf; default = yes
bool writePSDf_;
//- Write writeOctaves; default = yes
bool writeOctaves_;
// Protected Member Functions // Protected Member Functions
//- Helper function to read write options and provide info feedback
void readWriteOption
(
const dictionary& dict,
const word& lookup,
bool& option
) const;
//- Check and return uniform time step //- Check and return uniform time step
scalar checkUniformTimeStep scalar checkUniformTimeStep
( (
@ -133,6 +183,9 @@ protected:
const scalar startTime const scalar startTime
) const; ) const;
//- Return the base output directory
fileName baseFileDir(const label dataseti) const;
public: public:

View File

@ -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-2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -66,7 +66,11 @@ void pointNoise::filterTimeData
} }
void pointNoise::processData(const Function1Types::CSV<scalar>& data) void pointNoise::processData
(
const label dataseti,
const Function1Types::CSV<scalar>& data
)
{ {
Info<< "Reading data file " << data.fName() << endl; Info<< "Reading data file " << data.fName() << endl;
@ -86,7 +90,7 @@ void pointNoise::processData(const Function1Types::CSV<scalar>& data)
windowModelPtr_->validate(t.size()); windowModelPtr_->validate(t.size());
const windowModel& win = windowModelPtr_(); const windowModel& win = windowModelPtr_();
const scalar deltaf = 1.0/(deltaT*win.nSamples()); const scalar deltaf = 1.0/(deltaT*win.nSamples());
fileName outDir(fileName("postProcessing")/"noise"/typeName/fNameBase); fileName outDir(baseFileDir(dataseti)/fNameBase);
// Create the fft // Create the fft
noiseFFT nfft(deltaT, p); noiseFFT nfft(deltaT, p);
@ -97,13 +101,27 @@ void pointNoise::processData(const Function1Types::CSV<scalar>& data)
// RMS pressure [Pa] // RMS pressure [Pa]
graph Prmsf(nfft.RMSmeanPf(win)); graph Prmsf(nfft.RMSmeanPf(win));
if (customBounds_)
{
Prmsf.setXRange(fLower_, fUpper_);
}
if (writePrmsf_)
{
Info<< " Creating graph for " << Prmsf.title() << endl; Info<< " Creating graph for " << Prmsf.title() << endl;
Prmsf.write(outDir, graph::wordify(Prmsf.title()), graphFormat_); Prmsf.write(outDir, graph::wordify(Prmsf.title()), graphFormat_);
}
// PSD [Pa^2/Hz] // PSD [Pa^2/Hz]
graph PSDf(nfft.PSDf(win)); graph PSDf(nfft.PSDf(win));
if (customBounds_)
{
PSDf.setXRange(fLower_, fUpper_);
}
if (writePSDf_)
{
Info<< " Creating graph for " << PSDf.title() << endl; Info<< " Creating graph for " << PSDf.title() << endl;
PSDf.write(outDir, graph::wordify(PSDf.title()), graphFormat_); PSDf.write(outDir, graph::wordify(PSDf.title()), graphFormat_);
}
// PSD [dB/Hz] // PSD [dB/Hz]
graph PSDg graph PSDg
@ -114,8 +132,12 @@ void pointNoise::processData(const Function1Types::CSV<scalar>& data)
Prmsf.x(), Prmsf.x(),
noiseFFT::PSD(PSDf.y()) noiseFFT::PSD(PSDf.y())
); );
if (writePSD_)
{
Info<< " Creating graph for " << PSDg.title() << endl; Info<< " Creating graph for " << PSDg.title() << endl;
PSDg.write(outDir, graph::wordify(PSDg.title()), graphFormat_); PSDg.write(outDir, graph::wordify(PSDg.title()), graphFormat_);
}
// SPL [dB] // SPL [dB]
graph SPLg graph SPLg
@ -126,9 +148,15 @@ void pointNoise::processData(const Function1Types::CSV<scalar>& data)
Prmsf.x(), Prmsf.x(),
noiseFFT::SPL(PSDf.y()*deltaf) noiseFFT::SPL(PSDf.y()*deltaf)
); );
if (writeSPL_)
{
Info<< " Creating graph for " << SPLg.title() << endl; Info<< " Creating graph for " << SPLg.title() << endl;
SPLg.write(outDir, graph::wordify(SPLg.title()), graphFormat_); SPLg.write(outDir, graph::wordify(SPLg.title()), graphFormat_);
}
if (writeOctaves_)
{
labelList octave13BandIDs; labelList octave13BandIDs;
scalarField octave13FreqCentre; scalarField octave13FreqCentre;
noiseFFT::octaveBandInfo noiseFFT::octaveBandInfo
@ -173,33 +201,6 @@ void pointNoise::processData(const Function1Types::CSV<scalar>& data)
Info<< " Creating graph for " << SPL13g.title() << endl; Info<< " Creating graph for " << SPL13g.title() << endl;
SPL13g.write(outDir, graph::wordify(SPL13g.title()), graphFormat_); SPL13g.write(outDir, graph::wordify(SPL13g.title()), graphFormat_);
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void pointNoise::calculate()
{
// Point data only handled by master
if (!Pstream::master())
{
return;
}
if (inputFileNames_.size())
{
forAll(inputFileNames_, i)
{
const fileName fName = inputFileNames_[i].expand();
Function1Types::CSV<scalar> data("pressure", dict_, "Data", fName);
processData(data);
}
}
else
{
Function1Types::CSV<scalar> data("pressure", dict_, "Data");
processData(data);
}
} }
@ -222,11 +223,45 @@ pointNoise::~pointNoise()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void pointNoise::calculate()
{
// Point data only handled by master
if (!Pstream::master())
{
return;
}
forAll(inputFileNames_, filei)
{
fileName fName = inputFileNames_[filei];
fName.expand();
if (!fName.isAbsolute())
{
fName = "$FOAM_CASE"/fName;
}
fName.expand();
Function1Types::CSV<scalar> data("pressure", dict_, "Data", fName);
processData(filei, data);
}
}
bool pointNoise::read(const dictionary& dict) bool pointNoise::read(const dictionary& dict)
{ {
if (noiseModel::read(dict)) if (noiseModel::read(dict))
{ {
dict.readIfPresent("inputFiles", inputFileNames_); if (!dict.readIfPresent("inputFiles", inputFileNames_))
{
inputFileNames_.setSize(1);
// Note: unsafe lookup of file name from pressureData sub-dict!
dict.subDict("pressureData").lookup("fileName")
>> inputFileNames_[0];
}
return true; return true;
} }

View File

@ -117,7 +117,11 @@ protected:
) const; ) const;
//- Process the CSV data //- Process the CSV data
void processData(const Function1Types::CSV<scalar>& data); void processData
(
const label dataseti,
const Function1Types::CSV<scalar>& data
);
public: public:

View File

@ -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-2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -226,20 +226,18 @@ void surfaceNoise::readSurfaceData
Foam::scalar surfaceNoise::writeSurfaceData Foam::scalar surfaceNoise::writeSurfaceData
( (
const fileName& outDirBase,
const word& fName, const word& fName,
const word& groupName,
const word& title, const word& title,
const scalar freq, const scalar freq,
const scalarField& data, const scalarField& data,
const labelList& procFaceOffset const labelList& procFaceOffset,
const bool writeSurface
) const ) const
{ {
Info<< " processing " << title << " for frequency " << freq << endl; Info<< " processing " << title << " for frequency " << freq << endl;
fileName outDir const fileName outDir(outDirBase/Foam::name(freq));
(
fileName("postProcessing")/"noise"/groupName/Foam::name(freq)
);
if (Pstream::parRun()) if (Pstream::parRun())
{ {
@ -279,7 +277,9 @@ Foam::scalar surfaceNoise::writeSurfaceData
} }
} }
// could also have meshedSurface implement meshedSurf // Could also have meshedSurface implement meshedSurf
if (writeSurface)
{
fileName outFileName = writerPtr_->write fileName outFileName = writerPtr_->write
( (
outDir, outDir,
@ -293,6 +293,7 @@ Foam::scalar surfaceNoise::writeSurfaceData
allData, allData,
false false
); );
}
// TO BE VERIFIED: area-averaged values // TO BE VERIFIED: area-averaged values
// areaAverage = sum(allData*surf.magSf())/sum(surf.magSf()); // areaAverage = sum(allData*surf.magSf())/sum(surf.magSf());
@ -306,7 +307,9 @@ Foam::scalar surfaceNoise::writeSurfaceData
{ {
const meshedSurface& surf = readerPtr_->geometry(); const meshedSurface& surf = readerPtr_->geometry();
// could also have meshedSurface implement meshedSurf // Could also have meshedSurface implement meshedSurf
if (writeSurface)
{
writerPtr_->write writerPtr_->write
( (
outDir, outDir,
@ -320,6 +323,7 @@ Foam::scalar surfaceNoise::writeSurfaceData
data, data,
false false
); );
}
// TO BE VERIFIED: area-averaged values // TO BE VERIFIED: area-averaged values
// return sum(data*surf.magSf())/sum(surf.magSf()); // return sum(data*surf.magSf())/sum(surf.magSf());
@ -459,9 +463,15 @@ bool surfaceNoise::read(const dictionary& dict)
void surfaceNoise::calculate() void surfaceNoise::calculate()
{ {
forAll(inputFileNames_, i) forAll(inputFileNames_, filei)
{ {
fileName fName = inputFileNames_[i]; fileName fName = inputFileNames_[filei];
fName.expand();
if (!fName.isAbsolute())
{
fName = "$FOAM_CASE"/fName;
}
initialise(fName.expand()); initialise(fName.expand());
@ -494,10 +504,16 @@ void surfaceNoise::calculate()
Info<< "Creating noise FFTs" << endl; Info<< "Creating noise FFTs" << endl;
const scalarField freq1(noiseFFT::frequencies(nSamples_, deltaT_));
// Reset desired frequency range if outside actual frequency range
fLower_ = min(fLower_, max(freq1));
fUpper_ = min(fUpper_, max(freq1));
// Storage for FFT data // Storage for FFT data
const label nLocalFace = pData.size(); const label nLocalFace = pData.size();
const scalarField freq1(noiseFFT::frequencies(nSamples_, deltaT_)); const label nFFT = ceil(freq1.size()/scalar(fftWriteInterval_));
const label nFFT = freq1.size()/fftWriteInterval_;
List<scalarField> surfPrmsf(nFFT); List<scalarField> surfPrmsf(nFFT);
List<scalarField> surfPSDf(nFFT); List<scalarField> surfPSDf(nFFT);
forAll(surfPrmsf, freqI) forAll(surfPrmsf, freqI)
@ -553,7 +569,7 @@ void surfaceNoise::calculate()
// Store the frequency results in slot for face of surface // Store the frequency results in slot for face of surface
forAll(surfPrmsf, i) forAll(surfPrmsf, i)
{ {
label freqI = (i + 1)*fftWriteInterval_ - 1; label freqI = i*fftWriteInterval_;
surfPrmsf[i][faceI] = Prmsf.y()[freqI]; surfPrmsf[i][faceI] = Prmsf.y()[freqI];
surfPSDf[i][faceI] = PSDf.y()[freqI]; surfPSDf[i][faceI] = PSDf.y()[freqI];
} }
@ -575,61 +591,91 @@ void surfaceNoise::calculate()
const word fNameBase = fName.nameLessExt(); const word fNameBase = fName.nameLessExt();
// Output directory for graphs // Output directory for graphs
fileName outDir fileName outDirBase(baseFileDir(filei)/fNameBase);
(
fileName("postProcessing")/"noise"/typeName/fNameBase
);
const scalar deltaf = 1.0/(deltaT_*win.nSamples()); const scalar deltaf = 1.0/(deltaT_*win.nSamples());
Info<< "Writing fft surface data" << endl; Info<< "Writing fft surface data";
if (fftWriteInterval_ == 1)
{ {
scalarField PrmsfAve(surfPrmsf.size(), 0); Info<< endl;
scalarField PSDfAve(surfPrmsf.size(), 0); }
scalarField fOut(surfPrmsf.size(), 0); else
{
Info<< " at every " << fftWriteInterval_ << " frequency points"
<< endl;
}
forAll(surfPrmsf, i)
{ {
label freqI = (i + 1)*fftWriteInterval_ - 1; fileName outDir(outDirBase/"fft");
// Determine frequency range of interest
// Note: freqencies have fixed interval, and are in the range
// 0 to fftWriteInterval_*(n-1)*deltaf
label f0 = ceil(fLower_/deltaf/scalar(fftWriteInterval_));
label f1 = floor(fUpper_/deltaf/scalar(fftWriteInterval_));
label nFreq = f1 - f0;
scalarField PrmsfAve(nFreq, 0);
scalarField PSDfAve(nFreq, 0);
scalarField fOut(nFreq, 0);
if (nFreq == 0)
{
WarningInFunction
<< "No surface data available using a fftWriteInterval of "
<< fftWriteInterval_ << endl;
}
else
{
forAll(fOut, i)
{
label freqI = (i + f0)*fftWriteInterval_;
fOut[i] = freq1[freqI]; fOut[i] = freq1[freqI];
const word gName = "fft";
PrmsfAve[i] = writeSurfaceData PrmsfAve[i] = writeSurfaceData
( (
outDir,
fNameBase, fNameBase,
gName,
"Prmsf", "Prmsf",
freq1[freqI], freq1[freqI],
surfPrmsf[i], surfPrmsf[i + f0],
procFaceOffset procFaceOffset,
writePrmsf_
); );
PSDfAve[i] = writeSurfaceData PSDfAve[i] = writeSurfaceData
( (
outDir,
fNameBase, fNameBase,
gName,
"PSDf", "PSDf",
freq1[freqI], freq1[freqI],
surfPSDf[i], surfPSDf[i + f0],
procFaceOffset procFaceOffset,
writePSDf_
); );
writeSurfaceData writeSurfaceData
( (
outDir,
fNameBase, fNameBase,
gName,
"PSD", "PSD",
freq1[freqI], freq1[freqI],
noiseFFT::PSD(surfPSDf[i]), noiseFFT::PSD(surfPSDf[i + f0]),
procFaceOffset procFaceOffset,
writePSD_
); );
writeSurfaceData writeSurfaceData
( (
outDir,
fNameBase, fNameBase,
gName,
"SPL", "SPL",
freq1[freqI], freq1[freqI],
noiseFFT::SPL(surfPSDf[i]*deltaf), noiseFFT::SPL(surfPSDf[i + f0]*deltaf),
procFaceOffset procFaceOffset,
writeSPL_
); );
} }
}
graph Prmsfg graph Prmsfg
( (
@ -675,38 +721,42 @@ void surfaceNoise::calculate()
Info<< "Writing one-third octave surface data" << endl; Info<< "Writing one-third octave surface data" << endl;
{ {
fileName outDir(outDirBase/"oneThirdOctave");
scalarField PSDfAve(surfPSD13f.size(), 0); scalarField PSDfAve(surfPSD13f.size(), 0);
scalarField Prms13f2Ave(surfPSD13f.size(), 0); scalarField Prms13f2Ave(surfPSD13f.size(), 0);
forAll(surfPSD13f, i) forAll(surfPSD13f, i)
{ {
const word gName = "oneThirdOctave";
PSDfAve[i] = writeSurfaceData PSDfAve[i] = writeSurfaceData
( (
outDir,
fNameBase, fNameBase,
gName,
"PSD13f", "PSD13f",
octave13FreqCentre[i], octave13FreqCentre[i],
surfPSD13f[i], surfPSD13f[i],
procFaceOffset procFaceOffset,
writeOctaves_
); );
writeSurfaceData writeSurfaceData
( (
outDir,
fNameBase, fNameBase,
gName,
"PSD13", "PSD13",
octave13FreqCentre[i], octave13FreqCentre[i],
noiseFFT::PSD(surfPSD13f[i]), noiseFFT::PSD(surfPSD13f[i]),
procFaceOffset procFaceOffset,
writeOctaves_
); );
writeSurfaceData writeSurfaceData
( (
outDir,
fNameBase, fNameBase,
gName,
"SPL13", "SPL13",
octave13FreqCentre[i], octave13FreqCentre[i],
noiseFFT::SPL(surfPrms13f2[i]), noiseFFT::SPL(surfPrms13f2[i]),
procFaceOffset procFaceOffset,
writeOctaves_
); );
Prms13f2Ave[i] = Prms13f2Ave[i] =

View File

@ -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-2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -71,7 +71,23 @@ Description
{ {
collateTimes true; collateTimes true;
} }
// Write Prmsf; default = yes
writePrmsf no;
// Write SPL; default = yes
writeSPL yes;
// Write PSD; default = yes
writePSD yes;
// Write PSDf; default = yes
writePSDf no;
// Write writeOctaves; default = yes
writeOctaves yes;
} }
\endverbatim \endverbatim
SourceFiles SourceFiles
@ -167,12 +183,13 @@ protected:
// Returns the area average value // Returns the area average value
scalar writeSurfaceData scalar writeSurfaceData
( (
const fileName& outDirBase,
const word& fName, const word& fName,
const word& groupName,
const word& title, const word& title,
const scalar freq, const scalar freq,
const scalarField& data, const scalarField& data,
const labelList& procFaceOffset const labelList& procFaceOffset,
const bool writeSurface
) const; ) const;
//- Calculate the area average value //- Calculate the area average value