Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
fieldAverage Class Reference

Computes ensemble- and/or time-based field averages, with optional windowing, for a user-specified selection of volumetric and/or surface fields. More...

Inheritance diagram for fieldAverage:
Inheritance graph
[legend]
Collaboration diagram for fieldAverage:
Collaboration graph
[legend]

Public Member Functions

 TypeName ("fieldAverage")
 
 fieldAverage (const word &name, const Time &runTime, const dictionary &)
 
 fieldAverage (const fieldAverage &)=delete
 
void operator= (const fieldAverage &)=delete
 
virtual ~fieldAverage ()=default
 
virtual bool read (const dictionary &)
 
virtual bool execute ()
 
virtual bool write ()
 
- Public Member Functions inherited from fvMeshFunctionObject
 TypeName ("fvMeshFunctionObject")
 
 fvMeshFunctionObject (const word &name, const Time &runTime, const dictionary &dict)
 
 fvMeshFunctionObject (const word &name, const objectRegistry &obr, const dictionary &dict)
 
virtual ~fvMeshFunctionObject ()=default
 
- Public Member Functions inherited from regionFunctionObject
 TypeName ("regionFunctionObject")
 
 regionFunctionObject (const word &name, const Time &runTime, const dictionary &dict)
 
 regionFunctionObject (const word &name, const objectRegistry &obr, const dictionary &dict)
 
virtual ~regionFunctionObject ()=default
 
template<class ObjectType >
const ObjectType * lookupObjectPtr (const word &fieldName) const
 
template<class ObjectType >
ObjectType * lookupObjectRefPtr (const word &fieldName) const
 
- Public Member Functions inherited from stateFunctionObject
 stateFunctionObject (const word &name, const Time &runTime)
 
virtual ~stateFunctionObject ()=default
 
dictionarypropertyDict ()
 
bool foundProperty (const word &entryName) const
 
void clearTrigger ()
 
label getTrigger () const
 
bool setTrigger (const label triggeri, bool increaseOnly=true)
 
bool getDict (const word &entryName, dictionary &dict) const
 
bool getObjectDict (const word &objectName, const word &entryName, dictionary &dict) const
 
template<class Type >
Type getProperty (const word &entryName, const Type &defaultValue=Type(Zero)) const
 
template<class Type >
bool getProperty (const word &entryName, Type &value) const
 
template<class Type >
void setProperty (const word &entryName, const Type &value)
 
template<class Type >
Type getObjectProperty (const word &objectName, const word &entryName, const Type &defaultValue=Type(Zero)) const
 
template<class Type >
bool getObjectProperty (const word &objectName, const word &entryName, Type &value) const
 
template<class Type >
void setObjectProperty (const word &objectName, const word &entryName, const Type &value)
 
template<class Type >
void setResult (const word &entryName, const Type &value)
 
template<class Type >
void setObjectResult (const word &objectName, const word &entryName, const Type &value)
 
template<class Type >
Type getResult (const word &entryName, const Type &defaultValue=Type(Zero)) const
 
template<class Type >
Type getObjectResult (const word &objectName, const word &entryName, const Type &defaultValue=Type(Zero)) const
 
template<class Type >
bool getObjectResult (const word &objectName, const word &entryName, Type &value) const
 
word resultType (const word &entryName) const
 
word objectResultType (const word &objectName, const word &entryName) const
 
wordList objectResultEntries () const
 
wordList objectResultEntries (const word &objectName) const
 
void writeResultEntries (Ostream &os) const
 
void writeResultEntries (const word &objectName, Ostream &os) const
 
void writeAllResultEntries (Ostream &os) const
 
- Public Member Functions inherited from timeFunctionObject
 timeFunctionObject (const word &name, const Time &runTime)
 
virtual ~timeFunctionObject ()=default
 
const Timetime () const
 
objectRegistrystoredObjects ()
 
const objectRegistrystoredObjects () const
 
- Public Member Functions inherited from functionObject
 declareRunTimeSelectionTable (autoPtr, functionObject, dictionary,(const word &name, const Time &runTime, const dictionary &dict),(name, runTime, dict))
 
 functionObject (const word &name, const bool withNamePrefix=defaultUseNamePrefix)
 
autoPtr< functionObjectclone () const
 
virtual ~functionObject ()=default
 
