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;
117 surfaceVectorField::Boundary& pVectorsBf =
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();