From 7de07fd8baf35bedc75aa5256702f94bd3e541a6 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Wed, 29 Jun 2022 10:03:56 +0100
Subject: [PATCH] BUG: cyclicACMI: update face areas on lower levels. Fixes
 #2394

In movePoints had some duplicated code but did not update the
lower level (polyPatch) areas. This caused scaling to be applied
multiple times (so only 1.0 would not be affected)
---
 .../constraint/cyclicACMI/cyclicACMIFvPatch.C | 28 +++++--------------
 1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicACMI/cyclicACMIFvPatch.C b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicACMI/cyclicACMIFvPatch.C
index b573d3a2b26..3e6db16b4df 100644
--- a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicACMI/cyclicACMIFvPatch.C
+++ b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicACMI/cyclicACMIFvPatch.C
@@ -311,36 +311,25 @@ Foam::tmp<Foam::labelField> Foam::cyclicACMIFvPatch::internalFieldTransfer
 
 void Foam::cyclicACMIFvPatch::movePoints()
 {
-    if (!cyclicACMIPolyPatch_.owner())
-    {
-        return;
-    }
+    // Update local and higher level areas
+    const bool updated = updateAreas();
 
-
-    if (!cyclicACMIPolyPatch_.upToDate(areaTime_))
+    // If anything changed update the mesh flux
+    if (cyclicACMIPolyPatch_.owner() && updated)
     {
         if (debug)
         {
-            Pout<< "cyclicACMIFvPatch::movePoints() : updating fv areas for "
-                << name() << " and " << this->nonOverlapPatch().name()
+            Pout<< "cyclicACMIFvPatch::movePoints() : areas updated for "
+                << name() << "; updating mesh flux now"
                 << endl;
         }
 
-
-        // Set the patch face areas to be consistent with the changes made
-        // at the polyPatch level
+        // Scale the mesh flux
 
         const fvPatch& nonOverlapPatch = this->nonOverlapPatch();
         const cyclicACMIFvPatch& nbrACMI = neighbPatch();
         const fvPatch& nbrNonOverlapPatch = nbrACMI.nonOverlapPatch();
 
-        resetPatchAreas(*this);
-        resetPatchAreas(nonOverlapPatch);
-        resetPatchAreas(nbrACMI);
-        resetPatchAreas(nbrNonOverlapPatch);
-
-        // Scale the mesh flux
-
         const labelListList& newSrcAddr = AMI().srcAddress();
         const labelListList& newTgtAddr = AMI().tgtAddress();
 
@@ -410,9 +399,6 @@ void Foam::cyclicACMIFvPatch::movePoints()
             const scalar w = 1.0 - cyclicACMIPolyPatch_.tgtMask()[facei];
             nbrPhiNonOverlapp[facei] *= w;
         }
-
-        // Mark my data to be up to date with ACMI polyPatch level
-        cyclicACMIPolyPatch_.setUpToDate(areaTime_);
     }
 }
 
-- 
GitLab