lagrangian: Made ACMI interactions insensitive to cell-face order

This commit is contained in:
Will Bainbridge
2017-08-11 10:22:03 +01:00
committed by Andrew Heather
parent 66349c60a1
commit f021409db3
3 changed files with 50 additions and 14 deletions

View File

@ -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,

View File

@ -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

View File

@ -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);
}