fieldAverageItem Class Reference

Helper class to describe what form of averaging to apply. A set will be applied to each base field in Foam::fieldAverage, of the following form. More...

Collaboration diagram for fieldAverageItem:
[legend]

Public Types

enum class  baseType { ITER , TIME }
 Enumeration defining the averaging base type. More...
 
enum class  windowType { NONE , APPROXIMATE , EXACT }
 Enumeration defining the averaging window type. More...
 

Public Member Functions

 fieldAverageItem ()
 Construct null. More...
 
 fieldAverageItem (Istream &)
 Construct from Istream. More...
 
 fieldAverageItem (const fieldAverageItem &)
 Construct as copy. More...
 
 ~fieldAverageItem ()
 Destructor. More...
 
bool active () const
 Return const access to the active flag. More...
 
boolactive ()
 Return non-const access to the active flag. More...
 
const wordfieldName () const
 Return const access to the field name. More...
 
bool mean () const
 Return const access to the mean flag. More...
 
boolmean ()
 Return non-const access to the mean flag. More...
 
const wordmeanFieldName () const
 Return const access to the mean field name. More...
 
void setMeanFieldName (const word &name)
 Set the mean field name. More...
 
bool prime2Mean () const
 Return const access to the prime-squared mean flag. More...
 
boolprime2Mean ()
 Return non-const access to the prime-squared mean flag. More...
 
const wordprime2MeanFieldName () const
 Return const access to the prime-squared mean field name. More...
 
void setPrime2MeanFieldName (const word &name)
 Set the prime-squared mean field name. More...
 
const wordbase () const
 Return averaging base type name. More...
 
label totalIter () const
 Return the total number of iterations item has been evolved. More...
 
scalar totalTime () const
 Return the total time item has been evolved. More...
 
scalar window () const
 Return the window length (iterations or seconds) More...
 
const wordwindowName () const
 Return the (optional) window name. More...
 
const FIFOStack< scalar > & windowTimes () const
 Return the list of window times (windowType = EXACT) More...
 
const FIFOStack< word > & windowFieldNames () const
 Return the list of window field names (windowType = EXACT) More...
 
bool allowRestart () const
 Return the allow restart flag. More...
 
scalar dt (const scalar deltaT) const
 Return the current time interval. More...
 
scalar Dt () const
 Return the total time interval. More...
 
word windowFieldName (const word &prefix) const
 Helper function to construct a window field name. More...
 
bool inWindow (const scalar t) const
 Return true if time is inside window (including boundaries) More...
 
bool storeWindowFields () const
 Return true if we wish to store window fields. More...
 
bool writeWindowFields () const
 Return true if we wish to write window fields. More...
 
void addToWindow (const word &fieldName, const scalar deltaT)
 Add field to window. More...
 
void evolve (const objectRegistry &obr)
 Evolve and update. More...
 
void clear (const objectRegistry &obr, const bool fullClean)
 Clear out all mean fields and (optionally) supporting data. More...
 
bool readState (const dictionary &dict)
 Read state and re-initialise values. More...
 
void writeState (dictionary &dict) const
 Write state for restart. More...
 
template<class Type >
bool calculateMeanField (const objectRegistry &obr) const
 Calculate the mean field value. More...
 
template<class Type1 , class Type2 >
bool calculatePrime2MeanField (const objectRegistry &obr) const
 Calculate prime-squared average fields. More...
 
void operator= (const fieldAverageItem &)
 

Static Public Attributes

static const word EXT_MEAN
 Mean average. More...
 
static const word EXT_PRIME2MEAN
 Prime-squared average. More...
 

Friends

bool operator== (const fieldAverageItem &a, const fieldAverageItem &b)
 
bool operator!= (const fieldAverageItem &a, const fieldAverageItem &b)
 
Istreamoperator>> (Istream &, fieldAverageItem &)
 
Ostreamoperator<< (Ostream &, const fieldAverageItem &)
 

Detailed Description

Helper class to describe what form of averaging to apply. A set will be applied to each base field in Foam::fieldAverage, of the following form.

Usage
<field1>
{
    mean            on;
    prime2Mean      on;
    base            time; // iteration
    window          200;  // optional averaging window
    windowName      w1;   // optional window name (default = "")
    windowType      approximate; // window type

    allowRestart    yes;  // optional, used for windowType 'exact'
}

where the entries mean:

Property Description Type Req'd Dflt
mean Flag to calculate average bool yes -
prime2Mean Flag to calculate prime-square average bool yes -
base Type of averaging interval word yes -
window Averaging window scalar no
windowName Name of the averaging window word no ""
windowType Type of averaging window word no
allowRestart Flag to allow restart for windowType=exact bool no

Options for the base entry:

      time | Averaging interval is based on time
      iter | Averaging interval is based on iterations

Options for the windowType entry:

      none  | no windowing
      exact | allow additional files will be stored and written
      approximate | disallow additional files will be stored and written
Note
To employ the prime2Mean option, the mean option must be enabled.
Source files

