51 void Foam::leastSquaresFaVectors::makeLeastSquaresVectors()
const 54 <<
"Constructing finite area (invDist) least square gradient vectors" 57 pVectorsPtr_ = std::make_unique<edgeVectorField>
62 mesh().pointsInstance(),
71 auto& lsP = *pVectorsPtr_;
73 nVectorsPtr_ = std::make_unique<edgeVectorField>
78 mesh().pointsInstance(),
87 auto& lsN = *nVectorsPtr_;
99 const scalar minLenSqr(SMALL*SMALL);
103 const label own = owner[facei];
104 const label nei = neighbour[facei];
109 const scalar magSqrDist = d.magSqr();
110 if (magSqrDist >= minLenSqr)
119 for (
const auto& patchLsP : lsP.boundaryField())
121 const faPatch&
p = patchLsP.patch();
129 const vector& d = pd[patchFacei];
132 const scalar magSqrDist = d.
magSqr();
133 if (magSqrDist >= minLenSqr)
135 dd[edgeFaces[patchFacei]] +=
sqr(d)/magSqrDist;
148 const label own = owner[facei];
149 const label nei = neighbour[facei];
154 const scalar magSqrDist = d.magSqr();
155 if (magSqrDist >= minLenSqr)
157 lsP[facei] = (invDd[own] & d)/magSqrDist;
158 lsN[facei] = -(invDd[nei] & d)/magSqrDist;
168 for (
auto& patchLsP : lsP.boundaryFieldRef())
170 const faPatch&
p = patchLsP.patch();
178 const vector& d = pd[patchFacei];
181 const scalar magSqrDist = d.
magSqr();
182 if (magSqrDist >= minLenSqr)
184 patchLsP[patchFacei] =
185 (invDd[edgeFaces[patchFacei]] & d)/magSqrDist;
196 <<
"Done constructing finite area least square gradient vectors" <<
nl;
204 makeLeastSquaresVectors();
207 return *pVectorsPtr_;
215 makeLeastSquaresVectors();
218 return *nVectorsPtr_;
225 <<
"Clearing least square data" <<
nl;
227 pVectorsPtr_.reset(
nullptr);
228 nVectorsPtr_.reset(
nullptr);
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
virtual bool movePoints()
Delete the least square vectors when the mesh moves.
Field< symmTensor > symmTensorField
Specialisation of Field<T> for symmTensor.
const edgeVectorField & nVectors() const
Return reference to neighbour least square vectors.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
constexpr char nl
The newline '\n' character (0x0a)
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
leastSquaresFaVectors(const faMesh &)
Construct given an faMesh.
Generic GeometricField class.
Ignore writing from objectRegistry::writeObject()
const dimensionSet dimless
Dimensionless.
UList< label > labelUList
A UList of labels.
const labelUList & neighbour() const
Internal face neighbour.
#define forAll(list, i)
Loop across all elements in list.
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
#define DebugInFunction
Report an information message using Foam::Info.
scalar magSqr() const
The length (L2-norm) squared of the vector.
#define DebugInfo
Report an information message using Foam::Info.
defineTypeNameAndDebug(combustionModel, 0)
const labelUList & owner() const
Internal face owner. Note bypassing virtual mechanism so.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
const edgeVectorField & pVectors() const
Return reference to owner least square vectors.
Field< vector > vectorField
Specialisation of Field<T> for vector.
Least-squares gradient scheme vectors for the Finite Area method.
GeometricField< vector, faPatchField, areaMesh > areaVectorField
Do not request registration (bool: false)
static constexpr const zero Zero
Global zero (0)