From f96f883ea487fdad86b62701aa65c6910c0a92ab Mon Sep 17 00:00:00 2001
From: mattijs <mattijs@hunt.opencfd.co.uk>
Date: Thu, 16 Jul 2009 16:02:33 +0100
Subject: [PATCH] avoiding usage of Sf (triggers rebuild of S) in autoMap since
 upsets mapping

---
 .../activeBaffleVelocityFvPatchVectorField.C  | 22 ++++++++++++++-----
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C
index c090d529687..abc46197060 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C
@@ -157,8 +157,15 @@ void Foam::activeBaffleVelocityFvPatchVectorField::autoMap
     //- Note: cannot map field from cyclic patch anyway so just recalculate
     //  Areas should be consistent when doing autoMap except in case of
     //  topo changes.
-    initWallSf_ = patch().Sf();
-    initCyclicSf_ = patch().boundaryMesh()[cyclicPatchLabel_].Sf();
+    //- Note: we don't want to use Sf here since triggers rebuilding of
+    //  fvMesh::S() which will give problems when mapped (since already
+    //  on new mesh)
+    const vectorField& areas = patch().boundaryMesh().mesh().faceAreas();
+    initWallSf_ = patch().patchSlice(areas);
+    initCyclicSf_ = patch().boundaryMesh()
+    [
+        cyclicPatchLabel_
+    ].patchSlice(areas);
 }
 
 void Foam::activeBaffleVelocityFvPatchVectorField::rmap
@@ -169,10 +176,13 @@ void Foam::activeBaffleVelocityFvPatchVectorField::rmap
 {
     fixedValueFvPatchVectorField::rmap(ptf, addr);
 
-    //- Note: cannot map field from cyclic patch anyway so just recalculate
-    //  Areas should be consistent when doing rmap (mainly reconstructPar)
-    initWallSf_ = patch().Sf();
-    initCyclicSf_ = patch().boundaryMesh()[cyclicPatchLabel_].Sf();
+    // See autoMap.
+    const vectorField& areas = patch().boundaryMesh().mesh().faceAreas();
+    initWallSf_ = patch().patchSlice(areas);
+    initCyclicSf_ = patch().boundaryMesh()
+    [
+        cyclicPatchLabel_
+    ].patchSlice(areas);
 }
 
 
-- 
GitLab