virtual const wordtype () const =0
 
const wordname () const noexcept
 
bool useNamePrefix () const noexcept
 
bool useNamePrefix (bool on) noexcept
 
virtual bool execute (const label subIndex)
 
virtual bool end ()
 
virtual bool adjustTimeStep ()
 
virtual bool filesModified () const
 
virtual void updateMesh (const mapPolyMesh &mpm)
 
virtual void movePoints (const polyMesh &mesh)
 

Protected Member Functions

void initialize ()
 
void restart ()
 
template<class Type >
void addMeanFieldType (fieldAverageItem &item)
 
template<class Type >
void addMeanField (fieldAverageItem &item)
 
template<class Type1 , class Type2 >
void addPrime2MeanFieldType (fieldAverageItem &item)
 
template<class Type1 , class Type2 >
void addPrime2MeanField (fieldAverageItem &item)
 
virtual void calcAverages ()
 
template<class Type >
void calculateMeanFields () const
 
template<class Type1 , class Type2 >
void calculatePrime2MeanFields () const
 
template<class Type1 , class Type2 >
void addMeanSqrToPrime2MeanType (const fieldAverageItem &item) const
 
template<class Type1 , class Type2 >
void addMeanSqrToPrime2Mean () const
 
template<class Type >
void storeWindowFieldType (fieldAverageItem &item)
 
template<class Type >
void storeWindowFields ()
 
template<class Type >
void restoreWindowFieldsType (const fieldAverageItem &item)
 
template<class Type >
void restoreWindowFields (const fieldAverageItem &item)
 
virtual void writeAverages () const
 
template<class Type >
void writeFieldType (const word &fieldName) const
 
template<class Type >
void writeFields () const
 
void writeAveragingProperties ()
 
void readAveragingProperties ()
 
- Protected Member Functions inherited from fvMeshFunctionObject
 fvMeshFunctionObject (const fvMeshFunctionObject &)=delete
 
void operator= (const fvMeshFunctionObject &)=delete
 
- Protected Member Functions inherited from regionFunctionObject
virtual const objectRegistryobr () const
 
template<class ObjectType >
bool foundObject (const word &fieldName) const
 
template<class ObjectType >
const ObjectType * cfindObject (const word &fieldName) const
 
template<class ObjectType >
const ObjectType * findObject (const word &fieldName) const
 
template<class ObjectType >
ObjectType * findObject (const word &fieldName)
 
template<class ObjectType >
ObjectType * getObjectPtr (const word &fieldName) const
 
template<class ObjectType >
const ObjectType & lookupObject (const word &fieldName) const
 
template<class ObjectType >
ObjectType & lookupObjectRef (const word &fieldName) const
 
template<class ObjectType >
bool store (word &fieldName, const tmp< ObjectType > &tfield, bool cacheable=false)
 
template<class ObjectType >
bool storeInDb (const word &fieldName, const tmp< ObjectType > &tfield, const objectRegistry &obr)
 
bool writeObject (const word &fieldName)
 
bool clearObject (const word &fieldName)
 
void clearObjects (const wordList &objNames)
 
 regionFunctionObject (const regionFunctionObject &)=delete
 
void operator= (const regionFunctionObject &)=delete
 
- Protected Member Functions inherited from stateFunctionObject
const functionObjects::propertiesstateDict () const
 
functionObjects::propertiesstateDict ()
 
 stateFunctionObject (const stateFunctionObject &)=delete
 
void operator= (const stateFunctionObject &)=delete
 
- Protected Member Functions inherited from timeFunctionObject
void clearOutputObjects (const wordList &objNames)
 
 timeFunctionObject (const timeFunctionObject &)=delete
 
void operator= (const timeFunctionObject &)=delete
 
- Protected Member Functions inherited from functionObject
word scopedName (const word &name) const
 

Protected Attributes

label prevTimeIndex_
 
bool initialised_
 
Switch restartOnRestart_
 
Switch restartOnOutput_
 
Switch periodicRestart_
 
scalar restartPeriod_
 
scalar restartTime_
 
List< fieldAverageItemfaItems_
 
List< label > totalIter_
 
List< scalar > totalTime_
 
label periodIndex_
 
- Protected Attributes inherited from fvMeshFunctionObject
const fvMeshmesh_
 
- Protected Attributes inherited from regionFunctionObject
word subRegistryName_
 
