Calculates the field averages given list of fieldAverageItems, e.g. More...
#include <fieldFunctionObjects/fieldAverage.H>
Calculates the field averages given list of fieldAverageItems, e.g.
fieldAverage1 { // Type of functionObject type fieldAverage; // Where to load it from (if not already in solver) functionObjectLibs ("libfieldAverage.so"); // Whether to perform a clean restart, or start from previous // averaging info if available cleanRestart true; // Whether to reset the averaged fields after they have been written. // Used to average over only the preceding write interval for transient // cases. resetOnOutput true; // Fields to be averaged. runTime modifiable! fields ( U { meanon; prime2Mean on; basetime; } p { meanon; prime2Mean on; basetime; } );
Member function calcAverages() calculates the averages.
Member function fieldAverage::write() calls calcAverages(). Average field names are constructed by concatenating the base field with the averaging type, e.g.
Information regarding the number of averaging steps, and total averaging time are written on a (base) per-field basis to the fieldAveragingProperties dictionary, located in <time>/uniform
Definition at line 110 of file fieldAverage.H.
Public Member Functions | |
TypeName ("fieldAverage") | |
Runtime type information.
| |
fieldAverage (const word &name, const objectRegistry &, const dictionary &, const bool loadFromFiles=false) | |
Construct for given objectRegistry and dictionary.
| |
virtual | ~fieldAverage () |
Destructor.
| |
virtual const word & | name () const |
Return name of the set of field averages.
| |
virtual void | read (const dictionary &) |
Read the field average data.
| |
virtual void | execute () |
Execute the averaging.
| |
virtual void | end () |
Execute the averaging at the final time-loop, currently does nothing.
| |
virtual void | write () |
Calculate the field average data and write.
| |
Protected Member Functions | |
void | resetFields (wordList &) |
Checkout fields (causes deletion) from the database.
| |
void | initialize () |
Reset lists (clear existing values) and initialize averaging.
| |
template<class Type > | |
void | addMeanField (const label, wordList &) const |
Add mean average field to list.
| |
template<class Type1 , class Type2 > | |
void | addPrime2MeanField (const label, const wordList &, wordList &) const |
Add prime-squared average field to list.
| |
virtual void | calcAverages () |
Main calculation routine.
| |
template<class Type > | |
void | calculateMeanFields (const wordList &) const |
Calculate mean average fields.
| |
template<class Type1 , class Type2 > | |
void | addMeanSqrToPrime2Mean (const wordList &, const wordList &) const |
Add mean-squared field value to prime-squared mean field.
| |
template<class Type1 , class Type2 > | |
void | calculatePrime2MeanFields (const wordList &, const wordList &) const |
Calculate prime-squared average fields.
| |
virtual void | writeAverages () const |
Write averages.
| |
template<class Type > | |
void | writeFieldList (const wordList &) const |
Write fields.
| |
void | writeAveragingProperties () const |
Write averaging properties - steps and time.
| |
void | readAveragingProperties () |
Read averaging properties - steps and time.
| |
virtual void | updateMesh (const mapPolyMesh &) |
Update mesh.
| |
virtual void | movePoints (const Field< point > &) |
Move points.
| |
fieldAverage (const fieldAverage &) | |
Disallow default bitwise copy construct.
| |
void | operator= (const fieldAverage &) |
Disallow default bitwise assignment.
| |
Protected Attributes | |
word | name_ |
Name of this set of field averages.
| |
const objectRegistry & | obr_ |
Database this class is registered to.
| |
bool | active_ |
On/off switch.
| |
label | prevTimeIndex_ |
Time at last call, prevents repeated averaging.
| |
Switch | cleanRestart_ |
Clean restart flag.
| |
Switch | resetOnOutput_ |
resetOnOutput flag
| |
List< fieldAverageItem > | faItems_ |
List of field average items, describing what averages to be.
| |
wordList | meanScalarFields_ |
wordList | meanVectorFields_ |
wordList | meanSphericalTensorFields_ |
wordList | meanSymmTensorFields_ |
wordList | meanTensorFields_ |
wordList | prime2MeanScalarFields_ |
wordList | prime2MeanSymmTensorFields_ |
List< label > | totalIter_ |
Iteration steps counter.
| |
List< scalar > | totalTime_ |
Total time counter.
| |
Static Protected Attributes | |
static const word | EXT_MEAN = "Mean" |
Mean average.
| |
static const word | EXT_PRIME2MEAN = "Prime2Mean" |
Prime-squared average.
|
fieldAverage | ( | const fieldAverage & | ) | [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 298 of file fieldAverage.C.
References Foam::endl(), Foam::nl, and WarningIn.
~fieldAverage | ( | ) | [virtual]
|
Destructor.
Definition at line 347 of file fieldAverage.C.
void resetFields | ( | wordList & | names ) | [protected]
|
Checkout fields (causes deletion) from the database.
and reset lists
Definition at line 42 of file fieldAverage.C.
References objectRegistry::checkOut(), List< T >::clear(), fieldAverage::faItems_, forAll, fieldAverage::obr_, List< T >::setSize(), and List< T >::size().
void initialize | ( | ) | [protected]
|
Reset lists (clear existing values) and initialize averaging.
Check requested field averages are valid, populate field lists
Definition at line 57 of file fieldAverage.C.
References Foam::exit(), Foam::FatalError, FatalErrorIn, forAll, and Foam::nl.
void addMeanField | ( | const label | fieldI, |
wordList & | meanFieldList | ||
) | const [protected]
|
Add mean average field to list.
Definition at line 34 of file fieldAverageTemplates.C.
References Foam::endl(), Foam::Info, and Foam::nl.
void addPrime2MeanField | ( | const label | fieldI, |
const wordList & | meanFieldList, | ||
wordList & | prime2MeanFieldList | ||
) | const [protected]
|
Add prime-squared average field to list.
Definition at line 90 of file fieldAverageTemplates.C.
References Foam::endl(), Foam::Info, Foam::nl, and sqr().
void calcAverages | ( | ) | [protected, virtual]
|
Main calculation routine.
Definition at line 153 of file fieldAverage.C.
References Foam::endl(), forAll, Foam::Info, and Foam::nl.
void calculateMeanFields | ( | const wordList & | meanFieldList ) | const [protected]
|
Calculate mean average fields.
Definition at line 147 of file fieldAverageTemplates.C.
References beta(), TimeState::deltaT(), fieldAverage::faItems_, forAll, objectRegistry::lookupObject(), fieldAverage::obr_, objectRegistry::time(), fieldAverage::totalIter_, fieldAverage::totalTime_, and dimensioned< Type >::value().
void addMeanSqrToPrime2Mean | ( | const wordList & | meanFieldList, |
const wordList & | prime2MeanFieldList | ||
) | const [protected]
|
Add mean-squared field value to prime-squared mean field.
Definition at line 240 of file fieldAverageTemplates.C.
References forAll, and Foam::sqr().
void calculatePrime2MeanFields | ( | const wordList & | meanFieldList, |
const wordList & | prime2MeanFieldList | ||
) | const [protected]
|
Calculate prime-squared average fields.
Definition at line 187 of file fieldAverageTemplates.C.
References beta(), TimeState::deltaT(), forAll, Foam::sqr(), IOobject::time(), and dimensioned< Type >::value().
void writeAverages | ( | ) | const [protected, virtual]
|
Write averages.
Definition at line 205 of file fieldAverage.C.
void writeFieldList | ( | const wordList & | fieldList ) | const [protected]
|
void writeAveragingProperties | ( | ) | const [protected]
|
Write averaging properties - steps and time.
Definition at line 218 of file fieldAverage.C.
References dictionary::add(), forAll, IOobject::NO_READ, IOobject::NO_WRITE, propsDict(), and dictionary::subDict().
void readAveragingProperties | ( | ) | [protected]
|
Read averaging properties - steps and time.
Definition at line 246 of file fieldAverage.C.
References Foam::endl(), forAll, dictionary::found(), Foam::Info, IOobject::MUST_READ, Foam::nl, IOobject::NO_WRITE, propsDict(), Foam::readScalar(), and dictionary::subDict().
void updateMesh | ( | const mapPolyMesh & | ) | [protected, virtual]
|
Update mesh.
Definition at line 406 of file fieldAverage.C.
void operator= | ( | const fieldAverage & | ) | [protected]
|
Disallow default bitwise assignment.
TypeName | ( | "fieldAverage" | ) |
Runtime type information.
virtual const word& name | ( | ) | const [inline, virtual]
|
Return name of the set of field averages.
Definition at line 281 of file fieldAverage.H.
References fieldAverage::name_.
void read | ( | const dictionary & | dict ) | [virtual]
|
Read the field average data.
Definition at line 353 of file fieldAverage.C.
References dictionary::lookup(), and dictionary::readIfPresent().
void execute | ( | ) | [virtual]
|
Execute the averaging.
Definition at line 370 of file fieldAverage.C.
void end | ( | ) | [virtual]
|
Execute the averaging at the final time-loop, currently does nothing.
Definition at line 379 of file fieldAverage.C.
void write | ( | ) | [virtual]
|
Calculate the field average data and write.
Definition at line 384 of file fieldAverage.C.
References Foam::endl(), Foam::Info, and Foam::nl.
const Foam::word EXT_MEAN = "Mean" [static, protected]
|
Mean average.
Definition at line 117 of file fieldAverage.H.
const Foam::word EXT_PRIME2MEAN = "Prime2Mean" [static, protected]
|
Prime-squared average.
Definition at line 120 of file fieldAverage.H.
Name of this set of field averages.
Definition at line 125 of file fieldAverage.H.
Referenced by fieldAverage::name().
const objectRegistry& obr_ [protected]
|
Database this class is registered to.
Definition at line 128 of file fieldAverage.H.
Referenced by fieldAverage::calculateMeanFields(), and fieldAverage::resetFields().
bool active_ [protected]
|
On/off switch.
Definition at line 131 of file fieldAverage.H.
label prevTimeIndex_ [protected]
|
Time at last call, prevents repeated averaging.
Definition at line 134 of file fieldAverage.H.
Switch cleanRestart_ [protected]
|
Clean restart flag.
Definition at line 137 of file fieldAverage.H.
Switch resetOnOutput_ [protected]
|
resetOnOutput flag
Definition at line 140 of file fieldAverage.H.
List<fieldAverageItem> faItems_ [protected]
|
List of field average items, describing what averages to be.
calculated and output
Definition at line 144 of file fieldAverage.H.
Referenced by fieldAverage::calculateMeanFields(), and fieldAverage::resetFields().
wordList meanScalarFields_ [protected]
|
Definition at line 149 of file fieldAverage.H.
wordList meanVectorFields_ [protected]
|
Definition at line 150 of file fieldAverage.H.
wordList meanSphericalTensorFields_ [protected]
|
Definition at line 151 of file fieldAverage.H.
wordList meanSymmTensorFields_ [protected]
|
Definition at line 152 of file fieldAverage.H.
wordList meanTensorFields_ [protected]
|
Definition at line 153 of file fieldAverage.H.
wordList prime2MeanScalarFields_ [protected]
|
Definition at line 157 of file fieldAverage.H.
wordList prime2MeanSymmTensorFields_ [protected]
|
Definition at line 158 of file fieldAverage.H.
List<label> totalIter_ [protected]
|
Iteration steps counter.
Definition at line 164 of file fieldAverage.H.
Referenced by fieldAverage::calculateMeanFields().
List<scalar> totalTime_ [protected]
|
Total time counter.
Definition at line 167 of file fieldAverage.H.
Referenced by fieldAverage::calculateMeanFields().