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_));
85 const dictionary&
dict,
86 const label tZeroBufferSize
89 bufferedAccumulator<scalar>(),
91 duration_(
dict.
get<scalar>(
"duration")),
92 sampleInterval_(
dict.
get<scalar>(
"sampleInterval")),
93 averagingInterval_(
dict.
get<scalar>(
"averagingInterval"))
95 setTimesAndSizes(tZeroBufferSize);
102 const polyMesh&
mesh,
103 const label tZeroBufferSize,
104 const scalar duration,
105 const scalar sampleInterval,
106 const scalar averagingInterval
109 bufferedAccumulator<scalar>(),
112 sampleInterval_(sampleInterval),
113 averagingInterval_(averagingInterval)
115 setTimesAndSizes(tZeroBufferSize);
131 const Field<Type>& currentValues
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]);