Skip to content
Snippets Groups Projects
Commit f021409d authored by Will Bainbridge's avatar Will Bainbridge Committed by Andrew Heather
Browse files

lagrangian: Made ACMI interactions insensitive to cell-face order

parent 66349c60
No related branches found
No related tags found
No related merge requests found
......@@ -435,6 +435,40 @@ void Foam::particle::changeCell()
}
void Foam::particle::changeToMasterPatch()
{
label thisPatch = patch();
forAll(mesh_.cells()[celli_], cellFaceI)
{
// Skip the current face and any internal faces
const label otherFaceI = mesh_.cells()[celli_][cellFaceI];
if (facei_ == otherFaceI || mesh_.isInternalFace(otherFaceI))
{
continue;
}
// Compare the two faces. If they are the same, chose the one with the
// lower patch index. In the case of an ACMI-wall pair, this will be
// the ACMI, which is what we want.
const class face& thisFace = mesh_.faces()[facei_];
const class face& otherFace = mesh_.faces()[otherFaceI];
if (face::compare(thisFace, otherFace) != 0)
{
const label otherPatch =
mesh_.boundaryMesh().whichPatch(otherFaceI);
if (thisPatch > otherPatch)
{
facei_ = otherFaceI;
thisPatch = otherPatch;
}
}
}
tetFacei_ = facei_;
}
void Foam::particle::locate
(
const vector& position,
......
......@@ -278,6 +278,13 @@ private:
//- Change cell. Called when the particle hits an internal face.
void changeCell();
//- Put the particle on the lowest indexed patch for the current set
// of coincident faces. In the case of an ACMI-wall pair, this will
// move the particle from the wall face to the ACMI face, because
// ACMI patches are always listed before their associated non-
// overlapping patch.
void changeToMasterPatch();
// Geometry changes
......
......@@ -206,32 +206,21 @@ void Foam::particle::hitFace
typename TrackData::cloudType::particleType& p =
static_cast<typename TrackData::cloudType::particleType&>(*this);
// No action is taken for tetPti_ for tetFacei_ here. These are handled
// by the patch interaction call or later during processor transfer.
const label origFacei = facei_;
label patchi = mesh_.boundaryMesh().whichPatch(facei_);
const tetIndices faceHitTetIs(celli_, tetFacei_, tetPti_);
if
(
!p.hitPatch
(
mesh_.boundaryMesh()[patchi],
mesh_.boundaryMesh()[patch()],
td,
patchi,
patch(),
stepFraction(),
faceHitTetIs
)
)
{
// Did patch interaction model switch patches?
if (facei_ != origFacei)
{
patchi = mesh_.boundaryMesh().whichPatch(facei_);
}
const polyPatch& patch = mesh_.boundaryMesh()[patchi];
const polyPatch& patch = mesh_.boundaryMesh()[this->patch()];
if (isA<wedgePolyPatch>(patch))
{
......@@ -311,6 +300,12 @@ void Foam::particle::trackToAndHitFace
)
{
trackToFace(direction, fraction);
if (onBoundaryFace())
{
changeToMasterPatch();
}
hitFace(direction, td);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment