Public Member Functions | Protected Member Functions | Protected Attributes
residuals Class Reference

This function object writes out the initial residual for specified fields. More...

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

Public Member Functions

 TypeName ("residuals")
 Runtime type information. More...
 
 residuals (const word &name, const objectRegistry &, const dictionary &, const bool loadFromFiles=false)
 Construct for given objectRegistry and dictionary. More...
 
virtual ~residuals ()
 Destructor. More...
 
virtual const wordname () const
 Return name of the set of field min/max. More...
 
virtual void read (const dictionary &)
 Read the field residuals data. More...
 
virtual void execute ()
 Execute, currently does nothing. More...
 
virtual void end ()
 Execute at the final time-loop, currently does nothing. More...
 
virtual void timeSet ()
 Called when time was set at the end of the Time::operator++. More...
 
template<class Type >
void writeResidual (const word &fieldName)
 Calculate the field residuals. More...
 
virtual void write ()
 Write the residuals. More...
 
virtual void updateMesh (const mapPolyMesh &)
 Update for changes of mesh. More...
 
virtual void movePoints (const polyMesh &)
 Update for changes of mesh. More...
 
- Public Member Functions inherited from functionObjectFile
 functionObjectFile (const objectRegistry &obr, const word &prefix)
 Construct null. More...
 
 functionObjectFile (const objectRegistry &obr, const word &prefix, const word &fileName, const dictionary &dict)
 Construct from components and read options from dictionary. More...
 
virtual ~functionObjectFile ()
 Destructor. More...
 
void read (const dictionary &dict)
 Read. More...
 
OFstreamfile ()
 Return access to the file (if only 1) More...
 
bool writeToFile () const
 Return true if can write to file. More...
 
void writeCommented (Ostream &os, const string &str) const
 Write a commented string to stream. More...
 
void writeTabbed (Ostream &os, const string &str) const
 Write a tabbed string to stream. More...
 
void writeHeader (Ostream &os, const string &str) const
 Write a commented header to stream. More...
 
void writeTime (Ostream &os) const
 Write the current time to 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...
 
label charWidth () const
 Return width of character stream output. More...
 

Protected Member Functions

 residuals (const residuals &)
 Disallow default bitwise copy construct. More...
 
void operator= (const residuals &)
 Disallow default bitwise assignment. More...
 
template<class Type >
void writeFileHeader (const word &fieldName)
 Output field header information. More...
 
virtual void writeFileHeader (Ostream &os) const
 Output file header information. More...
 
- Protected Member Functions inherited from functionObjectFile
virtual void initStream (Ostream &os) const
 Initialise the output stream for writing. More...
 
virtual fileName baseFileDir () const
 Return the base directory for output. More...
 
virtual fileName baseTimeDir () const
 Return the base directory for the current time value. More...
 
virtual autoPtr< OFstreamcreateFile (const word &name) const
 Return an autoPtr to a new file. More...
 
virtual void resetFile (const word &name)
 Reset internal file pointer to new file with new name. More...
 
virtual Omanip< int > valueWidth (const label offset=0) const
 Return the value width when writing to stream with optional offset. More...
 
 functionObjectFile (const functionObjectFile &)
 Disallow default bitwise copy construct. More...
 
void operator= (const functionObjectFile &)
 Disallow default bitwise assignment. More...
 

Protected Attributes

word name_
 Name of this set of residuals. More...
 
const objectRegistryobr_
 
bool active_
 on/off switch More...
 
wordList fieldSet_
 Fields to write residuals. More...
 
- Protected Attributes inherited from functionObjectFile
bool writeToFile_
 Flag to enable/disable writing to file. More...
 

Additional Inherited Members

- Static Public Attributes inherited from functionObjectFile
static const word outputPrefix = "postProcessing"
 Directory prefix. More...
 
static label addChars = 7
 Additional characters for writing. More...
 

Detailed Description

This function object writes out the initial residual for specified fields.

Example of function object specification:

