functionObjects: renamed faceSource -> surfaceRegion, cellSource -> volRegion

The use of the term 'source' in the context of post-processing is
confusing and does not properly describe the process of region
selection.  The new names 'surfaceRegion' and 'volRegion' better
describe the purpose of the functionObjects which is to provide field
processing functionality limited to a specified region of space, either
a surface or volume.

The keyword 'source' is renamed 'regionType' which better describes the
purpose which is to specify the method by which the surface or volume
region is selected.

The keyword to select the name of the surface or volume region is
renamed from 'sourceName' to 'name' consistent with the other
name-changes above.
This commit is contained in:
Henry Weller
2016-06-12 20:56:51 +01:00
parent 621432fea5
commit 1d7e1a7ad5
99 changed files with 9723 additions and 259 deletions

View File

@ -8,8 +8,8 @@ fieldMinMax/fieldMinMax.C
fieldValues/fieldValue/fieldValue.C
fieldValues/fieldValue/fieldValueNew.C
fieldValues/fieldValueDelta/fieldValueDelta.C
fieldValues/cellSource/cellSource.C
fieldValues/faceSource/faceSource.C
fieldValues/volRegion/volRegion.C
fieldValues/surfaceRegion/surfaceRegion.C
nearWallFields/nearWallFields.C
nearWallFields/findCellParticle.C

View File

