40 const scalarField& levelC,
41 const scalarField& levelP,
42 const DimensionedField<Type, volMesh>& positiveC,
43 const DimensionedField<Type, pointMesh>& positiveP,
44 const DimensionedField<Type, volMesh>& negativeC,
45 const DimensionedField<Type, pointMesh>& negativeP
48 auto tresult = DimensionedField<Type, volMesh>::New
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,
118 const scalarField& levelF,
119 const scalarField& levelP,
120 const Field<Type>& positiveF,
121 const Field<Type>& positiveP,
122 const Field<Type>& negativeF,
123 const Field<Type>& negativeP
126 typedef typename outerProduct<Type, vector>::type sumType;
128 auto tResult = tmp<Field<Type>>::New(
patch.size(), Zero);
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;
A class for managing temporary objects.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
const std::string patch
OpenFOAM patch number as a std::string.
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.
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.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
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.
#define forAll(list, i)
Loop across all elements in list.