Commit 9cae54b4 authored by Henry Weller's avatar Henry Weller
Browse files

cyclicAMIPolyPatch, cyclicACMIPolyPatch: Ensure geometry is updated correctly following mesh-motion

Resolves bug-report: http://www.openfoam.org/mantisbt/view.php?id=1664
parent 765b8185
......@@ -44,7 +44,11 @@ const Foam::scalar Foam::cyclicACMIPolyPatch::tolerance_ = 1e-6;
void Foam::cyclicACMIPolyPatch::initPatchFaceAreas() const
{
if (!empty() && faceAreas0_.empty())
if
(
!empty()
&& (faceAreas0_.empty() || boundaryMesh().mesh().moving())
)
{
faceAreas0_ = faceAreas();
}
......@@ -52,9 +56,13 @@ void Foam::cyclicACMIPolyPatch::initPatchFaceAreas() const
const cyclicACMIPolyPatch& nbrACMI =
refCast<const cyclicACMIPolyPatch>(this->neighbPatch());
if (!nbrACMI.empty() && nbrACMI.faceAreas0().empty())
if
(
!nbrACMI.empty()
&& (nbrACMI.faceAreas0().empty() || boundaryMesh().mesh().moving())
)
{
nbrACMI.initPatchFaceAreas();
nbrACMI.faceAreas0_ = nbrACMI.faceAreas();
}
}
......@@ -136,11 +144,10 @@ void Foam::cyclicACMIPolyPatch::setNeighbourFaceAreas() const
void Foam::cyclicACMIPolyPatch::initGeometry(PstreamBuffers& pBufs)
{
// Initialise the AMI so that base geometry (e.g. cell volumes) are
// correctly evaluated
resetAMI();
cyclicAMIPolyPatch::initGeometry(pBufs);
// Initialise the AMI
resetAMI();
}
......@@ -157,6 +164,9 @@ void Foam::cyclicACMIPolyPatch::initMovePoints
)
{
cyclicAMIPolyPatch::initMovePoints(pBufs, p);
// Initialise the AMI
resetAMI();
}
......
......@@ -71,7 +71,6 @@ Foam::vector Foam::cyclicAMIPolyPatch::findFaceNormalMaxRadius
void Foam::cyclicAMIPolyPatch::calcTransforms()
{
// Half0
const cyclicAMIPolyPatch& half0 = *this;
vectorField half0Areas(half0.size());
forAll(half0, facei)
......@@ -79,7 +78,6 @@ void Foam::cyclicAMIPolyPatch::calcTransforms()
half0Areas[facei] = half0[facei].normal(half0.points());
}
// Half1
const cyclicAMIPolyPatch& half1 = neighbPatch();
vectorField half1Areas(half1.size());
forAll(half1, facei)
......@@ -406,6 +404,9 @@ void Foam::cyclicAMIPolyPatch::resetAMI
void Foam::cyclicAMIPolyPatch::initGeometry(PstreamBuffers& pBufs)
{
// Clear the invalid AMI
AMIPtr_.clear();
polyPatch::initGeometry(pBufs);
}
......@@ -431,6 +432,9 @@ void Foam::cyclicAMIPolyPatch::initMovePoints
const pointField& p
)
{
// Clear the invalid AMI
AMIPtr_.clear();
polyPatch::initMovePoints(pBufs, p);
// See below. Clear out any local geometry
......@@ -447,19 +451,15 @@ void Foam::cyclicAMIPolyPatch::movePoints
polyPatch::movePoints(pBufs, p);
calcTransforms();
// Note: resetAMI is called whilst in geometry update. So the slave
// side might not have reached 'movePoints'. Is explicitly handled by
// - clearing geometry of neighbour inside initMovePoints
// - not using localPoints() inside resetAMI
resetAMI();
}
void Foam::cyclicAMIPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
{
polyPatch::initUpdateMesh(pBufs);
// Clear the invalid AMI
AMIPtr_.clear();
polyPatch::initUpdateMesh(pBufs);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment