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 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -564,6 +564,16 @@ public:
trackingData& td 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 //- Convenience function. Cobines trackToFace and hitFace
template<class TrackCloudType> template<class TrackCloudType>
void trackToAndHitFace void trackToAndHitFace

View File

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