Definition at line 159 of file fieldAverageItem.H.

Member Enumeration Documentation

◆ baseType

enum class baseType
strong

Enumeration defining the averaging base type.

Enumerator
ITER 
TIME 

Definition at line 175 of file fieldAverageItem.H.

◆ windowType

enum class windowType
strong

Enumeration defining the averaging window type.

Enumerator
NONE 
APPROXIMATE 
EXACT 

Definition at line 182 of file fieldAverageItem.H.

Constructor & Destructor Documentation

◆ fieldAverageItem() [1/3]

Construct null.

Definition at line 70 of file fieldAverageItem.C.

◆ fieldAverageItem() [2/3]

Construct from Istream.

Definition at line 35 of file fieldAverageItemIO.C.

◆ fieldAverageItem() [3/3]

fieldAverageItem ( const fieldAverageItem faItem)

Construct as copy.

Definition at line 91 of file fieldAverageItem.C.

◆ ~fieldAverageItem()

Destructor.

Definition at line 117 of file fieldAverageItem.C.

Member Function Documentation

◆ active() [1/2]

bool active ( ) const
inline

Return const access to the active flag.

Definition at line 30 of file fieldAverageItemI.H.

Referenced by fieldAverage::addMeanFieldType().

Here is the caller graph for this function:

◆ active() [2/2]

bool & active ( )
inline

Return non-const access to the active flag.

Definition at line 36 of file fieldAverageItemI.H.

◆ fieldName()

const Foam::word & fieldName ( ) const
inline

Return const access to the field name.

Definition at line 42 of file fieldAverageItemI.H.

Referenced by fieldAverage::addMeanFieldType(), fieldAverage::addMeanSqrToPrime2MeanType(), fieldAverage::addPrime2MeanField(), fieldAverage::addPrime2MeanFieldType(), fieldAverageItem::calculateMeanField(), fieldAverage::restoreWindowFieldsType(), and fieldAverage::storeWindowFieldType().

Here is the caller graph for this function:

◆ mean() [1/2]

bool mean ( ) const
inline

Return const access to the mean flag.

Definition at line 48 of file fieldAverageItemI.H.

Referenced by fieldAverage::addMeanField(), fieldAverage::addMeanFieldType(), and fieldAverage::addPrime2MeanField().

Here is the caller graph for this function:

◆ mean() [2/2]

bool & mean ( )
inline

Return non-const access to the mean flag.

Definition at line 54 of file fieldAverageItemI.H.

◆ meanFieldName()

const Foam::word & meanFieldName ( ) const
inline

Return const access to the mean field name.

Definition at line 61 of file fieldAverageItemI.H.

Referenced by fieldAverage::addMeanFieldType(), fieldAverage::addMeanSqrToPrime2MeanType(), and fieldAverage::addPrime2MeanFieldType().

Here is the caller graph for this function:

◆ setMeanFieldName()

void setMeanFieldName ( const word name)
inline

Set the mean field name.

Definition at line 67 of file fieldAverageItemI.H.

References Foam::name().

Here is the call graph for this function:

◆ prime2Mean() [1/2]

bool prime2Mean ( ) const
inline

Return const access to the prime-squared mean flag.

Definition at line 76 of file fieldAverageItemI.H.

Referenced by fieldAverage::addPrime2MeanField(), and fieldAverage::addPrime2MeanFieldType().

Here is the caller graph for this function:

◆ prime2Mean() [2/2]

bool & prime2Mean ( )
inline

Return non-const access to the prime-squared mean flag.

Definition at line 82 of file fieldAverageItemI.H.

◆ prime2MeanFieldName()

const Foam::word & prime2MeanFieldName ( ) const
inline

Return const access to the prime-squared mean field name.

Definition at line 89 of file fieldAverageItemI.H.

Referenced by fieldAverage::addMeanSqrToPrime2MeanType(), and fieldAverage::addPrime2MeanFieldType().

Here is the caller graph for this function:

◆ setPrime2MeanFieldName()

void setPrime2MeanFieldName ( const word name)
inline

Set the prime-squared mean field name.

Definition at line 95 of file fieldAverageItemI.H.

References Foam::name().

Here is the call graph for this function:

◆ base()

const Foam::word & base ( ) const
inline

Return averaging base type name.

Definition at line 104 of file fieldAverageItemI.H.

◆ totalIter()

Foam::label totalIter ( ) const
inline

Return the total number of iterations item has been evolved.

Definition at line 110 of file fieldAverageItemI.H.

◆ totalTime()

Foam::scalar totalTime ( ) const
inline

Return the total time item has been evolved.

Definition at line 116 of file fieldAverageItemI.H.

◆ window()

Foam::scalar window ( ) const
inline

Return the window length (iterations or seconds)

Definition at line 122 of file fieldAverageItemI.H.

Referenced by fieldAverage::restoreWindowFields().

Here is the caller graph for this function:

◆ windowName()

const Foam::word & windowName ( ) const
inline

