This function object 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: More...
Public Member Functions | |
TypeName ("fieldAverage") | |
Runtime type information. More... | |
fieldAverage (const word &name, const objectRegistry &, const dictionary &, const bool loadFromFiles=false) | |
Construct for given objectRegistry and dictionary. More... | |
virtual | ~fieldAverage () |
Destructor. More... | |
virtual const word & | name () const |
Return name of the set of field averages. More... | |
virtual void | read (const dictionary &) |
Read the field average data. More... | |
virtual void | execute () |
Execute the averaging. More... | |
virtual void | end () |
Execute the averaging at the final time-loop, currently does nothing. More... | |
virtual void | timeSet () |
Called when time was set at the end of the Time::operator++. More... | |
virtual void | write () |
Calculate the field average data and write. More... | |
virtual void | updateMesh (const mapPolyMesh &) |
Update mesh. More... | |
virtual void | movePoints (const polyMesh &) |
Move points. More... | |
![]() | |
functionObjectState (const objectRegistry &obr, const word &name) | |
Construct from components. More... | |
virtual | ~functionObjectState () |
Destructor. More... | |
const word & | name () const |
Return the name. More... | |
bool | active () const |
Return the active flag. More... | |
const IOdictionary & | stateDict () const |
Return access to the state dictionary. More... | |
dictionary & | propertyDict () |
Return access to the property dictionary. More... | |
template<class Type > | |
bool | setActive () |
Set the active status by querying objectRegistry type. More... | |
bool | foundProperty (const word &entryName) const |
Return true if the property exists. More... | |
template<class Type > | |
Type | getProperty (const word &entryName, const Type &defaultValue=pTraits< Type >::zero) const |
Retrieve generic property. More... | |
template<class Type > | |
void | getProperty (const word &entryName, Type &value) const |
Retrieve generic property. More... | |
template<class Type > | |
void | setProperty (const word &entryName, const Type &value) |
Add generic property. More... | |
template<class Type > | |
Type | getObjectProperty (const word &objectName, const word &entryName, const Type &defaultValue=pTraits< Type >::zero) const |
Retrieve generic property from named object. More... | |
template<class Type > | |
void | getObjectProperty (const word &objectName, const word &entryName, Type &value) const |
Retrieve generic property from named object. More... | |
template<class Type > | |
void | setObjectProperty (const word &objectName, const word &entryName, const Type &value) |
Add generic property from named object. More... | |
template<class Type > | |
void | setResult (const word &entryName, const Type &value) |
Add result. More... | |
template<class Type > | |
void | setObjectResult (const word &objectName, const word &entryName, const Type &value) |
Add result from named object. More... | |
template<class Type > | |
Type | getResult (const word &entryName, const Type &defaultValue=pTraits< Type >::zero) const |
Retrieve result. More... | |
template<class Type > | |
Type | getObjectResult (const word &objectName, const word &entryName, const Type &defaultValue=pTraits< Type >::zero) const |
Retrieve result from named object. More... | |
template<class Type > | |
void | getObjectResult (const word &objectName, const word &entryName, Type &value) const |
Retrieve result from named object. More... | |
word | resultType (const word &entryName) const |
Retrieve the result type. More... | |
word | objectResultType (const word &objectName, const word &entryName) const |
Return the type of result. More... | |
List< word > | objectResultEntries () const |
Retrieve the result entries. More... | |
List< word > | objectResultEntries (const word &objectName) const |
Return result entries for named object. More... | |
Protected Member Functions | |
void | resetFields () |
Checkout fields (causes deletion) from the database. More... | |
void | initialize () |
Reset lists (clear existing values) and initialize averaging. 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 () |
Write averaging properties - steps and time. More... | |
void | readAveragingProperties () |
Read averaging properties - steps and time. More... | |
fieldAverage (const fieldAverage &) | |
Disallow default bitwise copy construct. More... | |
void | operator= (const fieldAverage &) |
Disallow default bitwise assignment. More... | |
![]() | |
functionObjectState (const functionObjectState &) | |
Disallow default bitwise copy construct. More... | |
void | operator= (const functionObjectState &) |
Disallow default bitwise assignment. More... | |
Protected Attributes | |
const objectRegistry & | obr_ |
Reference to the database. More... | |
label | prevTimeIndex_ |
Time at last call, prevents repeated averaging. More... | |
Switch | resetOnRestart_ |
Reset the averaging process on restart flag. More... | |
Switch | resetOnOutput_ |
Reset the averaging process on output flag. More... | |
Switch | log_ |
Switch to send output to Info as well as to file. More... | |
bool | initialised_ |
Initialised flag. More... | |
List< 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... | |
![]() | |
const word | name_ |
Name of model. More... | |
bool | active_ |
Flag to indicate whether the object is active. More... | |
IOdictionary & | stateDict_ |
Reference to the state dictionary. More... | |
This function object 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:
prime2Mean:
prime-squared mean
Average field names are constructed by concatenating the base field with the averaging type, e.g. when averaging field 'U', the resultant fields are:
Information regarding the number of averaging steps, and total averaging time are written on a per-field basis to the fieldAveragingProperties
dictionary, located in <time>/uniform
When restarting form a previous calculation, the averaging is continuous. However, the averaging process can be restarted using the resetOnRestart
option.
To restart the averaging process after each calculation output time, use the resetOnOutput
option.
Example of function object specification:
fieldAverage1 { type fieldAverage; functionObjectLibs ("libfieldFunctionObjects.so"); ... resetOnRestart true; resetOnOutput false; fields ( U { mean on; prime2Mean on; base time; window 10.0; windowName w1; } p { mean on; prime2Mean on; base time; } ); }
Function object usage
Property | Description | Required | Default value |
---|---|---|---|
type | type name: fieldAverage | yes | |
resetOnRestart | flag to reset the averaging on restart | yes | |
resetOnOutput | flag to reset the averaging on output | yes | |
fields | list of fields and averaging options | yes | |
log | Log to standard output | no | yes |
prime2Mean
option, the mean
option must be selecetd.Definition at line 172 of file fieldAverage.H.
|
protected |
Disallow default bitwise copy construct.
fieldAverage | ( | const word & | name, |
const objectRegistry & | obr, | ||
const dictionary & | dict, | ||
const bool | loadFromFiles = false |
||
) |
Construct for given objectRegistry and dictionary.
Allow the possibility to load fields from files
Definition at line 225 of file fieldAverage.C.
References dict, and Foam::read().
|
virtual |
Destructor.
Definition at line 253 of file fieldAverage.C.
|
protected |
Checkout fields (causes deletion) from the database.
and reset lists
Definition at line 42 of file fieldAverage.C.
References objectRegistry::checkOut(), fieldAverage::faItems_, forAll, HashTable::found(), and fieldAverage::obr_.
|
protected |
Reset lists (clear existing values) and initialize averaging.
Check requested field averages are valid, populate field lists
Definition at line 65 of file fieldAverage.C.
References Foam::endl(), forAll, Foam::Info, Foam::nl, Foam::type(), and WarningInFunction.
|
protected |
Add mean average field to database.
Definition at line 34 of file fieldAverageTemplates.C.
References Foam::endl(), fieldAverage::faItems_, HashTable::found(), objectRegistry::foundObject(), Foam::Info, fieldAverage::log_, objectRegistry::lookupObject(), IOobject::NO_READ, IOobject::NO_WRITE, fieldAverage::obr_, IOobject::READ_IF_PRESENT, fieldAverage::resetOnOutput_, Time::startTime(), regIOobject::store(), objectRegistry::time(), Time::timeName(), and dimensioned::value().
|
protected |
Add mean average field to database.
Definition at line 83 of file fieldAverageTemplates.C.
|
protected |
Add prime-squared average field to database.
Definition at line 105 of file fieldAverageTemplates.C.
References Foam::endl(), Foam::Info, IOobject::NO_READ, IOobject::NO_WRITE, IOobject::READ_IF_PRESENT, and Foam::sqr().
|
protected |
Add prime-squared average field to database.
Definition at line 155 of file fieldAverageTemplates.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.
|
protectedvirtual |
Main calculation routine.
Definition at line 108 of file fieldAverage.C.
References forAll, Foam::Info, Foam::nl, and Foam::type().
|
protected |
Calculate mean average fields.
Definition at line 188 of file fieldAverageTemplates.C.
References Foam::constant::atomic::alpha, beta(), and w().
|
protected |
Calculate mean average fields.
Definition at line 230 of file fieldAverageTemplates.C.
References forAll.
|
protected |
Calculate prime-squared average fields.
Definition at line 247 of file fieldAverageTemplates.C.
References Foam::constant::atomic::alpha, beta(), Foam::sqr(), and w().
|
protected |
Calculate prime-squared average fields.
Definition at line 294 of file fieldAverageTemplates.C.
References forAll.
|
protected |
Add mean-squared field value to prime-squared mean field.
Definition at line 314 of file fieldAverageTemplates.C.
References Foam::sqr().
|
protected |
Add mean-squared field value to prime-squared mean field.
Definition at line 334 of file fieldAverageTemplates.C.
References forAll.
|
protectedvirtual |
Write averages.
Definition at line 151 of file fieldAverage.C.
References Foam::endl(), and Foam::Info.
|
protected |
Write fields.
Definition at line 354 of file fieldAverageTemplates.C.
References f().
|
protected |
|
protected |
Write averaging properties - steps and time.
Definition at line 163 of file fieldAverage.C.
References dictionary::add(), forAll, and propsDict().
|
protected |
Read averaging properties - steps and time.
Definition at line 177 of file fieldAverage.C.
References Foam::endl(), forAll, Foam::Info, dictionary::lookup(), Foam::nl, Foam::readLabel(), and Foam::readScalar().
|
protected |
Disallow default bitwise assignment.
TypeName | ( | "fieldAverage" | ) |
Runtime type information.
|
inlinevirtual |
Return name of the set of field averages.
Definition at line 323 of file fieldAverage.H.
References functionObjectState::name_.
|
virtual |
Read the field average data.
Definition at line 259 of file fieldAverage.C.
References dict, Foam::endl(), Foam::Info, dictionary::lookup(), Foam::nl, dictionary::readIfPresent(), and Foam::type().
|
virtual |
Execute the averaging.
Definition at line 280 of file fieldAverage.C.
References Foam::endl(), and Foam::Info.
|
virtual |
Execute the averaging at the final time-loop, currently does nothing.
Definition at line 290 of file fieldAverage.C.
|
virtual |
Called when time was set at the end of the Time::operator++.
Definition at line 294 of file fieldAverage.C.
|
virtual |
Calculate the field average data and write.
Definition at line 298 of file fieldAverage.C.
References Foam::endl(), Foam::Info, and Foam::nl.
|
virtual |
Update mesh.
Definition at line 325 of file fieldAverage.C.
|
virtual |
Move points.
Definition at line 331 of file fieldAverage.C.
|
protected |
Reference to the database.
Definition at line 181 of file fieldAverage.H.
Referenced by fieldAverage::addMeanFieldType(), and fieldAverage::resetFields().
|
protected |
Time at last call, prevents repeated averaging.
Definition at line 184 of file fieldAverage.H.
|
protected |
Reset the averaging process on restart flag.
Definition at line 187 of file fieldAverage.H.
|
protected |
Reset the averaging process on output flag.
Definition at line 190 of file fieldAverage.H.
Referenced by fieldAverage::addMeanFieldType().
|
protected |
Switch to send output to Info as well as to file.
Definition at line 193 of file fieldAverage.H.
Referenced by fieldAverage::addMeanFieldType().
|
protected |
Initialised flag.
Definition at line 196 of file fieldAverage.H.
|
protected |
List of field average items, describing what averages to be.
calculated and output
Definition at line 200 of file fieldAverage.H.
Referenced by fieldAverage::addMeanFieldType(), and fieldAverage::resetFields().
Iteration steps counter.
Definition at line 205 of file fieldAverage.H.
|
protected |
Total time counter.
Definition at line 208 of file fieldAverage.H.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.