40 #include "wedgeFvPatch.H"
41 #include "symmetryPlaneFvPatch.H"
42 #include "symmetryFvPatch.H"
43 #include "emptyFvPatch.H"
44 #include <HashTable.H>
46 #include "addToRunTimeSelectionTable.H"
77 return Grad(iVF, linearInterpolate(iVF));
89 tmp<surfaceTensorField> tgradIVF(0*nf_*fvc::snGrad(iVF));
90 surfaceScalarField tField = sVF.component(0)*0;
91 surfaceTensorField& gradIVF = tgradIVF.ref();
93 faceScalarDer(iVF.primitiveField().component(0),sVF.primitiveField().component(0),0,tField);
94 gradIVF.primitiveFieldRef().replace(0,tField);
96 faceScalarDer(iVF.primitiveField().component(0),sVF.primitiveField().component(0),1,tField);
97 gradIVF.primitiveFieldRef().replace(3,tField);
99 faceScalarDer(iVF.primitiveField().component(0),sVF.primitiveField().component(0),2,tField);
100 gradIVF.primitiveFieldRef().replace(6,tField);
102 faceScalarDer(iVF.primitiveField().component(1),sVF.primitiveField().component(1),0,tField);
103 gradIVF.primitiveFieldRef().replace(1,tField);
105 faceScalarDer(iVF.primitiveField().component(1),sVF.primitiveField().component(1),1,tField);
106 gradIVF.primitiveFieldRef().replace(4,tField);
108 faceScalarDer(iVF.primitiveField().component(1),sVF.primitiveField().component(1),2,tField);
109 gradIVF.primitiveFieldRef().replace(7,tField);
111 faceScalarDer(iVF.primitiveField().component(2),sVF.primitiveField().component(2),0,tField);
112 gradIVF.primitiveFieldRef().replace(2,tField);
114 faceScalarDer(iVF.primitiveField().component(2),sVF.primitiveField().component(2),1,tField);
115 gradIVF.primitiveFieldRef().replace(5,tField);
117 faceScalarDer(iVF.primitiveField().component(2),sVF.primitiveField().component(2),2,tField);
118 gradIVF.primitiveFieldRef().replace(8,tField);
121 forAll(mesh_.boundaryMesh(), ipatch)
123 bool notConstrain =
true;
124 const fvPatch& fvp = mesh_.boundary()[ipatch];
127 isA<emptyFvPatch>(fvp) ||
128 isA<wedgeFvPatch>(fvp) ||
129 isA<coupledFvPatch>(fvp) ||
130 isA<symmetryFvPatch>(fvp) ||
131 isA<symmetryPlaneFvPatch>(fvp)
134 notConstrain =
false;
139 gradIVF.boundaryFieldRef()[ipatch] = nf_.boundaryField()[ipatch]*iVF.boundaryField()[ipatch].snGrad();
143 if(!Pstream::parRun())
148 List<List3<scalar>> procVfValues(nProcPatches_);
152 faceScalarDer(procVfValues[0],sVF.component(0),0,tField);
153 gradIVF.boundaryFieldRef().replace(0,tField.boundaryField());
155 faceScalarDer(procVfValues[0],sVF.component(0),1,tField);
156 gradIVF.boundaryFieldRef().replace(3,tField.boundaryField());
158 faceScalarDer(procVfValues[0],sVF.component(0),2,tField);
159 gradIVF.boundaryFieldRef().replace(6,tField.boundaryField());
161 faceScalarDer(procVfValues[1],sVF.component(1),0,tField);
162 gradIVF.boundaryFieldRef().replace(1,tField.boundaryField());
164 faceScalarDer(procVfValues[1],sVF.component(1),1,tField);
165 gradIVF.boundaryFieldRef().replace(4,tField.boundaryField());
167 faceScalarDer(procVfValues[1],sVF.component(1),2,tField);
168 gradIVF.boundaryFieldRef().replace(7,tField.boundaryField());
170 faceScalarDer(procVfValues[2],sVF.component(2),0,tField);
171 gradIVF.boundaryFieldRef().replace(2,tField.boundaryField());
173 faceScalarDer(procVfValues[2],sVF.component(2),1,tField);
174 gradIVF.boundaryFieldRef().replace(5,tField.boundaryField());
176 faceScalarDer(procVfValues[2],sVF.component(2),2,tField);
177 gradIVF.boundaryFieldRef().replace(8,tField.boundaryField());
192 surfaceVectorField sVF = linearInterpolate(iVF);
193 surfaceScalarField tField = sVF.component(0)*0;
194 tmp<surfaceScalarField> tdivIVF(0*nf_&fvc::snGrad(iVF));
195 surfaceScalarField& divIVF = tdivIVF.ref();
197 faceScalarDer(iVF.primitiveField().component(0),sVF.primitiveField().component(0),0,tField);
198 divIVF.primitiveFieldRef() = tField;
200 faceScalarDer(iVF.primitiveField().component(1),sVF.primitiveField().component(1),1,tField);
201 divIVF.primitiveFieldRef() += tField;
203 faceScalarDer(iVF.primitiveField().component(2),sVF.primitiveField().component(2),2,tField);
204 divIVF.primitiveFieldRef() += tField;
206 forAll(mesh_.boundaryMesh(), ipatch)
208 bool notConstrain =
true;
209 const fvPatch& fvp = mesh_.boundary()[ipatch];
212 isA<emptyFvPatch>(fvp) ||
213 isA<wedgeFvPatch>(fvp) ||
214 isA<coupledFvPatch>(fvp) ||
215 isA<symmetryFvPatch>(fvp) ||
216 isA<symmetryPlaneFvPatch>(fvp)
219 notConstrain =
false;
224 divIVF.boundaryFieldRef()[ipatch] = nf_.boundaryField()[ipatch] & iVF.boundaryField()[ipatch].snGrad();
228 if(!Pstream::parRun())
233 List<List3<scalar>> procVfValues(nProcPatches_);
237 faceScalarDer(procVfValues[0],sVF.component(0),0,tField);
238 divIVF.boundaryFieldRef() = tField.boundaryField();
240 faceScalarDer(procVfValues[1],sVF.component(1),1,tField);
241 divIVF.boundaryFieldRef() += tField.boundaryField();
243 faceScalarDer(procVfValues[2],sVF.component(2),2,tField);
244 divIVF.boundaryFieldRef() += tField.boundaryField();
259 surfaceTensorField sTF = linearInterpolate(iTF);
260 surfaceScalarField tField = sTF.component(0)*0;
261 tmp<surfaceVectorField> tdivITF(0*nf_*fvc::snGrad(iTF.component(0)));
262 surfaceVectorField& divITF = tdivITF.ref();
263 surfaceScalarField divComp = tField;
265 faceScalarDer(iTF.primitiveField().component(0),sTF.primitiveField().component(0),0,tField);
267 faceScalarDer(iTF.primitiveField().component(1),sTF.primitiveField().component(1),1,tField);
269 faceScalarDer(iTF.primitiveField().component(2),sTF.primitiveField().component(2),2,tField);
271 divITF.primitiveFieldRef().replace(0,divComp);
273 faceScalarDer(iTF.primitiveField().component(3),sTF.primitiveField().component(3),0,tField);
275 faceScalarDer(iTF.primitiveField().component(4),sTF.primitiveField().component(4),1,tField);
277 faceScalarDer(iTF.primitiveField().component(5),sTF.primitiveField().component(5),2,tField);
279 divITF.primitiveFieldRef().replace(1,divComp);
281 faceScalarDer(iTF.primitiveField().component(6),sTF.primitiveField().component(6),0,tField);
283 faceScalarDer(iTF.primitiveField().component(7),sTF.primitiveField().component(7),1,tField);
285 faceScalarDer(iTF.primitiveField().component(8),sTF.primitiveField().component(8),2,tField);
287 divITF.primitiveFieldRef().replace(2,divComp);
289 forAll(mesh_.boundaryMesh(), ipatch)
291 bool notConstrain =
true;
292 const fvPatch& fvp = mesh_.boundary()[ipatch];
295 isA<emptyFvPatch>(fvp) ||
296 isA<wedgeFvPatch>(fvp) ||
297 isA<coupledFvPatch>(fvp) ||
298 isA<symmetryFvPatch>(fvp) ||
299 isA<symmetryPlaneFvPatch>(fvp)
302 notConstrain =
false;
307 divITF.boundaryFieldRef()[ipatch] = nf_.boundaryField()[ipatch]
308 & iTF.boundaryField()[ipatch].snGrad();
313 if (!Pstream::parRun())
319 List<List3<scalar>> procVfValues(nProcPatches_);
322 faceScalarDer(procVfValues[0],sTF.component(0),0,tField);
324 faceScalarDer(procVfValues[1],sTF.component(1),1,tField);
326 faceScalarDer(procVfValues[2],sTF.component(2),2,tField);
328 divITF.boundaryFieldRef().replace(0,divComp.boundaryField());
330 faceScalarDer(procVfValues[3],sTF.component(3),0,tField);
332 faceScalarDer(procVfValues[4],sTF.component(4),1,tField);
334 faceScalarDer(procVfValues[5],sTF.component(5),2,tField);
336 divITF.boundaryFieldRef().replace(1,divComp.boundaryField());
338 faceScalarDer(procVfValues[6],sTF.component(6),0,tField);
340 faceScalarDer(procVfValues[7],sTF.component(7),1,tField);
342 faceScalarDer(procVfValues[8],sTF.component(8),2,tField);
344 divITF.boundaryFieldRef().replace(2,divComp.boundaryField());
This is a method for calculation the differential operators without tangential derivatives. They are further used in the calculation of the QGD terms.
tmp< surfaceScalarField > Div(const volVectorField &iVF)
Calculate divergence of volume vector field on the faces.
tmp< surfaceVectorField > Grad(const volScalarField &iF)
Calculate gradient of volume scalar function on the faces.
~leastSquaresOpt()
Destructor.
addToRunTimeSelectionTable(fvscStencil, GaussVolPoint, components)
leastSquaresOpt(const IOobject &)
Construct from IOobject. Optional flag for if IOobject is the.
defineTypeNameAndDebug(fvscStencil, 0)