FreeFOAM The Cross-Platform CFD Toolkit
faceSource Class Reference

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

#include <fieldFunctionObjects/faceSource.H>


Detailed Description

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

faceObj1// Name also used to identify output folder { typefaceSource; functionObjectLibs ("libfieldValueFunctionObjects.so"); enabled true; outputControl outputTime; log true; // log to screen? valueOutput true; // Write values at run-time output times? source faceZone; // Type of face source: faceZone, patch, sampledSurface sourceName f0; // faceZone or patch, see below operation sum; fields ( p phi U ); }

source:

  • faceZone : requires a 'sourceName' entry to specify the faceZone
  • patch :""patch
  • sampledSurface : requires a 'sampledSurfaceDict' subdictionary. See e.g. sampleDict.

operation is one of:

  • none
  • sum
  • areaAverage
  • areaIntegrate
  • weightedAverage
  • min
  • max

Notes:

  • faces on empty patches get ignored
  • if the field is a volField the faceZone can only consist of boundary faces.
  • all fields get oriented according to the faceZone (so you might e.g. see negative pressure)
  • using sampledSurfaces:
  • they do not do surface fields
  • they use cell values - they do not do any interpolation.
  • take care when using isoSurfaces - these might have duplicate triangles so integration might be wrong
Source files

Definition at line 105 of file faceSource.H.

+ Inheritance diagram for faceSource:
+ Collaboration diagram for faceSource:

List of all members.

Public Types

enum  sourceType { stFaceZone, stPatch, stSampledSurface }
 Source type enumeration. More...
enum  operationType {
  opNone, opSum, opAreaAverage, opAreaIntegrate,
  opWeightedAverage, opMin, opMax
}
 Operation type enumeration. More...

Public Member Functions

 TypeName ("faceSource")
 Run-time type information.
 faceSource (const word &name, const objectRegistry &obr, const dictionary &dict, const bool loadFromFiles=false)
 Construct from components.
virtual ~faceSource ()
 Destructor.
const sourceType & source () const
 Return the source type.
const labelList & faceId () const
 Return the local list of face IDs.
const labelList & facePatch () const
 Return the local list of patch ID per face.
const labelList & faceSign () const
 Return the list of +1/-1 representing face flip map.
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 GeometricField< Type, fvsPatchField, surfaceMesh > &field, const bool applyOrientation) const
 Filter a surface field according to faceIds.
template<class Type >
tmp< Field< Type > > filterField (const GeometricField< Type, fvPatchField, volMesh > &field, const bool applyOrientation) const
 Filter a volume field according to faceIds.
- 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 word & name () const
 Return the name of the geometric source.
const objectRegistry & obr () const
 Return the reference to the object registry.
bool active () const
 Return the active flag.
const Switch & log () const
 Return the switch to send output to Info as well as to file.
const word & sourceName () const
 Return the source name.
const wordList & fields () const
 Return the list of field names.
const Switch & valueOutput () const
 Return the output field values flag.
const fvMesh & mesh () 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, 3 > 
sourceTypeNames_
 Source type names.
static const NamedEnum
< operationType, 7 > 
operationTypeNames_
 Operation type names.

Protected Member Functions

void initialise (const dictionary &dict)
 Initialise, e.g. face 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
 Return field values by looking up field name.
