Go to the documentation of this file.
45 if (!foundObject<Type>(fieldName))
55 Log <<
" Reading/initialising field " << meanFieldName <<
endl;
57 if (foundObject<Type>(meanFieldName))
59 else if (obr().
found(meanFieldName))
61 Log <<
" Cannot allocate average field " << meanFieldName
62 <<
" since an object with that name already exists."
63 <<
" Disabling averaging for field." <<
endl;
69 const Type& baseField = lookupObject<Type>(fieldName);
84 : IOobject::READ_IF_PRESENT
107 addMeanFieldType<VolFieldType>(item);
108 addMeanFieldType<SurfaceFieldType>(item);
109 addMeanFieldType<SurfFieldType>(item);
120 if (restartOnOutput_)
127 const Type* fieldPtr = findObject<Type>(fieldName);
152 obr().store(
new Type(io, fieldPtr->mesh()));
157 <<
"Unable to read window " << Type::typeName <<
" " <<
name
158 <<
". Averaging restart behaviour may be compromised"
177 restoreWindowFieldsType<VolFieldType>(item);
178 restoreWindowFieldsType<SurfaceFieldType>(item);
179 restoreWindowFieldsType<SurfFieldType>(item);
184 template<
class Type1,
class Type2>
192 if (!foundObject<Type1>(fieldName))
200 Log <<
" Reading/initialising field " << prime2MeanFieldName <<
nl;
202 if (foundObject<Type2>(prime2MeanFieldName))
204 else if (obr().
found(prime2MeanFieldName))
206 Log <<
" Cannot allocate average field " << prime2MeanFieldName
207 <<
" since an object with that name already exists."
208 <<
" Disabling averaging for field." <<
endl;
214 const Type1& baseField = lookupObject<Type1>(fieldName);
215 const Type1& meanField = lookupObject<Type1>(meanFieldName);
229 : IOobject::READ_IF_PRESENT,
232 sqr(baseField) -
sqr(meanField)
239 template<
class Type1,
class Type2>
258 <<
"To calculate the prime-squared average, the "
259 <<
"mean average must also be selected for field "
263 addPrime2MeanFieldType<VolFieldType1, VolFieldType2>(item);
264 addPrime2MeanFieldType<SurfaceFieldType1, SurfaceFieldType2>(item);
265 addPrime2MeanFieldType<SurfFieldType1, SurfFieldType2>(item);
277 if (!foundObject<Type>(fieldName))
282 const Type& baseField = lookupObject<Type>(fieldName);
298 : IOobject::READ_IF_PRESENT,
305 DebugInfo <<
"Create and store: " << windowFieldName <<
endl;
307 item.
addToWindow(windowFieldName, obr().time().deltaTValue());
322 storeWindowFieldType<VolFieldType>(item);
323 storeWindowFieldType<SurfaceFieldType>(item);
324 storeWindowFieldType<SurfFieldType>(item);
346 template<
class Type1,
class Type2>
369 template<
class Type1,
class Type2>
377 if (!foundObject<Type1>(fieldName))
382 const Type1& meanField = lookupObject<Type1>(item.
meanFieldName());
386 prime2MeanField +=
sqr(meanField);
390 template<
class Type1,
class Type2>
405 addMeanSqrToPrime2MeanType<VolFieldType1, VolFieldType2>(item);
406 addMeanSqrToPrime2MeanType<SurfaceFieldType1, SurfaceFieldType2>
410 addMeanSqrToPrime2MeanType<SurfFieldType1, SurfFieldType2>(item);
419 const word& fieldName
422 if (foundObject<Type>(fieldName))
424 const Type&
f = lookupObject<Type>(fieldName);
442 writeFieldType<VolFieldType>(fieldName);
443 writeFieldType<SurfaceFieldType>(fieldName);
444 writeFieldType<SurfFieldType>(fieldName);
450 writeFieldType<VolFieldType>(fieldName);
451 writeFieldType<SurfaceFieldType>(fieldName);
452 writeFieldType<SurfFieldType>(fieldName);
460 const word& fieldName = fieldNameIter();
461 writeFieldType<VolFieldType>(fieldName);
462 writeFieldType<SurfaceFieldType>(fieldName);
463 writeFieldType<SurfFieldType>(fieldName);
void addPrime2MeanFieldType(fieldAverageItem &item)
Add prime-squared average field to database.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
bool calculatePrime2MeanField(const objectRegistry &obr) const
Calculate prime-squared average fields.
void calculateMeanFields() const
Calculate mean average fields.
A class for handling words, derived from Foam::string.
void restoreWindowFieldsType(const fieldAverageItem &item)
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (uses typeFilePath to find file) and check its info.
void storeWindowFieldType(fieldAverageItem &item)
bool writeWindowFields() const
Return true if we wish to write window fields.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void addMeanSqrToPrime2MeanType(const fieldAverageItem &item) const
Add mean-squared field value to prime-squared mean field.
void writeFieldType(const word &fieldName) const
Write fields.
void calculatePrime2MeanFields() const
Calculate prime-squared average fields.
const word & fieldName() const
Return const access to the field name.
bool storeWindowFields() const
Return true if we wish to store window fields.
void addToWindow(const word &fieldName, const scalar deltaT)
Add field to window.
const word & meanFieldName() const
Return const access to the mean field name.
void addPrime2MeanField(fieldAverageItem &item)
Add prime-squared average field to database.
void addMeanSqrToPrime2Mean() const
Add mean-squared field value to prime-squared mean field.
word name(const complex &c)
Return string representation of complex.
void writeFields() const
Write fields.
bool mean() const
Return const access to the mean flag.
void addMeanField(fieldAverageItem &item)
Add mean average field to database.
bool active() const
Return const access to the active flag.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Helper class to describe what form of averaging to apply. A set will be applied to each base field in...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
#define DebugInfo
Report an information message using Foam::Info.
void restoreWindowFields(const fieldAverageItem &item)
forAllConstIters(mixture.phases(), phase)
bool prime2Mean() const
Return const access to the prime-squared mean flag.
scalar window() const
Return the window length (iterations or seconds)
void addMeanFieldType(fieldAverageItem &item)
Add mean average field to database.
const word & prime2MeanFieldName() const
Return const access to the prime-squared mean field name.
bool calculateMeanField(const objectRegistry &obr) const
Calculate the mean field value.
const FIFOStack< word > & windowFieldNames() const
Return the list of window field names (windowType = EXACT)
A FIFO stack based on a singly-linked list.
List< fieldAverageItem > faItems_
List of field average items, describing what averages to be.
#define WarningInFunction
Report a warning using Foam::Warning.
word windowFieldName(const word &prefix) const
Helper function to construct a window field name.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...