Calculates average quantities for a user-specified selection of volumetric and surface fields. More...
Public Types | |
enum | baseType { iter, time } |
Enumeration defining the averaging base type. More... | |
Public Member Functions | |
TypeName ("fieldAverage") | |
Runtime type information. More... | |
fieldAverage (const word &name, const Time &runTime, const dictionary &) | |
Construct from Time and dictionary. More... | |
fieldAverage (const fieldAverage &)=delete | |
Disallow default bitwise copy construction. More... | |
virtual | ~fieldAverage () |
Destructor. More... | |
const word | base () const |
Return averaging base type name. More... | |
Switch | iterBase () const |
Return true if base is iter. More... | |
Switch | timeBase () const |
Return true if base is time. More... | |
scalar | window () const |
const word & | windowName () const |
virtual bool | read (const dictionary &) |
Read the field average data. More... | |
virtual wordList | fields () const |
Return the list of fields required. More... | |
virtual bool | executeAtStart () const |
Do not average at the start of the run. More... | |
virtual bool | execute () |
Calculate the field averages. More... | |
virtual bool | write () |
Write the field averages. More... | |
void | operator= (const fieldAverage &)=delete |
Disallow default bitwise assignment. More... | |
Public Member Functions inherited from fvMeshFunctionObject | |
TypeName ("fvMeshFunctionObject") | |
Runtime type information. More... | |
fvMeshFunctionObject (const word &name, const Time &runTime, const dictionary &dict) | |
Construct from Time and dictionary. More... | |
fvMeshFunctionObject (const word &name, const objectRegistry &obr, const dictionary &dict) | |
Construct from the region objectRegistry and dictionary. More... | |
fvMeshFunctionObject (const fvMeshFunctionObject &)=delete | |
Disallow default bitwise copy construction. More... | |
virtual | ~fvMeshFunctionObject () |
Destructor. More... | |
void | operator= (const fvMeshFunctionObject &)=delete |
Disallow default bitwise assignment. More... | |
Public Member Functions inherited from regionFunctionObject | |
TypeName ("regionFunctionObject") | |
Runtime type information. More... | |
regionFunctionObject (const word &name, const Time &runTime, const dictionary &dict) | |
Construct from Time and dictionary. More... | |
regionFunctionObject (const word &name, const objectRegistry &obr, const dictionary &dict) | |
Construct from the region objectRegistry and dictionary. More... | |
regionFunctionObject (const regionFunctionObject &)=delete | |
Disallow default bitwise copy construction. More... | |
virtual | ~regionFunctionObject () |
Destructor. More... | |
void | operator= (const regionFunctionObject &)=delete |
Disallow default bitwise assignment. More... | |
Public Member Functions inherited from functionObject | |
ClassName ("functionObject") | |
virtual const word & | type () const =0 |
Runtime type information. More... | |
declareRunTimeSelectionTable (autoPtr, functionObject, dictionary,(const word &name, const Time &runTime, const dictionary &dict),(name, runTime, dict)) | |
functionObject (const word &name) | |
Construct from components. More... | |
autoPtr< functionObject > | clone () const |
Return clone. More... | |
functionObject (const functionObject &)=delete | |
Disallow default bitwise copy construction. More... | |
virtual | ~functionObject () |
Destructor. More... | |
const word & | name () const |
Return the name of this functionObject. More... | |
virtual bool | end () |
Called when Time::run() determines that the time-loop exits. More... | |
virtual scalar | timeToNextWrite () |
Called by Time::adjustTimeStep(). Allows the functionObject to. More... | |
virtual void | movePoints (const polyMesh &mesh) |
Update topology using the given map. More... | |
virtual void | topoChange (const polyTopoChangeMap &map) |
Update topology using the given map. More... | |
virtual void | mapMesh (const polyMeshMap &) |
Update from another mesh using the given map. More... | |
void | operator= (const functionObject &)=delete |
Disallow default bitwise assignment. More... | |
Protected Member Functions | |
void | resetFields () |
Checkout fields (causes deletion) from the database. More... | |
void | initialise () |
Reset lists (clear existing values) and initialise averaging. More... | |
void | restart () |
Restart averaging for restartOnOutput. More... | |
template<class Type > | |
void | addMeanFieldType (const label fieldi) |
Add mean average field to database. More... | |
template<class Type > | |
void | addMeanField (const label fieldi) |
Add mean average field to database. More... | |
template<class Type1 , class Type2 > | |
void | addPrime2MeanFieldType (const label fieldi) |
Add prime-squared average field to database. More... | |
template<class Type1 , class Type2 > | |
void | addPrime2MeanField (const label fieldi) |
Add prime-squared average field to database. More... | |
virtual void | calcAverages () |
Main calculation routine. More... | |
template<class Type > | |
void | calculateMeanFieldType (const label fieldi) const |
Calculate mean average fields. More... | |
template<class Type > | |
void | calculateMeanFields () const |
Calculate mean average fields. More... | |
template<class Type1 , class Type2 > | |
void | calculatePrime2MeanFieldType (const label fieldi) const |
Calculate prime-squared average fields. More... | |
template<class Type1 , class Type2 > | |
void | calculatePrime2MeanFields () const |
Calculate prime-squared average fields. More... | |
template<class Type1 , class Type2 > | |
void | addMeanSqrToPrime2MeanType (const label fieldi) const |
Add mean-squared field value to prime-squared mean field. More... | |
template<class Type1 , class Type2 > | |
void | addMeanSqrToPrime2Mean () const |
Add mean-squared field value to prime-squared mean field. More... | |
virtual void | writeAverages () const |
Write averages. More... | |
template<class Type > | |
void | writeFieldType (const word &fieldName) const |
Write fields. More... | |
template<class Type > | |
void | writeFields () const |
Write fields. More... | |
void | writeAveragingProperties () const |
Write averaging properties - steps and time. More... | |
void | readAveragingProperties () |
Read averaging properties - steps and time. More... | |
Protected Member Functions inherited from regionFunctionObject | |
template<class ObjectType > | |
bool | foundObject (const word &fieldName) const |
Find field in the objectRegistry. More... | |
template<class ObjectType > | |
void | cannotFindObject (const word &fieldName) |
Prints a warning message that fieldName cannot be found. More... | |
void | cannotFindObject (const word &fieldName) |
Prints a warning message that fieldName cannot be found. More... | |
template<class ObjectType > | |
const ObjectType & | lookupObject (const word &fieldName) const |
Lookup object from the objectRegistry. More... | |
template<class ObjectType > | |
ObjectType & | lookupObjectRef (const word &fieldName) |
Lookup non-const object reference from the objectRegistry. More... | |
template<class ObjectType > | |
bool | store (const tmp< ObjectType > &tfield) |
Store the given field in the objectRegistry. More... | |
template<class ObjectType > | |
bool | store (const word &fieldName, const tmp< ObjectType > &tfield, bool cacheable=false) |
Store the given field in the objectRegistry under the given name. More... | |
bool | writeObject (const word &fieldName) |
Write field if present in objectRegistry. More... | |
bool | clearObject (const word &fieldName) |
Clear field from the objectRegistry if present. More... | |
Protected Attributes | |
label | prevTimeIndex_ |
Time at last call, prevents repeated averaging. More... | |
Switch | restartOnRestart_ |
Restart the averaging process on restart. More... | |
Switch | restartOnOutput_ |
Restart the averaging process on output. More... | |
Switch | periodicRestart_ |
Periodically restart the averaging process. More... | |
scalar | restartPeriod_ |
Restart period. More... | |
bool | initialised_ |
Initialised flag. More... | |
baseType | base_ |
Averaging base type. More... | |
scalar | window_ |
Averaging window - defaults to -1 for 'all iters/time'. More... | |
word | windowName_ |
Averaging window name - defaults to 'window'. More... | |
Switch | mean_ |
Compute mean flag. More... | |
Switch | prime2Mean_ |
Compute prime-squared mean flag. More... | |
PtrList< fieldAverageItem > | faItems_ |
List of field average items, describing what averages to be. More... | |
List< label > | totalIter_ |
Iteration steps counter. More... | |
List< scalar > | totalTime_ |
Total time counter. More... | |
label | periodIndex_ |
Index for periodic restart. More... | |
Protected Attributes inherited from fvMeshFunctionObject | |
const fvMesh & | mesh_ |
Reference to the fvMesh. More... | |
Protected Attributes inherited from regionFunctionObject | |
const Time & | time_ |
Reference to the Time. More... | |
const objectRegistry & | obr_ |
Reference to the region objectRegistry. More... | |
Static Protected Attributes | |
static const NamedEnum< baseType, 2 > | baseTypeNames_ |
Averaging base type names. More... | |
Friends | |
class | fieldAverageItem |
Additional Inherited Members | |
Static Public Member Functions inherited from functionObject | |
static autoPtr< functionObject > | New (const word &name, const Time &, const dictionary &) |
Select from dictionary, based on its "type" entry. More... | |
Public Attributes inherited from functionObject | |
Switch | log |
Switch write log to Info. More... | |
Switch | executeAtStart_ |
Switch write log to Info. More... | |
Static Public Attributes inherited from functionObject | |
static bool | postProcess |
Global post-processing mode switch. More... | |
Calculates average quantities for a user-specified selection of volumetric and surface fields.
Fields are entered as a list of sub-dictionaries, which indicate the type of averages to perform, and can be updated during the calculation. The current options include:
mean:
arithmetic meanprime2Mean:
prime-squared meanbase:
average over 'time', or 'iteration'window:
optional averaging window, specified in 'base' unitsAverage field names are constructed by concatenating the base field with the averaging type, e.g. when averaging field 'U', the resultant fields are:
UMean
UPrime2Mean
Information regarding the number of averaging steps, and total averaging time are written on a per-field basis to the "<functionObject
name>Properties"
dictionary, located in <time>/uniform
When restarting form a previous calculation, the averaging is continuous or may be restarted using the restartOnRestart
option.
The averaging process may be restarted after each calculation output time using the restartOnOutput
option or restarted periodically using the periodicRestart
option and setting restartPeriod
to the required averaging period.
Example of function object specification:
fieldAverage1 { type fieldAverage; libs ("libfieldFunctionObjects.so"); writeControl writeTime; restartOnRestart false; restartOnOutput false; periodicRestart false; restartPeriod 0.002; base time; window 10.0; windowName w1; mean yes; prime2Mean yes; fields (U p); }
Property | Description | Required | Default |
---|---|---|---|
type | type name: fieldAverage | yes | |
restartOnRestart | Restart the averaging on restart | no | no |
restartOnOutput | Restart the averaging on output | no | no |
periodicRestart | Periodically restart the averaging | no | no |
restartPeriod | Periodic restart period | conditional | |
fields | list of fields and averaging options | yes |
Note: To employ the prime2Mean
option, the mean
option must be selected.
Definition at line 160 of file fieldAverage.H.
|
strong |
Enumeration defining the averaging base type.
Enumerator | |
---|---|
iter | |
time |
Definition at line 168 of file fieldAverage.H.
fieldAverage | ( | const word & | name, |
const Time & | runTime, | ||
const dictionary & | dict | ||
) |
Construct from Time and dictionary.
Definition at line 297 of file fieldAverage.C.
References Foam::read().
Referenced by fieldAverage::readAveragingProperties().
|
delete |
Disallow default bitwise copy construction.
|
virtual |
Destructor.
Definition at line 324 of file fieldAverage.C.
|
protected |
Checkout fields (causes deletion) from the database.
and reset lists
Definition at line 59 of file fieldAverage.C.
References forAll.
|
protected |
Reset lists (clear existing values) and initialise averaging.
Check requested field averages are valid, populate field lists
Definition at line 82 of file fieldAverage.C.
References forAll.
|
protected |
Restart averaging for restartOnOutput.
Definition at line 131 of file fieldAverage.C.
References Foam::endl(), Log, and Foam::nl.
|
protected |
Add mean average field to database.
Definition at line 33 of file fieldAverageTemplates.C.
References Foam::endl(), fieldAverage::faItems_, HashTable< T, Key, Hash >::found(), objectRegistry::foundObject(), Log, objectRegistry::lookupObject(), IOobject::NO_READ, IOobject::NO_WRITE, regionFunctionObject::obr_, IOobject::READ_IF_PRESENT, fieldAverage::restartOnOutput_, Time::startTime(), regIOobject::store(), objectRegistry::time(), Time::timeName(), and dimensioned< Type >::value().
|
protected |
Add mean average field to database.
Definition at line 77 of file fieldAverageTemplates.C.
References fieldAverage::addPrime2MeanFieldType(), fieldAverage::faItems_, objectRegistry::foundObject(), and regionFunctionObject::obr_.
|
protected |
Add prime-squared average field to database.
Definition at line 109 of file fieldAverageTemplates.C.
References fieldAverage::faItems_, HashTable< T, Key, Hash >::found(), objectRegistry::foundObject(), Log, objectRegistry::lookupObject(), Foam::nl, IOobject::NO_READ, IOobject::NO_WRITE, regionFunctionObject::obr_, IOobject::READ_IF_PRESENT, fieldAverage::restartOnOutput_, Foam::sqr(), Time::startTime(), regIOobject::store(), objectRegistry::time(), Time::timeName(), and dimensioned< Type >::value().
Referenced by fieldAverage::addMeanField().
|
protected |
Add prime-squared average field to database.
Definition at line 157 of file fieldAverageTemplates.C.
References fieldAverage::calculateMeanFieldType(), Foam::exit(), fieldAverage::faItems_, Foam::FatalError, FatalErrorInFunction, objectRegistry::foundObject(), Foam::nl, and regionFunctionObject::obr_.
|
protectedvirtual |
Main calculation routine.
Definition at line 143 of file fieldAverage.C.
References Foam::endl(), forAll, Log, Foam::name(), Foam::nl, and Foam::type().
|
protected |
Calculate mean average fields.
Definition at line 200 of file fieldAverageTemplates.C.
References TimeState::deltaTValue(), fieldAverage::faItems_, objectRegistry::foundObject(), fieldAverage::iterBase(), objectRegistry::lookupObject(), objectRegistry::lookupObjectRef(), regionFunctionObject::obr_, objectRegistry::time(), fieldAverage::totalIter_, fieldAverage::totalTime_, and fieldAverage::window().
Referenced by fieldAverage::addPrime2MeanField().
|
protected |
Calculate mean average fields.
Definition at line 240 of file fieldAverageTemplates.C.
References fieldAverage::calculatePrime2MeanFieldType(), fieldAverage::faItems_, forAll, objectRegistry::foundObject(), and regionFunctionObject::obr_.
|
protected |
Calculate prime-squared average fields.
Definition at line 271 of file fieldAverageTemplates.C.
References TimeState::deltaTValue(), fieldAverage::faItems_, fieldAverage::iterBase(), objectRegistry::lookupObject(), objectRegistry::lookupObjectRef(), regionFunctionObject::obr_, Foam::sqr(), objectRegistry::time(), fieldAverage::totalIter_, fieldAverage::totalTime_, and fieldAverage::window().
Referenced by fieldAverage::calculateMeanFields(), and fieldAverage::calculatePrime2MeanFields().
|
protected |
Calculate prime-squared average fields.
Definition at line 313 of file fieldAverageTemplates.C.
References fieldAverage::addMeanSqrToPrime2MeanType(), fieldAverage::calculatePrime2MeanFieldType(), fieldAverage::faItems_, forAll, objectRegistry::foundObject(), and regionFunctionObject::obr_.
|
protected |
Add mean-squared field value to prime-squared mean field.
Definition at line 358 of file fieldAverageTemplates.C.
References fieldAverage::faItems_, objectRegistry::lookupObject(), objectRegistry::lookupObjectRef(), regionFunctionObject::obr_, and Foam::sqr().
Referenced by fieldAverage::calculatePrime2MeanFields().
|
protected |
Add mean-squared field value to prime-squared mean field.
Definition at line 373 of file fieldAverageTemplates.C.
References fieldAverage::faItems_, forAll, objectRegistry::foundObject(), regionFunctionObject::obr_, and fieldAverage::writeFieldType().
|
protectedvirtual |
Write averages.
Definition at line 193 of file fieldAverage.C.
References Foam::endl(), and Log.
|
protected |
Write fields.
Definition at line 417 of file fieldAverageTemplates.C.
References f(), objectRegistry::foundObject(), objectRegistry::lookupObject(), and regionFunctionObject::obr_.
Referenced by fieldAverage::addMeanSqrToPrime2Mean().
|
protected |
Write fields.
Definition at line 430 of file fieldAverageTemplates.C.
References fieldAverage::faItems_, and forAll.
|
protected |
Write averaging properties - steps and time.
Definition at line 207 of file fieldAverage.C.
References dictionary::add(), Foam::endl(), forAll, Log, Foam::name(), IOobject::NO_READ, IOobject::NO_WRITE, propsDict(), and dictionary::subDict().
|
protected |
Read averaging properties - steps and time.
Definition at line 237 of file fieldAverage.C.
References fieldAverage::fieldAverage(), forAll, dictionary::found(), typeIOobject< Type >::headerOk(), Foam::Info, Log, dictionary::lookup(), IOobject::MUST_READ_IF_MODIFIED, Foam::name(), Foam::nl, IOobject::NO_WRITE, propsDict(), and dictionary::subDict().
TypeName | ( | "fieldAverage" | ) |
Runtime type information.
|
inline |
Return averaging base type name.
Definition at line 345 of file fieldAverage.H.
References fieldAverage::base_.
|
inline |
Return true if base is iter.
Definition at line 351 of file fieldAverage.H.
References fieldAverage::iter.
Referenced by fieldAverage::calculateMeanFieldType(), and fieldAverage::calculatePrime2MeanFieldType().
|
inline |
Return true if base is time.
Definition at line 357 of file fieldAverage.H.
References fieldAverage::time.
|
inline |
Definition at line 362 of file fieldAverage.H.
References fieldAverage::window_.
Referenced by fieldAverage::calculateMeanFieldType(), and fieldAverage::calculatePrime2MeanFieldType().
|
inline |
Definition at line 367 of file fieldAverage.H.
References fieldAverage::fields(), fieldAverage::read(), and fieldAverage::windowName_.
|
virtual |
Read the field average data.
Reimplemented from regionFunctionObject.
Definition at line 330 of file fieldAverage.C.
References Foam::endl(), Log, dictionary::lookup(), dictionary::lookupOrDefault(), Foam::name(), Foam::nl, regionFunctionObject::read(), dictionary::readIfPresent(), and Foam::type().
Referenced by fieldAverage::windowName().
|
virtual |
Return the list of fields required.
Implements functionObject.
Definition at line 370 of file fieldAverage.C.
References fields, and forAll.
Referenced by fieldAverage::windowName().
|
inlinevirtual |
Do not average at the start of the run.
Reimplemented from functionObject.
Definition at line 380 of file fieldAverage.H.
References fieldAverage::execute(), fieldAverage::operator=(), and fieldAverage::write().
|
virtual |
Calculate the field averages.
Implements functionObject.
Definition at line 383 of file fieldAverage.C.
Referenced by fieldAverage::executeAtStart().
|
virtual |
Write the field averages.
Implements functionObject.
Definition at line 391 of file fieldAverage.C.
Referenced by fieldAverage::executeAtStart().
|
delete |
Disallow default bitwise assignment.
Referenced by fieldAverage::executeAtStart().
|
friend |
Definition at line 315 of file fieldAverage.H.
|
protected |
Time at last call, prevents repeated averaging.
Definition at line 180 of file fieldAverage.H.
|
protected |
Restart the averaging process on restart.
Definition at line 183 of file fieldAverage.H.
|
protected |
Restart the averaging process on output.
Definition at line 186 of file fieldAverage.H.
Referenced by fieldAverage::addMeanFieldType(), and fieldAverage::addPrime2MeanFieldType().
|
protected |
Periodically restart the averaging process.
Definition at line 189 of file fieldAverage.H.
|
protected |
Restart period.
Definition at line 192 of file fieldAverage.H.
|
protected |
Initialised flag.
Definition at line 195 of file fieldAverage.H.
|
staticprotected |
Averaging base type names.
Definition at line 198 of file fieldAverage.H.
Referenced by NamedEnum< compressibleField, 8 >::names().
|
protected |
Averaging base type.
Definition at line 201 of file fieldAverage.H.
Referenced by fieldAverage::base().
|
protected |
Averaging window - defaults to -1 for 'all iters/time'.
Definition at line 204 of file fieldAverage.H.
Referenced by fieldAverageItem::fieldAverageItem(), and fieldAverage::window().
|
protected |
Averaging window name - defaults to 'window'.
Definition at line 207 of file fieldAverage.H.
Referenced by fieldAverageItem::fieldAverageItem(), and fieldAverage::windowName().
|
protected |
Compute mean flag.
Definition at line 210 of file fieldAverage.H.
Referenced by fieldAverageItem::fieldAverageItem().
|
protected |
Compute prime-squared mean flag.
Definition at line 213 of file fieldAverage.H.
Referenced by fieldAverageItem::fieldAverageItem().
|
protected |
List of field average items, describing what averages to be.
calculated and output
Definition at line 217 of file fieldAverage.H.
Referenced by fieldAverage::addMeanField(), fieldAverage::addMeanFieldType(), fieldAverage::addMeanSqrToPrime2Mean(), fieldAverage::addMeanSqrToPrime2MeanType(), fieldAverage::addPrime2MeanField(), fieldAverage::addPrime2MeanFieldType(), fieldAverage::calculateMeanFields(), fieldAverage::calculateMeanFieldType(), fieldAverage::calculatePrime2MeanFields(), fieldAverage::calculatePrime2MeanFieldType(), and fieldAverage::writeFields().
Iteration steps counter.
Definition at line 222 of file fieldAverage.H.
Referenced by fieldAverage::calculateMeanFieldType(), and fieldAverage::calculatePrime2MeanFieldType().
|
protected |
Total time counter.
Definition at line 225 of file fieldAverage.H.
Referenced by fieldAverage::calculateMeanFieldType(), and fieldAverage::calculatePrime2MeanFieldType().
|
protected |
Index for periodic restart.
Definition at line 228 of file fieldAverage.H.