From 54da290c287d2a84b41ddc41b09eb5c56e134ea7 Mon Sep 17 00:00:00 2001
From: Christoph Schwarzmeier <christoph.schwarzmeier@fau.de>
Date: Fri, 3 Feb 2023 14:24:37 +0100
Subject: [PATCH] Fix error in center of mass computation in FSLBM showcases

---
 apps/showcases/FreeSurface/RisingBubble.cpp | 6 +++---
 apps/showcases/FreeSurface/TaylorBubble.cpp | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/apps/showcases/FreeSurface/RisingBubble.cpp b/apps/showcases/FreeSurface/RisingBubble.cpp
index 09bef1b3f..8fc773876 100644
--- a/apps/showcases/FreeSurface/RisingBubble.cpp
+++ b/apps/showcases/FreeSurface/RisingBubble.cpp
@@ -122,9 +122,9 @@ class CenterOfMassComputer
          Vector3< cell_idx_t >(cellSum[0], cellSum[1], cellSum[2]); // use Vector3 to limit calls to MPI-reduce to one
       mpi::allReduceInplace< cell_idx_t >(cellSumVector, mpi::SUM);
 
-      (*centerOfMass_)[0] = real_c(cellSum[0]) / real_c(cellCount);
-      (*centerOfMass_)[1] = real_c(cellSum[1]) / real_c(cellCount);
-      (*centerOfMass_)[2] = real_c(cellSum[2]) / real_c(cellCount);
+      (*centerOfMass_)[0] = real_c(cellSumVector[0]) / real_c(cellCount);
+      (*centerOfMass_)[1] = real_c(cellSumVector[1]) / real_c(cellCount);
+      (*centerOfMass_)[2] = real_c(cellSumVector[2]) / real_c(cellCount);
    }
 
  private:
diff --git a/apps/showcases/FreeSurface/TaylorBubble.cpp b/apps/showcases/FreeSurface/TaylorBubble.cpp
index 9672337ed..a045cd6ac 100644
--- a/apps/showcases/FreeSurface/TaylorBubble.cpp
+++ b/apps/showcases/FreeSurface/TaylorBubble.cpp
@@ -123,9 +123,9 @@ class CenterOfMassComputer
          Vector3< cell_idx_t >(cellSum[0], cellSum[1], cellSum[2]); // use Vector3 to limit calls to MPI-reduce to one
       mpi::allReduceInplace< cell_idx_t >(cellSumVector, mpi::SUM);
 
-      (*centerOfMass_)[0] = real_c(cellSum[0]) / real_c(cellCount);
-      (*centerOfMass_)[1] = real_c(cellSum[1]) / real_c(cellCount);
-      (*centerOfMass_)[2] = real_c(cellSum[2]) / real_c(cellCount);
+      (*centerOfMass_)[0] = real_c(cellSumVector[0]) / real_c(cellCount);
+      (*centerOfMass_)[1] = real_c(cellSumVector[1]) / real_c(cellCount);
+      (*centerOfMass_)[2] = real_c(cellSumVector[2]) / real_c(cellCount);
    }
 
  private:
-- 
GitLab