valueAverageBase Class Reference

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...

Inheritance diagram for valueAverageBase:
Collaboration diagram for valueAverageBase:

Public Types

enum  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. More...
 
 valueAverageBase (const valueAverageBase &)=delete
 No copy construct. More...
 
void operator= (const valueAverageBase &)=delete
 No copy assignment. More...
 
virtual ~valueAverageBase ()=default
 Destructor. More...
 
virtual bool read (const dictionary &dict)
 Read the field value average data. More...
 
virtual bool calculate (dictionary &dict)
 Calculate the averages. More...
 
- Public Member Functions inherited from writeFile
 writeFile (const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true)
 Construct from objectRegistry, prefix, fileName. More...
 
 writeFile (const objectRegistry &obr, const fileName &prefix, const word &name, const dictionary &dict, const bool writeToFile=true)
 Construct from objectRegistry, prefix, fileName and read options from dictionary. More...
 
 writeFile (const writeFile &wf)
 Construct copy. More...
 
virtual ~writeFile ()=default
 Destructor. More...
 
virtual OFstreamfile ()
 Return access to the file (if only 1) More...
 
virtual bool writeToFile () const
 Flag to allow writing to file. More...
 
virtual bool canWriteToFile () const
 Flag to allow writing to the file. More...
 
virtual bool canResetFile () const
 Flag to allow resetting the file. More...
 
virtual bool canWriteHeader () const
 Flag to allow writing the header. More...
 
virtual label charWidth () const
 Return width of character stream output. More...
 
virtual void writeCommented (Ostream &os, const string &str) const
 Write a commented string to stream. More...
 
virtual void writeTabbed (Ostream &os, const string &str) const
 Write a tabbed string to stream. More...
 
virtual void writeHeader (Ostream &os, const string &str) const
 Write a commented header to stream. More...
 
virtual void writeCurrentTime (Ostream &os) const
 Write the current time to stream. More...
 
virtual void writeBreak (Ostream &os) const
 Write a break marker to the stream. More...
 
template<class Type >
void writeHeaderValue (Ostream &os, const string &property, const Type &value) const
 Write a (commented) header property and value pair. More...
 
template<class Type >
void writeValue (Ostream &os, const Type &val) const
 Write a given value to stream with the space delimiter. More...
 

Static Public Attributes

static const Enum< windowTypewindowTypeNames
 Names for windowType enumeration. More...
 
- Static Public Attributes inherited from writeFile
static label addChars = 8
 Additional characters for writing. More...
 

Protected Member Functions

template<class Type , class Type2 = Type>
bool calc (const label fieldi, bool &converged, dictionary &dict)
 Templated function to calculate the average. More...
 
virtual void writeFileHeader (Ostream &os) const
 Output file header information. More...
 
virtual void readState (dictionary &dict)
 Read state from dictionary. More...
 
virtual void writeState (dictionary &dict)
 Write state to dictionary for restarts. More...
 
virtual void resetState (dictionary &dict)
 Reset state. More...
 
- Protected Member Functions inherited from writeFile
void initStream (Ostream &os) const
 Initialise the output stream for writing. More...
 
fileName baseFileDir () const
 Return the base directory for output. More...
 
fileName baseTimeDir () const
 Return the base directory for the current time value. More...
 
fileName filePath (const fileName &fName) const
 Return the full path for the supplied file name. More...
 
virtual autoPtr< OFstreamnewFile (const fileName &fName) const
 Return autoPtr to a new file using file name. More...
 
virtual autoPtr< OFstreamnewFileAtTime (const word &name, scalar timeValue) const
 Return autoPtr to a new file for a given time. More...
 
virtual autoPtr< OFstreamnewFileAtStartTime (const word &name) const
 Return autoPtr to a new file using the simulation start time. More...
 
virtual void resetFile (const word &name)
 Reset internal file pointer to new file with new name. More...
 
Omanip< int > valueWidth (const label offset=0) const
 Return the value width when writing to stream with optional offset. More...
 
void operator= (const writeFile &)=delete
 No copy assignment. More...
 
virtual autoPtr< OFstreamcreateFile (const word &name, scalar timeValue) const
 Deprecated(2022-09) Return autoPtr to a new file for a given time. More...
 
virtual autoPtr< OFstreamcreateFile (const word &name) const
 Deprecated(2022-09) Return autoPtr to a new file using the simulation start time. More...
 

Protected Attributes

bool resetOnRestart_
 Reset the averaging process on restart. More...
 
windowType windowType_
 Window type. More...
 
stateFunctionObjectstate_
 Reference to the state functionObject. More...
 
word functionObjectName_
 Name of function object to retrieve data from. More...
 
wordList fieldNames_
 List of fields on which to operate. More...
 
scalar tolerance_
 Optional tolerance to check for converged results. More...
 
scalar window_
 Averaging window. More...
 
List< scalar > totalTime_
 Average time per field. More...
 
- Protected Attributes inherited from writeFile
const objectRegistryfileObr_
 Reference to the region objectRegistry. More...
 
const fileName prefix_
 Prefix. More...
 
word fileName_
 Name of file. More...
 
autoPtr< OFstreamfilePtr_
 File pointer. More...
 
label writePrecision_
 Write precision. More...
 
bool writeToFile_
 Flag to enable/disable writing to file. More...
 
bool updateHeader_
 Flag to update the header, e.g. on mesh changes. Default is true. More...
 
bool writtenHeader_
 Flag to identify whether the header has been written. More...
 
bool useUserTime_
 Flag to use the specified user time, e.g. CA deg instead of seconds. Default = true. More...
 
scalar startTime_
 Start time value. More...
 

Detailed Description

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.

See also
Source files

Definition at line 58 of file valueAverageBase.H.

Member Enumeration Documentation

◆ windowType

enum windowType : uint8_t
strong

Averaging window types.

Enumerator
NONE 

"none"

APPROXIMATE 

"approximate"

EXACT 

"exact"

Definition at line 69 of file valueAverageBase.H.

Constructor & Destructor Documentation

◆ valueAverageBase() [1/2]

valueAverageBase ( const word name,
const objectRegistry obr,
const dictionary dict,
stateFunctionObject state,
const bool  writeToFile = true 
)

Construct from Time and dictionary.

Definition at line 113 of file valueAverageBase.C.

References dict, and Foam::read().

Here is the call graph for this function:

◆ valueAverageBase() [2/2]

valueAverageBase ( const valueAverageBase )
delete

No copy construct.

◆ ~valueAverageBase()

virtual ~valueAverageBase ( )
virtualdefault

Destructor.

Member Function Documentation

◆ calc()

bool calc ( const label  fieldi,
bool &  converged,
dictionary dict 
)
protected

Templated function to calculate the average.

Return true if processed

Definition at line 26 of file valueAverageBaseTemplates.C.

References beta(), LList< LListBase, T >::cbegin(), delta, dict, Foam::indent(), Log, Foam::mag(), Foam::nl, FIFOStack< T >::pop(), FIFOStack< T >::push(), dictionary::readIfPresent(), dictionary::set(), Foam::tab, and Foam::Zero.

Here is the call graph for this function:

◆ writeFileHeader()

void writeFileHeader ( Ostream os) const
protectedvirtual

Output file header information.

Definition at line 41 of file valueAverageBase.C.

References Foam::endl(), valueAverageBase::fieldNames_, forAll, os(), writeFile::writeCommented(), writeFile::writeHeader(), and writeFile::writeTabbed().

Here is the call graph for this function:

◆ readState()

void readState ( dictionary dict)
protectedvirtual

Read state from dictionary.

Definition at line 53 of file valueAverageBase.C.

References dict, forAll, and dictionary::readEntry().

Here is the call graph for this function:

◆ writeState()

void writeState ( dictionary dict)
protectedvirtual

Write state to dictionary for restarts.

Definition at line 79 of file valueAverageBase.C.

References dictionary::add(), dict, and forAll.

Referenced by averageCondition::write(), and valueAverage::write().

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

◆ resetState()

void resetState ( dictionary dict)
protectedvirtual

Reset state.

Definition at line 100 of file valueAverageBase.C.

References dict, and forAll.

Referenced by averageCondition::reset().

Here is the caller graph for this function:

◆ operator=()

void operator= ( const valueAverageBase )
delete

No copy assignment.

◆ read()

bool read ( const dictionary dict)
virtual

Read the field value average data.

Reimplemented from writeFile.

Reimplemented in valueAverage.

Definition at line 140 of file valueAverageBase.C.

References dict, writeFile::read(), and Foam::Zero.

Referenced by valueAverage::read().

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

◆ calculate()

bool calculate ( dictionary dict)
virtual

Calculate the averages.

Definition at line 172 of file valueAverageBase.C.

References dict, Foam::endl(), forAll, Foam::indent(), Log, Foam::nl, Foam::tab, and WarningInFunction.

Referenced by averageCondition::apply(), and valueAverage::execute().

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

Member Data Documentation

◆ windowTypeNames

Names for windowType enumeration.

Definition at line 79 of file valueAverageBase.H.

◆ resetOnRestart_

bool resetOnRestart_
protected

Reset the averaging process on restart.

Definition at line 98 of file valueAverageBase.H.

◆ windowType_

windowType windowType_
protected

Window type.

Definition at line 103 of file valueAverageBase.H.

◆ state_

stateFunctionObject& state_
protected

Reference to the state functionObject.

Definition at line 108 of file valueAverageBase.H.

◆ functionObjectName_

word functionObjectName_
protected

Name of function object to retrieve data from.

Definition at line 113 of file valueAverageBase.H.

◆ fieldNames_

wordList fieldNames_
protected

List of fields on which to operate.

Definition at line 118 of file valueAverageBase.H.

Referenced by valueAverageBase::writeFileHeader().

◆ tolerance_

scalar tolerance_
protected

Optional tolerance to check for converged results.

Definition at line 123 of file valueAverageBase.H.

◆ window_

scalar window_
protected

Averaging window.

Definition at line 128 of file valueAverageBase.H.

◆ totalTime_

List<scalar> totalTime_
protected

Average time per field.

Definition at line 133 of file valueAverageBase.H.


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