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

@ -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<objectRegistry>(regionName_);
return storedObjects().lookupObject<polySurface>(regionName_);
}
return mesh_;
@ -368,9 +368,9 @@ combineSurfaceGeometry
pointField& points
) const
{
if (stSurface == regionType_)
if (stObject == regionType_)
{
const surfMesh& s = dynamicCast<const surfMesh>(obr());
const polySurface& s = dynamicCast<const polySurface>(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<const surfMesh>(obr());
const polySurface& s = dynamicCast<const polySurface>(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<const surfMesh>(obr());
const polySurface& s = dynamicCast<const polySurface>(obr());
nFaces_ = returnReduce(s.size(), sumOp<label>());
break;
}
@ -1007,9 +1007,9 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
vectorField Sf;
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();
}
else if (sampledPtr_.valid())

View File

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

View File

@ -26,13 +26,19 @@ License
\*---------------------------------------------------------------------------*/
#include "Time.H"
#include "sampledSurface.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
inline bool Foam::functionObjects::fieldValues::surfaceFieldValue::
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 "surfaceFields.H"
#include "surfFields.H"
#include "polySurfaceFields.H"
#include "volFields.H"
#include "sampledSurface.H"
#include "surfaceWriter.H"
@ -58,7 +58,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::validField
{
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
typedef GeometricField<Type, fvPatchField, volMesh> vf;
typedef DimensionedField<Type, surfGeoMesh> smt;
typedef DimensionedField<Type, polySurfaceGeoMesh> smt;
return
(
@ -79,7 +79,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
{
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
typedef GeometricField<Type, fvPatchField, volMesh> vf;
typedef DimensionedField<Type, surfGeoMesh> smt;
typedef DimensionedField<Type, polySurfaceGeoMesh> smt;
if (foundObject<smt>(fieldName))
{