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...
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... | |
bool & | active () |
Return non-const access to the active flag. More... | |
const word & | fieldName () const |
Return const access to the field name. More... | |
bool | mean () const |
Return const access to the mean flag. More... | |
bool & | mean () |
Return non-const access to the mean flag. More... | |
const word & | meanFieldName () 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... | |
bool & | prime2Mean () |
Return non-const access to the prime-squared mean flag. More... | |
const word & | prime2MeanFieldName () 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 word & | base () 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 word & | windowName () 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) |
Istream & | operator>> (Istream &, fieldAverageItem &) |
Ostream & | operator<< (Ostream &, const fieldAverageItem &) |
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.
<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
prime2Mean
option, the mean
option must be enabled.Definition at line 159 of file fieldAverageItem.H.
|
strong |
Enumeration defining the averaging base type.
Enumerator | |
---|---|
ITER | |
TIME |
Definition at line 175 of file fieldAverageItem.H.
|
strong |
Enumeration defining the averaging window type.
Enumerator | |
---|---|
NONE | |
APPROXIMATE | |
EXACT |
Definition at line 182 of file fieldAverageItem.H.
fieldAverageItem | ( | ) |
Construct null.
Definition at line 70 of file fieldAverageItem.C.
fieldAverageItem | ( | Istream & | is | ) |
Construct from Istream.
Definition at line 35 of file fieldAverageItemIO.C.
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.
|
inline |
Return const access to the active flag.
Definition at line 30 of file fieldAverageItemI.H.
Referenced by fieldAverage::addMeanFieldType().
|
inline |
Return non-const access to the active flag.
Definition at line 36 of file fieldAverageItemI.H.
|
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().
|
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().
|
inline |
Return non-const access to the mean flag.
Definition at line 54 of file fieldAverageItemI.H.
|
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().
|
inline |
Set the mean field name.
Definition at line 67 of file fieldAverageItemI.H.
References Foam::name().
|
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().
|
inline |
Return non-const access to the prime-squared mean flag.
Definition at line 82 of file fieldAverageItemI.H.
|
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().
|
inline |
Set the prime-squared mean field name.
Definition at line 95 of file fieldAverageItemI.H.
References Foam::name().
|
inline |
Return averaging base type name.
Definition at line 104 of file fieldAverageItemI.H.
|
inline |
Return the total number of iterations item has been evolved.
Definition at line 110 of file fieldAverageItemI.H.
|
inline |
Return the total time item has been evolved.
Definition at line 116 of file fieldAverageItemI.H.
|
inline |
Return the window length (iterations or seconds)
Definition at line 122 of file fieldAverageItemI.H.
Referenced by fieldAverage::restoreWindowFields().
|
inline |
Return the (optional) window name.
Definition at line 128 of file fieldAverageItemI.H.
|
inline |
Return the list of window times (windowType = EXACT)
Definition at line 135 of file fieldAverageItemI.H.
|
inline |
Return the list of window field names (windowType = EXACT)
Definition at line 142 of file fieldAverageItemI.H.
Referenced by fieldAverage::restoreWindowFieldsType().
|
inline |
Return the allow restart flag.
Definition at line 148 of file fieldAverageItemI.H.
|
inline |
Return the current time interval.
Definition at line 154 of file fieldAverageItemI.H.
References Foam::FatalError, and FatalErrorInFunction.
Referenced by fieldAverageItem::calculateMeanField().
|
inline |
Return the total time interval.
Definition at line 181 of file fieldAverageItemI.H.
References Foam::FatalError, and FatalErrorInFunction.
Referenced by fieldAverageItem::calculateMeanField().
|
inline |
Helper function to construct a window field name.
Definition at line 205 of file fieldAverageItemI.H.
References Foam::name().
Referenced by fieldAverage::storeWindowFieldType().
|
inline |
Return true if time is inside window (including boundaries)
Definition at line 214 of file fieldAverageItemI.H.
References Foam::FatalError, and FatalErrorInFunction.
|
inline |
Return true if we wish to store window fields.
Definition at line 239 of file fieldAverageItemI.H.
|
inline |
Return true if we wish to write window fields.
Definition at line 245 of file fieldAverageItemI.H.
void addToWindow | ( | const word & | fieldName, |
const scalar | deltaT | ||
) |
Add field to window.
Definition at line 123 of file fieldAverageItem.C.
Referenced by fieldAverage::storeWindowFieldType().
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().
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().
bool readState | ( | const dictionary & | dict | ) |
Read state and re-initialise values.
Definition at line 193 of file fieldAverageItem.C.
References dict.
void writeState | ( | dictionary & | dict | ) | const |
bool calculateMeanField | ( | const objectRegistry & | obr | ) | const |
Calculate the mean field value.
Definition at line 32 of file fieldAverageItemTemplates.C.
References fieldAverageItem::APPROXIMATE, beta(), LList< LListBase, T >::cbegin(), TimeState::deltaTValue(), fieldAverageItem::Dt(), fieldAverageItem::dt(), fieldAverageItem::EXACT, Foam::FatalError, FatalErrorInFunction, fieldAverageItem::fieldName(), objectRegistry::findObject(), LList< LListBase, T >::first(), fieldAverageItem::ITER, objectRegistry::lookupObject(), objectRegistry::lookupObjectRef(), n, fieldAverageItem::NONE, fieldAverageItem::TIME, and objectRegistry::time().
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().
void operator= | ( | const fieldAverageItem & | rhs | ) |
Definition at line 226 of file fieldAverageItem.C.
|
friend |
Definition at line 374 of file fieldAverageItem.H.
|
friend |
Definition at line 396 of file fieldAverageItem.H.
|
friend |
|
friend |
|
static |
Mean average.
Definition at line 168 of file fieldAverageItem.H.
Referenced by Foam::functionObjects::operator>>().
|
static |
Prime-squared average.
Definition at line 171 of file fieldAverageItem.H.
Referenced by Foam::functionObjects::operator>>().