59 void Foam::leastSquaresVectors::makeLeastSquaresVectors()
const
63 Info<<
"leastSquaresVectors::makeLeastSquaresVectors() :"
64 <<
"Constructing least square gradient vectors"
68 const fvMesh&
mesh = mesh_;
75 mesh_.pointsInstance(),
91 mesh_.pointsInstance(),
116 label own = owner[facei];
117 label nei = neighbour[facei];
122 dd[own] += (1 - w[facei])*wdd;
123 dd[nei] += w[facei]*wdd;
132 const fvPatch&
p = pw.patch();
137 mesh.Sf().boundaryField()[
patchi]
139 mesh.magSf().boundaryField()[
patchi]
140 *mesh.deltaCoeffs().boundaryField()[
patchi]
143 if (!mesh.orthogonal())
145 pd -= mesh.correctionVectors().boundaryField()[
patchi]
146 /mesh.deltaCoeffs().boundaryField()[
patchi];
153 const vector& d = pd[patchFacei];
155 dd[faceCells[patchFacei]] +=
156 ((1 - pw[patchFacei])*pMagSf[patchFacei]/
magSqr(d))*
sqr(d);
163 const vector& d = pd[patchFacei];
165 dd[faceCells[patchFacei]] +=
179 label own = owner[facei];
180 label nei = neighbour[facei];
182 vector d = C[nei] - C[own];
183 scalar magSfByMagSqrd = magSf[facei]/
magSqr(d);
185 lsP[facei] = (1 - w[facei])*magSfByMagSqrd*(invDd[own] & d);
186 lsN[facei] = -w[facei]*magSfByMagSqrd*(invDd[nei] &
d);
196 const fvPatch& p = pw.patch();
201 mesh.Sf().boundaryField()[
patchi]
203 mesh.magSf().boundaryField()[
patchi]
204 *mesh.deltaCoeffs().boundaryField()[
patchi]
207 if (!mesh.orthogonal())
209 pd -= mesh.correctionVectors().boundaryField()[
patchi]
210 /mesh.deltaCoeffs().boundaryField()[
patchi];
218 const vector& d = pd[patchFacei];
220 patchLsP[patchFacei] =
221 ((1 - pw[patchFacei])*pMagSf[patchFacei]/
magSqr(d))
222 *(invDd[faceCells[patchFacei]] & d);
229 const vector& d = pd[patchFacei];
231 patchLsP[patchFacei] =
232 pMagSf[patchFacei]*(1.0/
magSqr(d))
233 *(invDd[faceCells[patchFacei]] & d);
325 Info<<
"leastSquaresVectors::makeLeastSquaresVectors() :"
326 <<
"Finished constructing least square gradient vectors"
336 makeLeastSquaresVectors();
339 return *pVectorsPtr_;
347 makeLeastSquaresVectors();
350 return *nVectorsPtr_;