51 Info<<
"Reading data file " << fName <<
endl;
53 label nAvailableTimes = 0;
67 <<
"Unable to find pressure field name " <<
pName_
68 <<
" in list of available fields: " << fieldNames
136 Info <<
"Reading pressure data" <<
endl;
150 const label nLocalFace =
151 procFaceOffset[myProcI + 1] - procFaceOffset[myProcI];
181 label face0 = procFaceOffset[procI];
183 procFaceOffset[procI + 1] - procFaceOffset[procI];
186 toProc << SubList<scalar>(
p, nLocalFace, face0);
198 pData[faceI][i] = pSlice[faceI];
204 pData[faceI] -=
average(pData[faceI]);
209 const label nLocalFace = procFaceOffset[0];
229 pData[faceI][i] =
p[faceI];
235 pData[faceI] -=
average(pData[faceI]);
241 <<
" pressure traces with "
243 <<
" time values" <<
nl <<
endl;
255 const bool writeSurface
258 Info<<
" processing " << title <<
" for frequency " << freq <<
endl;
276 scalar areaAverage = 0;
287 allData[faceI] =
data[faceI];
296 label faceI = procFaceOffset[procI] + i;
297 allData[faceI] = dataSlice[i];
310 (outDirBase / fName),
327 areaAverage =
sum(allData)/(allData.
size() + ROOTVSMALL);
348 (outDirBase / fName),
391 scalar areaAverage = 0;
402 allData[faceI] =
data[faceI];
411 label faceI = procFaceOffset[procI] + i;
412 allData[faceI] = dataSlice[i];
422 areaAverage =
sum(allData)/allData.
size();
455 fftWriteInterval_(1),
457 readerType_(
word::null),
490 Info<<
" Averaging: area weighted" <<
endl;
494 Info<<
" Averaging: ensemble" <<
endl;
541 const label nFacePerProc = floor(
nFace_/nProcs) + 1;
543 procFaceOffset.
setSize(nProcs + 1, 0);
544 for (label i = 1; i < procFaceOffset.
size(); ++i)
546 procFaceOffset[i] =
min(i*nFacePerProc,
nFace_);
560 Info<<
"Creating noise FFTs" <<
endl;
569 const label nLocalFace = pData.
size();
576 surfPrmsf[freqI].
setSize(nLocalFace);
577 surfPSDf[freqI].
setSize(nLocalFace);
594 if (octave13BandIDs.
empty())
597 <<
"Octave band calculation failed (zero sized). "
598 <<
"Please check your input data"
603 bandSize = octave13BandIDs.
size() - 1;
607 forAll(surfPrms13f, freqI)
609 surfPrms13f[freqI].
setSize(nLocalFace);
627 surfPrmsf[i][faceI] = Prmsf[freqI];
628 surfPSDf[i][faceI] =
PSDf[freqI];
643 forAll(surfPrms13f, freqI)
645 surfPrms13f[freqI][faceI] = Prms13f[freqI];
656 Info<<
"Writing fft surface data";
675 label nFreq = f1 - f0;
684 <<
"No surface data available using a fftWriteInterval of "
692 fOut[i] = freq1[freqI];
722 PSD(surfPSDf[i + f0]),
732 SPL(surfPSDf[i + f0]*deltaf, freq1[freqI]),
773 "Average PSD_dB_Hz(f)",
792 SPL(PSDfAve*deltaf, fOut)
804 Info<<
"Writing one-third octave surface data" <<
endl;
806 fileName outDir(outDirBase/
"oneThirdOctave");
818 octave13FreqCentre[i],
819 SPL(surfPrms13f[i], octave13FreqCentre[i]),
832 "Average SPL13_dB(fm)",
836 SPL(Prms13fAve, octave13FreqCentre)
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(const label n)
Alias for resize()
void resize(const label len)
Adjust allocated size of list.
const scalarField & magSf() const
Face area magnitudes.
label size() const
The surface size is the number of faces.
const List< Face > & surfFaces() const
Return const access to the faces.
const Field< point_type > & points() const noexcept
Return reference to global points.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
UPstream::rangeType allProcs() const noexcept
Range of ranks indices associated with PstreamBuffers.
label nProcs() const noexcept
Number of ranks associated with PstreamBuffers.
void finishedScatters(const bool wait=true)
Mark all sends to sub-procs as done.
void clear()
Clear individual buffers and reset states.
void finishedGathers(const bool wait=true)
Mark all sends to master as done.
UPstream::rangeType subProcs() const noexcept
Range of sub-processes indices associated with PstreamBuffers.
static void broadcast(Type &value, const label comm=UPstream::worldComm)
static void broadcasts(const label comm, Type &arg1, Args &&... args)
Broadcast multiple items to all processes in communicator.
virtual bool read()
Re-read model coefficients if they have changed.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
T & first()
Return the first element of the list.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
void size(const label n)
Older name for setAddressableSize.
@ nonBlocking
"nonBlocking"
static constexpr int masterNo() noexcept
Process index of the master (always 0)
static label worldComm
Default communicator (all processors)
static bool & parRun() noexcept
Test if this a parallel run.
static fileName envGlobalPath()
Global case (directory) from environment variable.
Database for solution data, solver performance and other reduced data.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
dictionary subOrEmptyDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX, const bool mandatory=false) const
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
A class for handling file names.
static std::string nameLessExt(const std::string &str)
Return basename, without extension.
static bool isAbsolute(const std::string &str)
Class to create, store and output qgraph files.
const string & title() const
void write(Ostream &, const word &format) const
Write graph to stream in given format.
static word wordify(const string &sname)
Helper function to convert string name into appropriate word.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
Base class for noise models.
tmp< scalarField > uniformFrequencies(const scalar deltaT, const bool check) const
label findStartTimeIndex(const instantList &allTimes, const scalar startTime) const
Find and return start time index.
scalar rhoRef_
Reference density (to convert from kinematic to static pressure)
tmp< scalarField > octaves(const scalarField &data, const scalarField &f, const labelUList &freqBandIDs) const
Generate octave data.
tmp< scalarField > RMSmeanPf(const scalarField &p) const
scalar fUpper_
Upper frequency limit, default = 10kHz.
tmp< Foam::scalarField > PSD(const scalarField &PSDf) const
PSD [dB/Hz].
bool writePSD_
Write PSD; default = yes.
word graphFormat_
Graph format.
static void setOctaveBands(const scalarField &f, const scalar fLower, const scalar fUpper, const scalar octave, labelList &fBandIDs, scalarField &fCentre)
fileName baseFileDir(const label dataseti) const
Return the base output directory.
bool writeOctaves_
Write writeOctaves; default = yes.
tmp< scalarField > SPL(const scalarField &Prms2, const scalar f) const
SPL [dB].
autoPtr< windowModel > windowModelPtr_
Window model.
bool writeSPL_
Write SPL; default = yes.
bool writePrmsf_
Write Prmsf; default = yes.
scalar checkUniformTimeStep(const scalarList ×) const
Check and return uniform time step.
bool writePSDf_
Write PSDf; default = yes.
tmp< scalarField > PSDf(const scalarField &p, const scalar deltaT) const
scalar startTime_
Start time, default = 0s.
scalar fLower_
Lower frequency limit, default = 25Hz.
Perform noise analysis on surface-based pressure data.
scalarList times_
Sample times.
scalar surfaceAverage(const scalarField &data, const labelList &procFaceOffset) const
Calculate the area average value.
word pName_
Name of pressure field.
void initialise(const fileName &fName)
Initialise.
scalar deltaT_
Time step (constant)
label nFace_
Number of surface faces.
virtual bool read(const dictionary &dict)
Read from dictionary.
List< fileName > inputFileNames_
Input file names.
autoPtr< surfaceWriter > writerPtr_
Pointer to the surface writer.
word readerType_
Reader type.
label startTimeIndex_
Start time index.
label fftWriteInterval_
Frequency data output interval, default = 1.
scalar writeSurfaceData(const fileName &outDirBase, const word &fName, const word &title, const scalar freq, const scalarField &data, const labelList &procFaceOffset, const bool writeSurface) const
Write surface data to file.
autoPtr< surfaceReader > readerPtr_
Pointer to the surface reader.
label pIndex_
Index of pressure field in reader field list.
void readSurfaceData(const labelList &procFaceOffset, List< scalarField > &pData)
Read surface data.
virtual void calculate()
Calculate.
int myProcNo() const noexcept
Return processor number.
splitCell * master() const
string & expand(const bool allowEmpty=false)
void initialise()
Initialise integral-scale box properties.
Base class for windowing models.
label nSamples() const
Return the number of samples in the window.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
messageStream Info
Information stream (stdout output on master, null elsewhere)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
static constexpr const zero Zero
Global zero (0)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.