36 #include <HashTable.H>
37 #include "addToRunTimeSelectionTable.H"
59 leastSquaresBase(
mesh_)
61 faceSet degenerateFacesSet
65 "degenerateStencilFaces",
66 IOobject::READ_IF_PRESENT,
70 if (degenerateFacesSet.size() > 0)
72 Info <<
"Found set with faces for reduced approximation QGD terms" << endl;
77 const labelList degenerateFaces = degenerateFacesSet.toc();
82 forAll(degenerateFaces, iDegFace)
84 label faceId = degenerateFaces[iDegFace];
86 if (
mesh_.isInternalFace(faceId))
88 intDegFaces.insert(faceId);
92 label patchId =
mesh_.boundaryMesh().whichPatch(faceId);
105 procDegFaces[iPatch].insert
109 mesh_.boundaryMesh()[patchId].start()
116 forAll(procDegFaces, iProcPair)
118 if (procDegFaces[iProcPair].toc().size() > 0)
122 procDegFaces[iProcPair].toc()
129 Info <<
"Set \"degenerateStencilFaces\" with faces for reduced approximation QGD terms not found" << endl;
145 surfaceVectorField gradComp0col =
Grad(iVF.component(0));
146 surfaceVectorField gradComp1col =
Grad(iVF.component(1));
147 surfaceVectorField gradComp2col =
Grad(iVF.component(2));
149 tmp<surfaceTensorField> tgradIVF(0*
nf_* fvc::snGrad(iVF));
150 surfaceTensorField& gradIVF = tgradIVF.ref();
153 gradIVF.primitiveFieldRef().replace(0, gradComp0col.primitiveField().component(0));
154 gradIVF.primitiveFieldRef().replace(1, gradComp1col.primitiveField().component(0));
155 gradIVF.primitiveFieldRef().replace(2, gradComp2col.primitiveField().component(0));
157 gradIVF.primitiveFieldRef().replace(3, gradComp0col.primitiveField().component(1));
158 gradIVF.primitiveFieldRef().replace(4, gradComp1col.primitiveField().component(1));
159 gradIVF.primitiveFieldRef().replace(5, gradComp2col.primitiveField().component(1));
161 gradIVF.primitiveFieldRef().replace(6, gradComp0col.primitiveField().component(2));
162 gradIVF.primitiveFieldRef().replace(7, gradComp1col.primitiveField().component(2));
163 gradIVF.primitiveFieldRef().replace(8, gradComp2col.primitiveField().component(2));
170 gradIVF.boundaryFieldRef()[patchi][facei].component(0) =
171 gradComp0col.boundaryField()[patchi][facei].component(0);
172 gradIVF.boundaryFieldRef()[patchi][facei].component(1) =
173 gradComp1col.boundaryField()[patchi][facei].component(0);
174 gradIVF.boundaryFieldRef()[patchi][facei].component(2) =
175 gradComp2col.boundaryField()[patchi][facei].component(0);
177 gradIVF.boundaryFieldRef()[patchi][facei].component(3) =
178 gradComp0col.boundaryField()[patchi][facei].component(1);
179 gradIVF.boundaryFieldRef()[patchi][facei].component(4) =
180 gradComp1col.boundaryField()[patchi][facei].component(1);
181 gradIVF.boundaryFieldRef()[patchi][facei].component(5) =
182 gradComp2col.boundaryField()[patchi][facei].component(1);
184 gradIVF.boundaryFieldRef()[patchi][facei].component(6) =
185 gradComp0col.boundaryField()[patchi][facei].component(2);
186 gradIVF.boundaryFieldRef()[patchi][facei].component(7) =
187 gradComp1col.boundaryField()[patchi][facei].component(2);
188 gradIVF.boundaryFieldRef()[patchi][facei].component(8) =
189 gradComp2col.boundaryField()[patchi][facei].component(2);
204 surfaceVectorField gradComp0 =
Grad(iVF.component(0));
205 surfaceVectorField gradComp1 =
Grad(iVF.component(1));
206 surfaceVectorField gradComp2 =
Grad(iVF.component(2));
208 tmp<surfaceScalarField> tdivIVF(0 * (
nf_ & fvc::snGrad(iVF)));
209 surfaceScalarField& divIVF = tdivIVF.ref();
211 divIVF.primitiveFieldRef() = gradComp0.primitiveField().component(0)
212 + gradComp1.primitiveField().component(1)
213 + gradComp2.primitiveField().component(2);
217 divIVF.boundaryFieldRef()[patchi] =
218 gradComp0.boundaryField()[patchi].component(0)
220 gradComp1.boundaryField()[patchi].component(1)
222 gradComp2.boundaryField()[patchi].component(2);
236 tmp<surfaceVectorField> gradComp0 (
Grad(iTF.component(0)));
237 tmp<surfaceVectorField> gradComp1 (
Grad(iTF.component(1)));
238 tmp<surfaceVectorField> gradComp2 (
Grad(iTF.component(2)));
240 tmp<surfaceVectorField> gradComp3 (
Grad(iTF.component(3)));
241 tmp<surfaceVectorField> gradComp4 (
Grad(iTF.component(4)));
242 tmp<surfaceVectorField> gradComp5 (
Grad(iTF.component(5)));
244 tmp<surfaceVectorField> gradComp6 (
Grad(iTF.component(6)));
245 tmp<surfaceVectorField> gradComp7 (
Grad(iTF.component(7)));
246 tmp<surfaceVectorField> gradComp8 (
Grad(iTF.component(8)));
248 tmp<surfaceScalarField> divComp0 (gradComp0().component(0) + gradComp3().component(1) + gradComp6().component(2));
249 tmp<surfaceScalarField> divComp1 (gradComp1().component(0) + gradComp4().component(1) + gradComp7().component(2));
250 tmp<surfaceScalarField> divComp2 (gradComp2().component(0) + gradComp5().component(1) + gradComp8().component(2));
252 tmp<surfaceVectorField> tdivITF(0*
nf_*fvc::snGrad(iTF.component(0)));
253 surfaceVectorField& divITF = tdivITF.ref();
255 divITF.primitiveFieldRef().replace(0, divComp0().primitiveField());
256 divITF.primitiveFieldRef().replace(1, divComp1().primitiveField());
257 divITF.primitiveFieldRef().replace(2, divComp2().primitiveField());
263 divITF.boundaryFieldRef()[patchi][facei].component(0) =
264 divComp0().boundaryField()[patchi][facei];
265 divITF.boundaryFieldRef()[patchi][facei].component(1) =
266 divComp1().boundaryField()[patchi][facei];
267 divITF.boundaryFieldRef()[patchi][facei].component(2) =
268 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.
fvscStencil(const IOobject &io)
Construct from components.
virtual tmp< surfaceVectorField > Grad(const volScalarField &vF)
~leastSquares()
Destructor.
defineTypeNameAndDebug(fvscStencil, 0)
DynamicList< label > internalDegFaces_