31template<
class Type,
class Type2>
41 const word valueType =
51 const Type2 currentValue =
55 const word meanName(fieldName +
"Mean");
63 const scalar
beta = dt/Dt;
64 meanValue = (1 -
beta)*meanValue +
beta*currentValue;
81 meanValue = (1 -
beta)*meanValue +
beta*currentValue;
94 for (scalar& dti : windowTimes)
100 bool removeValue =
true;
101 while (removeValue && windowTimes.size())
113 windowTimes.
push(dt);
114 windowValues.
push(currentValue);
117 auto timeIter = windowTimes.
cbegin();
118 auto valueIter = windowValues.
cbegin();
127 ++i, ++timeIter, ++valueIter
130 const Type2& value = valueIter();
131 const scalar dt = timeIter();
133 meanValue += dt*value;
137 meanValue -= dt*valueOld;
143 meanValue /= windowTimes.
first();
146 fieldDict.
set(
"windowTimes", windowTimes);
147 fieldDict.
set(
"windowValues", windowValues);
153 scalar
delta =
mag(meanValue - currentValue);
155 Log <<
indent <<
" " << meanName <<
": " << meanValue
A FIFO stack based on a singly-linked list.
void push(const T &elem)
Push an element onto the back of the stack.
T pop()
Pop the bottom element off the stack.
const_iterator cbegin() const
Iterator to first item in list with const access.
reference first()
The first entry in the list.
scalar deltaTValue() const noexcept
Return time step value.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
Computes the magnitude of an input field.
void setResult(const word &entryName, const Type &value)
Add result.
word objectResultType(const word &objectName, const word &entryName) const
Return the type of result.
Type getResult(const word &entryName, const Type &defaultValue=Type(Zero)) const
Retrieve result.
Type getObjectResult(const word &objectName, const word &entryName, const Type &defaultValue=Type(Zero)) const
Retrieve result from named object.
const Time & time() const
Return time database.
word functionObjectName_
Name of function object to retrieve data from.
@ APPROXIMATE
"approximate"
scalar tolerance_
Optional tolerance to check for converged results.
wordList fieldNames_
List of fields on which to operate.
List< scalar > totalTime_
Average time per field.
bool calc(const label fieldi, bool &converged, dictionary &dict)
Templated function to calculate the average.
scalar window_
Averaging window.
stateFunctionObject & state_
Reference to the state functionObject.
windowType windowType_
Window type.
virtual OFstream & file()
Return access to the file (if only 1)
A traits class, which is primarily used for primitives.
A class for handling words, derived from Foam::string.
Ostream & indent(Ostream &os)
Indent stream.
constexpr char nl
The newline '\n' character (0x0a)
constexpr char tab
The tab '\t' character(0x09)
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
A non-counting (dummy) refCount.