36 const word& meanFieldName =
faItems_[fieldi].meanFieldName();
38 Log <<
" Reading/initialising field " << meanFieldName <<
endl;
44 Log <<
" Cannot allocate average field " << meanFieldName
45 <<
" since an object with that name already exists." 46 <<
" Disabling averaging for field." <<
endl;
84 typedef typename VolFieldType::Internal InternalType;
93 addMeanFieldType<VolFieldType>(fieldi);
97 addMeanFieldType<InternalType>(fieldi);
101 addMeanFieldType<SurfaceFieldType>(fieldi);
107 template<
class Type1,
class Type2>
114 const word& meanFieldName =
faItems_[fieldi].meanFieldName();
115 const word& prime2MeanFieldName =
faItems_[fieldi].prime2MeanFieldName();
117 Log <<
" Reading/initialising field " << prime2MeanFieldName <<
nl;
121 else if (
obr_.
found(prime2MeanFieldName))
123 Log <<
" Cannot allocate average field " << prime2MeanFieldName
124 <<
" since an object with that name already exists." 125 <<
" Disabling averaging for field." <<
nl;
127 faItems_[fieldi].prime2Mean() =
false;
149 sqr(baseField) -
sqr(meanField)
156 template<
class Type1,
class Type2>
160 typedef typename VolFieldType1::Internal InternalType1;
164 typedef typename VolFieldType2::Internal InternalType2;
174 <<
"To calculate the prime-squared average, the " 175 <<
"mean average must also be selected for field " 181 addPrime2MeanFieldType<VolFieldType1, VolFieldType2>(fieldi);
185 addPrime2MeanFieldType<InternalType1, InternalType2>(fieldi);
189 addPrime2MeanFieldType<SurfaceFieldType1, SurfaceFieldType2>
226 const scalar w =
window();
234 meanField = (1 - beta)*meanField + beta*baseField;
243 typedef typename VolFieldType::Internal InternalType;
254 calculateMeanFieldType<VolFieldType>(fieldi);
258 calculateMeanFieldType<InternalType>(fieldi);
262 calculateMeanFieldType<SurfaceFieldType>(fieldi);
269 template<
class Type1,
class Type2>
278 const Type1& meanField =
281 Type2& prime2MeanField =
297 const scalar w =
window();
306 (1 - beta)*prime2MeanField
307 + beta*
sqr(baseField)
312 template<
class Type1,
class Type2>
316 typedef typename VolFieldType1::Internal InternalType1;
320 typedef typename VolFieldType2::Internal InternalType2;
331 calculatePrime2MeanFieldType<VolFieldType1, VolFieldType2>
338 calculatePrime2MeanFieldType<InternalType1, InternalType2>
356 template<
class Type1,
class Type2>
362 const Type1& meanField =
365 Type2& prime2MeanField =
368 prime2MeanField +=
sqr(meanField);
372 template<
class Type1,
class Type2>
376 typedef typename VolFieldType1::Internal InternalType1;
380 typedef typename VolFieldType2::Internal InternalType2;
391 addMeanSqrToPrime2MeanType<VolFieldType1, VolFieldType2>
398 addMeanSqrToPrime2MeanType<InternalType1, InternalType2>
405 addMeanSqrToPrime2MeanType<SurfaceFieldType1, SurfaceFieldType2>
418 const word& fieldName
433 typedef typename VolFieldType::Internal InternalType;
440 const word& fieldName =
faItems_[fieldi].meanFieldName();
441 writeFieldType<VolFieldType>(fieldName);
442 writeFieldType<InternalType>(fieldName);
443 writeFieldType<SurfaceFieldType>(fieldName);
447 const word& fieldName =
faItems_[fieldi].prime2MeanFieldName();
448 writeFieldType<VolFieldType>(fieldName);
449 writeFieldType<InternalType>(fieldName);
450 writeFieldType<SurfaceFieldType>(fieldName);
void addPrime2MeanFieldType(const label fieldi)
Add prime-squared average field to database.
void addMeanField(const label fieldi)
Add mean average field to database.
void addMeanSqrToPrime2MeanType(const label fieldi) const
Add mean-squared field value to prime-squared mean field.
#define forAll(list, i)
Loop across all elements in list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
PtrList< fieldAverageItem > faItems_
List of field average items, describing what averages to be.
List< scalar > totalTime_
Total time counter.
virtual dimensionedScalar startTime() const
Return start time.
Type & lookupObjectRef(const word &name) const
Lookup and return the object reference of the given Type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool foundObject(const word &name) const
Is the named Type found?
void calculatePrime2MeanFieldType(const label fieldi) const
Calculate prime-squared average fields.
void addMeanFieldType(const label fieldi)
Add mean average field to database.
Generic GeometricField class.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
void calculateMeanFieldType(const label fieldi) const
Calculate mean average fields.
void calculatePrime2MeanFields() const
Calculate prime-squared average fields.
void writeFields() const
Write fields.
Switch restartOnOutput_
Restart the averaging process on output.
List< label > totalIter_
Iteration steps counter.
void writeFieldType(const word &fieldName) const
Write fields.
bool found(const Key &) const
Return true if hashedEntry is found in table.
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
A class for handling words, derived from string.
scalar deltaTValue() const
Return time step value.
const Type & value() const
Return const reference to value.
void calculateMeanFields() const
Calculate mean average fields.
void store()
Transfer ownership of this object to its registry.
const Time & time() const
Return time.
void addPrime2MeanField(const label fieldi)
Add prime-squared average field to database.
const objectRegistry & obr_
Reference to the region objectRegistry.
#define Log
Report write to Foam::Info if the local log switch is true.
Switch iterBase() const
Return true if base is iter.
void addMeanSqrToPrime2Mean() const
Add mean-squared field value to prime-squared mean field.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...