Commit 118a0f22 authored by Henry Weller's avatar Henry Weller
Browse files

functionObjects: Completed transformation of 'source' to vol/surfaceRegion

parent ae1a6dd1
......@@ -15,13 +15,13 @@ writeControl timeStep;
writeInterval 1
log false;
source1
region1
{
#includeEtc "caseDicts/postProcessing/surfaceRegion/surfaceRegion.cfg"
operation areaAverage;
fields (p);
}
source2
region2
{
#includeEtc "caseDicts/postProcessing/surfaceRegion/surfaceRegion.cfg"
operation areaAverage;
......
......@@ -8,12 +8,12 @@
#includeEtc "caseDicts/postProcessing/pressure/pressureDifference.cfg"
source1
region1
{
regionType patch;
name $patch1;
}
source2
region2
{
regionType patch;
name $patch2;
......
......@@ -8,7 +8,7 @@
#includeEtc "caseDicts/postProcessing/pressure/pressureDifference.cfg"
source1
region1
{
regionType sampledSurface;
......@@ -21,9 +21,9 @@ source1
}
}
source2
region2
{
$source1;
$region1;
sampledSurfaceDict
{
surface $triSurface2;
......
......@@ -133,9 +133,6 @@ public:
//- Return the input dictionary
inline const dictionary& dict() const;
//- Return the region name
inline const word& regionName() const;
//- Return the execute control object
inline const Foam::timeControl& executeControl() const;
......
......@@ -52,7 +52,7 @@ functions
libs ("libfieldFunctionObjects.so");
enabled true;
writeControl writeTime;
writeControl writeTime;
// Output to log&file (true) or to file only
log true;
......@@ -60,8 +60,8 @@ functions
// Output field values as well
writeFields true;
// Type of source: patch/faceZone/sampledSurface
source patch;
// Type of region: patch/faceZone/sampledSurface
regionType patch;
// if patch or faceZone: name of patch or faceZone
name movingWall;
......@@ -73,7 +73,7 @@ functions
// // Sampling on triSurface
// type sampledTriSurfaceMesh;
// surface integrationPlane.stl;
// source cells; // sample cells or boundaryFaces
// regionType cells; // sample cells or boundaryFaces
// interpolate true;
//}
......@@ -93,10 +93,10 @@ functions
type surfaceRegion;
libs ("libfieldFunctionObjects.so");
enabled true;
writeControl writeTime;
writeControl writeTime;
log true;
writeFields true;
source faceZone;
regionType faceZone;
name f0;
operation sum;
......@@ -111,10 +111,10 @@ functions
type volRegion;
libs ("libfieldFunctionObjects.so");
enabled true;
writeControl writeTime;
writeControl writeTime;
log true;
writeFields true;
source cellZone;
regionType cellZone;
name c0;
operation volAverage;
......
......@@ -51,7 +51,7 @@ Foam::functionObjects::fieldValue::fieldValue
:
writeFiles(name, runTime, dict, name),
dict_(dict),
name_(word::null),
regionName_(word::null),
resultDict_(fileName("name"), dictionary::null)
{
read(dict);
......@@ -69,7 +69,7 @@ Foam::functionObjects::fieldValue::fieldValue
:
writeFiles(name, obr, dict, name),
dict_(dict),
name_(word::null),
regionName_(word::null),
resultDict_(fileName("name"), dictionary::null)
{
read(dict);
......
......@@ -69,8 +69,8 @@ protected:
//- Construction dictionary
dictionary dict_;
//- Name of source object
word name_;
//- Name of region (patch, zone, etc.)
word regionName_;
//- List of field names to operate on
wordList fields_;
......@@ -153,8 +153,8 @@ public:
//- Return the reference to the construction dictionary
inline const dictionary& dict() const;
//- Return the source name
inline const word& name() const;
//- Return the region name
inline const word& regionName() const;
//- Return the list of field names
inline const wordList& fields() const;
......
......@@ -34,9 +34,9 @@ inline const Foam::dictionary& Foam::functionObjects::fieldValue::dict() const
}
inline const Foam::word& Foam::functionObjects::fieldValue::name() const
inline const Foam::word& Foam::functionObjects::fieldValue::regionName() const
{
return name_;
return regionName_;
}
......
......@@ -68,8 +68,8 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::writeFileHeader
const label i
)
{
const wordList& fields1 = source1Ptr_->fields();
const wordList& fields2 = source2Ptr_->fields();
const wordList& fields1 = region1Ptr_->fields();
const wordList& fields2 = region2Ptr_->fields();
DynamicList<word> commonFields(fields1.size());
forAll(fields1, i)
......@@ -83,8 +83,8 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::writeFileHeader
Ostream& os = file();
writeHeaderValue(os, "Source1", source1Ptr_->name());
writeHeaderValue(os, "Source2", source2Ptr_->name());
writeHeaderValue(os, "Source1", region1Ptr_->name());
writeHeaderValue(os, "Source2", region2Ptr_->name());
writeHeaderValue(os, "Operation", operationTypeNames_[operation_]);
writeCommented(os, "Time");
......@@ -108,8 +108,8 @@ Foam::functionObjects::fieldValues::fieldValueDelta::fieldValueDelta
:
writeFiles(name, runTime, dict, name),
operation_(opSubtract),
source1Ptr_(NULL),
source2Ptr_(NULL)
region1Ptr_(NULL),
region2Ptr_(NULL)
{
if (!isA<fvMesh>(obr_))
{
......@@ -137,23 +137,23 @@ bool Foam::functionObjects::fieldValues::fieldValueDelta::read
{
writeFiles::read(dict);
source1Ptr_.reset
region1Ptr_.reset
(
fieldValue::New
(
name() + ".source1",
name() + ".region1",
obr_,
dict.subDict("source1"),
dict.subDict("region1"),
false
).ptr()
);
source2Ptr_.reset
region2Ptr_.reset
(
fieldValue::New
(
name() + ".source2",
name() + ".region2",
obr_,
dict.subDict("source2"),
dict.subDict("region2"),
false
).ptr()
);
......@@ -168,8 +168,8 @@ bool Foam::functionObjects::fieldValues::fieldValueDelta::write()
{
writeFiles::write();
source1Ptr_->write();
source2Ptr_->write();
region1Ptr_->write();
region2Ptr_->write();
if (Pstream::master())
{
......
......@@ -118,11 +118,11 @@ private:
//- Operation to apply to values
operationType operation_;
//- Field value source object 1
autoPtr<fieldValue> source1Ptr_;
//- Field value region object 1
autoPtr<fieldValue> region1Ptr_;
//- Field value source object 2
autoPtr<fieldValue> source2Ptr_;
//- Field value region object 2
autoPtr<fieldValue> region2Ptr_;
// Private Member Functions
......
......@@ -87,10 +87,10 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::processFields
typedef GeometricField<Type, fvPatchField, volMesh> vf;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
const wordList& fields1 = source1Ptr_->fields();
const wordList& fields1 = region1Ptr_->fields();
const dictionary& results1 = source1Ptr_->resultDict();
const dictionary& results2 = source2Ptr_->resultDict();
const dictionary& results1 = region1Ptr_->resultDict();
const dictionary& results2 = region2Ptr_->resultDict();
Type r1(Zero);
Type r2(Zero);
......
......@@ -102,14 +102,14 @@ const Foam::NamedEnum
void Foam::functionObjects::fieldValues::surfaceRegion::setFaceZoneFaces()
{
label zoneId = mesh().faceZones().findZoneID(name_);
label zoneId = mesh().faceZones().findZoneID(regionName_);
if (zoneId < 0)
{
FatalErrorInFunction
<< type() << " " << name() << ": "
<< regionTypeNames_[regionType_] << "(" << name_ << "):" << nl
<< " Unknown face zone name: " << name_
<< regionTypeNames_[regionType_] << "(" << regionName_ << "):" << nl
<< " Unknown face zone name: " << regionName_
<< ". Valid face zones are: " << mesh().faceZones().names()
<< nl << exit(FatalError);
}
......@@ -187,14 +187,14 @@ void Foam::functionObjects::fieldValues::surfaceRegion::setFaceZoneFaces()
void Foam::functionObjects::fieldValues::surfaceRegion::setPatchFaces()
{
const label patchid = mesh().boundaryMesh().findPatchID(name_);
const label patchid = mesh().boundaryMesh().findPatchID(regionName_);
if (patchid < 0)
{
FatalErrorInFunction
<< type() << " " << name() << ": "
<< regionTypeNames_[regionType_] << "(" << name_ << "):" << nl
<< " Unknown patch name: " << name_
<< regionTypeNames_[regionType_] << "(" << regionName_ << "):" << nl
<< " Unknown patch name: " << regionName_
<< ". Valid patch names are: "
<< mesh().boundaryMesh().names() << nl
<< exit(FatalError);
......@@ -423,7 +423,7 @@ void Foam::functionObjects::fieldValues::surfaceRegion::initialise
const dictionary& dict
)
{
dict.lookup("name") >> name_;
dict.lookup("name") >> regionName_;
switch (regionType_)
{
......@@ -446,7 +446,7 @@ void Foam::functionObjects::fieldValues::surfaceRegion::initialise
{
FatalErrorInFunction
<< type() << " " << name() << ": "
<< regionTypeNames_[regionType_] << "(" << name_ << "):"
<< regionTypeNames_[regionType_] << "(" << regionName_ << "):"
<< nl << " Unknown region type. Valid region types are:"
<< regionTypeNames_.sortedToc() << nl << exit(FatalError);
}
......@@ -456,7 +456,7 @@ void Foam::functionObjects::fieldValues::surfaceRegion::initialise
{
FatalErrorInFunction
<< type() << " " << name() << ": "
<< regionTypeNames_[regionType_] << "(" << name_ << "):" << nl
<< regionTypeNames_[regionType_] << "(" << regionName_ << "):" << nl
<< " Region has no faces" << exit(FatalError);
}
......@@ -539,7 +539,7 @@ void Foam::functionObjects::fieldValues::surfaceRegion::writeFileHeader
)
{
writeCommented(file(), "Region type : ");
file() << regionTypeNames_[regionType_] << " " << name_ << endl;
file() << regionTypeNames_[regionType_] << " " << regionName_ << endl;
writeCommented(file(), "Faces : ");
file() << nFaces_ << endl;
writeCommented(file(), "Area : ");
......
......@@ -321,7 +321,7 @@ bool Foam::functionObjects::fieldValues::surfaceRegion::writeValues
surfaceWriterPtr_->write
(
outputDir,
word(regionTypeNames_[regionType_]) + "_" + name_,
word(regionTypeNames_[regionType_]) + "_" + regionName_,
points,
faces,
fieldName,
......@@ -345,7 +345,7 @@ bool Foam::functionObjects::fieldValues::surfaceRegion::writeValues
file()<< tab << result;
Log << " " << operationTypeNames_[operation_]
<< "(" << name_ << ") of " << fieldName
<< "(" << regionName_ << ") of " << fieldName
<< " = " << result << endl;
}
}
......@@ -377,7 +377,7 @@ Foam::functionObjects::fieldValues::surfaceRegion::filterField
{
FatalErrorInFunction
<< type() << " " << name() << ": "
<< regionTypeNames_[regionType_] << "(" << name_ << "):"
<< regionTypeNames_[regionType_] << "(" << regionName_ << "):"
<< nl
<< " Unable to process internal faces for volume field "
<< field.name() << nl << abort(FatalError);
......
......@@ -93,14 +93,14 @@ void Foam::functionObjects::fieldValues::volRegion::setCellZoneCells()
{
case stCellZone:
{
dict().lookup("name") >> name_;
dict().lookup("name") >> regionName_;
label zoneId = mesh().cellZones().findZoneID(name_);
label zoneId = mesh().cellZones().findZoneID(regionName_);
if (zoneId < 0)
{
FatalErrorInFunction
<< "Unknown cell zone name: " << name_
<< "Unknown cell zone name: " << regionName_
<< ". Valid cell zones are: " << mesh().cellZones().names()
<< nl << exit(FatalError);
}
......@@ -151,14 +151,14 @@ void Foam::functionObjects::fieldValues::volRegion::initialise
{
FatalErrorInFunction
<< type() << " " << name() << ": "
<< regionTypeNames_[regionType_] << "(" << name_ << "):" << nl
<< regionTypeNames_[regionType_] << "(" << regionName_ << "):" << nl
<< " Region has no cells" << exit(FatalError);
}
volume_ = volume();
Info<< type() << " " << name() << ":"
<< regionTypeNames_[regionType_] << "(" << name_ << "):" << nl
<< regionTypeNames_[regionType_] << "(" << regionName_ << "):" << nl
<< " total cells = " << nCells_ << nl
<< " total volume = " << volume_
<< nl << endl;
......@@ -178,7 +178,7 @@ void Foam::functionObjects::fieldValues::volRegion::writeFileHeader
)
{
writeCommented(file(), "Region type : ");
file() << regionTypeNames_[regionType_] << " " << name_ << endl;
file() << regionTypeNames_[regionType_] << " " << regionName_ << endl;
writeCommented(file(), "Cells : ");
file() << nCells_ << endl;
writeCommented(file(), "Volume : ");
......
......@@ -192,7 +192,7 @@ bool Foam::functionObjects::fieldValues::volRegion::writeValues
IOobject
(
fieldName + "_" + regionTypeNames_[regionType_] + "-"
+ name_,
+ regionName_,
obr_.time().timeName(),
obr_,
IOobject::NO_READ,
......@@ -206,7 +206,7 @@ bool Foam::functionObjects::fieldValues::volRegion::writeValues
file()<< tab << result;
Log << " " << operationTypeNames_[operation_]
<< "(" << name_ << ") of " << fieldName
<< "(" << regionName_ << ") of " << fieldName
<< " = " << result << endl;
}
}
......
......@@ -21,8 +21,8 @@ functions
type readFields;
libs ("libfieldFunctionObjects.so");
enabled true;
writeControl timeStep;
writeInterval 1;
writeControl timeStep;
writeInterval 1;
fields
(
......@@ -35,12 +35,12 @@ functions
type surfaceRegion;
libs ("libfieldFunctionObjects.so");
enabled true;
writeControl timeStep;
writeInterval 1;
writeControl timeStep;
writeInterval 1;
log true;
writeFields true;
source faceZone;
name f0;
regionType faceZone;
name f0;
operation areaAverage;
fields
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment