FreeFOAM The Cross-Platform CFD Toolkit
cellSource Class Reference

Cell source variant of field value function object. Values of user- specified fields reported for collections of cells. More...

#include <fieldFunctionObjects/cellSource.H>


Detailed Description

Cell source variant of field value function object. Values of user- specified fields reported for collections of cells.

cellObj1// Name also used to identify output folder { typecellSource; functionObjectLibs ("libfieldValueFunctionObjects.so"); enabled true; outputControl outputTime; log true; // log to screen? valueOutput true; // Write values at run-time output times? source cellZone; // Type of cell source sourceName c0; operation volAverage; fields ( p U ); }

where operation is one of:

  • none
  • sum
  • volAverage
  • volIntegrate
  • weightedAverage
Source files

Definition at line 80 of file cellSource.H.

+ Inheritance diagram for cellSource:
+ Collaboration diagram for cellSource:

List of all members.

Public Types

enum  sourceType { stCellZone, stAll }
 Source type enumeration. More...
enum  operationType {
  opNone, opSum, opVolAverage, opVolIntegrate,
  opWeightedAverage, opMin, opMax
}
 Operation type enumeration. More...

Public Member Functions

 TypeName ("cellSource")
 Run-time type information.
 cellSource (const word &name, const objectRegistry &obr, const dictionary &dict, const bool loadFromFiles=false)
 Construct from components.
virtual ~cellSource ()
 Destructor.
const sourceTypesource () const
 Return the source type.
const labelListcellId () const
 Return the local list of cell IDs.
virtual void read (const dictionary &)
 Read from dictionary.
virtual void write ()
 Calculate and write.
template<class Type >
bool writeValues (const word &fieldName)
 Templated helper function to output field values.
template<class Type >
tmp< Field< Type > > filterField (const Field< Type > &field) const
 Filter a field according to cellIds.
- Public Member Functions inherited from fieldValue
 TypeName ("fieldValue")
 Run-time type information.
 fieldValue (const word &name, const objectRegistry &obr, const dictionary &dict, const bool loadFromFiles=false)
 Construct from components.
virtual ~fieldValue ()
 Destructor.
const wordname () const
 Return the name of the geometric source.
const objectRegistryobr () const
 Return the reference to the object registry.
bool active () const
 Return the active flag.
const Switchlog () const
 Return the switch to send output to Info as well as to file.
const wordsourceName () const
 Return the source name.
const wordListfields () const
 Return the list of field names.
const SwitchvalueOutput () const
 Return the output field values flag.
const fvMeshmesh () const
 Helper function to return the reference to the mesh.
virtual void execute ()
 Execute.
virtual void end ()
 Execute the at the final time-loop, currently does nothing.
template<class Type >
tmp< Field< Type > > combineFields (const Field< Type > &field) const
 Comnbine fields from all processor domains into single field.

Static Public Attributes

static const NamedEnum
< sourceType, 2 > 
sourceTypeNames_
 Source type names.
static const NamedEnum
< operationType, 7 > 
operationTypeNames_
 Operation type names.

Protected Member Functions

void initialise (const dictionary &dict)
 Initialise, e.g. cell addressing.
template<class Type >
bool validField (const word &fieldName) const
 Return true if the field name is valid.
template<class Type >
tmp< Field< Type > > setFieldValues (const word &fieldName) const
 Insert field values into values list.
template<class Type >
Type processValues (const Field< Type > &values, const scalarField &V, const scalarField &weightField) const
 Apply the 'operation' to the values.
virtual void writeFileHeader ()
 Output file header information.
- Protected Member Functions inherited from fieldValue
virtual void makeFile ()
 Make the output file.
virtual void updateMesh (const mapPolyMesh &)
 Update mesh.
virtual void movePoints (const Field< point > &)
 Move points.

Protected Attributes

sourceType source_
 Source type.
operationType operation_
 Operation to apply to values.
label nCells_
 Global number of cells.
labelList cellId_
 Local list of cell IDs.
word weightFieldName_
 Weight field name - only used for opWeightedAverage mode.
