Base class that computes the ensemble- or time-based singular-value average values, with optional windowing, from the output of function objects that generate non-field type values, e.g. Cd of forceCoeffs or momentum_x in momentum function objects.
More...
#include <valueAverageBase.H>


Public Types | |
| enum class | windowType : uint8_t { NONE , APPROXIMATE , EXACT } |
| Averaging window types. More... | |
Public Member Functions | |
| valueAverageBase (const word &name, const objectRegistry &obr, const dictionary &dict, stateFunctionObject &state, const bool writeToFile=true) | |
| Construct from Time and dictionary. | |
| valueAverageBase (const valueAverageBase &)=delete | |
| No copy construct. | |
| void | operator= (const valueAverageBase &)=delete |
| No copy assignment. | |
| virtual | ~valueAverageBase ()=default |
| Destructor. | |
| virtual bool | read (const dictionary &dict) |
| Read the field value average data. | |
| virtual bool | calculate (dictionary &dict) |
| Calculate the averages. | |
| Public Member Functions inherited from writeFile | |
| writeFile (const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true, const string &ext=".dat") | |
| Construct from objectRegistry, prefix, fileName. | |
| writeFile (const objectRegistry &obr, const fileName &prefix, const word &name, const dictionary &dict, const bool writeToFile=true, const string &ext=".dat") | |
| Construct from objectRegistry, prefix, fileName and read options from dictionary. | |
| writeFile (const writeFile &wf) | |
| Construct copy. | |
| virtual | ~writeFile ()=default |
| Destructor. | |
| virtual const string & | setExt (const string &ext) |
| Set extension. | |
| virtual OFstream & | file () |
| Return access to the file (if only 1). | |
| virtual bool | writeToFile () const |
| Flag to allow writing to file. | |
| virtual bool | canWriteToFile () const |
| Flag to allow writing to the file. | |
| virtual bool | canResetFile () const |
| Flag to allow resetting the file. | |
| virtual bool | canWriteHeader () const |
| Flag to allow writing the header. | |
| virtual label | charWidth () const |
| Return width of character stream output. | |
| virtual void | writeCommented (Ostream &os, const string &str) const |
| Write a commented string to stream. | |
| virtual void | writeTabbed (Ostream &os, const string &str) const |
| Write a tabbed string to stream. | |
| virtual void | writeHeader (Ostream &os, const string &str) const |
| Write a commented header to stream. | |
| virtual void | writeCurrentTime (Ostream &os) const |
| Write the current time to stream. | |
| virtual void | writeBreak (Ostream &os) const |
| Write a break marker to the stream. | |
| template<class Type> | |
| void | writeHeaderValue (Ostream &os, const string &property, const Type &value) const |
| Write a (commented) header property and value pair. | |
| template<class Type> | |
| void | writeValue (Ostream &os, const Type &val) const |
| Write a given value to stream with the space delimiter. | |
Static Public Attributes | |
| static const Enum< windowType > | windowTypeNames |
| Names for windowType enumeration. | |
| Static Public Attributes inherited from writeFile | |
| static label | addChars = 8 |
| Additional characters for writing. | |
Protected Member Functions | |
| template<class Type, class Type2 = Type> | |
| bool | calc (const label fieldi, bool &converged, dictionary &dict) |
| Templated function to calculate the average. | |
| virtual void | writeFileHeader (Ostream &os) const |
| Output file header information. | |
| virtual void | readState (dictionary &dict) |
| Read state from dictionary. | |
| virtual void | writeState (dictionary &dict) |
| Write state to dictionary for restarts. | |
| virtual void | resetState (dictionary &dict) |
| Reset state. | |
| Protected Member Functions inherited from writeFile | |
| void | initStream (Ostream &os) const |
| Initialise the output stream for writing. | |
| fileName | baseFileDir () const |
| Return the base directory for output. | |
| fileName | baseTimeDir () const |
| Return the base directory for the current time value. | |
| fileName | filePath (const fileName &fName) const |
| Return the full path for the supplied file name. | |
| virtual autoPtr< OFstream > | newFile (const fileName &fName) const |
| Return autoPtr to a new file using file name. | |
| virtual autoPtr< OFstream > | newFileAtTime (const word &name, scalar timeValue) const |
| Return autoPtr to a new file for a given time. | |
| virtual autoPtr< OFstream > | newFileAtStartTime (const word &name) const |
| Return autoPtr to a new file using the simulation start time. | |
| virtual void | resetFile (const word &name) |
| Reset internal file pointer to new file with new name. | |
| Omanip< int > | valueWidth (const label offset=0) const |
| Return the value width when writing to stream with optional offset. | |
| void | operator= (const writeFile &)=delete |
| No copy assignment. | |
| virtual autoPtr< OFstream > | createFile (const word &name, scalar timeValue) const |
| Deprecated(2022-09) Return autoPtr to a new file for a given time. | |
| virtual autoPtr< OFstream > | createFile (const word &name) const |
| Deprecated(2022-09) Return autoPtr to a new file using the simulation start time. | |
Protected Attributes | |
| bool | resetOnRestart_ |
| Reset the averaging process on restart. | |
| windowType | windowType_ |
| Window type. | |
| stateFunctionObject & | state_ |
| Reference to the state functionObject. | |
| word | functionObjectName_ |
| Name of function object to retrieve data from. | |
| wordList | fieldNames_ |
| List of fields on which to operate. | |
| scalar | tolerance_ |
| Optional tolerance to check for converged results. | |
| scalar | window_ |
| Averaging window. | |
| List< scalar > | totalTime_ |
| Average time per field. | |
| Protected Attributes inherited from writeFile | |
| const objectRegistry & | fileObr_ |
| Reference to the region objectRegistry. | |
| const fileName | prefix_ |
| Prefix. | |
| word | fileName_ |
| Name of file. | |
| autoPtr< OFstream > | filePtr_ |
| File pointer. | |
| label | writePrecision_ |
| Write precision. | |
| bool | writeToFile_ |
| Flag to enable/disable writing to file. | |
| bool | updateHeader_ |
| Flag to update the header, e.g. on mesh changes. Default is true. | |
| bool | writtenHeader_ |
| Flag to identify whether the header has been written. | |
| bool | useUserTime_ |
| Flag to use the specified user time, e.g. CA deg instead of seconds. Default = true. | |
| scalar | startTime_ |
| Start time value. | |
| string | ext_ |
| File extension; default = .dat. | |
Base class that computes the ensemble- or time-based singular-value average values, with optional windowing, from the output of function objects that generate non-field type values, e.g. Cd of forceCoeffs or momentum_x in momentum function objects.
Definition at line 58 of file valueAverageBase.H.
|
strong |
Averaging window types.
| Enumerator | |
|---|---|
| NONE | "none" |
| APPROXIMATE | "approximate" |
| EXACT | "exact" |
Definition at line 69 of file valueAverageBase.H.
| valueAverageBase | ( | const word & | name, |
| const objectRegistry & | obr, | ||
| const dictionary & | dict, | ||
| stateFunctionObject & | state, | ||
| const bool | writeToFile = true ) |
Construct from Time and dictionary.
Definition at line 112 of file valueAverageBase.C.
References dict, fieldNames_, writeFile::file(), functionObjectName_, Foam::name(), read(), resetOnRestart_, state_, tolerance_, totalTime_, window_, windowType_, writeFile::writeFile(), writeFileHeader(), and writeFile::writeToFile().
Referenced by averageCondition::averageCondition(), operator=(), valueAverage::valueAverage(), and valueAverageBase().