@ -48,7 +48,7 @@ functions
{
faceObj1
{
type faceSource;
type surfaceRegion;
libs ("libfieldFunctionObjects.so");
enabled true;
@ -64,7 +64,7 @@ functions
source patch;
// if patch or faceZone: name of patch or faceZone
sourceName movingWall;
name movingWall;
//// if sampledSurface: dictionary with a sampledSurface
//// Note: will not sample surface fields.
@ -90,14 +90,14 @@ functions
faceObj2
{
type faceSource;
type surfaceRegion;
libs ("libfieldFunctionObjects.so");
enabled true;
writeControl writeTime;
log true;
writeFields true;
source faceZone;
sourceName f0;
name f0;
operation sum;
fields
@ -108,14 +108,14 @@ functions
cellObj1
{
type cellSource;
type volRegion;
libs ("libfieldFunctionObjects.so");
enabled true;
writeControl writeTime;
log true;
writeFields true;
source cellZone;
sourceName c0;
name c0;
operation volAverage;
fields

View File

@ -51,7 +51,7 @@ Foam::functionObjects::fieldValue::fieldValue
:
writeFiles(name, runTime, dict, name),
dict_(dict),
sourceName_(word::null),
name_(word::null),
resultDict_(fileName("name"), dictionary::null)
{
read(dict);
@ -69,7 +69,7 @@ Foam::functionObjects::fieldValue::fieldValue
:
writeFiles(name, obr, dict, name),
dict_(dict),
sourceName_(word::null),
name_(word::null),
resultDict_(fileName("name"), dictionary::null)
{
read(dict);

View File

@ -70,7 +70,7 @@ protected:
dictionary dict_;
//- Name of source object
word sourceName_;
word name_;
//- List of field names to operate on
wordList fields_;
@ -154,7 +154,7 @@ public:
inline const dictionary& dict() const;
//- Return the source name
inline const word& sourceName() const;
inline const word& name() const;
//- Return the list of field names
inline const wordList& fields() const;

View File

@ -34,9 +34,9 @@ inline const Foam::dictionary& Foam::functionObjects::fieldValue::dict() const
}
inline const Foam::word& Foam::functionObjects::fieldValue::sourceName() const
inline const Foam::word& Foam::functionObjects::fieldValue::name() const
{
return sourceName_;
return name_;
}

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "faceSource.H"
#include "surfaceRegion.H"
#include "fvMesh.H"
#include "cyclicPolyPatch.H"
#include "emptyPolyPatch.H"
@ -42,9 +42,9 @@ namespace functionObjects
{
namespace fieldValues
{
defineTypeNameAndDebug(faceSource, 0);
addToRunTimeSelectionTable(fieldValue, faceSource, dictionary);
addToRunTimeSelectionTable(functionObject, faceSource, dictionary);
defineTypeNameAndDebug(surfaceRegion, 0);
addToRunTimeSelectionTable(fieldValue, surfaceRegion, dictionary);
addToRunTimeSelectionTable(functionObject, surfaceRegion, dictionary);
}
}
}
@ -52,7 +52,7 @@ namespace fieldValues
template<>
const char* Foam::NamedEnum
<
Foam::functionObjects::fieldValues::faceSource::sourceType,
Foam::functionObjects::fieldValues::surfaceRegion::regionTypes,
3
>::names[] =
{
@ -64,7 +64,7 @@ const char* Foam::NamedEnum
template<>
const char* Foam::NamedEnum
<
Foam::functionObjects::fieldValues::faceSource::operationType,
Foam::functionObjects::fieldValues::surfaceRegion::operationType,
15
>::names[] =
{
@ -87,29 +87,29 @@ const char* Foam::NamedEnum
const Foam::NamedEnum
<
Foam::functionObjects::fieldValues::faceSource::sourceType,
Foam::functionObjects::fieldValues::surfaceRegion::regionTypes,
3
> Foam::functionObjects::fieldValues::faceSource::sourceTypeNames_;
> Foam::functionObjects::fieldValues::surfaceRegion::regionTypeNames_;
const Foam::NamedEnum
<
Foam::functionObjects::fieldValues::faceSource::operationType,
Foam::functionObjects::fieldValues::surfaceRegion::operationType,
15
> Foam::functionObjects::fieldValues::faceSource::operationTypeNames_;
> Foam::functionObjects::fieldValues::surfaceRegion::operationTypeNames_;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::functionObjects::fieldValues::faceSource::setFaceZoneFaces()
void Foam::functionObjects::fieldValues::surfaceRegion::setFaceZoneFaces()
{
label zoneId = mesh().faceZones().findZoneID(sourceName_);
label zoneId = mesh().faceZones().findZoneID(name_);
if (zoneId < 0)
{
FatalErrorInFunction
<< type() << " " << name() << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
<< " Unknown face zone name: " << sourceName_
<< regionTypeNames_[regionType_] << "(" << name_ << "):" << nl
<< " Unknown face zone name: " << name_
<< ". Valid face zones are: " << mesh().faceZones().names()
<< nl << exit(FatalError);
}
@ -185,16 +185,16 @@ void Foam::functionObjects::fieldValues::faceSource::setFaceZoneFaces()
}
void Foam::functionObjects::fieldValues::faceSource::setPatchFaces()
void Foam::functionObjects::fieldValues::surfaceRegion::setPatchFaces()
{
const label patchid = mesh().boundaryMesh().findPatchID(sourceName_);
const label patchid = mesh().boundaryMesh().findPatchID(name_);
if (patchid < 0)
{
FatalErrorInFunction
<< type() << " " << name() << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
<< " Unknown patch name: " << sourceName_
<< regionTypeNames_[regionType_] << "(" << name_ << "):" << nl
<< " Unknown patch name: " << name_
<< ". Valid patch names are: "
<< mesh().boundaryMesh().names() << nl
<< exit(FatalError);
@ -222,7 +222,7 @@ void Foam::functionObjects::fieldValues::faceSource::setPatchFaces()
}
void Foam::functionObjects::fieldValues::faceSource::sampledSurfaceFaces
void Foam::functionObjects::fieldValues::surfaceRegion::sampledSurfaceFaces
(
const dictionary& dict
)
@ -238,7 +238,7 @@ void Foam::functionObjects::fieldValues::faceSource::sampledSurfaceFaces
}
void Foam::functionObjects::fieldValues::faceSource::combineMeshGeometry
void Foam::functionObjects::fieldValues::surfaceRegion::combineMeshGeometry
(
faceList& faces,
pointField& points
@ -359,7 +359,7 @@ void Foam::functionObjects::fieldValues::faceSource::combineMeshGeometry
}
void Foam::functionObjects::fieldValues::faceSource::combineSurfaceGeometry
void Foam::functionObjects::fieldValues::surfaceRegion::combineSurfaceGeometry
(
faceList& faces,
pointField& points
@ -398,7 +398,8 @@ void Foam::functionObjects::fieldValues::faceSource::combineSurfaceGeometry
}
Foam::scalar Foam::functionObjects::fieldValues::faceSource::totalArea() const
Foam::scalar
Foam::functionObjects::fieldValues::surfaceRegion::totalArea() const
{
scalar totalArea;
@ -417,14 +418,14 @@ Foam::scalar Foam::functionObjects::fieldValues::faceSource::totalArea() const
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::functionObjects::fieldValues::faceSource::initialise
void Foam::functionObjects::fieldValues::surfaceRegion::initialise
(
const dictionary& dict
)
{
dict.lookup("sourceName") >> sourceName_;
dict.lookup("name") >> name_;
switch (source_)
switch (regionType_)
{
case stFaceZone:
{
@ -445,9 +446,9 @@ void Foam::functionObjects::fieldValues::faceSource::initialise
{
FatalErrorInFunction
<< type() << " " << name() << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
<< nl << " Unknown source type. Valid source types are:"
<< sourceTypeNames_.sortedToc() << nl << exit(FatalError);
<< regionTypeNames_[regionType_] << "(" << name_ << "):"
<< nl << " Unknown region type. Valid region types are:"
<< regionTypeNames_.sortedToc() << nl << exit(FatalError);
}
}
@ -455,8 +456,8 @@ void Foam::functionObjects::fieldValues::faceSource::initialise
{
FatalErrorInFunction
<< type() << " " << name() << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
<< " Source has no faces" << exit(FatalError);
<< regionTypeNames_[regionType_] << "(" << name_ << "):" << nl
<< " Region has no faces" << exit(FatalError);
}
if (surfacePtr_.valid())
@ -476,7 +477,7 @@ void Foam::functionObjects::fieldValues::faceSource::initialise
{
Info<< " weight field = " << weightFieldName_ << nl;
if (source_ == stSampledSurface)
if (regionType_ == stSampledSurface)
{
FatalIOErrorInFunction(dict)
<< "Cannot use weightField for a sampledSurface"
@ -532,13 +533,13 @@ void Foam::functionObjects::fieldValues::faceSource::initialise
}
void Foam::functionObjects::fieldValues::faceSource::writeFileHeader
void Foam::functionObjects::fieldValues::surfaceRegion::writeFileHeader
(
const label i
)
{
writeCommented(file(), "Source : ");
file() << sourceTypeNames_[source_] << " " << sourceName_ << endl;
writeCommented(file(), "Region type : ");
file() << regionTypeNames_[regionType_] << " " << name_ << endl;
writeCommented(file(), "Faces : ");
file() << nFaces_ << endl;
writeCommented(file(), "Area : ");
@ -562,7 +563,7 @@ void Foam::functionObjects::fieldValues::faceSource::writeFileHeader
template<>
Foam::scalar Foam::functionObjects::fieldValues::faceSource::processValues
Foam::scalar Foam::functionObjects::fieldValues::surfaceRegion::processValues
(
const Field<scalar>& values,
const vectorField& Sf,
@ -593,7 +594,7 @@ Foam::scalar Foam::functionObjects::fieldValues::faceSource::processValues
template<>
Foam::vector Foam::functionObjects::fieldValues::faceSource::processValues
Foam::vector Foam::functionObjects::fieldValues::surfaceRegion::processValues
(
const Field<vector>& values,
const vectorField& Sf,
@ -639,7 +640,7 @@ Foam::vector Foam::functionObjects::fieldValues::faceSource::processValues
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::fieldValues::faceSource::faceSource
Foam::functionObjects::fieldValues::surfaceRegion::surfaceRegion
(
const word& name,
const Time& runTime,
@ -648,7 +649,7 @@ Foam::functionObjects::fieldValues::faceSource::faceSource
:
fieldValue(name, runTime, dict, typeName),
surfaceWriterPtr_(NULL),
source_(sourceTypeNames_.read(dict.lookup("source"))),
regionType_(regionTypeNames_.read(dict.lookup("regionType"))),
operation_(operationTypeNames_.read(dict.lookup("operation"))),
weightFieldName_("none"),
orientWeightField_(false),
@ -669,7 +670,7 @@ Foam::functionObjects::fieldValues::faceSource::faceSource
read(dict);
}
Foam::functionObjects::fieldValues::faceSource::faceSource
Foam::functionObjects::fieldValues::surfaceRegion::surfaceRegion
(
const word& name,
const objectRegistry& obr,
@ -678,7 +679,7 @@ Foam::functionObjects::fieldValues::faceSource::faceSource
:
fieldValue(name, obr, dict, typeName),
surfaceWriterPtr_(NULL),
source_(sourceTypeNames_.read(dict.lookup("source"))),
regionType_(regionTypeNames_.read(dict.lookup("regionType"))),
operation_(operationTypeNames_.read(dict.lookup("operation"))),
weightFieldName_("none"),
orientWeightField_(false),
@ -702,13 +703,13 @@ Foam::functionObjects::fieldValues::faceSource::faceSource
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fieldValues::faceSource::~faceSource()
Foam::functionObjects::fieldValues::surfaceRegion::~surfaceRegion()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::fieldValues::faceSource::read
bool Foam::functionObjects::fieldValues::surfaceRegion::read
(
const dictionary& dict
)
@ -720,7 +721,7 @@ bool Foam::functionObjects::fieldValues::faceSource::read
}
bool Foam::functionObjects::fieldValues::faceSource::write
bool Foam::functionObjects::fieldValues::surfaceRegion::write
(
const bool postProcess
)

View File

@ -22,13 +22,13 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjects::fieldValues::faceSource
Foam::functionObjects::fieldValues::surfaceRegion
Group
grpFieldFunctionObjects
Description
This function object provides a 'face source' variant of the fieldValues
This function object provides a 'face regionType' variant of the fieldValues
function object. Given a list of user-specified fields and a selection
of mesh (or general surface) faces, a number of operations can be
performed, such as sums, averages and integrations.
@ -39,16 +39,16 @@ Description
Example of function object specification:
\verbatim
faceSource1
surfaceRegion1
{
type faceSource;
type surfaceRegion;
libs ("libfieldFunctionObjects.so");
...
log yes;
writeFields true;
surfaceFormat none;
source faceZone;
sourceName f0;
regionType faceZone;
name f0;
operation sum;
weightField alpha1;
fields
@ -63,13 +63,13 @@ Description
\heading Function object usage
\table
Property | Description | Required | Default value
type | type name: faceSource | yes |
type | type name: surfaceRegion | yes |
log | write data to standard output | no | no
writeFields | write the output values | yes |
writeArea | Write the area of the faceSource | no |
writeArea | Write the area of the surfaceRegion | no |
surfaceFormat | output value format | no |
source | face source: see below | yes |
sourceName | name of face source if required | no |
regionType | face regionType: see below | yes |
name | name of face regionType if required | no |
operation | operation to perform | yes |
weightField | name of field to apply weighting | no |
orientedWeightField | name of oriented field to apply weighting | no |
@ -79,10 +79,10 @@ Description
\endtable
\linebreak
Where \c source is defined by
Where \c regionType is defined by
\plaintable
faceZone | requires a 'sourceName' entry to specify the faceZone
patch | requires a 'sourceName' entry to specify the patch
faceZone | requires a 'name' entry to specify the faceZone
patch | requires a 'name' entry to specify the patch
sampledSurface | requires a 'sampledSurfaceDict' sub-dictionary
\endplaintable
@ -130,13 +130,13 @@ SeeAlso
Foam::functionObject
SourceFiles
faceSource.C
faceSourceTemplates.C
surfaceRegion.C
surfaceRegionTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_faceSource_H
#define functionObjects_faceSource_H
#ifndef functionObjects_surfaceRegion_H
#define functionObjects_surfaceRegion_H
#include "fieldValue.H"
#include "NamedEnum.H"
@ -155,10 +155,10 @@ namespace fieldValues
{
/*---------------------------------------------------------------------------*\
Class faceSource Declaration
Class surfaceRegion Declaration
\*---------------------------------------------------------------------------*/
class faceSource
class surfaceRegion
:
public fieldValue
{
@ -167,16 +167,16 @@ public:
// Public data types
//- Source type enumeration
enum sourceType
//- region type enumeration
enum regionTypes
{
stFaceZone,
stPatch,
stSampledSurface
};
//- Source type names
static const NamedEnum<sourceType, 3> sourceTypeNames_;
//- region type names
static const NamedEnum<regionTypes, 3> regionTypeNames_;
//- Operation type enumeration
@ -230,7 +230,7 @@ private:
pointField& points
) const;
//- Calculate and return total area of the faceSource: sum(magSf)
//- Calculate and return total area of the surfaceRegion: sum(magSf)
scalar totalArea() const;
@ -241,8 +241,8 @@ protected:
//- Surface writer
autoPtr<surfaceWriter> surfaceWriterPtr_;
//- Source type
sourceType source_;
//- region type
regionTypes regionType_;
//- Operation to apply to values
operationType operation_;
@ -259,10 +259,10 @@ protected:
//- Scale factor - optional
scalar scaleFactor_;
//- Total area of the faceSource
//- Total area of the surfaceRegion
scalar totalArea_;
//- Optionally write the area of the faceSource
//- Optionally write the area of the surfaceRegion
bool writeArea_;
//- Global number of faces
@ -333,13 +333,13 @@ protected:
public:
//- Run-time type information
TypeName("faceSource");
TypeName("surfaceRegion");
// Constructors
//- Construct from name, Time and dictionary
faceSource
surfaceRegion
(
const word& name,
const Time& runTime,
@ -347,7 +347,7 @@ public:
);
//- Construct from name, objectRegistry and dictionary
faceSource
surfaceRegion
(
const word& name,
const objectRegistry& obr,
@ -356,13 +356,13 @@ public:
//- Destructor
virtual ~faceSource();
virtual ~surfaceRegion();
// Public Member Functions
//- Return the source type
inline const sourceType& source() const;
//- Return the region type
inline const regionTypes& regionType() const;
//- Return the local list of face IDs
inline const labelList& faceId() const;
@ -408,7 +408,7 @@ public:
//- Specialisation for scalar
template<>
scalar faceSource::processValues
scalar surfaceRegion::processValues
(
const Field<scalar>& values,
const vectorField& Sf,
@ -418,7 +418,7 @@ scalar faceSource::processValues
//- Specialisation for vector
template<>
vector faceSource::processValues
vector surfaceRegion::processValues
(
const Field<vector>& values,
const vectorField& Sf,
@ -434,12 +434,12 @@ vector faceSource::processValues
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "faceSourceI.H"
#include "surfaceRegionI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "faceSourceTemplates.C"
#include "surfaceRegionTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -23,33 +23,33 @@ License
\*---------------------------------------------------------------------------*/
#include "faceSource.H"
#include "surfaceRegion.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::functionObjects::fieldValues::faceSource::sourceType&
Foam::functionObjects::fieldValues::faceSource::source() const
inline const Foam::functionObjects::fieldValues::surfaceRegion::regionTypes&
Foam::functionObjects::fieldValues::surfaceRegion::regionType() const
{
return source_;
return regionType_;
}
inline const Foam::labelList&
Foam::functionObjects::fieldValues::faceSource::faceId() const
Foam::functionObjects::fieldValues::surfaceRegion::faceId() const
{
return faceId_;
}
inline const Foam::labelList&
Foam::functionObjects::fieldValues::faceSource::facePatch() const
Foam::functionObjects::fieldValues::surfaceRegion::facePatch() const
{
return facePatchId_;
}
inline const Foam::labelList&
Foam::functionObjects::fieldValues::faceSource::faceSign() const
Foam::functionObjects::fieldValues::surfaceRegion::faceSign() const
{
return faceSign_;
}

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "faceSource.H"
#include "surfaceRegion.H"
#include "surfaceFields.H"
#include "volFields.H"
#include "sampledSurface.H"
@ -33,7 +33,7 @@ License
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type>
bool Foam::functionObjects::fieldValues::faceSource::validField
bool Foam::functionObjects::fieldValues::surfaceRegion::validField
(
const word& fieldName
) const
@ -41,7 +41,7 @@ bool Foam::functionObjects::fieldValues::faceSource::validField
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
typedef GeometricField<Type, fvPatchField, volMesh> vf;
if (source_ != stSampledSurface && obr_.foundObject<sf>(fieldName))
if (regionType_ != stSampledSurface && obr_.foundObject<sf>(fieldName))
{
return true;
}
@ -56,7 +56,7 @@ bool Foam::functionObjects::fieldValues::faceSource::validField
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::functionObjects::fieldValues::faceSource::getFieldValues
Foam::functionObjects::fieldValues::surfaceRegion::getFieldValues
(
const word& fieldName,
const bool mustGet,
@ -66,7 +66,7 @@ Foam::functionObjects::fieldValues::faceSource::getFieldValues
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
typedef GeometricField<Type, fvPatchField, volMesh> vf;
if (source_ != stSampledSurface && obr_.foundObject<sf>(fieldName))
if (regionType_ != stSampledSurface && obr_.foundObject<sf>(fieldName))
{
return filterField(obr_.lookupObject<sf>(fieldName), applyOrientation);
}
@ -125,7 +125,7 @@ Foam::functionObjects::fieldValues::faceSource::getFieldValues
template<class Type>
Type Foam::functionObjects::fieldValues::faceSource::processSameTypeValues
Type Foam::functionObjects::fieldValues::surfaceRegion::processSameTypeValues
(
const Field<Type>& values,
const vectorField& Sf,
@ -254,7 +254,7 @@ Type Foam::functionObjects::fieldValues::faceSource::processSameTypeValues
template<class Type>
Type Foam::functionObjects::fieldValues::faceSource::processValues
Type Foam::functionObjects::fieldValues::surfaceRegion::processValues
(
const Field<Type>& values,
const vectorField& Sf,
@ -269,7 +269,7 @@ Type Foam::functionObjects::fieldValues::faceSource::processValues
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
bool Foam::functionObjects::fieldValues::faceSource::writeValues
bool Foam::functionObjects::fieldValues::surfaceRegion::writeValues
(
const word& fieldName,
const scalarField& weightField,
@ -321,7 +321,7 @@ bool Foam::functionObjects::fieldValues::faceSource::writeValues
surfaceWriterPtr_->write
(
outputDir,
word(sourceTypeNames_[source_]) + "_" + sourceName_,
word(regionTypeNames_[regionType_]) + "_" + name_,
points,
faces,
fieldName,
@ -345,7 +345,7 @@ bool Foam::functionObjects::fieldValues::faceSource::writeValues
file()<< tab << result;
Log << " " << operationTypeNames_[operation_]
<< "(" << sourceName_ << ") of " << fieldName
<< "(" << name_ << ") of " << fieldName
<< " = " << result << endl;
}
}
@ -356,7 +356,7 @@ bool Foam::functionObjects::fieldValues::faceSource::writeValues
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::functionObjects::fieldValues::faceSource::filterField
Foam::functionObjects::fieldValues::surfaceRegion::filterField
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const bool applyOrientation
@ -377,7 +377,7 @@ Foam::functionObjects::fieldValues::faceSource::filterField
{
FatalErrorInFunction
<< type() << " " << name() << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
<< regionTypeNames_[regionType_] << "(" << name_ << "):"
<< nl
<< " Unable to process internal faces for volume field "
<< field.name() << nl << abort(FatalError);
@ -398,7 +398,7 @@ Foam::functionObjects::fieldValues::faceSource::filterField
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::functionObjects::fieldValues::faceSource::filterField
Foam::functionObjects::fieldValues::surfaceRegion::filterField
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& field,
const bool applyOrientation

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "cellSource.H"
#include "volRegion.H"
#include "fvMesh.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
@ -36,9 +36,9 @@ namespace functionObjects
{
namespace fieldValues
{
defineTypeNameAndDebug(cellSource, 0);
addToRunTimeSelectionTable(fieldValue, cellSource, dictionary);
addToRunTimeSelectionTable(functionObject, cellSource, dictionary);
defineTypeNameAndDebug(volRegion, 0);
addToRunTimeSelectionTable(fieldValue, volRegion, dictionary);
addToRunTimeSelectionTable(functionObject, volRegion, dictionary);
}
}
}
@ -47,7 +47,7 @@ template<>
const char*
Foam::NamedEnum
<
Foam::functionObjects::fieldValues::cellSource::sourceType,
Foam::functionObjects::fieldValues::volRegion::regionTypes,
2
>::names[] = {"cellZone", "all"};
@ -55,7 +55,7 @@ template<>
const char*
Foam::NamedEnum
<
Foam::functionObjects::fieldValues::cellSource::operationType,
Foam::functionObjects::fieldValues::volRegion::operationType,
11
>::names[] =
{
@ -74,33 +74,33 @@ Foam::NamedEnum
const Foam::NamedEnum
<
Foam::functionObjects::fieldValues::cellSource::sourceType,
Foam::functionObjects::fieldValues::volRegion::regionTypes,
2
> Foam::functionObjects::fieldValues::cellSource::sourceTypeNames_;
> Foam::functionObjects::fieldValues::volRegion::regionTypeNames_;
const Foam::NamedEnum
<
Foam::functionObjects::fieldValues::cellSource::operationType,
Foam::functionObjects::fieldValues::volRegion::operationType,
11
> Foam::functionObjects::fieldValues::cellSource::operationTypeNames_;
> Foam::functionObjects::fieldValues::volRegion::operationTypeNames_;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::functionObjects::fieldValues::cellSource::setCellZoneCells()
void Foam::functionObjects::fieldValues::volRegion::setCellZoneCells()
{
switch (source_)
switch (regionType_)
{
case stCellZone:
{
dict().lookup("sourceName") >> sourceName_;
dict().lookup("name") >> name_;
label zoneId = mesh().cellZones().findZoneID(sourceName_);
label zoneId = mesh().cellZones().findZoneID(name_);
if (zoneId < 0)
{
FatalErrorInFunction
<< "Unknown cell zone name: " << sourceName_
<< "Unknown cell zone name: " << name_
<< ". Valid cell zones are: " << mesh().cellZones().names()
<< nl << exit(FatalError);
}
@ -120,19 +120,19 @@ void Foam::functionObjects::fieldValues::cellSource::setCellZoneCells()
default:
{
FatalErrorInFunction
<< "Unknown source type. Valid source types are:"
<< sourceTypeNames_ << nl << exit(FatalError);
<< "Unknown region type. Valid region types are:"
<< regionTypeNames_ << nl << exit(FatalError);
}
}
if (debug)
{
Pout<< "Selected source size = " << cellId_.size() << endl;
Pout<< "Selected region size = " << cellId_.size() << endl;
}
}
Foam::scalar Foam::functionObjects::fieldValues::cellSource::volume() const
Foam::scalar Foam::functionObjects::fieldValues::volRegion::volume() const
{
return gSum(filterField(mesh().V()));
}
@ -140,7 +140,7 @@ Foam::scalar Foam::functionObjects::fieldValues::cellSource::volume() const
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::functionObjects::fieldValues::cellSource::initialise
void Foam::functionObjects::fieldValues::volRegion::initialise
(
const dictionary& dict
)
@ -151,14 +151,14 @@ void Foam::functionObjects::fieldValues::cellSource::initialise
{
FatalErrorInFunction
<< type() << " " << name() << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
<< " Source has no cells" << exit(FatalError);
<< regionTypeNames_[regionType_] << "(" << name_ << "):" << nl
<< " Region has no cells" << exit(FatalError);
}
volume_ = volume();
Info<< type() << " " << name() << ":"
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
<< regionTypeNames_[regionType_] << "(" << name_ << "):" << nl
<< " total cells = " << nCells_ << nl
<< " total volume = " << volume_
<< nl << endl;
@ -172,13 +172,13 @@ void Foam::functionObjects::fieldValues::cellSource::initialise
}
void Foam::functionObjects::fieldValues::cellSource::writeFileHeader
void Foam::functionObjects::fieldValues::volRegion::writeFileHeader
(
const label i
)
{
writeCommented(file(), "Source : ");
file() << sourceTypeNames_[source_] << " " << sourceName_ << endl;
writeCommented(file(), "Region type : ");
file() << regionTypeNames_[regionType_] << " " << name_ << endl;
writeCommented(file(), "Cells : ");
file() << nCells_ << endl;
writeCommented(file(), "Volume : ");
@ -203,7 +203,7 @@ void Foam::functionObjects::fieldValues::cellSource::writeFileHeader
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::fieldValues::cellSource::cellSource
Foam::functionObjects::fieldValues::volRegion::volRegion
(
const word& name,
const Time& runTime,
@ -211,7 +211,7 @@ Foam::functionObjects::fieldValues::cellSource::cellSource
)
:
fieldValue(name, runTime, dict, typeName),
source_(sourceTypeNames_.read(dict.lookup("source"))),
regionType_(regionTypeNames_.read(dict.lookup("regionType"))),
operation_(operationTypeNames_.read(dict.lookup("operation"))),
nCells_(0),
cellId_(),
@ -228,7 +228,7 @@ Foam::functionObjects::fieldValues::cellSource::cellSource
}
Foam::functionObjects::fieldValues::cellSource::cellSource
Foam::functionObjects::fieldValues::volRegion::volRegion
(
const word& name,
const objectRegistry& obr,
@ -236,7 +236,7 @@ Foam::functionObjects::fieldValues::cellSource::cellSource
)
:
fieldValue(name, obr, dict, typeName),
source_(sourceTypeNames_.read(dict.lookup("source"))),
regionType_(regionTypeNames_.read(dict.lookup("regionType"))),
operation_(operationTypeNames_.read(dict.lookup("operation"))),
nCells_(0),
cellId_(),
@ -255,13 +255,13 @@ Foam::functionObjects::fieldValues::cellSource::cellSource
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fieldValues::cellSource::~cellSource()
Foam::functionObjects::fieldValues::volRegion::~volRegion()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::fieldValues::cellSource::read
bool Foam::functionObjects::fieldValues::volRegion::read
(
const dictionary& dict
)
@ -275,7 +275,7 @@ bool Foam::functionObjects::fieldValues::cellSource::read
}
bool Foam::functionObjects::fieldValues::cellSource::write
bool Foam::functionObjects::fieldValues::volRegion::write
(
const bool postProcess
)

View File

@ -22,13 +22,13 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjects::fieldValues::cellSource
Foam::functionObjects::fieldValues::volRegion
Group
grpFieldFunctionObjects
Description
This function object provides a 'cell source' variant of the fieldValues
This function object provides a 'cell region' variant of the fieldValues
function object. Given a list of user-specified fields and a selection
of mesh cells, a number of operations can be performed, such as sums,
averages and integrations.
@ -36,15 +36,15 @@ Description
Example of function object specification:
\verbatim
cellSource1
volRegion1
{
type cellSource;
type volRegion;
libs ("libfieldFunctionObjects.so");
...
log true;
writeFields true;
source cellZone;
sourceName c0;
regionType cellZone;
name c0;
operation volAverage;
weightField alpha1;
fields
@ -58,21 +58,21 @@ Description
\heading Function object usage
\table
Property | Description | Required | Default value
type | Type name: cellSource | yes |
type | Type name: volRegion | yes |
log | Write data to standard output | no | no
writeFields | Write the raw output values | yes |
writeVolume | Write the volume of the cellSource | no |
source | cell source: see below | yes |
sourceName | name of cell source if required | no |
writeVolume | Write the volume of the volRegion | no |
regionType | cell regionType: see below | yes |
name | name of cell regionType if required | no |
operation | operation to perform | yes |
weightField | name of field to apply weighting | no |
fields | list of fields to operate on | yes |
\endtable
\linebreak
Where \c source is defined by
Where \c regionType is defined by
\plaintable
cellZone | requires a 'sourceName' entry to specify the cellZone
cellZone | requires a 'name' entry to specify the cellZone
all | all cells
\endplaintable
@ -97,12 +97,12 @@ SeeAlso
Foam::functionObject
SourceFiles
cellSource.C
volRegion.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_cellSource_H
#define functionObjects_cellSource_H
#ifndef functionObjects_volRegion_H
#define functionObjects_volRegion_H
#include "fieldValue.H"
#include "NamedEnum.H"
@ -117,10 +117,10 @@ namespace fieldValues
{
/*---------------------------------------------------------------------------*\
Class cellSource Declaration
Class volRegion Declaration
\*---------------------------------------------------------------------------*/
class cellSource
class volRegion
:
public fieldValue
{
@ -129,15 +129,15 @@ public:
// Public data types
//- Source type enumeration
enum sourceType
//- region type enumeration
enum regionTypes
{
stCellZone,
stAll
};
//- Source type names
static const NamedEnum<sourceType, 2> sourceTypeNames_;
//- region type names
static const NamedEnum<regionTypes, 2> regionTypeNames_;
//- Operation type enumeration
@ -170,7 +170,7 @@ private:
//- Set cells to evaluate based on a patch
void setPatchCells();
//- Calculate and return volume of the cellSource: sum(V)
//- Calculate and return volume of the volRegion: sum(V)
scalar volume() const;
@ -178,8 +178,8 @@ protected:
// Protected data
//- Source type
sourceType source_;
//- region type
regionTypes regionType_;
//- Operation to apply to values
operationType operation_;
@ -193,10 +193,10 @@ protected:
//- Weight field name - only used for opWeightedAverage mode
word weightFieldName_;
//- Volume of the cellSource
//- Volume of the volRegion
scalar volume_;
//- Optionally write the volume of the cellSource
//- Optionally write the volume of the volRegion
bool writeVolume_;
@ -233,13 +233,13 @@ protected:
public:
//- Run-time type information
TypeName("cellSource");
TypeName("volRegion");
// Constructors
//- Construct from name, Time and dictionary
cellSource
volRegion
(
const word& name,
const Time& runTime,
@ -247,7 +247,7 @@ public:
);
//- Construct from name, objectRegistry and dictionary
cellSource
volRegion
(
const word& name,
const objectRegistry& obr,
@ -256,13 +256,13 @@ public:
//- Destructor
virtual ~cellSource();
virtual ~volRegion();
// Public Member Functions
//- Return the source type
inline const sourceType& source() const;
//- Return the region type
inline const regionTypes& regionType() const;
//- Return the local list of cell IDs
inline const labelList& cellId() const;
@ -291,12 +291,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "cellSourceI.H"
#include "volRegionI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "cellSourceTemplates.C"
#include "volRegionTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -23,19 +23,19 @@ License
\*---------------------------------------------------------------------------*/
#include "cellSource.H"
#include "volRegion.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::functionObjects::fieldValues::cellSource::sourceType&
Foam::functionObjects::fieldValues::cellSource::source() const
inline const Foam::functionObjects::fieldValues::volRegion::regionTypes&
Foam::functionObjects::fieldValues::volRegion::regionType() const
{
return source_;
return regionType_;
}
inline const Foam::labelList&
Foam::functionObjects::fieldValues::cellSource::cellId() const
Foam::functionObjects::fieldValues::volRegion::cellId() const
{
return cellId_;
}

View File

@ -23,13 +23,13 @@ License
\*---------------------------------------------------------------------------*/
#include "cellSource.H"
#include "volRegion.H"
#include "volFields.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type>
bool Foam::functionObjects::fieldValues::cellSource::validField
bool Foam::functionObjects::fieldValues::volRegion::validField
(
const word& fieldName
) const
@ -47,7 +47,7 @@ bool Foam::functionObjects::fieldValues::cellSource::validField
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::functionObjects::fieldValues::cellSource::setFieldValues
Foam::functionObjects::fieldValues::volRegion::setFieldValues
(
const word& fieldName,
const bool mustGet
@ -72,7 +72,7 @@ Foam::functionObjects::fieldValues::cellSource::setFieldValues
template<class Type>
Type Foam::functionObjects::fieldValues::cellSource::processValues
Type Foam::functionObjects::fieldValues::volRegion::processValues
(
const Field<Type>& values,
const scalarField& V,
@ -155,7 +155,7 @@ Type Foam::functionObjects::fieldValues::cellSource::processValues
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
bool Foam::functionObjects::fieldValues::cellSource::writeValues
bool Foam::functionObjects::fieldValues::volRegion::writeValues
(
const word& fieldName
)
@ -191,8 +191,8 @@ bool Foam::functionObjects::fieldValues::cellSource::writeValues
(
IOobject
(
fieldName + "_" + sourceTypeNames_[source_] + "-"
+ sourceName_,
fieldName + "_" + regionTypeNames_[regionType_] + "-"
+ name_,
obr_.time().timeName(),
obr_,
IOobject::NO_READ,
@ -206,7 +206,7 @@ bool Foam::functionObjects::fieldValues::cellSource::writeValues
file()<< tab << result;
Log << " " << operationTypeNames_[operation_]
<< "(" << sourceName_ << ") of " << fieldName
<< "(" << name_ << ") of " << fieldName
<< " = " << result << endl;
}
}
@ -217,7 +217,7 @@ bool Foam::functionObjects::fieldValues::cellSource::writeValues
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::functionObjects::fieldValues::cellSource::filterField
Foam::functionObjects::fieldValues::volRegion::filterField
(
const Field<Type>& field
) const

View File

@ -32,7 +32,7 @@ functions
faceObj2
{
type faceSource;
type surfaceRegion;
libs ("libfieldFunctionObjects.so");
enabled true;
writeControl timeStep;
@ -40,7 +40,7 @@ functions
log true;
writeFields true;
source faceZone;
sourceName f0;
name f0;
operation areaAverage;
fields