OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

fieldAverage Class Reference

Calculates the field averages given list of fieldAverageItems, e.g. More...

Collaboration diagram for fieldAverage:

List of all members.


Public Member Functions

 TypeName ("fieldAverage")
 Runtime type information.
 fieldAverage (const word &name, const objectRegistry &, const dictionary &, const bool loadFromFiles=false)
 Construct for given objectRegistry and dictionary.
virtual ~fieldAverage ()
 Destructor.
virtual const wordname () const
 Return name of the set of field averages.
virtual void read (const dictionary &)
 Read the field average data.
virtual void execute ()
 Execute the averaging.
virtual void end ()
 Execute the averaging at the final time-loop, currently does nothing.
virtual void write ()
 Calculate the field average data and write.

Protected Member Functions

void resetFields (wordList &)
 Checkout fields (causes deletion) from the database.
void initialize ()
 Reset lists (clear existing values) and initialize averaging.
template<class Type >
void addMeanField (const label, wordList &) const
 Add mean average field to list.
template<class Type1 , class Type2 >
void addPrime2MeanField (const label, const wordList &, wordList &) const
 Add prime-squared average field to list.
virtual void calcAverages ()
 Main calculation routine.
template<class Type >
void calculateMeanFields (const wordList &) const
 Calculate mean average fields.
template<class Type1 , class Type2 >
void addMeanSqrToPrime2Mean (const wordList &, const wordList &) const
 Add mean-squared field value to prime-squared mean field.
template<class Type1 , class Type2 >
void calculatePrime2MeanFields (const wordList &, const wordList &) const
 Calculate prime-squared average fields.
virtual void writeAverages () const
 Write averages.
template<class Type >
void writeFieldList (const wordList &) const
 Write fields.
void writeAveragingProperties () const
 Write averaging properties - steps and time.
void readAveragingProperties ()
 Read averaging properties - steps and time.
virtual void updateMesh (const mapPolyMesh &)
 Update mesh.
virtual void movePoints (const Field< point > &)
 Move points.
 fieldAverage (const fieldAverage &)
 Disallow default bitwise copy construct.
void operator= (const fieldAverage &)
 Disallow default bitwise assignment.

Protected Attributes

word name_
 Name of this set of field averages.
const objectRegistryobr_
 Database this class is registered to.
bool active_
 On/off switch.
label prevTimeIndex_
 Time at last call, prevents repeated averaging.
Switch cleanRestart_
 Clean restart flag.
Switch resetOnOutput_
 resetOnOutput flag
List< fieldAverageItemfaItems_
 List of field average items, describing what averages to be.
wordList meanScalarFields_
wordList meanVectorFields_
wordList meanSphericalTensorFields_
wordList meanSymmTensorFields_
wordList meanTensorFields_
wordList prime2MeanScalarFields_
wordList prime2MeanSymmTensorFields_
List< labeltotalIter_
 Iteration steps counter.
List< scalartotalTime_
 Total time counter.

Static Protected Attributes

static const word EXT_MEAN = "Mean"
 Mean average.
static const word EXT_PRIME2MEAN = "Prime2Mean"
 Prime-squared average.

Detailed Description

Calculates the field averages given list of fieldAverageItems, e.g.