Return the (optional) window name.

Definition at line 128 of file fieldAverageItemI.H.

◆ windowTimes()

const Foam::FIFOStack< Foam::scalar > & windowTimes ( ) const
inline

Return the list of window times (windowType = EXACT)

Definition at line 135 of file fieldAverageItemI.H.

◆ windowFieldNames()

const Foam::FIFOStack< Foam::word > & windowFieldNames ( ) const
inline

Return the list of window field names (windowType = EXACT)

Definition at line 142 of file fieldAverageItemI.H.

Referenced by fieldAverage::restoreWindowFieldsType().

Here is the caller graph for this function:

◆ allowRestart()

bool allowRestart ( ) const
inline

Return the allow restart flag.

Definition at line 148 of file fieldAverageItemI.H.

◆ dt()

Foam::scalar dt ( const scalar  deltaT) const
inline

Return the current time interval.

Definition at line 154 of file fieldAverageItemI.H.

References Foam::FatalError, and FatalErrorInFunction.

Referenced by fieldAverageItem::calculateMeanField().

Here is the caller graph for this function:

◆ Dt()

Foam::scalar Dt ( ) const
inline

Return the total time interval.

Definition at line 181 of file fieldAverageItemI.H.

References Foam::FatalError, and FatalErrorInFunction.

Referenced by fieldAverageItem::calculateMeanField().

Here is the caller graph for this function:

◆ windowFieldName()

Foam::word windowFieldName ( const word prefix) const
inline

Helper function to construct a window field name.

Definition at line 205 of file fieldAverageItemI.H.

References Foam::name().

Referenced by fieldAverage::storeWindowFieldType().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ inWindow()

bool inWindow ( const scalar  t) const
inline

Return true if time is inside window (including boundaries)

Definition at line 214 of file fieldAverageItemI.H.

References Foam::FatalError, and FatalErrorInFunction.

◆ storeWindowFields()

bool storeWindowFields ( ) const
inline

Return true if we wish to store window fields.

Definition at line 239 of file fieldAverageItemI.H.

◆ writeWindowFields()

bool writeWindowFields ( ) const
inline

Return true if we wish to write window fields.

Definition at line 245 of file fieldAverageItemI.H.

◆ addToWindow()

void addToWindow ( const word fieldName,
const scalar  deltaT 
)

Add field to window.

Definition at line 123 of file fieldAverageItem.C.

Referenced by fieldAverage::storeWindowFieldType().

Here is the caller graph for this function:

◆ evolve()

void evolve ( const objectRegistry obr)

Evolve and update.

Definition at line 134 of file fieldAverageItem.C.

References objectRegistry::checkOut(), TimeState::deltaTValue(), forAllIters, and objectRegistry::time().

Here is the call graph for this function:

◆ clear()

void clear ( const objectRegistry obr,
const bool  fullClean 
)

Clear out all mean fields and (optionally) supporting data.

Definition at line 162 of file fieldAverageItem.C.

References objectRegistry::checkOut().

Here is the call graph for this function:

◆ readState()

bool readState ( const dictionary dict)

Read state and re-initialise values.

Definition at line 193 of file fieldAverageItem.C.

References dict.

◆ writeState()

void writeState ( dictionary dict) const

Write state for restart.

Definition at line 208 of file fieldAverageItem.C.

References dict.

◆ calculateMeanField()

◆ calculatePrime2MeanField()

bool calculatePrime2MeanField ( const objectRegistry obr) const

Calculate prime-squared average fields.

Definition at line 167 of file fieldAverageItemTemplates.C.

References beta(), TimeState::deltaTValue(), Foam::FatalError, FatalErrorInFunction, objectRegistry::findObject(), objectRegistry::lookupObject(), objectRegistry::lookupObjectRef(), Foam::sqr(), and objectRegistry::time().

Here is the call graph for this function:

◆ operator=()

void operator= ( const fieldAverageItem rhs)

Definition at line 226 of file fieldAverageItem.C.

Friends And Related Function Documentation

◆ operator==

bool operator== ( const fieldAverageItem a,
const fieldAverageItem b 
)
friend

Definition at line 374 of file fieldAverageItem.H.

◆ operator!=

bool operator!= ( const fieldAverageItem a,
const fieldAverageItem b 
)
friend

Definition at line 396 of file fieldAverageItem.H.

◆ operator>>

Istream & operator>> ( Istream ,
fieldAverageItem  
)
friend

◆ operator<<

Ostream & operator<< ( Ostream ,
const fieldAverageItem  
)
friend

Member Data Documentation

◆ EXT_MEAN

const Foam::word EXT_MEAN
static

Mean average.

Definition at line 168 of file fieldAverageItem.H.

Referenced by Foam::functionObjects::operator>>().

◆ EXT_PRIME2MEAN

const Foam::word EXT_PRIME2MEAN
static

Prime-squared average.

Definition at line 171 of file fieldAverageItem.H.

Referenced by Foam::functionObjects::operator>>().


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