mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: noiseModels - enable models to accept lists of file names
This commit is contained in:
@ -204,7 +204,8 @@ Foam::Function1Types::CSV<Type>::CSV
|
|||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& ext
|
const word& ext,
|
||||||
|
const fileName& fName
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
TableBase<Type>(entryName, dict.subDict(entryName + ext)),
|
TableBase<Type>(entryName, dict.subDict(entryName + ext)),
|
||||||
@ -214,7 +215,7 @@ Foam::Function1Types::CSV<Type>::CSV
|
|||||||
componentColumns_(coeffs_.lookup("componentColumns")),
|
componentColumns_(coeffs_.lookup("componentColumns")),
|
||||||
separator_(coeffs_.lookupOrDefault<string>("separator", string(","))[0]),
|
separator_(coeffs_.lookupOrDefault<string>("separator", string(","))[0]),
|
||||||
mergeSeparators_(readBool(coeffs_.lookup("mergeSeparators"))),
|
mergeSeparators_(readBool(coeffs_.lookup("mergeSeparators"))),
|
||||||
fName_(coeffs_.lookup("fileName"))
|
fName_(fName != fileName::null ? fName : coeffs_.lookup("fileName"))
|
||||||
{
|
{
|
||||||
if (componentColumns_.size() != pTraits<Type>::nComponents)
|
if (componentColumns_.size() != pTraits<Type>::nComponents)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -122,7 +122,8 @@ public:
|
|||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& ext = "Coeffs"
|
const word& ext = "Coeffs",
|
||||||
|
const fileName& fName = fileName::null
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Copy constructor
|
//- Copy constructor
|
||||||
|
|||||||
@ -94,17 +94,41 @@ Foam::label Foam::noiseModel::findStartTimeIndex
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::noiseModel::noiseModel(const dictionary& dict)
|
Foam::noiseModel::noiseModel(const dictionary& dict, const bool readFields)
|
||||||
:
|
:
|
||||||
dict_(dict),
|
dict_(dict),
|
||||||
rhoRef_(dict.lookupOrDefault<scalar>("rhoRef", 1)),
|
rhoRef_(1),
|
||||||
nSamples_(dict.lookupOrDefault<label>("N", 65536)),
|
nSamples_(65536),
|
||||||
fLower_(dict.lookupOrDefault<scalar>("fl", 25)),
|
fLower_(25),
|
||||||
fUpper_(dict.lookupOrDefault<scalar>("fu", 10000)),
|
fUpper_(10000),
|
||||||
startTime_(dict.lookupOrDefault<scalar>("startTime", 0)),
|
startTime_(0),
|
||||||
windowModelPtr_(windowModel::New(dict, nSamples_)),
|
windowModelPtr_(),
|
||||||
graphFormat_(dict.lookupOrDefault<word>("graphFormat", "raw"))
|
graphFormat_("raw")
|
||||||
{
|
{
|
||||||
|
if (readFields)
|
||||||
|
{
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::noiseModel::~noiseModel()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::noiseModel::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
dict.readIfPresent("rhoRef", rhoRef_);
|
||||||
|
dict.readIfPresent("N", nSamples_);
|
||||||
|
dict.readIfPresent("fl", fLower_);
|
||||||
|
dict.readIfPresent("fu", fUpper_);
|
||||||
|
dict.readIfPresent("startTime", startTime_);
|
||||||
|
dict.readIfPresent("graphFormat", graphFormat_);
|
||||||
|
|
||||||
// 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)));
|
||||||
if (!powerOf2)
|
if (!powerOf2)
|
||||||
@ -139,13 +163,11 @@ Foam::noiseModel::noiseModel(const dictionary& dict)
|
|||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
windowModelPtr_ = windowModel::New(dict, nSamples_);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::noiseModel::~noiseModel()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -155,7 +155,7 @@ public:
|
|||||||
static autoPtr<noiseModel> New(const dictionary& dict);
|
static autoPtr<noiseModel> New(const dictionary& dict);
|
||||||
|
|
||||||
//- Constructor
|
//- Constructor
|
||||||
noiseModel(const dictionary& dict);
|
noiseModel(const dictionary& dict, const bool readFields = true);
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~noiseModel();
|
virtual ~noiseModel();
|
||||||
@ -163,6 +163,9 @@ public:
|
|||||||
|
|
||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
|
//- Read from dictionary
|
||||||
|
virtual bool read(const dictionary& dict);
|
||||||
|
|
||||||
//- Abstract call to calculate
|
//- Abstract call to calculate
|
||||||
virtual void calculate() = 0;
|
virtual void calculate() = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -43,14 +43,12 @@ addToRunTimeSelectionTable(noiseModel, pointNoise, dictionary);
|
|||||||
|
|
||||||
void pointNoise::filterTimeData
|
void pointNoise::filterTimeData
|
||||||
(
|
(
|
||||||
const Function1Types::CSV<scalar>& pData,
|
const scalarField& t0,
|
||||||
|
const scalarField& p0,
|
||||||
scalarField& t,
|
scalarField& t,
|
||||||
scalarField& p
|
scalarField& p
|
||||||
)
|
) const
|
||||||
{
|
{
|
||||||
const scalarField t0(pData.x());
|
|
||||||
const scalarField p0(pData.y());
|
|
||||||
|
|
||||||
DynamicList<scalar> tf(t0.size());
|
DynamicList<scalar> tf(t0.size());
|
||||||
DynamicList<scalar> pf(t0.size());
|
DynamicList<scalar> pf(t0.size());
|
||||||
|
|
||||||
@ -68,23 +66,15 @@ void pointNoise::filterTimeData
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
void pointNoise::processData(const Function1Types::CSV<scalar>& data)
|
||||||
|
|
||||||
void pointNoise::calculate()
|
|
||||||
{
|
{
|
||||||
// Point data only handled by master
|
Info<< "Reading data file " << data.fName() << endl;
|
||||||
if (!Pstream::master())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Info<< "Reading data file" << endl;
|
const fileName& fNameBase = data.fName()(true);
|
||||||
|
|
||||||
Function1Types::CSV<scalar> pData("pressure", dict_, "Data");
|
|
||||||
|
|
||||||
// Time and pressure history data
|
// Time and pressure history data
|
||||||
scalarField t, p;
|
scalarField t, p;
|
||||||
filterTimeData(pData, t, p);
|
filterTimeData(data.x(), data.y(), t, p);
|
||||||
p *= rhoRef_;
|
p *= rhoRef_;
|
||||||
|
|
||||||
Info<< " read " << t.size() << " values" << nl << endl;
|
Info<< " read " << t.size() << " values" << nl << endl;
|
||||||
@ -96,7 +86,7 @@ void pointNoise::calculate()
|
|||||||
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);
|
fileName outDir(fileName("postProcessing")/"noise"/typeName/fNameBase);
|
||||||
|
|
||||||
// Create the fft
|
// Create the fft
|
||||||
noiseFFT nfft(deltaT, p);
|
noiseFFT nfft(deltaT, p);
|
||||||
@ -185,12 +175,45 @@ void pointNoise::calculate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
pointNoise::pointNoise(const dictionary& dict)
|
pointNoise::pointNoise(const dictionary& dict, const bool readFields)
|
||||||
:
|
:
|
||||||
noiseModel(dict)
|
noiseModel(dict)
|
||||||
{}
|
{
|
||||||
|
if (readFields)
|
||||||
|
{
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
@ -199,6 +222,18 @@ pointNoise::~pointNoise()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
bool pointNoise::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (noiseModel::read(dict))
|
||||||
|
{
|
||||||
|
dict.readIfPresent("inputFiles", inputFileNames_);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace noiseModels
|
} // End namespace noiseModels
|
||||||
|
|||||||
@ -76,8 +76,8 @@ SeeAlso
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef pointNoise_H
|
#ifndef noiseModels_pointNoise_H
|
||||||
#define pointNoise_H
|
#define noiseModels_pointNoise_H
|
||||||
|
|
||||||
#include "noiseModel.H"
|
#include "noiseModel.H"
|
||||||
#include "CSV.H"
|
#include "CSV.H"
|
||||||
@ -100,14 +100,24 @@ class pointNoise
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- Input file names - optional
|
||||||
|
List<fileName> inputFileNames_;
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
void filterTimeData
|
void filterTimeData
|
||||||
(
|
(
|
||||||
const Function1Types::CSV<scalar>& pData,
|
const scalarField& t0,
|
||||||
|
const scalarField& p0,
|
||||||
scalarField& t,
|
scalarField& t,
|
||||||
scalarField& p
|
scalarField& p
|
||||||
);
|
) const;
|
||||||
|
|
||||||
|
//- Process the CSV data
|
||||||
|
void processData(const Function1Types::CSV<scalar>& data);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -116,7 +126,7 @@ public:
|
|||||||
TypeName("pointNoise");
|
TypeName("pointNoise");
|
||||||
|
|
||||||
//- Constructor
|
//- Constructor
|
||||||
pointNoise(const dictionary& dict);
|
pointNoise(const dictionary& dict, const bool readFields = true);
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~pointNoise();
|
virtual ~pointNoise();
|
||||||
@ -124,6 +134,9 @@ public:
|
|||||||
|
|
||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
|
//- Read from dictionary
|
||||||
|
virtual bool read(const dictionary& dict);
|
||||||
|
|
||||||
//- Calculate
|
//- Calculate
|
||||||
virtual void calculate();
|
virtual void calculate();
|
||||||
|
|
||||||
|
|||||||
@ -44,12 +44,9 @@ addToRunTimeSelectionTable(noiseModel, surfaceNoise, dictionary);
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||||
|
|
||||||
void surfaceNoise::initialise(const dictionary& dict)
|
void surfaceNoise::initialise(const fileName& fName)
|
||||||
{
|
{
|
||||||
dict.lookup("inputFile") >> inputFileName_;
|
Info<< "Reading data file " << fName << endl;
|
||||||
inputFileName_.expand();
|
|
||||||
|
|
||||||
dict.readIfPresent("fftWriteInterval", fftWriteInterval_);
|
|
||||||
|
|
||||||
label nAvailableTimes = 0;
|
label nAvailableTimes = 0;
|
||||||
|
|
||||||
@ -57,17 +54,15 @@ void surfaceNoise::initialise(const dictionary& dict)
|
|||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
// Create the surface reader
|
// Create the surface reader
|
||||||
const word readerType(dict.lookup("reader"));
|
readerPtr_ = surfaceReader::New(readerType_, fName);
|
||||||
readerPtr_.reset(surfaceReader::New(readerType, inputFileName_).ptr());
|
|
||||||
|
|
||||||
// Find the index of the pressure data
|
// Find the index of the pressure data
|
||||||
const word pName(dict.lookupOrDefault<word>("p", "p"));
|
|
||||||
const List<word> fieldNames(readerPtr_->fieldNames(0));
|
const List<word> fieldNames(readerPtr_->fieldNames(0));
|
||||||
pIndex_ = findIndex(fieldNames, pName);
|
pIndex_ = findIndex(fieldNames, pName_);
|
||||||
if (pIndex_ == -1)
|
if (pIndex_ == -1)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Unable to find pressure field name " << pName
|
<< "Unable to find pressure field name " << pName_
|
||||||
<< " in list of available fields: " << fieldNames
|
<< " in list of available fields: " << fieldNames
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
@ -76,12 +71,6 @@ void surfaceNoise::initialise(const dictionary& dict)
|
|||||||
// - Could be done later, but since this utility can process a lot of
|
// - Could be done later, but since this utility can process a lot of
|
||||||
// data we can ensure that the user-input is correct prior to doing
|
// data we can ensure that the user-input is correct prior to doing
|
||||||
// the heavy lifting
|
// the heavy lifting
|
||||||
const word writerType(dict.lookup("writer"));
|
|
||||||
dictionary optDict
|
|
||||||
(
|
|
||||||
dict.subOrEmptyDict("writeOptions").subOrEmptyDict(writerType)
|
|
||||||
);
|
|
||||||
writerPtr_.reset(surfaceWriter::New(writerType, optDict).ptr());
|
|
||||||
|
|
||||||
// Set the time range
|
// Set the time range
|
||||||
const instantList allTimes = readerPtr_->times();
|
const instantList allTimes = readerPtr_->times();
|
||||||
@ -404,18 +393,25 @@ Foam::scalar surfaceNoise::surfaceAverage
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
surfaceNoise::surfaceNoise(const dictionary& dict)
|
surfaceNoise::surfaceNoise(const dictionary& dict, const bool readFields)
|
||||||
:
|
:
|
||||||
noiseModel(dict),
|
noiseModel(dict, false),
|
||||||
inputFileName_("unknown-inputFile"),
|
inputFileNames_(),
|
||||||
|
pName_("p"),
|
||||||
pIndex_(0),
|
pIndex_(0),
|
||||||
times_(),
|
times_(),
|
||||||
deltaT_(0),
|
deltaT_(0),
|
||||||
startTimeIndex_(0),
|
startTimeIndex_(0),
|
||||||
nFace_(0),
|
nFace_(0),
|
||||||
fftWriteInterval_(1)
|
fftWriteInterval_(1),
|
||||||
|
readerType_(word::null),
|
||||||
|
readerPtr_(nullptr),
|
||||||
|
writerPtr_(nullptr)
|
||||||
{
|
{
|
||||||
initialise(dict);
|
if (readFields)
|
||||||
|
{
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -427,8 +423,39 @@ surfaceNoise::~surfaceNoise()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool surfaceNoise::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (noiseModel::read(dict))
|
||||||
|
{
|
||||||
|
dict.lookup("inputFiles") >> inputFileNames_;
|
||||||
|
dict.readIfPresent("fftWriteInterval", fftWriteInterval_);
|
||||||
|
dict.readIfPresent("p", pName_);
|
||||||
|
|
||||||
|
dict.lookup("reader") >> readerType_;
|
||||||
|
|
||||||
|
word writerType(dict.lookup("writer"));
|
||||||
|
dictionary optDict
|
||||||
|
(
|
||||||
|
dict.subOrEmptyDict("writeOptions").subOrEmptyDict(writerType)
|
||||||
|
);
|
||||||
|
|
||||||
|
writerPtr_ = surfaceWriter::New(writerType, optDict);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void surfaceNoise::calculate()
|
void surfaceNoise::calculate()
|
||||||
{
|
{
|
||||||
|
forAll(inputFileNames_, i)
|
||||||
|
{
|
||||||
|
fileName fName = inputFileNames_[i];
|
||||||
|
|
||||||
|
initialise(fName.expand());
|
||||||
|
|
||||||
// Container for pressure time history data per face
|
// Container for pressure time history data per face
|
||||||
List<scalarField> pData;
|
List<scalarField> pData;
|
||||||
|
|
||||||
@ -536,8 +563,13 @@ void surfaceNoise::calculate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const word& fNameBase = fName.name(true);
|
||||||
|
|
||||||
// Output directory for graphs
|
// Output directory for graphs
|
||||||
fileName outDir(fileName("postProcessing")/"noise"/typeName);
|
fileName outDir
|
||||||
|
(
|
||||||
|
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" << endl;
|
||||||
@ -550,11 +582,10 @@ void surfaceNoise::calculate()
|
|||||||
{
|
{
|
||||||
label freqI = i*fftWriteInterval_;
|
label freqI = i*fftWriteInterval_;
|
||||||
fOut[i] = freq1[freqI];
|
fOut[i] = freq1[freqI];
|
||||||
const word& fName = inputFileName_.name(true);
|
|
||||||
const word gName = "fft";
|
const word gName = "fft";
|
||||||
PrmsfAve[i] = writeSurfaceData
|
PrmsfAve[i] = writeSurfaceData
|
||||||
(
|
(
|
||||||
fName,
|
fNameBase,
|
||||||
gName,
|
gName,
|
||||||
"Prmsf",
|
"Prmsf",
|
||||||
freq1[freqI],
|
freq1[freqI],
|
||||||
@ -564,7 +595,7 @@ void surfaceNoise::calculate()
|
|||||||
|
|
||||||
PSDfAve[i] = writeSurfaceData
|
PSDfAve[i] = writeSurfaceData
|
||||||
(
|
(
|
||||||
fName,
|
fNameBase,
|
||||||
gName,
|
gName,
|
||||||
"PSDf",
|
"PSDf",
|
||||||
freq1[freqI],
|
freq1[freqI],
|
||||||
@ -573,7 +604,7 @@ void surfaceNoise::calculate()
|
|||||||
);
|
);
|
||||||
writeSurfaceData
|
writeSurfaceData
|
||||||
(
|
(
|
||||||
fName,
|
fNameBase,
|
||||||
gName,
|
gName,
|
||||||
"PSD",
|
"PSD",
|
||||||
freq1[freqI],
|
freq1[freqI],
|
||||||
@ -582,7 +613,7 @@ void surfaceNoise::calculate()
|
|||||||
);
|
);
|
||||||
writeSurfaceData
|
writeSurfaceData
|
||||||
(
|
(
|
||||||
fName,
|
fNameBase,
|
||||||
gName,
|
gName,
|
||||||
"SPL",
|
"SPL",
|
||||||
freq1[freqI],
|
freq1[freqI],
|
||||||
@ -640,11 +671,10 @@ void surfaceNoise::calculate()
|
|||||||
|
|
||||||
forAll(surfPSD13f, i)
|
forAll(surfPSD13f, i)
|
||||||
{
|
{
|
||||||
const word& fName = inputFileName_.name(true);
|
|
||||||
const word gName = "oneThirdOctave";
|
const word gName = "oneThirdOctave";
|
||||||
PSDfAve[i] = writeSurfaceData
|
PSDfAve[i] = writeSurfaceData
|
||||||
(
|
(
|
||||||
fName,
|
fNameBase,
|
||||||
gName,
|
gName,
|
||||||
"PSD13f",
|
"PSD13f",
|
||||||
octave13FreqCentre[i],
|
octave13FreqCentre[i],
|
||||||
@ -653,7 +683,7 @@ void surfaceNoise::calculate()
|
|||||||
);
|
);
|
||||||
writeSurfaceData
|
writeSurfaceData
|
||||||
(
|
(
|
||||||
fName,
|
fNameBase,
|
||||||
gName,
|
gName,
|
||||||
"PSD13",
|
"PSD13",
|
||||||
octave13FreqCentre[i],
|
octave13FreqCentre[i],
|
||||||
@ -662,7 +692,7 @@ void surfaceNoise::calculate()
|
|||||||
);
|
);
|
||||||
writeSurfaceData
|
writeSurfaceData
|
||||||
(
|
(
|
||||||
fName,
|
fNameBase,
|
||||||
gName,
|
gName,
|
||||||
"SPL13",
|
"SPL13",
|
||||||
octave13FreqCentre[i],
|
octave13FreqCentre[i],
|
||||||
@ -670,7 +700,8 @@ void surfaceNoise::calculate()
|
|||||||
procFaceOffset
|
procFaceOffset
|
||||||
);
|
);
|
||||||
|
|
||||||
Prms13f2Ave[i] = surfaceAverage(surfPrms13f2[i], procFaceOffset);
|
Prms13f2Ave[i] =
|
||||||
|
surfaceAverage(surfPrms13f2[i], procFaceOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
graph PSD13g
|
graph PSD13g
|
||||||
@ -694,6 +725,7 @@ void surfaceNoise::calculate()
|
|||||||
SPL13g.write(outDir, graph::wordify(SPL13g.title()), graphFormat_);
|
SPL13g.write(outDir, graph::wordify(SPL13g.title()), graphFormat_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -53,7 +53,7 @@ Description
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Input file
|
// Input file
|
||||||
inputFile "postProcessing/faceSource1/surface/patch/patch.case";
|
inputFiles ("postProcessing/faceSource1/surface/patch/patch.case");
|
||||||
|
|
||||||
// Write interval for FFT data, default = 1
|
// Write interval for FFT data, default = 1
|
||||||
fftWriteInterval 100;
|
fftWriteInterval 100;
|
||||||
@ -83,8 +83,8 @@ SeeAlso
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef surfaceNoise_H
|
#ifndef noiseModels_surfaceNoise_H
|
||||||
#define surfaceNoise_H
|
#define noiseModels_surfaceNoise_H
|
||||||
|
|
||||||
#include "noiseModel.H"
|
#include "noiseModel.H"
|
||||||
#include "labelList.H"
|
#include "labelList.H"
|
||||||
@ -115,8 +115,11 @@ protected:
|
|||||||
|
|
||||||
// Protected Data
|
// Protected Data
|
||||||
|
|
||||||
//- Input file name
|
//- Input file names
|
||||||
fileName inputFileName_;
|
List<fileName> inputFileNames_;
|
||||||
|
|
||||||
|
//- Name of pressure field
|
||||||
|
word pName_;
|
||||||
|
|
||||||
//- Index of pressure field in reader field list
|
//- Index of pressure field in reader field list
|
||||||
label pIndex_;
|
label pIndex_;
|
||||||
@ -138,17 +141,20 @@ protected:
|
|||||||
// result in a very large number of output files (1 per frequency)
|
// result in a very large number of output files (1 per frequency)
|
||||||
label fftWriteInterval_;
|
label fftWriteInterval_;
|
||||||
|
|
||||||
|
//- Reader type
|
||||||
|
word readerType_;
|
||||||
|
|
||||||
//- Pointer to the surface reader
|
//- Pointer to the surface reader
|
||||||
mutable autoPtr<surfaceReader> readerPtr_;
|
mutable autoPtr<surfaceReader> readerPtr_;
|
||||||
|
|
||||||
//- Pointer to the surface writer
|
//- Pointer to the surface writer
|
||||||
autoPtr<surfaceWriter> writerPtr_;
|
mutable autoPtr<surfaceWriter> writerPtr_;
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Initialise
|
//- Initialise
|
||||||
void initialise(const dictionary& dict);
|
void initialise(const fileName& fName);
|
||||||
|
|
||||||
//- Read surface data
|
//- Read surface data
|
||||||
void readSurfaceData
|
void readSurfaceData
|
||||||
@ -183,7 +189,7 @@ public:
|
|||||||
TypeName("surfaceNoise");
|
TypeName("surfaceNoise");
|
||||||
|
|
||||||
//- Constructor
|
//- Constructor
|
||||||
surfaceNoise(const dictionary& dict);
|
surfaceNoise(const dictionary& dict, const bool readFields = true);
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~surfaceNoise();
|
virtual ~surfaceNoise();
|
||||||
@ -191,6 +197,9 @@ public:
|
|||||||
|
|
||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
|
//- Read from dictionary
|
||||||
|
virtual bool read(const dictionary& dict);
|
||||||
|
|
||||||
//- Calculate
|
//- Calculate
|
||||||
virtual void calculate();
|
virtual void calculate();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user