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
This commit is contained in:
Mark Olesen
2019-02-12 13:54:02 +01:00
committed by Andrew Heather
parent 181c974b11
commit 03e6aa1a6d
29 changed files with 480 additions and 395 deletions

View File

@ -32,7 +32,9 @@ Group
Description Description
Calculates average quantities for a user-specified selection of volumetric Calculates average quantities for a user-specified selection of volumetric
and surface fields. 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 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 averages to perform, and can be updated during the calculation. The current
@ -104,15 +106,15 @@ Usage
Where the entries comprise: Where the entries comprise:
\table \table
Property | Description | Required | Default Property | Description | Required | Default
type | type name: fieldAverage | yes | type | Type name: fieldAverage | yes |
restartOnRestart | Restart the averaging on restart | no | no restartOnRestart| Restart the averaging on restart | no | no
restartOnOutput | Restart the averaging on output | no | no restartOnOutput | Restart the averaging on output | no | no
periodicRestart | Periodically restart the averaging | no | no periodicRestart | Periodically restart the averaging | no | no
restartPeriod | Periodic restart period | conditional | restartPeriod | Periodic restart period | conditional |
restartTime | One-shot reset of the averaging | no | great restartTime | One-shot reset of the averaging | no | great
fields | list of fields and averaging options | yes | fields | list of fields and averaging options | yes |
subRegion | name of a sub-region such as a surface name | no | subRegion | Name for alternative objectRegistry | no | ""
\endtable \endtable

View File

