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());
|
|
|
|
|
|
|
|
{
|
2015-05-17 14:25:35 +00:00
|
|
|
const labelListList& pf = mesh.pointFaces();
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2015-05-17 14:25:35 +00:00
|
|
|
const volVectorField& centres = mesh.C();
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2015-05-17 14:25:35 +00:00
|
|
|
const fvBoundaryMesh& bm = mesh.boundary();
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2015-05-17 14:25:35 +00:00
|
|
|
pointScalarField volPointSumWeights
|
2012-09-11 15:42:55 +00:00
|
|
|
(
|
2015-05-17 14:25:35 +00:00
|
|
|
IOobject
|
|
|
|
(
|
|
|
|
"volPointSumWeights",
|
|
|
|
mesh.polyMesh::instance(),
|
|
|
|
mesh
|
|
|
|
),
|
|
|
|
pMesh,
|
|
|
|
dimensionedScalar("zero", dimless, 0)
|
|
|
|
);
|
|
|
|
|
|
|
|
forAll (ptc, pointI)
|
2012-09-11 15:42:55 +00:00
|
|
|
{
|
2015-05-17 14:25:35 +00:00
|
|
|
const label curPoint = ptc[pointI];
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2015-05-17 14:25:35 +00:00
|
|
|
const labelList& curFaces = pf[curPoint];
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2015-05-17 14:25:35 +00:00
|
|
|
//w.hook(new scalarField(curFaces.size())); //philipc no hook function
|
|
|
|
w.set
|
2013-10-11 13:31:14 +00:00
|
|
|
(
|
2015-05-17 14:25:35 +00:00
|
|
|
pointI,
|
|
|
|
new scalarField(curFaces.size())
|
|
|
|
);
|
|
|
|
|
|
|
|
scalarField& curWeights = w[pointI];
|
|
|
|
|
|
|
|
label nFacesAroundPoint = 0;
|
|
|
|
|
|
|
|
const vector& pointLoc = mesh.points()[curPoint];
|
|
|
|
|
|
|
|
// Go through all the faces
|
|
|
|
forAll (curFaces, faceI)
|
|
|
|
{
|
|
|
|
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++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reset the sizes of the local weights
|
|
|
|
curWeights.setSize(nFacesAroundPoint);
|
|
|
|
|
|
|
|
// Collect the sum of weights for parallel correction
|
|
|
|
volPointSumWeights[curPoint] += sum(curWeights);
|
|
|
|
}
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2015-05-17 14:25:35 +00:00
|
|
|
// Do parallel correction of weights
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2015-05-17 14:25:35 +00:00
|
|
|
// Update coupled boundaries
|
|
|
|
// Work-around for cyclic parallels.
|
|
|
|
/*if (Pstream::parRun() && !mesh.parallelData().cyclicParallel())
|
2015-05-17 15:11:30 +00:00
|
|
|
{
|
2015-05-17 14:25:35 +00:00
|
|
|
forAll (volPointSumWeights.boundaryField(), patchI)
|
2015-05-17 15:11:30 +00:00
|
|
|
{
|
2015-05-17 14:25:35 +00:00
|
|
|
if (volPointSumWeights.boundaryField()[patchI].coupled())
|
|
|
|
{
|
|
|
|
volPointSumWeights.boundaryField()[patchI].initAddField();
|
|
|
|
}
|
|
|
|
}
|
2015-05-17 15:11:30 +00:00
|
|
|
|
2015-05-17 14:25:35 +00:00
|
|
|
forAll (volPointSumWeights.boundaryField(), patchI)
|
2015-05-17 15:11:30 +00:00
|
|
|
{
|
2015-05-17 14:25:35 +00:00
|
|
|
if (volPointSumWeights.boundaryField()[patchI].coupled())
|
|
|
|
{
|
|
|
|
volPointSumWeights.boundaryField()[patchI].addField
|
|
|
|
(
|
|
|
|
volPointSumWeights.internalField()
|
|
|
|
);
|
|
|
|
}
|
2015-05-17 15:11:30 +00:00
|
|
|
}
|
2013-10-11 13:31:14 +00:00
|
|
|
}*/
|
2014-06-01 18:12:52 +00:00
|
|
|
|
2015-05-17 14:25:35 +00:00
|
|
|
// Re-scale the weights for the current point
|
|
|
|
forAll (ptc, pointI)
|
2012-09-11 15:42:55 +00:00
|
|
|
{
|
2015-05-17 14:25:35 +00:00
|
|
|
w[pointI] /= volPointSumWeights[ptc[pointI]];
|
2012-09-11 15:42:55 +00:00
|
|
|
}
|
|
|
|
}
|