mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -85,7 +85,7 @@ FoamFile
|
|||||||
// {
|
// {
|
||||||
// set p0;
|
// set p0;
|
||||||
// option any; // cell with any point in pointSet
|
// option any; // cell with any point in pointSet
|
||||||
// //option all; // cell with all points in pointSet
|
// //option edge; // cell with an edge with both points in pointSet
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// // Select based on cellShape
|
// // Select based on cellShape
|
||||||
@ -198,6 +198,7 @@ FoamFile
|
|||||||
// set p0;
|
// set p0;
|
||||||
// option any; // Faces using any point in pointSet
|
// option any; // Faces using any point in pointSet
|
||||||
// //option all // Faces with all points in pointSet
|
// //option all // Faces with all points in pointSet
|
||||||
|
// //option edge // Faces with two consecutive points in pointSet
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// // Select by explicitly providing face labels
|
// // Select by explicitly providing face labels
|
||||||
|
|||||||
@ -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) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -41,10 +41,11 @@ namespace Foam
|
|||||||
const char* Foam::NamedEnum
|
const char* Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::pointToCell::pointAction,
|
Foam::pointToCell::pointAction,
|
||||||
1
|
2
|
||||||
>::names[] =
|
>::names[] =
|
||||||
{
|
{
|
||||||
"any"
|
"any",
|
||||||
|
"edge"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,11 +53,12 @@ namespace Foam
|
|||||||
Foam::topoSetSource::addToUsageTable Foam::pointToCell::usage_
|
Foam::topoSetSource::addToUsageTable Foam::pointToCell::usage_
|
||||||
(
|
(
|
||||||
pointToCell::typeName,
|
pointToCell::typeName,
|
||||||
"\n Usage: pointToCell <pointSet> any\n\n"
|
"\n Usage: pointToCell <pointSet> any|edge\n\n"
|
||||||
" Select all cells with any point in the pointSet\n\n"
|
" Select all cells with any point ('any') or any edge ('edge')"
|
||||||
|
" in the pointSet\n\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::pointToCell::pointAction, 1>
|
const Foam::NamedEnum<Foam::pointToCell::pointAction, 2>
|
||||||
Foam::pointToCell::pointActionNames_;
|
Foam::pointToCell::pointActionNames_;
|
||||||
|
|
||||||
|
|
||||||
@ -82,6 +84,26 @@ void Foam::pointToCell::combine(topoSet& set, const bool add) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (option_ == EDGE)
|
||||||
|
{
|
||||||
|
const faceList& faces = mesh_.faces();
|
||||||
|
forAll(faces, faceI)
|
||||||
|
{
|
||||||
|
const face& f = faces[faceI];
|
||||||
|
|
||||||
|
forAll(f, fp)
|
||||||
|
{
|
||||||
|
if (loadedSet.found(f[fp]) && loadedSet.found(f.nextLabel(fp)))
|
||||||
|
{
|
||||||
|
addOrDelete(set, mesh_.faceOwner()[faceI], add);
|
||||||
|
if (mesh_.isInternalFace(faceI))
|
||||||
|
{
|
||||||
|
addOrDelete(set, mesh_.faceNeighbour()[faceI], add);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -55,7 +55,8 @@ public:
|
|||||||
//- Enumeration defining the valid options
|
//- Enumeration defining the valid options
|
||||||
enum pointAction
|
enum pointAction
|
||||||
{
|
{
|
||||||
ANY // Cells using any point in set
|
ANY, // Cells using any point in set
|
||||||
|
EDGE // Cells using an edge with both points in set
|
||||||
//ALL // Possible extension: cells whose all points are in set
|
//ALL // Possible extension: cells whose all points are in set
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ private:
|
|||||||
//- Add usage string
|
//- Add usage string
|
||||||
static addToUsageTable usage_;
|
static addToUsageTable usage_;
|
||||||
|
|
||||||
static const NamedEnum<pointAction, 1> pointActionNames_;
|
static const NamedEnum<pointAction, 2> pointActionNames_;
|
||||||
|
|
||||||
//- Name of set to use
|
//- Name of set to use
|
||||||
word setName_;
|
word setName_;
|
||||||
|
|||||||
@ -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) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -41,11 +41,12 @@ namespace Foam
|
|||||||
const char* Foam::NamedEnum
|
const char* Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::pointToFace::pointAction,
|
Foam::pointToFace::pointAction,
|
||||||
2
|
3
|
||||||
>::names[] =
|
>::names[] =
|
||||||
{
|
{
|
||||||
"any",
|
"any",
|
||||||
"all"
|
"all",
|
||||||
|
"edge"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,13 +54,14 @@ namespace Foam
|
|||||||
Foam::topoSetSource::addToUsageTable Foam::pointToFace::usage_
|
Foam::topoSetSource::addToUsageTable Foam::pointToFace::usage_
|
||||||
(
|
(
|
||||||
pointToFace::typeName,
|
pointToFace::typeName,
|
||||||
"\n Usage: pointToFace <pointSet> any|all\n\n"
|
"\n Usage: pointToFace <pointSet> any|all|edge\n\n"
|
||||||
" Select faces with\n"
|
" Select faces with\n"
|
||||||
" -any point in the pointSet\n"
|
" -any point in the pointSet\n"
|
||||||
" -all points in the pointSet\n\n"
|
" -all points in the pointSet\n\n"
|
||||||
|
" -two consecutive points (an edge) in the pointSet\n\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::pointToFace::pointAction, 2>
|
const Foam::NamedEnum<Foam::pointToFace::pointAction, 3>
|
||||||
Foam::pointToFace::pointActionNames_;
|
Foam::pointToFace::pointActionNames_;
|
||||||
|
|
||||||
|
|
||||||
@ -126,6 +128,23 @@ void Foam::pointToFace::combine(topoSet& set, const bool add) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (option_ == EDGE)
|
||||||
|
{
|
||||||
|
const faceList& faces = mesh_.faces();
|
||||||
|
forAll(faces, faceI)
|
||||||
|
{
|
||||||
|
const face& f = faces[faceI];
|
||||||
|
|
||||||
|
forAll(f, fp)
|
||||||
|
{
|
||||||
|
if (loadedSet.found(f[fp]) && loadedSet.found(f.nextLabel(fp)))
|
||||||
|
{
|
||||||
|
addOrDelete(set, faceI, add);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -58,7 +58,8 @@ public:
|
|||||||
enum pointAction
|
enum pointAction
|
||||||
{
|
{
|
||||||
ANY,
|
ANY,
|
||||||
ALL
|
ALL,
|
||||||
|
EDGE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -67,7 +68,7 @@ private:
|
|||||||
//- Add usage string
|
//- Add usage string
|
||||||
static addToUsageTable usage_;
|
static addToUsageTable usage_;
|
||||||
|
|
||||||
static const NamedEnum<pointAction, 2> pointActionNames_;
|
static const NamedEnum<pointAction, 3> pointActionNames_;
|
||||||
|
|
||||||
//- Name of set to use
|
//- Name of set to use
|
||||||
word setName_;
|
word setName_;
|
||||||
|
|||||||
@ -67,17 +67,14 @@ functions
|
|||||||
sourceName movingWall;
|
sourceName movingWall;
|
||||||
|
|
||||||
//// if sampledSurface: dictionary with a sampledSurface
|
//// if sampledSurface: dictionary with a sampledSurface
|
||||||
//// Note: the sampledSurfaces will have cell-values, i.e.
|
//// Note: will not sample surface fields.
|
||||||
//// non-interpolated. Also will not sample surface fields.
|
|
||||||
//sampledSurfaceDict
|
//sampledSurfaceDict
|
||||||
//{
|
//{
|
||||||
// type cuttingPlane;
|
// // Sampling on triSurface
|
||||||
// planeType pointAndNormal;
|
// type sampledTriSurfaceMesh;
|
||||||
// pointAndNormalDict
|
// surface integrationPlane.stl;
|
||||||
// {
|
// source cells; // sample cells or boundaryFaces
|
||||||
// basePoint (0 0.099 0);
|
// interpolate true;
|
||||||
// normalVector (0 1 0);
|
|
||||||
// }
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// Operation: areaAverage/sum/weightedAverage ...
|
// Operation: areaAverage/sum/weightedAverage ...
|
||||||
|
|||||||
@ -53,7 +53,7 @@ namespace Foam
|
|||||||
const char* Foam::NamedEnum
|
const char* Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::fieldValues::faceSource::operationType,
|
Foam::fieldValues::faceSource::operationType,
|
||||||
9
|
11
|
||||||
>::names[] =
|
>::names[] =
|
||||||
{
|
{
|
||||||
"none",
|
"none",
|
||||||
@ -64,7 +64,9 @@ namespace Foam
|
|||||||
"areaIntegrate",
|
"areaIntegrate",
|
||||||
"min",
|
"min",
|
||||||
"max",
|
"max",
|
||||||
"CoV"
|
"CoV",
|
||||||
|
"areaNormalAverage",
|
||||||
|
"areaNormalIntegrate"
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -73,7 +75,7 @@ namespace Foam
|
|||||||
const Foam::NamedEnum<Foam::fieldValues::faceSource::sourceType, 3>
|
const Foam::NamedEnum<Foam::fieldValues::faceSource::sourceType, 3>
|
||||||
Foam::fieldValues::faceSource::sourceTypeNames_;
|
Foam::fieldValues::faceSource::sourceTypeNames_;
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::fieldValues::faceSource::operationType, 9>
|
const Foam::NamedEnum<Foam::fieldValues::faceSource::operationType, 11>
|
||||||
Foam::fieldValues::faceSource::operationTypeNames_;
|
Foam::fieldValues::faceSource::operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
@ -313,6 +315,35 @@ void Foam::fieldValues::faceSource::writeFileHeader()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
Foam::vector Foam::fieldValues::faceSource::processValues
|
||||||
|
(
|
||||||
|
const Field<vector>& values,
|
||||||
|
const vectorField& Sf,
|
||||||
|
const scalarField& weightField
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
switch (operation_)
|
||||||
|
{
|
||||||
|
case opAreaNormalAverage:
|
||||||
|
{
|
||||||
|
scalar result = sum(values&Sf)/sum(mag(Sf));
|
||||||
|
return vector(result, 0.0, 0.0);
|
||||||
|
}
|
||||||
|
case opAreaNormalIntegrate:
|
||||||
|
{
|
||||||
|
scalar result = sum(values&Sf);
|
||||||
|
return vector(result, 0.0, 0.0);
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
// Fall through to other operations
|
||||||
|
return processSameTypeValues(values, Sf, weightField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::fieldValues::faceSource::faceSource
|
Foam::fieldValues::faceSource::faceSource
|
||||||
|
|||||||
@ -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) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -65,7 +65,9 @@ Description
|
|||||||
- min
|
- min
|
||||||
- max
|
- max
|
||||||
- CoV (Coefficient of variation: standard deviation/mean)
|
- CoV (Coefficient of variation: standard deviation/mean)
|
||||||
|
- areaNormalAverage (vector with first component (average of) inproduct
|
||||||
|
of value and face area vector)
|
||||||
|
- areaNormalIntegrate ( ,, ,, (sum of) ,,
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
- faces on empty patches get ignored
|
- faces on empty patches get ignored
|
||||||
@ -75,7 +77,11 @@ Description
|
|||||||
negative pressure)
|
negative pressure)
|
||||||
- using sampledSurfaces:
|
- using sampledSurfaces:
|
||||||
- they do not do surface fields
|
- they do not do surface fields
|
||||||
- they use cell values - they do not do any interpolation.
|
- if interpolate=true they use interpolationCellPoint
|
||||||
|
otherwise they use cell values
|
||||||
|
- each triangle in sampledSurface is logically only in one cell
|
||||||
|
so interpolation will be wrong when triangles are larger than
|
||||||
|
cells. This can only happen for sampling on triSurfaceMesh.
|
||||||
- take care when using isoSurfaces - these might have duplicate
|
- take care when using isoSurfaces - these might have duplicate
|
||||||
triangles so integration might be wrong
|
triangles so integration might be wrong
|
||||||
|
|
||||||
@ -138,11 +144,13 @@ public:
|
|||||||
opAreaIntegrate,
|
opAreaIntegrate,
|
||||||
opMin,
|
opMin,
|
||||||
opMax,
|
opMax,
|
||||||
opCoV
|
opCoV,
|
||||||
|
opAreaNormalAverage,
|
||||||
|
opAreaNormalIntegrate
|
||||||
};
|
};
|
||||||
|
|
||||||
//- Operation type names
|
//- Operation type names
|
||||||
static const NamedEnum<operationType, 9> operationTypeNames_;
|
static const NamedEnum<operationType, 11> operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -194,7 +202,6 @@ protected:
|
|||||||
autoPtr<sampledSurface> surfacePtr_;
|
autoPtr<sampledSurface> surfacePtr_;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Initialise, e.g. face addressing
|
//- Initialise, e.g. face addressing
|
||||||
@ -212,12 +219,23 @@ protected:
|
|||||||
const bool mustGet = false
|
const bool mustGet = false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Apply the 'operation' to the values
|
//- Apply the 'operation' to the values. Operation has to
|
||||||
|
// preserve Type.
|
||||||
|
template<class Type>
|
||||||
|
Type processSameTypeValues
|
||||||
|
(
|
||||||
|
const Field<Type>& values,
|
||||||
|
const vectorField& Sf,
|
||||||
|
const scalarField& weightField
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Apply the 'operation' to the values. Wrapper around
|
||||||
|
// processSameTypeValues. See also template specialisation below.
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Type processValues
|
Type processValues
|
||||||
(
|
(
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
const scalarField& magSf,
|
const vectorField& Sf,
|
||||||
const scalarField& weightField
|
const scalarField& weightField
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -292,6 +310,17 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//- Specialisation of processing vectors for opAreaNormalAverage,
|
||||||
|
// opAreaNormalIntegrate (use inproduct - dimension reducing operation)
|
||||||
|
template<>
|
||||||
|
vector faceSource::processValues
|
||||||
|
(
|
||||||
|
const Field<vector>& values,
|
||||||
|
const vectorField& Sf,
|
||||||
|
const scalarField& weightField
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace fieldValues
|
} // End namespace fieldValues
|
||||||
|
|||||||
@ -27,6 +27,7 @@ License
|
|||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "sampledSurface.H"
|
#include "sampledSurface.H"
|
||||||
|
#include "interpolationCellPoint.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -65,13 +66,44 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::getFieldValues
|
|||||||
}
|
}
|
||||||
else if (obr_.foundObject<vf>(fieldName))
|
else if (obr_.foundObject<vf>(fieldName))
|
||||||
{
|
{
|
||||||
|
const vf& fld = obr_.lookupObject<vf>(fieldName);
|
||||||
|
|
||||||
if (surfacePtr_.valid())
|
if (surfacePtr_.valid())
|
||||||
{
|
{
|
||||||
return surfacePtr_().sample(obr_.lookupObject<vf>(fieldName));
|
if (surfacePtr_().interpolate())
|
||||||
|
{
|
||||||
|
const interpolationCellPoint<Type> interp(fld);
|
||||||
|
tmp<Field<Type> > tintFld(surfacePtr_().interpolate(interp));
|
||||||
|
const Field<Type>& intFld = tintFld();
|
||||||
|
|
||||||
|
// Average
|
||||||
|
const faceList& faces = surfacePtr_().faces();
|
||||||
|
tmp<Field<Type> > tavg
|
||||||
|
(
|
||||||
|
new Field<Type>(faces.size(), pTraits<Type>::zero)
|
||||||
|
);
|
||||||
|
Field<Type>& avg = tavg();
|
||||||
|
|
||||||
|
forAll(faces, faceI)
|
||||||
|
{
|
||||||
|
const face& f = faces[faceI];
|
||||||
|
forAll(f, fp)
|
||||||
|
{
|
||||||
|
avg[faceI] += intFld[f[fp]];
|
||||||
|
}
|
||||||
|
avg[faceI] /= f.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
return tavg;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return surfacePtr_().sample(fld);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return filterField(obr_.lookupObject<vf>(fieldName), true);
|
return filterField(fld, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,12 +126,11 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::getFieldValues
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Type Foam::fieldValues::faceSource::processValues
|
Type Foam::fieldValues::faceSource::processSameTypeValues
|
||||||
(
|
(
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
const scalarField& magSf,
|
const vectorField& Sf,
|
||||||
const scalarField& weightField
|
const scalarField& weightField
|
||||||
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
Type result = pTraits<Type>::zero;
|
Type result = pTraits<Type>::zero;
|
||||||
@ -122,11 +153,15 @@ Type Foam::fieldValues::faceSource::processValues
|
|||||||
}
|
}
|
||||||
case opAreaAverage:
|
case opAreaAverage:
|
||||||
{
|
{
|
||||||
|
const scalarField magSf = mag(Sf);
|
||||||
|
|
||||||
result = sum(values*magSf)/sum(magSf);
|
result = sum(values*magSf)/sum(magSf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opAreaIntegrate:
|
case opAreaIntegrate:
|
||||||
{
|
{
|
||||||
|
const scalarField magSf = mag(Sf);
|
||||||
|
|
||||||
result = sum(values*magSf);
|
result = sum(values*magSf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -142,6 +177,8 @@ Type Foam::fieldValues::faceSource::processValues
|
|||||||
}
|
}
|
||||||
case opCoV:
|
case opCoV:
|
||||||
{
|
{
|
||||||
|
const scalarField magSf = mag(Sf);
|
||||||
|
|
||||||
Type meanValue = sum(values*magSf)/sum(magSf);
|
Type meanValue = sum(values*magSf)/sum(magSf);
|
||||||
|
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
@ -169,6 +206,19 @@ Type Foam::fieldValues::faceSource::processValues
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Type Foam::fieldValues::faceSource::processValues
|
||||||
|
(
|
||||||
|
const Field<Type>& values,
|
||||||
|
const vectorField& Sf,
|
||||||
|
const scalarField& weightField
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return processSameTypeValues(values, Sf, weightField);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
@ -186,22 +236,22 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName)
|
|||||||
weightField = getFieldValues<scalar>(weightFieldName_, true);
|
weightField = getFieldValues<scalar>(weightFieldName_, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
scalarField magSf;
|
vectorField Sf;
|
||||||
|
|
||||||
if (surfacePtr_.valid())
|
if (surfacePtr_.valid())
|
||||||
{
|
{
|
||||||
// Get unoriented magSf
|
// Get oriented Sf
|
||||||
magSf = surfacePtr_().magSf();
|
Sf = surfacePtr_().Sf();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Get unoriented magSf
|
// Get oriented Sf
|
||||||
magSf = filterField(mesh().magSf(), false);
|
Sf = filterField(mesh().Sf(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Combine onto master
|
// Combine onto master
|
||||||
combineFields(values);
|
combineFields(values);
|
||||||
combineFields(magSf);
|
combineFields(Sf);
|
||||||
combineFields(weightField);
|
combineFields(weightField);
|
||||||
|
|
||||||
// apply weight field
|
// apply weight field
|
||||||
@ -210,7 +260,7 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName)
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
Type result = processValues(values, magSf, weightField);
|
Type result = processValues(values, Sf, weightField);
|
||||||
|
|
||||||
if (valueOutput_)
|
if (valueOutput_)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user