const objectRegistryobr_
 
const objectRegistryobrPtr_
 
- Protected Attributes inherited from timeFunctionObject
const Timetime_
 

Additional Inherited Members

- Static Public Member Functions inherited from functionObject
static autoPtr< functionObjectNew (const word &name, const Time &runTime, const dictionary &dict)
 
- Public Attributes inherited from functionObject
bool log
 
- Static Public Attributes inherited from functionObject
static int debug
 
static bool postProcess
 
static bool defaultUseNamePrefix
 
static word outputPrefix
 

Detailed Description

Computes ensemble- and/or time-based field averages, with optional windowing, for a user-specified selection of volumetric and/or 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:

Average field names are constructed by concatenating the base field with the averaging type, e.g. when averaging field 'U', the name of resultant fields becomes:

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.

With the subRegion option, also supports fields on function object surface output (e.g., sampledSurfaces).

Operands:

Operand Type Location
input {vol,surface}<Type>Field(s) $FOAM_CASE/<time>/<inpField>s
output file - -
output field {vol,surface}<Type>Field(s) $FOAM_CASE/<time>/<outField>s

where <Type>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.

Usage
Minimal example by using system/controlDict.functions:
fieldAverage1
{
    // Mandatory entries (unmodifiable)
    type                fieldAverage;
    libs                (fieldFunctionObjects);

    // Mandatory entries (runtime modifiable)
    fields
    (
        <field1>
        {
            // Optional (inherited) entries
            ...
        }

        ...

        <fieldN>
        {
            ...
        }
    );

    // Optional entries (runtime modifiable)
    restartOnRestart    false;
    restartOnOutput     false;
    periodicRestart     false;
    restartPeriod       0.002;

    // Optional (inherited) entries
    ...
}

where the entries mean:

Property Description Type Req'd Dflt
type Type name: fieldAverage word yes -
libs Library name: fieldFunctionObjects word yes -
fields Names of the operand fields and averaging options dict yes -
restartOnRestart Restart the averaging on restart bool no false
restartOnOutput Restart the averaging on output bool no false
periodicRestart Periodically restart the averaging bool no false
restartPeriod Periodic restart period scalar conditional -
restartTime One-shot reset of the averaging scalar no GREAT
subRegion Name for alternative objectRegistry word no ""

The inherited entries are elaborated in:

Usage by the postProcess utility is not available.

See also
Source files

Definition at line 255 of file fieldAverage.H.

Constructor & Destructor Documentation

◆ fieldAverage() [1/2]

fieldAverage ( const word name,
const Time runTime,
const dictionary dict 
)

Definition at line 264 of file fieldAverage.C.

References dict, and Foam::read().

Here is the call graph for this function:

◆ fieldAverage() [2/2]

fieldAverage ( const fieldAverage )
delete

◆ ~fieldAverage()

virtual ~fieldAverage ( )
virtualdefault

Member Function Documentation

◆ initialize()

void initialize ( )
protected

◆ restart()

void restart ( )
protected

Definition at line 97 of file fieldAverage.C.

References Foam::endl(), Log, and Foam::nl.

Here is the call graph for this function:

◆ addMeanFieldType()

void addMeanFieldType ( fieldAverageItem item)
protected

◆ addMeanField()

void addMeanField ( fieldAverageItem item)
protected

Definition at line 90 of file fieldAverageTemplates.C.

References fieldAverageItem::mean().

Here is the call graph for this function:

◆ addPrime2MeanFieldType()

void addPrime2MeanFieldType ( fieldAverageItem item)
protected

◆ addPrime2MeanField()

void addPrime2MeanField ( fieldAverageItem item)
protected

◆ calcAverages()

void calcAverages ( )
protectedvirtual

Definition at line 112 of file fieldAverage.C.

References Foam::endl(), forAll, Log, Foam::name(), Foam::nl, and Foam::type().

Here is the call graph for this function:

◆ calculateMeanFields()

void calculateMeanFields
protected

Definition at line 324 of file fieldAverageTemplates.C.

References fieldAverageItem::calculateMeanField().

Here is the call graph for this function:

◆ calculatePrime2MeanFields()

void calculatePrime2MeanFields
protected

Definition at line 340 of file fieldAverageTemplates.C.

References fieldAverageItem::calculatePrime2MeanField().

