57template<
class Type,
class NVDweight>
60 const GeometricField<Type, faPatchField, areaMesh>&
phi
65 tmp<edgeScalarField> tWeightingFactors
67 new edgeScalarField(
mesh.edgeInterpolation::weights())
69 edgeScalarField& weightingFactors = tWeightingFactors.
ref();
71 scalarField& weights = weightingFactors.primitiveFieldRef();
73 tmp<areaScalarField> tvf = limiter(
phi);
74 const areaScalarField& vf = tvf();
76 const areaVectorField gradc(fac::grad(vf));
91 const labelUList& owner =
mesh.owner();
92 const labelUList& neighbour =
mesh.neighbour();
93 const vectorField&
n =
mesh.faceAreaNormals().internalField();
94 const vectorField& c =
mesh.areaCentres().internalField();
98 vector d(c[neighbour[edge]] - c[owner[edge]]);
100 if (edgeFlux_[edge] > 0)
102 d.removeCollinear(
n[owner[edge]]);
106 d.removeCollinear(
n[neighbour[edge]]);
109 d *=
mesh.edgeInterpolation::lPN().internalField()[edge];
112 if (d.magSqr() < ROOTSMALL)
114 d = vector::uniform(SMALL);
126 gradc[neighbour[edge]],
132 auto& bWeights = weightingFactors.boundaryFieldRef();
136 if (bWeights[patchI].
coupled())
140 const scalarField& pEdgeFlux = edgeFlux_.boundaryField()[patchI];
142 scalarField pVfP(vf.boundaryField()[patchI].patchInternalField());
144 scalarField pVfN(vf.boundaryField()[patchI].patchNeighbourField());
148 gradc.boundaryField()[patchI].patchInternalField()
153 gradc.boundaryField()[patchI].patchNeighbourField()
158 mesh.areaCentres().boundaryField()[patchI].patchInternalField()
163 mesh.areaCentres().boundaryField()[patchI]
164 .patchNeighbourField()
169 mesh.faceAreaNormals().boundaryField()[patchI]
170 .patchInternalField()
175 mesh.faceAreaNormals().boundaryField()[patchI]
176 .patchNeighbourField()
181 mesh.edgeInterpolation::lPN().boundaryField()[patchI]
186 vector d(CN[edgeI] - CP[edgeI]);
188 if (pEdgeFlux[edgeI] > 0)
190 d.removeCollinear(nP[edgeI]);
194 d.removeCollinear(nN[edgeI]);
200 if (d.magSqr() < ROOTSMALL)
202 d = vector::uniform(SMALL);
221 return tWeightingFactors;
Generic GeometricField class.
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef().
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
static Form uniform(const Cmpt &s)
Return a VectorSpace with all elements = s.
Vector< Cmpt > & normalise(const scalar tol=ROOTVSMALL)
Inplace normalise the vector by its magnitude.
scalar magSqr() const
The length (L2-norm) squared of the vector.
Vector< Cmpt > & removeCollinear(const Vector< Cmpt > &unitVec)
Inplace removal of components that are collinear to the given unit vector.
const faMesh & mesh() const
Return mesh reference.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
virtual tmp< edgeScalarField > weights(const GeometricField< Type, faPatchField, areaMesh > &) const
Return the interpolation weighting factors.
const edgeScalarField & edgeFlux_
A class for managing temporary objects.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Calculate the gradient of the given field.
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > > grad(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
GeometricField< tensor, faPatchField, areaMesh > areaTensorField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
GeometricField< vector, faPatchField, areaMesh > areaVectorField
GeometricField< scalar, faePatchField, edgeMesh > edgeScalarField
GeometricField< scalar, faPatchField, areaMesh > areaScalarField
Field< vector > vectorField
Specialisation of Field<T> for vector.
UList< label > labelUList
A UList of labels.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
tmp< areaScalarField > limiter(const areaScalarField &phi)
#define forAll(list, i)
Loop across all elements in list.