From 03e6aa1a6db0bc5d9ef9012f70a92039f1733422 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 12 Feb 2019 13:54:02 +0100 Subject: [PATCH] ENH: replace surfMesh/fields support with polySurface/fields support (#1206) - fits better into the general sampling framework, improves flexibilty and allows code reduction. ENH: include surface fields on sampledSurfaces that support it --- .../field/fieldAverage/fieldAverage.H | 22 +-- .../fieldAverage/fieldAverageTemplates.C | 24 +-- .../surfaceFieldValue/surfaceFieldValue.C | 22 +-- .../surfaceFieldValue/surfaceFieldValue.H | 19 +- .../surfaceFieldValue/surfaceFieldValueI.H | 8 +- .../surfaceFieldValueTemplates.C | 6 +- .../fieldsExpressionTemplates.C | 4 +- .../field/fluxSummary/fluxSummary.C | 33 ++-- .../field/fluxSummary/fluxSummary.H | 12 +- src/functionObjects/field/mag/mag.H | 3 +- src/functionObjects/field/mag/magTemplates.C | 4 +- src/functionObjects/field/magSqr/magSqr.H | 3 +- .../field/magSqr/magSqrTemplates.C | 4 +- .../field/readFields/readFieldsTemplates.C | 58 +++--- .../gasMixing/injectorPipe/system/avg-tracer0 | 12 +- .../gasMixing/injectorPipe/system/controlDict | 2 - .../injectorPipe/system/fieldTransfer | 34 ++-- .../gasMixing/injectorPipe/system/fluxSummary | 29 +++ .../gasMixing/injectorPipe/system/sampling | 8 + .../gasMixing/injectorPipe/system/sum-tracer0 | 18 +- .../{sampleControls => surfaceFieldValue.cfg} | 4 +- .../squareBend/system/controlDict | 3 +- .../squareBend/system/fieldTransfer | 65 ------- .../squareBend/system/sampleControls | 40 ----- .../rhoSimpleFoam/squareBend/system/sampling | 167 +++++++++++++++--- .../simpleFoam/squareBend/system/controlDict | 3 +- .../squareBend/system/fieldTransfer | 65 ------- .../squareBend/system/sampleControls | 40 ----- .../simpleFoam/squareBend/system/sampling | 163 ++++++++++++++--- 29 files changed, 480 insertions(+), 395 deletions(-) create mode 100644 tutorials/compressible/rhoSimpleFoam/gasMixing/injectorPipe/system/fluxSummary rename tutorials/compressible/rhoSimpleFoam/gasMixing/injectorPipe/system/{sampleControls => surfaceFieldValue.cfg} (98%) delete mode 100644 tutorials/compressible/rhoSimpleFoam/squareBend/system/fieldTransfer delete mode 100644 tutorials/compressible/rhoSimpleFoam/squareBend/system/sampleControls delete mode 100644 tutorials/incompressible/simpleFoam/squareBend/system/fieldTransfer delete mode 100644 tutorials/incompressible/simpleFoam/squareBend/system/sampleControls diff --git a/src/functionObjects/field/fieldAverage/fieldAverage.H b/src/functionObjects/field/fieldAverage/fieldAverage.H index 6985a21670..6d6a748d34 100644 --- a/src/functionObjects/field/fieldAverage/fieldAverage.H +++ b/src/functionObjects/field/fieldAverage/fieldAverage.H @@ -32,7 +32,9 @@ Group Description Calculates average quantities for a user-specified selection of volumetric and surface fields. - With the %subRegion option, also supports fields on a surfMesh. + With the %subRegion option, also supports fields on functionObject + surface output (eg, sampledSurfaces). + Fields are entered as a list of sub-dictionaries, which indicate the type of averages to perform, and can be updated during the calculation. The current @@ -104,15 +106,15 @@ Usage Where the entries comprise: \table - Property | Description | Required | Default - type | type name: fieldAverage | yes | - restartOnRestart | Restart the averaging on restart | no | no - restartOnOutput | Restart the averaging on output | no | no - periodicRestart | Periodically restart the averaging | no | no - restartPeriod | Periodic restart period | conditional | - restartTime | One-shot reset of the averaging | no | great - fields | list of fields and averaging options | yes | - subRegion | name of a sub-region such as a surface name | no | + Property | Description | Required | Default + type | Type name: fieldAverage | yes | + restartOnRestart| Restart the averaging on restart | no | no + restartOnOutput | Restart the averaging on output | no | no + periodicRestart | Periodically restart the averaging | no | no + restartPeriod | Periodic restart period | conditional | + restartTime | One-shot reset of the averaging | no | great + fields | list of fields and averaging options | yes | + subRegion | Name for alternative objectRegistry | no | "" \endtable diff --git a/src/functionObjects/field/fieldAverage/fieldAverageTemplates.C b/src/functionObjects/field/fieldAverage/fieldAverageTemplates.C index 6b7fe6e1be..edfa9628e1 100644 --- a/src/functionObjects/field/fieldAverage/fieldAverageTemplates.C +++ b/src/functionObjects/field/fieldAverage/fieldAverageTemplates.C @@ -28,7 +28,7 @@ License #include "fieldAverageItem.H" #include "volFields.H" #include "surfaceFields.H" -#include "surfFields.H" +#include "polySurfaceFields.H" #include "OFstream.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -99,7 +99,7 @@ void Foam::functionObjects::fieldAverage::addMeanField { typedef GeometricField VolFieldType; typedef GeometricField SurfaceFieldType; - typedef DimensionedField SurfFieldType; + typedef DimensionedField SurfFieldType; if (item.mean()) { @@ -169,7 +169,7 @@ void Foam::functionObjects::fieldAverage::restoreWindowFields { typedef GeometricField VolFieldType; typedef GeometricField SurfaceFieldType; - typedef DimensionedField SurfFieldType; + typedef DimensionedField SurfFieldType; if (item.window() > 0) { @@ -243,11 +243,11 @@ void Foam::functionObjects::fieldAverage::addPrime2MeanField { typedef GeometricField VolFieldType1; typedef GeometricField SurfaceFieldType1; - typedef DimensionedField SurfFieldType1; + typedef DimensionedField SurfFieldType1; typedef GeometricField VolFieldType2; typedef GeometricField SurfaceFieldType2; - typedef DimensionedField SurfFieldType2; + typedef DimensionedField SurfFieldType2; if (item.prime2Mean()) { @@ -312,7 +312,7 @@ void Foam::functionObjects::fieldAverage::storeWindowFields() { typedef GeometricField VolFieldType; typedef GeometricField SurfaceFieldType; - typedef DimensionedField SurfFieldType; + typedef DimensionedField SurfFieldType; for (fieldAverageItem& item : faItems_) { @@ -331,7 +331,7 @@ void Foam::functionObjects::fieldAverage::calculateMeanFields() const { typedef GeometricField VolFieldType; typedef GeometricField SurfaceFieldType; - typedef DimensionedField SurfFieldType; + typedef DimensionedField SurfFieldType; for (const fieldAverageItem& item : faItems_) { @@ -347,11 +347,11 @@ void Foam::functionObjects::fieldAverage::calculatePrime2MeanFields() const { typedef GeometricField VolFieldType1; typedef GeometricField SurfaceFieldType1; - typedef DimensionedField SurfFieldType1; + typedef DimensionedField SurfFieldType1; typedef GeometricField VolFieldType2; typedef GeometricField SurfaceFieldType2; - typedef DimensionedField SurfFieldType2; + typedef DimensionedField SurfFieldType2; for (const fieldAverageItem& item : faItems_) { @@ -391,11 +391,11 @@ void Foam::functionObjects::fieldAverage::addMeanSqrToPrime2Mean() const { typedef GeometricField VolFieldType1; typedef GeometricField SurfaceFieldType1; - typedef DimensionedField SurfFieldType1; + typedef DimensionedField SurfFieldType1; typedef GeometricField VolFieldType2; typedef GeometricField SurfaceFieldType2; - typedef DimensionedField SurfFieldType2; + typedef DimensionedField SurfFieldType2; for (const fieldAverageItem& item : faItems_) { @@ -431,7 +431,7 @@ void Foam::functionObjects::fieldAverage::writeFields() const { typedef GeometricField VolFieldType; typedef GeometricField SurfaceFieldType; - typedef DimensionedField SurfFieldType; + typedef DimensionedField SurfFieldType; for (const fieldAverageItem& item : faItems_) { diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C index 056b00a0c5..65225a544a 100644 --- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C +++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C @@ -60,7 +60,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypeNames_ ({ { regionTypes::stFaceZone, "faceZone" }, { regionTypes::stPatch, "patch" }, - { regionTypes::stSurface, "surface" }, + { regionTypes::stObject, "functionObjectSurface" }, { regionTypes::stSampled, "sampledSurface" }, }); @@ -118,9 +118,9 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::postOperationTypeNames_ const Foam::objectRegistry& Foam::functionObjects::fieldValues::surfaceFieldValue::obr() const { - if (stSurface == regionType_) + if (stObject == regionType_) { - return mesh_.lookupObject(regionName_); + return storedObjects().lookupObject(regionName_); } return mesh_; @@ -368,9 +368,9 @@ combineSurfaceGeometry pointField& points ) const { - if (stSurface == regionType_) + if (stObject == regionType_) { - const surfMesh& s = dynamicCast(obr()); + const polySurface& s = dynamicCast(obr()); if (Pstream::parRun()) { @@ -436,9 +436,9 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::totalArea() const { scalar totalArea = 0; - if (stSurface == regionType_) + if (stObject == regionType_) { - const surfMesh& s = dynamicCast(obr()); + const polySurface& s = dynamicCast(obr()); totalArea = gSum(s.magSf()); } @@ -505,9 +505,9 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::update() setPatchFaces(); break; } - case stSurface: + case stObject: { - const surfMesh& s = dynamicCast(obr()); + const polySurface& s = dynamicCast(obr()); nFaces_ = returnReduce(s.size(), sumOp