Skip to content
Permalink
Browse files

particle: Fixed AMI displacement check for transformations

  • Loading branch information...
Will Bainbridge
Will Bainbridge committed Apr 23, 2019
1 parent 6588424 commit 10ece84b48c08b95b833a3d7cd62c85b298a0b39
Showing with 26 additions and 31 deletions.
  1. +26 −31 src/lagrangian/basic/particle/particleTemplates.C
@@ -369,45 +369,17 @@ void Foam::particle::hitCyclicAMIPatch
// register as incomplete
facei_ = tetFacei_;

// Get the receive patch data
vector receiveNormal, receiveDisplacement;
if (onBoundaryFace())
{
patchData(receiveNormal, receiveDisplacement);
}
else
{
receiveNormal = receiveCpp.faceNormals()[receiveFacei];
}

// If the displacement points into the receiving face then issue a warning
// and remove the particle
if
(
onBoundaryFace()
&& ((displacement - fraction*receiveDisplacement) & receiveNormal) > 0
)
{
td.keepParticle = false;
WarningInFunction
<< "Particle transfer from " << cyclicAMIPolyPatch::typeName
<< " patches " << cpp.name() << " to " << receiveCpp.name()
<< " failed at position " << pos << " and with displacement "
<< (displacement - fraction*receiveDisplacement) << nl
<< " The displacement points into both the source and receiving "
<< "faces, so the tracking cannot proceed" << nl
<< " The particle has been removed" << nl << endl;
return;
}

// Transform the properties
vector displacementT = displacement;

const vectorTensorTransform AMITransform =
receiveCpp.owner()
? receiveCpp.AMITransforms()[receiveAMIi]
: inv(cpp.AMITransforms()[receiveAMIi]);
if (AMITransform.hasR())
{
transformProperties(AMITransform.R());
displacementT = transform(AMITransform.R(), displacementT);
}
else if (AMITransform.t() != vector::zero)
{
@@ -423,6 +395,7 @@ void Foam::particle::hitCyclicAMIPatch
: receiveCpp.forwardT()[facei_]
);
transformProperties(T);
displacementT = transform(T, displacementT);
}
else if (receiveCpp.separated())
{
@@ -434,6 +407,28 @@ void Foam::particle::hitCyclicAMIPatch
);
transformProperties(-s);
}

// If on a boundary and the displacement points into the receiving face
// then issue a warning and remove the particle
if (onBoundaryFace())
{
vector receiveNormal, receiveDisplacement;
patchData(receiveNormal, receiveDisplacement);

if (((displacementT - fraction*receiveDisplacement)&receiveNormal) > 0)
{
td.keepParticle = false;
WarningInFunction
<< "Particle transfer from " << cyclicAMIPolyPatch::typeName
<< " patches " << cpp.name() << " to " << receiveCpp.name()
<< " failed at position " << pos << " and with displacement "
<< (displacementT - fraction*receiveDisplacement) << nl
<< " The displacement points into both the source and "
<< "receiving faces, so the tracking cannot proceed" << nl
<< " The particle has been removed" << nl << endl;
return;
}
}
}


0 comments on commit 10ece84

Please sign in to comment.
You can’t perform that action at this time.