50 mesh_.pointsInstance(),
64 mesh_.pointsInstance(),
74 calcLeastSquaresVectors();
86 void Foam::leastSquaresVectors::calcLeastSquaresVectors()
90 const fvMesh&
mesh = mesh_;
94 const labelUList& neighbour = mesh_.neighbour();
103 const label own = owner[facei];
104 const label nei = neighbour[facei];
107 const scalar magSqrDist = d.magSqr();
109 if (magSqrDist > ROOTVSMALL)
117 auto& blsP = pVectors_.boundaryField();
123 const fvPatch&
p = patchLsP.patch();
124 const labelUList& faceCells =
p.patch().faceCells();
131 const vector& d = pd[patchFacei];
132 const scalar magSqrDist = d.
magSqr();
134 if (magSqrDist > ROOTVSMALL)
136 dd[faceCells[patchFacei]] +=
sqr(d)/magSqrDist;
149 const label own = owner[facei];
150 const label nei = neighbour[facei];
153 const scalar magSqrDist = d.magSqr();
155 if (magSqrDist > ROOTVSMALL)
157 pVectors_[facei] = (invDd[own] & d)/magSqrDist;
158 nVectors_[facei] = -(invDd[nei] & d)/magSqrDist;
162 pVectors_[facei] =
Zero;
163 nVectors_[facei] =
Zero;
171 const fvPatch&
p = patchLsP.patch();
179 const vector& d = pd[patchFacei];
180 const scalar magSqrDist = d.
magSqr();
182 if (magSqrDist > ROOTVSMALL)
184 patchLsP[patchFacei] =
185 (invDd[faceCells[patchFacei]] & d)/magSqrDist;
189 patchLsP[patchFacei] =
Zero;
194 DebugInfo <<
"Finished calculating least square gradient vectors" <<
endl;
200 calcLeastSquaresVectors();
fvsPatchField< vector > fvsPatchVectorField
Field< symmTensor > symmTensorField
Specialisation of Field<T> for symmTensor.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
leastSquaresVectors(const fvMesh &)
Construct given an fvMesh.
Least-squares gradient scheme vectors.
const dimensionSet dimless
Dimensionless.
GeometricField< vector, fvPatchField, volMesh > volVectorField
UList< label > labelUList
A UList of labels.
virtual bool movePoints()
Delete the least square vectors when the mesh moves.
#define forAll(list, i)
Loop across all elements in list.
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
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)
virtual ~leastSquaresVectors()
Destructor.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Mesh data needed to do the Finite Volume discretisation.
Field< vector > vectorField
Specialisation of Field<T> for vector.
const volVectorField & C() const
Return cell centres as volVectorField.
Defines the attributes of an object for which implicit objectRegistry management is supported...
static constexpr const zero Zero
Global zero (0)