38 #include <HashTable.H>
39 #include "addToRunTimeSelectionTable.H"
61 leastSquaresBase(mesh_)
63 faceSet degenerateFacesSet
67 "degenerateStencilFaces",
68 IOobject::READ_IF_PRESENT,
72 if (degenerateFacesSet.size() > 0)
74 Info <<
"Found set with faces for reduced approximation QGD terms" << endl;
79 const labelList degenerateFaces = degenerateFacesSet.toc();
84 forAll(degenerateFaces, iDegFace)
86 label faceId = degenerateFaces[iDegFace];
88 if (
mesh_.isInternalFace(faceId))
90 intDegFaces.insert(faceId);
94 label patchId =
mesh_.boundaryMesh().whichPatch(faceId);
107 procDegFaces[iPatch].insert
111 mesh_.boundaryMesh()[patchId].start()
118 forAll(procDegFaces, iProcPair)
120 if (procDegFaces[iProcPair].toc().size() > 0)
124 procDegFaces[iProcPair].toc()
131 Info <<
"Set \"degenerateStencilFaces\" with faces for reduced approximation QGD terms not found" << endl;
147 surfaceVectorField gradComp0col = Grad(iVF.component(0));
148 surfaceVectorField gradComp1col = Grad(iVF.component(1));
149 surfaceVectorField gradComp2col = Grad(iVF.component(2));
151 tmp<surfaceTensorField> tgradIVF(0* nf_* fvc::snGrad(iVF));
152 surfaceTensorField& gradIVF = tgradIVF.ref();
155 gradIVF.primitiveFieldRef().replace(0, gradComp0col.primitiveField().component(0));
156 gradIVF.primitiveFieldRef().replace(1, gradComp1col.primitiveField().component(0));
157 gradIVF.primitiveFieldRef().replace(2, gradComp2col.primitiveField().component(0));
159 gradIVF.primitiveFieldRef().replace(3, gradComp0col.primitiveField().component(1));
160 gradIVF.primitiveFieldRef().replace(4, gradComp1col.primitiveField().component(1));
161 gradIVF.primitiveFieldRef().replace(5, gradComp2col.primitiveField().component(1));
163 gradIVF.primitiveFieldRef().replace(6, gradComp0col.primitiveField().component(2));
164 gradIVF.primitiveFieldRef().replace(7, gradComp1col.primitiveField().component(2));
165 gradIVF.primitiveFieldRef().replace(8, gradComp2col.primitiveField().component(2));
168 forAll(mesh_.boundaryMesh(), patchi)
170 forAll(mesh_.boundary()[patchi], facei)
172 gradIVF.boundaryFieldRef()[patchi][facei].component(0) =
173 gradComp0col.boundaryField()[patchi][facei].component(0);
174 gradIVF.boundaryFieldRef()[patchi][facei].component(1) =
175 gradComp1col.boundaryField()[patchi][facei].component(0);
176 gradIVF.boundaryFieldRef()[patchi][facei].component(2) =
177 gradComp2col.boundaryField()[patchi][facei].component(0);
179 gradIVF.boundaryFieldRef()[patchi][facei].component(3) =
180 gradComp0col.boundaryField()[patchi][facei].component(1);
181 gradIVF.boundaryFieldRef()[patchi][facei].component(4) =
182 gradComp1col.boundaryField()[patchi][facei].component(1);
183 gradIVF.boundaryFieldRef()[patchi][facei].component(5) =
184 gradComp2col.boundaryField()[patchi][facei].component(1);
186 gradIVF.boundaryFieldRef()[patchi][facei].component(6) =
187 gradComp0col.boundaryField()[patchi][facei].component(2);
188 gradIVF.boundaryFieldRef()[patchi][facei].component(7) =
189 gradComp1col.boundaryField()[patchi][facei].component(2);
190 gradIVF.boundaryFieldRef()[patchi][facei].component(8) =
191 gradComp2col.boundaryField()[patchi][facei].component(2);
206 surfaceVectorField gradComp0 = Grad(iVF.component(0));
207 surfaceVectorField gradComp1 = Grad(iVF.component(1));
208 surfaceVectorField gradComp2 = Grad(iVF.component(2));
210 tmp<surfaceScalarField> tdivIVF(0 * (nf_ & fvc::snGrad(iVF)));
211 surfaceScalarField& divIVF = tdivIVF.ref();
213 divIVF.primitiveFieldRef() = gradComp0.primitiveField().component(0)
214 + gradComp1.primitiveField().component(1)
215 + gradComp2.primitiveField().component(2);
217 forAll(mesh_.boundary(), patchi)
219 divIVF.boundaryFieldRef()[patchi] =
220 gradComp0.boundaryField()[patchi].component(0)
222 gradComp1.boundaryField()[patchi].component(1)
224 gradComp2.boundaryField()[patchi].component(2);
238 tmp<surfaceVectorField> gradComp0 (Grad(iTF.component(0)));
239 tmp<surfaceVectorField> gradComp1 (Grad(iTF.component(1)));
240 tmp<surfaceVectorField> gradComp2 (Grad(iTF.component(2)));
242 tmp<surfaceVectorField> gradComp3 (Grad(iTF.component(3)));
243 tmp<surfaceVectorField> gradComp4 (Grad(iTF.component(4)));
244 tmp<surfaceVectorField> gradComp5 (Grad(iTF.component(5)));
246 tmp<surfaceVectorField> gradComp6 (Grad(iTF.component(6)));
247 tmp<surfaceVectorField> gradComp7 (Grad(iTF.component(7)));
248 tmp<surfaceVectorField> gradComp8 (Grad(iTF.component(8)));
250 tmp<surfaceScalarField> divComp0 (gradComp0().component(0) + gradComp3().component(1) + gradComp6().component(2));
251 tmp<surfaceScalarField> divComp1 (gradComp1().component(0) + gradComp4().component(1) + gradComp7().component(2));
252 tmp<surfaceScalarField> divComp2 (gradComp2().component(0) + gradComp5().component(1) + gradComp8().component(2));
254 tmp<surfaceVectorField> tdivITF(0*nf_*fvc::snGrad(iTF.component(0)));
255 surfaceVectorField& divITF = tdivITF.ref();
257 divITF.primitiveFieldRef().replace(0, divComp0().primitiveField());
258 divITF.primitiveFieldRef().replace(1, divComp1().primitiveField());
259 divITF.primitiveFieldRef().replace(2, divComp2().primitiveField());
261 forAll(mesh_.boundary(), patchi)
263 forAll(mesh_.boundary()[patchi], facei)
265 divITF.boundaryFieldRef()[patchi][facei].component(0) =
266 divComp0().boundaryField()[patchi][facei];
267 divITF.boundaryFieldRef()[patchi][facei].component(1) =
268 divComp1().boundaryField()[patchi][facei];
269 divITF.boundaryFieldRef()[patchi][facei].component(2) =
270 divComp2().boundaryField()[patchi][facei];
List< DynamicList< label > > procDegFaces_
tmp< surfaceVectorField > Grad(const volScalarField &iF)
Calculate gradient of volume scalar function on the faces.
tmp< surfaceScalarField > Div(const volVectorField &iVF)
Calculate divergence of volume vector field on the faces.
addToRunTimeSelectionTable(fvscStencil, GaussVolPoint, components)
HashSet< label, Hash< label > > labelHashSet
leastSquares(const IOobject &)
Construct from IOobject. Optional flag for if IOobject is the.
~leastSquares()
Destructor.
defineTypeNameAndDebug(fvscStencil, 0)
DynamicList< label > internalDegFaces_