51void 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);
static const Foam::dimensionedScalar C("", Foam::dimTemperature, 234.5)
Graphite solid properties.
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const faMesh & mesh() const noexcept
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Finite area patch class. Used for 2-D non-Euclidian finite area method.
const labelUList & owner() const
Internal face owner. Note bypassing virtual mechanism so.
const labelUList & neighbour() const
Internal face neighbour.
Least-squares gradient scheme vectors for the Finite Area method.
virtual bool movePoints()
Delete the least square vectors when the mesh moves.
leastSquaresFaVectors(const faMesh &)
Construct given an faMesh.
const edgeVectorField & pVectors() const
Return reference to owner least square vectors.
const edgeVectorField & nVectors() const
Return reference to neighbour least square vectors.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define DebugInfo
Report an information message using Foam::Info.
#define DebugInFunction
Report an information message using Foam::Info.
GeometricField< vector, faePatchField, edgeMesh > edgeVectorField
const dimensionSet dimless
Dimensionless.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
GeometricField< vector, faPatchField, areaMesh > areaVectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Field< symmTensor > symmTensorField
Specialisation of Field<T> for symmTensor.
static constexpr const zero Zero
Global zero (0).
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
UList< label > labelUList
A UList of labels.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.