fieldAverage1
{
    // Type of functionObject
    type fieldAverage;

    // Where to load it from (if not already in solver)
    functionObjectLibs ("libfieldAverage.so");

    // Whether to perform a clean restart, or start from previous
    // averaging info if available
    cleanRestart true;

    // Whether to reset the averaged fields after they have been written.
    // Used to average over only the preceding write interval for transient
    // cases.
    resetOnOutput true;

    // Fields to be averaged. runTime modifiable!
    fields
    (
        U
        {
            mean            on;
            prime2Mean      on;
            base            time;
        }
        p
        {
            mean            on;
            prime2Mean      on;
            base            time;
        }
    );

Member function calcAverages() calculates the averages.

Member function fieldAverage::write() calls calcAverages(). Average field names are constructed by concatenating the base field with the averaging type, e.g.

  • base field, U
  • arithmetic mean field, UMean
  • prime-squared field, UPrime2Mean

Information regarding the number of averaging steps, and total averaging time are written on a (base) per-field basis to the fieldAveragingProperties dictionary, located in <time>/uniform

Source files

Definition at line 105 of file fieldAverage.H.


Constructor & Destructor Documentation

fieldAverage ( const fieldAverage  )  [protected]

Disallow default bitwise copy construct.

fieldAverage ( 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 290 of file fieldAverage.C.

~fieldAverage (  )  [virtual]

Destructor.

Definition at line 339 of file fieldAverage.C.


Member Function Documentation

void resetFields ( wordList names  )  [protected]

Checkout fields (causes deletion) from the database.

and reset lists

Definition at line 34 of file fieldAverage.C.

void initialize (  )  [protected]

Reset lists (clear existing values) and initialize averaging.

Check requested field averages are valid, populate field lists

Definition at line 49 of file fieldAverage.C.

void addMeanField ( const label  fieldI,
wordList meanFieldList 
) const [inline, protected]

void addPrime2MeanField ( const label  fieldI,
const wordList meanFieldList,
wordList prime2MeanFieldList 
) const [inline, protected]

Add prime-squared average field to list.

Definition at line 82 of file fieldAverageTemplates.C.

void calcAverages (  )  [protected, virtual]

Main calculation routine.

Definition at line 145 of file fieldAverage.C.

Referenced by fieldAverage::end().

Here is the caller graph for this function:

void calculateMeanFields ( const wordList meanFieldList  )  const [inline, protected]

Calculate mean average fields.

Definition at line 139 of file fieldAverageTemplates.C.

void addMeanSqrToPrime2Mean ( const wordList meanFieldList,
const wordList prime2MeanFieldList 
) const [inline, protected]

Add mean-squared field value to prime-squared mean field.

Definition at line 232 of file fieldAverageTemplates.C.

void calculatePrime2MeanFields ( const wordList meanFieldList,
const wordList prime2MeanFieldList 
) const [inline, protected]

Calculate prime-squared average fields.

Definition at line 179 of file fieldAverageTemplates.C.

void writeAverages (  )  const [protected, virtual]

Write averages.

Definition at line 197 of file fieldAverage.C.

void writeFieldList ( const wordList fieldList  )  const [inline, protected]

Write fields.

Definition at line 263 of file fieldAverageTemplates.C.

void writeAveragingProperties (  )  const [protected]

Write averaging properties - steps and time.

Definition at line 210 of file fieldAverage.C.

void readAveragingProperties (  )  [protected]

Read averaging properties - steps and time.

Definition at line 238 of file fieldAverage.C.

void updateMesh ( const mapPolyMesh  )  [protected, virtual]

Update mesh.

Definition at line 398 of file fieldAverage.C.

virtual void movePoints ( const Field< point > &   )  [protected, virtual]

Move points.

void operator= ( const fieldAverage  )  [protected]

Disallow default bitwise assignment.

TypeName ( "fieldAverage"   ) 

Runtime type information.

virtual const word& name (  )  const [inline, virtual]

Return name of the set of field averages.

Definition at line 284 of file fieldAverage.H.

void read ( const dictionary dict  )  [virtual]

Read the field average data.

Definition at line 345 of file fieldAverage.C.

void execute (  )  [virtual]

Execute the averaging.

Definition at line 362 of file fieldAverage.C.

void end (  )  [virtual]

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

Definition at line 371 of file fieldAverage.C.

References fieldAverage::active_, and fieldAverage::calcAverages().

Here is the call graph for this function:

void write (  )  [virtual]

Calculate the field average data and write.

Definition at line 376 of file fieldAverage.C.


Member Data Documentation

const Foam::word EXT_MEAN = "Mean" [static, protected]

Mean average.

Definition at line 112 of file fieldAverage.H.

Referenced by fieldAverage::addMeanField().

const Foam::word EXT_PRIME2MEAN = "Prime2Mean" [static, protected]

Prime-squared average.

Definition at line 115 of file fieldAverage.H.

word name_ [protected]

Name of this set of field averages.

Definition at line 120 of file fieldAverage.H.

const objectRegistry& obr_ [protected]

Database this class is registered to.

Definition at line 123 of file fieldAverage.H.

Referenced by fieldAverage::addMeanField().

bool active_ [protected]

On/off switch.

Definition at line 126 of file fieldAverage.H.

Referenced by fieldAverage::end().

label prevTimeIndex_ [protected]

Time at last call, prevents repeated averaging.

Definition at line 129 of file fieldAverage.H.

Switch cleanRestart_ [protected]

Clean restart flag.

Definition at line 132 of file fieldAverage.H.

Switch resetOnOutput_ [protected]

resetOnOutput flag

Definition at line 135 of file fieldAverage.H.

List of field average items, describing what averages to be.

calculated and output

Definition at line 141 of file fieldAverage.H.

Referenced by fieldAverage::addMeanField().

Definition at line 146 of file fieldAverage.H.

Definition at line 147 of file fieldAverage.H.

Definition at line 148 of file fieldAverage.H.

Definition at line 149 of file fieldAverage.H.

Definition at line 150 of file fieldAverage.H.

Definition at line 154 of file fieldAverage.H.

Definition at line 155 of file fieldAverage.H.

List<label> totalIter_ [protected]

Iteration steps counter.

Definition at line 161 of file fieldAverage.H.

List<scalar> totalTime_ [protected]

Total time counter.

Definition at line 164 of file fieldAverage.H.


The documentation for this class was generated from the following files:
Copyright © 2000-2009 OpenCFD Ltd