Here is the call graph for this function:

◆ addMeanSqrToPrime2MeanType()

void addMeanSqrToPrime2MeanType ( const fieldAverageItem item) const
protected

Definition at line 364 of file fieldAverageTemplates.C.

References fieldAverageItem::fieldName(), fieldAverageItem::meanFieldName(), fieldAverageItem::prime2MeanFieldName(), and Foam::sqr().

Here is the call graph for this function:

◆ addMeanSqrToPrime2Mean()

void addMeanSqrToPrime2Mean
protected

Definition at line 384 of file fieldAverageTemplates.C.

References fieldAverageItem::prime2Mean().

Here is the call graph for this function:

◆ storeWindowFieldType()

void storeWindowFieldType ( fieldAverageItem item)
protected

◆ storeWindowFields()

void storeWindowFields
protected

Definition at line 305 of file fieldAverageTemplates.C.

References fieldAverage::faItems_, and fieldAverageItem::storeWindowFields().

Here is the call graph for this function:

◆ restoreWindowFieldsType()

void restoreWindowFieldsType ( const fieldAverageItem item)
protected

◆ restoreWindowFields()

void restoreWindowFields ( const fieldAverageItem item)
protected

Definition at line 160 of file fieldAverageTemplates.C.

References fieldAverageItem::window().

Here is the call graph for this function:

◆ writeAverages()

void writeAverages ( ) const
protectedvirtual

Definition at line 185 of file fieldAverage.C.

References Foam::endl(), and Log.

Here is the call graph for this function:

◆ writeFieldType()

void writeFieldType ( const word fieldName) const
protected

Definition at line 411 of file fieldAverageTemplates.C.

References f().

Here is the call graph for this function:

◆ writeFields()

void writeFields
protected

◆ writeAveragingProperties()

void writeAveragingProperties ( )
protected

Definition at line 199 of file fieldAverage.C.

References propsDict().

Here is the call graph for this function:

◆ readAveragingProperties()

void readAveragingProperties ( )
protected

Definition at line 210 of file fieldAverage.C.

References Foam::endl(), Foam::Info, and Foam::nl.

Here is the call graph for this function:

◆ TypeName()

TypeName ( "fieldAverage"  )

◆ operator=()

void operator= ( const fieldAverage )
delete

◆ read()

bool read ( const dictionary dict)
virtual

Reimplemented from regionFunctionObject.

Definition at line 287 of file fieldAverage.C.

References dict, Foam::endl(), Foam::Info, Foam::name(), Foam::nl, regionFunctionObject::read(), and Foam::type().

Here is the call graph for this function:

◆ execute()

bool execute ( )
virtual

Implements functionObject.

Definition at line 367 of file fieldAverage.C.

◆ write()

bool write ( )
virtual

Implements functionObject.

Definition at line 375 of file fieldAverage.C.

Member Data Documentation

◆ prevTimeIndex_

label prevTimeIndex_
protected

Definition at line 264 of file fieldAverage.H.

Referenced by fieldAverage::initialize().

◆ initialised_

bool initialised_
protected

Definition at line 267 of file fieldAverage.H.

Referenced by fieldAverage::initialize().

◆ restartOnRestart_

Switch restartOnRestart_
protected

Definition at line 270 of file fieldAverage.H.

◆ restartOnOutput_

Switch restartOnOutput_
protected

Definition at line 273 of file fieldAverage.H.

◆ periodicRestart_

Switch periodicRestart_
protected

Definition at line 276 of file fieldAverage.H.

◆ restartPeriod_

scalar restartPeriod_
protected

Definition at line 279 of file fieldAverage.H.

◆ restartTime_

scalar restartTime_
protected

Definition at line 282 of file fieldAverage.H.

◆ faItems_

List<fieldAverageItem> faItems_
protected

Definition at line 286 of file fieldAverage.H.

Referenced by fieldAverage::initialize(), and fieldAverage::storeWindowFields().

◆ totalIter_

List<label> totalIter_
protected

Definition at line 291 of file fieldAverage.H.

◆ totalTime_

List<scalar> totalTime_
protected

Definition at line 294 of file fieldAverage.H.

◆ periodIndex_

label periodIndex_
protected

Definition at line 297 of file fieldAverage.H.


The documentation for this class was generated from the following files: