From 118a0f225dddd99d8df368b3868e628d652bbbae Mon Sep 17 00:00:00 2001 From: Henry Weller <http://cfd.direct> Date: Mon, 13 Jun 2016 09:42:14 +0100 Subject: [PATCH] functionObjects: Completed transformation of 'source' to vol/surfaceRegion --- .../pressure/pressureDifference.cfg | 4 +-- .../pressure/pressureDifferencePatch.cfg | 4 +-- .../pressure/pressureDifferenceSurface.cfg | 6 ++-- .../timeControl/timeControlFunctionObject.H | 3 -- .../field/fieldValues/controlDict | 16 +++++------ .../field/fieldValues/fieldValue/fieldValue.C | 4 +-- .../field/fieldValues/fieldValue/fieldValue.H | 8 +++--- .../fieldValues/fieldValue/fieldValueI.H | 4 +-- .../fieldValueDelta/fieldValueDelta.C | 28 +++++++++---------- .../fieldValueDelta/fieldValueDelta.H | 8 +++--- .../fieldValueDeltaTemplates.C | 6 ++-- .../fieldValues/surfaceRegion/surfaceRegion.C | 20 ++++++------- .../surfaceRegion/surfaceRegionTemplates.C | 6 ++-- .../field/fieldValues/volRegion/volRegion.C | 12 ++++---- .../volRegion/volRegionTemplates.C | 4 +-- .../field/readFields/postProcessingDict | 12 ++++---- 16 files changed, 71 insertions(+), 74 deletions(-) diff --git a/etc/caseDicts/postProcessing/pressure/pressureDifference.cfg b/etc/caseDicts/postProcessing/pressure/pressureDifference.cfg index 7b8f3588c64..8351759b638 100644 --- a/etc/caseDicts/postProcessing/pressure/pressureDifference.cfg +++ b/etc/caseDicts/postProcessing/pressure/pressureDifference.cfg @@ -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; diff --git a/etc/caseDicts/postProcessing/pressure/pressureDifferencePatch.cfg b/etc/caseDicts/postProcessing/pressure/pressureDifferencePatch.cfg index 4775eb803b4..0704e88d5dd 100644 --- a/etc/caseDicts/postProcessing/pressure/pressureDifferencePatch.cfg +++ b/etc/caseDicts/postProcessing/pressure/pressureDifferencePatch.cfg @@ -8,12 +8,12 @@ #includeEtc "caseDicts/postProcessing/pressure/pressureDifference.cfg" -source1 +region1 { regionType patch; name $patch1; } -source2 +region2 { regionType patch; name $patch2; diff --git a/etc/caseDicts/postProcessing/pressure/pressureDifferenceSurface.cfg b/etc/caseDicts/postProcessing/pressure/pressureDifferenceSurface.cfg index e42e167d0d2..165ed594511 100644 --- a/etc/caseDicts/postProcessing/pressure/pressureDifferenceSurface.cfg +++ b/etc/caseDicts/postProcessing/pressure/pressureDifferenceSurface.cfg @@ -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; diff --git a/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.H b/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.H index 0697a18cf63..2ab9524921b 100644 --- a/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.H +++ b/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.H @@ -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; diff --git a/src/functionObjects/field/fieldValues/controlDict b/src/functionObjects/field/fieldValues/controlDict index f21f2d32542..97b1e21ab5d 100644 --- a/src/functionObjects/field/fieldValues/controlDict +++ b/src/functionObjects/field/fieldValues/controlDict @@ -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; diff --git a/src/functionObjects/field/fieldValues/fieldValue/fieldValue.C b/src/functionObjects/field/fieldValues/fieldValue/fieldValue.C index df313aa5460..54731bb9ff9 100644 --- a/src/functionObjects/field/fieldValues/fieldValue/fieldValue.C +++ b/src/functionObjects/field/fieldValues/fieldValue/fieldValue.C @@ -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); diff --git a/src/functionObjects/field/fieldValues/fieldValue/fieldValue.H b/src/functionObjects/field/fieldValues/fieldValue/fieldValue.H index 77b7d7f3cd6..cad2b654907 100644 --- a/src/functionObjects/field/fieldValues/fieldValue/fieldValue.H +++ b/src/functionObjects/field/fieldValues/fieldValue/fieldValue.H @@ -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; diff --git a/src/functionObjects/field/fieldValues/fieldValue/fieldValueI.H b/src/functionObjects/field/fieldValues/fieldValue/fieldValueI.H index 7d0e402a680..fba3d4d8d52 100644 --- a/src/functionObjects/field/fieldValues/fieldValue/fieldValueI.H +++ b/src/functionObjects/field/fieldValues/fieldValue/fieldValueI.H @@ -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_; } diff --git a/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C b/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C index 53d3865b212..e60099d0571 100644 --- a/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C +++ b/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C @@ -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()) { diff --git a/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H b/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H index 2c4c183b91d..12267d588f7 100644 --- a/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H +++ b/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H @@ -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 diff --git a/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaTemplates.C b/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaTemplates.C index ed4163e80ad..2b552df4110 100644 --- a/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaTemplates.C +++ b/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaTemplates.C @@ -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); diff --git a/src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegion.C b/src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegion.C index cc36d586bff..6800e8d1f36 100644 --- a/src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegion.C +++ b/src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegion.C @@ -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 : "); diff --git a/src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegionTemplates.C b/src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegionTemplates.C index 478443c8a18..a0ea72ebdc5 100644 --- a/src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegionTemplates.C +++ b/src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegionTemplates.C @@ -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); diff --git a/src/functionObjects/field/fieldValues/volRegion/volRegion.C b/src/functionObjects/field/fieldValues/volRegion/volRegion.C index 4b96159045d..b6c3b671524 100644 --- a/src/functionObjects/field/fieldValues/volRegion/volRegion.C +++ b/src/functionObjects/field/fieldValues/volRegion/volRegion.C @@ -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 : "); diff --git a/src/functionObjects/field/fieldValues/volRegion/volRegionTemplates.C b/src/functionObjects/field/fieldValues/volRegion/volRegionTemplates.C index 12fb69de879..d3741f71756 100644 --- a/src/functionObjects/field/fieldValues/volRegion/volRegionTemplates.C +++ b/src/functionObjects/field/fieldValues/volRegion/volRegionTemplates.C @@ -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; } } diff --git a/src/functionObjects/field/readFields/postProcessingDict b/src/functionObjects/field/readFields/postProcessingDict index e319b614f56..89c9b262a79 100644 --- a/src/functionObjects/field/readFields/postProcessingDict +++ b/src/functionObjects/field/readFields/postProcessingDict @@ -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 -- GitLab