From 8427eccd0030527ccba744fe3a72076bbcf5f7ab Mon Sep 17 00:00:00 2001
From: sergio <s.ferraris@opencfd.co.uk>
Date: Fri, 28 Aug 2020 08:18:16 -0700
Subject: [PATCH] ENH: Triggering oldCellCentres calculation in Clouds

---
 src/lagrangian/basic/Cloud/Cloud.C   | 4 +++-
 src/lagrangian/basic/Cloud/CloudIO.C | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/lagrangian/basic/Cloud/Cloud.C b/src/lagrangian/basic/Cloud/Cloud.C
index 6ac60ed4dfd..0c04938a7b9 100644
--- a/src/lagrangian/basic/Cloud/Cloud.C
+++ b/src/lagrangian/basic/Cloud/Cloud.C
@@ -85,6 +85,7 @@ Foam::Cloud<ParticleType>::Cloud
     geometryType_(cloud::geometryType::COORDINATES)
 {
     checkPatches();
+    polyMesh_.oldCellCentres();
 
     // Ask for the tetBasePtIs to trigger all processors to build
     // them, otherwise, if some processors have no particles then
@@ -174,7 +175,7 @@ void Foam::Cloud<ParticleType>::move
     // Initialise the stepFraction moved for the particles
     forAllIters(*this, pIter)
     {
-        pIter().stepFraction() = 0;
+        pIter().reset();
     }
 
     // List of lists of particles to be transferred for all of the
@@ -360,6 +361,7 @@ void Foam::Cloud<ParticleType>::autoMap(const mapPolyMesh& mapper)
     // them, otherwise, if some processors have no particles then
     // there is a comms mismatch.
     polyMesh_.tetBasePtIs();
+    polyMesh_.oldCellCentres();
 
     const vectorField& positions = globalPositionsPtr_();
 
diff --git a/src/lagrangian/basic/Cloud/CloudIO.C b/src/lagrangian/basic/Cloud/CloudIO.C
index 6c375948470..20c1758f76c 100644
--- a/src/lagrangian/basic/Cloud/CloudIO.C
+++ b/src/lagrangian/basic/Cloud/CloudIO.C
@@ -177,6 +177,9 @@ Foam::Cloud<ParticleType>::Cloud
 {
     checkPatches();
 
+    polyMesh_.tetBasePtIs();
+    polyMesh_.oldCellCentres();
+
     initCloud(checkClass);
 }
 
-- 
GitLab