residuals
{
    type            residuals;
    outputControl   timeStep;
    outputInterval  1;
    fields
    (
        U
        p
    );
}

Output data is written to the dir postProcessing/residuals/<timeDir>/ For vector/tensor fields, e.g. U, where an equation is solved for each component, the largest residual of each component is written out.

See also
Foam::functionObject Foam::OutputFilterFunctionObject
Source files

Definition at line 88 of file residuals.H.

Constructor & Destructor Documentation

◆ residuals() [1/2]

residuals ( const residuals )
protected

Disallow default bitwise copy construct.

◆ residuals() [2/2]

residuals ( const word name,
const objectRegistry obr,
const dictionary dict,
const bool  loadFromFiles = false 
)

Construct for given objectRegistry and dictionary.

Allow the possibility to load fields from files

Definition at line 58 of file residuals.C.

References dict, Foam::endl(), Foam::read(), and WarningInFunction.

Here is the call graph for this function:

◆ ~residuals()

~residuals ( )
virtual

Destructor.

Definition at line 90 of file residuals.C.

Member Function Documentation

◆ operator=()

void operator= ( const residuals )
protected

Disallow default bitwise assignment.

◆ writeFileHeader() [1/2]

void writeFileHeader ( const word fieldName)
protected

Output field header information.

◆ writeFileHeader() [2/2]

void writeFileHeader ( Ostream os) const
protectedvirtual

Output file header information.

Definition at line 41 of file residuals.C.

References Foam::endl(), residuals::fieldSet_, forAll, functionObjectFile::writeCommented(), functionObjectFile::writeHeader(), and functionObjectFile::writeTabbed().

Here is the call graph for this function:

◆ TypeName()

TypeName ( "residuals"  )

Runtime type information.

◆ name()

virtual const word& name ( ) const
inlinevirtual

Return name of the set of field min/max.

Definition at line 151 of file residuals.H.

References residuals::name_.

◆ read()

void read ( const dictionary dict)
virtual

Read the field residuals data.

Definition at line 96 of file residuals.C.

References dict, dictionary::lookup(), functionObjectFile::read(), and HashTable::toc().

Here is the call graph for this function:

◆ execute()

void execute ( )
virtual

Execute, currently does nothing.

Definition at line 109 of file residuals.C.

◆ end()

void end ( )
virtual

Execute at the final time-loop, currently does nothing.

Definition at line 113 of file residuals.C.

◆ timeSet()

void timeSet ( )
virtual

Called when time was set at the end of the Time::operator++.

Definition at line 117 of file residuals.C.

◆ writeResidual()

void writeResidual ( const word fieldName)

Calculate the field residuals.

Definition at line 33 of file residualsTemplates.C.

References Foam::component(), functionObjectFile::file(), dictionary::found(), objectRegistry::foundObject(), dictionary::lookup(), objectRegistry::lookupObject(), mesh, residuals::obr_, and token::TAB.

Here is the call graph for this function:

◆ write()

void write ( )
virtual

Write the residuals.

Definition at line 121 of file residuals.C.

References Foam::endl(), forAll, and UPstream::master().

Here is the call graph for this function:

◆ updateMesh()

virtual void updateMesh ( const mapPolyMesh )
inlinevirtual

Update for changes of mesh.

Definition at line 176 of file residuals.H.

◆ movePoints()

virtual void movePoints ( const polyMesh )
inlinevirtual

Update for changes of mesh.

Definition at line 180 of file residuals.H.

Field Documentation

◆ name_

word name_
protected

Name of this set of residuals.

Also used as the name of the output directory

Definition at line 98 of file residuals.H.

Referenced by residuals::name().

◆ obr_

const objectRegistry& obr_
protected

Definition at line 100 of file residuals.H.

Referenced by residuals::writeResidual().

◆ active_

bool active_
protected

on/off switch

Definition at line 103 of file residuals.H.

◆ fieldSet_

wordList fieldSet_
protected

Fields to write residuals.

Definition at line 106 of file residuals.H.

Referenced by residuals::writeFileHeader().


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