42 const DimensionedField<Type, volMesh>& positiveC,
43 const DimensionedField<Type, pointMesh>& positiveP,
44 const DimensionedField<Type, volMesh>& negativeC,
45 const DimensionedField<Type, pointMesh>& negativeP
50 IOobject::scopedName(positiveC.name(),
"levelSetAverage"),
53 positiveC.dimensions()
55 auto& result = tresult.ref();
59 const List<tetIndices> cellTetIs =
60 polyMeshTetDecomposition::cellTetIndices(
mesh, cI);
65 forAll(cellTetIs, cellTetI)
67 const triFace triIs = cellTetIs[cellTetI].faceTriIs(
mesh);
69 const FixedList<point, 4>
72 mesh.cellCentres()[cI],
73 mesh.points()[triIs[0]],
74 mesh.points()[triIs[1]],
75 mesh.points()[triIs[2]]
77 const FixedList<scalar, 4>
85 const cut::volumeIntegrateOp<Type>
86 positive = FixedList<Type, 4>
93 const cut::volumeIntegrateOp<Type>
94 negative = FixedList<Type, 4>
102 v += cut::volumeOp()(tet);
104 r +=
tetCut(tet, level, positive, negative);
117 const fvPatch&
patch,
120 const Field<Type>& positiveF,
121 const Field<Type>& positiveP,
122 const Field<Type>& negativeF,
123 const Field<Type>& negativeP
129 auto& result = tResult.ref();
133 const face&
f =
patch.patch().localFaces()[fI];
138 for (label edgei = 0; edgei <
f.nEdges(); ++edgei)
140 const edge
e =
f.edge(edgei);
142 const FixedList<point, 3>
145 patch.patch().faceCentres()[fI],
146 patch.patch().localPoints()[
e[0]],
147 patch.patch().localPoints()[
e[1]]
149 const FixedList<scalar, 3>
156 const cut::areaIntegrateOp<Type>
157 positive = FixedList<Type, 3>
163 const cut::areaIntegrateOp<Type>
164 negative = FixedList<Type, 3>
171 a += cut::areaOp()(tri);
173 r +=
triCut(tri, level, positive, negative);
176 result[fI] = a/
magSqr(a) & r;
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
cut::opAddResult< AboveOp, BelowOp >::type tetCut(const FixedList< point, 4 > &tet, const FixedList< scalar, 4 > &level, const AboveOp &aboveOp, const BelowOp &belowOp)
As triCut, but for a tetrahedron.
cut::opAddResult< AboveOp, BelowOp >::type triCut(const FixedList< point, 3 > &tri, const FixedList< scalar, 3 > &level, const AboveOp &aboveOp, const BelowOp &belowOp)
Cut a triangle along the zero plane defined by the given levels.
#define forAll(list, i)
Loop across all elements in list.
tmp< DimensionedField< Type, volMesh > > levelSetAverage(const fvMesh &mesh, const scalarField &levelC, const scalarField &levelP, const DimensionedField< Type, volMesh > &positiveC, const DimensionedField< Type, pointMesh > &positiveP, const DimensionedField< Type, volMesh > &negativeC, const DimensionedField< Type, pointMesh > &negativeP)
Calculate the average value of two fields, one on each side of a level set.
const dimensionedScalar e
Elementary charge.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const std::string patch
OpenFOAM patch number as a std::string.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
A class for managing temporary objects.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
static constexpr const zero Zero
Global zero (0)