|
delete |
|
virtualdefault |
Destructor.
References dict.
|
protected |
Templated function to calculate the average.
Return true if processed
Definition at line 25 of file valueAverageBaseTemplates.C.
References APPROXIMATE, beta(), LList< LListBase, T >::cbegin(), delta, dict, EXACT, fieldNames_, writeFile::file(), LList< LListBase, T >::first(), functionObjectName_, Foam::indent(), Log, Foam::mag(), Foam::nl, NONE, FIFOStack< T >::pop(), FIFOStack< T >::push(), dictionary::readIfPresent(), dictionary::set(), SLListBase::size(), state_, Foam::tab, tolerance_, totalTime_, window_, windowType_, and Foam::Zero.
Referenced by calculate().


|
protectedvirtual |
Output file header information.
Definition at line 41 of file valueAverageBase.C.
References Foam::endl(), fieldNames_, forAll, os(), writeFile::writeCommented(), writeFile::writeHeader(), and writeFile::writeTabbed().
Referenced by valueAverageBase().


|
protectedvirtual |
Read state from dictionary.
Definition at line 53 of file valueAverageBase.C.
References dict, dictionary, fieldNames_, forAll, dictionary::readEntry(), resetOnRestart_, resetState(), and totalTime_.
Referenced by averageCondition::averageCondition(), and valueAverage::valueAverage().


