44 MeshObject<fvMesh,
Foam::MoveableMeshObject, leastSquaresVectors>(
mesh),
50 mesh_.pointsInstance(),
64 mesh_.pointsInstance(),
74 calcLeastSquaresVectors();
86 void Foam::leastSquaresVectors::calcLeastSquaresVectors()
90 const fvMesh&
mesh = mesh_;
94 const labelUList& neighbour = mesh_.neighbour();
106 const label own = owner[facei];
107 const label nei = neighbour[facei];
112 dd[own] += (1.0 - w[facei])*wdd;
113 dd[nei] += w[facei]*wdd;
118 pVectors_.boundaryFieldRef();
120 forAll(pVectorsBf, patchi)
125 const fvPatch&
p = pw.patch();
126 const labelUList& faceCells =
p.patch().faceCells();
135 const vector& d = pd[patchFacei];
137 dd[faceCells[patchFacei]] +=
138 ((1 - pw[patchFacei])*pMagSf[patchFacei]/
magSqr(d))*
sqr(d);
145 const vector& d = pd[patchFacei];
147 dd[faceCells[patchFacei]] +=
161 const label own = owner[facei];
162 const label nei = neighbour[facei];
165 const scalar magSfByMagSqrd = magSf[facei]/
magSqr(d);
167 pVectors_[facei] = (1.0 - w[facei])*magSfByMagSqrd*(invDd[own] & d);
168 nVectors_[facei] = -w[facei]*magSfByMagSqrd*(invDd[nei] & d);
171 forAll(pVectorsBf, patchi)
178 const fvPatch&
p = pw.patch();
188 const vector& d = pd[patchFacei];
190 patchLsP[patchFacei] =
191 ((1.0 - pw[patchFacei])*pMagSf[patchFacei]/
magSqr(d))
192 *(invDd[faceCells[patchFacei]] & d);
199 const vector& d = pd[patchFacei];
201 patchLsP[patchFacei] =
202 pMagSf[patchFacei]*(1.0/
magSqr(d))
203 *(invDd[faceCells[patchFacei]] & d);
208 DebugInfo <<
"Finished calculating least square gradient vectors" <<
nl;
214 calcLeastSquaresVectors();
fvsPatchField< vector > fvsPatchVectorField
fvsPatchField< scalar > fvsPatchScalarField
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)
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
leastSquaresVectors(const fvMesh &)
Construct given an fvMesh.
GeometricBoundaryField< vector, fvsPatchField, surfaceMesh > Boundary
Type of boundary fields.
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.
virtual const surfaceScalarField & weights() const
Return reference to linear difference weighting factors.
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
#define DebugInFunction
Report an information message using Foam::Info.
#define DebugInfo
Report an information message using Foam::Info.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
defineTypeNameAndDebug(combustionModel, 0)
virtual ~leastSquaresVectors()
Destructor.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Field< vector > vectorField
Specialisation of Field<T> for vector.
const volVectorField & C() const
Return cell centres as volVectorField.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
static constexpr const zero Zero
Global zero (0)