WIP: AMI - knock out connections with invalid interpolated delta vectors
This commit is contained in:
parent
a083ebb7bf
commit
de8dd7a5cf
@ -1123,6 +1123,36 @@ void Foam::AMIInterpolation::normaliseWeights
|
||||
}
|
||||
|
||||
|
||||
void Foam::AMIInterpolation::removeSourceConnection(const label facei)
|
||||
{
|
||||
if (facei < 0 || facei > srcAddress_.size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Face index " << facei << " out of bonds"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
srcWeightsSum_[facei] = 0;
|
||||
srcWeights_[facei].clear();
|
||||
srcAddress_[facei].clear();
|
||||
}
|
||||
|
||||
|
||||
void Foam::AMIInterpolation::removeTargetConnection(const label facei)
|
||||
{
|
||||
if (facei < 0 || facei > tgtAddress_.size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Face index " << facei << " out of bonds"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
tgtWeightsSum_[facei] = 0;
|
||||
tgtWeights_[facei].clear();
|
||||
tgtAddress_[facei].clear();
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::AMIInterpolation::srcPointFace
|
||||
(
|
||||
const primitivePatch& srcPatch,
|
||||
|
@ -446,6 +446,54 @@ void Foam::cyclicAMIPolyPatch::resetAMI(const UList<point>& points) const
|
||||
{
|
||||
AMIPtr_->checkSymmetricWeights(true);
|
||||
}
|
||||
|
||||
|
||||
// Check connectivity
|
||||
if (applyLowWeightCorrection() || !AMIPtr_->requireMatch())
|
||||
{
|
||||
Info<< "AMI: performing connectivity checks" << endl;
|
||||
|
||||
const auto& C = boundaryMesh().mesh().cellCentres();
|
||||
|
||||
auto cosTheta =
|
||||
[&](const polyPatch& p1, const polyPatch& p2, const bool toSource)
|
||||
{
|
||||
const auto& Cf1 = p1.faceCentres();
|
||||
const auto& faceCells1 = p1.faceCells();
|
||||
|
||||
vectorField delta1(p1.size());
|
||||
forAll(delta1, i)
|
||||
{
|
||||
delta1[i] = Cf1[i] - C[faceCells1[i]];
|
||||
}
|
||||
|
||||
// Interpolate nbr delta to local (src) side using (uncorrected)
|
||||
// multiply-weighted op
|
||||
const AMIMultiplyWeightedOp<vector> cop(*AMIPtr_, toSource);
|
||||
AMIPtr_->interpolate(delta1, cop, UList<vector>::null());
|
||||
delta1.normalise();
|
||||
|
||||
return delta1 & p2.faceNormals();
|
||||
};
|
||||
|
||||
const scalarField ctSrc(cosTheta(*this, nbr, true));
|
||||
forAll(ctSrc, facei)
|
||||
{
|
||||
if (ctSrc[facei] < 0)
|
||||
{
|
||||
AMIPtr_->removeSourceConnection(facei);
|
||||
}
|
||||
}
|
||||
|
||||
const scalarField ctTgt(cosTheta(nbr, *this, false));
|
||||
forAll(ctTgt, facei)
|
||||
{
|
||||
if (ctTgt[facei] < 0)
|
||||
{
|
||||
AMIPtr_->removeTargetConnection(facei);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user