particle: Fixed ACMI transfers

The optimisation work done as commit 81947c80 introduced a failure mode
where an ACMI interaction could repeat indefinitely. This has now been
corrected.

Resolves bug report https://bugs.openfoam.org/view.php?id=3166
This commit is contained in:
Will Bainbridge
2019-02-12 15:44:36 +00:00
parent 0d4d30aa29
commit 6b3f9c0b97
2 changed files with 40 additions and 5 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -564,6 +564,16 @@ public:
trackingData& td
);
//- As above, but does not change the master patch. Needed in order for
// ACMI to be able to delegate a hit to the non-overlap patch.
template<class TrackCloudType>
void hitFaceNoChangeToMasterPatch
(
const vector& displacement,
TrackCloudType& cloud,
trackingData& td
);
//- Convenience function. Cobines trackToFace and hitFace
template<class TrackCloudType>
void trackToAndHitFace

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -108,6 +108,33 @@ void Foam::particle::hitFace
trackingData& td
)
{
if (debug)
{
Info << "Particle " << origId() << nl << FUNCTION_NAME << nl << endl;
}
if (onBoundaryFace())
{
changeToMasterPatch();
}
hitFaceNoChangeToMasterPatch(direction, cloud, td);
}
template<class TrackCloudType>
void Foam::particle::hitFaceNoChangeToMasterPatch
(
const vector& direction,
TrackCloudType& cloud,
trackingData& td
)
{
if (debug)
{
Info << "Particle " << origId() << nl << FUNCTION_NAME << nl << endl;
}
typename TrackCloudType::particleType& p =
static_cast<typename TrackCloudType::particleType&>(*this);
typename TrackCloudType::particleType::trackingData& ttd =
@ -123,8 +150,6 @@ void Foam::particle::hitFace
}
else if (onBoundaryFace())
{
changeToMasterPatch();
if (!p.hitPatch(cloud, ttd))
{
const polyPatch& patch = mesh_.boundaryMesh()[p.patch()];
@ -392,7 +417,7 @@ void Foam::particle::hitCyclicACMIPatch
// Move to the face associated with the non-overlap patch and redo the
// face interaction.
tetFacei_ = facei_ = cpp.nonOverlapPatch().start() + localFacei;
hitFace(direction, cloud, td);
hitFaceNoChangeToMasterPatch(direction, cloud, td);
}
}