- Protected Attributes inherited from fieldValue
word name_
 Name of this fieldValue object.
const objectRegistryobr_
 Database this class is registered to.
bool active_
 Active flag.
Switch log_
 Switch to send output to Info as well as to file.
word sourceName_
 Name of source object.
wordList fields_
 List of field names to operate on.
Switch valueOutput_
 Output field values flag.
autoPtr< OFstreamoutputFilePtr_
 Output file pointer.

Member Enumeration Documentation

enum sourceType

Source type enumeration.

Enumerator:
stCellZone 
stAll 

Definition at line 90 of file cellSource.H.

Operation type enumeration.

Enumerator:
opNone 
opSum 
opVolAverage 
opVolIntegrate 
opWeightedAverage 
opMin 
opMax 

Definition at line 101 of file cellSource.H.


Constructor & Destructor Documentation

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

Construct from components.

Definition at line 166 of file cellSource.C.

~cellSource ( )
virtual

Destructor.

Definition at line 185 of file cellSource.C.


Member Function Documentation

void initialise ( const dictionary dict)
protected
bool validField ( const word fieldName) const
protected

Return true if the field name is valid.

Definition at line 33 of file cellSourceTemplates.C.

References objectRegistry::foundObject(), and fieldValue::obr_.

Foam::tmp< Foam::Field< Type > > setFieldValues ( const word fieldName) const
protected

Insert field values into values list.

Definition at line 48 of file cellSourceTemplates.C.

Type processValues ( const Field< Type > &  values,
const scalarField V,
const scalarField weightField 
) const
protected

Apply the 'operation' to the values.

Definition at line 65 of file cellSourceTemplates.C.

References Foam::max(), Foam::min(), and Foam::sum().

void writeFileHeader ( )
protectedvirtual

Output file header information.

Implements fieldValue.

Definition at line 142 of file cellSource.C.

References Foam::endl(), forAll, Foam::nl, and Foam::tab.

TypeName ( "cellSource"  )

Run-time type information.

const Foam::fieldValues::cellSource::sourceType & source ( ) const
inline

Return the source type.

Definition at line 31 of file cellSourceI.H.

References cellSource::source_.

const Foam::labelList & cellId ( ) const
inline

Return the local list of cell IDs.

Definition at line 38 of file cellSourceI.H.

void read ( const dictionary dict)
virtual

Read from dictionary.

Reimplemented from fieldValue.

Definition at line 191 of file cellSource.C.

References fieldValue::read().

void write ( )
virtual

Calculate and write.

Reimplemented from fieldValue.

Definition at line 203 of file cellSource.C.

References Foam::endl(), forAll, Foam::Info, Pstream::master(), mesh, Foam::sum(), Foam::tab, and fieldValue::write().

bool writeValues ( const word fieldName)

Templated helper function to output field values.

Definition at line 117 of file cellSourceTemplates.C.

References Foam::endl(), Foam::Info, Pstream::master(), mesh, IOobject::NO_READ, IOobject::NO_WRITE, Foam::tab, and regIOobject::write().

Foam::tmp< Foam::Field< Type > > filterField ( const Field< Type > &  field) const

Filter a field according to cellIds.

Definition at line 169 of file cellSourceTemplates.C.


Member Data Documentation

const NamedEnum< fieldValues::cellSource::sourceType, 2 > sourceTypeNames_
static

Source type names.

Definition at line 97 of file cellSource.H.

const NamedEnum< fieldValues::cellSource::operationType, 7 > operationTypeNames_
static

Operation type names.

Definition at line 113 of file cellSource.H.

sourceType source_
protected

Source type.

Definition at line 132 of file cellSource.H.

Referenced by cellSource::source().

operationType operation_
protected

Operation to apply to values.

Definition at line 135 of file cellSource.H.

label nCells_
protected

Global number of cells.

Definition at line 138 of file cellSource.H.

labelList cellId_
protected

Local list of cell IDs.

Definition at line 141 of file cellSource.H.

word weightFieldName_
protected

Weight field name - only used for opWeightedAverage mode.

Definition at line 144 of file cellSource.H.


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