@ -28,7 +28,7 @@ License
#include "fieldAverageItem.H" #include "fieldAverageItem.H"
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "surfFields.H" #include "polySurfaceFields.H"
#include "OFstream.H" #include "OFstream.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -99,7 +99,7 @@ void Foam::functionObjects::fieldAverage::addMeanField
{ {
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType; typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType; typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
typedef DimensionedField<Type, surfGeoMesh> SurfFieldType; typedef DimensionedField<Type, polySurfaceGeoMesh> SurfFieldType;
if (item.mean()) if (item.mean())
{ {
@ -169,7 +169,7 @@ void Foam::functionObjects::fieldAverage::restoreWindowFields
{ {
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType; typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType; typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
typedef DimensionedField<Type, surfGeoMesh> SurfFieldType; typedef DimensionedField<Type, polySurfaceGeoMesh> SurfFieldType;
if (item.window() > 0) if (item.window() > 0)
{ {
@ -243,11 +243,11 @@ void Foam::functionObjects::fieldAverage::addPrime2MeanField
{ {
typedef GeometricField<Type1, fvPatchField, volMesh> VolFieldType1; typedef GeometricField<Type1, fvPatchField, volMesh> VolFieldType1;
typedef GeometricField<Type1, fvsPatchField, surfaceMesh> SurfaceFieldType1; typedef GeometricField<Type1, fvsPatchField, surfaceMesh> SurfaceFieldType1;
typedef DimensionedField<Type1, surfGeoMesh> SurfFieldType1; typedef DimensionedField<Type1, polySurfaceGeoMesh> SurfFieldType1;
typedef GeometricField<Type2, fvPatchField, volMesh> VolFieldType2; typedef GeometricField<Type2, fvPatchField, volMesh> VolFieldType2;
typedef GeometricField<Type2, fvsPatchField, surfaceMesh> SurfaceFieldType2; typedef GeometricField<Type2, fvsPatchField, surfaceMesh> SurfaceFieldType2;
typedef DimensionedField<Type2, surfGeoMesh> SurfFieldType2; typedef DimensionedField<Type2, polySurfaceGeoMesh> SurfFieldType2;
if (item.prime2Mean()) if (item.prime2Mean())
{ {
@ -312,7 +312,7 @@ void Foam::functionObjects::fieldAverage::storeWindowFields()
{ {
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType; typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType; typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
typedef DimensionedField<Type, surfGeoMesh> SurfFieldType; typedef DimensionedField<Type, polySurfaceGeoMesh> SurfFieldType;
for (fieldAverageItem& item : faItems_) for (fieldAverageItem& item : faItems_)
{ {
@ -331,7 +331,7 @@ void Foam::functionObjects::fieldAverage::calculateMeanFields() const
{ {
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType; typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType; typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
typedef DimensionedField<Type, surfGeoMesh> SurfFieldType; typedef DimensionedField<Type, polySurfaceGeoMesh> SurfFieldType;
for (const fieldAverageItem& item : faItems_) for (const fieldAverageItem& item : faItems_)
{ {
@ -347,11 +347,11 @@ void Foam::functionObjects::fieldAverage::calculatePrime2MeanFields() const
{ {
typedef GeometricField<Type1, fvPatchField, volMesh> VolFieldType1; typedef GeometricField<Type1, fvPatchField, volMesh> VolFieldType1;
typedef GeometricField<Type1, fvsPatchField, surfaceMesh> SurfaceFieldType1; typedef GeometricField<Type1, fvsPatchField, surfaceMesh> SurfaceFieldType1;
typedef DimensionedField<Type1, surfGeoMesh> SurfFieldType1; typedef DimensionedField<Type1, polySurfaceGeoMesh> SurfFieldType1;
typedef GeometricField<Type2, fvPatchField, volMesh> VolFieldType2; typedef GeometricField<Type2, fvPatchField, volMesh> VolFieldType2;
typedef GeometricField<Type2, fvsPatchField, surfaceMesh> SurfaceFieldType2; typedef GeometricField<Type2, fvsPatchField, surfaceMesh> SurfaceFieldType2;
typedef DimensionedField<Type2, surfGeoMesh> SurfFieldType2; typedef DimensionedField<Type2, polySurfaceGeoMesh> SurfFieldType2;
for (const fieldAverageItem& item : faItems_) for (const fieldAverageItem& item : faItems_)
{ {
@ -391,11 +391,11 @@ void Foam::functionObjects::fieldAverage::addMeanSqrToPrime2Mean() const
{ {
typedef GeometricField<Type1, fvPatchField, volMesh> VolFieldType1; typedef GeometricField<Type1, fvPatchField, volMesh> VolFieldType1;
typedef GeometricField<Type1, fvsPatchField, surfaceMesh> SurfaceFieldType1; typedef GeometricField<Type1, fvsPatchField, surfaceMesh> SurfaceFieldType1;
typedef DimensionedField<Type1, surfGeoMesh> SurfFieldType1; typedef DimensionedField<Type1, polySurfaceGeoMesh> SurfFieldType1;
typedef GeometricField<Type2, fvPatchField, volMesh> VolFieldType2; typedef GeometricField<Type2, fvPatchField, volMesh> VolFieldType2;
typedef GeometricField<Type2, fvsPatchField, surfaceMesh> SurfaceFieldType2; typedef GeometricField<Type2, fvsPatchField, surfaceMesh> SurfaceFieldType2;
typedef DimensionedField<Type2, surfGeoMesh> SurfFieldType2; typedef DimensionedField<Type2, polySurfaceGeoMesh> SurfFieldType2;
for (const fieldAverageItem& item : faItems_) for (const fieldAverageItem& item : faItems_)
{ {
@ -431,7 +431,7 @@ void Foam::functionObjects::fieldAverage::writeFields() const
{ {
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType; typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType; typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
typedef DimensionedField<Type, surfGeoMesh> SurfFieldType; typedef DimensionedField<Type, polySurfaceGeoMesh> SurfFieldType;
for (const fieldAverageItem& item : faItems_) for (const fieldAverageItem& item : faItems_)
{ {

View File

@ -60,7 +60,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypeNames_
({ ({
{ regionTypes::stFaceZone, "faceZone" }, { regionTypes::stFaceZone, "faceZone" },
{ regionTypes::stPatch, "patch" }, { regionTypes::stPatch, "patch" },
{ regionTypes::stSurface, "surface" }, { regionTypes::stObject, "functionObjectSurface" },
{ regionTypes::stSampled, "sampledSurface" }, { regionTypes::stSampled, "sampledSurface" },
}); });
@ -118,9 +118,9 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::postOperationTypeNames_
const Foam::objectRegistry& const Foam::objectRegistry&
Foam::functionObjects::fieldValues::surfaceFieldValue::obr() const Foam::functionObjects::fieldValues::surfaceFieldValue::obr() const
{ {
if (stSurface == regionType_) if (stObject == regionType_)
{ {
return mesh_.lookupObject<objectRegistry>(regionName_); return storedObjects().lookupObject<polySurface>(regionName_);
} }
return mesh_; return mesh_;
@ -368,9 +368,9 @@ combineSurfaceGeometry
pointField& points pointField& points
) const ) const
{ {
if (stSurface == regionType_) if (stObject == regionType_)
{ {
const surfMesh& s = dynamicCast<const surfMesh>(obr()); const polySurface& s = dynamicCast<const polySurface>(obr());
if (Pstream::parRun()) if (Pstream::parRun())
{ {
@ -436,9 +436,9 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::totalArea() const
{ {
scalar totalArea = 0; scalar totalArea = 0;
if (stSurface == regionType_) if (stObject == regionType_)
{ {
const surfMesh& s = dynamicCast<const surfMesh>(obr()); const polySurface& s = dynamicCast<const polySurface>(obr());
totalArea = gSum(s.magSf()); totalArea = gSum(s.magSf());
} }
@ -505,9 +505,9 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::update()
setPatchFaces(); setPatchFaces();
break; break;
} }
case stSurface: case stObject:
{ {
const surfMesh& s = dynamicCast<const surfMesh>(obr()); const polySurface& s = dynamicCast<const polySurface>(obr());
nFaces_ = returnReduce(s.size(), sumOp<label>()); nFaces_ = returnReduce(s.size(), sumOp<label>());
break; break;
} }
@ -1007,9 +1007,9 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
vectorField Sf; vectorField Sf;
if (usesSf()) if (usesSf())
{ {
if (stSurface == regionType_) if (stObject == regionType_)
{ {
const surfMesh& s = dynamicCast<const surfMesh>(obr()); const polySurface& s = dynamicCast<const polySurface>(obr());
Sf = s.Sf(); Sf = s.Sf();
} }
else if (sampledPtr_.valid()) else if (sampledPtr_.valid())

View File

@ -98,7 +98,7 @@ Usage
\plaintable \plaintable
faceZone | The \b name entry to specify the faceZone faceZone | The \b name entry to specify the faceZone
patch | The \b name entry to specify the patch patch | The \b name entry to specify the patch
surface | The \b name entry to specify the surfMesh functionObjectSurface | The \b name entry to specify a polySurface
sampledSurface | A \b sampledSurfaceDict sub-dictionary and \b name sampledSurface | A \b sampledSurfaceDict sub-dictionary and \b name
\endplaintable \endplaintable
@ -134,13 +134,14 @@ Note
- The values reported by the areaNormalAverage and areaNormalIntegrate - The values reported by the areaNormalAverage and areaNormalIntegrate
operations are written as the first component of a field with the same operations are written as the first component of a field with the same
rank as the input field. rank as the input field.
- faces on empty patches get ignored - Faces on empty patches get ignored
- if the field is a volField the \c faceZone can only consist of boundary - If the field is a volField the \c faceZone can only consist of boundary
faces faces
- Using \c surface: - Using \c functionObjectSurface:
- The keyword %subRegion should not be used to select surfaces. - The keyword %subRegion should not be used to select surfaces.
Specify instead the regionType 'surface' and provide the surface name. Instead specify the regionType 'functionObjectSurface' and provide
- using \c sampledSurface: the name.
- Using \c sampledSurface:
- not available for surface fields - not available for surface fields
- if interpolate=true they use \c interpolationCellPoint - if interpolate=true they use \c interpolationCellPoint
otherwise they use cell values otherwise they use cell values
@ -180,11 +181,11 @@ SourceFiles
#include "fieldValue.H" #include "fieldValue.H"
#include "Enum.H" #include "Enum.H"
#include "meshedSurf.H"
#include "surfaceMesh.H" #include "surfaceMesh.H"
#include "polySurface.H"
#include "fvsPatchField.H" #include "fvsPatchField.H"
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "surfFieldsFwd.H" #include "polySurfaceFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -217,7 +218,7 @@ public:
{ {
stFaceZone = 0x01, //!< Calculate on a faceZone stFaceZone = 0x01, //!< Calculate on a faceZone
stPatch = 0x02, //!< Calculate on a patch stPatch = 0x02, //!< Calculate on a patch
stSurface = 0x11, //!< Calculate with fields on a surfMesh stObject = 0x11, //!< Calculate with function object surface
stSampled = 0x12 //!< Sample onto surface and calculate stSampled = 0x12 //!< Sample onto surface and calculate
}; };

View File

@ -26,13 +26,19 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "Time.H" #include "Time.H"
#include "sampledSurface.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
inline bool Foam::functionObjects::fieldValues::surfaceFieldValue:: inline bool Foam::functionObjects::fieldValues::surfaceFieldValue::
withSurfaceFields() const withSurfaceFields() const
{ {
return (stFaceZone == regionType_ || stPatch == regionType_); return
(
stFaceZone == regionType_
|| stPatch == regionType_
|| (sampledPtr_.valid() && sampledPtr_->withSurfaceFields())
);
} }

View File

@ -27,7 +27,7 @@ License
#include "surfaceFieldValue.H" #include "surfaceFieldValue.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "surfFields.H" #include "polySurfaceFields.H"
#include "volFields.H" #include "volFields.H"
#include "sampledSurface.H" #include "sampledSurface.H"
#include "surfaceWriter.H" #include "surfaceWriter.H"
@ -58,7 +58,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::validField
{ {
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf; typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
typedef GeometricField<Type, fvPatchField, volMesh> vf; typedef GeometricField<Type, fvPatchField, volMesh> vf;
typedef DimensionedField<Type, surfGeoMesh> smt; typedef DimensionedField<Type, polySurfaceGeoMesh> smt;
return return
( (
@ -79,7 +79,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
{ {
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf; typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
typedef GeometricField<Type, fvPatchField, volMesh> vf; typedef GeometricField<Type, fvPatchField, volMesh> vf;
typedef DimensionedField<Type, surfGeoMesh> smt; typedef DimensionedField<Type, polySurfaceGeoMesh> smt;
if (foundObject<smt>(fieldName)) if (foundObject<smt>(fieldName))
{ {

View File

@ -27,7 +27,7 @@ License
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "surfFields.H" #include "polySurfaceFields.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -36,7 +36,7 @@ bool Foam::functionObjects::fieldsExpression::calcFieldTypes(FOType& fo)
{ {
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType; typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType; typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
typedef DimensionedField<Type, surfGeoMesh> SurfFieldType; typedef DimensionedField<Type, polySurfaceGeoMesh> SurfFieldType;
if (foundObject<VolFieldType>(fieldNames_[0])) if (foundObject<VolFieldType>(fieldNames_[0]))
{ {

View File

@ -27,8 +27,7 @@ License
#include "fluxSummary.H" #include "fluxSummary.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "surfFields.H" #include "polySurfaceFields.H"
#include "surfMesh.H"
#include "dictionary.H" #include "dictionary.H"
#include "Time.H" #include "Time.H"
#include "syncTools.H" #include "syncTools.H"
@ -65,6 +64,7 @@ Foam::functionObjects::fluxSummary::modeTypeNames_
{ modeType::mdFaceZone , "faceZone" }, { modeType::mdFaceZone , "faceZone" },
{ modeType::mdFaceZoneAndDirection, "faceZoneAndDirection" }, { modeType::mdFaceZoneAndDirection, "faceZoneAndDirection" },
{ modeType::mdCellZoneAndDirection, "cellZoneAndDirection" }, { modeType::mdCellZoneAndDirection, "cellZoneAndDirection" },
{ modeType::mdSurface, "functionObjectSurface" },
{ modeType::mdSurface, "surface" }, { modeType::mdSurface, "surface" },
{ modeType::mdSurfaceAndDirection, "surfaceAndDirection" }, { modeType::mdSurfaceAndDirection, "surfaceAndDirection" },
}); });
@ -116,14 +116,15 @@ void Foam::functionObjects::fluxSummary::initialiseSurface
DynamicList<boolList>& faceFlip DynamicList<boolList>& faceFlip
) const ) const
{ {
const surfMesh* surfptr = mesh_.cfindObject<surfMesh>(surfName); const polySurface* surfptr =
storedObjects().cfindObject<polySurface>(surfName);
if (!surfptr) if (!surfptr)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unable to find surface " << surfName << "Unable to find surface " << surfName
<< ". Valid surfaces: " << ". Valid surfaces: "
<< mesh_.sortedNames<surfMesh>() << nl << storedObjects().sortedNames<polySurface>() << nl
<< exit(FatalError); << exit(FatalError);
} }
@ -142,14 +143,15 @@ void Foam::functionObjects::fluxSummary::initialiseSurfaceAndDirection
DynamicList<boolList>& faceFlip DynamicList<boolList>& faceFlip
) const ) const
{ {
const surfMesh* surfptr = mesh_.cfindObject<surfMesh>(surfName); const polySurface* surfptr =
storedObjects().cfindObject<polySurface>(surfName);
if (!surfptr) if (!surfptr)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unable to find surface " << surfName << "Unable to find surface " << surfName
<< ". Valid surfaces: " << ". Valid surfaces: "
<< mesh_.sortedNames<surfMesh>() << nl << storedObjects().sortedNames<polySurface>() << nl
<< exit(FatalError); << exit(FatalError);
} }
@ -661,7 +663,9 @@ Foam::scalar Foam::functionObjects::fluxSummary::totalArea
if (isSurfaceMode()) if (isSurfaceMode())
{ {
const surfMesh& s = mesh_.lookupObject<surfMesh>(zoneNames_[idx]); const polySurface& s =
storedObjects().lookupObject<polySurface>(zoneNames_[idx]);
sumMagSf = sum(s.magSf()); sumMagSf = sum(s.magSf());
} }
else else
@ -693,11 +697,12 @@ Foam::scalar Foam::functionObjects::fluxSummary::totalArea
bool Foam::functionObjects::fluxSummary::surfaceModeWrite() bool Foam::functionObjects::fluxSummary::surfaceModeWrite()
{ {
if (zoneNames_.size()) for (const word& surfName : zoneNames_)
{ {
const label surfi = 0; const polySurface& s =
const surfMesh& s = mesh_.lookupObject<surfMesh>(zoneNames_[surfi]); storedObjects().lookupObject<polySurface>(surfName);
const surfVectorField& phi = s.lookupObject<surfVectorField>(phiName_);
const auto& phi = s.lookupObject<polySurfaceVectorField>(phiName_);
Log << type() << ' ' << name() << ' ' Log << type() << ' ' << name() << ' '
<< checkFlowType(phi.dimensions(), phi.name()) << " write:" << nl; << checkFlowType(phi.dimensions(), phi.name()) << " write:" << nl;
@ -706,8 +711,10 @@ bool Foam::functionObjects::fluxSummary::surfaceModeWrite()
forAll(zoneNames_, surfi) forAll(zoneNames_, surfi)
{ {
const surfMesh& s = mesh_.lookupObject<surfMesh>(zoneNames_[surfi]); const polySurface& s =
const surfVectorField& phi = s.lookupObject<surfVectorField>(phiName_); storedObjects().lookupObject<polySurface>(zoneNames_[surfi]);
const auto& phi = s.lookupObject<polySurfaceVectorField>(phiName_);
checkFlowType(phi.dimensions(), phi.name()); checkFlowType(phi.dimensions(), phi.name());

View File

@ -120,14 +120,14 @@ public:
//- Face mode type //- Face mode type
enum modeType enum modeType
{ {
mdFaceZone, //!< face zone mdFaceZone, //!< Face zone
mdFaceZoneAndDirection, //!< face zone with prescribed direction mdFaceZoneAndDirection, //!< Face zone with prescribed direction
mdCellZoneAndDirection, //!< cell zone with prescribed direction mdCellZoneAndDirection, //!< Cell zone with prescribed direction
mdSurface, //!< surfMesh mdSurface, //!< A functionObject surface
mdSurfaceAndDirection //!< surfMesh with prescribed direction mdSurfaceAndDirection //!< A surface with prescribed direction
}; };
//- Mode type names //- Face mode names
static const Enum<modeType> modeTypeNames_; static const Enum<modeType> modeTypeNames_;

View File

@ -34,7 +34,8 @@ Description
The operation can be applied to any volume or surface fields generating a The operation can be applied to any volume or surface fields generating a
volume or surface scalar field. volume or surface scalar field.
With the %subRegion option, also supports fields on a surfMesh. With the %subRegion option, also supports fields on functionObject
surface output (eg, sampledSurfaces).
See also See also
Foam::functionObjects::fvMeshFunctionObject Foam::functionObjects::fvMeshFunctionObject

View File

@ -27,7 +27,7 @@ License
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "surfFields.H" #include "polySurfaceFields.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -36,7 +36,7 @@ bool Foam::functionObjects::mag::calcMag()
{ {
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType; typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType; typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
typedef DimensionedField<Type, surfGeoMesh> SurfFieldType; typedef DimensionedField<Type, polySurfaceGeoMesh> SurfFieldType;
if (foundObject<VolFieldType>(fieldName_, false)) if (foundObject<VolFieldType>(fieldName_, false))
{ {

View File

@ -34,7 +34,8 @@ Description
The operation can be applied to any volume or surface field generating a The operation can be applied to any volume or surface field generating a
volume or surface scalar field. volume or surface scalar field.
With the %subRegion option, also supports fields on a surfMesh. With the %subRegion option, also supports fields on functionObject
surface output (eg, sampledSurfaces).
See also See also
Foam::functionObjects::fvMeshFunctionObject Foam::functionObjects::fvMeshFunctionObject

View File

@ -27,7 +27,7 @@ License
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "surfFields.H" #include "polySurfaceFields.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -36,7 +36,7 @@ bool Foam::functionObjects::magSqr::calcMagSqr()
{ {
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType; typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType; typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
typedef DimensionedField<Type, surfGeoMesh> SurfFieldType; typedef DimensionedField<Type, polySurfaceGeoMesh> SurfFieldType;
if (foundObject<VolFieldType>(fieldName_, false)) if (foundObject<VolFieldType>(fieldName_, false))
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation | Copyright (C) 2011-2016 OpenFOAM Foundation
@ -28,7 +28,6 @@ License
#include "readFields.H" #include "readFields.H"
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "surfFields.H"
#include "Time.H" #include "Time.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -38,7 +37,7 @@ bool Foam::functionObjects::readFields::loadField(const word& fieldName)
{ {
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType; typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType; typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
typedef DimensionedField<Type, surfGeoMesh> SurfFieldType; /// typedef DimensionedField<Type, surfGeoMesh> SurfFieldType;
if (foundObject<VolFieldType>(fieldName)) if (foundObject<VolFieldType>(fieldName))
{ {
@ -54,13 +53,13 @@ bool Foam::functionObjects::readFields::loadField(const word& fieldName)
<< " " << fieldName << " already exists in database" << " " << fieldName << " already exists in database"
<< " already in database" << endl; << " already in database" << endl;
} }
else if (foundObject<SurfFieldType>(fieldName)) /// else if (foundObject<SurfFieldType>(fieldName))
{ /// {
DebugInfo /// DebugInfo
<< "readFields: " << SurfFieldType::typeName /// << "readFields: " << SurfFieldType::typeName
<< " " << fieldName << " already exists in database" /// << " " << fieldName << " already exists in database"
<< " already in database" << endl; /// << " already in database" << endl;
} /// }
else else
{ {
IOobject fieldHeader IOobject fieldHeader
@ -76,35 +75,32 @@ bool Foam::functionObjects::readFields::loadField(const word& fieldName)
{ {
// Store field on mesh database // Store field on mesh database
Log << " Reading " << fieldName << endl; Log << " Reading " << fieldName << endl;
VolFieldType* vfPtr(new VolFieldType(fieldHeader, mesh_)); VolFieldType* fldPtr(new VolFieldType(fieldHeader, mesh_));
mesh_.objectRegistry::store(vfPtr); mesh_.objectRegistry::store(fldPtr);
return true; return true;
} }
else if (fieldHeader.typeHeaderOk<SurfaceFieldType>(true, true, false)) else if (fieldHeader.typeHeaderOk<SurfaceFieldType>(true, true, false))
{ {
// Store field on mesh database // Store field on mesh database
Log << " Reading " << fieldName << endl; Log << " Reading " << fieldName << endl;
SurfaceFieldType* sfPtr(new SurfaceFieldType(fieldHeader, mesh_)); SurfaceFieldType* fldPtr(new SurfaceFieldType(fieldHeader, mesh_));
mesh_.objectRegistry::store(sfPtr); mesh_.objectRegistry::store(fldPtr);
return true; return true;
} }
else if (fieldHeader.typeHeaderOk<SurfFieldType>(true, true, false)) /// else if (fieldHeader.typeHeaderOk<SurfFieldType>(true, true, false))
{ /// {
if (isA<surfMesh>(obr())) /// const surfMesh* surfptr = isA<surfMesh>(obr());
{ /// if (surfptr)
const surfMesh& s = dynamicCast<const surfMesh>(obr()); /// {
/// const surfMesh& s = surfptr;
// Store field on surfMesh database ///
Log << " Reading " << fieldName << endl; /// // Store field on surfMesh database
SurfFieldType* sfPtr(new SurfFieldType(fieldHeader, s)); /// Log << " Reading " << fieldName << endl;
s.store(sfPtr); /// SurfFieldType* fldPtr(new SurfFieldType(fieldHeader, s));
return true; /// s.store(fldPtr);
} /// return true;
else /// }
{ /// }
return false;
}
}
} }
return false; return false;

View File

@ -3,20 +3,20 @@
// Averaging of volume fields or fields on an externally loaded surface. // Averaging of volume fields or fields on an externally loaded surface.
avg-tracer0-0.25 avg-tracer0-0.25
{ {
${settings_avg} ${__settings_avg}
subRegion plane-0.25; subRegion sampled.plane-0.25;
} }
avg-tracer0-0.45 avg-tracer0-0.45
{ {
${settings_avg} ${__settings_avg}
subRegion plane-0.45; subRegion sampled.plane-0.45;
} }
avg-tracer0-0.55 avg-tracer0-0.55
{ {
${settings_avg} ${__settings_avg}
subRegion plane-0.55; subRegion sampled.plane-0.55;
} }

View File

@ -55,8 +55,6 @@ endTime 1200;
deltaT 1; deltaT 1;
writeInterval 100; writeInterval 100;
#include "sampleControls"
functions functions
{ {
#include "abort" #include "abort"

View File

@ -1,17 +1,19 @@
// -*- C++ -*- // -*- C++ -*-
// ************************************************************************* // // Sample volume fields to surfaces and hold on registry.
sampled
// Transcribe volume fields to surfaces.
fieldTransfer
{ {
type surfMeshes; type surfaces;
libs ("libsampling.so"); libs ("libsampling.so");
log true; log true;
writeControl none; verbose true;
createOnRead true;
executeControl timeStep; executeControl timeStep;
executeInterval 1; executeInterval 1;
writeControl none;
surfaceFormat none;
sampleOnExecute true;
// Includes a rhoU derived field // Includes a rhoU derived field
fields (rho U tracer0 rhoU); fields (rho U tracer0 rhoU);
@ -19,31 +21,31 @@ fieldTransfer
// Remove derived fields we created prior // Remove derived fields we created prior
removeFieldsOnExecute (pTotal); removeFieldsOnExecute (pTotal);
_sampleMesh
baseCfg
{ {
type sampledTriSurfaceMesh; type sampledTriSurfaceMesh;
source cells; source cells;
store true;
} }
surfaces surfaces
( {
plane-0.25 plane-0.25
{ {
$baseCfg ${_sampleMesh}
surface plane-0.25.stl; surface plane-0.25.stl;
} }
plane-0.45 plane-0.45
{ {
$baseCfg ${_sampleMesh}
surface plane-0.45.stl; surface plane-0.45.stl;
} }
plane-0.55 plane-0.55
{ {
$baseCfg ${_sampleMesh}
surface plane-0.55.stl; surface plane-0.55.stl;
} }
); }
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,29 @@
// -*- C++ -*-
//
// Summary of fluxes
flux
{
type fluxSummary;
libs ("libfieldFunctionObjects.so");
log on;
enabled true;
executeControl none;
writeControl timeStep;
writeInterval 4;
mode functionObjectSurface;
phi rhoU;
surfaces
(
sampled.plane-0.25
sampled.plane-0.45
sampled.plane-0.55
);
}
// ************************************************************************* //

View File

@ -4,12 +4,20 @@
#include "derivedFields" #include "derivedFields"
#include "fieldTransfer" #include "fieldTransfer"
#include "fluxSummary"
#include "surfaceFieldValue.cfg"
#include "avg-tracer0" #include "avg-tracer0"
#include "sum-tracer0" #include "sum-tracer0"
// #include "sum-tracer0Mean" // #include "sum-tracer0Mean"
// #include "averaging.1612" // generate time-averaged fields // #include "averaging.1612" // generate time-averaged fields
// #include "spatialDeviation.1612" // spatial deviation compared to a mean field // #include "spatialDeviation.1612" // spatial deviation compared to a mean field
// #include "statistics.1612" // transcribe volume fields -> surface // #include "statistics.1612" // transcribe volume fields -> surface
// Cleanup
#remove "__.*"
// ************************************************************************* // // ************************************************************************* //

View File

@ -4,10 +4,10 @@
sum-tracer0-0.25 sum-tracer0-0.25
{ {
$settings_stats ${__settings_stats}
regionType surface; regionType functionObjectSurface;
name plane-0.25; name sampled.plane-0.25;
operation weightedAreaIntegrate; operation weightedAreaIntegrate;
// postOperation sqrt; // postOperation sqrt;
@ -19,10 +19,10 @@ sum-tracer0-0.25
sum-tracer0-0.45 sum-tracer0-0.45
{ {
$settings_stats ${__settings_stats}
regionType surface; regionType functionObjectSurface;
name plane-0.45; name sampled.plane-0.45;
operation weightedAreaIntegrate; operation weightedAreaIntegrate;
// postOperation sqrt; // postOperation sqrt;
@ -33,10 +33,10 @@ sum-tracer0-0.45
sum-tracer0-0.55 sum-tracer0-0.55
{ {
$settings_stats ${__settings_stats}
regionType surface; regionType functionObjectSurface;
name plane-0.55; name sampled.plane-0.55;
operation weightedAreaIntegrate; operation weightedAreaIntegrate;
// postOperation sqrt; // postOperation sqrt;

View File

@ -16,7 +16,7 @@
// restartTime: // restartTime:
// - a 'one-shot' reset at a particular time // - a 'one-shot' reset at a particular time
// //
settings_avg __settings_avg
{ {
type fieldAverage; type fieldAverage;
libs ("libfieldFunctionObjects.so"); libs ("libfieldFunctionObjects.so");
@ -77,7 +77,7 @@ settings_avg
// The sqrt operation is useful when determining RMS values. // The sqrt operation is useful when determining RMS values.
// //
// The 'output/write' control triggers the calculation. // The 'output/write' control triggers the calculation.
settings_stats __settings_stats
{ {
type surfaceFieldValue; type surfaceFieldValue;
libs ("libfieldFunctionObjects.so"); libs ("libfieldFunctionObjects.so");

View File

@ -47,10 +47,9 @@ graphFormat raw;
runTimeModifiable true; runTimeModifiable true;
#include "sampleControls"
functions functions
{ {
#include "derivedFields"
#include "sampling" #include "sampling"
// #include "samplingDebug" // #include "samplingDebug"
// #include "sampleCellCentres" // #include "sampleCellCentres"

View File

@ -1,65 +0,0 @@
// -*- C++ -*-
// ************************************************************************* //
// Transcribe volume fields to surfaces.
fieldTransfer
{
type surfMeshes;
libs ("libsampling.so");
log true;
writeControl none;
createOnRead true;
executeControl timeStep;
executeInterval 1;
fields (p rho U T rhoU pTotal);
// Remove derived fields we created prior
removeFieldsOnExecute (rhoU pTotal);
_plane
{
type plane;
source cells;
planeType pointAndNormal;
pointAndNormalDict
{
normal (-1 0 0);
point (-0.04 0 0);
}
}
surfaces
(
// Top channel
plane1
{
${_plane}
bounds (-1 0 -1) (0 1 1);
}
// Bottom channel
plane2
{
${_plane}
bounds (-1 -1 -1) (0 0 1);
}
// Angled plane - for general testing
plane3
{
type distanceSurface;
distance 0;
signed true;
surfaceType triSurfaceMesh;
surfaceName angledPlane.obj;
}
);
}
// ************************************************************************* //

View File

@ -1,40 +0,0 @@
// -*- C++ -*-
// restartTime:
// - a 'one-shot' reset at a particular time
//
// fields [required]
// Pairs of fields to use for calculating the deviation.
// The fields must already exist on the surfaces.
//
// weightField [optional]
// A scalar or vector field for weighting.
//
// postOperation [optional]
// Modify the results by particular operations.
// (none | sqrt)
// The sqrt operation is useful when determining RMS values.
//
// The 'output/write' control triggers the calculation.
__surfaceFieldValue
{
type surfaceFieldValue;
libs ("libfieldFunctionObjects.so");
log on;
enabled true;
writeControl timeStep;
writeInterval 1;
writeFields false;
surfaceFormat vtk;
// writeArea true;
// resetOnStartUp true;
// resetOnOutput false;
// periodicRestart true;
// restartPeriod 0.0005;
}
// ************************************************************************* //

View File

@ -1,16 +1,134 @@
// -*- C++ -*- /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object sampling;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* // // Setup for surfaceFieldValue
//
// restartTime:
// - a 'one-shot' reset at a particular time
//
// fields [required]
// Pairs of fields to use for calculating the deviation.
// The fields must already exist on the surfaces.
//
// weightField [optional]
// A scalar or vector field for weighting.
//
// postOperation [optional]
// Modify the results by particular operations.
// (none | sqrt)
// The sqrt operation is useful when determining RMS values.
//
// The 'output/write' control triggers the calculation.
__surfaceFieldValue
{
type surfaceFieldValue;
libs ("libfieldFunctionObjects.so");
log on;
enabled true;
#include "derivedFields" writeControl timeStep;
#include "fieldTransfer" writeInterval 1;
writeFields false;
surfaceFormat vtk;
// writeArea true;
// resetOnStartUp true;
// resetOnOutput false;
// periodicRestart true;
// restartPeriod 0.0005;
}
// * * * * * * * * * * * * * * * * Sampling * * * * * * * * * * * * * * * * //
// Sample volume fields to surfaces and hold on registry.
sampled
{
type surfaces;
libs ("libsampling.so");
log true;
executeControl timeStep;
executeInterval 1;
writeControl none;
sampleOnExecute true;
surfaceFormat none;
fields (p rho U T rhoU pTotal);
// Remove derived fields we created prior
removeFieldsOnExecute (rhoU pTotal);
_plane
{
type plane;
source cells;
store true;
planeType pointAndNormal;
pointAndNormalDict
{
normal (-1 0 0);
point (-0.04 0 0);
}
}
surfaces
{
// Top channel
plane1
{
${_plane}
bounds (-1 0 -1) (0 1 1);
}
// Bottom channel
plane2
{
${_plane}
bounds (-1 -1 -1) (0 0 1);
}
// Angled plane - for general testing
plane3
{
type distanceSurface;
distance 0;
signed true;
store true;
surfaceType triSurfaceMesh;
surfaceName angledPlane.obj;
}
}
}
// * * * * * * * * * * * * * * * Calculations * * * * * * * * * * * * * * * //
massflow massflow
{ {
${__surfaceFieldValue} ${__surfaceFieldValue}
regionType surface; regionType functionObjectSurface;
name plane1; name sampled.plane1;
operation areaNormalIntegrate; operation areaNormalIntegrate;
@ -21,8 +139,8 @@ areaAverage
{ {
${__surfaceFieldValue} ${__surfaceFieldValue}
regionType surface; regionType functionObjectSurface;
name plane1; name sampled.plane1;
operation weightedAreaAverage; operation weightedAreaAverage;
weightField rhoU; weightField rhoU;
@ -33,8 +151,8 @@ areaIntegrate
{ {
${__surfaceFieldValue} ${__surfaceFieldValue}
regionType surface; regionType functionObjectSurface;
name plane1; name sampled.plane1;
operation weightedAreaIntegrate; operation weightedAreaIntegrate;
weightField rhoU; weightField rhoU;
@ -46,8 +164,8 @@ UI1
{ {
${__surfaceFieldValue} ${__surfaceFieldValue}
regionType surface; regionType functionObjectSurface;
name plane1; name sampled.plane1;
operation uniformity; operation uniformity;
fields ( U T ); fields ( U T );
@ -59,8 +177,8 @@ UI2
{ {
${__surfaceFieldValue} ${__surfaceFieldValue}
regionType surface; regionType functionObjectSurface;
name plane2; name sampled.plane2;
operation uniformity; operation uniformity;
fields ( U T ); fields ( U T );
@ -72,8 +190,8 @@ UI3
{ {
${__surfaceFieldValue} ${__surfaceFieldValue}
regionType surface; regionType functionObjectSurface;
name plane3; name sampled.plane3;
operation uniformity; operation uniformity;
fields ( U T ); fields ( U T );
@ -86,8 +204,8 @@ T_UI1
{ {
${__surfaceFieldValue} ${__surfaceFieldValue}
regionType surface; regionType functionObjectSurface;
name plane1; name sampled.plane1;
operation weightedUniformity; operation weightedUniformity;
weightField T; weightField T;
@ -100,8 +218,8 @@ rhoU_UI1
{ {
${__surfaceFieldValue} ${__surfaceFieldValue}
regionType surface; regionType functionObjectSurface;
name plane1; name sampled.plane1;
operation weightedUniformity; operation weightedUniformity;
weightField rhoU; weightField rhoU;
@ -114,8 +232,8 @@ rhoU_UI2
{ {
${__surfaceFieldValue} ${__surfaceFieldValue}
regionType surface; regionType functionObjectSurface;
name plane2; name sampled.plane2;
operation weightedUniformity; operation weightedUniformity;
weightField rhoU; weightField rhoU;
@ -123,4 +241,9 @@ rhoU_UI2
} }
// * * * * * * * * * * * * * * * * * Cleanup * * * * * * * * * * * * * * * * //
#remove "__.*"
// ************************************************************************* // // ************************************************************************* //

View File

@ -47,10 +47,9 @@ graphFormat raw;
runTimeModifiable true; runTimeModifiable true;
#include "sampleControls"
functions functions
{ {
#include "derivedFields"
#include "sampling" #include "sampling"
// #include "samplingDebug" // #include "samplingDebug"
} }

View File

@ -1,65 +0,0 @@
// -*- C++ -*-
// ************************************************************************* //
// Transcribe volume fields to surfaces.
fieldTransfer
{
type surfMeshes;
libs ("libsampling.so");
log true;
writeControl none;
createOnRead true;
executeControl timeStep;
executeInterval 1;
fields (p U rhoU pTotal);
// Remove derived fields we created prior
removeFieldsOnExecute (rhoU pTotal);
_plane
{
type plane;
source cells;
planeType pointAndNormal;
pointAndNormalDict
{
normal (-1 0 0);
point (-0.04 0 0);
}
}
surfaces
(
// Top channel
plane1
{
${_plane}
bounds (-1 0 -1) (0 1 1);
}
// Bottom channel
plane2
{
${_plane}
bounds (-1 -1 -1) (0 0 1);
}
// Angled plane - for general testing
plane3
{
type distanceSurface;
distance 0;
signed true;
surfaceType triSurfaceMesh;
surfaceName angledPlane.obj;
}
);
}
// ************************************************************************* //

View File

@ -1,40 +0,0 @@
// -*- C++ -*-
// restartTime:
// - a 'one-shot' reset at a particular time
//
// fields [required]
// Pairs of fields to use for calculating the deviation.
// The fields must already exist on the surfaces.
//
// weightField [optional]
// A scalar or vector field for weighting.
//
// postOperation [optional]
// Modify the results by particular operations.
// (none | sqrt)
// The sqrt operation is useful when determining RMS values.
//
// The 'output/write' control triggers the calculation.
__surfaceFieldValue
{
type surfaceFieldValue;
libs ("libfieldFunctionObjects.so");
log on;
enabled true;
writeControl timeStep;
writeInterval 1;
writeFields false;
surfaceFormat vtk;
// writeArea true;
// resetOnStartUp true;
// resetOnOutput false;
// periodicRestart true;
// restartPeriod 0.0005;
}
// ************************************************************************* //

View File

@ -1,16 +1,134 @@
// -*- C++ -*- /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object sampling;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* // // Setup for surfaceFieldValue
//
// restartTime:
// - a 'one-shot' reset at a particular time
//
// fields [required]
// Pairs of fields to use for calculating the deviation.
// The fields must already exist on the surfaces.
//
// weightField [optional]
// A scalar or vector field for weighting.
//
// postOperation [optional]
// Modify the results by particular operations.
// (none | sqrt)
// The sqrt operation is useful when determining RMS values.
//
// The 'output/write' control triggers the calculation.
__surfaceFieldValue
{
type surfaceFieldValue;
libs ("libfieldFunctionObjects.so");
log on;
enabled true;
#include "derivedFields" writeControl timeStep;
#include "fieldTransfer" writeInterval 1;
writeFields false;
surfaceFormat vtk;
// writeArea true;
// resetOnStartUp true;
// resetOnOutput false;
// periodicRestart true;
// restartPeriod 0.0005;
}
// * * * * * * * * * * * * * * * * Sampling * * * * * * * * * * * * * * * * //
// Sample volume fields to surfaces and hold on registry.
sampled
{
type surfaces;
libs ("libsampling.so");
log true;
executeControl timeStep;
executeInterval 1;
writeControl none;
sampleOnExecute true;
surfaceFormat none;
fields (p U rhoU pTotal);
// Remove derived fields we created prior
removeFieldsOnExecute (rhoU pTotal);
_plane
{
type plane;
source cells;
store true;
planeType pointAndNormal;
pointAndNormalDict
{
normal (-1 0 0);
point (-0.04 0 0);
}
}
surfaces
(
// Top channel
plane1
{
${_plane}
bounds (-1 0 -1) (0 1 1);
}
// Bottom channel
plane2
{
${_plane}
bounds (-1 -1 -1) (0 0 1);
}
// Angled plane - for general testing
plane3
{
type distanceSurface;
distance 0;
signed true;
store true;
surfaceType triSurfaceMesh;
surfaceName angledPlane.obj;
}
);
}
// * * * * * * * * * * * * * * * Calculations * * * * * * * * * * * * * * * //
massflow massflow
{ {
${__surfaceFieldValue} ${__surfaceFieldValue}
regionType surface; regionType functionObjectSurface;
name plane1; name sampled.plane1;
operation areaNormalIntegrate; operation areaNormalIntegrate;
@ -21,8 +139,8 @@ areaAverage
{ {
${__surfaceFieldValue} ${__surfaceFieldValue}
regionType surface; regionType functionObjectSurface;
name plane1; name sampled.plane1;
operation weightedAreaAverage; operation weightedAreaAverage;
weightField rhoU; weightField rhoU;
@ -33,8 +151,8 @@ areaIntegrate
{ {
${__surfaceFieldValue} ${__surfaceFieldValue}
regionType surface; regionType functionObjectSurface;
name plane1; name sampled.plane1;
operation weightedAreaIntegrate; operation weightedAreaIntegrate;
weightField rhoU; weightField rhoU;
@ -46,8 +164,8 @@ UI1
{ {
${__surfaceFieldValue} ${__surfaceFieldValue}
regionType surface; regionType functionObjectSurface;
name plane1; name sampled.plane1;
operation uniformity; operation uniformity;
fields ( U p ); fields ( U p );
@ -59,8 +177,8 @@ UI2
{ {
${__surfaceFieldValue} ${__surfaceFieldValue}
regionType surface; regionType functionObjectSurface;
name plane2; name sampled.plane2;
operation uniformity; operation uniformity;
fields ( U p ); fields ( U p );
@ -72,8 +190,8 @@ UI3
{ {
${__surfaceFieldValue} ${__surfaceFieldValue}
regionType surface; regionType functionObjectSurface;
name plane3; name sampled.plane3;
operation uniformity; operation uniformity;
fields ( U p ); fields ( U p );
@ -85,8 +203,8 @@ rhoU_UI1
{ {
${__surfaceFieldValue} ${__surfaceFieldValue}
regionType surface; regionType functionObjectSurface;
name plane1; name sampled.plane1;
operation weightedUniformity; operation weightedUniformity;
weightField rhoU; weightField rhoU;
@ -99,8 +217,8 @@ rhoU_UI2
{ {
${__surfaceFieldValue} ${__surfaceFieldValue}
regionType surface; regionType functionObjectSurface;
name plane2; name sampled.plane2;
operation weightedUniformity; operation weightedUniformity;
weightField rhoU; weightField rhoU;
@ -108,4 +226,9 @@ rhoU_UI2
} }
// * * * * * * * * * * * * * * * * * Cleanup * * * * * * * * * * * * * * * * //
#remove "__.*"
// ************************************************************************* // // ************************************************************************* //