|
protectedvirtual |
Write state to dictionary for restarts.
Definition at line 79 of file valueAverageBase.C.
References dictionary::add(), dict, fieldNames_, forAll, and totalTime_.
Referenced by averageCondition::write(), and valueAverage::write().


|
protectedvirtual |
Reset state.
Definition at line 100 of file valueAverageBase.C.
References dict, dictionary, fieldNames_, forAll, and totalTime_.
Referenced by readState(), and averageCondition::reset().

|
delete |
|
virtual |
Read the field value average data.
Reimplemented from writeFile.
Reimplemented in valueAverage.
Definition at line 140 of file valueAverageBase.C.
References dict, fieldNames_, functionObjectName_, writeFile::read(), resetOnRestart_, state_, totalTime_, window_, windowType_, windowTypeNames, and Foam::Zero.
Referenced by valueAverage::read(), and valueAverageBase().


|
virtual |
Calculate the averages.
Definition at line 172 of file valueAverageBase.C.
References DynamicList< T, SizeMin >::append(), calc(), dict, Foam::endl(), fieldNames_, writeFile::file(), forAll, functionObjectName_, Foam::indent(), Log, Foam::nl, writeFile::prefix_, UList< T >::size(), state_, Foam::tab, totalTime_, and WarningInFunction.
Referenced by averageCondition::apply(), and valueAverage::execute().


|
static |
Names for windowType enumeration.
Definition at line 79 of file valueAverageBase.H.
Referenced by read().
|
protected |
Reset the averaging process on restart.
Definition at line 98 of file valueAverageBase.H.
Referenced by read(), readState(), and valueAverageBase().
|
protected |
Window type.
Definition at line 103 of file valueAverageBase.H.
Referenced by calc(), read(), and valueAverageBase().
|
protected |
Reference to the state functionObject.
Definition at line 108 of file valueAverageBase.H.
Referenced by calc(), calculate(), read(), and valueAverageBase().
|
protected |
Name of function object to retrieve data from.
Definition at line 113 of file valueAverageBase.H.
Referenced by calc(), calculate(), read(), and valueAverageBase().
|
protected |
List of fields on which to operate.
Definition at line 118 of file valueAverageBase.H.
Referenced by calc(), calculate(), read(), readState(), resetState(), valueAverageBase(), writeFileHeader(), and writeState().
|
protected |
Optional tolerance to check for converged results.
Definition at line 123 of file valueAverageBase.H.
Referenced by calc(), and valueAverageBase().
|
protected |
Averaging window.
Definition at line 128 of file valueAverageBase.H.
Referenced by calc(), read(), and valueAverageBase().
|
protected |
Average time per field.
Definition at line 133 of file valueAverageBase.H.
Referenced by calc(), calculate(), read(), readState(), resetState(), valueAverageBase(), and writeState().