template<class Type >
Type processValues (const Field< Type > &values, const scalarField &magSf, 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.
word weightFieldName_
 Weight field name - only used for opWeightedAverage mode.
label nFaces_
 Global number of faces.
labelList faceId_
 Local list of face IDs.
labelList facePatchId_
 Local list of patch ID per face.
labelList faceSign_
 List of +1/-1 representing face flip map (1 use as is, -1 negate)
autoPtr< sampledSurface > surfacePtr_
 underlying sampledSurface
- Protected Attributes inherited from fieldValue
word name_
 Name of this fieldValue object.
const objectRegistry & obr_
 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< OFstream > outputFilePtr_
 Output file pointer.

Member Enumeration Documentation

enum sourceType

Source type enumeration.

Enumerator:
stFaceZone 
stPatch 
stSampledSurface 

Definition at line 115 of file faceSource.H.

Operation type enumeration.

Enumerator:
opNone 
opSum 
opAreaAverage 
opAreaIntegrate 
opWeightedAverage 
opMin 
opMax 

Definition at line 127 of file faceSource.H.


Constructor & Destructor Documentation

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

Construct from components.

Definition at line 317 of file faceSource.C.

~faceSource ( )
virtual

Destructor.

Definition at line 339 of file faceSource.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 34 of file faceSourceTemplates.C.

References objectRegistry::foundObject(), fieldValue::obr_, sf(), faceSource::source_, and faceSource::stSampledSurface.

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

Return field values by looking up field name.

Definition at line 54 of file faceSourceTemplates.C.

References sf().

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

Apply the 'operation' to the values.

Definition at line 83 of file faceSourceTemplates.C.

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

void writeFileHeader ( )
protectedvirtual

Output file header information.

Implements fieldValue.

Definition at line 293 of file faceSource.C.

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

TypeName ( "faceSource"  )

Run-time type information.

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

Return the source type.

Definition at line 31 of file faceSourceI.H.

References faceSource::source_.

const Foam::labelList & faceId ( ) const
inline

Return the local list of face IDs.

Definition at line 38 of file faceSourceI.H.

const Foam::labelList & facePatch ( ) const
inline

Return the local list of patch ID per face.

Definition at line 45 of file faceSourceI.H.

const Foam::labelList & faceSign ( ) const
inline

Return the list of +1/-1 representing face flip map.

Definition at line 52 of file faceSourceI.H.

void read ( const dictionary &  dict)
virtual

Read from dictionary.

Reimplemented from fieldValue.

Definition at line 345 of file faceSource.C.

References fieldValue::read().

void write ( )
virtual

Calculate and write.

Reimplemented from fieldValue.

Definition at line 356 of file faceSource.C.

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

bool writeValues ( const word &  fieldName)

Templated helper function to output field values.

Definition at line 135 of file faceSourceTemplates.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 GeometricField< Type, fvsPatchField, surfaceMesh > &  field,
const bool  applyOrientation 
) const

Filter a surface field according to faceIds.

Definition at line 244 of file faceSourceTemplates.C.

References GeometricField< Type, PatchField, GeoMesh >::boundaryField(), and forAll.

Foam::tmp< Foam::Field< Type > > filterField ( const GeometricField< Type, fvPatchField, volMesh > &  field,
const bool  applyOrientation 
) const

Member Data Documentation

const NamedEnum< fieldValues::faceSource::sourceType, 3 > sourceTypeNames_
static

Source type names.

Definition at line 123 of file faceSource.H.

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

Operation type names.

Definition at line 139 of file faceSource.H.

sourceType source_
protected

Source type.

Definition at line 161 of file faceSource.H.

Referenced by faceSource::source(), and faceSource::validField().

operationType operation_
protected

Operation to apply to values.

Definition at line 164 of file faceSource.H.

word weightFieldName_
protected

Weight field name - only used for opWeightedAverage mode.

Definition at line 167 of file faceSource.H.

label nFaces_
protected

Global number of faces.

Definition at line 170 of file faceSource.H.

labelList faceId_
protected

Local list of face IDs.

Definition at line 175 of file faceSource.H.

labelList facePatchId_
protected

Local list of patch ID per face.

Definition at line 178 of file faceSource.H.

labelList faceSign_
protected

List of +1/-1 representing face flip map (1 use as is, -1 negate)

Definition at line 181 of file faceSource.H.

autoPtr<sampledSurface> surfacePtr_
protected

underlying sampledSurface

Definition at line 186 of file faceSource.H.


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