42 const label tZeroBufferSize
45 sampleSteps_ = ceil(sampleInterval_/mesh_.time().deltaTValue());
47 sampleInterval_ = sampleSteps_*mesh_.time().deltaTValue();
49 label bufferLength(ceil(duration_/sampleInterval_));
51 duration_ = bufferLength*sampleInterval_;
53 label bufferingInterval(ceil(averagingInterval_/sampleInterval_));
55 averagingInterval_ = bufferingInterval*sampleInterval_;
57 label nBuffers(ceil(duration_/averagingInterval_));
86 const label tZeroBufferSize
91 duration_(
dict.
get<scalar>(
"duration")),
92 sampleInterval_(
dict.
get<scalar>(
"sampleInterval")),
93 averagingInterval_(
dict.
get<scalar>(
"averagingInterval"))
95 setTimesAndSizes(tZeroBufferSize);
103 const label tZeroBufferSize,
104 const scalar duration,
105 const scalar sampleInterval,
106 const scalar averagingInterval
112 sampleInterval_(sampleInterval),
113 averagingInterval_(averagingInterval)
115 setTimesAndSizes(tZeroBufferSize);
134 if (measurandFieldSize() != currentValues.
size())
137 <<
"Trying to supply a Field of length" 138 << currentValues.
size()
139 <<
" to calculate the correlation function. " 140 <<
"Expecting a Field of length " 141 << measurandFieldSize() <<
nl 145 List<scalar> cFSums(nBuffers(),
Zero);
147 forAll(tZeroBuffers_, tZB)
149 scalar& cFSum = cFSums[tZB];
151 const Field<Type>& tZeroBuffer = tZeroBuffers_[tZB];
155 const Type& tZeroBufferValue = tZeroBuffer[cV];
157 const Type& currentValue = currentValues[cV];
168 cFSum /= (measurandFieldSize()*currentValues[0].
size());
171 label bufferToRefill = addToBuffers(cFSums);
173 if (bufferToRefill != -1)
175 tZeroBuffers_[bufferToRefill] = currentValues;
183 const Type& currentValue
186 if (measurandFieldSize() != 1)
189 <<
"Trying to supply a single value to calculate the correlation " 190 <<
"function. Expecting a Field of length " 191 << measurandFieldSize()
195 calculateCorrelationFunction(
Field<Type>(1, currentValue));
202 Field<scalar> averageCF(averaged());
204 scalar cFIntegral = 0.0;
206 for (label v = 0; v < averageCF.size() - 1; v++)
211 *(averageCF[v+1] + averageCF[v]);
~correlationFunction()
Destructor.
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
void size(const label n)
Older name for setAddressableSize.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
void calculateCorrelationFunction(const Field< Type > &)
#define forAll(list, i)
Loop across all elements in list.
Generic templated field type.
errorManip< error > abort(error &err)
static const char *const typeName
Mesh consisting of general polyhedral cells.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
static constexpr const zero Zero
Global zero (0)