Skip to content
Snippets Groups Projects
Commit 9cae54b4 authored by Henry Weller's avatar Henry Weller
Browse files

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

parent 765b8185
No related branches found
No related tags found
No related merge requests found
...@@ -44,7 +44,11 @@ const Foam::scalar Foam::cyclicACMIPolyPatch::tolerance_ = 1e-6; ...@@ -44,7 +44,11 @@ const Foam::scalar Foam::cyclicACMIPolyPatch::tolerance_ = 1e-6;
void Foam::cyclicACMIPolyPatch::initPatchFaceAreas() const void Foam::cyclicACMIPolyPatch::initPatchFaceAreas() const
{ {
if (!empty() && faceAreas0_.empty()) if
(
!empty()
&& (faceAreas0_.empty() || boundaryMesh().mesh().moving())
)
{ {
faceAreas0_ = faceAreas(); faceAreas0_ = faceAreas();
} }
...@@ -52,9 +56,13 @@ void Foam::cyclicACMIPolyPatch::initPatchFaceAreas() const ...@@ -52,9 +56,13 @@ void Foam::cyclicACMIPolyPatch::initPatchFaceAreas() const
const cyclicACMIPolyPatch& nbrACMI = const cyclicACMIPolyPatch& nbrACMI =
refCast<const cyclicACMIPolyPatch>(this->neighbPatch()); 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 ...@@ -136,11 +144,10 @@ void Foam::cyclicACMIPolyPatch::setNeighbourFaceAreas() const
void Foam::cyclicACMIPolyPatch::initGeometry(PstreamBuffers& pBufs) void Foam::cyclicACMIPolyPatch::initGeometry(PstreamBuffers& pBufs)
{ {
// Initialise the AMI so that base geometry (e.g. cell volumes) are
// correctly evaluated
resetAMI();
cyclicAMIPolyPatch::initGeometry(pBufs); cyclicAMIPolyPatch::initGeometry(pBufs);
// Initialise the AMI
resetAMI();
} }
...@@ -157,6 +164,9 @@ void Foam::cyclicACMIPolyPatch::initMovePoints ...@@ -157,6 +164,9 @@ void Foam::cyclicACMIPolyPatch::initMovePoints
) )
{ {
cyclicAMIPolyPatch::initMovePoints(pBufs, p); cyclicAMIPolyPatch::initMovePoints(pBufs, p);
// Initialise the AMI
resetAMI();
} }
......
...@@ -71,7 +71,6 @@ Foam::vector Foam::cyclicAMIPolyPatch::findFaceNormalMaxRadius ...@@ -71,7 +71,6 @@ Foam::vector Foam::cyclicAMIPolyPatch::findFaceNormalMaxRadius
void Foam::cyclicAMIPolyPatch::calcTransforms() void Foam::cyclicAMIPolyPatch::calcTransforms()
{ {
// Half0
const cyclicAMIPolyPatch& half0 = *this; const cyclicAMIPolyPatch& half0 = *this;
vectorField half0Areas(half0.size()); vectorField half0Areas(half0.size());
forAll(half0, facei) forAll(half0, facei)
...@@ -79,7 +78,6 @@ void Foam::cyclicAMIPolyPatch::calcTransforms() ...@@ -79,7 +78,6 @@ void Foam::cyclicAMIPolyPatch::calcTransforms()
half0Areas[facei] = half0[facei].normal(half0.points()); half0Areas[facei] = half0[facei].normal(half0.points());
} }
// Half1
const cyclicAMIPolyPatch& half1 = neighbPatch(); const cyclicAMIPolyPatch& half1 = neighbPatch();
vectorField half1Areas(half1.size()); vectorField half1Areas(half1.size());
forAll(half1, facei) forAll(half1, facei)
...@@ -406,6 +404,9 @@ void Foam::cyclicAMIPolyPatch::resetAMI ...@@ -406,6 +404,9 @@ void Foam::cyclicAMIPolyPatch::resetAMI
void Foam::cyclicAMIPolyPatch::initGeometry(PstreamBuffers& pBufs) void Foam::cyclicAMIPolyPatch::initGeometry(PstreamBuffers& pBufs)
{ {
// Clear the invalid AMI
AMIPtr_.clear();
polyPatch::initGeometry(pBufs); polyPatch::initGeometry(pBufs);
} }
...@@ -431,6 +432,9 @@ void Foam::cyclicAMIPolyPatch::initMovePoints ...@@ -431,6 +432,9 @@ void Foam::cyclicAMIPolyPatch::initMovePoints
const pointField& p const pointField& p
) )
{ {
// Clear the invalid AMI
AMIPtr_.clear();
polyPatch::initMovePoints(pBufs, p); polyPatch::initMovePoints(pBufs, p);
// See below. Clear out any local geometry // See below. Clear out any local geometry
...@@ -447,19 +451,15 @@ void Foam::cyclicAMIPolyPatch::movePoints ...@@ -447,19 +451,15 @@ void Foam::cyclicAMIPolyPatch::movePoints
polyPatch::movePoints(pBufs, p); polyPatch::movePoints(pBufs, p);
calcTransforms(); 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) void Foam::cyclicAMIPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
{ {
polyPatch::initUpdateMesh(pBufs); // Clear the invalid AMI
AMIPtr_.clear(); AMIPtr_.clear();
polyPatch::initUpdateMesh(pBufs);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment