2012-09-11 15:42:55 +00:00
|
|
|
//void volPointInterpolation::makeBoundaryWeights() const
|
|
|
|
//{
|
|
|
|
// const labelList& ptc = boundaryPoints();
|
|
|
|
|
|
|
|
// Calculate the correction vectors and weighting factors
|
|
|
|
//pointBoundaryWeightsPtr_ = new FieldField<Field, scalar>(ptc.size());
|
|
|
|
//FieldField<Field, scalar>& w = *pointBoundaryWeightsPtr_;
|
|
|
|
FieldField<Field, scalar> w(ptc.size());
|
|
|
|
|
|
|
|
{
|
2013-10-11 13:31:14 +00:00
|
|
|
const labelListList& pf = mesh.pointFaces();
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
const volVectorField& centres = mesh.C();
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
const fvBoundaryMesh& bm = mesh.boundary();
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
pointScalarField volPointSumWeights
|
2012-09-11 15:42:55 +00:00
|
|
|
(
|
2013-10-11 13:31:14 +00:00
|
|
|
IOobject
|
|
|
|
(
|
|
|
|
"volPointSumWeights",
|
|
|
|
mesh.polyMesh::instance(),
|
|
|
|
mesh
|
|
|
|
),
|
|
|
|
pMesh,
|
|
|
|
dimensionedScalar("zero", dimless, 0)
|
|
|
|
);
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
forAll (ptc, pointI)
|
2012-09-11 15:42:55 +00:00
|
|
|
{
|
2013-10-11 13:31:14 +00:00
|
|
|
const label curPoint = ptc[pointI];
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
const labelList& curFaces = pf[curPoint];
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
//w.hook(new scalarField(curFaces.size())); //philipc no hook function
|
|
|
|
w.set
|
|
|
|
(
|
2015-05-17 15:11:30 +00:00
|
|
|
pointI,
|
|
|
|
new scalarField(curFaces.size())
|
|
|
|
);
|
2013-10-11 13:31:14 +00:00
|
|
|
|
|
|
|
scalarField& curWeights = w[pointI];
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
label nFacesAroundPoint = 0;
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
const vector& pointLoc = mesh.points()[curPoint];
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
// Go through all the faces
|
|
|
|
forAll (curFaces, faceI)
|
2015-05-17 15:11:30 +00:00
|
|
|
{
|
|
|
|
if (!mesh.isInternalFace(curFaces[faceI]))
|
|
|
|
{
|
|
|
|
// This is a boundary face. If not in the empty patch
|
|
|
|
// or coupled calculate the extrapolation vector
|
|
|
|
label patchID =
|
|
|
|
mesh.boundaryMesh().whichPatch(curFaces[faceI]);
|
|
|
|
|
|
|
|
if
|
|
|
|
(
|
|
|
|
!isA<emptyFvPatch>(bm[patchID])
|
|
|
|
&& !(
|
|
|
|
bm[patchID].coupled()
|
|
|
|
//&& Pstream::parRun()
|
|
|
|
//&& !mesh.parallelData().cyclicParallel()
|
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
curWeights[nFacesAroundPoint] =
|
|
|
|
1.0/mag
|
|
|
|
(
|
|
|
|
pointLoc
|
|
|
|
- centres.boundaryField()[patchID]
|
|
|
|
[
|
|
|
|
bm[patchID].patch().whichFace(curFaces[faceI])
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
|
|
|
nFacesAroundPoint++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
// Reset the sizes of the local weights
|
|
|
|
curWeights.setSize(nFacesAroundPoint);
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
// Collect the sum of weights for parallel correction
|
|
|
|
volPointSumWeights[curPoint] += sum(curWeights);
|
2012-09-11 15:42:55 +00:00
|
|
|
}
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
// Do parallel correction of weights
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
// Update coupled boundaries
|
2014-06-01 18:12:52 +00:00
|
|
|
// Work-around for cyclic parallels.
|
2013-10-11 13:31:14 +00:00
|
|
|
/*if (Pstream::parRun() && !mesh.parallelData().cyclicParallel())
|
2012-09-11 15:42:55 +00:00
|
|
|
{
|
2013-10-11 13:31:14 +00:00
|
|
|
forAll (volPointSumWeights.boundaryField(), patchI)
|
|
|
|
{
|
|
|
|
if (volPointSumWeights.boundaryField()[patchI].coupled())
|
|
|
|
{
|
|
|
|
volPointSumWeights.boundaryField()[patchI].initAddField();
|
2012-09-11 15:42:55 +00:00
|
|
|
}
|
2013-10-11 13:31:14 +00:00
|
|
|
}
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
forAll (volPointSumWeights.boundaryField(), patchI)
|
|
|
|
{
|
|
|
|
if (volPointSumWeights.boundaryField()[patchI].coupled())
|
|
|
|
{
|
|
|
|
volPointSumWeights.boundaryField()[patchI].addField
|
|
|
|
(
|
|
|
|
volPointSumWeights.internalField()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}*/
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
// Re-scale the weights for the current point
|
|
|
|
forAll (ptc, pointI)
|
2012-09-11 15:42:55 +00:00
|
|
|
{
|
2013-10-11 13:31:14 +00:00
|
|
|
w[pointI] /= volPointSumWeights[ptc[pointI]];
|
2012-09-11 15:42:55 +00:00
|
|
|
}
|
|
|
|
}
|